From c926f146d4cadd70e2abcf85ac47990958e05c4d Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Sun, 15 Dec 2024 16:51:28 +0000 Subject: [PATCH] TUT: motorBike - added example for graphFunctionObject --- .../simpleFoam/motorBike/system/controlDict | 3 + .../motorBike/system/graphFunctionObject | 142 ++++++++++++++++++ .../simpleFoam/motorBike/system/solverInfo | 21 +++ 3 files changed, 166 insertions(+) create mode 100644 tutorials/incompressible/simpleFoam/motorBike/system/graphFunctionObject create mode 100644 tutorials/incompressible/simpleFoam/motorBike/system/solverInfo diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index 6a42118c719..937a96613b0 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -51,6 +51,9 @@ functions #include "cuttingPlane" #include "forceCoeffs" #include "ensightWrite" + + #include "solverInfo" + #include "graphFunctionObject" } diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/graphFunctionObject b/tutorials/incompressible/simpleFoam/motorBike/system/graphFunctionObject new file mode 100644 index 00000000000..ba4f9a4a671 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/motorBike/system/graphFunctionObject @@ -0,0 +1,142 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2406 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +residualGraph1 +{ + // Mandatory entries + type graphFunctionObject; + libs (utilityFunctionObjects); + + functions + { + Ux + { + // Mandatory entries + object solverInfo1; + entry Ux_initial; + + // Optional entries + // title <string>; + // colour <labelVector>; + // dashes <labelList>; + } + Uy + { + object solverInfo1; + entry Uy_initial; + } + Uz + { + object solverInfo1; + entry Uz_initial; + } + p + { + object solverInfo1; + entry p_initial; + } + } + + // Optional entries + logScaleX no; + logScaleY yes; + xlabel "Iteration"; + ylabel "log10(Initial residual)"; + // xMin <scalar>; + // xMax <scalar>; + // yMin <scalar>; + // yMax <scalar>; + // width <label>; + // height <label>; + // strokeWidth <label>; + // drawGrid <bool>; + + // Inherited entries + writePrecision 6; + writeToFile true; + useUserTime true; + + region region0; + enabled true; + log true; + timeStart 0; + timeEnd 1000; + executeControl timeStep; + executeInterval 1; + writeControl writeTime; + writeInterval -1; +} + + +forceCoeffsGraph1 +{ + type graphFunctionObject; + libs (utilityFunctionObjects); + writeControl writeTime; + + logScaleX no; + logScaleY no; + + xlabel "Iteration"; + ylabel "Coefficient"; + + yMin -1; + yMax 1; + + functions + { + Cd + { + object forceCoeffs1; + entry Cd; + } + // CdMean + // { + // object valueAverage1; + // entry CdMean; + // } + Cd(f) + { + object forceCoeffs1; + entry Cd(f); + } + Cd(r) + { + object forceCoeffs1; + entry Cd(r); + } + Cl + { + object forceCoeffs1; + entry Cl; + //colour (0, 0, 0); + } + // ClMean + // { + // object valueAverage1; + // entry ClMean; + // } + Cl(f) + { + object forceCoeffs1; + entry Cl(f); + //colour (0, 0, 0); + title Cl(f); + } + Cl(r) + { + object forceCoeffs1; + entry Cl(r); + //colour (0, 0, 0); + title Cl(r); + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/solverInfo b/tutorials/incompressible/simpleFoam/motorBike/system/solverInfo new file mode 100644 index 00000000000..5c764aa4713 --- /dev/null +++ b/tutorials/incompressible/simpleFoam/motorBike/system/solverInfo @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2406 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +solverInfo1 +{ + // Mandatory entries + type solverInfo; + libs (utilityFunctionObjects); + fields (U p); + + // Optional entries + writeResidualFields no; +} + + +// ************************************************************************* // -- GitLab