Skip to content
Draft
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
1 change: 1 addition & 0 deletions partitioned-heat-conduction-mixedbc/clean-tutorial.sh
86 changes: 86 additions & 0 deletions partitioned-heat-conduction-mixedbc/openfoam-left/0/T
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}

dimensions [0 0 0 1 0 0 0];


internalField #codeStream
{
codeInclude
#{
#include "fvCFD.H"
#};

codeOptions
#{
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
#};

codeLibs
#{
-lmeshTools \
-lfiniteVolume
#};

code

#{
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
const fvMesh& mesh = refCast<const fvMesh>(d.db());
const vectorField& CC = mesh.C(); // cell center

// assign values
scalarField T(mesh.nCells());
forAll(CC, cellI)
{
scalar x = CC[cellI].x();
scalar y = CC[cellI].y();

T[cellI] = 1 + pow(x, 2) + (3 * pow(y, 2)); // t is zero for initial conditions
}
T.writeEntry("", os);
#};
};

boundaryField
{
interface
{
type mixed;
refValue uniform 2;
refGradient uniform 2;
valueFraction uniform 1.0;
}

DirichletBoundary
{
type codedFixedValue;
value uniform 1;
name DirichletBoundary;
code
#{
const vectorField& Cf = patch().Cf();
const scalar t = this->db().time().value();

scalarField& field = *this;
forAll(Cf, faceI)
{
const scalar x = Cf[faceI].x();
const scalar y = Cf[faceI].y();

field[faceI] = 1 + pow(x, 2) + (3 * pow(y, 2)) + 1.2 * t;
}
#};
}

defaultFaces
{
type empty;
}
}
6 changes: 6 additions & 0 deletions partitioned-heat-conduction-mixedbc/openfoam-left/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
set -e

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

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

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

. ../../tools/log.sh
exec > >(tee --append "$LOGFILE") 2>&1

blockMesh

../../tools/run-openfoam.sh "$@"
. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs

close_log
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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) (100 100 1) simpleGrading (1 1 1)
);

boundary
(

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

DirichletBoundary
{
type patch;
faces
(
(4 7 3 0)
(7 6 2 3)
(4 0 1 5)
);
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}

// Make sure you build the solver located
// in ../../solver-openfoam/ before running
// the case
application heatTransfer;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 1;

deltaT 0.01;

writeControl runTime;

// Write data only at the end of each coupling time window
// Intermediate time step results correspond to the first coupling iteration and are not converged.
writeInterval 0.1;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable false;

libs ("libpreciceAdapterFunctionObject.so");
functions
{
preCICE_Adapter
{
type preciceAdapterFunctionObject;
errors strict; // Available since OpenFOAM v2012
}
}
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;
}
39 changes: 39 additions & 0 deletions partitioned-heat-conduction-mixedbc/openfoam-left/system/fvSchemes
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}

ddtSchemes
{
default Euler;
}

gradSchemes
{
default Gauss linear;
grad(T) Gauss linear;
}

divSchemes
{
default none;
}

laplacianSchemes
{
default none;
laplacian(DT,T) Gauss linear corrected;
}

interpolationSchemes
{
default linear;
}

snGradSchemes
{
default corrected;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}

solvers
{
T
{
solver PCG;
preconditioner DIC;
tolerance 1e-10;
relTol 0;
}
}

SIMPLE
{
nNonOrthogonalCorrectors 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object preciceDict;
}

preciceConfig "../precice-config.xml";

participant Left;

modules (generic);

interfaces
{
Interface1
{
mesh Left-Mesh;
patches (interface);

readData
(
Sink-Temp
{
name Temperature-Right;
solver_name T;
operation ref-value;
}
);

writeData
(
Write-Grad
{
name Gradient-Left;
solver_name T;
operation surface-normal-gradient;
}
);
};
};
Loading