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, const double dxdot_dx, const double dx_dx, 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 * getIntegrationPointWriter (MeshLib::Mesh const &mesh) 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, const double dxdot_dx, const double dx_dx, 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
 
- 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
 
- 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:323
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:22

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 134 of file StokesFlowProcess.cpp.

138 {
139  DBUG("Assemble StokesFlowProcess.");
140 
141  std::vector<std::reference_wrapper<NumLib::LocalToGlobalIndexMap>>
142  dof_tables;
143  assert(_use_monolithic_scheme);
144  {
145  dof_tables.push_back(std::ref(*_local_to_global_index_map));
146  }
147 
148  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
149  // Call global assembler for each local assembly item.
152  pv.getActiveElementIDs(), dof_tables, t, dt, x, xdot, process_id, M, K,
153  b);
154 }
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
std::vector< std::size_t > const & getActiveElementIDs() const
std::vector< std::reference_wrapper< ProcessVariable > > const & getProcessVariables(const int process_id) const
Definition: Process.h:145
VectorMatrixAssembler _global_assembler
Definition: Process.h:333
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _local_to_global_index_map
Definition: Process.h:329
const bool _use_monolithic_scheme
Definition: Process.h:335
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 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(), and ProcessLib::ProcessVariable::getActiveElementIDs().

◆ 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,
const double  dxdot_dx,
const double  dx_dx,
int const  process_id,
GlobalMatrix M,
GlobalMatrix K,
GlobalVector b,
GlobalMatrix Jac 
)
overrideprivatevirtual

Implements ProcessLib::Process.

Definition at line 157 of file StokesFlowProcess.cpp.

163 {
164  OGS_FATAL(
165  "Assembly of Jacobian matrix has not yet been implemented for "
166  "StokesFlowProcess.");
167 }
#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 170 of file StokesFlowProcess.cpp.

176 {
177  if (process_id != 0)
178  {
179  return;
180  }
181 
182  std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
183  dof_tables.reserve(x.size());
184  assert(_use_monolithic_scheme);
185  {
186  dof_tables.push_back(_local_to_global_index_map.get());
187  }
188 
189  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
192  _local_assemblers, pv.getActiveElementIDs(), dof_tables, t, dt, x,
193  x_dot, process_id);
194 }
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(), and ProcessLib::ProcessVariable::getActiveElementIDs().

◆ 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:95
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Definition: Mesh.h:98
std::unique_ptr< MeshLib::MeshSubset const > _mesh_subset_all_nodes
Definition: Process.h:327
MeshLib::Mesh & _mesh
Definition: Process.h:326
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 222 of file StokesFlowProcess.cpp.

224 {
225  assert(_use_monolithic_scheme);
226  {
228  }
229 }

◆ getMatrixSpecifications()

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

Definition at line 121 of file StokesFlowProcess.cpp.

123 {
124  assert(_use_monolithic_scheme);
125  {
126  auto const& l = *_local_to_global_index_map;
127 
128  return {l.dofSizeWithoutGhosts(), l.dofSizeWithoutGhosts(),
129  &l.getGhostIndices(), &this->_sparsity_pattern};
130  }
131 }
GlobalSparsityPattern _sparsity_pattern
Definition: Process.h:352

◆ 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 109 of file StokesFlowProcess.cpp.

110 {
111  assert(_use_monolithic_scheme);
112  {
113  int const process_id = 0;
115  *_local_to_global_index_map, process_id);
116  }
117 }
void initializeProcessBoundaryConditionsAndSourceTerms(const NumLib::LocalToGlobalIndexMap &dof_table, const int process_id)
Definition: Process.cpp:67

◆ 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  int const process_id = 0;
92  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
93  // Todo: may move LocalDataInitializer.h and CreateLocalAssemblers.h which
94  // are identical to those in such processes as HydroMechanics,
95  // RichardsMechanics, and etc, into a common place.
97  LocalAssemblerData>(
98  mesh.getDimension(), mesh.getElements(), dof_table,
100  mesh.isAxiallySymmetric(), integration_order, _process_data);
101 
103  MeshLib::getOrCreateMeshProperty<double>(
104  const_cast<MeshLib::Mesh&>(mesh), "pressure_interpolated",
106 }
unsigned getShapeFunctionOrder() const
void createLocalAssemblers(const unsigned, std::vector< MeshLib::Element * > const &mesh_elements, NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< std::unique_ptr< LocalAssemblerInterface >> &local_assemblers, ExtraCtorArgs &&... extra_ctor_args)
MeshLib::PropertyVector< double > * pressure_interpolated

References ProcessLib::StokesFlow::createLocalAssemblers(), MeshLib::Mesh::getDimension(), MeshLib::Mesh::getElements(), ProcessLib::ProcessVariable::getShapeFunctionOrder(), 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 197 of file StokesFlowProcess.cpp.

202 {
203  if (process_id != 0)
204  {
205  return;
206  }
207 
208  std::vector<NumLib::LocalToGlobalIndexMap const*> dof_tables;
209  dof_tables.reserve(x.size());
210  assert(_use_monolithic_scheme);
211  {
212  dof_tables.push_back(_local_to_global_index_map.get());
213  }
214 
215  ProcessLib::ProcessVariable const& pv = getProcessVariables(process_id)[0];
218  pv.getActiveElementIDs(), dof_tables, x, t, dt);
219 }
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(), and ProcessLib::LocalAssemblerInterface::postTimestep().

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: