Skip to content

Commit

Permalink
Merge pull request #44 from aurora-multiphysics/alexanderianblair/mfe…
Browse files Browse the repository at this point in the history
…m-problem-builder-update

Add Auxsolvers, Sources and BoundaryConditions to hephaestus::Problem rather than setting and overwriting
  • Loading branch information
alexanderianblair authored Oct 31, 2023
2 parents 5ca68e2 + 5f4538c commit 14fa65c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
6 changes: 0 additions & 6 deletions include/problem/MFEMProblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,7 @@ class MFEMProblem : public ExternalProblem
int _order;
hephaestus::ProblemBuilder * mfem_problem_builder;
std::unique_ptr<hephaestus::Problem> mfem_problem;
hephaestus::BCMap _bc_maps;
hephaestus::Coefficients _coefficients;
hephaestus::FESpaces _fespaces;
hephaestus::GridFunctions _gridfunctions;
hephaestus::AuxSolvers _preprocessors;
hephaestus::AuxSolvers _postprocessors;
hephaestus::Sources _sources;
hephaestus::InputParameters _solver_options;
hephaestus::Outputs _outputs;
hephaestus::InputParameters _exec_params;
Expand Down
23 changes: 4 additions & 19 deletions src/problem/MFEMProblem.C
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,7 @@ MFEMProblem::validParams()
MFEMProblem::MFEMProblem(const InputParameters & params)
: ExternalProblem(params),
_input_mesh(_mesh.parameters().get<MeshFileName>("file")),
_bc_maps(),
_coefficients(),
_fespaces(),
_gridfunctions(),
_preprocessors(),
_postprocessors(),
_sources(),
_outputs(),
_exec_params()
{
Expand Down Expand Up @@ -60,14 +54,8 @@ MFEMProblem::initialSetup()
_solver_options.SetParam("PrintLevel", -1);

std::cout << "Launching MFEM solve\n\n" << std::endl;
// mfem_problem_builder->SetFESpaces(_fespaces);
// mfem_problem_builder->SetGridFunctions(_gridfunctions);
_coefficients.AddGlobalCoefficientsFromSubdomains();
mfem_problem_builder->SetBoundaryConditions(_bc_maps);
mfem_problem_builder->SetAuxSolvers(_preprocessors);
mfem_problem_builder->SetCoefficients(_coefficients);
mfem_problem_builder->SetPostprocessors(_postprocessors);
mfem_problem_builder->SetSources(_sources);
mfem_problem_builder->SetOutputs(_outputs);
mfem_problem_builder->SetSolverOptions(_solver_options);

Expand All @@ -82,8 +70,6 @@ MFEMProblem::initialSetup()
mfem_problem_builder->ConstructState();
mfem_problem_builder->ConstructSolver();

// hephaestus::ProblemBuildSequencer sequencer(mfem_problem_builder);
// sequencer.ConstructEquationSystemProblem();
hephaestus::InputParameters exec_params;

Transient * _moose_executioner = dynamic_cast<Transient *>(_app.getExecutioner());
Expand Down Expand Up @@ -158,7 +144,7 @@ MFEMProblem::addBoundaryCondition(const std::string & bc_name,
{
FEProblemBase::addUserObject(bc_name, name, parameters);
MFEMBoundaryCondition * mfem_bc(&getUserObject<MFEMBoundaryCondition>(name));
_bc_maps.Register(name, mfem_bc->getBC(), false);
mfem_problem_builder->AddBoundaryCondition(name, mfem_bc->getBC(), false);
mfem_bc->storeCoefficients(_coefficients);
}

Expand Down Expand Up @@ -186,7 +172,7 @@ MFEMProblem::addMaterial(const std::string & kernel_name,
dynamic_cast<hephaestus::CoupledCoefficient *>(coef->second);
if (_coupled_coef != NULL)
{
_preprocessors.Register(coef->first, _coupled_coef, false);
mfem_problem_builder->AddAuxSolver(coef->first, _coupled_coef, false);
}
}

Expand All @@ -201,7 +187,7 @@ MFEMProblem::addSource(const std::string & user_object_name,
{
FEProblemBase::addUserObject(user_object_name, name, parameters);
MFEMSource * mfem_source(&getUserObject<MFEMSource>(name));
_sources.Register(name, mfem_source->getSource(), true);
mfem_problem_builder->AddSource(name, mfem_source->getSource(), true);
mfem_source->storeCoefficients(_coefficients);
}

Expand Down Expand Up @@ -273,8 +259,7 @@ MFEMProblem::addAuxKernel(const std::string & kernel_name,
{
FEProblemBase::addUserObject(kernel_name, name, parameters);
MFEMAuxSolver * mfem_auxsolver(&getUserObject<MFEMAuxSolver>(name));

_postprocessors.Register(name, mfem_auxsolver->getAuxSolver(), true);
mfem_problem_builder->AddPostprocessor(name, mfem_auxsolver->getAuxSolver(), true);
mfem_auxsolver->storeCoefficients(_coefficients);
}

Expand Down

0 comments on commit 14fa65c

Please sign in to comment.