Skip to content

Commit

Permalink
add smoke test for CVODE solver
Browse files Browse the repository at this point in the history
  • Loading branch information
jcschaff committed Jul 29, 2024
1 parent b9988df commit 42fec0f
Show file tree
Hide file tree
Showing 13 changed files with 1,462 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@

NFsim_v1.11/tests/smoke/SimID_273069657_0_.gdat
NFsim_v1.11/tests/smoke/SimID_273069657_0_.species

IDAWin/tests/smoke/SimID_1489333437_0_.ida
13 changes: 13 additions & 0 deletions IDAWin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ install(TARGETS IDAWin ARCHIVE DESTINATION bin)

enable_testing()

if (MINGW)
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE}.exe)
set(python_cmd py)
else (MINGW)
set(test_sundials_exe ${CMAKE_BINARY_DIR}/bin/${EXE_FILE})
set(python_cmd python3)
endif (MINGW)
set(test_dir ${CMAKE_CURRENT_SOURCE_DIR}/tests/smoke)

# smoke test as a python script, for bash test example, see NFsim/tests/smoke
add_test(NAME ${EXE_FILE}_smoke COMMAND ${python_cmd} ${test_dir}/smoke.py ${test_sundials_exe} WORKING_DIRECTORY ${test_dir})


add_executable(
hello_test
hello_test.cpp
Expand Down
6 changes: 6 additions & 0 deletions IDAWin/SundialsSolverStandalone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ int main(int argc, char *argv[]) {
break;
}
}
#ifdef USE_MESSAGING
// should only happen during testing for solver compiled with messaging but run locally.
if (SimulationMessaging::getInstVar() == nullptr) {
SimulationMessaging::create();
}
#endif

if (solver.empty()) {
throw "Solver not defined ";
Expand Down
14 changes: 14 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.cvodeInput
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SOLVER CVODE
STARTING_TIME 0.0
ENDING_TIME 1.0
RELATIVE_TOLERANCE 1.0E-9
ABSOLUTE_TOLERANCE 1.0E-9
MAX_TIME_STEP 1.0
OUTPUT_TIMES 8
0.0 1.0E-5 1.0E-4 0.001 0.01 0.1 0.5 1.0
NUM_EQUATIONS 2
ODE s2 INIT 4.0;
RATE - ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2))));
ODE s4 INIT 0.0;
RATE 0.0;

10 changes: 10 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
##---------------------------------------------
## /Users/jimschaff/.vcell/simdata/temp/SimID_1489333437_0_.functions
##---------------------------------------------

Compartment::J_r0; ((2.0 * (-1.0 + (0.5 * s2)) * s2) - (4.0 * (3.5 - (0.5 * s2)))); ; Nonspatial_VariableType; false
Compartment::J_r1; 0.0; ; Nonspatial_VariableType; false
Compartment::s0; (2.0 * (-1.0 + (0.5 * s2))); ; Nonspatial_VariableType; false
Compartment::s1; (2.0 * (3.5 - (0.5 * s2))); ; Nonspatial_VariableType; false
Compartment::s3; - s4; ; Nonspatial_VariableType; false

