Skip to content

Commit 7be1a1a

Browse files
Remove MFEMProblem::setNewtonParameters
1 parent 9ccd0f1 commit 7be1a1a

File tree

5 files changed

+16
-48
lines changed

5 files changed

+16
-48
lines changed

framework/include/mfem/problem/MFEMProblem.h

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class MFEMProblem : public ExternalProblem
2222
MFEMProblem(const InputParameters & params);
2323
virtual ~MFEMProblem() {}
2424

25-
virtual void initialSetup() override;
2625
virtual void externalSolve() override {}
2726
virtual void syncSolutions(Direction) override {}
2827

@@ -160,10 +159,12 @@ class MFEMProblem : public ExternalProblem
160159
InputParameters & parameters);
161160

162161
/**
163-
* Add the nonlinear solver to the system. TODO: allow user to specify solver options,
164-
* similar to the linear solvers.
162+
* Add the nonlinear solver to the system.
165163
*/
166-
void addMFEMNonlinearSolver();
164+
void addMFEMNonlinearSolver(unsigned int nl_max_its,
165+
mfem::real_t nl_abs_tol,
166+
mfem::real_t nl_rel_tol,
167+
unsigned int print_level);
167168

168169
/**
169170
* Method used to get an mfem FEC depending on the variable family specified in the input file.
@@ -211,20 +212,8 @@ class MFEMProblem : public ExternalProblem
211212
*/
212213
std::shared_ptr<mfem::ParGridFunction> getGridFunction(const std::string & name);
213214

214-
/**
215-
* set newton solver parameters
216-
*/
217-
void setNewtonParamaters(unsigned int nl_max_its,
218-
mfem::real_t nl_abs_tol,
219-
mfem::real_t nl_rel_tol,
220-
unsigned int print_level);
221-
222215
protected:
223216
MFEMProblemData _problem_data;
224-
unsigned int _nl_max_its;
225-
mfem::real_t _nl_abs_tol;
226-
mfem::real_t _nl_rel_tol;
227-
unsigned int _print_level;
228217
};
229218

230219
#endif

framework/src/mfem/equation_systems/EquationSystem.C

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ EquationSystem::Init(Moose::MFEM::GridFunctions & gridfunctions, mfem::AssemblyL
125125
{
126126
_assembly_level = assembly_level;
127127

128-
// Extract which coupled variables are to be trivially eliminated and which are trial variables
129-
// SetTrialVariableNames();
130-
131128
for (auto & test_var_name : _test_var_names)
132129
{
133130
if (!gridfunctions.Has(test_var_name))
@@ -145,7 +142,7 @@ EquationSystem::Init(Moose::MFEM::GridFunctions & gridfunctions, mfem::AssemblyL
145142
}
146143

147144
// Extract which coupled variables are to be trivially eliminated and which are trial variables
148-
SetTrialVariableNames();
145+
SetTrialVariableNames();
149146

150147
// Store pointers to FESpaces of all coupled variables
151148
for (auto & coupled_var_name : _coupled_var_names)
@@ -393,7 +390,6 @@ EquationSystem::Mult(const mfem::Vector & sol, mfem::Vector & residual) const
393390
residual.HostRead();
394391
}
395392

396-
397393
void
398394
EquationSystem::UpdateJacobian() const
399395
{
@@ -421,7 +417,6 @@ EquationSystem::UpdateJacobian() const
421417
}
422418
}
423419
}
424-
425420
}
426421

427422
mfem::Operator &

framework/src/mfem/executioners/MFEMProblemSolve.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MFEMProblemSolve::MFEMProblemSolve(
4747
: "",
4848
Moose::PassKey<MFEMProblemSolve>());
4949

50-
_mfem_problem.setNewtonParamaters(_nl_max_its, _nl_abs_tol, _nl_rel_tol, _print_level);
50+
_mfem_problem.addMFEMNonlinearSolver(_nl_max_its, _nl_abs_tol, _nl_rel_tol, _print_level);
5151
}
5252

5353
bool

framework/src/mfem/problem/MFEMProblem.C

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@ MFEMProblem::MFEMProblem(const InputParameters & params) : ExternalProblem(param
3939
setMesh();
4040
}
4141

42-
void
43-
MFEMProblem::initialSetup()
44-
{
45-
FEProblemBase::initialSetup();
46-
addMFEMNonlinearSolver();
47-
}
48-
4942
void
5043
MFEMProblem::setMesh()
5144
{
@@ -76,15 +69,18 @@ MFEMProblem::addMFEMSolver(const std::string & user_object_name,
7669
}
7770

7871
void
79-
MFEMProblem::addMFEMNonlinearSolver()
72+
MFEMProblem::addMFEMNonlinearSolver(unsigned int nl_max_its,
73+
mfem::real_t nl_abs_tol,
74+
mfem::real_t nl_rel_tol,
75+
unsigned int print_level)
8076
{
8177
auto nl_solver = std::make_shared<mfem::NewtonSolver>(getComm());
8278

8379
// Defaults to one iteration, without further nonlinear iterations
84-
nl_solver->SetRelTol(_nl_rel_tol);
85-
nl_solver->SetAbsTol(_nl_abs_tol);
86-
nl_solver->SetPrintLevel(_print_level);
87-
nl_solver->SetMaxIter(_nl_max_its);
80+
nl_solver->SetRelTol(nl_rel_tol);
81+
nl_solver->SetAbsTol(nl_abs_tol);
82+
nl_solver->SetPrintLevel(print_level);
83+
nl_solver->SetMaxIter(nl_max_its);
8884

8985
getProblemData().nonlinear_solver = nl_solver;
9086
}
@@ -512,18 +508,6 @@ MFEMProblem::getGridFunction(const std::string & name)
512508
return getUserObject<MFEMVariable>(name).getGridFunction();
513509
}
514510

515-
void
516-
MFEMProblem::setNewtonParamaters(unsigned int nl_max_its,
517-
mfem::real_t nl_abs_tol,
518-
mfem::real_t nl_rel_tol,
519-
unsigned int print_level)
520-
{
521-
_nl_max_its = nl_max_its;
522-
_nl_abs_tol = nl_abs_tol;
523-
_nl_rel_tol = nl_rel_tol;
524-
_print_level = print_level;
525-
}
526-
527511
void
528512
MFEMProblem::addInitialCondition(const std::string & ic_name,
529513
const std::string & name,

framework/src/mfem/problem_operators/TimeDomainEquationSystemProblemOperator.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ TimeDomainEquationSystemProblemOperator::Solve()
4747

4848
void
4949
TimeDomainEquationSystemProblemOperator::ImplicitSolve(const mfem::real_t dt,
50-
const mfem::Vector & X,
50+
const mfem::Vector & /*X*/,
5151
mfem::Vector & dX_dt)
5252
{
5353
dX_dt = 0.0;

0 commit comments

Comments
 (0)