OGS
ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim > Class Template Referencefinal

Detailed Description

template<int GlobalDim>
class ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >

The Stokes equations are reduced from the Navier-Stokes equations, and include momentum equations and a continuity equation describing the flow in the free-flow region.

Definition at line 26 of file StokesFlowProcess.h.

#include <StokesFlowProcess.h>

Inheritance diagram for ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >:
[legend]
Collaboration diagram for ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >:
[legend]

Public Member Functions

 StokesFlowProcess (std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, StokesFlowProcessData &&process_data, SecondaryVariableCollection &&secondary_variables, bool const use_monolithic_scheme)
 
bool isLinear () const override
 
MathLib::MatrixSpecifications getMatrixSpecifications (const int) const override
 
NumLib::LocalToGlobalIndexMap const & getDOFTable (const int) const override
 
void computeSecondaryVariableConcrete (double const, double const, std::vector< GlobalVector * > const &x, GlobalVector const &, int const) override
 
void postTimestepConcreteProcess (std::vector< GlobalVector * > const &x, const double t, const double dt, int const process_id) override
 
- Public Member Functions inherited from ProcessLib::Process
 Process (std::string name_, MeshLib::Mesh &mesh, std::unique_ptr< AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, SecondaryVariableCollection &&secondary_variables, const bool use_monolithic_scheme=true)
 
void preTimestep (std::vector< GlobalVector * > const &x, const double t, const double delta_t, const int process_id)
 Preprocessing before starting assembly for new timestep. More...
 
void postTimestep (std::vector< GlobalVector * > const &x, const double t, const double delta_t, int const process_id)
 Postprocessing after a complete timestep. More...
 
void postNonLinearSolver (GlobalVector const &x, GlobalVector const &xdot, const double t, double const dt, int const process_id)
 
void preIteration (const unsigned iter, GlobalVector const &x) final
 
void computeSecondaryVariable (double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id)
 compute secondary variables for the coupled equations or for output. More...
 
NumLib::IterationResult postIteration (GlobalVector const &x) final
 
void initialize ()
 
void setInitialConditions (std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, double const t, int const process_id)
 
MathLib::MatrixSpecifications getMatrixSpecifications (const int process_id) const override
 
void setCoupledSolutionsForStaggeredScheme (CoupledSolutionsForStaggeredScheme *const coupled_solutions)
 
void updateDeactivatedSubdomains (double const time, const int process_id)
 
bool isMonolithicSchemeUsed () const
 
virtual void setCoupledTermForTheStaggeredSchemeToLocalAssemblers (int const)
 
virtual void extrapolateIntegrationPointValuesToNodes (const double, std::vector< GlobalVector * > const &, std::vector< GlobalVector * > &)
 
void preAssemble (const double t, double const dt, GlobalVector const &x) final
 
void assemble (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) final
 
void assembleWithJacobian (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) final
 
std::vector< NumLib::IndexValueVector< GlobalIndexType > > const * getKnownSolutions (double const t, GlobalVector const &x, int const process_id) const final
 
MeshLib::MeshgetMesh () const
 
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables (const int process_id) const
 
SecondaryVariableCollection const & getSecondaryVariables () const
 
std::vector< std::unique_ptr< IntegrationPointWriter > > const & getIntegrationPointWriters () const
 
virtual Eigen::Vector3d getFlux (std::size_t, MathLib::Point3d const &, double const, std::vector< GlobalVector * > const &) const
 
virtual void solveReactionEquation (std::vector< GlobalVector * > &, std::vector< GlobalVector * > const &, double const, double const, NumLib::EquationSystem &, int const)
 

Private Member Functions

void constructDofTable () override
 
void initializeConcreteProcess (NumLib::LocalToGlobalIndexMap const &dof_table, MeshLib::Mesh const &mesh, unsigned const integration_order) override
 Process specific initialization called by initialize(). More...
 
void initializeBoundaryConditions () override
 
void assembleConcreteProcess (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b) override
 
void assembleWithJacobianConcreteProcess (const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b, GlobalMatrix &Jac) override
 

Private Attributes

std::vector< MeshLib::Node * > _base_nodes
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_base_nodes
 
StokesFlowProcessData _process_data
 
std::vector< std::unique_ptr< StokesFlowLocalAssemblerInterface > > _local_assemblers
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map_single_component
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map_with_base_nodes
 

Additional Inherited Members

- Public Types inherited from ProcessLib::Process
using NonlinearSolver = NumLib::NonlinearSolverBase
 
using TimeDiscretization = NumLib::TimeDiscretization
 
