37 std::vector<std::unique_ptr<MeshLib::Mesh>>
const& meshes)
42 std::string mesh_name;
45#ifdef DOXYGEN_DOCU_ONLY
50 auto optional_mesh_name =
53 if (optional_mesh_name)
55 mesh_name = *optional_mesh_name;
59#ifdef DOXYGEN_DOCU_ONLY
67 auto const geometrical_set_name =
70 auto const geometry_name =
82 DBUG(
"Found mesh '{:s}' with id {:d}.", mesh.getName(), mesh.getID());
92 std::vector<std::unique_ptr<MeshLib::Mesh>>
const& meshes,
93 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
95 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
98 _name(config.getConfigParameter<std::string>(
"name")),
101 _n_components(config.getConfigParameter<int>(
"components")),
103 _shapefunction_order(config.getConfigParameter<unsigned>(
"order")),
104 _deactivated_subdomains(
108 config.getConfigParameter<std::string>(
"initial_condition"),
109 parameters, _n_components, &mesh)),
110 _compensate_non_equilibrium_initial_residuum(
112 config.getConfigParameter<bool>(
113 "compensate_non_equilibrium_initial_residuum", false))
115 DBUG(
"Constructing process variable {:s}",
_name);
119 OGS_FATAL(
"The given shape function order {:d} is not supported",
124 if (
auto bcs_config =
131 bcs_config->getConfigSubtreeList(
"boundary_condition"))
133 auto const& bc_mesh = findMeshInConfig(bc_config, meshes);
136 bc_config.getConfigParameterOptional<
int>(
"component");
144 _bc_configs.emplace_back(std::move(bc_config), bc_mesh,
150 INFO(
"No boundary conditions for process variable '{:s}' found.",
161 sts_config->getConfigSubtreeList(
"source_term"))
163 MeshLib::Mesh const& st_mesh = findMeshInConfig(st_config, meshes);
166 st_config.getConfigParameterOptional<
int>(
"component");
169 st_config.peekConfigParameter<std::string>(
"type");
178 else if (type ==
"Anchor")
186 "Specifying the component id (<component>) for a "
187 "source term for a non-scalar process variable is "
198 INFO(
"No source terms for process variable '{:s}' found.",
_name);
203 _is_active = getOrCreateMeshProperty<unsigned char>(
221std::vector<std::unique_ptr<BoundaryCondition>>
224 const int variable_id,
225 unsigned const integration_order,
226 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
228 std::vector<std::reference_wrapper<ProcessVariable>>
const&
229 all_process_variables_for_this_process,
230 std::map<
int, std::shared_ptr<MaterialPropertyLib::Medium>>
const& media)
232 std::vector<std::unique_ptr<BoundaryCondition>> bcs;
238 config, dof_table,
_mesh, variable_id, integration_order,
240 all_process_variables_for_this_process, media);
247 bcs.push_back(std::move(bc));
258 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
259 std::vector<std::unique_ptr<BoundaryCondition>>& bcs)
263 auto const& deactivated_subdomain_mesh =
264 deactivated_subdomain.deactivated_subdomain_mesh;
267 bool const set_outer_nodes_dirichlet_values =
268 deactivated_subdomain.boundary_value_parameter !=
nullptr;
269 if (set_outer_nodes_dirichlet_values)
271 parameter = deactivated_subdomain.boundary_value_parameter;
274 for (
int component_id = 0;
279 auto bc = std::make_unique<DeactivatedSubdomainDirichlet>(
280 *
_is_active, deactivated_subdomain.time_interval, *parameter,
281 set_outer_nodes_dirichlet_values, deactivated_subdomain_mesh,
282 dof_table, variable_id, component_id);
291 bcs.push_back(std::move(bc));
309 [&](
auto const& ds) {
return ds.isInTimeSupportInterval(time); }))
318 auto is_active_in_subdomain = [&](std::size_t
const element_id,
321 return (!ds.isInTimeSupportInterval(time)) ||
325 auto is_active_in_all_subdomains = [&](std::size_t
const element_id) ->
bool
330 {
return is_active_in_subdomain(element_id, ds); });
334 for (std::size_t element_id = 0; element_id < number_of_elements;
337 if (is_active_in_all_subdomains(element_id))
348 (*_is_active)[id] = 1u;
354 const int variable_id,
355 unsigned const integration_order,
356 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
357 std::vector<std::reference_wrapper<ProcessVariable>>
const&
358 all_process_variables_for_this_process)
360 std::vector<std::unique_ptr<SourceTerm>> source_terms;
363 back_inserter(source_terms),
364 [&](
auto const& config)
367 config, dof_table, config.mesh, variable_id,
369 all_process_variables_for_this_process);
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Mesh class.
Definition of the Node class.
std::optional< ConfigTree > getConfigSubtreeOptional(std::string const &root) const
std::optional< T > getConfigParameterOptional(std::string const ¶m) const
T getConfigParameter(std::string const ¶m) const
const Element * getElement(std::size_t idx) const
Get the element with the given index.
std::size_t getNumberOfElements() const
Get the number of elements.
int getNumberOfVariableComponents(int variable_id) const
void updateDeactivatedSubdomains(double const time)
std::vector< BoundaryConditionConfig > _bc_configs
ProcessVariable(BaseLib::ConfigTree const &config, MeshLib::Mesh &mesh, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
MeshLib::Mesh const & getMesh() const
Returns a mesh on which the process variable is defined.
std::vector< std::unique_ptr< SourceTerm > > createSourceTerms(const NumLib::LocalToGlobalIndexMap &dof_table, const int variable_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
unsigned _shapefunction_order
std::vector< DeactivatedSubdomain > _deactivated_subdomains
std::string const & getName() const
MeshLib::PropertyVector< unsigned char > * _is_active
std::vector< std::size_t > _ids_of_active_elements
std::vector< SourceTermConfig > _source_term_configs
std::vector< std::unique_ptr< BoundaryCondition > > createBoundaryConditions(const NumLib::LocalToGlobalIndexMap &dof_table, const int variable_id, unsigned const integration_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, Process const &process, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
void createBoundaryConditionsForDeactivatedSubDomains(const NumLib::LocalToGlobalIndexMap &dof_table, const int variable_id, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, std::vector< std::unique_ptr< BoundaryCondition > > &bcs)
Mesh & findMeshByName(std::vector< std::unique_ptr< Mesh > > const &meshes, std::string_view const name)
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const ¶meter_name, std::vector< std::unique_ptr< ParameterBase > > const ¶meters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
std::unique_ptr< SourceTerm > createSourceTerm(const SourceTermConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table_bulk, const MeshLib::Mesh &source_term_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process)
std::vector< DeactivatedSubdomain > createDeactivatedSubdomains(BaseLib::ConfigTree const &config, MeshLib::Mesh const &mesh, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves)
std::unique_ptr< BoundaryCondition > createBoundaryCondition(const BoundaryConditionConfig &config, const NumLib::LocalToGlobalIndexMap &dof_table, const MeshLib::Mesh &bulk_mesh, const int variable_id, const unsigned integration_order, const unsigned shapefunction_order, const std::vector< std::unique_ptr< ParameterLib::ParameterBase > > ¶meters, const Process &process, std::vector< std::reference_wrapper< ProcessVariable > > const &all_process_variables_for_this_process, std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const &media)
MeshLib::Mesh const & findMeshInConfig(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< MeshLib::Mesh > > const &meshes)
static PROCESSLIB_EXPORT const std::string zero_parameter_name