Skip to content

Commit

Permalink
save flow field only when it is newly computed.
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Mar 18, 2024
1 parent 272c85c commit 73c32ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/advdiff_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ void AdvDiffSolver::GetFlowField(ParameterizedProblem *flow_problem)
stokes_solver->InitVariables();
stokes_solver->SetSolutionSaveMode(save_flow);

bool flow_loaded = false;
if (load_flow && FileExists(flow_file))
{
stokes_solver->LoadSolution(flow_file);
flow_loaded = true;
}
else
{
stokes_solver->SetParameterizedProblem(flow_problem);
Expand All @@ -255,7 +259,7 @@ void AdvDiffSolver::GetFlowField(ParameterizedProblem *flow_problem)
stokes_solver->Solve();
}

if (save_flow)
if (save_flow && (!flow_loaded))
stokes_solver->SaveSolution(flow_file);

DeletePointers(flow_coeffs);
Expand Down

0 comments on commit 73c32ea

Please sign in to comment.