Skip to content

Commit

Permalink
new geometries new tests 3D
Browse files Browse the repository at this point in the history
  • Loading branch information
mohd-afeef-badri committed Feb 27, 2025
1 parent 81ff754 commit 27bb208
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 0 deletions.
61 changes: 61 additions & 0 deletions meshes/msh/boolean.geo
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*****************************************************************************
This file is a part of ArcaneFEM (finite element tool in Arcane)
-------------------------------------------------------------------
Author(s): Mohd Afeef Badri
Email : [email protected]
Date : 27-02-2024
-------------------------------------------------------------------
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; or without even the implied warranty
of FITNESS FOR A PARTICULAR PURPOSE.
--------------------------------------------------------------------
This is a Gmsh .geo file which produces 3D boolean geometry. The file
is a copy of Gmsh's tutorial on boolean only groups have been added
here.
compile-run: gmsh -3 boolean.geo -format msh41
*******************************************************************************/

SetFactory("OpenCASCADE");

// from http://en.wikipedia.org/wiki/Constructive_solid_geometry

Mesh.Algorithm = 6;
Mesh.MeshSizeMin = 0.4;
Mesh.MeshSizeMax = 0.4;

R = DefineNumber[ 1.4 , Min 0.1, Max 2, Step 0.01,
Name "Parameters/Box dimension" ];
Rs = DefineNumber[ R*.7 , Min 0.1, Max 2, Step 0.01,
Name "Parameters/Cylinder radius" ];
Rt = DefineNumber[ R*1.25, Min 0.1, Max 2, Step 0.01,
Name "Parameters/Sphere radius" ];

Box(1) = {-R,-R,-R, 2*R,2*R,2*R};

Sphere(2) = {0,0,0,Rt};

BooleanIntersection(3) = { Volume{1}; Delete; }{ Volume{2}; Delete; };

Cylinder(4) = {-2*R,0,0, 4*R,0,0, Rs};
Cylinder(5) = {0,-2*R,0, 0,4*R,0, Rs};
Cylinder(6) = {0,0,-2*R, 0,0,4*R, Rs};

BooleanUnion(7) = { Volume{4}; Delete; }{ Volume{5,6}; Delete; };
BooleanDifference(8) = { Volume{3}; Delete; }{ Volume{7}; Delete; };

Physical Surface("left", 42) = {4};
Physical Surface("right", 43) = {6};
Physical Surface("top", 44) = {7};
Physical Surface("bottom", 45) = {8};
Physical Surface("front", 46) = {5};
Physical Surface("back", 47) = {1};
Physical Volume("vol", 48) = {8};
Binary file added meshes/msh/boolean.msh
Binary file not shown.
60 changes: 60 additions & 0 deletions meshes/msh/pipe.geo
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*****************************************************************************
This file is a part of ArcaneFEM (finite element tool in Arcane)
-------------------------------------------------------------------
Author(s): Mohd Afeef Badri
Email : [email protected]
Date : 27-02-2024
-------------------------------------------------------------------
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; or without even the implied warranty
of FITNESS FOR A PARTICULAR PURPOSE.
--------------------------------------------------------------------
This is a Gmsh .geo file which produces 3D boolean geometry. The file
is a copy of Gmsh's tutorial on boolean only groups have been added
here.
compile-run: gmsh -3 pipe.geo -format msh41
*******************************************************************************/

SetFactory("OpenCASCADE");

Mesh.MeshSizeMin = 0.1;
Mesh.MeshSizeMax = 0.1;
Geometry.NumSubEdges = 100; // nicer display of curve

nturns = DefineNumber[ 1, Min 0.1, Max 1, Step 0.01, Name "Parameters/Turn" ];
npts = 20;
r = 1;
rd = 0.1;
h = 1 * nturns;

For i In {0:npts-1}
theta = i * 2*Pi*nturns/npts;
Point(i + 1) = {r * Cos(theta), r * Sin(theta), i * h/npts};
EndFor

