https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ComplexEquationSystemProblemOperator.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#ifdef MOOSE_MFEM_ENABLED
11
13#include "MFEMProblem.h"
14
15namespace Moose::MFEM
16{
18 MFEMProblem & problem, const std::string & weak_form_name)
19 : EquationSystemProblemOperator(problem, weak_form_name),
21 problem.getEquationSystem(weak_form_name))}
22{
24 mooseError("The weak form supplying this operator does not provide a ComplexEquationSystem, "
25 "which is required by ComplexEquationSystemProblemOperator.");
26}
27
28void
30{
33
36
37 // Set operator size and block structure for trial spaces
40 for (const auto ind : index_range(_cmplx_trial_variables))
41 {
43 2 * _cmplx_trial_variables.at(ind)->ParFESpace()->TrueVSize();
44 }
45 _block_true_offsets_trial.PartialSum();
46
47 // Set operator size and block structure for test spaces
50 for (const auto ind : index_range(_cmplx_test_variables))
51 {
53 2 * _cmplx_test_variables.at(ind)->ParFESpace()->TrueVSize();
54 }
55 _block_true_offsets_test.PartialSum();
56
59
62}
63
64void
66{
67 auto * const es = GetEquationSystem();
68
69 {
70 TIME_SECTION("ComplexEquationSystemProblemOperator::FormSystem", 2, "Assembling MFEM System");
72 }
73
74 {
75 TIME_SECTION("ComplexEquationSystemProblemOperator::SolveSystem", 2, "Solving MFEM System");
77 }
78
79 es->SetTrialVariablesFromTrueVectors(_true_x);
80}
81
82} // namespace Moose::MFEM
83
84#endif
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
std::vector< mfem::ParComplexGridFunction * > _cmplx_trial_variables
std::shared_ptr< Moose::MFEM::ComplexEquationSystem > _equation_system
ComplexEquationSystemProblemOperator(MFEMProblem &problem, const std::string &weak_form_name="")
virtual Moose::MFEM::ComplexEquationSystem * GetEquationSystem() const override
Returns a pointer to the operator's equation system.
std::vector< mfem::ParComplexGridFunction * > _cmplx_test_variables
Class to store weak form components (bilinear and linear forms, and optionally mixed and nonlinear fo...
Steady-state ProblemOperator that prepares and solves a single EquationSystem.
void FormEquationSystemOperator()
Form equation-system state used by Solve().
const std::vector< std::string > & GetTrialVarNames() const
const std::vector< std::string > & GetTestVarNames() const
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer.
void SolveWithOperator(mfem::Operator &system_operator, mfem::Operator &linear_operator, const mfem::Vector &rhs, mfem::Vector &x)
Solve the current system operator using the configured nonlinear and linear solvers.
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
std::vector< std::string > _test_var_names
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
Moose::MFEM::ComplexGridFunctions cmplx_gridfunctions