https://mooseframework.inl.gov
ProblemOperatorBase.h
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 
12 #pragma once
13 
14 #include "MFEMProblem.h"
15 #include <functional>
16 
17 namespace Moose::MFEM
18 {
19 
53 {
54 public:
56  virtual ~ProblemOperatorBase() = default;
57 
58  virtual void SetGridFunctions();
59  virtual void SetTrialVariablesFromTrueVectors();
60  virtual void Init(mfem::BlockVector & X);
61  virtual void Solve() = 0;
62 
63  mfem::Array<int> _block_true_offsets_test;
64  mfem::Array<int> _block_true_offsets_trial;
65 
66  mfem::BlockVector _true_x, _true_rhs;
67 
68 protected:
70  void SolveWithOperator(mfem::Operator & system_operator,
71  mfem::Operator & linear_operator,
72  const mfem::Vector & rhs,
73  mfem::Vector & x);
74 
76  void
77  SolveWithOperator(mfem::Operator & system_operator, const mfem::Vector & rhs, mfem::Vector & x)
78  {
79  return SolveWithOperator(system_operator, system_operator.GetGradient(x), rhs, x);
80  }
81 
85 
88  std::vector<std::string> _trial_var_names;
89  std::vector<std::string> _test_var_names;
90  std::vector<mfem::ParGridFunction *> _trial_variables;
91  std::vector<mfem::ParGridFunction *> _test_variables;
92  mfem::Vector * _trial_true_vector = nullptr;
93 };
94 }
95 
96 #endif
std::vector< std::string > _test_var_names
Base problem data struct.
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
ProblemOperatorBase(MFEMProblem &problem)
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.
mfem::Array< int > _block_true_offsets_test
std::vector< mfem::ParGridFunction * > _test_variables
mfem::Array< int > _block_true_offsets_trial
Connects MFEMProblem&#39;s MOOSE solver objects to EquationSystem&#39;s mathematics.
void SolveWithOperator(mfem::Operator &system_operator, const mfem::Vector &rhs, mfem::Vector &x)
Solve the current system operator using system_operator.GetGradient(x) as the linear operator...
std::vector< mfem::ParGridFunction * > _trial_variables
virtual ~ProblemOperatorBase()=default
MFEMProblem & _problem
Reference to the current problem.
virtual void Init(mfem::BlockVector &X)
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).