Skip to content

Commit

Permalink
[Test] Add test of VCS equilibrium solver with higher loglevel
Browse files Browse the repository at this point in the history
This improves the overall coverage of the test suite, since otherwise much
of the logging code in the VCS solver is not executed.
  • Loading branch information
speth committed Apr 8, 2016
1 parent 919045e commit 1a64a23
Show file tree
Hide file tree
Showing 3 changed files with 566 additions and 6 deletions.
12 changes: 9 additions & 3 deletions test_problems/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,15 @@ CompileAndTest('VCS-NaCl', 'VCSnonideal/NaCl_equil',
'nacl_equil', 'good_out.txt',
options='-d 3',
artifacts=['vcs_equilibrate_res.csv']), # not testing this file because it's not really csv
CompileAndTest('VCS-LiSi', 'VCSnonideal/LatticeSolid_LiSi',
'latticeSolid_LiSi', 'output_blessed.txt',
artifacts=['vcs_equilibrate_res.csv'])
vcs_LiSi = localenv.Program('VCSnonideal/LatticeSolid_LiSi/latsol',
'VCSnonideal/LatticeSolid_LiSi/latsol.cpp',
LIBS=cantera_libs)
vcs_LiSi_name = vcs_LiSi[0].name
Test('VCS-LiSi', 'VCSnonideal/LatticeSolid_LiSi', vcs_LiSi, 'output_blessed.txt',
artifacts=['vcs_equilibrate_res.csv', vcs_LiSi_name])
Test('VCS-LiSi-verbose', 'VCSnonideal/LatticeSolid_LiSi', vcs_LiSi, 'verbose_blessed.txt',
options='8',
artifacts=['vcs_equilibrate_res.csv', vcs_LiSi_name])
CompileAndTest('VPsilane_test', 'VPsilane_test', 'VPsilane_test', 'output_blessed.txt')

# Force explicitly-named tests to run even if SCons thinks they're up to date
Expand Down
9 changes: 6 additions & 3 deletions test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using namespace Cantera;

void testProblem()
void testProblem(int printLvl)
{
double T = 273.15 + 352.0;
vcs_timing_print_lvl = 0;
Expand Down Expand Up @@ -53,7 +53,6 @@ void testProblem()
mmm.addPhase(LiSi_solid.get(), 1.);
mmm.addPhase(&LiFixed, 100.);

int printLvl = 3;
int estimateEquil = 0;

mmm.equilibrate("TP", "vcs", 1e-9, 50000, 100, estimateEquil, printLvl);
Expand All @@ -64,8 +63,12 @@ void testProblem()

int main(int argc, char** argv)
{
int printLvl = 3;
if (argc > 1) {
printLvl = atoi(argv[1]);
}
try {
testProblem();
testProblem(printLvl);
return 0;
} catch (CanteraError& err) {
std::cout << err.what() << std::endl;
Expand Down
Loading

0 comments on commit 1a64a23

Please sign in to comment.