Commit Graph

985 Commits

Author SHA1 Message Date
2caad45a9b functionObjects/setTimeStep: Compatibility with 'adjustableRunTime'
setTimeStep is now compatible with a 'writeControl adjustableRunTime;'
setting in the systemControlDict. If 'adjustableRunTime' is selected
then the time-step values set by this function object will not be
exactly as specified, but write intervals will be matched exactly.

All function object time adjustment is now done during the execute
methods, so the specific setTimeStep hooks have been removed.
2021-01-26 08:12:21 +00:00
3ca14ebe58 functionObjects: Fixes to restart and run-time modification behaviour
All function objects now re-read as a result of run-time modifications
to the system/controlDict.

Function objects that write log files (via the logFiles class) will now
generate a new postProcessing/<funcName>/<time> directory as a result of
either restart or run-time modification. Log files will therefore never
be overwritten by restart or run-time modification, except for when a
case is restarted at the same time as a previous execution (e.g.,
repeated runs at the start time).
2021-01-26 08:12:21 +00:00
c2f4c6191d interFoam: Added support for phase-change with cavitation models
The phase-change functionality in interPhaseChangeFoam has been generalised and
moved into the run-time selectable twoPhaseChange library included into
interFoam providing optional phase-change.  The three cavitation models provided
in interPhaseChangeFoam are now included in the twoPhaseChange library and the
two interPhaseChangeFoam cavitation tutorials updated for interFoam.

interPhaseChangeFoam has been replaced by a user redirection script which prints
the following message:

The interPhaseChangeFoam solver has solver has been replaced by the more general
interFoam solver, which now supports phase-change using the new twoPhaseChange
models library.

To run with with phase-change create a constant/phaseChangeProperties dictionary
containing the phase-change model specification, e.g.

    phaseChangeModel SchnerrSauer;

    pSat            2300;   // Saturation pressure

See the following cases for an example converted from interPhaseChangeFoam:

    $FOAM_TUTORIALS/multiphase/interFoam/laminar/cavitatingBullet
    $FOAM_TUTORIALS/multiphase/interFoam/RAS/propeller
2021-01-24 23:35:17 +00:00
1adc1806df functionObjects::logFiles: Removed the writing of additional '_0' or '_<time>' files on restart
Given that logFiles now writes the log files into postProcessing/<func
name>/<time> it is no longer useful to add '_<time>' to the log file name in the
case that the file already exists without this extension.
2021-01-21 12:06:46 +00:00
187f69de13 ListOps: Renumbering of nested lists 2021-01-19 13:40:27 +00:00
b5fd577934 ISstream::getLine: continuation lines are now optional 2021-01-14 12:33:15 +00:00
58ae03c9eb Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2021-01-14 10:53:54 +00:00
c6f69e7987 Function1/2: Updated the writing of Function1/2 entries within Function1/2s
Resolves bug-report https://bugs.openfoam.org/view.php?id=3613
2021-01-14 10:52:55 +00:00
f1086e51e5 Converting conditional lookups to new dictionary::*BackwardsCompatibility methods 2021-01-14 08:33:57 +00:00
6566e6659e dictionary: Added backwards compatability lookup methods
These allows for dictionary lookups which fall back to a different,
older keyword. Both lookup and lookup-or-default methods are provided;
lookupBackwardsCompatible and lookupOrDefaultBackwardsCompatible,
respectively.

A list of keywords are provided to these methods. The first is taken to
be the current preferred name of the entry, and subsequent elements are
considered to relate to older syntax. These keywords are tried in turn.
If nothing are found then any errors or messages printed relate to the
first keyword in the list.

This centralises backwards compatability logic and allows for current
backwards compatibility settings to be conveniently searched for.
2021-01-14 08:33:57 +00:00
8182a0cff6 ThermophysicalTransportModels::MaxwellStefanFourier: New multi-component thermophysical transport model for laminar flow
Description
    Multi-component Maxwell Stefan generalized Fick's law diffusion coefficients
    and Fourier based temperature gradient heat flux model with optional Soret
    thermal diffusion of species for laminar flow.

    The binary diffusion coefficients are specified as Function2<scalar>s of
    pressure and temperature but independent of composition.

    The heat flux source is implemented as an implicit energy correction to the
    temperature gradient based flux source.  At convergence the energy
    correction is 0.

    References:
    \verbatim
        Taylor, R., & Krishna, R. (1993).
        Multicomponent mass transfer (Vol. 2).
        John Wiley & Sons.

        Merk, H. J. (1959).
        The macroscopic equations for simultaneous heat and mass transfer
        in isotropic, continuous and closed systems.
        Applied Scientific Research,
        Section A, 8(1), 73-99.
    \endverbatim

Usage
    \verbatim
    laminar
    {
        model           MaxwellStefanFourier;

        D // [m^2/s]
        {
            O2_O2 1e-2;
            O3_O3 5e-2;
            N2_N2 1e-2;
            O3_O2 5e-2;
            O3_N2 5e-2;
            O2_N2 1e-2;

            O2 1e-2;
            O3 5e-2;
            N2 1e-2;
        }

        DT // [kg/m/s] Optional
        {
            O2 1e-2;
            O3 5e-2;
            N2 1e-2;
        }
    }
    \endverbatim
2021-01-12 17:57:17 +00:00
12afa0966a Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2021-01-08 13:19:26 +00:00
0b21dbf1ec functionObject: Updated documentation
Resolves report https://bugs.openfoam.org/view.php?id=3609
2021-01-08 13:18:02 +00:00
dd3b495fdc objectFunction1: Prevent multiple definitions of the destructor 2021-01-07 09:14:07 +00:00
03da1891a7 coupledPolyPatch: Fix to walk ordering
Very occasionally a coupled patch contains two faces that are connected
by an edge, but which are numbered in opposite directions. Such faces
are not actually connected in a manifold sense. They just happen to
share two points. The edge in question should really be duplicated and
both should be considered to be part of the perimeter of the surface.

Walk patch ordering has been fixed so that it does not attempt to cross
edges such as these. This fixes a rare failure in snappyHexMesh.
2021-01-06 11:32:54 +00:00
c1ebcc1a78 Updating conditional statements in Make/files to use environment variables and ifeq and ifneq 2020-12-31 17:38:09 +00:00
6fe12e7361 NonUniformTable1: Added support for reading table values from separate file in FOAM or CSV format 2020-12-21 12:10:41 +00:00
cca0073619 UniformTable2: Simplified constructor 2020-12-21 12:10:20 +00:00
251c4b68d9 Table: Renamed table_ -> values_ for consistency with the other table forms 2020-12-21 12:09:10 +00:00
7652fe14fa Pair: Updated IO to ASCII only, consistent with Tuple2 2020-12-21 12:08:22 +00:00
17796ffa17 Tuple2: Added hash 2020-12-21 12:08:01 +00:00
aaf054c8fd Function1s::NonUniformTable, UniformTable: Templated on Type
Function1s::NonUniformTable,UniformTable can now be used for any primitive type
used for fields.
2020-12-18 18:40:20 +00:00
908f03b522 Function2::UniformTable: Templated on Type
Function2::UniformTable can now be used for any primitive type used for fields.
2020-12-18 16:06:30 +00:00
bae95b1291 functionObjects::setTimeStepFunctionObject: New functionObject which updates the writeInterval as a Function1 of time
Description
    Updates the writeInterval as a Function1 of time.

    Examples of function object specification:
    \verbatim
    setWriteInterval
    {
        type setWriteInterval;
        libs ("libutilityFunctionObjects.so");

        writeInterval table
        (
            (0      0.005)
            (0.1    0.005)
            (0.1001 0.01)
            (0.2    0.01)
            (0.2001 0.02)
        );
    }
    \endverbatim
    will cause results to be written every 0.005s between 0 and 0.1s, every
    0.01s between 0.1 and 0.2s and every 0.02s thereafter.
2020-12-18 11:24:23 +00:00
e27f719aed Time: Removed temporary diagnostics 2020-12-16 10:13:37 +00:00
f5b0a27241 includeFunc: Added 'funcName' option to set the name of the functionObject entry in the functions list
This is used to set the directory name for the results of the functionObject, if
not specified a unique name is generated automatically from the function type
and argument list, e.g.

    #includeFunc patchAverage(name=inlet, fields=(p U))

writes surfaceFieldValue.dat in postProcessing/patchAverage(name=inlet,fields=(pU))/0 and

    #includeFunc patchAverage(funcName=inlet, name=inlet, fields=(p U))

