Commit Graph

6956 Commits

Author SHA1 Message Date
6d548ad819 tutorials/multiRegion/film/cylinder: Corrected lagrangian flow rates 2023-06-29 16:34:04 +01:00
a8a1eeec0c tutorials/fluid/iglooWithFridges: Ensure the energy equation solves 2023-06-29 14:53:44 +01:00
9d66e38007 tutorials/fluid/hotRoomComfort: Ensure the energy equations solves 2023-06-29 13:55:23 +01:00
5f0a643e71 tutorials/multicomponentFluid/counterFlowFlame2D: Clean 0/Qdot field 2023-06-29 11:27:29 +01:00
a7c7f55274 tutorials/incompressibleMultiphaseVoF/damBreak4phase: Prevent unnecessary modification of 0/U 2023-06-29 11:21:54 +01:00
5f93b16a51 tutorials/shockFluid/biconic25-55Run35: Removed unused scripting 2023-06-29 10:41:51 +01:00
a329b887e5 tutorials/isothermalFilm/rivuletPanel: Fix delta BC for paraFoam 2023-06-29 10:17:18 +01:00
1ae1091f36 fvMesh: Check the topoChanger is allocated in the topoChanging() function 2023-06-29 09:35:04 +01:00
16012dccda fvMesh: Registered Vc0 and Vc00 and added to geometryFields set
for consistency with the handling of Vc and simplifies mesh redistribution.
2023-06-28 15:05:09 +01:00
a8de66f32b CrankNicolsonDdtScheme: Evaluate the ramped off-centering coefficient from user-time
Resolves bug-report https://bugs.openfoam.org/view.php?id=3992
2023-06-28 14:19:50 +01:00
9f4f89ba98 fvMesh: Don't store old-time mesh fluxes if the topology is changing
Currently 2nd-order time schemes are not supported with mesh topology change and
so there is no need to store the old-time mesh fluxes.
2023-06-28 14:08:09 +01:00
c2f6ae08a3 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2023-06-28 11:55:49 +01:00
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
8611db460a functionEntries::calcEntry: Added support for #{...#} delimited verbatim string
Class
    Foam::functionEntries::calcEntry

Description
    Compiles and executes code string expressions,
    returning the result to the dictionary

Usage
    \verbatim
    a 1.1;
    b 3.2;
    c #calc "$a*$b";
    \endverbatim

    Special care is required for calc entries that include a division since
    "/" is also used as the scoping operator to identify keywords in
    sub-dictionaries. For example, "$a/b" expects a keyword "b" within a
    sub-dictionary named "a". A division can be correctly executed by using a
    space between a variables and "/", e.g.

    \verbatim
    c #calc "$a / $b";
    \endverbatim

    or bracketing the variable, e.g.

    \verbatim
    c #calc "($a)/$b";
    \endverbatim

    The code string can be delimited either by '"..."' in which newlines must be
    escaped or '#{...#}' which directly supports multi-line strings and is more
    convenient when evaluating string expressions by avoiding the need to
    escape the quotes, e.g.

    \verbatim
    c #calc #{ $a*sqrt($b) #};
    \endverbatim

    \verbatim
    s "field";
    fieldName #calc #{ $<string>s + "Name" #};
    \endverbatim

    Additional include files for the #calc code compilation can be specified
    using the #calcInclude entry, e.g. if functions from transform.H are used
    \verbatim
    angleOfAttack   5; // degs

    angle           #calc "-degToRad($angleOfAttack)";

    #calcInclude    "transform.H"
    liftDir         #calc "transform(Ry($angle), vector(0, 0, 1))";
    dragDir         #calc "transform(Ry($angle), vector(1, 0, 0))";
    \endverbatim

    Note:
        Internally this is just a wrapper around codeStream functionality - the
        #calc string is used to construct a dictionary for codeStream.

See also
    Foam::functionEntries::calcIncludeEntry
