4#ifndef nonexplicit_self_nonlinear_solver_h
5#define nonexplicit_self_nonlinear_solver_h
7#include <prismspf/config.h>
9#ifdef PRISMS_PF_WITH_CALIPER
10# include <caliper/cali.h>
13PRISMS_PF_BEGIN_NAMESPACE
18template <
int dim,
int degree,
typename number>
24template <
int dim,
int degree>
40 const dealii::MappingQ1<dim> &_mapping,
65 std::map<unsigned int, std::unique_ptr<identitySolver<dim, degree>>> identity_solvers;
70 std::map<unsigned int, std::unique_ptr<GMGSolver<dim, degree>>> gmg_solvers;
73template <
int dim,
int degree>
81 const dealii::MappingQ1<dim> &_mapping,
86 _triangulation_handler,
91 _mg_matrix_free_handler,
95template <
int dim,
int degree>
99 this->compute_subset_attributes(fieldSolveType::NONEXPLICIT_SELF_NONLINEAR);
102 if (this->subset_attributes.empty())
107 this->set_initial_condition();
109 for (
const auto &[index, variable] : this->subset_attributes)
111 if (this->user_inputs.linear_solve_parameters.linear_solve.at(index)
112 .preconditioner == preconditionerType::GMG)
118 this->matrix_free_handler,
119 this->constraint_handler,
120 this->triangulation_handler,
122 this->mg_matrix_free_handler,
123 this->solution_handler));
124 gmg_solvers.at(index)->init();
128 identity_solvers.emplace(
132 this->matrix_free_handler,
133 this->constraint_handler,
134 this->solution_handler));
135 identity_solvers.at(index)->init();
140template <
int dim,
int degree>
145 if (this->subset_attributes.empty())
150 for (
const auto &[index, variable] : this->subset_attributes)
152 bool is_converged =
true;
153 unsigned int iteration = 0;
155 this->user_inputs.nonlinear_solve_parameters.nonlinear_solve.at(index)
160 is_converged =
false;
163 if (this->user_inputs.linear_solve_parameters.linear_solve.at(index)
164 .preconditioner == preconditionerType::GMG)
166 gmg_solvers.at(index)->solve(step_length);
170 identity_solvers.at(index)->solve(step_length);
176 this->user_inputs.nonlinear_solve_parameters.nonlinear_solve.at(index)
185PRISMS_PF_END_NAMESPACE
Class that handles the assembly and solving of a field with a GMG preconditioner.
Definition linear_solver_gmg.h:44
The class handles the generation and application of boundary conditions based on the user-inputs.
Definition constraint_handler.h:25
Definition explicit_base.h:27
Class that manages the deal.II DoFHandlers.
Definition dof_handler.h:25
Class that handles the assembly and solving of a field with the identity preconditioner (no precondit...
Definition linear_solver_identity.h:26
This class handles the computation and access of the inverted mass matrix for explicit solves.
Definition invm_handler.h:25
This class handlers the management and access of the matrix-free objects.
Definition matrix_free_handler.h:25
Base class for nonexplicit solves.
Definition nonexplicit_base.h:35
This class handles the self-nonlinear solves of a single nonexplicit field.
Definition nonexplicit_self_nonlinear_solver.h:26
void init() override
Initialize system.
Definition nonexplicit_self_nonlinear_solver.h:97
nonexplicitSelfNonlinearSolver(const userInputParameters< dim > &_user_inputs, const matrixfreeHandler< dim > &_matrix_free_handler, const triangulationHandler< dim > &_triangulation_handler, const invmHandler< dim, degree > &_invm_handler, const constraintHandler< dim > &_constraint_handler, const dofHandler< dim > &_dof_handler, const dealii::MappingQ1< dim > &_mapping, dealii::MGLevelObject< matrixfreeHandler< dim, float > > &_mg_matrix_free_handler, solutionHandler< dim > &_solution_handler)
Constructor.
Definition nonexplicit_self_nonlinear_solver.h:74
~nonexplicitSelfNonlinearSolver()=default
Destructor.
void solve() override
Solve a single update step.
Definition nonexplicit_self_nonlinear_solver.h:142
Class that manages solution initialization and swapping with old solutions.
Definition solution_handler.h:22
This class handlers the generation and manipulation of triangulations.
Definition triangulation_handler.h:24