OGS
|
A boundary condition whose values are computed by a Python script.
Definition at line 57 of file PythonBoundaryCondition.h.
#include <PythonBoundaryCondition.h>
Public Member Functions | |
PythonBoundaryCondition (PythonBcData &&bc_data, unsigned const integration_order, bool const flush_stdout, unsigned const bulk_mesh_dimension, NumLib::LocalToGlobalIndexMap const &dof_table_bulk) | |
void | getEssentialBCValues (const double t, const GlobalVector &x, NumLib::IndexValueVector< GlobalIndexType > &bc_values) const override |
Writes the values of essential BCs to bc_values . | |
void | applyNaturalBC (const double t, std::vector< GlobalVector * > const &x, int const process_id, GlobalMatrix *K, GlobalVector &b, GlobalMatrix *Jac) override |
Public Member Functions inherited from ProcessLib::BoundaryCondition | |
virtual void | preTimestep (const double, std::vector< GlobalVector * > const &, int const) |
virtual void | postTimestep (const double, std::vector< GlobalVector * > const &, int const) |
virtual | ~BoundaryCondition ()=default |
Private Member Functions | |
void | collectPrimaryVariables (std::vector< double > &primary_variables, MeshLib::Node const &boundary_node, GlobalVector const &x) const |
GlobalIndexType | getDofIdx (std::size_t const boundary_node_id) const |
GlobalIndexType | getDofIdx (std::size_t const boundary_node_id, int const var, int const comp) const |
double | interpolateToHigherOrderNode (GlobalVector const &x, int const var, int const comp, MeshLib::Node const &boundary_node) const |
Private Attributes | |
PythonBcData | _bc_data |
Auxiliary data used by the local assemblers. | |
std::unique_ptr< NumLib::LocalToGlobalIndexMap > | _dof_table_boundary |
Local dof table for the boundary mesh. | |
std::vector< std::unique_ptr< PythonBoundaryConditionLocalAssemblerInterface > > | _local_assemblers |
Local assemblers for all elements of the boundary mesh. | |
bool const | _flush_stdout |
ProcessLib::PythonBoundaryCondition::PythonBoundaryCondition | ( | PythonBcData && | bc_data, |
unsigned const | integration_order, | ||
bool const | flush_stdout, | ||
unsigned const | bulk_mesh_dimension, | ||
NumLib::LocalToGlobalIndexMap const & | dof_table_bulk ) |
Definition at line 71 of file PythonBoundaryCondition.cpp.
References _bc_data, _dof_table_boundary, _local_assemblers, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::all_process_variables_for_this_process, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_mesh, ProcessLib::BoundaryConditionAndSourceTerm::createLocalAssemblersPython(), NumLib::LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(), MeshLib::Mesh::getElements(), MeshLib::Mesh::getNodes(), and MeshLib::Mesh::isAxiallySymmetric().
|
overridevirtual |
Applies natural BCs (i.e. non-Dirichlet BCs) to the stiffness matrix K
and the vector b
.
Reimplemented from ProcessLib::BoundaryCondition.
Definition at line 246 of file PythonBoundaryCondition.cpp.
References _dof_table_boundary, _flush_stdout, _local_assemblers, ProcessLib::GenericNaturalBoundaryConditionLocalAssemblerInterface::assemble(), DBUG(), NumLib::SerialExecutor::executeMemberOnDereferenced(), and OGS_FATAL.
|
private |
Collects primary variables at the passed node from the passed GlobalVector to primary_variables
.
Primary variables at higher order nodes are interpolated from base nodes if necessary, e.g., for Taylor-Hood elements.
primary_variables
will contain the value of each component of each primary variable. Their order is determined by the d.o.f. table. Definition at line 180 of file PythonBoundaryCondition.cpp.
References _dof_table_boundary, getDofIdx(), MathLib::Point3dWithID::getID(), interpolateToHigherOrderNode(), and NumLib::MeshComponentMap::nop.
Referenced by getEssentialBCValues().
|
private |
Get the d.o.f. index at the given boundary_node_id
for this BC's variable and component.
Definition at line 163 of file PythonBoundaryCondition.cpp.
References _bc_data, _dof_table_boundary, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_mesh, MeshLib::Mesh::getID(), ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::global_component_id, and MeshLib::Node.
Referenced by collectPrimaryVariables(), and getEssentialBCValues().
|
private |
Get the d.o.f. index at the given boundary_node_id
for the given variable and component.
Definition at line 172 of file PythonBoundaryCondition.cpp.
References _bc_data, _dof_table_boundary, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_mesh, MeshLib::Mesh::getID(), and MeshLib::Node.
|
overridevirtual |
Writes the values of essential BCs to bc_values
.
Reimplemented from ProcessLib::BoundaryCondition.
Definition at line 95 of file PythonBoundaryCondition.cpp.
References _bc_data, _flush_stdout, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_mesh, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_object, collectPrimaryVariables(), DBUG(), getDofIdx(), MeshLib::Mesh::getNodes(), NumLib::IndexValueVector< typename >::ids, NumLib::MeshComponentMap::nop, OGS_FATAL, and NumLib::IndexValueVector< typename >::values.
|
private |
Interpolates the given component of the given variable to the given boundary_node
.
Definition at line 206 of file PythonBoundaryCondition.cpp.
References _bc_data, _dof_table_boundary, _local_assemblers, ProcessLib::BoundaryConditionAndSourceTerm::Python::BcOrStData< BcOrStPythonSideInterface >::bc_or_st_mesh, DBUG(), MeshLib::Mesh::getElementsConnectedToNode(), and MathLib::Point3dWithID::getID().
Referenced by collectPrimaryVariables().
|
private |
Auxiliary data used by the local assemblers.
Definition at line 104 of file PythonBoundaryCondition.h.
Referenced by PythonBoundaryCondition(), getDofIdx(), getDofIdx(), getEssentialBCValues(), and interpolateToHigherOrderNode().
|
private |
Local dof table for the boundary mesh.
Definition at line 107 of file PythonBoundaryCondition.h.
Referenced by PythonBoundaryCondition(), applyNaturalBC(), collectPrimaryVariables(), getDofIdx(), getDofIdx(), and interpolateToHigherOrderNode().
|
private |
Whether or not to flush standard output before and after each call to Python code. Ensures right order of output messages and therefore simplifies debugging.
Definition at line 116 of file PythonBoundaryCondition.h.
Referenced by applyNaturalBC(), and getEssentialBCValues().
|
private |
Local assemblers for all elements of the boundary mesh.
Definition at line 111 of file PythonBoundaryCondition.h.
Referenced by PythonBoundaryCondition(), applyNaturalBC(), and interpolateToHigherOrderNode().