diff --git a/.gitignore b/.gitignore index 010a377e4..370b31a0a 100644 --- a/.gitignore +++ b/.gitignore @@ -68,10 +68,9 @@ postProcessing/ *.foam *.OpenFOAM dynamicCode -Make/* -!Make/files -!Make/options -lnInclude/ +**/Make/* +!**/Make/files +!**/Make/options # CalculiX spooles.out 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 efa81fa12..26af96501 100644 --- a/channel-transport/README.md +++ b/channel-transport/README.md @@ -45,6 +45,8 @@ Transport participant: * Nutils with support for [adaptive mesh refinement](https://precice.org/couple-your-code-moving-or-changing-meshes.html#pseudo-reference-domain). For more information, have a look at the [Nutils adapter documentation](https://precice.org/adapter-nutils.html). This solver requires a preCICE release with [remeshing support](couple-your-code-moving-or-changing-meshes.html#remeshing-using-precice). +* OpenFOAM. This case uses a modified version of scalarTransportFoam, which recomputes `phi` after the preCICE adapter reads the velocity field. Find it in the `solver-openfoam` folder. Read more details in the [OpenFOAM adapter](https://precice.org/adapter-openfoam-overview.html). + ## Running the simulation For the fluid solver, use Nutils for ease of installation and OpenFOAM for speed. diff --git a/channel-transport/metadata.yaml b/channel-transport/metadata.yaml index 72588003e..8f4a22470 100644 --- a/channel-transport/metadata.yaml +++ b/channel-transport/metadata.yaml @@ -7,20 +7,26 @@ participants: - Transport cases: + fluid-nutils: + participant: Fluid + directory: ./fluid-nutils + run: ./run.sh + component: nutils-adapter + fluid-openfoam: participant: Fluid directory: ./fluid-openfoam run: ./run.sh component: openfoam-adapter - fluid-nutils: - participant: Fluid - directory: ./fluid-nutils + transport-nutils: + participant: Transport + directory: ./transport-nutils run: ./run.sh component: nutils-adapter - transport-nutils: + transport-openfoam: participant: Transport - directory: ./transport-nutils + directory: ./transport-openfoam run: ./run.sh - component: nutils-adapter \ No newline at end of file + component: openfoam-adapter diff --git a/channel-transport/solver-openfoam/.clang-format b/channel-transport/solver-openfoam/.clang-format new file mode 100644 index 000000000..00adea7a3 --- /dev/null +++ b/channel-transport/solver-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/solver-openfoam/Make/files b/channel-transport/solver-openfoam/Make/files new file mode 100644 index 000000000..6a9053551 --- /dev/null +++ b/channel-transport/solver-openfoam/Make/files @@ -0,0 +1,3 @@ +dynamicScalarTransportFoam.C + +EXE = $(FOAM_USER_APPBIN)/dynamicScalarTransportFoam diff --git a/channel-transport/solver-openfoam/Make/options b/channel-transport/solver-openfoam/Make/options new file mode 100644 index 000000000..acbe7a647 --- /dev/null +++ b/channel-transport/solver-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/solver-openfoam/clean.sh b/channel-transport/solver-openfoam/clean.sh new file mode 100755 index 000000000..2ca6224c6 --- /dev/null +++ b/channel-transport/solver-openfoam/clean.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +set -e -u + +wclean diff --git a/channel-transport/solver-openfoam/createFields.H b/channel-transport/solver-openfoam/createFields.H new file mode 100644 index 000000000..82417fbb0 --- /dev/null +++ b/channel-transport/solver-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/solver-openfoam/dynamicScalarTransportFoam.C b/channel-transport/solver-openfoam/dynamicScalarTransportFoam.C new file mode 100644 index 000000000..99fe8f626 --- /dev/null +++ b/channel-transport/solver-openfoam/dynamicScalarTransportFoam.C @@ -0,0 +1,63 @@ +// +// This file is based on the OpenFOAM example application scalarTransportFoam +// +// GitLab link: https://gitlab.com/openfoam/core/openfoam/-/tree/master/applications/solvers/basic/scalarTransportFoam +// +// This modified version doesn't expect a static velocity field U, instead, it repomputes it every time step. +// Therefore it allows the preCICE adapter to provide the velocities. + +#include "fvCFD.H" +#include "fvOptions.H" +#include "simpleControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char* argv[]) +{ + argList::addNote( + "Dynamic 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/.gitignore b/channel-transport/transport-openfoam/.gitignore new file mode 100644 index 000000000..e20d1247a --- /dev/null +++ b/channel-transport/transport-openfoam/.gitignore @@ -0,0 +1 @@ +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/clean.sh b/channel-transport/transport-openfoam/clean.sh new file mode 100755 index 000000000..5120c1355 --- /dev/null +++ b/channel-transport/transport-openfoam/clean.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh +set -e -u + +. ../../tools/cleaning-tools.sh + +clean_openfoam . +rm -rf ./0/ 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/run.sh b/channel-transport/transport-openfoam/run.sh new file mode 100755 index 000000000..da4e9565a --- /dev/null +++ b/channel-transport/transport-openfoam/run.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -e -u + +. ../../tools/log.sh +exec > >(tee --append "$LOGFILE") 2>&1 + +# Build the dynamicScalarTransportFoam solver, if not found. +if ! command -v dynamicScalarTransportFoam > /dev/null 2>&1; then + echo "Building ../solver-openfoam and installing to ${FOAM_USER_APPBIN}/dynamicScalarTransportFoam..." + wmake ../solver-openfoam +fi + +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..bdb4fe67b --- /dev/null +++ b/channel-transport/transport-openfoam/system/blockMeshDict @@ -0,0 +1,146 @@ +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; + +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 ) + ); + } +); \ No newline at end of file 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..109b08316 --- /dev/null +++ b/channel-transport/transport-openfoam/system/fvSchemes @@ -0,0 +1,39 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,T) bounded Gauss upwind; +} + +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..0e5e0a6c7 --- /dev/null +++ b/channel-transport/transport-openfoam/system/fvSolution @@ -0,0 +1,24 @@ +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..dc859d900 --- /dev/null +++ b/channel-transport/transport-openfoam/system/setExprFieldsDict @@ -0,0 +1,31 @@ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object setExprFieldsDict; +} + +// Initializes the blob at coordinates (bx,by) with given radius. +// The formula is consistent with the one used in the original nutils case. +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) + #}; + } +); diff --git a/tools/tests/tests.yaml b/tools/tests/tests.yaml index 4746de69f..97f537a92 100644 --- a/tools/tests/tests.yaml +++ b/tools/tests/tests.yaml @@ -37,6 +37,13 @@ test_suites: - transport-nutils max_time: 0.1 reference_result: ./channel-transport/reference-results/fluid-openfoam_transport-nutils.tar.gz + - &channel-transport_fluid-openfoam_transport-openfoam + path: channel-transport + case_combination: + - fluid-openfoam + - transport-openfoam + max_time: 0.5 + reference_result: ./channel-transport/reference-results/fluid-openfoam_transport-openfoam.tar.gz channel-transport-reaction: tutorials: @@ -559,6 +566,7 @@ test_suites: tutorials: - *breaking-dam-2d_fluid-openfoam_solid-calculix - *channel-transport_fluid-openfoam_transport-nutils + - *channel-transport_fluid-openfoam_transport-openfoam - *channel-transport-reaction_fluid-fenics_chemical-fenics - *channel-transport-particles_fluid-openfoam_particles-mercurydpm - *channel-transport-particles_fluid-nutils_particles-mercurydpm @@ -719,6 +727,7 @@ test_suites: tutorials: - *breaking-dam-2d_fluid-openfoam_solid-calculix - *channel-transport_fluid-openfoam_transport-nutils + - *channel-transport_fluid-openfoam_transport-openfoam - *channel-transport-particles_fluid-openfoam_particles-mercurydpm - *elastic-tube-3d_fluid-openfoam_solid-calculix - *flow-around-controlled-moving-cylinder_controller-fmi_fluid-openfoam_solid-python