Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 35 additions & 6 deletions .github/workflows/run-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
tests:
runs-on: ubuntu-latest



steps:
- name: checkout repo content
uses: actions/checkout@v2
Expand All @@ -30,19 +28,25 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: model-validation
activate-environment: model-validation
use-mamba: true

- name: Update environment
run: mamba env update -n model-validation -f environment_benchmarks.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: run-OpenFOAM-benchmarks
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/benchmarks/rotating-cylinder-OpenFOAM/
snakemake --force --cores 'all'

- name: run-fenics-benchmarks
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/benchmarks/linear-elasticity-plate-with-hole/
snakemake --use-conda --force --cores 'all'

- name: run-Kratos-benchmarks
shell: bash -l {0}
run: |
Expand All @@ -67,11 +71,36 @@ jobs:
name: fenics-output
path: |
benchmarks/linear-elasticity-plate-with-hole/data

- name: Archive kratos data
uses: actions/upload-artifact@v4
with:
name: kratos-output
path: |
benchmarks/linear-elasticity-plate-with-hole-Kratos/data



test_rotCyl_OF:
runs-on: ubuntu-latest
container:
image: opencfd/openfoam-run:2412

steps:
- name: Print debug information
run: |
echo "Running on OpenFOAM image"
echo "Current directory: $PWD"
echo "Available files:"
ls -la

- name: checkout repo content
uses: actions/checkout@v2

- name: run-OpenFOAM-benchmarks
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/benchmarks/rotating-cylinder-OpenFOAM/
sudo apt-get update && sudo apt-get install -y gnuplot
chmod +x ./plot
bash ./Allrun
echo "Finished job"
39 changes: 39 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/0/U
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;
}
}

// ************************************************************************* //
34 changes: 34 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/0/p
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;
}
}

// ************************************************************************* //
10 changes: 10 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/Allclean
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

#------------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/Allrun
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Author

Choose a reason for hiding this comment

The 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

#------------------------------------------------------------------------------
8 changes: 8 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/Snakefile
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"
30 changes: 30 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/constant/MRFProperties
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;
}

// ************************************************************************* //
22 changes: 22 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/constant/transportProperties
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;

// ************************************************************************* //
44 changes: 44 additions & 0 deletions benchmarks/rotating-cylinder-OpenFOAM/plot
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
Loading
Loading