openfoam/tutorials/incompressible/simpleFoam/simpleCar
2023-12-20 19:42:55 +01:00
..
0.orig RELEASE: Updated headers to v2312 2023-12-20 19:42:55 +01:00
constant RELEASE: Updated headers to v2312 2023-12-20 19:42:55 +01:00
system RELEASE: Updated headers to v2312 2023-12-20 19:42:55 +01:00
Allclean TUT: incompressible: clean up tutorials 2021-06-08 20:15:47 +00:00
Allrun TUT: incompressible: clean up tutorials 2021-06-08 20:15:47 +00:00
README TUT: Added example showing use of functionObject result lookup from a Function1 2021-11-26 11:22:36 +00:00

# 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;
    }
```