Commit Graph

390 Commits

Author SHA1 Message Date
bcc5169ddc fvMesh: Added meshPhi to the geometricFields set
Also provide fields and curFields functions which return the list of registered
fields not including the geometryFields and current registered fields not
including the geometryFields or old-time fields to simplify mapping code for
NCC, mesh-to-mesh mapping and load-balancing.
2023-06-28 11:53:14 +01:00
e019049bef primitiveMesh,polyMesh: Further refactoring of mesh checking 2023-06-23 13:44:35 +01:00
4c62933e7f surfaceFieldValue: Removed sumDirection and sumDirectionBalance operations
The purpose of these operations was unclear, and there was no
documentation or examples of their usage. The differences between these
operations behaviours for scalar and vector input seemed arbitrary.
These operations have in some cases become the subject of confusion.
They have therefore been removed.

Equivalent functionality could be easily reinstated as and when a clear
need and application becomes apparent.
2023-06-22 15:42:18 +01:00
0927fd47fa stringOps: Rationalisation of expansions
Specific names have been given for expand functions. Unused functions
have been removed, and functions only used locally have been removed
from the namespace. Documentation has been corrected. Default and
alternative value handling has been removed from code template
expansion.
2023-06-22 11:46:23 +01:00
04dd989911 Time: Removed graphFormat
setFormat no longer defaults to the value of graphFormat optionally set in
controlDict and must be set in the functionObject dictionary.

boundaryFoam, financialFoam and pdfPlot still require a graphFormat entry in
controlDict but this is now read directly rather than by Time.
2023-06-16 14:51:30 +01:00
618d9d33b2 controlDict: the optional graphFormat entry is now used as the default for all setFormat entries
Foam::graph superseded by the more general Foam::setWriter reducing code
maintenance overhead, simplifying usage and further development.
2023-06-12 17:14:37 +01:00
36e8344429 functionObjects::checkMesh: New functionObject to check mesh changes
Class
    Foam::functionObjects::checkMesh

Description
    Executes primitiveMesh::checkMesh(true) every execute time for which the
    mesh changed, i.e. moved or changed topology.

    Useful to check the correctness of changing and morphing meshes.

    Example of checkMesh specification:
    \verbatim
    checkMesh
    {
        type            checkMesh;
        libs            ("libutilityFunctionObjects.so");

        executeControl  timeStep;
        executeInterval 10;
    }
    \endverbatim
    or using the standard configuration file:
    \verbatim
    #includeFunc checkMesh(executeInterval=10)
    \endverbatim

Can be used with any solver supporting mesh-motion, in particular the movingMesh
solver module, to check the mesh quality following morphing and/or topology
change.
2023-06-06 18:36:46 +01:00
1d78434bee functionObjects::interfaceHeight: Corrected parallel operation 2023-05-31 11:51:38 +01:00
ca72b0a963 fvPatchFields: Removed all fvPatchFields requiring user specified data from the null-constructor table
This avoids potential hidden run-time errors caused by solvers running with
boundary conditions which are not fully specified.  Note that "null-constructor"
here means the constructor from patch and internal field only, no data is
provided.

Constraint and simple BCs such as 'calculated', 'zeroGradient' and others which
do not require user input to fully specify their operation remain on the
null-constructor table for the construction of fields with for example all
'calculated' or all 'zeroGradient' BCs.

A special version of the 'inletOutlet' fvPatchField named 'zeroInletOutlet' has
been added in which the inlet value is hard-coded to zero which allows this BC
to be included on the null-constructor table.  This is useful for the 'age'
functionObject to avoid the need to provide the 'age' volScalarField at time 0
unless special inlet or outlet BCs are required.  Also for isothermalFilm in
which the 'alpha' field is created automatically from the 'delta' field if it is
not present and can inherit 'zeroInletOutlet' from 'delta' if appropriate.  If a
specific 'inletValue' is require or other more complex BCs then the 'alpha'
field file must be provided to specify these BCs as before.