- Public Attributes inherited from ProcessLib::Process
std::string const name
 
- Static Public Attributes inherited from ProcessLib::Process
static PROCESSLIB_EXPORT const std::string constant_one_parameter_name = "constant_one"
 
- Protected Member Functions inherited from ProcessLib::Process
NumLib::ExtrapolatorgetExtrapolator () const
 
NumLib::LocalToGlobalIndexMap const & getSingleComponentDOFTable () const
 
void initializeProcessBoundaryConditionsAndSourceTerms (const NumLib::LocalToGlobalIndexMap &dof_table, const int process_id)
 
void constructMonolithicProcessDofTable ()
 
void constructDofTableOfSpecifiedProcessStaggeredScheme (const int specified_prosess_id)
 
virtual std::tuple< NumLib::LocalToGlobalIndexMap *, bool > getDOFTableForExtrapolatorData () const
 
std::vector< GlobalIndexTypegetIndicesOfResiduumWithoutInitialCompensation () const override
 
- Protected Attributes inherited from ProcessLib::Process
MeshLib::Mesh_mesh
 
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
 
std::unique_ptr< NumLib::LocalToGlobalIndexMap_local_to_global_index_map
 
SecondaryVariableCollection _secondary_variables
 
VectorMatrixAssembler _global_assembler
 
const bool _use_monolithic_scheme
 
CoupledSolutionsForStaggeredScheme_coupled_solutions
 
unsigned const _integration_order
 
std::vector< std::unique_ptr< IntegrationPointWriter > > _integration_point_writer
 
GlobalSparsityPattern _sparsity_pattern
 
std::vector< std::vector< std::reference_wrapper< ProcessVariable > > > _process_variables
 
std::vector< BoundaryConditionCollection_boundary_conditions
 

Constructor & Destructor Documentation

◆ StokesFlowProcess()

template<int GlobalDim>
ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::StokesFlowProcess ( std::string  name,
MeshLib::Mesh mesh,
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&  jacobian_assembler,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&  process_variables,
StokesFlowProcessData &&  process_data,
SecondaryVariableCollection &&  secondary_variables,
bool const  use_monolithic_scheme 
)

Definition at line 23 of file StokesFlowProcess.cpp.

34  : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters,
35  integration_order, std::move(process_variables),
36  std::move(secondary_variables), use_monolithic_scheme),
37  _process_data(std::move(process_data))
38 {
39 }
std::string const name
Definition: Process.h:328
Process(std::string name_, MeshLib::Mesh &mesh, std::unique_ptr< AbstractJacobianAssembler > &&jacobian_assembler, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, std::vector< std::vector< std::reference_wrapper< ProcessVariable >>> &&process_variables, SecondaryVariableCollection &&secondary_variables, const bool use_monolithic_scheme=true)
Definition: Process.cpp:24

Member Function Documentation

◆ assembleConcreteProcess()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::assembleConcreteProcess ( const double  t,
double const  dt,
std::vector< GlobalVector * > const &  x,
std::vector< GlobalVector * > const &  xdot,
int const  process_id,
GlobalMatrix M,
GlobalMatrix K,
GlobalVector b 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 128 of file StokesFlowProcess.cpp.

132 {
133  DBUG("Assemble StokesFlowProcess.");
134 
135  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
136  dof_tables;
137  assert(_use_monolithic_scheme);
138  {
139  dof_tables.push_back(std::ref(*_local_to_global_index_map));
140  }
141 
142  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
143  // Call global assembler for each local assembly item.
146  pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, process_id, M, K,
147  b);
148 }
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition: Logging.h:29
std::vector< std::size_t > const & getActiveElementIDs() const
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:149
VectorMatrixAssembler _global_assembler
Definition: Process.h:338
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition: Process.h:334
const bool _use_monolithic_scheme
Definition: Process.h:340
std::vector< std::unique_ptr< StokesFlowLocalAssemblerInterface > > _local_assemblers
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< std::reference_wrapper< NumLib::LocalToGlobalIndexMap >> const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &xdot, int const process_id, GlobalMatrix &M, GlobalMatrix &K, GlobalVector &b)
static const double t
static void executeSelectedMemberDereferenced(Object &object, Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)

References ProcessLib::VectorMatrixAssembler::assemble(), DBUG(), NumLib::SerialExecutor::executeSelectedMemberDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), and MathLib::t.

