Skip to content

Commit da48ba4

Browse files
Merge pull request #37 from aurora-multiphysics/hsaunders1904/heat_conduction_in_infinite_system
Add unsteady heat conduction in infinite system example/test
2 parents bb64c27 + 8a7363d commit da48ba4

File tree

24 files changed

+1135
-4
lines changed

24 files changed

+1135
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ jobs:
4040
shell: bash
4141
run: |
4242
. /opt/openfoam/OpenFOAM-12/etc/bashrc || true
43+
pip install -r requirements.test.txt
4344
./run_tests

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ METHOD=dbg make
8080

8181
Some basic tests can be run with `./run_tests`.
8282

83-
Note that you must have installed the `fluidfoam` Python package:
83+
Note that you must have the required Python packages installed:
8484

8585
```bash
86-
pip install "fluidfoam>=0.2.4"
86+
pip install -r requirements.test.txt
8787
```
8888

8989
## Quality

include/mesh/Foam2MooseMeshGen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class Foam2MooseMeshAdapter
7676
MPI_Comm * comm = nullptr);
7777
Foam2MooseMeshAdapter() = default;
7878
~Foam2MooseMeshAdapter();
79-
std::int32_t npoint();
80-
std::int32_t nface();
79+
int32_t npoint();
80+
int32_t nface();
8181
FoamPoint const & point(uint32_t i);
8282
FoamFace face(uint32_t i);
8383
int get_patch_id(std::string const & patch_name);

