OGS
ProcessLib::StokesFlow Namespace Reference

Namespaces

 anonymous_namespace{CreateStokesFlowProcess.cpp}
 
 detail
 

Classes

struct  IntegrationPointData
 
class  StokesFlowLocalAssemblerInterface
 
class  LocalDataInitializer
 
class  LocalAssemblerData
 
class  StokesFlowProcess
 
struct  StokesFlowProcessData
 

Functions

template<int GlobalDim, template< typename, typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
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)
 
template<int GlobalDim>
std::unique_ptr< ProcesscreateStokesFlowProcess (std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
 
template std::unique_ptr< ProcesscreateStokesFlowProcess< 2 > (std::string name, MeshLib::Mesh &mesh, std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&jacobian_assembler, std::vector< ProcessVariable > const &variables, std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &parameters, unsigned const integration_order, BaseLib::ConfigTree const &config, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &media)
 

Function Documentation

◆ createLocalAssemblers()

template<int GlobalDim, template< typename, typename, typename, int > class LocalAssemblerImplementation, typename LocalAssemblerInterface , typename... ExtraCtorArgs>
void ProcessLib::StokesFlow::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 
)

Creates local assemblers for each element of the given mesh.

Template Parameters
LocalAssemblerImplementationthe individual local assembler type
LocalAssemblerInterfacethe general local assembler interface
ExtraCtorArgstypes of additional constructor arguments. Those arguments will be passed to the constructor of LocalAssemblerImplementation.

The first two template parameters cannot be deduced from the arguments. Therefore they always have to be provided manually.

Definition at line 70 of file CreateLocalAssemblers.h.

77 {
78  DBUG("Create local assemblers.");
79 
80  detail::createLocalAssemblers<GlobalDim, LocalAssemblerImplementation>(
81  dof_table, shapefunction_order, mesh_elements, local_assemblers,
82  std::forward<ExtraCtorArgs>(extra_ctor_args)...);
83 }
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27

References DBUG().

Referenced by ProcessLib::StokesFlow::StokesFlowProcess< GlobalDim >::initializeConcreteProcess().

◆ createStokesFlowProcess()

template<int GlobalDim>
std::unique_ptr< Process > ProcessLib::StokesFlow::createStokesFlowProcess ( std::string  name,
MeshLib::Mesh mesh,
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&  jacobian_assembler,
std::vector< ProcessVariable > const &  variables,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
BaseLib::ConfigTree const &  config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &  media 
)
Input File Parameter:
prj__processes__process__type
Input File Parameter:
prj__processes__process__StokesFlow__coupling_scheme
Input File Parameter:
prj__processes__process__StokesFlow__process_variables
Input File Parameter:
prj__processes__process__StokesFlow__process_variables__liquid_velocity
Input File Parameter:
prj__processes__process__StokesFlow__process_variables__pressure
Input File Parameter:
prj__processes__process__StokesFlow__specific_body_force
Input File Parameter:
prj__processes__process__StokesFlow__use_stokes_brinkman_form

Definition at line 54 of file CreateStokesFlowProcess.cpp.