◆ assembleWithJacobianConcreteProcess()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::assembleWithJacobianConcreteProcess ( const double  t,
double const  dt,
std::vector< GlobalVector * > const &  x,
std::vector< GlobalVector * > const &  xdot,
int const  process_id,
GlobalMatrix M,
GlobalMatrix K,
GlobalVector b,
GlobalMatrix Jac 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 151 of file StokesFlowProcess.cpp.

157 {
158  OGS_FATAL(
159  "Assembly of Jacobian matrix has not yet been implemented for "
160  "StokesFlowProcess.");
161 }
#define OGS_FATAL(...)
Definition: Error.h:26

References OGS_FATAL.

◆ computeSecondaryVariableConcrete()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::computeSecondaryVariableConcrete ( double const  t,
double const  dt,
std::vector< GlobalVector * > const &  x,
GlobalVector const &  x_dot,
int const  process_id 
)
overridevirtual

Reimplemented from ProcessLib::Process.

Definition at line 164 of file StokesFlowProcess.cpp.

170 {
171  if (process_id != 0)
172  {
173  return;
174  }
175 
176  std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
177  dof_tables.reserve(x.size());
178  assert(_use_monolithic_scheme);
179  {
180  dof_tables.push_back(_local_to_global_index_map.get());
181  }
182 
183  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
186  _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x,
187  x_dot, process_id);
188 }
virtual void computeSecondaryVariable(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_dot, int const process_id)
static void executeSelectedMemberOnDereferenced(Method method, Container const &container, std::vector< std::size_t > const &active_container_ids, Args &&... args)

References ProcessLib::LocalAssemblerInterface::computeSecondaryVariable(), NumLib::SerialExecutor::executeSelectedMemberOnDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), and MathLib::t.

◆ constructDofTable()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::constructDofTable
overrideprivatevirtual

This function is for general cases, in which all equations of the coupled processes have the same number of unknowns. For the general cases with the staggered scheme, all equations of the coupled processes share one DOF table hold by _local_to_global_index_map. Other cases can be considered by overloading this member function in the derived class.

Reimplemented from ProcessLib::Process.

Definition at line 42 of file StokesFlowProcess.cpp.

