7#include <range/v3/range/conversion.hpp>
8#include <range/v3/view/transform.hpp>
26template <
int GlobalDim>
35 Eigen::Vector3d
const normal = e.cross(n).normalized();
51 normal.tail<3 - GlobalDim>().setZero();
52 return normal.normalized();
55template <
int GlobalDim,
template <
typename ,
int >
56 class LocalAssemblerImplementation>
59 unsigned const integration_order, unsigned const shapefunction_order,
60 MeshLib::Mesh const& bulk_mesh,
61 NumLib::LocalToGlobalIndexMap const& dof_table_bulk,
62 int const variable_id, MeshLib::Mesh const& bc_mesh,
63 ParameterLib::Parameter<double> const& pressure)
69 auto const& number_of_components =
70 dof_table_bulk.getNumberOfVariableComponents(variable_id);
71 std::vector<int> component_ids(number_of_components);
72 std::iota(std::begin(component_ids), std::end(component_ids), 0);
75 std::vector<MeshLib::Node*>
const bc_nodes =
_bc_mesh.getNodes();
76 DBUG(
"Found {:d} nodes for Natural BCs for the variable {:d}",
77 bc_nodes.size(), variable_id);
83 assert(bulk_element_ids !=
nullptr);
84 auto const& elements =
_bc_mesh.getElements();
87 ranges::views::transform(
91 auto const* bulk_element =
92 bulk_mesh.getElement((*bulk_element_ids)[e_ptr->
getID()]);
93 assert(bulk_element !=
nullptr);
97 ranges::to<std::vector<Eigen::Vector3d>>();
102 variable_id, component_ids, std::move(bc_mesh_subset));
105 GlobalDim, LocalAssemblerImplementation>(
111template <
int GlobalDim,
template <
typename ,
int >
112 class LocalAssemblerImplementation>
114 applyNaturalBC(const double t, std::vector<GlobalVector*> const& x,
115 int const , GlobalMatrix* K, GlobalVector& b,
126 DBUG(
"Parsing NormalTractionBoundaryCondition.");
131 auto const parameter_name =
134 DBUG(
"parameter {:s}", parameter_name);
136 return parameter_name;
139template <
int GlobalDim>
141 GlobalDim, NormalTractionBoundaryConditionLocalAssembler>>
143 std::string
const& parameter_name,
MeshLib::Mesh const& bc_mesh,
146 unsigned const integration_order,
unsigned const shapefunction_order,
147 std::vector<std::unique_ptr<ParameterLib::ParameterBase>>
const& parameters)
149 DBUG(
"Constructing NormalTractionBoundaryCondition.");
152 parameter_name, parameters, 1, &bc_mesh);
156 integration_order, shapefunction_order, bulk_mesh, dof_table,
157 variable_id, bc_mesh, pressure);
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
T getConfigParameter(std::string const ¶m) const
void checkConfigParameter(std::string const ¶m, std::string_view const value) const
Eigen::Vector3d const & asEigenVector3d() const
virtual MeshElemType getGeomType() const =0
virtual const Node * getNode(unsigned idx) const =0
std::size_t getID() const
Returns the ID of the element.
static Eigen::Vector3d getSurfaceNormal(Element const &e)
Returns the surface normal of a 2D element.
A subset of nodes on a single mesh.
virtual void assemble(std::size_t const id, NumLib::LocalToGlobalIndexMap const &dof_table_boundary, double const t, std::vector< GlobalVector * > const &, GlobalMatrix *, GlobalVector &b, GlobalMatrix *)=0
void applyNaturalBC(const double t, std::vector< GlobalVector * > const &x, int const process_id, GlobalMatrix *K, GlobalVector &b, GlobalMatrix *Jac) override
MeshLib::Mesh const & _bc_mesh
ParameterLib::Parameter< double > const & _pressure
std::vector< Eigen::Vector3d > _element_normals
Normal vectors for each element in the boundary condition mesh.
unsigned const _integration_order
Integration order for integration over the lower-dimensional elements.
NormalTractionBoundaryCondition(unsigned const integration_order, unsigned const shapefunction_order, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table_bulk, int const variable_id, MeshLib::Mesh const &bc_mesh, ParameterLib::Parameter< double > const &pressure)
std::unique_ptr< NumLib::LocalToGlobalIndexMap > _dof_table_boundary
std::vector< std::unique_ptr< NormalTractionBoundaryConditionLocalAssemblerInterface > > _local_assemblers
Local assemblers for each element of number of _elements.
PropertyVector< std::size_t > const * bulkElementIDs(Mesh const &mesh)
MathLib::Point3d getCenterOfGravity(Element const &element)
Calculates the center of gravity for the mesh element.
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)
void createLocalAssemblers(NumLib::LocalToGlobalIndexMap const &dof_table, const unsigned shapefunction_order, std::vector< MeshLib::Element * > const &mesh_elements, std::vector< std::unique_ptr< LocalAssemblerInterface > > &local_assemblers, NumLib::IntegrationOrder const integration_order, ExtraCtorArgs &&... extra_ctor_args)
std::unique_ptr< NormalTractionBoundaryCondition< GlobalDim, NormalTractionBoundaryConditionLocalAssembler > > createNormalTractionBoundaryCondition(std::string const ¶meter_name, MeshLib::Mesh const &bc_mesh, MeshLib::Mesh const &bulk_mesh, NumLib::LocalToGlobalIndexMap const &dof_table, int const variable_id, unsigned const integration_order, unsigned const shapefunction_order, std::vector< std::unique_ptr< ParameterLib::ParameterBase > > const ¶meters)
Eigen::Vector3d computeElementNormal(const MeshLib::Element &element, const MeshLib::Element &bulk_element)
std::string parseNormalTractionBoundaryCondition(BaseLib::ConfigTree const &config)
static void executeMemberOnDereferenced(Method method, Container const &container, Args &&... args)