Following this improvement it will now be possible to remove the
null-constructors from all fvPatchFields not added to the null-constructor
table, which is most of them, thus reducing the amount of code and maintenance
overhead and making easier and more obvious to write new fvPatchField types.
2023-05-27 16:56:10 +01:00
fec6705dc9 OpenFOAM: Updated for gcc-13
gcc-13 has new code checking and warning mechanisms which are useful but not
entirely robust and produce many false positives, particularly with respect to
local references:

    warning: possibly dangling reference to a temporary

This commit resolves many of the new warning messages but the above false
warnings remain.  It is possible to switch off this warning but as it also
provides some useful checks it is currently left on.
2023-05-23 10:47:56 +01:00
4974cc2e1d functionObjects::stopAtTimeStep: New functionObject to stop the run if the time-step becomes too small
This is useful to write results before a case fails due to uncontrollable
automatic time-step reduction, usually caused by unstable pressure-velocity
coupling.

Class
    Foam::functionObjects::stopAtTimeStep

Description
    Stops the run if the time-step drops below the specified value in seconds
    and optionally write results before stopping.

    The following actions are supported:
    - noWriteNow
    - writeNow (default)
    - nextWrite

    Examples of function object specification:
    \verbatim
    stop
    {
        type            stopAtTimeStep;

        libs            ("libutilityFunctionObjects.so");

        minDeltaT       1e-8;
        action          writeNow;
    }
    \endverbatim
    will write the fields and stop if the time-step drops below 1e-8s.

Usage
    \table
        Property  | Description               | Required | Default value
        type      | type name: stopAtTimeStep | yes      |
        minDeltaT | Minimum time-step [s]     | yes      |
        action    | Action executed           | no       | writeNow
    \endtable
2023-04-13 13:01:42 +01:00
496850ebb2 functionObjects::fieldValues::volFieldValue: Added support for VolInternalField
It is now possible to calculate field values of VolInternalFields, e.g. the
cached kEpsilon:G field in the
tutorials/modules/incompressibleFluid/pitzDailySteady case:

    #includeFunc cellMax(kEpsilon:G)
2023-03-15 13:59:29 +00:00
a535ff7c9a codedFunctionObject: Read executeAtStart control 2023-02-22 12:03:02 +00:00
e6b517a1e3 functionObjects: uniform, fieldsExpression: Support for dimensioned fields 2023-02-21 12:55:16 +00:00
c8f177e453 streamlines: Protected operation agaist no streamlines being generated 2023-02-16 11:12:36 +00:00
69dbca58fb Moved src/functionObjects/lagrangian -> src/lagrangian/functionObjects
to localise Lagrangian functionality
2023-02-04 10:50:39 +00:00
e2c160462e functionObjects::volRegion: Replaced with fvCellSet
Replacing volRegion removes unnecessary functionality duplication and ensures
cell set selection is consistent between functionObjects, fvModels and
fvConstraints for user convenience and reducing the code maintenance overhead.

Description
    General cell set selection class for models that apply to sub-sets
    of the mesh.

    Currently supports cell selection from a set of points, a specified cellSet
    or cellZone or all of the cells.  The selection method can either be
    specified explicitly using the \c select entry or inferred from the
    presence of either a \c cellSet, \c cellZone or \c points entry.  The \c
    select entry is required to select \c all cells.

Usage
    Examples:
    \verbatim
        // Apply everywhere
        select   all;

        // Apply within a given cellSet
        select   cellSet; // Optional
        cellSet         rotor;

        // Apply within a given cellZone
        select   cellZone; // Optional
        cellZone        rotor;

        // Apply in cells containing a list of points
        select   points; // Optional
        points
        (
            (2.25 0.5 0)
            (2.75 0.5 0)
        );
    \endverbatim
2023-02-03 19:16:32 +00:00
4dbc23c141 ListOps::identity -> identityMap
to avoid confusion with the tensor identity.
2023-02-03 17:12:31 +00:00
295223624b Rationalised and standardised cell, face and point set selection controls
The keyword 'select' is now used to specify the cell, face or point set
selection method consistently across all classes requiring this functionality.

'select' replaces the inconsistently named 'regionType' and 'selectionMode'
keywords used previously but backwards-compatibility is provided for user
convenience.  All configuration files and tutorials have been updated.

Examples of 'select' from the tutorial cases:

functionObjects:

    cellZoneAverage
    {
        type            volFieldValue;
        libs            ("libfieldFunctionObjects.so");

        writeControl    writeTime;
        writeInterval   1;

        fields          (p);
        select          cellZone;
        cellZone        injection;

        operation       volAverage;
        writeFields     false;
    }

    #includeFunc populationBalanceSizeDistribution
    (
        name=numberDensity,
        populationBalance=aggregates,
        select=cellZone,
        cellZone=outlet,
        functionType=numberDensity,
        coordinateType=projectedAreaDiameter,
        allCoordinates=yes,
        normalise=yes,
        logTransform=yes
    )

fvModel:

    cylinderHeat
    {
        type            heatSource;

        select          all;

        q               5e7;
    }

fvConstraint:

    momentumForce
    {
        type            meanVelocityForce;

        select          all;

        Ubar            (0.1335 0 0);
    }
2023-02-01 16:17:16 +00:00
574165dc13 functionObjects: Replaced 'name' with 'patch', 'faceZone' or 'cellZone' as appropriate
for consistency with the rest of OpenFOAM and to allow 'name' to be used as the
keyword to name the functionObject.
2023-02-01 11:54:36 +00:00
5d55e0483d functionObjects::phaseScalarTransport: Corrected member data documentation 2023-01-28 10:15:15 +00:00
2da6c4cc62 functionObjects::scalarTransport: diffusion -> diffusivity
It in more logical to name the diffusivity entry, types and variables
"diffusivity" rather than "diffusion".
2023-01-27 14:49:01 +00:00
8de6cd744e solvers::functions: New solver module to execute functionObjects in a time-loop
Description
    Solver module to execute the \c functionObjects for a specified solver

    The solver specified by either the \c subSolver or if not present the \c
    solver entry in the \c controlDict is instantiated to provide the physical
    fields needed by the \c functionObjects.  The \c functionObjects are then
    instantiated from the specifications are read from the \c functions entry in
    the \c controlDict and executed in a time-loop also controlled by entries in
    \c controlDict and the \c maxDeltaT() returned by the sub-solver.

    The fields and other objects registered by the sub-solver are set to
    NO_WRITE as they are not changed by the execution of the functionObjects and
    should not be written out each write-time.  Fields and other objects created
    and changed by the execution of the functionObjects are written out.

solvers::functions in conjunction with the scalarTransport functionObject
replaces scalarTransportFoam and provide more general handling of the scalar
diffusivity.
2023-01-27 14:31:58 +00:00
104be8eae9 Corrected typos 2023-01-24 22:01:34 +00:00
00ca8905a0 Minor typo corrections
Patch contributed by Timo Niemi, VTT.
2023-01-24 18:27:37 +00:00
20c7c7c21a Resolve warning messages generated by Clang-15 2023-01-03 11:26:15 +00:00
c0d56c905a fieldAverage: Corrected initialisation of iteration and time totals 2022-12-21 15:29:05 +00:00
118f77e6a5 functionObjects: stopAtEmptyClouds: New function to end the run when clouds are empty
This function stops the run when all parcel clouds are empty.

Example of function object specification:

    stop
    {
        type            stopAtEmptyClouds;
        libs            ("liblagrangianFunctionObjects.so");

        executeControl  timeStep; // <-- Likely only to be needed if injection
        startTime       0.500001; // starts after time zero. In which case the
                                  // startTime should be slightly after the
                                  // injection start time.

        action          nextWrite;
    }

A packaged function object is also included, which permits the following
syntax to be used, either with #includeFunc in the system/controlDict,
or with the -func option to foamPostProcess:

   stopAtEmptyClouds(startTime=0.500001)