9 changes: 9 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.ida.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
t:s2:s4:
0.00000000000000000E+00 4.00000000000000000E+00 0.00000000000000000E+00
1.00000000000000008E-05 3.99998000095349759E+00 0.00000000000000000E+00
1.00000000000000005E-04 3.99980008070643711E+00 0.00000000000000000E+00
1.00000000000000002E-03 3.99800797408532871E+00 0.00000000000000000E+00
1.00000000000000002E-02 3.98077784306128457E+00 0.00000000000000000E+00
1.00000000000000006E-01 3.86170998966032331E+00 0.00000000000000000E+00
5.00000000000000000E-01 3.74758417187014503E+00 0.00000000000000000E+00
1.00000000000000000E+00 3.74179783773998942E+00 0.00000000000000000E+00
3 changes: 3 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0_.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
IDAData logfile
IDAData text format version 1
SimID_1489333437_0_.ida
76 changes: 76 additions & 0 deletions IDAWin/tests/smoke/SimID_1489333437_0__0.simtask.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<SimulationTask xmlns="http://sourceforge.net/projects/vcell/vcml" TaskId="0" JobIndex="0" isPowerUser="false">
<MathDescription Name="Application0_generated">
<Constant Name="_F_">96485.3321</Constant>
<Constant Name="_F_nmol_">9.64853321E-5</Constant>
<Constant Name="_K_GHK_">1.0E-9</Constant>
<Constant Name="_N_pmol_">6.02214179E11</Constant>
<Constant Name="_PI_">3.141592653589793</Constant>
<Constant Name="_R_">8314.46261815</Constant>
<Constant Name="_T_">300.0</Constant>
<Constant Name="K_millivolts_per_volt">1000.0</Constant>
<Constant Name="Kf_r0">1.0</Constant>
<Constant Name="Kf_r1">0.0</Constant>
<Constant Name="KMOLE">0.001660538783162726</Constant>
<Constant Name="Kr_r0">2.0</Constant>
<Constant Name="Kr_r1">0.0</Constant>
<Constant Name="s0_init_uM">2.0</Constant>
<Constant Name="s1_init_uM">3.0</Constant>
<Constant Name="s2_init_uM">4.0</Constant>
<Constant Name="s3_init_uM">0.0</Constant>
<Constant Name="s4_init_uM">0.0</Constant>
<Constant Name="Size_c0">0.5</Constant>
<VolumeVariable Name="s2" Domain="Compartment" />
<VolumeVariable Name="s4" Domain="Compartment" />
<Function Name="J_r0" Domain="Compartment">(((Kf_r0 * s0) * s2) - (Kr_r0 * s1))</Function>
<Function Name="J_r1" Domain="Compartment">((Kf_r1 * s3) - (Kr_r1 * s4))</Function>
<Function Name="K_s0_total" Domain="Compartment">((Size_c0 * s0_init_uM) - (Size_c0 * s2_init_uM))</Function>
<Function Name="K_s1_total" Domain="Compartment">((Size_c0 * s1_init_uM) + (Size_c0 * s2_init_uM))</Function>
<Function Name="K_s3_total" Domain="Compartment">((Size_c0 * s3_init_uM) + (Size_c0 * s4_init_uM))</Function>
<Function Name="s0" Domain="Compartment">((K_s0_total + (Size_c0 * s2)) / Size_c0)</Function>
<Function Name="s1" Domain="Compartment">((K_s1_total - (Size_c0 * s2)) / Size_c0)</Function>
<Function Name="s3" Domain="Compartment">((K_s3_total - (Size_c0 * s4)) / Size_c0)</Function>
<CompartmentSubDomain Name="Compartment">
<BoundaryType Boundary="Xm" Type="Value" />
<BoundaryType Boundary="Xp" Type="Value" />
<BoundaryType Boundary="Ym" Type="Value" />
<BoundaryType Boundary="Yp" Type="Value" />
<BoundaryType Boundary="Zm" Type="Value" />
<BoundaryType Boundary="Zp" Type="Value" />
<OdeEquation Name="s2" SolutionType="Unknown">
<Rate>- J_r0</Rate>
<Initial>s2_init_uM</Initial>
</OdeEquation>
<OdeEquation Name="s4" SolutionType="Unknown">
<Rate>J_r1</Rate>
<Initial>s4_init_uM</Initial>
</OdeEquation>
</CompartmentSubDomain>
<Version Name="Application0_generated" KeyValue="95705054" BranchId="95705055" Archived="0" Date="06-Aug-2015 13:27:28" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
</Version>
</MathDescription>
<Simulation Name="Simulation0">
<SolverTaskDescription TaskType="Unsteady" UseSymbolicJacobian="false" Solver="Combined Stiff Solver (IDA/CVODE)">
<TimeBound StartTime="0.0" EndTime="1.0" />
<TimeStep DefaultTime="0.1" MinTime="1.0E-8" MaxTime="1.0" />
<ErrorTolerance Absolut="1.0E-9" Relative="1.0E-9" />
<OutputOptions OutputTimes="0.0,1.0E-5,1.0E-4,0.001,0.01,0.1,0.5,1.0" />
<NumberProcessors>1</NumberProcessors>
</SolverTaskDescription>
<MathOverrides />
<Version Name="temp simulation" KeyValue="1489333437" BranchId="1" Archived="1" Date="28-Jul-2024 18:28:21" FromVersionable="false">
<Owner Name="temp" Identifier="123" />
<GroupAccess Type="1" />
</Version>
</Simulation>
<Geometry Name="non-spatial420951543" Dimension="0">
<Extent X="10.0" Y="10.0" Z="10.0" />
<Origin X="0.0" Y="0.0" Z="0.0" />
<SubVolume Name="Compartment" Handle="0" Type="Compartmental" KeyValue="95705043" />
<Version Name="non-spatial420951543" KeyValue="95705039" BranchId="95705040" Archived="0" Date="06-Aug-2015 13:27:28" FromVersionable="false">
<Owner Name="schaff" Identifier="17" />
<GroupAccess Type="1" />
</Version>
</Geometry>
</SimulationTask>
Loading

0 comments on commit 42fec0f

Please sign in to comment.