requirements.test.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fluidfoam>=0.2.8
2+
scipy>=1.15.1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
polyMesh/
2+
0*
3+
1*
4+
!0/
5+
log.*
6+
processor*/
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Heat Conduction in an Infinite System
2+
3+
This simulation consists of a solid and a fluid domain.
4+
The domains have a shared interface at x = 0.
5+
The analytical solution for pure diffusion in this configuration
6+
was derived by Yoshida et al [1].
7+
8+
## Setup
9+
10+
```txt
11+
-------------------+------------------- ↑
12+
Solid | Fluid h
13+
-------------------+------------------- ↓
14+
←------- L -------→ ←------- L -------→
15+
|
16+
x = 0
17+
18+
```
19+
20+
| | Solid | Fluid |
21+
|------------------|-------|-------|
22+
| k $[W/m/K]$ | 1 | 4 |
23+
| ρ.Cp $[J/m^3/K]$ | 1 | 16 |
24+
| L $[m]$ | 1 | 1 |
25+
| h $[m]$ | 0.1 | 0.1 |
26+
| T $[K]$ | 1 | 0 |
27+
28+
All boundaries (other than the interface) have symmetry boundary conditions.
29+
The idea here is that `L` is large enough such that the system is
30+
effectively infinite in the time frame of the simulation.
31+
32+
## Analytical Solution
33+
34+
The analytical solution to the problem is:
35+
36+
$$
37+
T(x, t) =
38+
\begin{cases}
39+
T_h
40+
- \frac{(T_h - T_c) \sqrt{k_2(\rho C_p)_2}}
41+
{\sqrt{k_1(\rho C_p)_1} + \sqrt{k_2 (\rho C_p)_2}}
42+
\text{erfc}(\frac{-x}{2\sqrt{k_1 / (\rho C_p)_1 t}}),
43+
&x < 0 \text{ (Solid medium)}\\
44+
45+
T_c
46+
+ \frac{(T_h - T_c) \sqrt{k_1(\rho C_p)_1}}
47+
{\sqrt{k_1(\rho C_p)_1}
48+
+ \sqrt{k_2 (\rho C_p)_2}}
49+
\text{erfc}(\frac{x}{2\sqrt{k_2 / (\rho C_p)_2 t}}),
50+
&x > 0 \text{ (Fluid medium)}
51+
\end{cases}
52+
$$
53+
54+
## References
55+
56+
[1] Hiroaki Yoshida, Takayuki Kobayashi, Hidemitsu Hayashi, Tomoyuki Kinjo,
57+
Hitoshi Washizu, and Kenji Fukuzawa. Boundary condition at a two-phase
58+
interface in the lattice boltzmann method for the convection diffusion
59+
equation.
60+
Physical Review E, 90(1):013303, 2014. doi: https://doi.org/10.1103/PhysRevE.90.013303.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[Mesh]
2+
type = FoamMesh
3+
case = 'fluid-openfoam'
4+
foam_patch = 'left'
5+
[]
6+
7+
[Variables]
8+
[dummy]
9+
family = MONOMIAL
10+
order = CONSTANT
11+
initial_condition = 999
12+
[]
13+
[]
14+
15+
[AuxVariables]
16+
[fluid_wall_temp]
17+
family = MONOMIAL
18+
order = CONSTANT
19+
initial_condition = 0.075
20+
[]
21+
[solid_heat_flux]
22+
family = MONOMIAL
23+
order = CONSTANT
24+
initial_condition = 0
25+
[]
26+
[]
27+
28+
[Problem]
29+
type = FoamProblem
30+
# Take the heat flux from MOOSE and set it on the OpenFOAM mesh.
31+
heat_flux = solid_heat_flux
32+
# Take the boundary temperature from OpenFOAM and set it on the MOOSE mesh.
33+
foam_temp = fluid_wall_temp
34+
[]
35+
36+
[Executioner]
37+
type = Transient
38+
start_time = 0
39+
end_time = 0.01
40+
dt = 0.0003125
41+
42+
[TimeSteppers]
43+
[foam]
44+
type = FoamTimeStepper
45+
[]
46+
[]
47+
[]
48+
49+
[Outputs]
50+
exodus = true
51+
[]
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Version: 10
6+
\\/ M anipulation |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
format ascii;
11+
class volScalarField;
12+
location "0";
13+
object T;
14+
}
15+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16+
17+
dimensions [0 0 0 1 0 0 0];
18+
19+
internalField uniform 1e-10;
20+
21+
boundaryField
22+
{
23+
left
24+
{
25+
type fixedGradient;
26+
gradient uniform 0.75;
27+
}
28+
right
29+
{
30+
type zeroGradient;
31+
}
32+
top
33+
{
34+
type zeroGradient;
35+
}
36+
front
37+
{
38+
type zeroGradient;
39+
}
40+
bottom
41+
{
42+
type zeroGradient;
43+
}
44+
back
45+
{
46+
type zeroGradient;
47+
}
48+
}
49+
50+
51+
// ************************************************************************* //
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Version: 12
6+
\\/ M anipulation |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
format ascii;
11+
class volVectorField;
12+
location "0";
13+
object U;
14+
}
15+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16+
17+
dimensions [ 0 1 -1 0 0 0 0 ];
18+
19+
internalField uniform (0 0 0);
20+
21+
boundaryField
22+
{
23+
24+
".*"
25+
{
26+
type fixedValue;
27+
value $internalField;
28+
}
29+
}
30+
31+
// ************************************************************************* //
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*--------------------------------*- C++ -*----------------------------------*\
2+
========= |
3+
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4+
\\ / O peration | Website: https://openfoam.org
5+
\\ / A nd | Version: 12
6+
\\/ M anipulation |
7+
\*---------------------------------------------------------------------------*/
8+
FoamFile
9+
{
10+
format ascii;
11+
class volScalarField;
12+
location "0";
13+
object p;
14+
}
15+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
16+
17+
dimensions [ 1 -1 -2 0 0 0 0 ];
18+
19+
internalField uniform 0;
20+
21+
boundaryField
22+
{
23+
".*"
24+
{
25+
type calculated;
26+
value $internalField;
27+
}
28+
}
29+
30+
// ************************************************************************* //

0 commit comments

Comments
 (0)