fvOptions::SemiImplicitSource: Added support for Function1 specifications of the explicit and implicit sources

This significant improvement is flexibility of SemiImplicitSource required a
generalisation of the source specification syntax and all tutorials have been
updated accordingly.

Description
    Semi-implicit source, described using an input dictionary.  The injection
    rate coefficients are specified as pairs of Su-Sp coefficients, i.e.

        \f[
            S(x) = S_u + S_p x
        \f]

    where
    \vartable
        S(x)    | net source for field 'x'
        S_u     | explicit source contribution
        S_p     | linearised implicit contribution
    \endvartable

    Example tabulated heat source specification for internal energy:
    \verbatim
    volumeMode      absolute; // specific
    sources
    {
        e
        {
            explicit table ((0 0) (1.5 $power));
            implicit 0;
        }
    }
    \endverbatim

    Example coded heat source specification for enthalpy:
    \verbatim
    volumeMode      absolute; // specific
    sources
    {
        h
        {
            explicit
            {
                type coded;
                name heatInjection;
                code
                #{
                    // Power amplitude
                    const scalar powerAmplitude = 1000;

                    // x is the current time
                    return mag(powerAmplitude*sin(x));
                #};
            }
            implicit 0;
        }
    }
    \endverbatim
This commit is contained in:
Jakub Knir
2020-04-01 18:53:09 +01:00
parent c1587d5fc6
commit 95b5ef4458
15 changed files with 203 additions and 264 deletions

View File

@ -24,9 +24,14 @@ momentumSource
selectionMode all;
volumeMode specific;
injectionRateSuSp
sources
{
U ((5 0 0) 0);
U
{
explicit (5 0 0);
implicit 0;
}
}
}

View File

@ -50,9 +50,8 @@ IOdictionary fvOptions
)
);
const dictionary& gradPDict =
fvOptions.subDict("momentumSource").subDict("injectionRateSuSp");
const scalar K =
Tuple2<vector, scalar>(gradPDict.lookup("U")).first().x();
fvOptions.subDict("momentumSource").subDict("sources");
const scalar K(vector(gradPDict.subDict("U").lookup("explicit")).x());
dictionary probes(IFstream(runTime.system()/"probes")());
const point location = pointField(probes.lookup("probeLocations"))[0];

View File

@ -1,7 +1,7 @@
#!/bin/sh
tail -n +4 ../postProcessing/probes/0/U | \
tr -s " " | tr -d '(' | cut -d " " -f2-3 > ../Numerical.dat
tr -s " " | tr -d '(' | cut -d " " -f1-2 > ../Numerical.dat
if ! which gnuplot > /dev/null 2>&1
then
@ -24,4 +24,4 @@ gnuplot<<EOF
"../WatersKing.dat" with lines t "Analytical" lt -1
EOF
# ----------------------------------------------------------------- end-of-file
#------------------------------------------------------------------------------