Skip to content

Commit

Permalink
Merge pull request #2339 from norihiro-w/use-exprtk-bc
Browse files Browse the repository at this point in the history
[PL] support xyz-dependent parameters in Neumann bc
  • Loading branch information
endJunction authored Feb 1, 2019
2 parents 7e0dc96 + 7515402 commit 6585152
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#pragma once

#include "MeshLib/Elements/Element.h"
#include "NumLib/DOF/LocalToGlobalIndexMap.h"
#include "NumLib/Fem/ShapeMatrixPolicy.h"
#include "ProcessLib/Utils/InitShapeMatrices.h"
Expand Down Expand Up @@ -44,7 +45,8 @@ class GenericNaturalBoundaryConditionLocalAssembler
: _integration_method(integration_order),
_shape_matrices(initShapeMatrices<ShapeFunction, ShapeMatricesType,
IntegrationMethod, GlobalDim>(
e, is_axially_symmetric, _integration_method))
e, is_axially_symmetric, _integration_method)),
_element(e)
{
}

Expand All @@ -54,6 +56,7 @@ class GenericNaturalBoundaryConditionLocalAssembler
Eigen::aligned_allocator<
typename ShapeMatricesType::ShapeMatrices>> const
_shape_matrices;
MeshLib::Element const& _element;
};

} // namespace ProcessLib
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

#include "GenericNaturalBoundaryConditionLocalAssembler.h"
#include "NumLib/DOF/DOFTableUtil.h"
#include "NumLib/Fem/ShapeMatrixPolicy.h"
#include "ProcessLib/Parameter/Parameter.h"
#include "ProcessLib/Utils/InitShapeMatrices.h"

namespace ProcessLib
{
Expand All @@ -23,6 +25,7 @@ class NeumannBoundaryConditionLocalAssembler final
{
using Base = GenericNaturalBoundaryConditionLocalAssembler<
ShapeFunction, IntegrationMethod, GlobalDim>;
using ShapeMatricesType = ShapeMatrixPolicyType<ShapeFunction, GlobalDim>;

public:
/// The neumann_bc_value factor is directly integrated into the local
Expand Down Expand Up @@ -53,11 +56,20 @@ class NeumannBoundaryConditionLocalAssembler final
SpatialPosition pos;
pos.setElementID(id);

using FemType =
NumLib::TemplateIsoparametric<ShapeFunction, ShapeMatricesType>;
FemType fe(
static_cast<const typename ShapeFunction::MeshElement&>(Base::_element));

for (unsigned ip = 0; ip < n_integration_points; ip++)
{
pos.setIntegrationPoint(ip);
auto const& sm = Base::_shape_matrices[ip];
auto const& wp = Base::_integration_method.getWeightedPoint(ip);

MathLib::TemplatePoint<double, 3> coords_ip(fe.interpolateCoordinates(sm.N));
pos.setCoordinates(coords_ip);

_local_rhs.noalias() += sm.N * _neumann_bc_parameter(t, pos)[0] *
sm.detJ * wp.getWeight() *
sm.integralMeasure;
Expand Down

0 comments on commit 6585152

Please sign in to comment.