2022-12-13 15:04:16 +00:00
06e29c44ab Lagrangian: Removed sub-cycling and improved injection behaviour
Support for mesh sub-cycling has been removed from Lagrangian. Various
Lagrangian processes already support sub-dividing the time-step. It is
easier and more efficient to extend that support all the way to the
high-level cloud objects, rather than to sub-cycle the mesh.

This has additional benefits. The cloud now no longer needs to reset the
step fraction at the start of every sub-motion. Injection can take
advantage of this by modifying particles' step fractions in order to
distribute them uniformly through the time-step. This is a simple and
efficient method. Previously, injection would track the particles some
distance after injection. This was more expensive to do, it resulted in
spatial artefacts in the injected Lagrangian field, and it did not
correctly handle interactions with patches or parallel transfers.

The lack of injection tracking also means that particles injected
through patches now start their simulation topologically connected to
the face on which they are created. This means that they correctly
trigger cloud functions associated with that face and/or patch.

The injection models now also return barycentric coordinates directly,
rather than the global position of injected particles. For methods that
initially generate locations naturally in terms of barycentric
coordinates, this prevents unnecessary and potentially fragile
conversion from barycentric to Cartesian and back again. These are
typically the methods that "fill" some sort of space; e.g., patch or
cell-zone injections.
2022-12-13 14:32:24 +00:00
8208ca6cc7 functionObjects: Added patchCutLayerAverage
This function object writes graphs of patch face values, area-averaged in
planes perpendicular to a given direction. It adaptively grades the
distribution of graph points to match the resolution of the mesh.

Example of function object specification:

    patchCutLayerAverage1
    {
        type            patchCutLayerAverage;
        libs            ("libpatchCutLayerAverageFunctionObject.so");

        writeControl    writeTime;
        writeInterval   1;

        patch           lowerWall;
        direction       (1 0 0);
        nPoints         100;
        interpolate     no;

        fields          (p U);

        axis            x;
        setFormat       raw;
    }

A packaged function object is also included, which permits the following
syntax to be used, either with #includeFunc in the system/controlDict,
or with the -func option to foamPostProcess:

    graphPatchCutLayerAverage
    (
        funcName=aerofoilLowerPressure,
        patch=aerofoilLower,
        direction=(0.15 -0.016 0),
        nPoints=100,
        p
    )
2022-12-06 13:00:56 +00:00
73c5624acf functionObjects/field: Simplified code using the VolField and SurfaceField partial specialisations
replacing the inconsistently named local typedefs and direct use of the more
complex GeometricField template types.
2022-12-01 22:01:54 +00:00
3e8b97fef6 functionObjects: fieldAverage: Corrected initialisation behaviour
The fieldAverage can now average fields that do not exist at
construction time, and it also supports restart on cases in which
the mesh topology is changing.
2022-12-01 09:28:19 +00:00
ed7e703040 Time::timeName(): no longer needed, calls replaced by name()
The timeName() function simply returns the dimensionedScalar::name() which holds
the user-time name of the current time and now that timeName() is no longer
virtual the dimensionedScalar::name() can be called directly.  The timeName()
function implementation is maintained for backward-compatibility.
2022-11-30 15:53:51 +00:00
7286789b40 functionObjects::fieldAverage: Corrected restart when running with user-time 2022-11-30 11:46:34 +00:00
303c016704 functionObjects::timeActivatedFileUpdate: Changed file read time specification to user-time
Also changed the keyword timeVsFile to the more logical fileVsTime with
backward-compatibility.

Class
    Foam::functionObjects::timeActivatedFileUpdate

Description
    Performs a file copy/replacement once a specified time has been reached.