2023-06-28 10:58:57 +01:00
9fb9a8cc8c lagrangian: Merged parcel and parcelTurbulence libraries
Lagrangian's dependency set is simpler than it used to be. There is no
longer a need to maintain a separate library for models that depend on
the momentum transport modelling.
2023-06-27 15:44:54 +01:00
24085443bf BirdCarreau: added header example that uses the k coefficient 2023-06-27 10:53:43 +01:00
b51bb27fde tutorials/multicomponentFluid/lockExchange: Updated physicalProperties 2023-06-26 13:24:41 +01:00
0de23df8bb functionEntries::calcIncludeEntry: New dictionary function entry to provide additional include files for #calc
Description
    Specify an include file for #calc, expects a single string to follow.

    For example if functions from transform.H are used in the #calc expression
    \verbatim
    angleOfAttack   5; // degs

    angle           #calc "-degToRad($angleOfAttack)";

    #calcInclude    "transform.H"
    liftDir         #calc "transform(Ry($angle), vector(0, 0, 1))";
    dragDir         #calc "transform(Ry($angle), vector(1, 0, 0))";
    \endverbatim

    The usual expansion of environment variables and other constructs
    (eg, the \c ~OpenFOAM/ expansion) is retained.

See also:

Class
    Foam::functionEntries::calcEntry

Description
    Uses dynamic compilation to provide calculating functionality
    for entering dictionary entries.

    E.g.

    \verbatim
    a 1.0;
    b 3;
    c #calc "$a*$b";
    \endverbatim

    Note the explicit trailing 0 ('1.0') to force a to be read (and written)
    as a floating point number.

    Special care is required for calc entries that include a division since
    "/" is also used as the scoping operator to identify keywords in
    sub-dictionaries. For example, "$a/b" expects a keyword "b" within a
    sub-dictionary named "a". A division can be correctly executed by using a
    space between a variables and "/", e.g.

    \verbatim
    c #calc "$a / $b";
    \endverbatim

    or "()" scoping around the variable, e.g.

    \verbatim
    c #calc "($a)/$b";
    \endverbatim

    Additional include files for the #calc code compilation can be specified
    using the #calcInclude entry, e.g. if functions from transform.H are used
    \verbatim
    angleOfAttack   5; // degs

    angle           #calc "-degToRad($angleOfAttack)";

    #calcInclude    "transform.H"
    liftDir         #calc "transform(Ry($angle), vector(0, 0, 1))";
    dragDir         #calc "transform(Ry($angle), vector(1, 0, 0))";
    \endverbatim

    Note:
        Internally this is just a wrapper around codeStream functionality - the
        #calc string is used to construct a dictionary for codeStream.
20230626
2023-06-24 16:56:59 +01:00
755eae4aa9 tutorials/fluid/aerofoilNACA0012Steady/0/U: Use $<scalar>angle instead of scoping cos and sin
to improve the handling of 0 angle of attack.
2023-06-23 17:12:05 +01:00
0657826ab9 Replaced all remaining addTimeOptions.H includes with the more flexible timeSelector 2023-06-23 15:24:06 +01:00
f3df607dde Test-string: Remove dictionary substitution test
The dictionary/table-based expansions provided by stringOps::expand are
now too situation specific for this utility to concisely test with a
single complex string. These expansions are fundamental to the operation
of dictionary and dynamic code and receive good testing coverage in the
tutorial test loop anyway.
2023-06-23 15:15:51 +01:00
e019049bef primitiveMesh,polyMesh: Further refactoring of mesh checking 2023-06-23 13:44:35 +01:00
d6c6e99201 bash_completion: improved handling of '-solver', '-table' and '-func' options 2023-06-23 13:09:03 +01:00
33eb61406b tutorials: Updates to #codeStream and #calc examples
Simplifications have been made where possible, as permitted by the new
$<type>var syntax. Duplication has been reduced in similar blockMesh
files (e.g., sloshingTank cases). Settings that cannot practically be
changed have been hard-coded (e.g., angle in the mixerVessel2D
blockMeshDict). The rotor2D blockMeshDict has been centralised and
extended to work with an arbitrary number of rotor blades.
2023-06-23 10:51:11 +01:00
24995dcbd4 tutorials: ballValve: Named vertices in blockMeshDict
This makes the block/edge/face configuration much more similar between
the four different sections of this mesh. It is also useful as it
permits sections to be decativated by commenting them out without
this affecting all the subsequent numbering.
2023-06-23 10:51:11 +01:00
afbe519f5c etc/caseDicts/postProcessing/mesh/checkMesh: Corrected description 2023-06-22 20:36:18 +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
6f38550879 Function1s::Table: slight improvement to integration with outOfBounds repeat 2023-06-22 15:28:27 +01:00
3d95d179ea Function1s::Table: Corrected integration with outOfBounds repeat
Resolves bug-report https://bugs.openfoam.org/view.php?id=3990
2023-06-22 15:05:20 +01:00
aad7408f5f distributions::unintegrable: Formatting 2023-06-22 14:55:27 +01:00
b2d4f25fff codeStream: Typed substitutions
Dictionary entries constructed with #calc and #codeStream can now
conveniently access and use typed variables. This means calculations
involving vectors and tensors and list and field types are now possible.

