diff --git a/changelog-entries/551.md b/changelog-entries/551.md new file mode 100644 index 000000000..86ff9b8ac --- /dev/null +++ b/changelog-entries/551.md @@ -0,0 +1 @@ +- Added OpenFOAM variant of the transport participant to the channel-transport tutorial. diff --git a/channel-transport/README.md b/channel-transport/README.md index 267a70550..497bed369 100644 --- a/channel-transport/README.md +++ b/channel-transport/README.md @@ -41,6 +41,8 @@ Transport participant: * Nutils. For more information, have a look at the [Nutils adapter documentation](https://precice.org/adapter-nutils.html). This Nutils solver requires at least Nutils v7.0. +* OpenFOAM. This case uses a modified version of scalarTransportFoam, which recomputes `phi` after the preCICE adapter reads the velocity field. Build it with `wmake`. Read more details in the [OpenFOAM adapter](https://precice.org/adapter-openfoam-overview.html). Note that T accumulates in front of the outlet as this case conserves overall T. + ## Running the simulation Open two separate terminals and start one fluid and one transport participant by calling the respective run scripts `run.sh` located in each of the participants' directory. For example: diff --git a/channel-transport/transport-openfoam/.clang-format b/channel-transport/transport-openfoam/.clang-format new file mode 100644 index 000000000..00adea7a3 --- /dev/null +++ b/channel-transport/transport-openfoam/.clang-format @@ -0,0 +1,175 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +# +# Proposed clang-format-11 style for OpenFOAM, trying to follow the OpenFOAM style guide: +# https://develop.openfoam.com/Development/openfoam/-/wikis/coding/style/style +# Configuration developed for the OpenFOAM-preCICE adapter code: +# https://github.com/precice/openfoam-adapter +# Contribute to the discussion at the respective OpenFOAM issue: +# https://develop.openfoam.com/Development/openfoam/-/issues/1634 +# +# Keep `public:` at the first indentation level +AccessModifierOffset: -4 +# Undocumented guideline: align arguments after an open bracket. +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveBitFields: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Right +# Align operands after operators (+,*,<<) (see BreakBeforeBinaryOperators) +AlignOperands: AlignAfterOperator +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortEnumsOnASingleLine: true +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Always +AllowShortLoopsOnASingleLine: false +# Guideline: Splitting return type and function name +# (this guideline is apparently not strictly followed in OpenFOAM) +# AlwaysBreakAfterReturnType: All +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +# Covered by "BreakBeforeBraces" +BraceWrapping: + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: true + BeforeWhile: true + IndentBraces: true + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +# Guideline (almost): Splitting long lines at an = sign. Indent after split. +# Guideline (almost): Splitting formulae over several lines. +BreakBeforeBinaryOperators: NonAssignment +# Always break before braces: if, for, functions, classes, etc. +BreakBeforeBraces: Allman +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +# Guideline (almost): Splitting logical tests over several lines. +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +# Undocumented guideline (almost): Have the initializer : in a new line. +BreakConstructorInitializers: BeforeColon +BreakStringLiterals: true +# Here we could set the 80 charactes limit, but that would lead to more aggressive changes. +ColumnLimit: 0 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 0 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DeriveLineEnding: true +DerivePointerAlignment: false +DisableFormat: false +# Undocumented guideline: add line after "public:" etc (since clang-format 12) +# EmptyLineAfterAccessModifier: Always +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: false +# Guideline: Macro loops are like for loops, but without a space. +ForEachMacros: + - forAllIters + - forAllConstIters + - forAllReverseIters + - forAllConstReverseIters + - forAll + - forAllReverse + - forAllIter + - forAllConstIter +IncludeBlocks: Preserve +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + SortPriority: 0 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + SortPriority: 0 + - Regex: '.*' + Priority: 1 + SortPriority: 0 +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentCaseLabels: false +IndentCaseBlocks: false +IndentGotoLabels: true +IndentPPDirectives: None +IndentExternBlock: AfterExternBlock +# Guideline: The normal indentation is 4 spaces per logical level. +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +KeepEmptyLinesAtTheStartOfBlocks: true +MacroBlockBegin: '' +MacroBlockEnd: '' +# Required to not change code following the guidelines +# "Leave two empty lines between sections" and +# "Use two empty lines between functions" +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +ReflowComments: true +# Do not change the order of include statements (could be catastrophic for OpenFOAM) +SortIncludes: false +SortUsingDeclarations: false +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +# No "template " (guideline already used, but not documented) +SpaceAfterTemplateKeyword: false +SpaceBeforeAssignmentOperators: true +# No a{1} (no guideline) +SpaceBeforeCpp11BracedList: true +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +# Guideline: Spaces in "if ()", "for ()", but not "forAll ()". +SpaceBeforeParens: ControlStatementsExceptForEachMacros +# Guideline: Range-based for should have a space surrounding the ':'. +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInConditionalStatement: false +# No "arr[3] = [ 1, 2, 3 ]" (no guideline). +SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +SpaceBeforeSquareBrackets: false +# Treat the code as C++11 or later +Standard: Latest +StatementMacros: +TabWidth: 4 +UseCRLF: false +# Guideline: No tab characters - only use spaces for indentation. +UseTab: Never +WhitespaceSensitiveMacros: +... + diff --git a/channel-transport/transport-openfoam/.gitignore b/channel-transport/transport-openfoam/.gitignore new file mode 100644 index 000000000..1f7d5d93a --- /dev/null +++ b/channel-transport/transport-openfoam/.gitignore @@ -0,0 +1,4 @@ +Make/* +!Make/files +!Make/options +0/ diff --git a/channel-transport/transport-openfoam/0.orig/T b/channel-transport/transport-openfoam/0.orig/T new file mode 100644 index 000000000..d7a18ffa1 --- /dev/null +++ b/channel-transport/transport-openfoam/0.orig/T @@ -0,0 +1,44 @@ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type zeroGradient; + } + + outlet + { + type zeroGradient; + } + + obstacle + { + type zeroGradient; + } + + upperWall + { + type zeroGradient; + } + + lowerWall + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} diff --git a/channel-transport/transport-openfoam/0.orig/U b/channel-transport/transport-openfoam/0.orig/U new file mode 100644 index 000000000..1f4cb2292 --- /dev/null +++ b/channel-transport/transport-openfoam/0.orig/U @@ -0,0 +1,39 @@ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} + +dimensions [0 1 -1 0 0 0 0]; +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type zeroGradient; + } + obstacle + { + type noSlip; + } + upperWall + { + type noSlip; + } + lowerWall + { + type noSlip; + } + frontAndBack + { + type empty; + } +} diff --git a/channel-transport/transport-openfoam/Make/files b/channel-transport/transport-openfoam/Make/files new file mode 100644 index 000000000..6a9053551 --- /dev/null +++ b/channel-transport/transport-openfoam/Make/files @@ -0,0 +1,3 @@ +dynamicScalarTransportFoam.C + +EXE = $(FOAM_USER_APPBIN)/dynamicScalarTransportFoam diff --git a/channel-transport/transport-openfoam/Make/options b/channel-transport/transport-openfoam/Make/options new file mode 100644 index 000000000..acbe7a647 --- /dev/null +++ b/channel-transport/transport-openfoam/Make/options @@ -0,0 +1,10 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lfvOptions \ + -lmeshTools \ + -lsampling diff --git a/channel-transport/transport-openfoam/clean.sh b/channel-transport/transport-openfoam/clean.sh new file mode 100755 index 000000000..6ab219250 --- /dev/null +++ b/channel-transport/transport-openfoam/clean.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +set -e -u + +. ../../tools/cleaning-tools.sh + +clean_openfoam . +rm -rf ./0/ +rm -rf ./Make/linux* diff --git a/channel-transport/transport-openfoam/constant/transportProperties b/channel-transport/transport-openfoam/constant/transportProperties new file mode 100644 index 000000000..8d841ddc5 --- /dev/null +++ b/channel-transport/transport-openfoam/constant/transportProperties @@ -0,0 +1,9 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} + +DT 0.1; diff --git a/channel-transport/transport-openfoam/createFields.H b/channel-transport/transport-openfoam/createFields.H new file mode 100644 index 000000000..82417fbb0 --- /dev/null +++ b/channel-transport/transport-openfoam/createFields.H @@ -0,0 +1,43 @@ +Info << "Reading field T\n" + << endl; + +volScalarField T( + IOobject( + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE), + mesh); + +Info << "Reading field U\n" + << endl; + +volVectorField U( + IOobject( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE), + mesh); + +Info << "Reading transportProperties\n" + << endl; + +IOdictionary transportProperties( + IOobject( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE)); + +Info << "Reading diffusivity DT\n" + << endl; + +dimensionedScalar DT("DT", dimViscosity, transportProperties); + +#include "createPhi.H" + +#include "createFvOptions.H" diff --git a/channel-transport/transport-openfoam/dynamicScalarTransportFoam.C b/channel-transport/transport-openfoam/dynamicScalarTransportFoam.C new file mode 100644 index 000000000..0a3e787ca --- /dev/null +++ b/channel-transport/transport-openfoam/dynamicScalarTransportFoam.C @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2011-2017 OpenFOAM Foundation +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + dynamicScalarTransportFoam + +Group + grpBasicSolvers + +Description + Passive scalar transport equation solver. + + \heading Solver details + The equation is given by: + + \f[ + \ddt{T} + \div \left(\vec{U} T\right) - \div \left(D_T \grad T \right) + = S_{T} + \f] + + Where: + \vartable + T | Passive scalar + D_T | Diffusion coefficient + S_T | Source + \endvartable + + \heading Required fields + \plaintable + T | Passive scalar + U | Velocity [m/s] + \endplaintable + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "fvOptions.H" +#include "simpleControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::addNote + ( + "Passive scalar transport equation solver." + ); + + #include "addCheckCaseOptions.H" + #include "setRootCaseLists.H" + #include "createTime.H" + #include "createMesh.H" + + simpleControl simple(mesh); + + #include "createFields.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nCalculating scalar transport\n" << endl; + + while (simple.loop()) + { + Info << "Time = " << runTime.timeName() << nl << endl; + + Info<< "Recompute phi" << endl; + fvOptions.correct(U); + phi = fvc::flux(U); + #include "CourantNo.H" + + while (simple.correctNonOrthogonal()) + { + fvScalarMatrix TEqn + ( + fvm::ddt(T) + + fvm::div(phi, T) + - fvm::laplacian(DT, T) + == + fvOptions(T) + ); + + TEqn.relax(); + fvOptions.constrain(TEqn); + TEqn.solve(); + fvOptions.correct(T); + } + + runTime.write(); + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/channel-transport/transport-openfoam/run.sh b/channel-transport/transport-openfoam/run.sh new file mode 100755 index 000000000..9a8884f2c --- /dev/null +++ b/channel-transport/transport-openfoam/run.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e -u + +. ../../tools/log.sh +exec > >(tee --append "$LOGFILE") 2>&1 + +blockMesh +cp -r 0.orig 0 +setExprFields -time 0 + +../../tools/run-openfoam.sh "$@" +. ../../tools/openfoam-remove-empty-dirs.sh && openfoam_remove_empty_dirs + +close_log diff --git a/channel-transport/transport-openfoam/system/blockMeshDict b/channel-transport/transport-openfoam/system/blockMeshDict new file mode 100644 index 000000000..19774348b --- /dev/null +++ b/channel-transport/transport-openfoam/system/blockMeshDict @@ -0,0 +1,156 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +x0 0.; +x1 2.; +x2 3.; +x3 6.; + +y0 0.; +y1 1.; +y2 2.; + +z0 0; +z1 1; + +vertices +( + ($x0 $y0 $z0 ) // 0 + ($x1 $y0 $z0 ) // 1 + ($x2 $y0 $z0 ) // 2 + ($x3 $y0 $z0 ) // 3 + ($x0 $y1 $z0 ) // 4 + ($x1 $y1 $z0 ) // 5 + ($x2 $y1 $z0 ) // 6 + ($x3 $y1 $z0 ) // 7 + ($x0 $y2 $z0 ) // 8 + ($x1 $y2 $z0 ) // 9 + ($x2 $y2 $z0 ) // 10 + ($x3 $y2 $z0 ) // 11 + + ($x0 $y0 $z1 ) // 12 + ($x1 $y0 $z1 ) // 13 + ($x2 $y0 $z1 ) // 14 + ($x3 $y0 $z1 ) // 15 + ($x0 $y1 $z1 ) // 16 + ($x1 $y1 $z1 ) // 17 + ($x2 $y1 $z1 ) // 18 + ($x3 $y1 $z1 ) // 19 + ($x0 $y2 $z1 ) // 20 + ($x1 $y2 $z1 ) // 21 + ($x2 $y2 $z1 ) // 22 + ($x3 $y2 $z1 ) // 23 +); + + +// Grading +//h1 16; +//h2 8; +//h3 24; +//v1 8; + +//h1 40; +//h2 20; +//h3 60; +//v1 32; + +h1 20; +h2 10; +h3 30; +v1 16; + +blocks +( + hex ( 0 1 5 4 12 13 17 16 ) + ($h1 $v1 1 ) + simpleGrading (1 1 1) + + hex ( 2 3 7 6 14 15 19 18 ) + ($h3 $v1 1) + simpleGrading (1 1 1) + + hex ( 4 5 9 8 16 17 21 20 ) + ($h1 $v1 1) + simpleGrading (1 1 1) + + hex ( 5 6 10 9 17 18 22 21 ) + ($h2 $v1 1) + simpleGrading (1 1 1) + + hex ( 6 7 11 10 18 19 23 22 ) + ($h3 $v1 1 ) + simpleGrading (1 1 1) +); + +boundary +( + inlet + { + type patch; + faces + ( + ( 0 4 16 12 ) + ( 4 8 20 16 ) + ); + } + outlet + { + type patch; + faces + ( + ( 3 7 19 15 ) + ( 7 11 23 19 ) + ); + } + obstacle + { + type wall; + faces + ( + ( 1 5 17 13 ) + ( 5 6 18 17 ) + ( 6 2 14 18 ) + ); + } + upperWall + { + type wall; + faces + ( + ( 8 9 21 20 ) + ( 9 10 22 21 ) + ( 10 11 23 22 ) + ); + } + lowerWall + { + type wall; + faces + ( + ( 0 1 13 12 ) + ( 2 3 15 14 ) + ); + } + frontAndBack + { + type empty; + faces + ( + ( 0 1 5 4 ) + ( 2 3 7 6 ) + ( 4 5 9 8 ) + ( 5 6 10 9 ) + ( 6 7 11 10 ) + ( 12 13 17 16 ) + ( 14 15 19 18 ) + ( 16 17 21 20 ) + ( 17 18 22 21 ) + ( 18 19 23 22 ) + ); + } +); diff --git a/channel-transport/transport-openfoam/system/controlDict b/channel-transport/transport-openfoam/system/controlDict new file mode 100644 index 000000000..ef74b7f99 --- /dev/null +++ b/channel-transport/transport-openfoam/system/controlDict @@ -0,0 +1,44 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} + +application dynamicScalarTransportFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1.0; + +deltaT 0.005; + +writeControl adjustableRunTime; + +writeInterval 0.005; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +functions +{ + preCICE_Adapter + { + type preciceAdapterFunctionObject; + libs ("libpreciceAdapterFunctionObject.so"); + } +} diff --git a/channel-transport/transport-openfoam/system/decomposeParDict b/channel-transport/transport-openfoam/system/decomposeParDict new file mode 100644 index 000000000..f9eae003a --- /dev/null +++ b/channel-transport/transport-openfoam/system/decomposeParDict @@ -0,0 +1,16 @@ +FoamFile { + version 2.0; + class dictionary; + object decomposeParDict; + format ascii; +} + +numberOfSubdomains 4; + +method simple; + +simpleCoeffs +{ + n (2 2 1); + delta 0.001; +} \ No newline at end of file diff --git a/channel-transport/transport-openfoam/system/fvSchemes b/channel-transport/transport-openfoam/system/fvSchemes new file mode 100644 index 000000000..f3a636050 --- /dev/null +++ b/channel-transport/transport-openfoam/system/fvSchemes @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2312 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,T) Gauss linearUpwind grad(T); +} + +laplacianSchemes +{ + default none; + laplacian(DT,T) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/channel-transport/transport-openfoam/system/fvSolution b/channel-transport/transport-openfoam/system/fvSolution new file mode 100644 index 000000000..b258c9b1b --- /dev/null +++ b/channel-transport/transport-openfoam/system/fvSolution @@ -0,0 +1,35 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2312 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + T + { + solver PBiCGStab; + preconditioner DILU; + tolerance 1e-6; + relTol 0; + norm default; + } +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; +} + + +// ************************************************************************* // diff --git a/channel-transport/transport-openfoam/system/preciceDict b/channel-transport/transport-openfoam/system/preciceDict new file mode 100644 index 000000000..aca923918 --- /dev/null +++ b/channel-transport/transport-openfoam/system/preciceDict @@ -0,0 +1,37 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object preciceDict; +} + +preciceConfig "../precice-config.xml"; + +participant Transport; + +modules (FF); + +interfaces +{ + Interface1 + { + mesh Transport-Mesh; + patches (); + locations volumeCenters; + + readData + ( + Velocity + ); + + writeData + ( + ); + }; +}; + +FF +{ + solverType incompressible; +} diff --git a/channel-transport/transport-openfoam/system/setExprFieldsDict b/channel-transport/transport-openfoam/system/setExprFieldsDict new file mode 100644 index 000000000..69f06ed75 --- /dev/null +++ b/channel-transport/transport-openfoam/system/setExprFieldsDict @@ -0,0 +1,29 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setExprFieldsDict; +} + +expressions +( + T + { + field T; + + variables + ( + "x = pos().x()" + "y = pos().y()" + "r = 0.5" + "bx = 1" + "by = 1" + ); + + expression + #{ + r - r * tanh(((x - bx)*(x - bx) + (y - by)*(y - by) - r) / 0.1) + #}; + } +);