43 {
44  // Create single component dof in every of the mesh's nodes.
46  std::make_unique<MeshLib::MeshSubset>(_mesh, _mesh.getNodes());
47  // Create single component dof in the mesh's base nodes.
50  std::make_unique<MeshLib::MeshSubset>(_mesh, _base_nodes);
51 
52  // TODO move the two data members somewhere else.
53  // for extrapolation of secondary variables
54  std::vector<MeshLib::MeshSubset> all_mesh_subsets_single_component{
57  std::make_unique<NumLib::LocalToGlobalIndexMap>(
58  std::move(all_mesh_subsets_single_component),
59  // by location order is needed for output
61 
62  assert(_use_monolithic_scheme);
63  {
64  // For vector variables, in this case liquid velocity.
65  int const process_id = 0;
66  std::vector<MeshLib::MeshSubset> all_mesh_subsets(
67  getProcessVariables(process_id)[0]
68  .get()
69  .getNumberOfGlobalComponents(),
71 
72  // For scalar variables, in this case pressure.
73  all_mesh_subsets.push_back(*_mesh_subset_base_nodes);
74 
75  std::vector<int> const vec_n_components{GlobalDim, 1};
76 
78  std::make_unique<NumLib::LocalToGlobalIndexMap>(
79  std::move(all_mesh_subsets), vec_n_components,
82  }
83 }
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition: Mesh.h:100
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:103
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
Definition: Process.h:332
MeshLib::Mesh & _mesh
Definition: Process.h:331
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_base_nodes
std::vector< MeshLib::Node * > _base_nodes
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map_single_component
std::vector< Node * > getBaseNodes(std::vector< Element * > const &elements)
Definition: Utils.h:26
@ BY_LOCATION
Ordering data by spatial location.

References NumLib::BY_LOCATION, and MeshLib::getBaseNodes().

◆ getDOFTable()

template<int GlobalDim>
NumLib::LocalToGlobalIndexMap const & ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::getDOFTable ( const int  ) const
overridevirtual

Reimplemented from ProcessLib::Process.

Definition at line 216 of file StokesFlowProcess.cpp.

218 {
219  assert(_use_monolithic_scheme);
220  {
222  }
223 }

◆ getMatrixSpecifications()

template<int GlobalDim>
MathLib::MatrixSpecifications ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::getMatrixSpecifications ( const int  ) const
override

Definition at line 115 of file StokesFlowProcess.cpp.

117 {
118  assert(_use_monolithic_scheme);
119  {
120  auto const& l = *_local_to_global_index_map;
121 
122  return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
123  &l.getGhostIndices(), &this->_sparsity_pattern};
124  }
125 }
GlobalSparsityPattern _sparsity_pattern
Definition: Process.h:357

◆ initializeBoundaryConditions()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::initializeBoundaryConditions
overrideprivatevirtual

Member function to initialize the boundary conditions for all coupled processes. It is called by initialize().

Reimplemented from ProcessLib::Process.

Definition at line 103 of file StokesFlowProcess.cpp.

104 {
105  assert(_use_monolithic_scheme);
106  {
107  int const process_id = 0;
109  *_local_to_global_index_map, process_id);
110  }
111 }
void initializeProcessBoundaryConditionsAndSourceTerms(const NumLib::LocalToGlobalIndexMap &dof_table, const int process_id)
Definition: Process.cpp:69

◆ initializeConcreteProcess()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::initializeConcreteProcess ( NumLib::LocalToGlobalIndexMap const &  dof_table,
MeshLib::Mesh const &  mesh,
unsigned const  integration_order 
)
overrideprivatevirtual

Process specific initialization called by initialize().

Implements ProcessLib::Process.

Definition at line 86 of file StokesFlowProcess.cpp.

90 {
91  ProcessLib::createLocalAssemblersStokes<GlobalDim, LocalAssemblerData>(
92  mesh.getElements(), dof_table, _local_assemblers,
93  NumLib::IntegrationOrder{integration_order}, mesh.isAxiallySymmetric(),
95 
97  MeshLib::getOrCreateMeshProperty<double>(
98  const_cast<MeshLib::Mesh&>(mesh), "pressure_interpolated",
100 }
MeshLib::PropertyVector< double > * pressure_interpolated

References MeshLib::Mesh::getElements(), MeshLib::Mesh::isAxiallySymmetric(), and MeshLib::Node.

◆ isLinear()

template<int GlobalDim>
bool ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::isLinear ( ) const
inlineoverride

Definition at line 43 of file StokesFlowProcess.h.

43 { return false; }

◆ postTimestepConcreteProcess()

template<int GlobalDim>
void ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::postTimestepConcreteProcess ( std::vector< GlobalVector * > const &  x,
const double  t,
const double  dt,
int const  process_id 
)
overridevirtual

Reimplemented from ProcessLib::Process.

Definition at line 191 of file StokesFlowProcess.cpp.

196 {
197  if (process_id != 0)
198  {
199  return;
200  }
201 
202  std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
203  dof_tables.reserve(x.size());
204  assert(_use_monolithic_scheme);
205  {
206  dof_tables.push_back(_local_to_global_index_map.get());
207  }
208 
209  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
212  pv.getActiveElementIDs(), dof_tables, x, t, dt);
213 }
virtual void postTimestep(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, double const dt)

References NumLib::SerialExecutor::executeSelectedMemberOnDereferenced(), ProcessLib::ProcessVariable::getActiveElementIDs(), ProcessLib::LocalAssemblerInterface::postTimestep(), and MathLib::t.

Member Data Documentation

◆ _base_nodes

template<int GlobalDim>
std::vector<MeshLib::Node*> ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::_base_nodes
private

Definition at line 84 of file StokesFlowProcess.h.

◆ _local_assemblers

template<int GlobalDim>
std::vector<std::unique_ptr<StokesFlowLocalAssemblerInterface> > ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::_local_assemblers
private

Definition at line 90 of file StokesFlowProcess.h.

◆ _local_to_global_index_map_single_component

template<int GlobalDim>
std::unique_ptr<NumLib::LocalToGlobalIndexMap> ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::_local_to_global_index_map_single_component
private

Definition at line 93 of file StokesFlowProcess.h.

◆ _local_to_global_index_map_with_base_nodes

template<int GlobalDim>
std::unique_ptr<NumLib::LocalToGlobalIndexMap> ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::_local_to_global_index_map_with_base_nodes
private

Local to global index mapping for base nodes, which is used for linear interpolation for pressure in the staggered scheme.

Definition at line 98 of file StokesFlowProcess.h.

◆ _mesh_subset_base_nodes

template<int GlobalDim>
std::unique_ptr<MeshLib::MeshSubset const> ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::_mesh_subset_base_nodes
private

Definition at line 85 of file StokesFlowProcess.h.

◆ _process_data

template<int GlobalDim>
StokesFlowProcessData ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::_process_data
private

Definition at line 87 of file StokesFlowProcess.h.


The documentation for this class was generated from the following files: