Skip to content

Commit 42fec0f

Browse files
committed
add smoke test for CVODE solver
1 parent b9988df commit 42fec0f

13 files changed

+1462
-13
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@
2222

2323
NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat
2424
NFsim_v1.11/tests/smoke/SimID_273069657_0_.species
25+
26+
IDAWin/tests/smoke/SimID_1489333437_0_.ida

IDAWin/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ install(TARGETS IDAWin ARCHIVE DESTINATION bin)
3535

3636
enable_testing()
3737

38+
if (MINGW)
39+
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE}.exe)
40+
set(python_cmd py)
41+
else (MINGW)
42+
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE})
43+
set(python_cmd python3)
44+
endif (MINGW)
45+
set(test_dir ${CMAKE_CURRENT_SOURCE_DIR}/tests/smoke)
46+
47+
# smoke test as a python script, for bash test example, see NFsim/tests/smoke
48+
add_test(NAME ${EXE_FILE}_smoke COMMAND ${python_cmd} ${test_dir}/smoke.py ${test_sundials_exe} WORKING_DIRECTORY ${test_dir})
49+
50+
3851
add_executable(
3952
hello_test
4053
hello_test.cpp

IDAWin/SundialsSolverStandalone.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ int main(int argc, char *argv[]) {
194194
break;
195195
}
196196
}
197+
#ifdef USE_MESSAGING
198+
// should only happen during testing for solver compiled with messaging but run locally.
199+
if (SimulationMessaging::getInstVar() == nullptr) {
200+
SimulationMessaging::create();
201+
}
202+
#endif
197203

198204
if (solver.empty()) {
199205
throw "Solver not defined ";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SOLVER CVODE
2+
STARTING_TIME 0.0
3+
ENDING_TIME 1.0
4+
RELATIVE_TOLERANCE 1.0E-9
5+
ABSOLUTE_TOLERANCE 1.0E-9
6+
MAX_TIME_STEP 1.0
7+
OUTPUT_TIMES 8
8+
0.0 1.0E-5 1.0E-4 0.001 0.01 0.1 0.5 1.0
9+
NUM_EQUATIONS 2
10+
ODE s2 INIT 4.0;
11+
RATE - ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2))));
12+
ODE s4 INIT 0.0;
13+
RATE 0.0;
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
##---------------------------------------------
2+
## /Users/jimschaff/.vcell/simdata/temp/SimID_1489333437_0_.functions
3+
##---------------------------------------------
4+
5+
Compartment::J_r0; ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2)))); ; Nonspatial_VariableType; false
6+
Compartment::J_r1; 0.0; ; Nonspatial_VariableType; false
7+
Compartment::s0; (2.0 * (-1.0 + (0.5 * s2))); ; Nonspatial_VariableType; false
8+
Compartment::s1; (2.0 * (3.5 - (0.5 * s2))); ; Nonspatial_VariableType; false
9+
Compartment::s3; - s4; ; Nonspatial_VariableType; false
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
t:s2:s4:
2+
0.00000000000000000E+00 4.00000000000000000E+00 0.00000000000000000E+00
3+
1.00000000000000008E-05 3.99998000095349759E+00 0.00000000000000000E+00
4+
1.00000000000000005E-04 3.99980008070643711E+00 0.00000000000000000E+00
5+
1.00000000000000002E-03 3.99800797408532871E+00 0.00000000000000000E+00
6+
1.00000000000000002E-02 3.98077784306128457E+00 0.00000000000000000E+00
7+
1.00000000000000006E-01 3.86170998966032331E+00 0.00000000000000000E+00
8+
5.00000000000000000E-01 3.74758417187014503E+00 0.00000000000000000E+00
9+
1.00000000000000000E+00 3.74179783773998942E+00 0.00000000000000000E+00
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
IDAData logfile
2+
IDAData text format version 1
3+
SimID_1489333437_0_.ida
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<SimulationTask xmlns="http://sourceforge.net/projects/vcell/vcml" TaskId="0" JobIndex="0" isPowerUser="false">
2+
<MathDescription Name="Application0_generated">
3+
<Constant Name="_F_">96485.3321</Constant>
4+
<Constant Name="_F_nmol_">9.64853321E-5</Constant>
5+
<Constant Name="_K_GHK_">1.0E-9</Constant>
6+
<Constant Name="_N_pmol_">6.02214179E11</Constant>
7+
<Constant Name="_PI_">3.141592653589793</Constant>
8+
<Constant Name="_R_">8314.46261815</Constant>
9+
<Constant Name="_T_">300.0</Constant>
10+
<Constant Name="K_millivolts_per_volt">1000.0</Constant>
11+
<Constant Name="Kf_r0">1.0</Constant>
12+
<Constant Name="Kf_r1">0.0</Constant>
13+
<Constant Name="KMOLE">0.001660538783162726</Constant>
14+
<Constant Name="Kr_r0">2.0</Constant>
15+
<Constant Name="Kr_r1">0.0</Constant>
16+
<Constant Name="s0_init_uM">2.0</Constant>
17+
<Constant Name="s1_init_uM">3.0</Constant>
18+
<Constant Name="s2_init_uM">4.0</Constant>
19+
<Constant Name="s3_init_uM">0.0</Constant>
20+
<Constant Name="s4_init_uM">0.0</Constant>
21+
<Constant Name="Size_c0">0.5</Constant>
22+
<VolumeVariable Name="s2" Domain="Compartment" />
23+
<VolumeVariable Name="s4" Domain="Compartment" />
24+
<Function Name="J_r0" Domain="Compartment">(((Kf_r0 * s0) * s2) - (Kr_r0 * s1))</Function>
25+
<Function Name="J_r1" Domain="Compartment">((Kf_r1 * s3) - (Kr_r1 * s4))</Function>
26+
<Function Name="K_s0_total" Domain="Compartment">((Size_c0 * s0_init_uM) - (Size_c0 * s2_init_uM))</Function>
27+
<Function Name="K_s1_total" Domain="Compartment">((Size_c0 * s1_init_uM) + (Size_c0 * s2_init_uM))</Function>
28+
<Function Name="K_s3_total" Domain="Compartment">((Size_c0 * s3_init_uM) + (Size_c0 * s4_init_uM))</Function>
29+
<Function Name="s0" Domain="Compartment">((K_s0_total + (Size_c0 * s2)) / Size_c0)</Function>
30+
<Function Name="s1" Domain="Compartment">((K_s1_total - (Size_c0 * s2)) / Size_c0)</Function>
31+
<Function Name="s3" Domain="Compartment">((K_s3_total - (Size_c0 * s4)) / Size_c0)</Function>
32+
<CompartmentSubDomain Name="Compartment">
33+
<BoundaryType Boundary="Xm" Type="Value" />
34+
<BoundaryType Boundary="Xp" Type="Value" />
35+
<BoundaryType Boundary="Ym" Type="Value" />
36+
<BoundaryType Boundary="Yp" Type="Value" />
37+
<BoundaryType Boundary="Zm" Type="Value" />
38+
<BoundaryType Boundary="Zp" Type="Value" />
39+
<OdeEquation Name="s2" SolutionType="Unknown">
40+
<Rate>- J_r0</Rate>
41+
<Initial>s2_init_uM</Initial>
42+
</OdeEquation>
43+
<OdeEquation Name="s4" SolutionType="Unknown">
44+
<Rate>J_r1</Rate>
45+
<Initial>s4_init_uM</Initial>
46+
</OdeEquation>
47+
</CompartmentSubDomain>
48+
<Version Name="Application0_generated" KeyValue="95705054" BranchId="95705055" Archived="0" Date="06-Aug-2015 13:27:28" FromVersionable="false">
49+
<Owner Name="schaff" Identifier="17" />
50+
<GroupAccess Type="1" />
51+
</Version>
52+
</MathDescription>
53+
<Simulation Name="Simulation0">
54+
<SolverTaskDescription TaskType="Unsteady" UseSymbolicJacobian="false" Solver="Combined Stiff Solver (IDA/CVODE)">
55+
<TimeBound StartTime="0.0" EndTime="1.0" />
56+
<TimeStep DefaultTime="0.1" MinTime="1.0E-8" MaxTime="1.0" />
57+
<ErrorTolerance Absolut="1.0E-9" Relative="1.0E-9" />
58+
<OutputOptions OutputTimes="0.0,1.0E-5,1.0E-4,0.001,0.01,0.1,0.5,1.0" />
59+
<NumberProcessors>1</NumberProcessors>
60+
</SolverTaskDescription>
61+
<MathOverrides />
62+
<Version Name="temp simulation" KeyValue="1489333437" BranchId="1" Archived="1" Date="28-Jul-2024 18:28:21" FromVersionable="false">
63+
<Owner Name="temp" Identifier="123" />
64+
<GroupAccess Type="1" />
65+
</Version>
66+
</Simulation>
67+
<Geometry Name="non-spatial420951543" Dimension="0">
68+
<Extent X="10.0" Y="10.0" Z="10.0" />
69+
<Origin X="0.0" Y="0.0" Z="0.0" />
70+
<SubVolume Name="Compartment" Handle="0" Type="Compartmental" KeyValue="95705043" />
71+
<Version Name="non-spatial420951543" KeyValue="95705039" BranchId="95705040" Archived="0" Date="06-Aug-2015 13:27:28" FromVersionable="false">
72+
<Owner Name="schaff" Identifier="17" />
73+
<GroupAccess Type="1" />
74+
</Version>
75+
</Geometry>
76+
</SimulationTask>

0 commit comments

Comments
 (0)