Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add domain of definition for parameters. #2376

Merged
merged 12 commits into from Mar 1, 2019
@@ -28,18 +28,10 @@ BoundaryCondition::ConditionType BoundaryCondition::convertStringToType(
{
return ConditionType::DIRICHLET;
}
if (str == "NonuniformDirichlet")
{
return ConditionType::NONUNIFORMDIRICHLET;
}
else if (str == "Neumann")
{
return ConditionType::NEUMANN;
}
else if (str == "NonuniformNeumann")
{
return ConditionType::NONUNIFORMNEUMANN;
}
else if (str == "Robin")
{
return ConditionType::ROBIN;
@@ -54,18 +46,10 @@ std::string BoundaryCondition::convertTypeToString(ConditionType type)
{
return "Dirichlet";
}
if (type == ConditionType::NONUNIFORMDIRICHLET)
{
return "NonuniformDirichlet";
}
else if (type == ConditionType::NEUMANN)
{
return "Neumann";
}
else if (type == ConditionType::NONUNIFORMNEUMANN)
{
return "NonuniformNeumann";
}
else if (type == ConditionType::ROBIN)
{
return "Robin";
@@ -21,9 +21,7 @@ class BoundaryCondition final : public FemCondition
{
NONE,
DIRICHLET,
NONUNIFORMDIRICHLET,
NEUMANN,
NONUNIFORMNEUMANN,
ROBIN
};

@@ -27,6 +27,7 @@
<xs:sequence>
<xs:element ref="name" minOccurs="1" maxOccurs="1" />
<xs:element name="type" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="mesh" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="value" minOccurs="0" maxOccurs="1" />
<xs:element name="field_name" type="xs:string" minOccurs="0" maxOccurs="1" />
</xs:sequence>
@@ -38,7 +39,6 @@
<xs:element name="geometry" type="xs:string" minOccurs="0" />
<xs:element name="type" type="xs:string" />
<xs:element name="mesh" type="xs:string" minOccurs="0" />
<xs:element name="field_name" type="xs:string" minOccurs="0" />
<xs:element name="parameter" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
@@ -0,0 +1,6 @@
The domain of definition of the parameter.

The parameter's domain of definition is implicitly the main mesh.
It needs to be specified explicitly for parameters defined on boundary
or subdomain meshes. A notable exception is the Constant parameter,
which has an arbitrary domain of definition.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Copy path View file
@@ -188,6 +188,16 @@ class Mesh : BaseLib::Counter<Mesh>
}; /* class */


/// Meshes are equal if their id's are equal.
inline bool operator==(Mesh const& a, Mesh const& b)
{
return a.getID() == b.getID();
}

inline bool operator!=(Mesh const& a, Mesh const& b)
{
return !(a == b);
}

/// Scales the mesh property with name \c property_name by given \c factor.
/// \note The property must be a "double" property.
@@ -15,12 +15,10 @@
#include "DirichletBoundaryCondition.h"
#include "DirichletBoundaryConditionWithinTimeInterval.h"
#include "NeumannBoundaryCondition.h"
#include "NonuniformDirichletBoundaryCondition.h"
#include "NonuniformNeumannBoundaryCondition.h"
#include "NonuniformVariableDependentNeumannBoundaryCondition.h"
#include "NormalTractionBoundaryCondition.h"
#include "PhaseFieldIrreversibleDamageOracleBoundaryCondition.h"
#include "RobinBoundaryCondition.h"
#include "VariableDependentNeumannBoundaryCondition.h"

#include "BaseLib/TimeInterval.h"

@@ -78,27 +76,12 @@ std::unique_ptr<BoundaryCondition> createBoundaryCondition(
*config.component_id, integration_order, shapefunction_order,
bulk_mesh.getDimension(), parameters);
}
if (type == "NonuniformDirichlet")
if (type == "VariableDependentNeumann")
{
return ProcessLib::createNonuniformDirichletBoundaryCondition(
config.config, config.boundary_mesh, dof_table, variable_id,
*config.component_id);
}
if (type == "NonuniformNeumann")
{
return ProcessLib::createNonuniformNeumannBoundaryCondition(
return ProcessLib::createVariableDependentNeumannBoundaryCondition(
config.config, config.boundary_mesh, dof_table, variable_id,
*config.component_id, integration_order, shapefunction_order,
bulk_mesh);
}

if (type == "NonuniformVariableDependentNeumann")
{
return ProcessLib::
createNonuniformVariableDependentNeumannBoundaryCondition(
config.config, config.boundary_mesh, dof_table, variable_id,
*config.component_id, integration_order, shapefunction_order,
bulk_mesh);
bulk_mesh.getDimension(), parameters);
}

if (type == "Python")
@@ -67,7 +67,16 @@ std::unique_ptr<DirichletBoundaryCondition> createDirichletBoundaryCondition(
auto const param_name = config.getConfigParameter<std::string>("parameter");
DBUG("Using parameter %s", param_name.c_str());

auto& param = findParameter<double>(param_name, parameters, 1);
auto& parameter = findParameter<double>(param_name, parameters, 1);

if (parameter.mesh() && *parameter.mesh() != bc_mesh)
{
OGS_FATAL(
"The boundary condition is defined on a different domain than the "
"parameter: boundary condition is defined on mesh '%s', parameter "
"is defined on mesh '%s'.",
bc_mesh.getName().c_str(), parameter.mesh()->getName().c_str());
}

// In case of partitioned mesh the boundary could be empty, i.e. there is no
// boundary condition.
@@ -84,7 +93,7 @@ std::unique_ptr<DirichletBoundaryCondition> createDirichletBoundaryCondition(
#endif // USE_PETSC

return std::make_unique<DirichletBoundaryCondition>(
param, bc_mesh, dof_table_bulk, variable_id, component_id);
parameter, bc_mesh, dof_table_bulk, variable_id, component_id);
}

} // namespace ProcessLib
@@ -38,24 +38,58 @@ class GenericNaturalBoundaryConditionLocalAssembler
using NodalMatrixType = typename ShapeMatricesType::NodalMatrixType;
using NodalVectorType = typename ShapeMatricesType::NodalVectorType;