writes surfaceFieldValue.dat in postProcessing/inlet/0.
2020-12-11 17:10:46 +00:00
b594bcb753 Time: Set writeTimeIndex_ to correspond to beginTime_ for restarted cases 2020-12-11 17:09:09 +00:00
7aca9bfa78 Time: Added beginTime used to rationalise the write times when restarting
Now if a case is restarted from an arbitrary time, for example one generated at
a premature stop condition, or with an increased writeInterval, the subsequent
time directories written are referenced to the original start time of the case
rather than the restart time.
2020-12-11 13:37:16 +00:00
25e5031d2e dynamicCode: Updated the comments generated in Make/files and Make/options 2020-12-10 11:11:19 +00:00
848ec1cd97 wmake: Simplified and standardised the Make/files files
cpp is no longer used to pre-process Make/files files allowing standard make '#'
syntax for comments, 'ifdef', 'ifndef' conditionals etc.  This is make possible
by automatically pre-pending SOURCE += to each of the source file names in
Make/files.

The list of source files compile can be specified either as a simple list of
files in Make/files e.g.

    # Note: fileMonitor assumes inotify by default. Compile with -DFOAM_USE_STAT
    # to use stat (=timestamps) instead of inotify
    fileMonitor.C

    ifdef SunOS64
        dummyPrintStack.C
    else
        printStack.C
    endif

    LIB = $(FOAM_LIBBIN)/libOSspecific

or

or directly as the SOURCE entry which is used in the Makefile:

    SOURCE = \
        adjointOutletPressure/adjointOutletPressureFvPatchScalarField.C \
        adjointOutletVelocity/adjointOutletVelocityFvPatchVectorField.C \
        adjointShapeOptimizationFoam.C

    EXE = $(FOAM_APPBIN)/adjointShapeOptimizationFoam

In either form make syntax for comments and conditionals is supported.
2020-12-10 08:09:49 +00:00
25926b505d Function2::None: New Function2 which generates an error when 'value' is called
Used for undefined but unused functions, providing run-time checking.
2020-12-09 16:14:49 +00:00
59d9ce6a05 Function1::None: Minor consistency corrections 2020-12-09 15:52:56 +00:00
a0fc5c1f55 thermophysicalModels::liquid: Reinstated support for undefined functions which are not used
Uses the new None Function1 which throws an error when either the 'value' or
'integral' functions are called.
2020-12-09 15:41:43 +00:00
90497c9ce7 Function1::PolynomialEntry: Renamed Polynomial1 2020-12-07 10:35:07 +00:00
2732b8b50a demandDrivenEntry: Moved to src/lagrangian/basic 2020-12-07 10:20:31 +00:00
0c79b63f2e thermophysicalFunctions: Merged into Function1 and Function2
All thermophysicalFunctions, NSRDS, API and the fast uniform and non-uniform
tables have now been converted into the corresponding Function1<scalar> and
Function2<scalar> so that they can be used in other contexts, e.g. diffusion
coefficients for multi-component diffusion and in conjunction with other
Function1 and Function2s.  This also enables 'coded' Function1 and Function2 to
be used for thermo-physical properties.

Now all run-time selectable functions are within a single general framework
improving usability and simplifying maintenance.
2020-12-04 18:46:05 +00:00
a806e1bc6b thermophysicalFunction: Initial work to convert into Function1 and Function2 2020-12-03 19:22:50 +00:00
57b1655934 Function1: Renamed integrate -> integral for consistency with value
The integral function returns the integral as the value function returns the
value.
2020-12-02 16:15:55 +00:00
f85dbc557f polyBoundaryMesh: Update indices in neighbour patches on reorder 2020-12-02 11:01:55 +00:00
19b3a5c385 Sub-models, fvOptions: Removed 'active' switch
It is better to not select and instantiate a model, fvOption etc. than to create
it and set it inactive as the creation process requires reading of settings,
parameters, fields etc. with all the associated specification and storage
without being used.  Also the incomplete implementation added a lot of
complexity in the low-level operation of models introducing a significant
maintenance overhead and development overhead for new models.
2020-12-01 18:50:20 +00:00
3838df8eac surfaceFilmModels: Rationalised and standardised the surfaceFilmProperties dictionary
The convoluted separate ".*Coeffs" dictionary form of model coefficient
specification is now deprecated and replaced with the simpler sub-dictionary
form but support is provided for the deprecated form for backward comparability.

e.g.

thermophysicalProperties
{
    type        liquid;

    useReferenceValues  no;
    liquid      H2O;
}

rather than

    filmThermoModel liquid;

    liquidCoeffs
    {
        useReferenceValues no;
        liquid      H2O;
    }

