From 2d51d126c94ffea2ef2fed52dcb5520549e54fdf Mon Sep 17 00:00:00 2001
From: Mohd Afeef Badri <52162083+mohd-afeef-badri@users.noreply.github.com>
Date: Thu, 29 Aug 2024 16:54:02 +0200
Subject: [PATCH] Boundary condition service
---
acoustics/Fem.axl | 118 +--------------
acoustics/FemModule.cc | 7 +-
acoustics/FemModule.h | 1 +
acoustics/Test.sub.arc | 12 +-
acoustics/Test.sub.hypre.arc | 12 +-
electrostatics/Fem.axl | 131 +----------------
electrostatics/FemModule.cc | 7 +-
electrostatics/FemModule.h | 1 +
electrostatics/Test.Capacitor.arc | 27 ++--
electrostatics/Test.box-rods.arc | 27 ++--
electrostatics/Test.rod-circle.arc | 27 ++--
femutils/ArcaneFemFunctions.h | 36 ++---
femutils/CMakeLists.txt | 3 +
femutils/FemBoundaryConditions.axl | 136 ++++++++++++++++++
femutils/FemBoundaryConditions.cc | 30 ++++
femutils/IArcaneFemBC.h | 73 ++++++++++
fourier/Fem.axl | 104 +-------------
fourier/FemModule.cc | 34 ++---
fourier/FemModule.h | 1 +
fourier/Test.conduction.10k.arc | 48 ++++---
fourier/Test.conduction.arc | 54 +++----
fourier/Test.conduction.heterogeneous.10k.arc | 34 ++---
fourier/Test.conduction.heterogeneous.arc | 34 ++---
fourier/Test.conduction.quad4.arc | 42 +++---
fourier/Test.manufacture.solution.arc | 8 +-
laplace/Fem.axl | 122 +---------------
laplace/FemModule.cc | 15 +-
laplace/FemModule.h | 1 +
laplace/Test.L-shape.3D.arc | 18 +--
laplace/Test.PointDirichlet-refined.arc | 34 ++---
laplace/Test.PointDirichlet.arc | 34 ++---
laplace/Test.ring.arc | 18 +--
32 files changed, 554 insertions(+), 695 deletions(-)
create mode 100644 femutils/FemBoundaryConditions.axl
create mode 100644 femutils/FemBoundaryConditions.cc
create mode 100644 femutils/IArcaneFemBC.h
diff --git a/acoustics/Fem.axl b/acoustics/Fem.axl
index 34a589b..5cad225 100644
--- a/acoustics/Fem.axl
+++ b/acoustics/Fem.axl
@@ -38,122 +38,10 @@
Type of mesh provided to the solver
-
-
-
-
- Dirichlet boundary condition
-
-
-
- FaceGroup on which to apply these boundary condition
-
-
-
-
- Value of the boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
-
-
- Dirichlet boundary condition
-
-
-
- Function for Dirichlet boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
- Function for manufactured source term condition
-
-
-
-
-
-
-
- Dirichlet point condition
-
-
-
- NodeGroup on which to apply these point Dirichlet condition
-
-
-
-
- Value of the point Dirichlet condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
-
- Neumann boundary condition
-
-
- FaceGroup on which to apply the boundary condition
-
-
-
- Value of the boundary condition
-
-
-
- Neumann load value in x-direction
-
-
-
- Neumann load value in y-direction
-
-
-
+
+
+
diff --git a/acoustics/FemModule.cc b/acoustics/FemModule.cc
index 7521f91..e6c8abb 100644
--- a/acoustics/FemModule.cc
+++ b/acoustics/FemModule.cc
@@ -116,8 +116,11 @@ _assembleLinearOperator()
const auto node_dof(m_dofs_on_nodes.nodeDoFConnectivityView());
// setp 2
- for (const auto& bs : options()->neumannBoundaryCondition()) {
- ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
+ BC::IArcaneFemBC* bc = options()->boundaryConditions();
+ if(bc){
+ for (BC::INeumannBoundaryCondition* bs : bc->neumannBoundaryConditions()){
+ ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
+ }
}
}
diff --git a/acoustics/FemModule.h b/acoustics/FemModule.h
index f03f917..537e08e 100644
--- a/acoustics/FemModule.h
+++ b/acoustics/FemModule.h
@@ -25,6 +25,7 @@
#include
#include
+#include "IArcaneFemBC.h"
#include "IDoFLinearSystemFactory.h"
#include "Fem_axl.h"
#include "FemUtils.h"
diff --git a/acoustics/Test.sub.arc b/acoustics/Test.sub.arc
index 8b255ea..a73828d 100644
--- a/acoustics/Test.sub.arc
+++ b/acoustics/Test.sub.arc
@@ -34,16 +34,18 @@
.11e1
-
- inner1
- 1.0
-
+
+
+ inner1
+ 1.0
+
+
sub_2D.txt
diff --git a/acoustics/Test.sub.hypre.arc b/acoustics/Test.sub.hypre.arc
index 9a7708d..96f306f 100644
--- a/acoustics/Test.sub.hypre.arc
+++ b/acoustics/Test.sub.hypre.arc
@@ -34,16 +34,18 @@
.11e1
-
- inner1
- 1.0
-
+
+
+ inner1
+ 1.0
+
+
hypre
bicgstab
diff --git a/electrostatics/Fem.axl b/electrostatics/Fem.axl
index b78f2ab..89249c4 100644
--- a/electrostatics/Fem.axl
+++ b/electrostatics/Fem.axl
@@ -30,134 +30,11 @@
Type of mesh provided to the solver
-
-
-
- Dirichlet boundary condition
-
-
-
- FaceGroup on which to apply these boundary condition
-
-
-
-
- Value of the boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
-
- Dirichlet boundary condition
-
-
-
- Function for Dirichlet boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
- Function for manufactured source term condition
-
-
-
+
+
-
-
-
- Neumann boundary condition
-
-
-
- FaceGroup on which to apply these boundary condition
-
-
-
-
- Value of the boundary condition
-
-
-
-
- Value of the Neumann load in x
-
-
-
-
- Value of the Neumann load in y
-
-
-
-
-
-
-
-
- Dirichlet point condition
-
-
-
- NodeGroup on which to apply these point Dirichlet condition
-
-
-
-
- Value of the point Dirichlet condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
+
+
diff --git a/electrostatics/FemModule.cc b/electrostatics/FemModule.cc
index 303a84e..71509a1 100644
--- a/electrostatics/FemModule.cc
+++ b/electrostatics/FemModule.cc
@@ -136,10 +136,13 @@ _assembleLinearOperator()
ArcaneFemFunctions::BoundaryConditions2D::applyConstantSourceToRhs(qdot, mesh(), node_dof, m_node_coord, rhs_values);
}
- for (const auto& bs : options()->neumannBoundaryCondition())
+ BC::IArcaneFemBC* bc = options()->boundaryConditions();
+
+ for (BC::INeumannBoundaryCondition* bs : bc->neumannBoundaryConditions()){
ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
+ }
- for (const auto& bs : options()->dirichletBoundaryCondition())
+ for (BC::IDirichletBoundaryCondition* bs : bc->dirichletBoundaryConditions())
ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
}
diff --git a/electrostatics/FemModule.h b/electrostatics/FemModule.h
index 54654c5..5712a01 100644
--- a/electrostatics/FemModule.h
+++ b/electrostatics/FemModule.h
@@ -23,6 +23,7 @@
#include
#include
+#include "IArcaneFemBC.h"
#include "IDoFLinearSystemFactory.h"
#include "Fem_axl.h"
#include "FemUtils.h"
diff --git a/electrostatics/Test.Capacitor.arc b/electrostatics/Test.Capacitor.arc
index 63174ef..ef1a82d 100644
--- a/electrostatics/Test.Capacitor.arc
+++ b/electrostatics/Test.Capacitor.arc
@@ -23,17 +23,20 @@
0.0
1.0
-
- capacitor1
- -1.0
-
-
- capacitor2
- 1.0
-
-
- Outer
- 0.0
-
+
+
+
+ capacitor1
+ -1.0
+
+
+ capacitor2
+ 1.0
+
+
+ Outer
+ 0.0
+
+
diff --git a/electrostatics/Test.box-rods.arc b/electrostatics/Test.box-rods.arc
index a04bfb0..d817174 100644
--- a/electrostatics/Test.box-rods.arc
+++ b/electrostatics/Test.box-rods.arc
@@ -21,20 +21,23 @@
+
0.0
1.0
test_1.txt
-
- rod1
- -1.0
-
-
- rod2
- 1.0
-
-
- external
- 0.0
-
+
+
+ rod1
+ -1.0
+
+
+ rod2
+ 1.0
+
+
+ external
+ 0.0
+
+
diff --git a/electrostatics/Test.rod-circle.arc b/electrostatics/Test.rod-circle.arc
index fce4133..fa84582 100644
--- a/electrostatics/Test.rod-circle.arc
+++ b/electrostatics/Test.rod-circle.arc
@@ -24,17 +24,20 @@
0.0
1.0
test_2.txt
-
- rod1
- -1.0
-
-
- circle
- 1.0
-
-
- external
- 0.0
-
+
+
+
+ rod1
+ -1.0
+
+
+ circle
+ 1.0
+
+
+ external
+ 0.0
+
+
diff --git a/femutils/ArcaneFemFunctions.h b/femutils/ArcaneFemFunctions.h
index cb08e24..5543745 100644
--- a/femutils/ArcaneFemFunctions.h
+++ b/femutils/ArcaneFemFunctions.h
@@ -633,25 +633,25 @@ static inline Real4 computeGradientZTetra4(Cell cell, const VariableNodeReal3& n
*/
/*---------------------------------------------------------------------------*/
- static inline void applyNeumannToRhs(const CaseOptionsFem::CaseOptionNeumannBoundaryConditionValue* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, Arcane::VariableDoFReal& rhs_values)
+ static inline void applyNeumannToRhs(BC::INeumannBoundaryCondition* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, Arcane::VariableDoFReal& rhs_values)
{
- FaceGroup group = bs->surface();
+ FaceGroup group = bs->getSurface();
Real value = 0.0;
Real valueX = 0.0;
Real valueY = 0.0;
- bool hasValue = bs->value.isPresent();
- bool hasValueX = bs->valueX.isPresent();
- bool hasValueY = bs->valueY.isPresent();
+ bool hasValue = bs->hasValue();
+ bool hasValueX = bs->getValueX();
+ bool hasValueY = bs->getValueY();
if (hasValue) {
- value = bs->value();
+ value = bs->getValue();
}
else {
if (hasValueX)
- valueX = bs->valueX();
+ valueX = bs->getValueX();
if (hasValueY)
- valueY = bs->valueY();
+ valueY = bs->getValueY();
}
ENUMERATE_ (Face, iface, group) {
@@ -693,11 +693,11 @@ static inline Real4 computeGradientZTetra4(Cell cell, const VariableNodeReal3& n
* @param [OUT] rhs_values RHS : RHS values to update.
*/
/*---------------------------------------------------------------------------*/
- static inline void applyDirichletToLhsAndRhs(const CaseOptionsFem::CaseOptionDirichletBoundaryConditionValue* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, FemUtils::DoFLinearSystem& m_linear_system, Arcane::VariableDoFReal& rhs_values)
+ static inline void applyDirichletToLhsAndRhs(BC::IDirichletBoundaryCondition* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, FemUtils::DoFLinearSystem& m_linear_system, Arcane::VariableDoFReal& rhs_values)
{
- FaceGroup group = bs->surface();
- Real value = bs->value();
- Real Penalty = bs->penalty();
+ FaceGroup group = bs->getSurface();
+ Real value = bs->getValue();
+ Real Penalty = bs->getPenalty();
ENUMERATE_ (Face, iface, group) {
for (Node node : iface->nodes()) {
@@ -726,11 +726,11 @@ static inline Real4 computeGradientZTetra4(Cell cell, const VariableNodeReal3& n
* @param [OUT] rhs_values RHS : RHS values to update.
*/
/*---------------------------------------------------------------------------*/
- static inline void applyPointDirichletToLhsAndRhs(const CaseOptionsFem::CaseOptionDirichletPointConditionValue* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, FemUtils::DoFLinearSystem& m_linear_system, Arcane::VariableDoFReal& rhs_values)
+ static inline void applyPointDirichletToLhsAndRhs(BC::IDirichletPointCondition* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, FemUtils::DoFLinearSystem& m_linear_system, Arcane::VariableDoFReal& rhs_values)
{
- NodeGroup group = bs->node();
- Real value = bs->value();
- Real Penalty = bs->penalty();
+ NodeGroup group = bs->getNode();
+ Real value = bs->getValue();
+ Real Penalty = bs->getPenalty();
ENUMERATE_ (Node, inode, group) {
Node node = *inode;
@@ -760,9 +760,9 @@ static inline Real4 computeGradientZTetra4(Cell cell, const VariableNodeReal3& n
* @param [OUT] rhs_values RHS : RHS values to update.
*/
/*---------------------------------------------------------------------------*/
- static inline void applyManufacturedDirichletToLhsAndRhs(IBinaryMathFunctor* manufactured_dirichlet, const Arcane::Real& lambda, const Arcane::FaceGroup& group, const CaseOptionsFem::CaseOptionManufacturedSolutionValue* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, FemUtils::DoFLinearSystem& m_linear_system, Arcane::VariableDoFReal& rhs_values)
+ static inline void applyManufacturedDirichletToLhsAndRhs(IBinaryMathFunctor* manufactured_dirichlet, const Arcane::Real& lambda, const Arcane::FaceGroup& group, BC::IManufacturedSolution* bs, const Arcane::IndexedNodeDoFConnectivityView& node_dof, const Arcane::VariableNodeReal3& node_coord, FemUtils::DoFLinearSystem& m_linear_system, Arcane::VariableDoFReal& rhs_values)
{
- Real Penalty = bs->penalty();
+ Real Penalty = bs->getPenalty();
ENUMERATE_ (Face, iface, group) {
for (Node node : iface->nodes()) {
diff --git a/femutils/CMakeLists.txt b/femutils/CMakeLists.txt
index 3376abd..2b836fd 100644
--- a/femutils/CMakeLists.txt
+++ b/femutils/CMakeLists.txt
@@ -10,17 +10,20 @@ add_library(FemUtils
CsrFormatMatrix.cc
FemDoFsOnNodes.h
FemDoFsOnNodes.cc
+ FemBoundaryConditions.cc
ArcaneFemFunctions.h
AlephDoFLinearSystem.cc
IDoFLinearSystemFactory.h
AlephDoFLinearSystemFactory_axl.h
SequentialBasicDoFLinearSystemFactory_axl.h
HypreDoFLinearSystemFactory_axl.h
+ FemBoundaryConditions_axl.h
)
arcane_generate_axl(AlephDoFLinearSystemFactory)
arcane_generate_axl(SequentialBasicDoFLinearSystemFactory)
arcane_generate_axl(HypreDoFLinearSystemFactory)
+arcane_generate_axl(FemBoundaryConditions)
target_compile_definitions(FemUtils PRIVATE $<$:ENABLE_DEBUG_MATRIX>)
diff --git a/femutils/FemBoundaryConditions.axl b/femutils/FemBoundaryConditions.axl
new file mode 100644
index 0000000..a58ca30
--- /dev/null
+++ b/femutils/FemBoundaryConditions.axl
@@ -0,0 +1,136 @@
+
+
+ Service to apply Dirichlet BC
+
+
+
+
+
+ Neumann boundary condition
+
+
+
+ FaceGroup on which to apply these boundary condition
+
+
+
+
+ Value of the boundary condition
+
+
+
+
+ Value of the Neumann load in x
+
+
+
+
+ Value of the Neumann load in y
+
+
+
+
+
+
+ Dirichlet point condition
+
+
+
+ NodeGroup on which to apply these point Dirichlet condition
+
+
+
+
+ Value of the point Dirichlet condition
+
+
+
+
+ Method via which Dirichlet boundary condition is imposed
+
+
+
+
+ Penalty value for enforcing Dirichlet condition
+
+
+
+
+
+
+ Dirichlet boundary condition
+
+
+
+ NodeGroup on which to apply these point Dirichlet condition
+
+
+
+
+ Value of the point Dirichlet condition
+
+
+
+
+ Method via which Dirichlet boundary condition is imposed
+
+
+
+
+ Penalty value for enforcing Dirichlet condition
+
+
+
+
+
+
+ Dirichlet boundary condition
+
+
+
+ Function for Dirichlet boundary condition
+
+
+
+
+ Method via which Dirichlet boundary condition is imposed
+
+
+
+
+ Penalty value for enforcing Dirichlet condition
+
+
+
+
+ Function for manufactured source term condition
+
+
+
+
+
+ handler of boundary conditions
+
+
+
+
\ No newline at end of file
diff --git a/femutils/FemBoundaryConditions.cc b/femutils/FemBoundaryConditions.cc
new file mode 100644
index 0000000..42b7220
--- /dev/null
+++ b/femutils/FemBoundaryConditions.cc
@@ -0,0 +1,30 @@
+// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
+//-----------------------------------------------------------------------------
+// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
+// See the top-level COPYRIGHT file for details.
+// SPDX-License-Identifier: Apache-2.0
+//-----------------------------------------------------------------------------
+
+#include "IArcaneFemBC.h"
+#include "FemBoundaryConditions_axl.h"
+
+using namespace Arcane;
+
+
+class FemBoundaryConditionsService
+: public ArcaneFemBoundaryConditionsObject
+{
+ public:
+ explicit FemBoundaryConditionsService(const ServiceBuildInfo & sbi)
+ : ArcaneFemBoundaryConditionsObject(sbi) {}
+
+ ConstArrayView dirichletPointConditions() { return options()->getDirichletPoint(); }
+ ConstArrayView dirichletBoundaryConditions() { return options()->getDirichlet(); }
+ ConstArrayView neumannBoundaryConditions() { return options()->getNeumann(); }
+ ConstArrayView manufacturedSolutions() { return options()->getManufacturedSolution(); }
+ String getHandler() { return options()->getHandler();}
+};
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+ARCANE_REGISTER_SERVICE_FEMBOUNDARYCONDITIONS(FemBoundaryConditions, FemBoundaryConditionsService);
\ No newline at end of file
diff --git a/femutils/IArcaneFemBC.h b/femutils/IArcaneFemBC.h
new file mode 100644
index 0000000..071f6bc
--- /dev/null
+++ b/femutils/IArcaneFemBC.h
@@ -0,0 +1,73 @@
+// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
+//-----------------------------------------------------------------------------
+// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
+// See the top-level COPYRIGHT file for details.
+// SPDX-License-Identifier: Apache-2.0
+//-----------------------------------------------------------------------------
+#ifndef IARCANEFEMBC_H
+#define IARCANEFEMBC_H
+
+#include
+#include
+
+using namespace Arcane;
+
+namespace BC
+{
+
+class IDirichletPointCondition
+{
+ public:
+ virtual Arcane::NodeGroup getNode() =0;
+ virtual Real getValue() =0;
+ virtual Real getPenalty() =0;
+ virtual String getEnforceDirichletMethod() =0;
+};
+
+class IDirichletBoundaryCondition
+{
+ public:
+ virtual Arcane::FaceGroup getSurface() =0;
+ virtual Real getValue() =0;
+ virtual Real getPenalty() =0;
+ virtual String getEnforceDirichletMethod() =0;
+};
+
+class INeumannBoundaryCondition
+{
+ public:
+ virtual Arcane::FaceGroup getSurface() =0;
+ virtual Real getValue() =0;
+ virtual Real getValueX() =0;
+ virtual Real getValueY() =0;
+ virtual bool hasValue() const =0;
+ virtual bool hasValueX() const =0;
+ virtual bool hasValueY() const =0;
+};
+
+class IManufacturedSolution
+{
+ public:
+ virtual bool getManufacturedSource() =0;
+ virtual bool getManufacturedDirichlet() =0;
+ virtual Real getPenalty() =0;
+ virtual String getEnforceDirichletMethod() =0;
+};
+
+class IArcaneFemBC
+{
+ public:
+ virtual ~IArcaneFemBC() = default;
+ virtual ConstArrayView dirichletPointConditions() =0;
+ virtual ConstArrayView dirichletBoundaryConditions() =0;
+ virtual ConstArrayView neumannBoundaryConditions() =0;
+ virtual ConstArrayView manufacturedSolutions() =0;
+ virtual String getHandler() =0;
+};
+
+}
+
+/*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+#endif
\ No newline at end of file
diff --git a/fourier/Fem.axl b/fourier/Fem.axl
index 99d60d4..dcea0cf 100644
--- a/fourier/Fem.axl
+++ b/fourier/Fem.axl
@@ -33,37 +33,6 @@
Type of mesh provided to the solver
-
-
-
- Dirichlet boundary condition
-
-
-
- FaceGroup on which to apply these boundary condition
-
-
-
-
- Value of the boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
-
-
- Neumann boundary condition
-
-
-
- FaceGroup on which to apply these boundary condition
-
-
-
-
- Value of the boundary condition
-
-
-
-
- Value of the Neumann load in x
-
-
-
-
- Value of the Neumann load in y
-
-
-
-
-
-
-
-
- Dirichlet point condition
-
-
-
- NodeGroup on which to apply these point Dirichlet condition
-
-
-
-
- Value of the point Dirichlet condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
+
+
+
+
+
+
diff --git a/fourier/FemModule.cc b/fourier/FemModule.cc
index 01cc540..13f5933 100644
--- a/fourier/FemModule.cc
+++ b/fourier/FemModule.cc
@@ -180,26 +180,28 @@ _assembleLinearOperator()
if (options()->qdot.isPresent())
ArcaneFemFunctions::BoundaryConditions2D::applyConstantSourceToRhs(qdot, mesh(), node_dof, m_node_coord, rhs_values);
- for (const auto& bs : options()->neumannBoundaryCondition())
- ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
- for (const auto& bs : options()->dirichletBoundaryCondition())
- ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
+ BC::IArcaneFemBC* bc = options()->boundaryConditions();
- if (options()->manufacturedSolution.isPresent()) {
- const auto& bs = options()->manufacturedSolution()[0];
+ if(bc){
+ for (BC::INeumannBoundaryCondition* bs : bc->neumannBoundaryConditions())
+ ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
- if (bs->manufacturedSource.isPresent()) {
- ARCANE_CHECK_POINTER(m_manufactured_source);
- info() << "Apply manufactured Source condition to all cells";
- ArcaneFemFunctions::BoundaryConditions2D::applyManufacturedSourceToRhs(m_manufactured_source, mesh(), node_dof, m_node_coord, rhs_values);
- }
+ for (BC::IDirichletBoundaryCondition* bs : bc->dirichletBoundaryConditions())
+ ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
- if (bs->manufacturedDirichlet.isPresent()) {
- ARCANE_CHECK_POINTER(m_manufactured_dirichlet);
- info() << "Apply manufactured dirichlet condition to all borders";
- FaceGroup group = mesh()->outerFaces();
- ArcaneFemFunctions::BoundaryConditions2D::applyManufacturedDirichletToLhsAndRhs(m_manufactured_dirichlet, lambda, group, bs, node_dof, m_node_coord, m_linear_system, rhs_values);
+ for (BC::IManufacturedSolution* bs : bc->manufacturedSolutions()){
+ if (bs->getManufacturedSource()){
+ ARCANE_CHECK_POINTER(m_manufactured_source);
+ info() << "Apply manufactured Source condition to all cells";
+ ArcaneFemFunctions::BoundaryConditions2D::applyManufacturedSourceToRhs(m_manufactured_source, mesh(), node_dof, m_node_coord, rhs_values);
+ }
+ if (bs->getManufacturedDirichlet()){
+ ARCANE_CHECK_POINTER(m_manufactured_dirichlet);
+ info() << "Apply manufactured dirichlet condition to all borders";
+ FaceGroup group = mesh()->outerFaces();
+ ArcaneFemFunctions::BoundaryConditions2D::applyManufacturedDirichletToLhsAndRhs(m_manufactured_dirichlet, lambda, group, bs, node_dof, m_node_coord, m_linear_system, rhs_values);
+ }
}
}
}
diff --git a/fourier/FemModule.h b/fourier/FemModule.h
index 218c1d9..4063baf 100644
--- a/fourier/FemModule.h
+++ b/fourier/FemModule.h
@@ -28,6 +28,7 @@
#include
#include
+#include "IArcaneFemBC.h"
#include "IDoFLinearSystemFactory.h"
#include "Fem_axl.h"
#include "FemUtils.h"
diff --git a/fourier/Test.conduction.10k.arc b/fourier/Test.conduction.10k.arc
index 2c9ff8c..4aa9a4f 100644
--- a/fourier/Test.conduction.10k.arc
+++ b/fourier/Test.conduction.10k.arc
@@ -22,25 +22,33 @@
1.75
1e5
-
- Cercle
- 50.0
-
-
- Bas
- 5.0
-
-
- Haut
- 21.0
-
-
- Droite
- 15.0
-
-
- Gauche
- 0.0
-
+
+
+ Penalty
+ 1.e12
+ Cercle
+ 50.0
+
+
+ Penalty
+ 1.e12
+ Bas
+ 5.0
+
+
+ Penalty
+ 1.e12
+ Haut
+ 21.0
+
+
+ Droite
+ 15.0
+
+
+ Gauche
+ 0.0
+
+
diff --git a/fourier/Test.conduction.arc b/fourier/Test.conduction.arc
index 45dedbd..26848de 100644
--- a/fourier/Test.conduction.arc
+++ b/fourier/Test.conduction.arc
@@ -23,31 +23,33 @@
1.75
1e5
test1_results.txt
-
- Penalty
- 1.e12
- Cercle
- 50.0
-
-
- Penalty
- 1.e12
- Bas
- 5.0
-
-
- Penalty
- 1.e12
- Haut
- 21.0
-
-
- Droite
- 15.0
-
-
- Gauche
- 0.0
-
+
+
+ Penalty
+ 1.e12
+ Cercle
+ 50.0
+
+
+ Penalty
+ 1.e12
+ Bas
+ 5.0
+
+
+ Penalty
+ 1.e12
+ Haut
+ 21.0
+
+
+ Droite
+ 15.0
+
+
+ Gauche
+ 0.0
+
+
diff --git a/fourier/Test.conduction.heterogeneous.10k.arc b/fourier/Test.conduction.heterogeneous.10k.arc
index 93347b3..21ddb40 100644
--- a/fourier/Test.conduction.heterogeneous.10k.arc
+++ b/fourier/Test.conduction.heterogeneous.10k.arc
@@ -22,22 +22,24 @@
0.0
15.
-
- Left
- 50.0
-
-
- Right
- 5.0
-
-
- Top
- 0.0
-
-
- Bot
- 0.0
-
+
+
+ Left
+ 50.0
+
+
+ Right
+ 5.0
+
+
+ Top
+ 0.0
+
+
+ Bot
+ 0.0
+
+
Mat1
100.0
diff --git a/fourier/Test.conduction.heterogeneous.arc b/fourier/Test.conduction.heterogeneous.arc
index 3c2ebb3..c3deeb0 100644
--- a/fourier/Test.conduction.heterogeneous.arc
+++ b/fourier/Test.conduction.heterogeneous.arc
@@ -23,22 +23,24 @@
0.0
15.
test2_results.txt
-
- Left
- 50.0
-
-
- Right
- 5.0
-
-
- Top
- 0.0
-
-
- Bot
- 0.0
-
+
+
+ Left
+ 50.0
+
+
+ Right
+ 5.0
+
+
+ Top
+ 0.0
+
+
+ Bot
+ 0.0
+
+
Mat1
100.0
diff --git a/fourier/Test.conduction.quad4.arc b/fourier/Test.conduction.quad4.arc
index c5dfeb3..03bd31b 100644
--- a/fourier/Test.conduction.quad4.arc
+++ b/fourier/Test.conduction.quad4.arc
@@ -23,25 +23,27 @@
1.75
1e5
QUAD4
-
- Cercle
- 50.0
-
-
- Bas
- 5.0
-
-
- Haut
- 21.0
-
-
- Droite
- 15.0
-
-
- Gauche
- 0.0
-
+
+
+ Cercle
+ 50.0
+
+
+ Bas
+ 5.0
+
+
+ Haut
+ 21.0
+
+
+ Droite
+ 15.0
+
+
+ Gauche
+ 0.0
+
+
diff --git a/fourier/Test.manufacture.solution.arc b/fourier/Test.manufacture.solution.arc
index 66bd5e1..dfd9608 100644
--- a/fourier/Test.manufacture.solution.arc
+++ b/fourier/Test.manufacture.solution.arc
@@ -31,8 +31,14 @@
true
true
- Penalty
+
+
+ true
+ true
+ Penalty
+
+
1.0
diff --git a/laplace/Fem.axl b/laplace/Fem.axl
index a4fcc33..0de81d0 100644
--- a/laplace/Fem.axl
+++ b/laplace/Fem.axl
@@ -21,125 +21,11 @@
Type of mesh provided to the solver
-
-
-
- Dirichlet boundary condition
-
-
-
- Function for Dirichlet boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
- Function for manufactured source term condition
-
-
-
+
+
-
-
-
- Dirichlet boundary condition
-
-
-
- FaceGroup on which to apply these boundary condition
-
-
-
-
- Value of the boundary condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
+
+
-
-
- Neumann boundary condition
-
-
- FaceGroup on which to apply the boundary condition
-
-
-
- Value of the boundary condition
-
-
-
- Neumann load value in x-direction
-
-
-
- Neumann load value in y-direction
-
-
-
-
-
-
-
-
- Dirichlet point condition
-
-
-
- NodeGroup on which to apply these point Dirichlet condition
-
-
-
-
- Value of the point Dirichlet condition
-
-
-
-
- Method via which Dirichlet boundary condition is imposed
-
-
-
-
- Penalty value for enforcing Dirichlet condition
-
-
-
-
-
diff --git a/laplace/FemModule.cc b/laplace/FemModule.cc
index de2ce13..211e90c 100644
--- a/laplace/FemModule.cc
+++ b/laplace/FemModule.cc
@@ -123,14 +123,17 @@ _assembleLinearOperator()
auto node_dof(m_dofs_on_nodes.nodeDoFConnectivityView());
- for (const auto& bs : options()->neumannBoundaryCondition())
- ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
+ BC::IArcaneFemBC* bc = options()->boundaryConditions();
+ if(bc){
+ for (BC::INeumannBoundaryCondition* bs : bc->neumannBoundaryConditions())
+ ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values);
- for (const auto& bs : options()->dirichletBoundaryCondition())
- ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
+ for (BC::IDirichletBoundaryCondition* bs : bc->dirichletBoundaryConditions())
+ ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
- for (const auto& bs : options()->dirichletPointCondition())
- ArcaneFemFunctions::BoundaryConditions2D::applyPointDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
+ for (BC::IDirichletPointCondition* bs : bc->dirichletPointConditions())
+ ArcaneFemFunctions::BoundaryConditions2D::applyPointDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values);
+ }
}
/*---------------------------------------------------------------------------*/
diff --git a/laplace/FemModule.h b/laplace/FemModule.h
index a423597..04d432f 100644
--- a/laplace/FemModule.h
+++ b/laplace/FemModule.h
@@ -25,6 +25,7 @@
#include
#include
+#include "IArcaneFemBC.h"
#include "IDoFLinearSystemFactory.h"
#include "Fem_axl.h"
#include "FemUtils.h"
diff --git a/laplace/Test.L-shape.3D.arc b/laplace/Test.L-shape.3D.arc
index 7f69e21..439c532 100644
--- a/laplace/Test.L-shape.3D.arc
+++ b/laplace/Test.L-shape.3D.arc
@@ -22,13 +22,15 @@
test_3D_L-shape.txt
TETRA4
-
- bot
- 50.0
-
-
- bc
- 10.0
-
+
+
+ bot
+ 50.0
+
+
+ bc
+ 10.0
+
+
diff --git a/laplace/Test.PointDirichlet-refined.arc b/laplace/Test.PointDirichlet-refined.arc
index 8ac11dc..4b9a122 100644
--- a/laplace/Test.PointDirichlet-refined.arc
+++ b/laplace/Test.PointDirichlet-refined.arc
@@ -20,21 +20,23 @@
-
- topLeftCorner
- 50.0
-
-
- topRightCorner
- 20.0
-
-
- botLeftCorner
- 20.0
-
-
- botRightCorner
- 50.0
-
+
+
+ topLeftCorner
+ 50.0
+
+
+ topRightCorner
+ 20.0
+
+
+ botLeftCorner
+ 20.0
+
+
+ botRightCorner
+ 50.0
+
+
diff --git a/laplace/Test.PointDirichlet.arc b/laplace/Test.PointDirichlet.arc
index 5109b1b..29306da 100644
--- a/laplace/Test.PointDirichlet.arc
+++ b/laplace/Test.PointDirichlet.arc
@@ -21,22 +21,24 @@
test3_results.txt
-
- topLeftCorner
- 50.0
-
-
- topRightCorner
- 20.0
-
-
- botLeftCorner
- 20.0
-
-
- botRightCorner
- 50.0
-
+
+
+ topLeftCorner
+ 50.0
+
+
+ topRightCorner
+ 20.0
+
+
+ botLeftCorner
+ 20.0
+
+
+ botRightCorner
+ 50.0
+
+
diff --git a/laplace/Test.ring.arc b/laplace/Test.ring.arc
index b135c42..53ddbc2 100644
--- a/laplace/Test.ring.arc
+++ b/laplace/Test.ring.arc
@@ -20,13 +20,15 @@
-
- inner
- 50.0
-
-
- outer
- 20.0
-
+
+
+ inner
+ 50.0
+
+
+ outer
+ 20.0
+
+