Spline(1) = {1:npts};
Wire(1) = {1};

Disk(1) = {1,0,0, rd};

Rectangle(2) = {1+2*rd,-rd,0, 2*rd,2*rd,rd/5};
Rotate {{1, 0, 0}, {0, 0, 0}, Pi/2} { Surface{1,2}; }

Extrude { Surface{1,2}; } Using Wire {1}
Delete{ Surface{1,2}; }

Physical Surface("leftSurfaceCircularPipe", 47) = {5};
Physical Surface("rightSurfaceCircularPipe", 48) = {3};
Physical Surface("leftSurfaceSquarePipe", 49) = {15};
Physical Surface("rightSurfaceSquarePipe", 50) = {6};
Physical Volume("SquarePipeVol", 51) = {1};
Physical Volume("CylindricalPipeVol", 52) = {2};
Binary file added meshes/msh/pipe.msh
Binary file not shown.
6 changes: 6 additions & 0 deletions modules/fourier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ set(MESH_FILES
plancher.quad4.msh
square_-2pi_to_2pi.msh
bar_dynamic_3D.msh
pipe.msh
boolean.msh
)
foreach(MESH_FILE IN LISTS MESH_FILES)
file(COPY ${MSH_DIR}/${MESH_FILE} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/meshes)
Expand Down Expand Up @@ -76,6 +78,8 @@ if(FEMUTILS_HAS_SOLVER_BACKEND_PETSC)
inputs/manufacture.solution.arc)
add_test(NAME [Fourier]conduction_3D COMMAND Fourier
inputs/conduction.3D.arc)
add_test(NAME [Fourier]conduction_boolean_3D COMMAND Fourier
inputs/conduction.boolean.3D.arc)
add_test(NAME [Fourier]manufacture_solution_3D COMMAND Fourier
-A,UsingDotNet=1
-A,//meshes/mesh/filename=meshes/bar_dynamic_3D.msh
Expand All @@ -90,6 +94,8 @@ if(FEMUTILS_HAS_SOLVER_BACKEND_PETSC)
add_test(NAME [Fourier]manufacture_solution_2p COMMAND ${MPIEXEC_EXECUTABLE} -n 2 ./Fourier
-A,UsingDotNet=1
inputs/manufacture.solution.arc)
add_test(NAME [Fourier]conduction_heterogeneous_3D_2p COMMAND ${MPIEXEC_EXECUTABLE} -n 2 ./Fourier
inputs/conduction.pipe.3D.arc)
add_test(NAME [Fourier]manufacture_solution_3D_2p COMMAND ${MPIEXEC_EXECUTABLE} -n 2 ./Fourier
-A,UsingDotNet=1
-A,//meshes/mesh/filename=meshes/bar_dynamic_3D.msh
Expand Down
90 changes: 90 additions & 0 deletions modules/fourier/inputs/conduction.boolean.3D.arc
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0"?>
<!--
Case configuration for a Fourier analysis simulation.
This file includes settings for:
- General simulation parameters
- Mesh configuration details
- Finite Element Method (FEM) configurations
- Post-processing options
-->
<case codename="Fourier" xml:lang="en" codeversion="1.0">

<!--
Arcane-specific settings:
- title: Descriptive name for the simulation case.
- timeloop: Specifies the time-stepping loop used in this Fourier simulation.
-->
<arcane>
<title>Fouriers equation FEM code</title>
<timeloop>FourierLoop</timeloop>
</arcane>

<!--
Mesh configuration:
- filename: The path to the mesh file used in the simulation.
-->
<meshes>
<mesh>
<filename>meshes/boolean.msh</filename>
</mesh>
</meshes>

<!--
FEM (Finite Element Method) settings:
- lambda: Thermal conductivity or diffusivity coefficient.
- qdot: Heat source term or volumetric heat generation.
- result-file: File where simulation results will be saved.
- boundary-conditions: Defines the boundary conditions for the simulation.
- dirichlet: Fixed value boundary condition with penalty enforcement for specified surfaces.
- neumann: Flux or gradient boundary condition for specified surfaces.
-->
<fem>
<lambda>23.5</lambda>
<qdot>1.123e-2</qdot>
<mesh-type>TETRA4</mesh-type>
<boundary-conditions>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>left</surface>
<value>55.0</value>
</dirichlet>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>right</surface>
<value>12.0</value>
</dirichlet>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>top</surface>
<value>166.0</value>
</dirichlet>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>bottom</surface>
<value>32.0</value>
</dirichlet>
<neumann>
<surface>front</surface>
<value>56.0</value>
</neumann>
<neumann>
<surface>back</surface>
<value>3.67</value>
</neumann>
</boundary-conditions>
</fem>

<!--
Post-processing settings:
- output-period: Defines how often (in simulation steps) the output is generated.
- format: Specifies the post-processing format, here using VtkHdfV2.
- output: Defines the variables to be included in the post-processing output.
-->
<arcane-post-processing>
<output-period>1</output-period>
<output>
<variable>U</variable>
</output>
</arcane-post-processing>

</case>
89 changes: 89 additions & 0 deletions modules/fourier/inputs/conduction.pipe.3D.arc
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0"?>
<!--
Case configuration for a Fourier analysis simulation.
This file includes settings for:
- General simulation parameters
- Mesh configuration details
- Finite Element Method (FEM) configurations
- Post-processing options
-->
<case codename="Fourier" xml:lang="en" codeversion="1.0">

<!--
Arcane-specific settings:
- title: Descriptive name for the simulation case.
- timeloop: Specifies the time-stepping loop used in this Fourier simulation.
-->
<arcane>
<title>Fouriers equation FEM code</title>
<timeloop>FourierLoop</timeloop>
</arcane>

<!--
Mesh configuration:
- filename: The path to the mesh file used in the simulation.
-->
<meshes>
<mesh>
<filename>meshes/pipe.msh</filename>
</mesh>
</meshes>

<!--
FEM (Finite Element Method) settings:
- lambda: Thermal conductivity or diffusivity coefficient.
- qdot: Heat source term or volumetric heat generation.
- result-file: File where simulation results will be saved.
- boundary-conditions: Defines the boundary conditions for the simulation.
- dirichlet: Fixed value boundary condition with penalty enforcement for specified surfaces.
- neumann: Flux or gradient boundary condition for specified surfaces.
-->
<fem>
<qdot>6.3e-2</qdot>
<mesh-type>TETRA4</mesh-type>
<boundary-conditions>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>leftSurfaceCircularPipe</surface>
<value>55.0</value>
</dirichlet>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>rightSurfaceCircularPipe</surface>
<value>12.0</value>
</dirichlet>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>leftSurfaceSquarePipe</surface>
<value>55.0</value>
</dirichlet>
<dirichlet>
<enforce-Dirichlet-method>Penalty</enforce-Dirichlet-method>
<surface>rightSurfaceSquarePipe</surface>
<value>12.0</value>
</dirichlet>
</boundary-conditions>
<material-property>
<volume>SquarePipeVol</volume>
<lambda>16.5</lambda>
</material-property>
<material-property>
<volume>CylindricalPipeVol</volume>
<lambda>35.8</lambda>
</material-property>
</fem>

<!--
Post-processing settings:
- output-period: Defines how often (in simulation steps) the output is generated.
- format: Specifies the post-processing format, here using VtkHdfV2.
- output: Defines the variables to be included in the post-processing output.
-->
<arcane-post-processing>
<output-period>1</output-period>
<output>
<variable>U</variable>
</output>
</arcane-post-processing>

</case>

0 comments on commit 27bb208

Please sign in to comment.