and

forces
{
    thermocapillary;

    distributionContactAngle
    {
        Ccf             0.085;

        distribution
        {
            type            normal;
            normalDistribution
            {
                minValue        50;
                maxValue        100;
                expectation     75;
                variance        100;
            }
        }

        zeroForcePatches ();
    }
}

rather than

    forces
    (
        thermocapillary
        distributionContactAngle
    );

    distributionContactAngleCoeffs
    {
        Ccf             0.085;

        distribution
        {
            type            normal;
            normalDistribution
            {
                minValue        50;
                maxValue        100;
                expectation     75;
                variance        100;
            }
        }

        zeroForcePatches ();
    }

All the tutorial cases containing a surface film have been updated for guidance,
e.g. tutorials/lagrangian/buoyantReactingParticleFoam/hotBoxes/constant/surfaceFilmProperties

surfaceFilmModel thermoSingleLayer;

regionName      wallFilmRegion;

active          true;

thermophysicalProperties
{
    type        liquid;

    useReferenceValues  no;
    liquid      H2O;
}

viscosity
{
    model        liquid;
}

deltaWet    1e-4;
hydrophilic no;

momentumTransport
{
    model       laminar;
    Cf          0.005;
}

forces
{
    thermocapillary;

    distributionContactAngle
    {
        Ccf             0.085;

        distribution
        {
            type            normal;
            normalDistribution
            {
                minValue        50;
                maxValue        100;
                expectation     75;
                variance        100;
            }
        }

        zeroForcePatches ();
    }
}

injection
{
    curvatureSeparation
    {
        definedPatchRadii
        (
            ("(cube[0-9][0-9]_side[0-9]_to_cube[0-9][0-9]_side[0-9])" 0)
        );
    }

    drippingInjection
    {
        cloudName    reactingCloud1;
        deltaStable  0;

        particlesPerParcel 100.0;

        parcelDistribution
        {
            type         RosinRammler;
            RosinRammlerDistribution
            {
                minValue        5e-04;
                maxValue        0.0012;
                d               7.5e-05;
                n               0.5;
            }
        }
    }
}

phaseChange
{
    model           standardPhaseChange;
    Tb              373;
    deltaMin        1e-8;
    L               1.0;
}

upperSurfaceModels
{
    heatTransfer
    {
        model       mappedConvectiveHeatTransfer;
    }
}

lowerSurfaceModels
{
    heatTransfer
    {
        model       constant;
        c0              50;
    }
}
2020-11-30 16:31:44 +00:00
21bb6c549d Function1, Function2: Rationalising, simplifying and standardising writing 2020-11-28 19:50:39 +00:00
0d42b151f0 ZoneMesh: Changed zone selection from keyType to wordRe
It is more logical to use wordRe rather than keyType for name-based selection
including regular expression support as keyType now support other forms of
dictionary keyword including function and variable names which are not
relevant for selecting zones by name.
2020-11-25 15:10:22 +00:00
528a04244f Function1::TableFileReader: Updated write 2020-11-23 15:55:11 +00:00
9f614634a4 dictionary: Ensure the #inputSyntax keyword is processed even if disableFunctionEntries is true 2020-11-17 19:49:44 +00:00
3a2b846a39 calcEntry: Changed '{}' to '()' as the suggested variable name scoping method 2020-11-17 15:43:59 +00:00
6b75c32d43 calcEntry: added header documentation relating to division operations 2020-11-17 15:18:35 +00:00
4e183e33d4 Function1::Table: simplified and rationalised
TableBase, TableFile and Table now combined into a single simpler Table class
which handle both the reading of embedded and file data using the generalised
TableReader.  The new EmbeddedTableReader handles the embedded data reading
providing the functionality of the original Table class within the same
structure that can read the data from separate files.

The input format defaults to 'embedded' unless the 'file' entry is present and
the Table class is added to the run-time selection table under the name 'table'
and 'tableFile' which provides complete backward comparability.  However it is
advisable to migrate cases to use the new 'table' entry and all tutorial cases
have been updated.
2020-11-16 23:48:47 +00:00
37ebdfe36e Function1::TableReader: Added EmbeddedTableReader so that TableFile can read embedded table data 2020-11-16 21:01:41 +00:00
ac3473d7b8 Function2Evaluate: Corrected function declarations
Resolves bug-report https://bugs.openfoam.org/view.php?id=3591
2020-11-13 22:53:32 +00:00