Skip to content

Commit

Permalink
manufacture solutions via service
Browse files Browse the repository at this point in the history
  • Loading branch information
mohd-afeef-badri committed Aug 30, 2024
1 parent 2d51d12 commit 13f9220
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 49 deletions.
5 changes: 5 additions & 0 deletions femutils/IArcaneFemBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <arcane/ItemTypes.h>
#include <arcane/VariableTypedef.h>
#include <arcane/core/IStandardFunction.h>

using namespace Arcane;

Expand Down Expand Up @@ -52,6 +53,10 @@ class IManufacturedSolution
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
Expand Down
31 changes: 0 additions & 31 deletions fourier/Fem.axl
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,6 @@
<description>Type of mesh provided to the solver</description>
</simple>

<!-- - - - - - manufactured-solution - - - - -->
<complex name = "manufactured-solution"
type = "ManufacturedSolution"
minOccurs = "0"
maxOccurs = "unbounded"
>
<description>
Dirichlet boundary condition
</description>
<simple name="manufactured-dirichlet" type="bool" default="false" optional="true">
<description>
Function for Dirichlet boundary condition
</description>
</simple>
<simple name = "enforce-Dirichlet-method" type = "string" default="Penalty" optional="true">
<description>
Method via which Dirichlet boundary condition is imposed
</description>
</simple>
<simple name = "penalty" type = "real" default="1.e30" optional="true">
<description>
Penalty value for enforcing Dirichlet condition
</description>
</simple>
<simple name="manufactured-source" type="bool" default="false" optional="true">
<description>
Function for manufactured source term condition
</description>
</simple>
</complex>

<!-- - - - - - material-property - - - - -->
<complex name = "material-property"
type = "MaterialProperty"
Expand Down
27 changes: 13 additions & 14 deletions fourier/FemModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -180,23 +180,22 @@ _assembleLinearOperator()
if (options()->qdot.isPresent())
ArcaneFemFunctions::BoundaryConditions2D::applyConstantSourceToRhs(qdot, mesh(), node_dof, m_node_coord, rhs_values);


BC::IArcaneFemBC* bc = options()->boundaryConditions();

if(bc){
if (bc) {
for (BC::INeumannBoundaryCondition* bs : bc->neumannBoundaryConditions())
ArcaneFemFunctions::BoundaryConditions2D::applyNeumannToRhs(bs, 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);

for (BC::IManufacturedSolution* bs : bc->manufacturedSolutions()){
if (bs->getManufacturedSource()){
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);
ArcaneFemFunctions::BoundaryConditions2D::applyManufacturedSourceToRhs(m_manufactured_source, mesh(), node_dof, m_node_coord, rhs_values);
}
if (bs->getManufacturedDirichlet()){
if (bs->getManufacturedDirichlet()) {
ARCANE_CHECK_POINTER(m_manufactured_dirichlet);
info() << "Apply manufactured dirichlet condition to all borders";
FaceGroup group = mesh()->outerFaces();
Expand Down
4 changes: 0 additions & 4 deletions fourier/Test.manufacture.solution.arc
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
</functions>

<fem>
<manufactured-solution>
<manufactured-dirichlet function="manufacturedDirichlet">true</manufactured-dirichlet>
<manufactured-source function="manufacturedSource">true</manufactured-source>
</manufactured-solution>
<boundary-conditions>
<manufactured-solution>
<manufactured-dirichlet function="manufacturedDirichlet">true</manufactured-dirichlet>
Expand Down

0 comments on commit 13f9220

Please sign in to comment.