33 std::vector<std::unique_ptr<MeshLib::Mesh>>
const& meshes)
38 std::string mesh_name;
41 #ifdef DOXYGEN_DOCU_ONLY
46 auto optional_mesh_name =
49 if (optional_mesh_name)
51 mesh_name = *optional_mesh_name;
55 #ifdef DOXYGEN_DOCU_ONLY
63 auto const geometrical_set_name =
66 auto const geometry_name =
78 begin(meshes), end(meshes),
79 [&mesh_name](
auto const& mesh)
81 assert(mesh !=
nullptr);
82 return mesh->getName() == mesh_name;
84 "Required mesh with name '" + mesh_name +
"' not found.");
85 DBUG(
"Found mesh '{:s}' with id {:d}.", mesh.getName(), mesh.getID());
96 std::vector<std::unique_ptr<MeshLib::Mesh>>
const& meshes,
97 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
99 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
const&
102 _name(config.getConfigParameter<std::string>(
"name")),
105 _n_components(config.getConfigParameter<int>(
"components")),
107 _shapefunction_order(config.getConfigParameter<unsigned>(
"order")),
108 _deactivated_subdomains(
112 config.getConfigParameter<std::string>(
"initial_condition"),
113 parameters, _n_components, &mesh))
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"))
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"))
166 st_config.getConfigParameterOptional<
int>(
"component");
180 INFO(
"No source terms for process variable '{:s}' found.",
_name);
185 : _name(std::move(other._name)),
187 _n_components(other._n_components),
188 _shapefunction_order(other._shapefunction_order),
189 _deactivated_subdomains(std::move(other._deactivated_subdomains)),
190 _initial_condition(std::move(other._initial_condition)),
191 _bc_configs(std::move(other._bc_configs)),
192 _source_term_configs(std::move(other._source_term_configs))
206 std::vector<std::unique_ptr<BoundaryCondition>>
209 const int variable_id,
210 unsigned const integration_order,
211 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
214 std::vector<std::unique_ptr<BoundaryCondition>> bcs;
220 config, dof_table,
_mesh, variable_id, integration_order,
228 bcs.push_back(std::move(bc));
243 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters,
244 std::vector<std::unique_ptr<BoundaryCondition>>& bcs)
248 auto const& deactivated_subdomain_meshes =
249 deactivated_subdomain->deactivated_subdomain_meshes;
250 for (
auto const& deactivated_subdomain_mesh :
251 deactivated_subdomain_meshes)
253 auto const* parameter = &ParameterLib::findParameter<double>(
255 bool const set_outer_nodes_dirichlet_values =
256 deactivated_subdomain->boundary_value_parameter !=
nullptr;
257 if (set_outer_nodes_dirichlet_values)
259 parameter = deactivated_subdomain->boundary_value_parameter;
262 for (
int component_id = 0;
267 auto bc = std::make_unique<DeactivatedSubdomainDirichlet>(
269 deactivated_subdomain->time_interval, *parameter,
270 set_outer_nodes_dirichlet_values,
271 *deactivated_subdomain_mesh, dof_table, variable_id,
281 bcs.push_back(std::move(bc));
295 [&](
auto const& ds) {
return ds->isInTimeSupportInterval(time); }))
302 auto is_active_in_subdomain = [&](std::size_t
const i,
305 if (!ds.isInTimeSupportInterval(time))
310 auto const& deactivated_materialIDs = ds.materialIDs;
313 if (std::binary_search(deactivated_materialIDs.begin(),
314 deactivated_materialIDs.end(),
315 (*material_ids)[i]) &&
316 ds.isDeactivated(element_center, time))
324 for (std::size_t i = 0; i < number_of_elements; i++)
328 [&](
auto const& ds) {
return is_active_in_subdomain(i, *ds); }))
337 const int variable_id,
338 unsigned const integration_order,
339 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters)
341 std::vector<std::unique_ptr<SourceTerm>> source_terms;
344 back_inserter(source_terms),
345 [&](
auto const& config)
348 variable_id, integration_order,
void INFO(char const *fmt, Args const &... args)
void DBUG(char const *fmt, Args const &... 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
virtual std::size_t getID() const final
Returns the ID of the element.
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
MeshLib::Mesh const & getMesh() const
Returns a mesh on which the process variable is defined.
unsigned _shapefunction_order
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)
std::string const & getName() const
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)
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)
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::size_t > _ids_of_active_elements
std::vector< SourceTermConfig > _source_term_configs
std::vector< std::unique_ptr< DeactivatedSubdomain const > > _deactivated_subdomains
std::iterator_traits< InputIt >::reference findElementOrError(InputIt begin, InputIt end, Predicate predicate, std::string const &error="")
PropertyVector< int > const * materialIDs(Mesh const &mesh)
MeshLib::Node getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
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< 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::unique_ptr< DeactivatedSubdomain const > > 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< 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)
MeshLib::Mesh const & findMeshInConfig(BaseLib::ConfigTree const &config, std::vector< std::unique_ptr< MeshLib::Mesh >> const &meshes)
static const std::string zero_parameter_name