Skip to content

Commit

Permalink
Removes sources and auxsolvers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Palmer committed Jun 28, 2024
1 parent 986c92c commit f1614b2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 40 deletions.
7 changes: 3 additions & 4 deletions framework/include/mfem/equation_systems/equation_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "inputs.h"
#include "kernel_base.h"
#include "named_fields_map.h"
#include "sources.h"

namespace platypus
{
Expand Down Expand Up @@ -68,10 +67,10 @@ class EquationSystem : public mfem::Operator
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
platypus::Coefficients & coefficients);
virtual void BuildLinearForms(platypus::BCMap & bc_map, platypus::Sources & sources);
virtual void BuildLinearForms(platypus::BCMap & bc_map);
virtual void BuildBilinearForms();
virtual void BuildMixedBilinearForms();
virtual void BuildEquationSystem(platypus::BCMap & bc_map, platypus::Sources & sources);
virtual void BuildEquationSystem(platypus::BCMap & bc_map);

// Form linear system, with essential boundary conditions accounted for
virtual void FormLinearSystem(mfem::OperatorHandle & op,
Expand Down Expand Up @@ -134,7 +133,7 @@ class TimeDependentEquationSystem : public EquationSystem
void AddTrialVariableNameIfMissing(const std::string & trial_var_name) override;

virtual void SetTimeStep(double dt);
virtual void UpdateEquationSystem(platypus::BCMap & bc_map, platypus::Sources & sources);
virtual void UpdateEquationSystem(platypus::BCMap & bc_map);
mfem::ConstantCoefficient _dt_coef; // Coefficient for timestep scaling
std::vector<std::string> _trial_var_time_derivative_names;
};
Expand Down
5 changes: 1 addition & 4 deletions framework/include/mfem/problem/MFEMProblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "MFEMBilinearFormKernel.h"
#include "MFEMLinearFormKernel.h"
#include "MFEMFormulation.h"
#include "MFEMAuxSolver.h"
#include "MFEMDataCollection.h"
#include "MFEMFESpace.h"
#include "Function.h"
Expand Down Expand Up @@ -109,9 +108,7 @@ class MFEMProblem : public ExternalProblem
const std::string & name,
InputParameters & parameters) override;
/**
* Override of ExternalProblem::addAuxKernel. Uses ExternalProblem::addAuxKernel to create a
* GeneralUserObject representing the auxkernel in MOOSE, and creates corresponding MFEM auxsolver
* to be used in the MFEM solve.
* Override of ExternalProblem::addAuxKernel.
*/
void addAuxKernel(const std::string & kernel_name,
const std::string & name,
Expand Down
16 changes: 5 additions & 11 deletions framework/src/mfem/equation_systems/equation_system.C
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ EquationSystem::Init(platypus::GridFunctions & gridfunctions,
}

void
EquationSystem::BuildLinearForms(platypus::BCMap & bc_map, platypus::Sources & sources)
EquationSystem::BuildLinearForms(platypus::BCMap & bc_map)
{
// Register linear forms
for (int i = 0; i < _test_var_names.size(); i++)
Expand Down Expand Up @@ -313,11 +313,6 @@ EquationSystem::BuildLinearForms(platypus::BCMap & bc_map, platypus::Sources & s
lf_kernel->Apply(lf);
}
}

if (test_var_name == _test_var_names.at(0))
{
sources.Apply(lf);
}
}
}

Expand Down Expand Up @@ -388,9 +383,9 @@ EquationSystem::BuildMixedBilinearForms()
}

void
EquationSystem::BuildEquationSystem(platypus::BCMap & bc_map, platypus::Sources & sources)
EquationSystem::BuildEquationSystem(platypus::BCMap & bc_map)
{
BuildLinearForms(bc_map, sources);
BuildLinearForms(bc_map);
BuildBilinearForms();
BuildMixedBilinearForms();
}
Expand Down Expand Up @@ -426,10 +421,9 @@ TimeDependentEquationSystem::SetTimeStep(double dt)
}

void
TimeDependentEquationSystem::UpdateEquationSystem(platypus::BCMap & bc_map,
platypus::Sources & sources)
TimeDependentEquationSystem::UpdateEquationSystem(platypus::BCMap & bc_map)
{
BuildLinearForms(bc_map, sources);
BuildLinearForms(bc_map);
BuildBilinearForms();
BuildMixedBilinearForms();
}
Expand Down
20 changes: 2 additions & 18 deletions framework/src/mfem/problem/MFEMProblem.C
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,6 @@ MFEMProblem::addCoefficient(const std::string & user_object_name,
FEProblemBase::addUserObject(user_object_name, name, parameters);
MFEMCoefficient * mfem_coef(&getUserObject<MFEMCoefficient>(name));
_coefficients._scalars.Register(name, mfem_coef->getCoefficient());

// Add associated auxsolvers for CoupledCoefficients
auto coupled_coef = std::dynamic_pointer_cast<platypus::CoupledCoefficient>(
_coefficients._scalars.GetShared(name));
if (coupled_coef != nullptr)
{
mfem_problem_builder->AddAuxSolver(name, std::move(coupled_coef));
}
}

void
Expand Down Expand Up @@ -271,16 +263,8 @@ MFEMProblem::addAuxKernel(const std::string & kernel_name,
{
std::string base_auxkernel = parameters.get<std::string>("_moose_base");

if (base_auxkernel == "MFEMAuxKernel") // MFEM auxsolver.
{
FEProblemBase::addUserObject(kernel_name, name, parameters);
MFEMAuxSolver * mfem_auxsolver(&getUserObject<MFEMAuxSolver>(name));

mfem_problem_builder->AddPostprocessor(name, mfem_auxsolver->getAuxSolver());
mfem_auxsolver->storeCoefficients(_coefficients);
}
else if (base_auxkernel == "AuxKernel" || base_auxkernel == "VectorAuxKernel" ||
base_auxkernel == "ArrayAuxKernel") // MOOSE auxkernels.
if (base_auxkernel == "AuxKernel" || base_auxkernel == "VectorAuxKernel" ||
base_auxkernel == "ArrayAuxKernel") // MOOSE auxkernels.
{
FEProblemBase::addAuxKernel(kernel_name, name, parameters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ EquationSystemProblemOperator::Init(mfem::Vector & X)
{
ProblemOperator::Init(X);

GetEquationSystem()->BuildEquationSystem(_problem._bc_map, _problem._sources);
GetEquationSystem()->BuildEquationSystem(_problem._bc_map);
}

} // namespace platypus
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TimeDomainEquationSystemProblemOperator::Init(mfem::Vector & X)
*(_trial_variable_time_derivatives.at(i)) = 0.0;
}

GetEquationSystem()->BuildEquationSystem(_problem._bc_map, _problem._sources);
GetEquationSystem()->BuildEquationSystem(_problem._bc_map);
}

void
Expand Down Expand Up @@ -54,7 +54,7 @@ void
TimeDomainEquationSystemProblemOperator::BuildEquationSystemOperator(double dt)
{
GetEquationSystem()->SetTimeStep(dt);
GetEquationSystem()->UpdateEquationSystem(_problem._bc_map, _problem._sources);
GetEquationSystem()->UpdateEquationSystem(_problem._bc_map);
GetEquationSystem()->BuildJacobian(_true_x, _true_rhs);
}

Expand Down

0 comments on commit f1614b2

Please sign in to comment.