diff --git a/tutorials/incompressible/simpleFoam/simpleCar/README b/tutorials/incompressible/simpleFoam/simpleCar/README new file mode 100644 index 0000000000000000000000000000000000000000..0e731901c9b2ea070a68e6df35390476776048ed --- /dev/null +++ b/tutorials/incompressible/simpleFoam/simpleCar/README @@ -0,0 +1,95 @@ +# Tutorial case: simpleCar + +Provides example of using the function objects: + +- forceCoeffs +- fieldAverage +- reference +- runTimeControls + +The case automatically terminates according to the runTimeControls: + +- The first condition monitors the average drag coefficient, derived from a + combination of the forceCoeffs and valueAverage function objects. When the + average stabilises to a tolerance of 1e-3 it sets the trigger 1 index + +``` + runTimeControl1 + { + type runTimeControl; + libs (utilityFunctionObjects); + conditions + { + condition1 + { + type average; + functionObject forceCoeffs1; + fields (Cd); + tolerance 1e-3; + window 20; + windowType exact; + } + } + satisfiedAction setTrigger; + trigger 1; + } +``` + +- This starts the second condition, which instructs the code to terminate + after a further 100 time steps. + +``` + runTimeControl2 + { + type runTimeControl; + libs (utilityFunctionObjects); + controlMode trigger; + triggerStart 1; + conditions + { + condition1 + { + type maxDuration; + duration 100; + } + } + satisfiedAction end; + } +``` + +The `reference` function object provides an additional example where: + +- the average of the sample object values are averaged in time: + +``` + average1 + { + type valueAverage; + libs (fieldFunctionObjects); + writeControl writeTime; + + // Average the result of the `sample1` function object, where the + // result is given by the name `average(p)` + functionObject sample1; + fields (average(p)); + } +``` + +- this value is used by the `reference` function object, where the refValue + is a Function1 entry: + +``` + reference1 + { + type reference; + libs (fieldFunctionObjects); + writeControl writeTime; + field p; + + // Set the refValue according to the result of the `average1` function + // object, where the result is given by the name `average(p)Mean` + refValue functionObjectValue; + functionObject average1; + functionObjectResult average(p)Mean; + } +``` diff --git a/tutorials/incompressible/simpleFoam/simpleCar/system/controlDict b/tutorials/incompressible/simpleFoam/simpleCar/system/controlDict index c257be3bc33410dd95cac5b662d19214fb507489..5d4059e848b518b369ac4e6facc474eb64382c2a 100644 --- a/tutorials/incompressible/simpleFoam/simpleCar/system/controlDict +++ b/tutorials/incompressible/simpleFoam/simpleCar/system/controlDict @@ -48,6 +48,7 @@ functions { #include "forceCoeffs" #include "fieldAverage" + #include "referencePressure" #include "runTimeControls" } diff --git a/tutorials/incompressible/simpleFoam/simpleCar/system/referencePressure b/tutorials/incompressible/simpleFoam/simpleCar/system/referencePressure new file mode 100644 index 0000000000000000000000000000000000000000..e71a93b47cc9dcb5388c757092847c448669285b --- /dev/null +++ b/tutorials/incompressible/simpleFoam/simpleCar/system/referencePressure @@ -0,0 +1,66 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2106 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +sample1 +{ + type sets; + libs (sampling); + interpolationScheme cellPointFace; + setFormat raw; + fields ( p ); + + sets + ( + cloud + { + type cloud; + axis xyz; + points + ( + (1 0.2 0.05) + (1 0.4 0.05) + (1 0.6 0.05) + (1 0.8 0.05) + (1 1.0 0.05) + ); + } + ); +} + +average1 +{ + type valueAverage; + libs (fieldFunctionObjects); + writeControl writeTime; + functionObject sample1; + fields (average(p)); +} + +reference1 +{ + type reference; + libs (fieldFunctionObjects); + writeControl writeTime; + field p; + refValue functionObjectValue; + functionObject average1; + functionObjectResult average(p)Mean; +} + +reference2 +{ + type reference; + libs (fieldFunctionObjects); + writeControl writeTime; + field p; + refValue sample; + position (1 0.2 0.05); +} + + +// ************************************************************************* //