Usage
    Example usage to update the fvSolution dictionary at 0.1, 0.2 and 0.3s
    during the run:
    \verbatim
    fileUpdate1
    {
        type            timeActivatedFileUpdate;

        libs            ("libutilityFunctionObjects.so");

        writeControl    timeStep;
        writeInterval   1;
        fileToUpdate    "$FOAM_CASE/system/fvSolution";
        fileVsTime
        (
            (-1 "$FOAM_CASE/system/fvSolution.0")
            (0.10 "$FOAM_CASE/system/fvSolution.10")
            (0.20 "$FOAM_CASE/system/fvSolution.20")
            (0.35 "$FOAM_CASE/system/fvSolution.35")
        );
    }
    \endverbatim

Resolves bug-report https://bugs.openfoam.org/view.php?id=3938
2022-11-29 14:33:31 +00:00
052a4803f0 regionModels: Refactored to remove the now redundant regionModel base class 2022-11-23 14:23:12 +00:00
366e38d34a compressibleVoF: Consolidated library functionality 2022-11-16 20:54:40 +00:00
ee4f05411d functionObjects::fieldAverage: Print warning if used with foamPostProcess
Field averaging can only be performed during the run as the averaging is
performed every time-step.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3922
2022-11-03 15:54:50 +00:00
65b7f62857 fieldAverage: Made restart work with mesh topology change and NCC 2022-11-01 10:42:14 +00:00
0661fbb433 basicThermo, heThermo: Simplified by removing alphahe
Now that kappa, Cp and Cv fields are cached and Cpv returns either the Cp or Cv
field reference depending on the energy solved and thermal transport is now
fundamentally based on temperature rather energy gradients it is no longer
necessary or useful to provide an abstract function returning alphahe.
2022-10-30 06:29:06 +00:00
4bd90bc969 rhoThermo: Renamed thermo:rho -> rho
The thermodynamic density field is now named "rho" by default and only renamed
"thermo:rho" by solvers that create and maintain a separate continuity density
field which is named "rho".  This change significantly simplifies and
standardises the specification of schemes and boundary conditions requiring
density as it is now always named "rho" or "rho.<phase>" unless under some very
unusual circumstances the thermodynamic rather than continuity density is
required for a solver maintaining both.

The advantage of this change is particularly noticeable for multiphase
simulations in which each phase has its own density now named "rho.<phase>"
rather than "thermo:rho.<phase>" as separate phase continuity density fields are
not required so for multiphaseEulerFoam the scheme specification:

    "div\(alphaRhoPhi.*,\(p\|thermo:rho.*\)\)" Gauss limitedLinear 1;

is now written:

    "div\(alphaRhoPhi.*,\(p\|rho.*\)\)" Gauss limitedLinear 1;
2022-10-28 02:19:13 +01:00
5af5413542 thermophysicalTransportModel: New abstract base-class for all thermophysical transport
the new fluidThermophysicalTransportModel and solidThermophysicalTransportModel
are derived from thermophysicalTransportModel providing a consistent and unified
interface for heat transport within and between regions.  Coupled and external
heat-transfer boundary conditions can now be written independent of the
thermophysical properties or transport modelling of the regions providing
greater flexibility, simpler code and reduces the maintenance overhead.
2022-10-23 04:13:52 +01:00
3521ab03a2 ThermophysicalTransportModels: Reorganisation to support a new abstract base-class fluidThermophysicalTransportModel
The previous fluidThermophysicalTransportModel typedef has been renamed
fluidThermoThermophysicalTransportModel as it is instantiated on fluidThermo,
freeing the name fluidThermophysicalTransportModel for the new base-class.
2022-10-21 19:45:26 +01:00
cdaaa61987 solidThermophysicalTransportModel: new thermophysical transport model for solids
to handle isotropic and anisotropic is a consistent, general and extensible
manner, replacing the horrible hacks which were in solidThermo.

This is entirely consistent with thermophysicalTransportModel for fluids and
provides the q() and divq() for the solid energy conservation equations.  The
transport model and properties are specified in the optional
thermophysicalTransport dictionary, the default model being isotropic if this
dictionary file is not present, thus providing complete backward-compatibility
for the common isotropic cases.