63 {
65  config.checkConfigParameter("type", "StokesFlow");
66 
67  DBUG("Create StokesFlowProcess.");
68 
69  auto const coupling_scheme =
71  config.getConfigParameter<std::string>("coupling_scheme",
72  "monolithic_scheme");
73  const bool use_monolithic_scheme = (coupling_scheme != "staggered");
74 
75  // Process variable.
77  auto const pv_config = config.getConfigSubtree("process_variables");
78 
79  std::vector<std::vector<std::reference_wrapper<ProcessVariable>>>
80  process_variables;
81 
82  // Collect all process variables in a vector before allocation
83  // liquid_velocity first, pressure then
84  auto const collected_process_variables = findProcessVariables(
85  variables, pv_config,
86  {
87  "liquid_velocity",
89  "pressure"});
90 
91  // Check number of components for each process variable
92  auto const variable_v = collected_process_variables[0];
93  if (variable_v.get().getNumberOfGlobalComponents() != GlobalDim)
94  {
95  OGS_FATAL(
96  "Number of components of the process variable '{:s}' is different "
97  "from the global dimension: got {:d}, expected {:d}",
98  variable_v.get().getName(),
99  variable_v.get().getNumberOfGlobalComponents(),
100  GlobalDim);
101  }
102 
103  auto const variable_p = collected_process_variables[1];
104  if (variable_p.get().getNumberOfGlobalComponents() != 1)
105  {
106  OGS_FATAL(
107  "Pressure process variable '{:s}' is not a scalar variable but has "
108  "{:d} components.",
109  variable_p.get().getName(),
110  variable_p.get().getNumberOfGlobalComponents());
111  }
112 
113  // Allocate the collected process variables into a two-dimensional vector,
114  // depending on what coupling scheme is adopted
115  if (use_monolithic_scheme) // monolithic scheme.
116  {
117  process_variables.push_back(std::move(collected_process_variables));
118  }
119  else // staggered scheme.
120  {
121  OGS_FATAL(
122  "The staggered coupling scheme for StokesFlowProcess is not "
123  "implemented.");
124  }
125 
126  // Specific body force
127  Eigen::VectorXd specific_body_force = Eigen::VectorXd::Zero(GlobalDim);
128  auto const b =
130  config.getConfigParameter<std::vector<double>>("specific_body_force");
131  if (b.size() != GlobalDim)
132  {
133  OGS_FATAL(
134  "The size of the specific body force vector does not match the "
135  "global dimension. Vector size is {:d}, global "
136  "dimension is {:d}",
137  b.size(), GlobalDim);
138  }
139  std::copy_n(b.data(), b.size(), specific_body_force.data());
140 
141  bool const use_stokes_brinkman_form =
143  config.getConfigParameter<bool>("use_stokes_brinkman_form", false);
144 
145  auto media_map =
147 
148  DBUG("Check the media properties of StokesFlow process ...");
149  checkMPLProperties(mesh, *media_map, use_stokes_brinkman_form);
150  DBUG("Media properties verified.");
151 
152  StokesFlowProcessData process_data{std::move(media_map),
153  std::move(specific_body_force),
154  use_stokes_brinkman_form};
155 
156  SecondaryVariableCollection secondary_variables;
157 
158  ProcessLib::createSecondaryVariables(config, secondary_variables);
159 
160  return std::make_unique<StokesFlowProcess<GlobalDim>>(
161  std::move(name), mesh, std::move(jacobian_assembler), parameters,
162  integration_order, std::move(process_variables),
163  std::move(process_data), std::move(secondary_variables),
164  use_monolithic_scheme);
165 }
#define OGS_FATAL(...)
Definition: Error.h:26
std::unique_ptr< MaterialSpatialDistributionMap > createMaterialSpatialDistributionMap(std::map< int, std::shared_ptr< Medium >> const &media, MeshLib::Mesh const &mesh)
void checkMPLProperties(MeshLib::Mesh const &mesh, MaterialPropertyLib::MaterialSpatialDistributionMap const &media_map, bool const use_stokes_brinkman_form)
std::vector< std::reference_wrapper< ProcessVariable > > findProcessVariables(std::vector< ProcessVariable > const &variables, BaseLib::ConfigTree const &pv_config, std::initializer_list< std::string > tags)
void createSecondaryVariables(BaseLib::ConfigTree const &config, SecondaryVariableCollection &secondary_variables)

References BaseLib::ConfigTree::checkConfigParameter(), ProcessLib::StokesFlow::anonymous_namespace{CreateStokesFlowProcess.cpp}::checkMPLProperties(), MaterialPropertyLib::createMaterialSpatialDistributionMap(), ProcessLib::createSecondaryVariables(), DBUG(), ProcessLib::findProcessVariables(), BaseLib::ConfigTree::getConfigParameter(), BaseLib::ConfigTree::getConfigSubtree(), MaterialPropertyLib::name, and OGS_FATAL.

◆ createStokesFlowProcess< 2 >()

template std::unique_ptr< Process > ProcessLib::StokesFlow::createStokesFlowProcess< 2 > ( std::string  name,
MeshLib::Mesh mesh,
std::unique_ptr< ProcessLib::AbstractJacobianAssembler > &&  jacobian_assembler,
std::vector< ProcessVariable > const &  variables,
std::vector< std::unique_ptr< ParameterLib::ParameterBase >> const &  parameters,
unsigned const  integration_order,
BaseLib::ConfigTree const &  config,
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium >> const &  media 
)