-
Notifications
You must be signed in to change notification settings - Fork 2
add OpenFOAM test case: rotating cylinder #13
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /*--------------------------------*- C++ -*----------------------------------*\ | ||
| | ========= | | | ||
| | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| | \\ / O peration | Version: v2412 | | ||
| | \\ / A nd | Website: www.openfoam.com | | ||
| | \\/ M anipulation | | | ||
| \*---------------------------------------------------------------------------*/ | ||
| FoamFile | ||
| { | ||
| version 2.0; | ||
| format ascii; | ||
| class volVectorField; | ||
| object U; | ||
| } | ||
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
|
||
| dimensions [0 1 -1 0 0 0 0]; | ||
|
|
||
| internalField uniform (0 0 0); | ||
|
|
||
| boundaryField | ||
| { | ||
| innerWall | ||
| { | ||
| type noSlip; | ||
| } | ||
|
|
||
| outerWall | ||
| { | ||
| type noSlip; | ||
| } | ||
|
|
||
| frontAndBack | ||
| { | ||
| type empty; | ||
| } | ||
| } | ||
|
|
||
| // ************************************************************************* // |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /*--------------------------------*- C++ -*----------------------------------*\ | ||
| | ========= | | | ||
| | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| | \\ / O peration | Version: v2412 | | ||
| | \\ / A nd | Website: www.openfoam.com | | ||
| | \\/ M anipulation | | | ||
| \*---------------------------------------------------------------------------*/ | ||
| FoamFile | ||
| { | ||
| version 2.0; | ||
| format ascii; | ||
| class volScalarField; | ||
| object p; | ||
| } | ||
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
|
||
| dimensions [0 2 -2 0 0 0 0]; | ||
|
|
||
| internalField uniform 0; | ||
|
|
||
| boundaryField | ||
| { | ||
| "innerWall|outerWall" | ||
| { | ||
| type zeroGradient; | ||
| } | ||
|
|
||
| frontAndBack | ||
| { | ||
| type empty; | ||
| } | ||
| } | ||
|
|
||
| // ************************************************************************* // |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/sh | ||
| cd "${0%/*}" || exit # Run from this directory | ||
| . ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions | ||
| #------------------------------------------------------------------------------ | ||
|
|
||
| cleanCase | ||
|
|
||
| rm -f *.png | ||
|
|
||
| #------------------------------------------------------------------------------ |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this a file that can be replaced by the Snakemake file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Allrun-script is established in OpenFOAM to run simulations, often containing 5 or more steps, which need to be executed (calling applications, moving/deleting files, sometimes receiving input parameters from the CLI). This is the way. As discussed in the previous comments, we are going to remove the post-processing from this. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/bin/sh | ||
| cd "${0%/*}" || exit # Run from this directory | ||
| . ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions | ||
| #------------------------------------------------------------------------------ | ||
|
|
||
| runApplication blockMesh | ||
| runApplication $(getApplication) | ||
| ./plot | ||
|
|
||
| #------------------------------------------------------------------------------ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
|
|
||
| rule run_simulation_container: | ||
| input: | ||
| ".", | ||
| output: | ||
| directory("."), | ||
| container: "docker://opencfd/openfoam-run:2412" | ||
| shell: "./Allrun" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /*--------------------------------*- C++ -*----------------------------------*\ | ||
| | ========= | | | ||
| | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| | \\ / O peration | Version: v2412 | | ||
| | \\ / A nd | Website: www.openfoam.com | | ||
| | \\/ M anipulation | | | ||
| \*---------------------------------------------------------------------------*/ | ||
| FoamFile | ||
| { | ||
| version 2.0; | ||
| format ascii; | ||
| class dictionary; | ||
| location "constant"; | ||
| object MRFProperties; | ||
| } | ||
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
|
||
| MRF1 | ||
| { | ||
| cellZone all; | ||
| active yes; | ||
|
|
||
| nonRotatingPatches (outerWall); | ||
|
|
||
| origin (0 0 0); | ||
| axis (0 0 1); | ||
| omega 100; | ||
| } | ||
|
|
||
| // ************************************************************************* // |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /*--------------------------------*- C++ -*----------------------------------*\ | ||
| | ========= | | | ||
| | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| | \\ / O peration | Version: v2412 | | ||
| | \\ / A nd | Website: www.openfoam.com | | ||
| | \\/ M anipulation | | | ||
| \*---------------------------------------------------------------------------*/ | ||
| FoamFile | ||
| { | ||
| version 2.0; | ||
| format ascii; | ||
| class dictionary; | ||
| location "constant"; | ||
| object transportProperties; | ||
| } | ||
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
|
||
| transportModel Newtonian; | ||
|
|
||
| nu 1; | ||
|
|
||
| // ************************************************************************* // |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /*--------------------------------*- C++ -*----------------------------------*\ | ||
| | ========= | | | ||
| | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | ||
| | \\ / O peration | Version: v2412 | | ||
| | \\ / A nd | Website: www.openfoam.com | | ||
| | \\/ M anipulation | | | ||
| \*---------------------------------------------------------------------------*/ | ||
| FoamFile | ||
| { | ||
| version 2.0; | ||
| format ascii; | ||
| class dictionary; | ||
| location "constant"; | ||
| object turbulenceProperties; | ||
| } | ||
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
|
||
| simulationType laminar; | ||
|
|
||
| // ************************************************************************* // |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/bin/sh | ||
| # Require gnuplot | ||
| command -v gnuplot >/dev/null || { | ||
| echo "FOAM FATAL ERROR: gnuplot not found - skipping graph creation" 1>&2 | ||
| exit 1 | ||
| } | ||
|
|
||
|
|
||
| gnuplot<<EOF | ||
| set terminal pngcairo font "helvetica,16" size 800,600 | ||
| set xlabel "Radius, r" | ||
| set xrange [1:2] | ||
| set grid | ||
|
|
||
| Omega1 = 100. | ||
| Omega2 = 0. | ||
| R1 = 1. | ||
| R2 = 2. | ||
|
|
||
| mu = Omega2/Omega1 | ||
|
|
||
| A = Omega1*(1. - R2*R2*mu/R1/R1)/(1. - R2*R2/R1/R1) | ||
| B = R1*R1*Omega1*(1. - mu)/(1. - R1*R1/R2/R2) | ||
|
|
||
| analytical_utheta(r) = A*r + B/r | ||
| C = 0.5*A*A*R1*R1 + 2.*A*B*log(R1) - 0.5*B*B/R1/R1 | ||
| analytical_p(r) = 0.5*A*A*r*r + 2.*A*B*log(r) - 0.5*B*B/r/r - C | ||
|
|
||
| samples="postProcessing/sample1/1000/centreLine_p_U_U:Transformed.xy" | ||
|
|
||
| set ylabel "Pressure, p" | ||
| set output "p.png" | ||
| set samples 20 | ||
| set key bottom right | ||
| plot samples u 1:2 w lines lw 2 lc "black" t "OpenFOAM", \ | ||
| analytical_p(x) w p ps 2 pt 6 lw 2 lc rgb "red" t "analytical" | ||
|
|
||
| set ylabel "U_{/Symbol q}, rad/s" | ||
| set output "Utheta.png" | ||
| set samples 20 | ||
| set key top right | ||
| plot samples u 1:7 w lines lw 2 lc "black" t "OpenFOAM", \ | ||
| analytical_utheta(x) w p ps 2 pt 6 lw 2 lc rgb "red" t "analytical" | ||
| EOF |
Uh oh!
There was an error while loading. Please reload this page.