Anisotropic thermal conductivity is now handled in a much more general manner by
the anisotropic model:

Class
    Foam::solidThermophysicalTransportModels::anisotropic

Description
    Solid thermophysical transport model for anisotropic thermal conductivity

    The anisotropic thermal conductivity field is evaluated from the solid
    material anisotropic kappa specified in the physicalProperties dictionary
    transformed into the global coordinate system using default
    coordinate system and optionally additional coordinate systems specified
    per-zone in the thermophysicalProperties dictionary.

Usage
    Example of the anisotropic thermal conductivity specification in
    thermophysicalProperties with two zone-based coordinate systems in
    addition to the default:

    \verbatim
    model anisotropic;

    // Default coordinate system
    coordinateSystem
    {
        type        cartesian;
        origin      (0 0 0);
        coordinateRotation
        {
            type        cylindrical;
            e3          (1 0 0);
        }
    }

    // Optional zone coordinate systems
    zones
    {
        coil1
        {
            type        cartesian;
            origin      (0.1 0.2 0.7);
            coordinateRotation
            {
                type        cylindrical;
                e3          (0.5 0.866 0);
            }
        }

        coil2
        {
            type        cartesian;
            origin      (0.4 0.5 1);
            coordinateRotation
            {
                type        cylindrical;
                e3          (0.866 0.5 0);
            }
        }
    }
    \endverbatim

This development required substantial rationalisation of solidThermo,
coordinateSystems and updates to the solid solver module, solidDisplacementFoam,
the wallHeatFlux functionObject, thermalBaffle and all coupled thermal boundary
conditions.
2022-10-19 16:45:00 +01:00
3bde146b47 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2022-10-13 12:13:48 +01:00
2972d16653 setTimeStepFunctionObject, setWriteIntervalFunctionObject: Convert from user-time to real-time
so that the specification of time-step and write-interval are in user-time,
consistent with the controlDict.

Class
    Foam::functionObjects::setTimeStepFunctionObject

Description
    Updates the time step as a Function1 of time.

    If the case is running with userTime specified in controlDict then the
    time-step values returned by the Function1 are assumed to be in user-time
    rather than real-time.

Class
    Foam::functionObjects::setWriteIntervalFunctionObject

Description
    Updates the writeInterval as a Function1 of time.

    If the case is running with userTime specified in controlDict then the write
    interval values returned by the Function1 are assumed to be in user-time
    rather than real-time.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3904
2022-10-13 12:11:09 +01:00
5b11f5a833 functionObjects: Standardised file paths for functions applied to regions
Function objects now write to the following path when applied to a
non-default region of a multi-region case:

    postProcessing/<regionName>/<functionName>/<time>/

Previously the order of <regionName> and <functionName> was not
consistent between the various function objects.

Resolves bug report https://bugs.openfoam.org/view.php?id=3907
2022-10-13 11:28:26 +01:00
03b17d695b writeObjectsBase: Added static Switch logFalse for default initialisation of log
avoiding erroneously setting the log Switch reference to false when logging is
not required.
2022-10-09 22:07:55 +01:00
f4ac5f8748 AMIInterpolation, cyclicAMI: Removed
AMIInterpolation and cyclicAMI have been superseded by patchToPatch and
nonConformalCoupled, respectively.

The motivation behind this change is explained in the following article:

    https://cfd.direct/openfoam/free-software/non-conformal-coupling/

Information about how to convert a case which uses cyclicAMI to
nonConformalCoupled can be found here:

    https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
2022-09-22 10:05:41 +01:00
4c223b8aee particle: Removed polyMesh reference
This reference represents unnecessary storage. The mesh can be obtained
from tracking data or passed to the particle evolution functions by
argument.

In addition, removing the mesh reference makes it possible to construct
as particle from an Istream without the need for an iNew class. This
simplifies stream-based transfer, and makes it possible for particles to
be communicated by a polyDistributionMap.
2022-09-21 16:31:40 +01:00