unitConversion: Unit conversions on all input parameters
The majority of input parameters now support automatic unit conversion.
Units are specified within square brackets, either before or after the
value. Primitive parameters (e.g., scalars, vectors, tensors, ...),
dimensioned types, fields, Function1-s and Function2-s all support unit
conversion in this way.
Unit conversion occurs on input only. OpenFOAM writes out all fields and
parameters in standard units. It is recommended to use '.orig' files in
the 0 directory to preserve user-readable input if those files are being
modified by pre-processing applications (e.g., setFields).
For example, to specify a volumetric flow rate inlet boundary in litres
per second [l/s], rather than metres-cubed per second [m^3/s], in 0/U:
boundaryField
{
inlet
{
type flowRateInletVelocity;
volumetricFlowRate 0.1 [l/s];
value $internalField;
}
...
}
Or, to specify the pressure field in bar, in 0/p:
internalField uniform 1 [bar];
Or, to convert the parameters of an Arrhenius reaction rate from a
cm-mol-kcal unit system, in constant/chemistryProperties:
reactions
{
methaneReaction
{
type irreversibleArrhenius;
reaction "CH4^0.2 + 2O2^1.3 = CO2 + 2H2O";
A 6.7e12 [(mol/cm^3)^-0.5/s];
beta 0;
Ea 48.4 [kcal/mol];
}
}
Or, to define a time-varying outlet pressure using a CSV file in which
the pressure column is in mega-pascals [MPa], in 0/p:
boundaryField
{
outlet
{
type uniformFixedValue;
value
{
type table;
format csv;
nHeaderLine 1;
units ([s] [MPa]); // <-- new units entry
columns (0 1);
mergeSeparators no;
file "data/pressure.csv";
outOfBounds clamp;
interpolationScheme linear;
}
}
...
}
(Note also that a new 'columns' entry replaces the old 'refColumn' and
'componentColumns'. This is is considered to be more intuitive, and has
a consistent syntax with the new 'units' entry. 'columns' and
'componentColumns' have been retained for backwards compatibility and
will continue to work for the time being.)
Unit definitions can be added in the global or case controlDict files.
See UnitConversions in $WM_PROJECT_DIR/etc/controlDict for examples.
Currently available units include:
Standard: kg m s K kmol A Cd
Derived: Hz N Pa J W g um mm cm km l ml us ms min hr mol
rpm bar atm kPa MPa cal kcal cSt cP % rad rot deg
A user-time unit is also provided if user-time is in operation. This
allows it to be specified locally whether a parameter relates to
real-time or to user-time. For example, to define a mass source that
ramps up from a given engine-time (in crank-angle-degrees [CAD]) over a
duration in real-time, in constant/fvModels:
massSource1
{
type massSource;
points ((1 2 3));
massFlowRate
{
type scale;
scale linearRamp;
start 20 [CAD];
duration 50 [ms];
value 0.1 [g/s];
}
}
Specified units will be checked against the parameter's dimensions where
possible, and an error generated if they are not consistent. For the
dimensions to be available for this check, the code requires
modification, and work propagating this change across OpenFOAM is
ongoing. Unit conversions are still possible without these changes, but
the validity of such conversions will not be checked.
Units are no longer permitted in 'dimensions' entries in field files.
These 'dimensions' entries can now, instead, take the names of
dimensions. The names of the available dimensions are:
Standard: mass length time temperature
moles current luminousIntensity
Derived: area volume rate velocity momentum acceleration density
force energy power pressure kinematicPressure
compressibility gasConstant specificHeatCapacity
kinematicViscosity dynamicViscosity thermalConductivity
volumetricFlux massFlux
So, for example, a 0/epsilon file might specify the dimensions as
follows:
dimensions [energy/mass/time];
And a 0/alphat file might have:
dimensions [thermalConductivity/specificHeatCapacity];
*** Development Notes ***
A unit conversion can construct trivially from a dimension set,
resulting in a "standard" unit with a conversion factor of one. This
means the functions which perform unit conversion on read can be
provided dimension sets or unit conversion objects interchangeably.
A basic `dict.lookup<vector>("Umean")` call will do unit conversion, but
it does not know the parameter's dimensions, so it cannot check the
validity of the supplied units. A corresponding lookup function has been
added in which the dimensions or units can be provided; in this case the
corresponding call would be `dict.lookup<vector>("Umean", dimVelocity)`.
This function enables additional checking and should be used wherever
possible.
Function1-s and Function2-s have had their constructors and selectors
changed so that dimensions/units must be specified by calling code. In
the case of Function1, two unit arguments must be given; one for the
x-axis and one for the value-axis. For Function2-s, three must be
provided.
In some cases, it is desirable (or at least established practice), that
a given non-standard unit be used in the absence of specific
user-defined units. Commonly this includes reading angles in degrees
(rather than radians) and reading times in user-time (rather than
real-time). The primitive lookup functions and Function1 and Function2
selectors both support specifying a non-standard default unit. For
example, `theta_ = dict.lookup<scalar>("theta", unitDegrees)` will read
an angle in degrees by default. If this is done within a model which
also supports writing then the write call must be modified accordingly
so that the data is also written out in degrees. Overloads of writeEntry
have been created for this purpose. In this case, the angle theta should
be written out with `writeEntry(os, "theta", unitDegrees, theta_)`.
Function1-s and Function2-s behave similarly, but with greater numbers
of dimensions/units arguments as before.
The non-standard user-time unit can be accessed by a `userUnits()`
method that has been added to Time. Use of this user-time unit in the
construction of Function1-s should prevent the need for explicit
user-time conversion in boundary conditions and sub-models and similar.
Some models might contain non-typed stream-based lookups of the form
`dict.lookup("p0") >> p0_` (e.g., in a re-read method), or
`Umean_(dict.lookup("Umean"))` (e.g., in an initialiser list). These
calls cannot facilitate unit conversion and are therefore discouraged.
They should be replaced with
`p0_ = dict.lookup<scalar>("p0", dimPressure)` and
`Umean_(dict.lookup<vector>("Umean", dimVelocity))` and similar whenever
they are found.
This commit is contained in:
@ -16,27 +16,21 @@ FoamFile
|
||||
|
||||
setDeltaT
|
||||
{
|
||||
type coded;
|
||||
|
||||
// Load the library containing the 'coded' functionObject
|
||||
libs ("libutilityFunctionObjects.so");
|
||||
|
||||
codeInclude
|
||||
#{
|
||||
#include "volFields.H"
|
||||
#};
|
||||
type setTimeStep;
|
||||
|
||||
codeExecute
|
||||
#{
|
||||
const Time& runTime = mesh().time();
|
||||
if (runTime.userTimeValue() >= -15.0)
|
||||
{
|
||||
const_cast<Time&>(runTime).setDeltaT
|
||||
(
|
||||
runTime.userTimeToTime(0.025)
|
||||
);
|
||||
}
|
||||
#};
|
||||
deltaT
|
||||
{
|
||||
type table;
|
||||
values
|
||||
(
|
||||
(-180 0.25)
|
||||
(-15 0.025)
|
||||
);
|
||||
interpolationScheme step;
|
||||
outOfBounds clamp;
|
||||
}
|
||||
}
|
||||
|
||||
#includeFunc multiValveEngineState
|
||||
|
||||
@ -16,7 +16,7 @@ FoamFile
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
|
||||
internalField uniform 1e5;
|
||||
internalField uniform 1 [bar];
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -27,16 +27,15 @@ boundaryField
|
||||
type uniformTotalPressure;
|
||||
p0
|
||||
{
|
||||
type tableFile;
|
||||
format csv;
|
||||
file "constant/expData/pInlet";
|
||||
nHeaderLine 2; // Number of header lines
|
||||
refColumn 0; // Reference column index
|
||||
separator " "; // Optional (defaults to ",")
|
||||
componentColumns (1); // Component column indices
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
// For multi-cycle simulations, use repeat
|
||||
outOfBounds repeat;
|
||||
type table;
|
||||
format csv;
|
||||
file "constant/expData/pInlet";
|
||||
nHeaderLine 2; // Number of header lines
|
||||
units ([CAD] [bar]);
|
||||
columns (0 1); // Column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds repeat; // For multi-cycle simulations, use repeat
|
||||
interpolationScheme linear;
|
||||
}
|
||||
value $internalField;
|
||||
@ -48,19 +47,21 @@ boundaryField
|
||||
outlet
|
||||
{
|
||||
type uniformTotalPressure;
|
||||
p0 table
|
||||
(
|
||||
(0 1.0e5)
|
||||
(100 1.0e5)
|
||||
(240 1.7e5)
|
||||
(380 1.0e5)
|
||||
(720 1.0e5)
|
||||
);
|
||||
|
||||
// For multi-cycle simulations, use repeat
|
||||
outOfBounds repeat;
|
||||
interpolationScheme linear;
|
||||
|
||||
p0
|
||||
{
|
||||
type table;
|
||||
units ([CAD] [bar]);
|
||||
values
|
||||
(
|
||||
(0 1.0)
|
||||
(100 1.0)
|
||||
(240 1.7)
|
||||
(380 1.0)
|
||||
(720 1.0)
|
||||
);
|
||||
outOfBounds repeat; // For multi-cycle simulations, use repeat
|
||||
interpolationScheme linear;
|
||||
}
|
||||
value $internalField;
|
||||
psi psi;
|
||||
rho rho;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Intake pressure profile
|
||||
#CAD Pa
|
||||
0 1.0e5
|
||||
340 1.5e5
|
||||
480 1.6e5
|
||||
620 1.5e5
|
||||
720 1.0e5
|
||||
#CAD bar
|
||||
0 1.0
|
||||
340 1.5
|
||||
480 1.6
|
||||
620 1.5
|
||||
720 1.0
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 0 0 1 0 0 0];
|
||||
dimensions [temperature];
|
||||
|
||||
internalField uniform 300;
|
||||
|
||||
@ -23,14 +23,14 @@ boundaryField
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 300;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
inletValue uniform 300;
|
||||
value uniform 300;
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
symmetry
|
||||
@ -41,13 +41,13 @@ boundaryField
|
||||
wall
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 300;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
plenum
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 300;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 1 -1 0 0 0 0];
|
||||
dimensions [velocity];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
@ -23,15 +23,15 @@ boundaryField
|
||||
inlet
|
||||
{
|
||||
type flowRateInletVelocity;
|
||||
massFlowRate 0.0001;
|
||||
value uniform (0 0 0);
|
||||
massFlowRate 0.1 [g/s];
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type pressureInletOutletVelocity;
|
||||
inletValue uniform (0 0 0);
|
||||
value uniform (0 0 0);
|
||||
inletValue $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
symmetry
|
||||
@ -42,13 +42,13 @@ boundaryField
|
||||
wall
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform (0 0 0);
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
plenum
|
||||
{
|
||||
type pressureInletVelocity;
|
||||
value uniform (0 0 0);
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,9 +14,9 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
dimensions [pressure];
|
||||
|
||||
internalField uniform 1e5;
|
||||
internalField uniform 1 [bar];
|
||||
|
||||
boundaryField
|
||||
{
|
||||
@ -28,8 +28,8 @@ boundaryField
|
||||
outlet
|
||||
{
|
||||
type fixedMean;
|
||||
meanValue constant 1e5;
|
||||
value uniform 1e5;
|
||||
meanValue constant 1 [bar];
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
symmetry
|
||||
@ -47,15 +47,15 @@ boundaryField
|
||||
type plenumPressure;
|
||||
gamma 1.4;
|
||||
R 287.04;
|
||||
supplyMassFlowRate 0.0001;
|
||||
supplyMassFlowRate 0.1 [g/s];
|
||||
supplyTotalTemperature 300;
|
||||
plenumVolume 0.000125;
|
||||
plenumVolume 0.125 [l];
|
||||
plenumDensity 1.1613;
|
||||
plenumTemperature 300;
|
||||
inletAreaRatio 1.0;
|
||||
inletDischargeCoefficient 0.8;
|
||||
inletAreaRatio 100 [%];
|
||||
inletDischargeCoefficient 80 [%];
|
||||
timeScale 1e-4;
|
||||
value uniform 1e5;
|
||||
value $internalField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [m s^-1];
|
||||
dimensions [velocity];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [m^2 s^-3];
|
||||
dimensions [energy/mass/time];
|
||||
|
||||
internalField uniform 200;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [m^2 s^-2];
|
||||
dimensions [energy/mass];
|
||||
|
||||
internalField uniform 0.375;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [m^2 s^-1];
|
||||
dimensions [kinematicViscosity];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [m^2 s^-1];
|
||||
dimensions [kinematicViscosity];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [m^2 s^-2];
|
||||
dimensions [kinematicPressure];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -27,5 +27,4 @@ boundaryField
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,7 +42,6 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#include "argList.H"
|
||||
#include "viscosityModel.H"
|
||||
#include "incompressibleMomentumTransportModel.H"
|
||||
@ -107,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
const scalar LOGvGreat = Foam::log(vGreat);
|
||||
while (!runTime.end())
|
||||
{
|
||||
const scalar t = runTime.userTimeValue()/lambda;
|
||||
const scalar t = runTime.value()/lambda;
|
||||
forAll(A, i)
|
||||
{
|
||||
if (bk[i]*t < LOGvGreat)
|
||||
|
||||
@ -6,7 +6,7 @@ const scalar nu2 =
|
||||
dimensionedScalar
|
||||
(
|
||||
"nu",
|
||||
dimViscosity,
|
||||
dimKinematicViscosity,
|
||||
viscosity->lookup("nu")
|
||||
).value();
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@ sixDoFRigidBodyState
|
||||
{
|
||||
type sixDoFRigidBodyState;
|
||||
libs ("libsixDoFRigidBodyState.so");
|
||||
angleUnits degrees;
|
||||
angleUnits [deg];
|
||||
angularVelocityUnits [deg/s];
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -18,7 +18,8 @@ rigidBodyState
|
||||
{
|
||||
type rigidBodyState;
|
||||
libs ("librigidBodyState.so");
|
||||
angleUnits degrees;
|
||||
angleUnits [deg];
|
||||
angularVelocityUnits [deg/s];
|
||||
}
|
||||
|
||||
rigidBodyForces
|
||||
|
||||
@ -18,7 +18,8 @@ sixDoFRigidBodyState
|
||||
{
|
||||
type sixDoFRigidBodyState;
|
||||
libs ("libsixDoFRigidBodyState.so");
|
||||
angleUnits degrees;
|
||||
angleUnits [deg];
|
||||
angularVelocityUnits [deg/s];
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -18,7 +18,8 @@ rigidBodyState
|
||||
{
|
||||
type rigidBodyState;
|
||||
libs ("librigidBodyState.so");
|
||||
angleUnits degrees;
|
||||
angleUnits [deg];
|
||||
angularVelocityUnits [deg/s];
|
||||
}
|
||||
|
||||
rigidBodyForces
|
||||
|
||||
@ -18,7 +18,8 @@ sixDoFRigidBodyState
|
||||
{
|
||||
type sixDoFRigidBodyState;
|
||||
libs ("libsixDoFRigidBodyState.so");
|
||||
angleUnits degrees;
|
||||
angleUnits [deg];
|
||||
angularVelocityUnits [deg/s];
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -29,7 +29,8 @@ rigidBodyState
|
||||
{
|
||||
type rigidBodyState;
|
||||
libs ("librigidBodyState.so");
|
||||
angleUnits degrees;
|
||||
angleUnits [deg];
|
||||
angularVelocityUnits [deg/s];
|
||||
}
|
||||
|
||||
#includeFunc surfaces
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 1 0 -3 0 0 0 0 ];
|
||||
dimensions [mass/time^3];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 0 0 1 0 0 0 ];
|
||||
dimensions [temperature];
|
||||
|
||||
internalField uniform 300;
|
||||
|
||||
@ -27,14 +27,12 @@ boundaryField
|
||||
type fixedValue;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type inletOutlet;
|
||||
value $internalField;
|
||||
inletValue $internalField;
|
||||
}
|
||||
|
||||
gas_to_solid
|
||||
{
|
||||
type coupledTemperature;
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 1 -1 0 0 0 0 ];
|
||||
dimensions [velocity];
|
||||
|
||||
internalField uniform (0 0 0);
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -1 0 0 0 0];
|
||||
dimensions [thermalConductivity/specificHeatCapacity];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 2 -3 0 0 0 0 ];
|
||||
dimensions [energy/mass/time];
|
||||
|
||||
internalField uniform 3.60203e-06;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 2 -2 0 0 0 0 ];
|
||||
dimensions [energy/mass];
|
||||
|
||||
internalField uniform 0.00016875;
|
||||
|
||||
|
||||
@ -10,11 +10,11 @@ FoamFile
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0/gas";
|
||||
object nutt;
|
||||
object nut;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [0 2 -1 0 0 0 0];
|
||||
dimensions [kinematicViscosity];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -14,9 +14,9 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 1 -1 -2 0 0 0 0 ];
|
||||
dimensions [pressure];
|
||||
|
||||
internalField uniform 1e6;
|
||||
internalField uniform 10 [bar];
|
||||
|
||||
boundaryField
|
||||
{
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 1 -1 -2 0 0 0 0 ];
|
||||
dimensions [pressure];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 0 0 1 0 0 0 ];
|
||||
dimensions [temperature];
|
||||
|
||||
internalField uniform 300;
|
||||
|
||||
@ -25,11 +25,10 @@ boundaryField
|
||||
external
|
||||
{
|
||||
type externalTemperature;
|
||||
h uniform 1e3;
|
||||
h 1e3 [W/m^2/K];
|
||||
Ta $internalField;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
solid_to_gas
|
||||
{
|
||||
type coupledTemperature;
|
||||
|
||||
@ -15,6 +15,7 @@ FoamFile
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -2 0 0 0 0];
|
||||
value 1e6;
|
||||
|
||||
value 10 [bar];
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -25,8 +25,121 @@ thermoType
|
||||
energy sensibleEnthalpy;
|
||||
}
|
||||
|
||||
species
|
||||
(
|
||||
O2
|
||||
H2O
|
||||
CH4
|
||||
CO2
|
||||
N2
|
||||
);
|
||||
|
||||
defaultSpecie N2;
|
||||
|
||||
#include "thermo.compressibleGas"
|
||||
O2
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 31.9988;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 3.69758 0.00061352 -1.25884e-07 1.77528e-11 -1.13644e-15 -1233.93 3.18917 );
|
||||
lowCpCoeffs ( 3.21294 0.00112749 -5.75615e-07 1.31388e-09 -8.76855e-13 -1005.25 6.03474 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.753e-6;
|
||||
Ts 139;
|
||||
}
|
||||
}
|
||||
|
||||
H2O
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 18.0153;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 2.67215 0.00305629 -8.73026e-07 1.201e-10 -6.39162e-15 -29899.2 6.86282 );
|
||||
lowCpCoeffs ( 3.38684 0.00347498 -6.3547e-06 6.96858e-09 -2.50659e-12 -30208.1 2.59023 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 2.978e-7;
|
||||
Ts 1064;
|
||||
}
|
||||
}
|
||||
|
||||
CH4
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 16.0428;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 6000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 1.63543 0.0100844 -3.36924e-06 5.34973e-10 -3.15528e-14 -10005.6 9.9937 );
|
||||
lowCpCoeffs ( 5.14988 -0.013671 4.91801e-05 -4.84744e-08 1.66694e-11 -10246.6 -4.64132 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.0194e-06;
|
||||
Ts 171.06;
|
||||
}
|
||||
}
|
||||
|
||||
CO2
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 44.01;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 4.45362 0.00314017 -1.27841e-06 2.394e-10 -1.66903e-14 -48967 -0.955396 );
|
||||
lowCpCoeffs ( 2.27572 0.00992207 -1.04091e-05 6.86669e-09 -2.11728e-12 -48373.1 10.1885 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.503e-6;
|
||||
Ts 222;
|
||||
}
|
||||
}
|
||||
|
||||
N2
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 28.0134;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 2.92664 0.00148798 -5.68476e-07 1.0097e-10 -6.75335e-15 -922.798 5.98053 );
|
||||
lowCpCoeffs ( 3.29868 0.00140824 -3.96322e-06 5.64152e-09 -2.44486e-12 -1020.9 3.95037 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.401e-6;
|
||||
Ts 107;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -12,10 +12,6 @@ Reference:
|
||||
Combustion science and technology, 27(1-2), 31-43.
|
||||
|
||||
Notes:
|
||||
The reference gives parameters in a unit system of cm-sec-mole-kcal-Kelvin,
|
||||
whilst OpenFOAM uses m-sec-kmol-J-Kelvin, both the pre-exponential factors
|
||||
and the activation temperature/energy require unit conversion.
|
||||
|
||||
The mechanism used is set 3 from table 2. This should be the most accurate
|
||||
single-step methane mechanism without any negative exponents. Set 2 is not
|
||||
usable because the negative exponent on the methane concentration causes
|
||||
@ -27,11 +23,11 @@ reactions
|
||||
{
|
||||
methaneReaction
|
||||
{
|
||||
type irreversibleArrhenius;
|
||||
type irreversibleArrhenius;
|
||||
reaction "CH4^0.2 + 2O2^1.3 = CO2 + 2H2O";
|
||||
A 2.11873e+11;
|
||||
beta 0;
|
||||
Ta 24357;
|
||||
A 6.7e12 [(mol/cm^3)^-0.5/s];
|
||||
beta 0;
|
||||
Ea 48.4 [kcal/mol];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
species
|
||||
(
|
||||
O2
|
||||
H2O
|
||||
CH4
|
||||
CO2
|
||||
N2
|
||||
);
|
||||
|
||||
O2
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 31.9988;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 3.69758 0.00061352 -1.25884e-07 1.77528e-11 -1.13644e-15 -1233.93 3.18917 );
|
||||
lowCpCoeffs ( 3.21294 0.00112749 -5.75615e-07 1.31388e-09 -8.76855e-13 -1005.25 6.03474 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.753e-6;
|
||||
Ts 139;
|
||||
}
|
||||
}
|
||||
|
||||
H2O
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 18.0153;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 2.67215 0.00305629 -8.73026e-07 1.201e-10 -6.39162e-15 -29899.2 6.86282 );
|
||||
lowCpCoeffs ( 3.38684 0.00347498 -6.3547e-06 6.96858e-09 -2.50659e-12 -30208.1 2.59023 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 2.978e-7;
|
||||
Ts 1064;
|
||||
}
|
||||
}
|
||||
|
||||
CH4
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 16.0428;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 6000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 1.63543 0.0100844 -3.36924e-06 5.34973e-10 -3.15528e-14 -10005.6 9.9937 );
|
||||
lowCpCoeffs ( 5.14988 -0.013671 4.91801e-05 -4.84744e-08 1.66694e-11 -10246.6 -4.64132 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.0194e-06;
|
||||
Ts 171.06;
|
||||
}
|
||||
}
|
||||
|
||||
CO2
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 44.01;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 4.45362 0.00314017 -1.27841e-06 2.394e-10 -1.66903e-14 -48967 -0.955396 );
|
||||
lowCpCoeffs ( 2.27572 0.00992207 -1.04091e-05 6.86669e-09 -2.11728e-12 -48373.1 10.1885 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.503e-6;
|
||||
Ts 222;
|
||||
}
|
||||
}
|
||||
|
||||
N2
|
||||
{
|
||||
specie
|
||||
{
|
||||
molWeight 28.0134;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Tlow 200;
|
||||
Thigh 5000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 2.92664 0.00148798 -5.68476e-07 1.0097e-10 -6.75335e-15 -922.798 5.98053 );
|
||||
lowCpCoeffs ( 3.29868 0.00140824 -3.96322e-06 5.64152e-09 -2.44486e-12 -1020.9 3.95037 );
|
||||
}
|
||||
transport
|
||||
{
|
||||
As 1.401e-6;
|
||||
Ts 107;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -52,8 +52,8 @@ solvers
|
||||
|
||||
G
|
||||
{
|
||||
solver GAMG;
|
||||
smoother GaussSeidel;
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-5;
|
||||
relTol 0.1;
|
||||
}
|
||||
|
||||
@ -130,22 +130,18 @@ saturationTemperature
|
||||
{
|
||||
gas_liquid
|
||||
{
|
||||
type function1;
|
||||
type function1;
|
||||
|
||||
function scale;
|
||||
|
||||
xScale 1e-6;
|
||||
scale 1;
|
||||
value
|
||||
function
|
||||
{
|
||||
type tableFile;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
refColumn 1;
|
||||
componentColumns (0);
|
||||
mergeSeparators no;
|
||||
type table;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
units ([MPa] [K]);
|
||||
columns (1 0);
|
||||
mergeSeparators no;
|
||||
file "$FOAM_TUTORIALS/resources/thermoData/wallBoiling-saturation.csv";
|
||||
outOfBounds clamp;
|
||||
outOfBounds clamp;
|
||||
interpolationScheme linear;
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,17 +209,13 @@ saturationTemperature
|
||||
{
|
||||
type function1;
|
||||
|
||||
function scale;
|
||||
|
||||
xScale 1e-5;
|
||||
scale 1;
|
||||
value
|
||||
function
|
||||
{
|
||||
type table;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
refColumn 1;
|
||||
componentColumns (0);
|
||||
units ([bar] [K]);
|
||||
columns (1 0);
|
||||
mergeSeparators no;
|
||||
file "constant/water-saturation.csv";
|
||||
outOfBounds clamp;
|
||||
|
||||
@ -23,8 +23,8 @@ boundaryField
|
||||
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
}
|
||||
|
||||
outlet
|
||||
@ -37,15 +37,14 @@ boundaryField
|
||||
type fixedProfile;
|
||||
profile
|
||||
{
|
||||
type tableFile;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
refColumn 0; // Reference column index
|
||||
componentColumns (1); // Component column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
type table;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
columns (0 1); // Column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
interpolationScheme linear; // Optional interpolation scheme
|
||||
}
|
||||
direction (1 0 0);
|
||||
|
||||
@ -23,8 +23,8 @@ boundaryField
|
||||
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
}
|
||||
|
||||
outlet
|
||||
@ -37,15 +37,14 @@ boundaryField
|
||||
type fixedProfile;
|
||||
profile
|
||||
{
|
||||
type tableFile;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
refColumn 0; // Reference column index
|
||||
componentColumns (1); // Component column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
type table;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
columns (0 1); // Column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
interpolationScheme linear; // Optional interpolation scheme
|
||||
}
|
||||
direction (1 0 0);
|
||||
|
||||
@ -23,8 +23,8 @@ boundaryField
|
||||
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
}
|
||||
|
||||
outlet
|
||||
@ -37,15 +37,14 @@ boundaryField
|
||||
type fixedProfile;
|
||||
profile
|
||||
{
|
||||
type tableFile;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
refColumn 0; // Reference column index
|
||||
componentColumns (1); // Component column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
type table;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
columns (0 1); // Column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
interpolationScheme linear; // Optional interpolation scheme
|
||||
}
|
||||
direction (1 0 0);
|
||||
|
||||
@ -23,8 +23,8 @@ boundaryField
|
||||
|
||||
inlet
|
||||
{
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
type fixedValue;
|
||||
value uniform 296;
|
||||
}
|
||||
|
||||
outlet
|
||||
@ -37,15 +37,14 @@ boundaryField
|
||||
type fixedProfile;
|
||||
profile
|
||||
{
|
||||
type tableFile;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
refColumn 0; // Reference column index
|
||||
componentColumns (1); // Component column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
type table;
|
||||
format csv; // Input format
|
||||
nHeaderLine 0; // Number of header lines
|
||||
columns (0 1); // Column indices
|
||||
separator " "; // Optional (defaults to ",")
|
||||
mergeSeparators yes; // Merge multiple separators
|
||||
outOfBounds clamp; // Optional out-of-bounds handling
|
||||
file "validation/exptData/wallTemperature";
|
||||
interpolationScheme linear; // Optional interpolation scheme
|
||||
}
|
||||
direction (1 0 0);
|
||||
|
||||
@ -167,22 +167,18 @@ saturationTemperature
|
||||
{
|
||||
gas_liquid
|
||||
{
|
||||
type function1;
|
||||
type function1;
|
||||
|
||||
function scale;
|
||||
|
||||
xScale 1e-6;
|
||||
scale 1;
|
||||
value
|
||||
function
|
||||
{
|
||||
type tableFile;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
refColumn 1;
|
||||
componentColumns (0);
|
||||
mergeSeparators no;
|
||||
type table;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
units ([MPa] [K]);
|
||||
columns (1 0);
|
||||
mergeSeparators no;
|
||||
file "$FOAM_TUTORIALS/resources/thermoData/wallBoiling-saturation.csv";
|
||||
outOfBounds clamp;
|
||||
outOfBounds clamp;
|
||||
interpolationScheme linear;
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,22 +216,18 @@ saturationTemperature
|
||||
{
|
||||
gas_liquid
|
||||
{
|
||||
type function1;
|
||||
type function1;
|
||||
|
||||
function scale;
|
||||
|
||||
xScale 1e-6;
|
||||
scale 1;
|
||||
value
|
||||
function
|
||||
{
|
||||
type tableFile;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
refColumn 1;
|
||||
componentColumns (0);
|
||||
mergeSeparators no;
|
||||
type table;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
units ([MPa] [K]);
|
||||
columns (1 0);
|
||||
mergeSeparators no;
|
||||
file "$FOAM_TUTORIALS/resources/thermoData/wallBoiling-saturation.csv";
|
||||
outOfBounds clamp;
|
||||
outOfBounds clamp;
|
||||
interpolationScheme linear;
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,22 +274,18 @@ saturationTemperature
|
||||
{
|
||||
gas_liquid
|
||||
{
|
||||
type function1;
|
||||
type function1;
|
||||
|
||||
function scale;
|
||||
|
||||
xScale 1e-6;
|
||||
scale 1;
|
||||
value
|
||||
function
|
||||
{
|
||||
type tableFile;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
refColumn 1;
|
||||
componentColumns (0);
|
||||
mergeSeparators no;
|
||||
type table;
|
||||
format csv;
|
||||
nHeaderLine 1;
|
||||
units ([MPa] [K]);
|
||||
columns (1 0);
|
||||
mergeSeparators no;
|
||||
file "$FOAM_TUTORIALS/resources/thermoData/wallBoiling-saturation.csv";
|
||||
outOfBounds clamp;
|
||||
outOfBounds clamp;
|
||||
interpolationScheme linear;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user