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

@ -35,10 +35,19 @@ fixedPower
power 100; // Set power (W)
injectionRateSuSp
sources
{
e ($power 0);
h ($power 0);
e
{
explicit $power;
implicit 0;
}
h
{
explicit $power;
implicit 0;
}
}
}

View File

@ -26,9 +26,13 @@ options
selectionMode all;
volumeMode specific;
injectionRateSuSp
sources
{
h (1e7 0); // W/m^3 == kg/m/s^3
h
{
explicit 1e7; // W/m^3 == kg/m/s^3
implicit 0;
}
}
}
}

View File

@ -27,9 +27,13 @@ options
cellSet ignition;
volumeMode specific;
injectionRateSuSp
sources
{
e (5e7 0); // kg/m/s^3
e
{
explicit 5e7; // kg/m/s^3
implicit 0;
}
}
}
}

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
#------------------------------------------------------------------------------

View File

@ -57,10 +57,26 @@ massSource1
);
volumeMode absolute;
injectionRateSuSp
sources
{
rho (1e-4 0); // kg/s
H2O (1e-4 0); // kg/s
rho
{
explicit 1e-4; // kg/s
implicit 0;
}
H2O
{
explicit 1e-4; // kg/s
implicit 0;
}
h
{
explicit 10;
implicit 0;
}
}
}
@ -78,29 +94,14 @@ momentumSource1
);
volumeMode absolute;
injectionRateSuSp
sources
{
U ((0 0.005 0) 0);
}
}
energySource1
{
type scalarSemiImplicitSource;
timeStart 0.2;
duration 2.0;
selectionMode points;
points
(
(2.75 0.5 0)
);
volumeMode absolute;
injectionRateSuSp
{
h (10 0);
U
{
explicit (0 0.005 0);
implicit 0;
}
}
}

View File

@ -35,9 +35,14 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
thermo:rho.water (1 0); // kg/s
thermo:rho.water
{
explicit 1; // kg/s
implicit 0;
}
}
}
}

View File

@ -35,9 +35,20 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
thermo:rho.air (1e-3 0); // kg/s
thermo:rho.air
{
explicit 1e-3; // kg/s
implicit 0;
}
e.air
{
explicit 500; // kg*m^2/s^3
implicit 0;
}
}
}
@ -48,22 +59,14 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
U.air ((0 -1e-2 0) 0); // kg*m/s^2
}
}
energySource1
{
type scalarSemiImplicitSource;
$injector1;
volumeMode absolute;
injectionRateSuSp
{
e.air (500 0); // kg*m^2/s^3
U.air
{
explicit (0 -1e-2 0); // kg*m/s^2
implicit 0; // kg*m/s^2
}
}
}
}

View File

@ -35,9 +35,20 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
thermo:rho.steam (1.0e-3 0); // kg/s
thermo:rho.steam
{
explicit 1.0e-3; // kg/s
implicit 0;
}
h.steam
{
explicit 3700; // kg*m^2/s^3
implicit 0;
}
}
}
@ -48,22 +59,14 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
U.steam ((0 1e-1 0) 0); // kg*m/s^2
}
}
energySource1
{
type scalarSemiImplicitSource;
$injector1;
volumeMode absolute;
injectionRateSuSp
{
h.steam (3700 0); // kg*m^2/s^3
U.steam
{
explicit (0 1e-1 0); // kg*m/s^2
implicit 0;
}
}
}

View File

@ -35,9 +35,20 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
thermo:rho.air (1e-3 0); // kg/s
thermo:rho.air
{
explicit 1e-3; // kg/s
implicit 0;
}
e.air
{
explicit 500; // kg*m^2/s^3
implicit 0;
}
}
}
@ -48,22 +59,14 @@ options
$injector1;
volumeMode absolute;
injectionRateSuSp
sources
{
U.air ((0 -1e-2 0) 0); // kg*m/s^2
}
}
energySource1
{
type scalarSemiImplicitSource;
$injector1;
volumeMode absolute;
injectionRateSuSp
{
e.air (500 0); // kg*m^2/s^3
U.air
{
explicit (0 -1e-2 0); // kg*m/s^2
implicit 0; // kg*m/s^2
}
}
}
}