-
-
Notifications
You must be signed in to change notification settings - Fork 164
Add channel-transport transport OpenFOAM #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fsimonis
wants to merge
38
commits into
precice:develop
Choose a base branch
from
fsimonis:add-channel-transport-openfoam
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
1d949e5
It kind of runs
fsimonis ea64e38
remove blob
fsimonis a1c142c
Maybe right?
fsimonis f2fb4f3
setup setFields
fsimonis 9a1e7b9
Set a cylinder, increase mesh cells, add U_vol workaround
fsimonis e363145
Add modified solver
fsimonis e103c9a
Remove U_vol and rename solver
fsimonis 38f1424
fix
fsimonis 14db9a1
Revert to default schemes
fsimonis a4d0899
Fix dimensions of T
fsimonis 900eef5
Revert to tutorial files
fsimonis 759e9e5
Recompute phi after the preCICE adapter
fsimonis 78e4769
Correctly set blob
fsimonis 3b001ee
Add OpenFOAM transport to README
fsimonis c711cce
Only set initial condition
fsimonis 5602cfd
Add note about openfoam conserving T
fsimonis 9d72498
Fix application name
fsimonis 7e6502b
Add changelog
fsimonis 9d4322b
Merge branch 'develop' into add-channel-transport-openfoam
MakisH 7b2d66a
Change outlet to advective
fsimonis 44e2384
Add new blockMesh including generator
fsimonis d65fc11
Coarsen the mesh
fsimonis a06b27b
Remove the accumulation note
fsimonis 8ae9404
Move dynamicScalarTransportFoam into separate dir
fsimonis a8fa010
Move the openfoam solver gitignore
fsimonis 4b715ba
Add the solver installation
fsimonis 719fca6
Replace header
fsimonis e10d284
Add explanation for the expression
fsimonis e97213d
Fix order of includes in dynamicScalarTransportFoam.C
MakisH b463a64
Merge branch 'develop' into add-channel-transport-openfoam
MakisH 9a3e76f
Merge central gitignore changes
MakisH bd00dd2
Build the solver automatically
MakisH dc336c9
Move createMesh.py to a utils/ folder, add requirements.txt
MakisH 08935ba
Move .clang-format file
MakisH 48c2d4b
Reformat solver source file
MakisH a250faf
Add the new case to the metadata.yaml
MakisH 9a195d9
Add the new case to the system tests
MakisH 46961b9
Remove leftover headers
MakisH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - Added OpenFOAM variant of the transport participant to the channel-transport tutorial. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <T>" (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: | ||
| ... | ||
|
|
|
fsimonis marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| dynamicScalarTransportFoam.C | ||
|
|
||
| EXE = $(FOAM_USER_APPBIN)/dynamicScalarTransportFoam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/usr/bin/env sh | ||
| set -e -u | ||
|
|
||
| wclean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" |
63 changes: 63 additions & 0 deletions
63
channel-transport/solver-openfoam/dynamicScalarTransportFoam.C
|
MakisH marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| } | ||
|
|
||
| // ************************************************************************* // |
|
MakisH marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 0/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.