To access a variable and construct it as a given type within a #calc
or #codeStream entry, put the type immediately after the $ symbol inside
angled brackets <>. So, $<vector>var or $<vector>{var} substitutes a
variable named var as a vector.

Examples:

- Reflect a point in a plane defined by a normal

    p       (1 2 3);
    n       (1 1 0);
    pStar   #calc "$<vector>p - (2*sqr($<vector>n)/magSqr($<vector>n)&$<vector>p)";

- Rotate a list of points around an axis by a given angle

    points  ((3 0 0) (2 1 1) (1 2 2) (0 3 3));
    rotation
    {
        axis    (0 1 1);
        angle   45;
    }

    #codeStream
    {
        codeInclude
        #{
            #include "pointField.H"
            #include "transform.H"
        #};

        code
        #{
            const pointField points($<List<point>>points);
            const vector axis = $<vector>!rotation/axis;
            const scalar angle = degToRad($!rotation/angle);
            os << "pointsRotated" << nl << (Ra(axis, angle) & points)() << ";";
        #};
    };

- Compute the centre and trianglation of a polygon

   polygon  ((0 0 0) (1 0 0) (2 1 0) (0 2 0) (-1 1 0));

   #codeStream
   {
       codeInclude
       #{
           #include "polygonTriangulate.H"
       #};

       code
       #{
           const List<point> polygon($<List<point>>polygon);
           writeEntry(os, "polygonCentre", face::centre(polygon));

           polygonTriangulate triEngine;
           triEngine.triangulate(polygon);
           os << "polygonTris" << ' ' << triEngine.triPoints() << ";";
       #};
    };

- Generate a single block blockMeshDict for use with snappyHexMesh with no redundant information

    min         (-2.5 -1.2 -3.0);   // Minimum coordinates of the block
    max         (2.5 1.2 3.0);      // Maximum coordinates of the block
    nCellsByL   33.3333;            // Number of cells per unit length

    // Calculate the number of cells in each block direction
    nCells      #calc "Vector<label>($nCellsByL*($<vector>max - $<vector>min) + vector::one/2)";

    // Generate the vertices using a boundBox
    vertices    #codeStream
    {
        codeInclude
        #{
            #include "boundBox.H"
        #};

        code
        #{
            os << boundBox($<vector>min, $<vector>max).points();
        #};
    };

    blocks
    (
        hex (0 1 2 3 4 5 6 7) $nCells simpleGrading (1 1 1)
    );

    defaultPatch
    {
        type patch;
    }

    boundary
    ();
2023-06-22 12:53:21 +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
d028a9a4d3 bool: Add name function and read and write as "true" and "false" 2023-06-22 11:46:14 +01:00
c40f918c0d primitiveMesh,polyMesh: Initial refactoring of mesh checking 2023-06-21 19:10:39 +01:00
cead8bb02e cellsToCells::distributeMesh: Specifically handle processorPolyPatch, not processorCyclicPolyPatch 2023-06-21 15:31:19 +01:00
f49eb3011d applications/.*/decomposeParDict: Removed unused clutter 2023-06-21 15:11:19 +01:00
ba8297e7c3 fvMeshTopoChangersMeshToMesh: Remove redundant call to mesh().deltaCoeffs() 2023-06-21 14:58:27 +01:00
9de6683244 pTraits::read: Moved the read<Type>(Istream&) from read.H to pTraits.H
so that primitives can be read from Istream without the need to include
IStringStream.H
2023-06-21 12:44:55 +01:00
3ef7a23b32 pTraits::read: Added global templated read functions for pTraits
This allows primitive and other types either directly or indirectly
constructable from Istream to be constructed from a string using pTraits and
IStringStream, e.g.

    const vector v(read<vector>("(1 2 3)"));
