Skip to content

Commit

Permalink
save stokes flow solution
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer2368 committed Mar 18, 2024
1 parent 0e7cf67 commit 272c85c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/multiblock_solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ friend class ParameterizedProblem;
BlockVector* GetSolution() { return U; }
BlockVector* GetSolutionCopy() { return new BlockVector(*U); }

void SetSolutionSaveMode(const bool save_sol_);

void GetVariableVector(const int &var_idx, BlockVector &global, BlockVector &var);
void SetVariableVector(const int &var_idx, BlockVector &var, BlockVector &global);

Expand Down
1 change: 1 addition & 0 deletions src/advdiff_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ void AdvDiffSolver::GetFlowField(ParameterizedProblem *flow_problem)

stokes_solver = new StokesSolver;
stokes_solver->InitVariables();
stokes_solver->SetSolutionSaveMode(save_flow);

if (load_flow && FileExists(flow_file))
stokes_solver->LoadSolution(flow_file);
Expand Down
8 changes: 7 additions & 1 deletion src/multiblock_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ void MultiBlockSolver::ParseInputs()
train_mode = SetTrainMode();

// save solution if single run.
save_sol = config.GetOption<bool>("save_solution/enabled", false);
SetSolutionSaveMode(config.GetOption<bool>("save_solution/enabled", false));
}

void MultiBlockSolver::SetSolutionSaveMode(const bool save_sol_)
{
// save solution if single run.
save_sol = save_sol_;
if (save_sol)
{
// Default file path if no input file name is provided.
Expand Down

0 comments on commit 272c85c

Please sign in to comment.