diff --git a/partitioned-heat-conduction/fenics/heat.py b/partitioned-heat-conduction/fenics/heat.py index e7113f570..fb0487854 100644 --- a/partitioned-heat-conduction/fenics/heat.py +++ b/partitioned-heat-conduction/fenics/heat.py @@ -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(): diff --git a/partitioned-heat-conduction/fenics/precice-adapter-config-D.json b/partitioned-heat-conduction/fenics/precice-adapter-config-D.json index c2a7788c0..7989ba340 100644 --- a/partitioned-heat-conduction/fenics/precice-adapter-config-D.json +++ b/partitioned-heat-conduction/fenics/precice-adapter-config-D.json @@ -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" } } diff --git a/partitioned-heat-conduction/fenics/precice-adapter-config-N.json b/partitioned-heat-conduction/fenics/precice-adapter-config-N.json index 36ea15d19..2afd52ce3 100644 --- a/partitioned-heat-conduction/fenics/precice-adapter-config-N.json +++ b/partitioned-heat-conduction/fenics/precice-adapter-config-N.json @@ -4,6 +4,6 @@ "interface": { "coupling_mesh_name": "Neumann-Mesh", "write_data_name": "Temperature", - "read_data_name": "Flux" + "read_data_name": "Heat-Flux" } } diff --git a/partitioned-heat-conduction/nutils/heat.py b/partitioned-heat-conduction/nutils/heat.py index 16c00726e..b0bb2acde 100644 --- a/partitioned-heat-conduction/nutils/heat.py +++ b/partitioned-heat-conduction/nutils/heat.py @@ -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) diff --git a/partitioned-heat-conduction/openfoam-dirichlet/0/T b/partitioned-heat-conduction/openfoam-dirichlet/0/T new file mode 100644 index 000000000..013a086d4 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/0/T @@ -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 +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; + } +} + + +// ************************************************************************* // diff --git a/partitioned-heat-conduction/openfoam-dirichlet/clean.sh b/partitioned-heat-conduction/openfoam-dirichlet/clean.sh new file mode 100755 index 000000000..c31d9fc76 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/clean.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e -u + +. ../../tools/cleaning-tools.sh + +clean_openfoam . diff --git a/partitioned-heat-conduction/openfoam-dirichlet/constant/transportProperties b/partitioned-heat-conduction/openfoam-dirichlet/constant/transportProperties new file mode 100644 index 000000000..40dc0a36b --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/constant/transportProperties @@ -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; diff --git a/partitioned-heat-conduction/openfoam-dirichlet/run.sh b/partitioned-heat-conduction/openfoam-dirichlet/run.sh new file mode 100755 index 000000000..5c90bf0a3 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/run.sh @@ -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 diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/blockMeshDict b/partitioned-heat-conduction/openfoam-dirichlet/system/blockMeshDict new file mode 100644 index 000000000..efffa9aea --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/blockMeshDict @@ -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 +( +); diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/controlDict b/partitioned-heat-conduction/openfoam-dirichlet/system/controlDict new file mode 100644 index 000000000..f95dfadcc --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/controlDict @@ -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"); + } +} diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/createPatchDict b/partitioned-heat-conduction/openfoam-dirichlet/system/createPatchDict new file mode 100644 index 000000000..55f8f972c --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/createPatchDict @@ -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; + } +); diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/decomposeParDict b/partitioned-heat-conduction/openfoam-dirichlet/system/decomposeParDict new file mode 100644 index 000000000..ad99cf6c5 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/decomposeParDict @@ -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; +} diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/fvSchemes b/partitioned-heat-conduction/openfoam-dirichlet/system/fvSchemes new file mode 100644 index 000000000..528752472 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/fvSchemes @@ -0,0 +1,40 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + 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; +} diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/fvSolution b/partitioned-heat-conduction/openfoam-dirichlet/system/fvSolution new file mode 100644 index 000000000..86a2ab7f1 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/fvSolution @@ -0,0 +1,24 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} + +solvers +{ + T + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 2; +} diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/preciceDict b/partitioned-heat-conduction/openfoam-dirichlet/system/preciceDict new file mode 100644 index 000000000..8fbdb699d --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/preciceDict @@ -0,0 +1,39 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object preciceDict; +} + +preciceConfig "../precice-config.xml"; + +participant Dirichlet; + +modules (CHT); + +interfaces +{ + Interface1 + { + mesh Dirichlet-Mesh; + patches (interface); + + readData + ( + Temperature + ); + + writeData + ( + Heat-Flux + ); + }; +}; + +CHT +{ + k [ 1 1 -3 -1 0 0 0 ] 3; + solverType "basic"; +}; diff --git a/partitioned-heat-conduction/openfoam-dirichlet/system/topoSetDict b/partitioned-heat-conduction/openfoam-dirichlet/system/topoSetDict new file mode 100644 index 000000000..9ee152e00 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-dirichlet/system/topoSetDict @@ -0,0 +1,18 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +actions +( + { + name heatSourceSet; + type faceSet; + action new; + source boxToFace; + box (0 0 0.01) (0.06 0.06 0.06); + } +); diff --git a/partitioned-heat-conduction/openfoam-neumann/0/T b/partitioned-heat-conduction/openfoam-neumann/0/T new file mode 100644 index 000000000..8ebba5109 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/0/T @@ -0,0 +1,46 @@ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 8; + +boundaryField +{ + interface + { + type fixedGradient; + gradient uniform 0; + } + + heatSink + { + type fixedValue; + value $internalField; + } + + right + { + type zeroGradient; + } + + top + { + type zeroGradient; + } + + bottom + { + type zeroGradient; + } + + defaultFaces + { + type empty; + } +} diff --git a/partitioned-heat-conduction/openfoam-neumann/clean.sh b/partitioned-heat-conduction/openfoam-neumann/clean.sh new file mode 100755 index 000000000..c31d9fc76 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/clean.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e -u + +. ../../tools/cleaning-tools.sh + +clean_openfoam . diff --git a/partitioned-heat-conduction/openfoam-neumann/constant/transportProperties b/partitioned-heat-conduction/openfoam-neumann/constant/transportProperties new file mode 100644 index 000000000..93b06319d --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/constant/transportProperties @@ -0,0 +1,11 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +DT DT [ 0 2 -1 0 0 0 0 ] 1; diff --git a/partitioned-heat-conduction/openfoam-neumann/run.sh b/partitioned-heat-conduction/openfoam-neumann/run.sh new file mode 100755 index 000000000..037ef8e70 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/run.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e -u + +blockMesh +topoSet +touch openfoam-neumann.foam + +../../tools/run-openfoam.sh "$@" +. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs diff --git a/partitioned-heat-conduction/openfoam-neumann/system/blockMeshDict b/partitioned-heat-conduction/openfoam-neumann/system/blockMeshDict new file mode 100644 index 000000000..bcd2800b4 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/blockMeshDict @@ -0,0 +1,78 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +convertToMeters 1; + +vertices +( + + (1 0 0) + (2 0 0) + (2 1 0) + (1 1 0) + + (1 0 .1) + (2 0 .1) + (2 1 .1) + (1 1 .1) + +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + + interface + { + type wall; + faces + ( + (4 7 3 0) + ); + } + + right + { + type wall; + faces + ( + (1 2 6 5) + ); + } + + top + { + type wall; + faces + ( + (7 6 2 3) + ); + } + + bottom + { + type wall; + faces + ( + (4 0 1 5) + ); + } + +); + +mergePatchPairs +( +); diff --git a/partitioned-heat-conduction/openfoam-neumann/system/controlDict b/partitioned-heat-conduction/openfoam-neumann/system/controlDict new file mode 100644 index 000000000..f95dfadcc --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/controlDict @@ -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"); + } +} diff --git a/partitioned-heat-conduction/openfoam-neumann/system/decomposeParDict b/partitioned-heat-conduction/openfoam-neumann/system/decomposeParDict new file mode 100644 index 000000000..ad99cf6c5 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/decomposeParDict @@ -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; +} diff --git a/partitioned-heat-conduction/openfoam-neumann/system/fvSchemes b/partitioned-heat-conduction/openfoam-neumann/system/fvSchemes new file mode 100644 index 000000000..528752472 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/fvSchemes @@ -0,0 +1,40 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + 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; +} diff --git a/partitioned-heat-conduction/openfoam-neumann/system/fvSolution b/partitioned-heat-conduction/openfoam-neumann/system/fvSolution new file mode 100644 index 000000000..86a2ab7f1 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/fvSolution @@ -0,0 +1,24 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} + +solvers +{ + T + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 2; +} diff --git a/partitioned-heat-conduction/openfoam-neumann/system/preciceDict b/partitioned-heat-conduction/openfoam-neumann/system/preciceDict new file mode 100644 index 000000000..6960fd583 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/preciceDict @@ -0,0 +1,39 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object preciceDict; +} + +preciceConfig "../precice-config.xml"; + +participant Neumann; + +modules (CHT); + +interfaces +{ + Interface1 + { + mesh Neumann-Mesh; + patches (interface); + + readData + ( + Heat-Flux + ); + + writeData + ( + Temperature + ); + }; +}; + +CHT +{ + k [ 1 1 -3 -1 0 0 0 ] 3; + solverType "basic"; +}; diff --git a/partitioned-heat-conduction/openfoam-neumann/system/topoSetDict b/partitioned-heat-conduction/openfoam-neumann/system/topoSetDict new file mode 100644 index 000000000..2cd4ba441 --- /dev/null +++ b/partitioned-heat-conduction/openfoam-neumann/system/topoSetDict @@ -0,0 +1,19 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +actions +( + { + name heatSink; + type cellSet; + action new; + source sphereToCell; + origin (2 1 0); + radius 0.1; + } +); diff --git a/partitioned-heat-conduction/precice-config.xml b/partitioned-heat-conduction/precice-config.xml index a810f285d..2b5ef7cc1 100644 --- a/partitioned-heat-conduction/precice-config.xml +++ b/partitioned-heat-conduction/precice-config.xml @@ -9,22 +9,22 @@ - + - + - + - + @@ -33,7 +33,7 @@ - + @@ -44,9 +44,9 @@ - + - +