diff --git a/include/core/invm_handler.h b/include/core/invm_handler.h new file mode 100644 index 000000000..5143b5928 --- /dev/null +++ b/include/core/invm_handler.h @@ -0,0 +1,142 @@ +#ifndef invm_handler_h +#define invm_handler_h + +#include + +#include +#include +#include + +/** + * \brief This class handles the computation and access of the inverted mass matrix for + * explicit solves. + */ +template +class invmHandler +{ +public: + /** + * \brief Constructor. + */ + invmHandler(const AttributesList &_variable_attributes); + + /** + * \brief Destructor. + */ + ~invmHandler(); + + /** + * \brief Compute the mass matrix for scalar/vector fields. + */ + void + compute_invm(); + + /** + * \brief Recompute the mass matrix for scalar/vector fields. This just points to + * compute_invm() and is used for style. + */ + void + recompute_invm(); + + /** + * \brief Getter function for the mass matrix for the given field index (constant + * reference). + */ + const dealii::LinearAlgebra::distributed::Vector & + get_invm(const uint &index); + +private: + /** + * \brief Variable attributes. This is used to determine the proper return type for the + * invm when given a field index. + */ + const AttributesList &variable_attributes; + + /** + * \brief Inverse of the mass matrix for scalar fields. + */ + dealii::LinearAlgebra::distributed::Vector invm_scalar; + + /** + * \brief Inverse of the mass matrix for vector fields. + */ + dealii::LinearAlgebra::distributed::Vector invm_vector; + + /** + * \brief Whether a scalar invm is needed. + */ + bool scalar_needed = false; + + /** + * \brief Whether a vector invm is needed. + */ + bool vector_needed = false; +}; + +template +invmHandler::invmHandler(const AttributesList &_variable_attributes) + : variable_attributes(_variable_attributes) +{ + for (const auto &[index, variable] : variable_attributes) + { + if (variable.field_type == fieldType::SCALAR) + { + scalar_needed = true; + } + if (variable.field_type == fieldType::VECTOR) + { + vector_needed = true; + } + } +} + +template +inline void +invmHandler::compute_invm() +{} + +template +inline void +invmHandler::recompute_invm() +{ + this->compute_invm(); +} + +template +inline const dealii::LinearAlgebra::distributed::Vector & +invmHandler::get_invm(const uint &index) +{ + Assert(variable_attributes.at(index) != variable_attributes.end(), + dealii::ExcMessage( + "Invalid index. The provided index does not have an entry in the variable " + "attributes that were provided to the constructor.")); + + if (variable_attributes.at(index).field_type == fieldType::SCALAR) + { + Assert(scalar_needed, + dealii::ExcMessage( + "The invm for scalar fields is marked as not needed. Make sure the " + "variable attributes correspond with the provided index.")); + Assert(invm_scalar.size() == 0, + dealii::ExcMessage("The scalar invm has size 0. Please make sure to call " + "compute_invm() prior to calling the getter function.")); + + return invm_scalar; + } + else if (variable_attributes.at(index).field_type == fieldType::VECTOR) + { + Assert(vector_needed, + dealii::ExcMessage( + "The invm for vector fields is marked as not needed. Make sure the " + "variable attributes correspond with the provided index.")); + Assert(invm_vector.size() == 0, + dealii::ExcMessage("The vector invm has size 0. Please make sure to call " + "compute_invm() prior to calling the getter function.")); + + return invm_vector; + } + + Assert(false, dealii::ExcMessage("Invalid field type.")); +} + +#endif \ No newline at end of file diff --git a/include/core/solvers/explicit_constant_solver.h b/include/core/solvers/explicit_constant_solver.h new file mode 100644 index 000000000..7bb65815c --- /dev/null +++ b/include/core/solvers/explicit_constant_solver.h @@ -0,0 +1,10 @@ +#ifndef explicit_constant_solver_h +#define explicit_constant_solver_h + +/** + * \brief This class handles the explicit solves of all constant fields + */ +class explicitConstantSolver +{}; + +#endif \ No newline at end of file diff --git a/include/core/solvers/explicit_postprocess_solver.h b/include/core/solvers/explicit_postprocess_solver.h new file mode 100644 index 000000000..1c110244a --- /dev/null +++ b/include/core/solvers/explicit_postprocess_solver.h @@ -0,0 +1,10 @@ +#ifndef explicit_postprocess_solver_h +#define explicit_postprocess_solver_h + +/** + * \brief This class handles the explicit solves of all postprocessed fields + */ +class explicitPostprocessSolver +{}; + +#endif \ No newline at end of file diff --git a/include/core/solvers/explicit_solver.h b/include/core/solvers/explicit_solver.h new file mode 100644 index 000000000..73d3da2ff --- /dev/null +++ b/include/core/solvers/explicit_solver.h @@ -0,0 +1,39 @@ +#ifndef explicit_solver_h +#define explicit_solver_h + +/** + * \brief This class handles the explicit solves of all explicit fields + */ +class explicitSolver +{ +public: + /** + * \brief Constructor. + */ + explicitSolver(); + + /** + * \brief Destructor. + */ + ~explicitSolver(); + + /** + * \brief Initialize system. + */ + void + init_system(); + + /** + * \brief Reinitialize system. + */ + void + reinit_system(); + + /** + * \brief Solve a single update step. + */ + void + solve(); +}; + +#endif \ No newline at end of file diff --git a/include/core/solvers/nonexplicit_auxiliary_solver.h b/include/core/solvers/nonexplicit_auxiliary_solver.h new file mode 100644 index 000000000..24fbe61c6 --- /dev/null +++ b/include/core/solvers/nonexplicit_auxiliary_solver.h @@ -0,0 +1,10 @@ +#ifndef nonexplicit_auxiliary_solver_h +#define nonexplicit_auxiliary_solver_h + +/** + * \brief This class handles the explicit solves of a single nonexplicit field + */ +class nonexplicitAuxiliarySolves +{}; + +#endif \ No newline at end of file diff --git a/include/core/solvers/nonexplicit_co_nonlinear_solver.h b/include/core/solvers/nonexplicit_co_nonlinear_solver.h new file mode 100644 index 000000000..dae004fca --- /dev/null +++ b/include/core/solvers/nonexplicit_co_nonlinear_solver.h @@ -0,0 +1,10 @@ +#ifndef nonexplicit_co_nonlinear_solver_h +#define nonexplicit_co_nonlinear_solver_h + +/** + * \brief This class handles the nonlinear solves of a several nonexplicit fields + */ +class nonexplicitCoNonlinearSolver +{}; + +#endif \ No newline at end of file diff --git a/include/core/solvers/nonexplicit_linear_solver.h b/include/core/solvers/nonexplicit_linear_solver.h new file mode 100644 index 000000000..3353f1bb8 --- /dev/null +++ b/include/core/solvers/nonexplicit_linear_solver.h @@ -0,0 +1,10 @@ +#ifndef nonexplicit_linear_solver_h +#define nonexplicit_linear_solver_h + +/** + * \brief This class handles the linear solves of a single nonexplicit field + */ +class nonexplicitLinearSolver +{}; + +#endif \ No newline at end of file diff --git a/include/core/solvers/nonexplicit_self_nonlinear_solver.h b/include/core/solvers/nonexplicit_self_nonlinear_solver.h new file mode 100644 index 000000000..23f42b9b6 --- /dev/null +++ b/include/core/solvers/nonexplicit_self_nonlinear_solver.h @@ -0,0 +1,10 @@ +#ifndef nonexplicit_self_nonlinear_solver_h +#define nonexplicit_self_nonlinear_solver_h + +/** + * \brief This class handles the self-nonlinear solves of a single nonexplicit field + */ +class nonexplicitSelfNonlinearSolver +{}; + +#endif \ No newline at end of file