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..d8caf98 --- /dev/null +++ b/femutils/IArcaneFemBC.h @@ -0,0 +1,78 @@ +// -*- 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 +#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; + virtual ICaseFunction* getManufacturedDirichletFunction() =0; + virtual IStandardFunction* getManufacturedDirichletStandardFunction() =0; + virtual ICaseFunction* getManufacturedSourceFunction() =0; + virtual IStandardFunction* getManufacturedSourceStandardFunction() =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..719d859 100644 --- a/fourier/Fem.axl +++ b/fourier/Fem.axl @@ -33,131 +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 - - - - - - - - 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/fourier/FemModule.cc b/fourier/FemModule.cc index 01cc540..7acfce2 100644 --- a/fourier/FemModule.cc +++ b/fourier/FemModule.cc @@ -30,12 +30,12 @@ startInit() m_dofs_on_nodes.initialize(mesh(), 1); m_dof_family = m_dofs_on_nodes.dofFamily(); - if (options()->manufacturedSolution.isPresent()) { - const auto& bs = options()->manufacturedSolution()[0]; + BC::IArcaneFemBC* bc = options()->boundaryConditions(); - if (bs->manufacturedSource.isPresent()) { - ICaseFunction* opt_function_source = bs->manufacturedSource.function(); - IStandardFunction* scf_source = bs->manufacturedSource.standardFunction(); + for (BC::IManufacturedSolution* bs : bc->manufacturedSolutions()) { + if (bs->getManufacturedSource()) { + ICaseFunction* opt_function_source = bs->getManufacturedSourceFunction(); + IStandardFunction* scf_source = bs->getManufacturedSourceStandardFunction(); if (!scf_source) ARCANE_FATAL("No standard case function for option 'manufactured-source-condition'"); auto* functorS = scf_source->getFunctorRealReal3ToReal(); @@ -44,9 +44,9 @@ startInit() m_manufactured_source = functorS; } - if (bs->manufacturedDirichlet.isPresent()) { - ICaseFunction* opt_function = bs->manufacturedDirichlet.function(); - IStandardFunction* scf = bs->manufacturedDirichlet.standardFunction(); + if (bs->getManufacturedDirichlet()) { + ICaseFunction* opt_function = bs->getManufacturedDirichletFunction(); + IStandardFunction* scf = bs->getManufacturedDirichletStandardFunction(); if (!scf) ARCANE_FATAL("No standard case function for option 'manufactured-dirichlet-condition'"); auto* functor = scf->getFunctorRealReal3ToReal(); @@ -180,26 +180,27 @@ _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); + BC::IArcaneFemBC* bc = options()->boundaryConditions(); - for (const auto& bs : options()->dirichletBoundaryCondition()) - ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, rhs_values); + if (bc) { + for (BC::INeumannBoundaryCondition* bs : bc->neumannBoundaryConditions()) + ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, node_dof, m_node_coord, rhs_values); - if (options()->manufacturedSolution.isPresent()) { - const auto& bs = options()->manufacturedSolution()[0]; + for (BC::IDirichletBoundaryCondition* bs : bc->dirichletBoundaryConditions()) + ArcaneFemFunctions::BoundaryConditions2D::applyDirichletToLhsAndRhs(bs, node_dof, m_node_coord, m_linear_system, 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); - } - - 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); + } } } } @@ -328,16 +329,16 @@ _solve() m_u[node] = v; } - if (options()->manufacturedSolution.isPresent()) { + for (BC::IManufacturedSolution* bs : options()->boundaryConditions()->manufacturedSolutions()) ENUMERATE_ (Node, inode, ownNodes()) { Node node = *inode; m_u_exact[node] = m_manufactured_dirichlet->apply(lambda, m_node_coord[node]); } - } } m_u.synchronize(); - if (options()->manufacturedSolution.isPresent()) + + for (BC::IManufacturedSolution* bs : options()->boundaryConditions()->manufacturedSolutions()) m_u_exact.synchronize(); } 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..d70c66b 100644 --- a/fourier/Test.conduction.10k.arc +++ b/fourier/Test.conduction.10k.arc @@ -1,46 +1,87 @@ + + + - Sample + Fouriers equation FEM code fine mesh FourierLoop - - 1 - - - U - - - + plancher.10k.msh + 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 + + + + + + 1 + + + U + + + diff --git a/fourier/Test.conduction.arc b/fourier/Test.conduction.arc index 45dedbd..394cd12 100644 --- a/fourier/Test.conduction.arc +++ b/fourier/Test.conduction.arc @@ -1,53 +1,89 @@ + + + - Sample + Fouriers equation FEM code FourierLoop - - 1 - - - U - - - + plancher.msh + 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 + + + + + + 1 + + + U + + + diff --git a/fourier/Test.conduction.heterogeneous.10k.arc b/fourier/Test.conduction.heterogeneous.10k.arc index 93347b3..804fad6 100644 --- a/fourier/Test.conduction.heterogeneous.10k.arc +++ b/fourier/Test.conduction.heterogeneous.10k.arc @@ -1,43 +1,67 @@ + + + - Sample + Fouriers equation FEM code with heterogenous material and fine mesh FourierLoop - - 1 - - - U - - - + multi-material.10k.msh + 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 @@ -47,4 +71,19 @@ 1.0 + + + + 1 + + + U + + + diff --git a/fourier/Test.conduction.heterogeneous.arc b/fourier/Test.conduction.heterogeneous.arc index 3c2ebb3..07961f6 100644 --- a/fourier/Test.conduction.heterogeneous.arc +++ b/fourier/Test.conduction.heterogeneous.arc @@ -1,44 +1,69 @@ + + + - Sample + Fouriers equation FEM code with heterogenous material FourierLoop - - 1 - - - U - - - + multi-material.msh + 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 @@ -48,4 +73,19 @@ 1.0 + + + + 1 + + + U + + + diff --git a/fourier/Test.conduction.quad4.arc b/fourier/Test.conduction.quad4.arc index c5dfeb3..7e9e368 100644 --- a/fourier/Test.conduction.quad4.arc +++ b/fourier/Test.conduction.quad4.arc @@ -1,47 +1,83 @@ + + + - Sample + Fouriers equation FEM code with quad mesh FourierLoop - - 1 - - - U - - - + plancher.quad4.msh + 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 + + - + + + + 1 + + + U + + + + \ No newline at end of file diff --git a/fourier/Test.manufacture.solution.arc b/fourier/Test.manufacture.solution.arc index 66bd5e1..09d5762 100644 --- a/fourier/Test.manufacture.solution.arc +++ b/fourier/Test.manufacture.solution.arc @@ -1,25 +1,41 @@ + + + - Sample + Fouriers equation FEM code with maufactured solution FourierLoop - - 1 - - - U - UExact - - - + square_-2pi_to_2pi.msh + ExternalFunctions.dll @@ -27,12 +43,39 @@ + - - true - true - Penalty - + + + true + true + Penalty + + 1.0 + + + + 1 + + + U + UExact + + + 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 + +