diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/T b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/T new file mode 100644 index 0000000000000000000000000000000000000000..3bf09662bb0a143ba6281b3e9f135607ea59eefe --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/T @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 293; + +boundaryField +{ + frontAndBack + { + type zeroGradient; + } + + topAndBottom + { + type zeroGradient; + } + + hot + { + type externalCoupledTemperature; + commsDir "${FOAM_CASE}/comms"; + fileName "data"; + initByExternal yes; + log true; + value uniform 307.75; // 34.6 degC + } + + cold + { + type externalCoupledTemperature; + commsDir "${FOAM_CASE}/comms"; + fileName "data"; + initByExternal yes; + log true; + value uniform 288.15; // 15 degC + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/U b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/U new file mode 100644 index 0000000000000000000000000000000000000000..2d917d036faaa2d227ec7ef69f7338d00b670f22 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/U @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + frontAndBack + { + type fixedValue; + value uniform (0 0 0); + } + + topAndBottom + { + type fixedValue; + value uniform (0 0 0); + } + + hot + { + type fixedValue; + value uniform (0 0 0); + } + + cold + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/alphat b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/alphat new file mode 100644 index 0000000000000000000000000000000000000000..9e486ba21571232468addb9c24008bcaebb3be18 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/alphat @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + frontAndBack + { + type compressible::alphatWallFunction; + Prt 0.85; + value uniform 0; + } + topAndBottom + { + type compressible::alphatWallFunction; + Prt 0.85; + value uniform 0; + } + hot + { + type compressible::alphatWallFunction; + Prt 0.85; + value uniform 0; + } + cold + { + type compressible::alphatWallFunction; + Prt 0.85; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/epsilon b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..da6d89154851331611a27d6b49a58efd89858852 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/epsilon @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 4e-06; + +boundaryField +{ + frontAndBack + { + type compressible::epsilonWallFunction; + value uniform 4e-06; + } + topAndBottom + { + type compressible::epsilonWallFunction; + value uniform 4e-06; + } + hot + { + type compressible::epsilonWallFunction; + value uniform 4e-06; + } + cold + { + type compressible::epsilonWallFunction; + value uniform 4e-06; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/k b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/k new file mode 100644 index 0000000000000000000000000000000000000000..886667fb5c3f9345b3bcd01d6af87fd49d640837 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/k @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 3.75e-04; + +boundaryField +{ + frontAndBack + { + type compressible::kqRWallFunction; + value uniform 3.75e-04; + } + topAndBottom + { + type compressible::kqRWallFunction; + value uniform 3.75e-04; + } + hot + { + type compressible::kqRWallFunction; + value uniform 3.75e-04; + } + cold + { + type compressible::kqRWallFunction; + value uniform 3.75e-04; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/mut b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/mut new file mode 100644 index 0000000000000000000000000000000000000000..0ecb8672d2758749a6119dd49183237cb1bfa503 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/mut @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + frontAndBack + { + type mutUWallFunction; + value uniform 0; + } + topAndBottom + { + type mutUWallFunction; + value uniform 0; + } + hot + { + type mutUWallFunction; + value uniform 0; + } + cold + { + type mutUWallFunction; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/omega b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/omega new file mode 100644 index 0000000000000000000000000000000000000000..423815a2de8a485bfb7829b7669a7b147a225d3e --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/omega @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 0.12; + +boundaryField +{ + frontAndBack + { + type compressible::omegaWallFunction; + value uniform 0.12; + } + topAndBottom + { + type compressible::omegaWallFunction; + value uniform 0.12; + } + hot + { + type compressible::omegaWallFunction; + value uniform 0.12; + } + cold + { + type compressible::omegaWallFunction; + value uniform 0.12; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/p b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/p new file mode 100644 index 0000000000000000000000000000000000000000..9b1e74247bf9946eae6d063aa536d141bee454ad --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/p @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + frontAndBack + { + type calculated; + value $internalField; + } + + topAndBottom + { + type calculated; + value $internalField; + } + + hot + { + type calculated; + value $internalField; + } + + cold + { + type calculated; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/p_rgh b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/p_rgh new file mode 100644 index 0000000000000000000000000000000000000000..15979d020e33ed2769512df863c4ccb772b6eeca --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/0/p_rgh @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + frontAndBack + { + type fixedFluxPressure; + value uniform 1e5; + } + + topAndBottom + { + type fixedFluxPressure; + value uniform 1e5; + } + + hot + { + type fixedFluxPressure; + value uniform 1e5; + } + + cold + { + type fixedFluxPressure; + value uniform 1e5; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allclean b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..0dbf345049b678d451db10398a7c52c2f928b88c --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allclean @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +rm -rf comms + +killall externalSolver > /dev/null 2>&1 + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..484bfa6c525aeb575c18ed505d7dd32af8ee99c6 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +runApplication $(getApplication) & + +./externalSolver + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel new file mode 100755 index 0000000000000000000000000000000000000000..5bba5c94401d28061723de9e6f7cfc1f5460a2a4 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun-parallel @@ -0,0 +1,16 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +runApplication decomposePar + +runParallel $(getApplication) 4 & + +./externalSolver + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun.pre b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun.pre new file mode 100755 index 0000000000000000000000000000000000000000..1964116a40f8c9400516a5dd5b4a2ac013c0bf88 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/Allrun.pre @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh +runApplication createExternalCoupledPatchGeometry T + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/README b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/README new file mode 100644 index 0000000000000000000000000000000000000000..10d7392eb4814034795d02d08115ce261ce9875a --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/README @@ -0,0 +1,5 @@ +Example of an explicit coupling between OpenFOAM and an external application +using the externalCoupled boundary conditions. + +The case is based on the buoyantCavity tutorial case, whereby on each iteration +the 'hot' and 'cold' patch temperatures are incremented by 1K. diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/RASProperties b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..be86bc1efaab5bb87f00ce3f86915c671b6ef43b --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/RASProperties @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kOmegaSST; + +turbulence on; + +printCoeffs on; + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/g b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..e0ac2653b5b370ad62f6770588121d30cac51627 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/polyMesh/blockMeshDict b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..5f2f1e8fd2b5032b4ee3d38fcb0a2d432d1e3077 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/polyMesh/blockMeshDict @@ -0,0 +1,83 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + ( 0 0 -260) + (76 0 -260) + (76 2180 -260) + ( 0 2180 -260) + ( 0 0 260) + (76 0 260) + (76 2180 260) + ( 0 2180 260) +); + +edges +( +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (35 150 15) simpleGrading (1 1 1) +); + +boundary +( + frontAndBack + { + type wall; + faces + ( + (0 1 5 4) + (2 3 7 6) + ); + } + + topAndBottom + { + type wall; + faces + ( + (4 5 6 7) + (3 2 1 0) + ); + } + + hot + { + type wall; + faces + ( + (6 5 1 2) + ); + } + + cold + { + type wall; + faces + ( + (4 7 3 0) + ); + } +); + +mergePatchPairs +( +); diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/polyMesh/boundary b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..7cba6d73ec3f51a6b3060c296fcc3634d9e16846 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/polyMesh/boundary @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +4 +( + frontAndBack + { + type wall; + nFaces 1050; + startFace 228225; + } + topAndBottom + { + type wall; + nFaces 10500; + startFace 229275; + } + hot + { + type wall; + nFaces 2250; + startFace 239775; + } + cold + { + type wall; + nFaces 2250; + startFace 242025; + } +) + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/thermophysicalProperties new file mode 100644 index 0000000000000000000000000000000000000000..95579e34cb51bd580ceb7debb125ff47a8c7a6aa --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/constant/thermophysicalProperties @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 28.96; + } + thermodynamics + { + Cp 1004.4; + Hf 0; + } + transport + { + mu 1.831e-05; + Pr 0.705; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/externalSolver b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/externalSolver new file mode 100755 index 0000000000000000000000000000000000000000..ac4b78d3d1553c34ca1a4e8c1a6d282a4b740199 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/externalSolver @@ -0,0 +1,85 @@ +#!/bin/sh +# +# Dummy external solver to communicate with OpenFOAM via externalCoupled +# boundary conditions +# +# Functionality is hard-coded for this particular test case +# - patch temperatures increased by 1K on each step +# +cd ${0%/*} || exit 1 # run from this directory + +echo "*** Executing dummy external solver" + +commsDir="comms" +lockFile="${commsDir}/OpenFOAM.lock" +dataFile="${commsDir}/data" +waitSec=1 +timeOut=10 +refGrad=0 +valueFraction=1 + +function log() +{ + echo "External: $@" +} + +function init() +{ + log "initialisation: creating ${dataFile}.in" + + # Hard-coded for 2 patches of size 2250 + n=2250 + refCold=283 + refHot=303 + touch "${dataFile}.in" + for i in $(seq 1 $n); do + echo "$refHot $refGrad $valueFraction" >> "${dataFile}.in" + done + for i in $(seq 1 $n); do + echo "$refCold $refGrad $valueFraction" >> "${dataFile}.in" + done + + # create lock file to pass control to OF + touch ${lockFile} +} + + +# tutorial case employs the 'initByExternalOption', so we need to provide +# the initial values +init + + +totalWait=0 +step=0 +while [ 1 ]; do + if [ -f $lockFile ]; then + log "found lock file ${lockFile} - waiting" + ((totalWait += waitSec)) + if [ $totalWait -gt $timeOut ]; then + log "timeout" + break + else + sleep $waitSec + fi + else + totalWait=0 + ((step++)) + log "step $step" + log "lock not present - taking control" + + log "sleeping for $waitSec secs to simulate external process" + sleep $waitSec + + log "creating ${dataFile}.in" + + awk '{if( $1 != "#" ){print $2+1 " 0 1"}}' ${dataFile}.out > ${dataFile}.in + + log "creating lock file ${lockFile}" + touch ${lockFile} + fi +done + +log "done" + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/controlDict b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..afe4591501362f5fd49092722ff1f3fe28c7eb5e --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/controlDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application buoyantSimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 100; + +deltaT 1; + +writeControl timeStep; + +writeInterval 10; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/decomposeParDict b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..9165c030940a7593525d345371ad8611c5f45726 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/decomposeParDict @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method simple; + +simpleCoeffs +{ + n ( 2 2 1 ); + delta 0.001; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..c52c053c84844fb84137797f741b112943bcd03a --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/fvSchemes @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) bounded Gauss limitedLinear 0.2; + div(phi,K) bounded Gauss limitedLinear 0.2; + div(phi,h) bounded Gauss limitedLinear 0.2; + div(phi,k) bounded Gauss limitedLinear 0.2; + div(phi,epsilon) bounded Gauss limitedLinear 0.2; + div(phi,omega) bounded Gauss limitedLinear 0.2; + div((muEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian(muEff,U) Gauss linear orthogonal; + laplacian(Dp,p_rgh) Gauss linear orthogonal; + laplacian(alphaEff,h) Gauss linear orthogonal; + laplacian(DkEff,k) Gauss linear orthogonal; + laplacian(DepsilonEff,epsilon) Gauss linear orthogonal; + laplacian(DomegaEff,omega) Gauss linear orthogonal; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default orthogonal; +} + +fluxRequired +{ + default no; + p_rgh; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/fvSolution b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..d30cdf20b496e354128a273418811f504df1abed --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/externalCoupledCavity/system/fvSolution @@ -0,0 +1,77 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + + smoother DICGaussSeidel; + + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + "(U|h|k|epsilon|omega)" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-8; + relTol 0.1; + } +} + +SIMPLE +{ + momentumPredictor yes; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; + + residualControl + { + p_rgh 1e-2; + U 1e-3; + h 1e-3; + + // possibly check turbulence fields + "(k|epsilon|omega)" 1e-3; + } +} + +relaxationFactors +{ + fields + { + rho 1.0; + p_rgh 0.7; + } + equations + { + U 0.3; + h 0.3; + "(k|epsilon|omega)" 0.7; + } +} + + +// ************************************************************************* //