2023-06-21 12:22:43 +01:00
0ba5ebb0cd UIndirectList: Use UList<label> rather than the labelUList typedef
to avoid dependency on another file.
2023-06-21 12:21:16 +01:00
d0b2fe89e5 applications/test/dictionary: Corrected formatting of example dictionary files 2023-06-21 12:20:38 +01:00
c9bb53e109 ISstream: Corrected parsing of variables 2023-06-20 19:14:47 +01:00
23b169553c tutorials: Removed unused mergePatchPairs entries from blockMeshDicts 2023-06-20 15:13:35 +01:00
3c7f34ff0d foamGenerateBashCompletion: Added -solvers to foamToC 2023-06-20 13:15:04 +01:00
3460364ef2 foamToC: Added -solvers option
which lists the solver modules:

Contents of table solver:
    XiFluid                                 libXiFluid.so
    compressibleMultiphaseVoF               libcompressibleMultiphaseVoF.so
    compressibleVoF                         libcompressibleVoF.so
    film                                    libfilm.so
    fluid                                   libfluid.so
    functions                               libfunctions.so
    incompressibleDenseParticleFluid        libincompressibleDenseParticleFluid.so
    incompressibleDriftFlux                 libincompressibleDriftFlux.so
    incompressibleFluid                     libincompressibleFluid.so
    incompressibleMultiphaseVoF             libincompressibleMultiphaseVoF.so
    incompressibleVoF                       libincompressibleVoF.so
    isothermalFilm                          libisothermalFilm.so
    isothermalFluid                         libisothermalFluid.so
    movingMesh                              libmovingMesh.so
    multicomponentFluid                     libmulticomponentFluid.so
    multiphaseEuler                         libmultiphaseEuler.so
    shockFluid                              libshockFluid.so
    solid                                   libsolid.so
    solidDisplacement                       libsolidDisplacement.so

This is equivalent to

    foamToC -table solver
2023-06-20 13:06:40 +01:00
71936d4425 processorCyclicFvPatchField: Corrected usage 2023-06-20 11:58:47 +01:00
708471da77 valueMulticomponentMixture: Corrected mixing of compresibility 2023-06-20 10:03:32 +01:00
2bb8cb9c9a tutorials/multicomponentFluid/membrane: Call foamRun rather than reactingFoam 2023-06-20 10:03:24 +01:00
de2b4457d6 distribtion: Prevent hidden overload warning with Clang 2023-06-20 09:28:31 +01:00
d1cb137266 dictionary: Convenient programmatic construction
Variadic constructors have been added to dictionary to facilitate
convenient construction in code, including within a #codeStream entry.
The constructors take an even number of arguments, alternating between
the key and the corresponding value. The values may, themselves, be
dictionaries constructed in the same way. This means that the code
directly maps to the resulting nested dictionary structure.

For example, the following code stream entry:

    #codeStream
    {
        code
        #{
            writeEntry
            (
                os,
                "dict",
                dictionary
                (
                    "s", 1,
                    "wl", wordList({"apples", "oranges"}),
                    "subDict", dictionary
                    (
                        "v", vector(2, 3, 4),
                        "t", tensor(5, 6, 7, 8, 9, 10, 11, 12, 13),
                        "ll", labelList(10, -1)
                    )
                )
            );
        #};
    }

Expands to the following:

    dict
    {
        s               1;
        wl              2 ( apples oranges );
        subDict
        {
            v               ( 2 3 4 );
            t               ( 5 6 7 8 9 10 11 12 13 );
            ll              10 { -1 };
        }
    }
2023-06-20 09:28:26 +01:00