Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenFOAM partitioned heat equation #214

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion partitioned-heat-conduction/fenics/heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def determine_gradient(V_g, u, flux):

if problem is ProblemType.DIRICHLET:
flux = Function(V_g)
flux.rename("Flux", "")
flux.rename("Heat-Flux", "")

while precice.is_coupling_ongoing():

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"config_file_name": "../precice-config.xml",
"interface": {
"coupling_mesh_name": "Dirichlet-Mesh",
"write_data_name": "Flux",
"write_data_name": "Heat-Flux",
"read_data_name": "Temperature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"interface": {
"coupling_mesh_name": "Neumann-Mesh",
"write_data_name": "Temperature",
"read_data_name": "Flux"
"read_data_name": "Heat-Flux"
}
}
2 changes: 1 addition & 1 deletion partitioned-heat-conduction/nutils/heat.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main(side='Dirichlet'):

# coupling data
write_data = "Temperature" if side == "Neumann" else "Flux"
read_data = "Flux" if side == "Neumann" else "Temperature"
read_data = "Heat-Flux" if side == "Neumann" else "Temperature"
write_data_id = interface.get_data_id(write_data, mesh_id)
read_data_id = interface.get_data_id(read_data, mesh_id)

Expand Down
148 changes: 148 additions & 0 deletions partitioned-heat-conduction/openfoam-dirichlet/0/T
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 1 0 0 0];


internalField nonuniform List<scalar>
100
(
1.01
1.03
1.07
1.13
1.21
1.31
1.43
1.57
1.73
1.91
1.07
1.09
1.13
1.19
1.27
1.37
1.49
1.63
1.79
1.97
1.19
1.21
1.25
1.31
1.39
1.49
1.61
1.75
1.91
2.09
1.37
1.39
1.43
1.49
1.57
1.67
1.79
1.93
2.09
2.27
1.61
1.63
1.67
1.73
1.81
1.91
2.03
2.17
2.33
2.51
1.91
1.93
1.97
2.03
2.11
2.21
2.33
2.47
2.63
2.81
2.27
2.29
2.33
2.39
2.47
2.57
2.69
2.83
2.99
3.17
2.69
2.71
2.75
2.81
2.89
2.99
3.11
3.25
3.41
3.59
3.17
3.19
3.23
3.29
3.37
3.47
3.59
3.73
3.89
4.07
3.71
3.73
3.77
3.83
3.91
4.01
4.13
4.27
4.43
4.61
)
;

boundaryField
{
DirichletBoundary
{
type groovyBC;
variables "alpha=3;beta=1.3;para=1+pow(pos().x,2)+(alpha*pow(pos().y,2));";
valueExpression "para+(beta*time())";
value uniform 1;
}
interface
{
type fixedValue;
value uniform 0;
}
defaultFaces
{
type empty;
}
}


// ************************************************************************* //
6 changes: 6 additions & 0 deletions partitioned-heat-conduction/openfoam-dirichlet/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -e -u

. ../../tools/cleaning-tools.sh

clean_openfoam .
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}

DT DT [ 0 2 -1 0 0 0 0 ] 1;
10 changes: 10 additions & 0 deletions partitioned-heat-conduction/openfoam-dirichlet/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e -u

blockMesh
topoSet
createPatch
touch openfoam-dirichlet.foam

../../tools/run-openfoam.sh "$@"
. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}

vertices
(

(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)

(0 0 .1)
(1 0 .1)
(1 1 .1)
(0 1 .1)
);

blocks
(
hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1)
);

edges
(
);

boundary
(

left
{
type wall;
faces
(
(4 7 3 0)
);
}

interface
{
type wall;
faces
(
(1 2 6 5)
);
}

top
{
type wall;
faces
(
(7 6 2 3)
);
}

bottom
{
type wall;
faces
(
(4 0 1 5)
);
}

);

mergePatchPairs
(
);
47 changes: 47 additions & 0 deletions partitioned-heat-conduction/openfoam-dirichlet/system/controlDict
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}

application laplacianFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1;

deltaT 0.01;

writeControl runTime;

writeInterval 0.2;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable false;

functions
{
preCICE_Adapter
{
type preciceAdapterFunctionObject;
libs ("libpreciceAdapterFunctionObject.so");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createPatchDict;
}

pointSync true;

patches
(
{
name heatSource;

patchInfo
{
type patch;
}

constructFrom set;
set heatSourceSet;
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FoamFile {
version 2.0;
class dictionary;
object decomposeParDict;
format ascii;
}

numberOfSubdomains 2;

method simple;

simpleCoeffs
{
n (2 1 1);
delta 0.001;
}
Loading