struct NAndWeight
{
NAndWeight(typename ShapeMatricesType::ShapeMatrices::ShapeType&& N_,
double const weight_)
: N(std::move(N_)), weight(weight_)
{
}
typename ShapeMatricesType::ShapeMatrices::ShapeType const N;
double const weight;
};

private:
static std::vector<NAndWeight, Eigen::aligned_allocator<NAndWeight>>
initNsAndWeights(MeshLib::Element const& e, bool is_axially_symmetric,
unsigned const integration_order)
{
IntegrationMethod const integration_method(integration_order);
std::vector<NAndWeight, Eigen::aligned_allocator<NAndWeight>>
ns_and_weights;
ns_and_weights.reserve(integration_method.getNumberOfPoints());

auto sms = initShapeMatrices<ShapeFunction, ShapeMatricesType,
IntegrationMethod, GlobalDim>(
e, is_axially_symmetric, integration_method);
for (unsigned ip = 0; ip < sms.size(); ++ip)
{
auto& sm = sms[ip];
double const w =
sm.detJ * sm.integralMeasure *
integration_method.getWeightedPoint(ip).getWeight();

ns_and_weights.emplace_back(std::move(sm.N), w);
}

return ns_and_weights;
}

public:
GenericNaturalBoundaryConditionLocalAssembler(
MeshLib::Element const& e, bool is_axially_symmetric,
unsigned const integration_order)
: _integration_method(integration_order),
_shape_matrices(initShapeMatrices<ShapeFunction, ShapeMatricesType,
IntegrationMethod, GlobalDim>(
e, is_axially_symmetric, _integration_method)),
_ns_and_weights(
initNsAndWeights(e, is_axially_symmetric, integration_order)),
_element(e)
{
}

protected:
IntegrationMethod const _integration_method;
std::vector<typename ShapeMatricesType::ShapeMatrices,
Eigen::aligned_allocator<
typename ShapeMatricesType::ShapeMatrices>> const
_shape_matrices;
std::vector<NAndWeight, Eigen::aligned_allocator<NAndWeight>> const
_ns_and_weights;
MeshLib::Element const& _element;
};

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.