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:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -53,9 +53,12 @@ activeBaffleVelocityFvPatchVectorField
|
||||
p.boundaryMesh()[cyclicPatchLabel_]
|
||||
).neighbFvPatch().Sf()
|
||||
),
|
||||
openFraction_(dict.lookup<scalar>("openFraction")),
|
||||
openingTime_(dict.lookup<scalar>("openingTime")),
|
||||
maxOpenFractionDelta_(dict.lookup<scalar>("maxOpenFractionDelta")),
|
||||
openFraction_(dict.lookup<scalar>("openFraction", unitFraction)),
|
||||
openingTime_(dict.lookup<scalar>("openingTime", dimTime)),
|
||||
maxOpenFractionDelta_
|
||||
(
|
||||
dict.lookup<scalar>("maxOpenFractionDelta", unitFraction)
|
||||
),
|
||||
curTimeIndex_(-1)
|
||||
{
|
||||
fvPatchVectorField::operator=(Zero);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,12 +47,15 @@ activePressureForceBaffleVelocityFvPatchVectorField
|
||||
initWallSf_(0),
|
||||
initCyclicSf_(0),
|
||||
nbrCyclicSf_(0),
|
||||
openFraction_(dict.lookup<scalar>("openFraction")),
|
||||
openingTime_(dict.lookup<scalar>("openingTime")),
|
||||
maxOpenFractionDelta_(dict.lookup<scalar>("maxOpenFractionDelta")),
|
||||
openFraction_(dict.lookup<scalar>("openFraction", unitFraction)),
|
||||
openingTime_(dict.lookup<scalar>("openingTime", dimTime)),
|
||||
maxOpenFractionDelta_
|
||||
(
|
||||
dict.lookup<scalar>("maxOpenFractionDelta", unitFraction)
|
||||
),
|
||||
curTimeIndex_(-1),
|
||||
minThresholdValue_(dict.lookup<scalar>("minThresholdValue")),
|
||||
fBased_(readBool(dict.lookup("forceBased"))),
|
||||
minThresholdValue_(dict.lookup<scalar>("minThresholdValue", dimPressure)),
|
||||
fBased_(dict.lookup<bool>("forceBased")),
|
||||
baffleActivated_(0)
|
||||
{
|
||||
fvPatchVectorField::operator=(Zero);
|
||||
|
||||
@ -22,7 +22,7 @@ dimensionedScalar rho
|
||||
dimensionedScalar nu
|
||||
(
|
||||
"nu",
|
||||
dimViscosity,
|
||||
dimKinematicViscosity,
|
||||
physicalProperties
|
||||
);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ IOdictionary physicalProperties
|
||||
dimensionedScalar nu
|
||||
(
|
||||
"nu",
|
||||
dimViscosity,
|
||||
dimKinematicViscosity,
|
||||
physicalProperties.lookup("nu")
|
||||
);
|
||||
|
||||
|
||||
@ -15,7 +15,8 @@ IOdictionary gravitationalProperties
|
||||
const dimensionedVector g(gravitationalProperties.lookup("g"));
|
||||
const Switch rotating(gravitationalProperties.lookup("rotating"));
|
||||
const dimensionedVector Omega =
|
||||
rotating ? gravitationalProperties.lookup("Omega")
|
||||
: dimensionedVector("Omega", -dimTime, vector(0,0,0));
|
||||
rotating
|
||||
? gravitationalProperties.lookup("Omega")
|
||||
: dimensionedVector("Omega", dimless/dimTime, vector::zero);
|
||||
const dimensionedScalar magg = mag(g);
|
||||
const dimensionedVector gHat = g/magg;
|
||||
|
||||
@ -59,11 +59,20 @@ namespace Foam
|
||||
|
||||
void Foam::fv::VoFSolidificationMelting::readCoeffs()
|
||||
{
|
||||
alphaSolidT_.reset(Function1<scalar>::New("alphaSolidT", coeffs()).ptr());
|
||||
alphaSolidT_.reset
|
||||
(
|
||||
Function1<scalar>::New
|
||||
(
|
||||
"alphaSolidT",
|
||||
dimTemperature,
|
||||
unitFraction,
|
||||
coeffs()
|
||||
).ptr()
|
||||
);
|
||||
L_ = dimensionedScalar("L", dimEnergy/dimMass, coeffs());
|
||||
relax_ = coeffs().lookupOrDefault<scalar>("relax", 0.9);
|
||||
Cu_ = coeffs().lookupOrDefault<scalar>("Cu", 100000);
|
||||
q_ = coeffs().lookupOrDefault<scalar>("q", 0.001);
|
||||
relax_ = coeffs().lookupOrDefault<scalar>("relax", dimless, 0.9);
|
||||
Cu_ = coeffs().lookupOrDefault<scalar>("Cu", dimless/dimTime, 100000);
|
||||
q_ = coeffs().lookupOrDefault<scalar>("q", dimless, 0.001);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -57,10 +57,7 @@ bool Foam::solvers::fluidSolver::read()
|
||||
|
||||
maxDeltaT_ =
|
||||
runTime.controlDict().found("maxDeltaT")
|
||||
? runTime.userTimeToTime
|
||||
(
|
||||
runTime.controlDict().lookup<scalar>("maxDeltaT")
|
||||
)
|
||||
? runTime.controlDict().lookup<scalar>("maxDeltaT", runTime.userUnits())
|
||||
: vGreat;
|
||||
|
||||
correctPhi = pimple.dict().lookupOrDefault
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -72,8 +72,22 @@ bool Foam::functionObjects::fluidMaxDeltaT::read(const dictionary& dict)
|
||||
{
|
||||
fvMeshFunctionObject::read(dict);
|
||||
|
||||
maxCoPtr_ = Function1<scalar>::New("maxCo", dict);
|
||||
maxDeltaTPtr_ = Function1<scalar>::New("maxDeltaT", dict);
|
||||
maxCoPtr_ =
|
||||
Function1<scalar>::New
|
||||
(
|
||||
"maxCo",
|
||||
time_.userUnits(),
|
||||
dimless,
|
||||
dict
|
||||
);
|
||||
maxDeltaTPtr_ =
|
||||
Function1<scalar>::New
|
||||
(
|
||||
"maxDeltaT",
|
||||
time_.userUnits(),
|
||||
time_.userUnits(),
|
||||
dict
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -93,15 +107,14 @@ bool Foam::functionObjects::fluidMaxDeltaT::write()
|
||||
|
||||
Foam::scalar Foam::functionObjects::fluidMaxDeltaT::maxDeltaT() const
|
||||
{
|
||||
scalar deltaT =
|
||||
time_.userTimeToTime(maxDeltaTPtr_().value(time_.userTimeValue()));
|
||||
scalar deltaT = maxDeltaTPtr_().value(time_.value());
|
||||
|
||||
const scalar CoNum =
|
||||
mesh_.lookupObject<solvers::fluidSolver>(solver::typeName).CoNum;
|
||||
|
||||
if (CoNum > small)
|
||||
{
|
||||
const scalar maxCo = maxCoPtr_().value(time_.userTimeValue());
|
||||
const scalar maxCo = maxCoPtr_().value(time_.value());
|
||||
|
||||
deltaT = min(deltaT, maxCo/CoNum*time_.deltaTValue());
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -74,7 +74,7 @@ Foam::incompressibleDriftFluxMixture::incompressibleDriftFluxMixture
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimViscosity, 0),
|
||||
dimensionedScalar(dimKinematicViscosity, 0),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
),
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -88,7 +88,7 @@ Foam::incompressibleMultiphaseVoFMixture::incompressibleMultiphaseVoFMixture
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimViscosity, 0),
|
||||
dimensionedScalar(dimKinematicViscosity, 0),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -73,7 +73,7 @@ Foam::incompressibleTwoPhaseVoFMixture::incompressibleTwoPhaseVoFMixture
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimViscosity, 0),
|
||||
dimensionedScalar(dimKinematicViscosity, 0),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ filmSurfaceVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
mixedFvPatchField<vector>(p, iF, dict, false),
|
||||
Cs_(dict.lookupOrDefault<scalar>("Cs", 0))
|
||||
Cs_(dict.lookupOrDefault<scalar>("Cs", dimless, 0))
|
||||
{
|
||||
refValue() = Zero;
|
||||
refGrad() = Zero;
|
||||
@ -49,7 +49,7 @@ filmSurfaceVelocityFvPatchVectorField
|
||||
{
|
||||
fvPatchVectorField::operator=
|
||||
(
|
||||
vectorField("value", dict, p.size())
|
||||
vectorField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -235,10 +235,7 @@ bool Foam::solvers::isothermalFilm::read()
|
||||
|
||||
maxDeltaT_ =
|
||||
runTime.controlDict().found("maxDeltaT")
|
||||
? runTime.userTimeToTime
|
||||
(
|
||||
runTime.controlDict().lookup<scalar>("maxDeltaT")
|
||||
)
|
||||
? runTime.controlDict().lookup<scalar>("maxDeltaT", runTime.userUnits())
|
||||
: vGreat;
|
||||
|
||||
return true;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,10 +46,7 @@ Foam::solvers::movingMesh::movingMesh(fvMesh& mesh)
|
||||
maxDeltaT_
|
||||
(
|
||||
runTime.controlDict().found("maxDeltaT")
|
||||
? runTime.userTimeToTime
|
||||
(
|
||||
runTime.controlDict().lookup<scalar>("maxDeltaT")
|
||||
)
|
||||
? runTime.controlDict().lookup<scalar>("maxDeltaT", runTime.userUnits())
|
||||
: vGreat
|
||||
)
|
||||
{}
|
||||
|
||||
@ -284,7 +284,7 @@ void Foam::solvers::multiphaseEuler::cellPressureCorrector()
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimFlux, 0)
|
||||
dimensionedScalar(dimVolumetricFlux, 0)
|
||||
);
|
||||
|
||||
forAll(movingPhases, movingPhasei)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -226,7 +226,7 @@ void Foam::solvers::multiphaseEuler::facePressureCorrector()
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimFlux, 0)
|
||||
dimensionedScalar(dimVolumetricFlux, 0)
|
||||
);
|
||||
|
||||
forAll(movingPhases, movingPhasei)
|
||||
|
||||
@ -52,7 +52,13 @@ void Foam::fv::homogeneousLiquidPhaseSeparation::readCoeffs()
|
||||
{
|
||||
solubilityCurve_.reset
|
||||
(
|
||||
Function1<scalar>::New("solubility", coeffs()).ptr()
|
||||
Function1<scalar>::New
|
||||
(
|
||||
"solubility",
|
||||
dimTemperature,
|
||||
unitFraction,
|
||||
coeffs()
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -70,7 +70,7 @@ Foam::tmp<Foam::volScalarField> Foam::liftModels::SaffmanMei::Cl() const
|
||||
*sqr(interface_.dispersed().d())
|
||||
/(
|
||||
interface_.continuous().fluidThermo().nu()
|
||||
+ dimensionedScalar(dimViscosity, small)
|
||||
+ dimensionedScalar(dimKinematicViscosity, small)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -52,16 +52,10 @@ JohnsonJacksonParticleSlipFvPatchVectorField
|
||||
partialSlipFvPatchVectorField(p, iF),
|
||||
specularityCoefficient_
|
||||
(
|
||||
"specularityCoefficient",
|
||||
dimless,
|
||||
dict.lookup("specularityCoefficient")
|
||||
dict.lookup<scalar>("specularityCoefficient", unitFraction)
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
(specularityCoefficient_.value() < 0)
|
||||
|| (specularityCoefficient_.value() > 1)
|
||||
)
|
||||
if (specularityCoefficient_ < 0 || specularityCoefficient_ > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "The specularity coefficient has to be between 0 and 1"
|
||||
@ -70,7 +64,7 @@ JohnsonJacksonParticleSlipFvPatchVectorField
|
||||
|
||||
fvPatchVectorField::operator=
|
||||
(
|
||||
vectorField("value", dict, p.size())
|
||||
vectorField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
}
|
||||
|
||||
@ -163,7 +157,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
|
||||
constant::mathematical::pi
|
||||
*alpha
|
||||
*gs0
|
||||
*specularityCoefficient_.value()
|
||||
*specularityCoefficient_
|
||||
*sqrt(3*Theta)
|
||||
/max(6*nu*phase.alphaMax(), small)
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,7 +69,7 @@ class JohnsonJacksonParticleSlipFvPatchVectorField
|
||||
// Private Data
|
||||
|
||||
//- Specularity coefficient
|
||||
dimensionedScalar specularityCoefficient_;
|
||||
const scalar specularityCoefficient_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -51,33 +51,21 @@ JohnsonJacksonParticleThetaFvPatchScalarField
|
||||
mixedFvPatchScalarField(p, iF, dict, false),
|
||||
restitutionCoefficient_
|
||||
(
|
||||
"restitutionCoefficient",
|
||||
dimless,
|
||||
dict.lookup("restitutionCoefficient")
|
||||
dict.lookup<scalar>("restitutionCoefficient", unitFraction)
|
||||
),
|
||||
specularityCoefficient_
|
||||
(
|
||||
"specularityCoefficient",
|
||||
dimless,
|
||||
dict.lookup("specularityCoefficient")
|
||||
dict.lookup<scalar>("specularityCoefficient", unitFraction)
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
(restitutionCoefficient_.value() < 0)
|
||||
|| (restitutionCoefficient_.value() > 1)
|
||||
)
|
||||
if (restitutionCoefficient_ < 0 || restitutionCoefficient_ > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "The restitution coefficient has to be between 0 and 1"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
(specularityCoefficient_.value() < 0)
|
||||
|| (specularityCoefficient_.value() > 1)
|
||||
)
|
||||
if (specularityCoefficient_ < 0 || specularityCoefficient_ > 1)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "The specularity coefficient has to be between 0 and 1"
|
||||
@ -86,7 +74,7 @@ JohnsonJacksonParticleThetaFvPatchScalarField
|
||||
|
||||
fvPatchScalarField::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
scalarField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
}
|
||||
|
||||
@ -182,13 +170,13 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
|
||||
const scalarField Theta(patchInternalField());
|
||||
|
||||
// calculate the reference value and the value fraction
|
||||
if (restitutionCoefficient_.value() != 1.0)
|
||||
if (restitutionCoefficient_ != 1.0)
|
||||
{
|
||||
this->refValue() =
|
||||
(2.0/3.0)
|
||||
*specularityCoefficient_.value()
|
||||
*specularityCoefficient_
|
||||
*magSqr(U)
|
||||
/(scalar(1) - sqr(restitutionCoefficient_.value()));
|
||||
/(scalar(1) - sqr(restitutionCoefficient_));
|
||||
|
||||
this->refGrad() = 0.0;
|
||||
|
||||
@ -197,7 +185,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
|
||||
constant::mathematical::pi
|
||||
*alpha
|
||||
*gs0
|
||||
*(scalar(1) - sqr(restitutionCoefficient_.value()))
|
||||
*(scalar(1) - sqr(restitutionCoefficient_))
|
||||
*sqrt(3*Theta)
|
||||
/max(4*kappa*phase.alphaMax(), small)
|
||||
);
|
||||
@ -214,7 +202,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
|
||||
this->refGrad() =
|
||||
pos0(alpha - small)
|
||||
*constant::mathematical::pi
|
||||
*specularityCoefficient_.value()
|
||||
*specularityCoefficient_
|
||||
*alpha
|
||||
*gs0
|
||||
*sqrt(3*Theta)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -69,10 +69,10 @@ class JohnsonJacksonParticleThetaFvPatchScalarField
|
||||
// Private Data
|
||||
|
||||
//- Particle-wall restitution coefficient
|
||||
dimensionedScalar restitutionCoefficient_;
|
||||
const scalar restitutionCoefficient_;
|
||||
|
||||
//- Specularity coefficient
|
||||
dimensionedScalar specularityCoefficient_;
|
||||
const scalar specularityCoefficient_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -222,7 +222,7 @@ Foam::phaseSystem::phaseSystem
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimFlux, 0)
|
||||
dimensionedScalar(dimVolumetricFlux, 0)
|
||||
),
|
||||
|
||||
dpdt_
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -119,7 +119,7 @@ void Foam::diameterModels::LiaoBase::precompute()
|
||||
const dimensionedScalar nuc
|
||||
(
|
||||
"nuc",
|
||||
dimViscosity,
|
||||
dimKinematicViscosity,
|
||||
gAverage(populationBalance_.continuousPhase().fluidThermo().nu()())
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -84,6 +84,7 @@ public:
|
||||
(
|
||||
const speciesTable& species,
|
||||
const objectRegistry& ob,
|
||||
const dimensionSet& dims,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,10 +34,11 @@ phaseSurfaceArrheniusReactionRate
|
||||
(
|
||||
const speciesTable& species,
|
||||
const objectRegistry& ob,
|
||||
const dimensionSet& dims,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
ArrheniusReactionRate(species, dict),
|
||||
ArrheniusReactionRate(species, dims, dict),
|
||||
phaseName_(dict.lookup("phase")),
|
||||
ob_(ob),
|
||||
tAv_(nullptr)
|
||||
|
||||
@ -576,8 +576,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
),
|
||||
tolerance_(dict.lookupOrDefault<scalar>("tolerance", rootSmall)),
|
||||
|
||||
Prt_(dict.lookupOrDefault<scalar>("Prt", 0.85)),
|
||||
tau_(dict.lookupOrDefault<scalar>("bubbleWaitingTimeRatio", 0.8)),
|
||||
Prt_(dict.lookupOrDefault<scalar>("Prt", dimless, 0.85)),
|
||||
tau_(dict.lookupOrDefault<scalar>("bubbleWaitingTimeRatio", dimless, 0.8)),
|
||||
|
||||
partitioningModel_(nullptr),
|
||||
nucleationSiteModel_(nullptr),
|
||||
@ -628,6 +628,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
auto readFieldBackwardsCompatible = [&p]
|
||||
(
|
||||
const dictionary& dict,
|
||||
const unitConversion& units,
|
||||
const wordList& keywords,
|
||||
scalarField& field
|
||||
)
|
||||
@ -636,7 +637,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
{
|
||||
if (dict.found(keywords[i]))
|
||||
{
|
||||
field = scalarField(keywords[i], dict, p.size());
|
||||
field = scalarField(keywords[i], units, dict, p.size());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -646,17 +647,25 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
unitFraction,
|
||||
{"wetFraction", "wallLiquidFraction"},
|
||||
wetFraction_
|
||||
);
|
||||
|
||||
if (phaseType_ == liquidPhase)
|
||||
{
|
||||
readFieldBackwardsCompatible(dict, {"dDeparture"}, dDeparture_);
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
dimLength,
|
||||
{"dDeparture"},
|
||||
dDeparture_
|
||||
);
|
||||
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
dimless/dimTime,
|
||||
{"fDeparture", "depFrequency"},
|
||||
fDeparture_
|
||||
);
|
||||
@ -664,15 +673,34 @@ alphatWallBoilingWallFunctionFvPatchScalarField
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
dimless/dimArea,
|
||||
{"nucleationSiteDensity", "nucSiteDensity"},
|
||||
nucleationSiteDensity_
|
||||
);
|
||||
|
||||
readFieldBackwardsCompatible(dict, {"qQuenching"}, qQuenching_);
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
dimPower/dimArea,
|
||||
{"qQuenching"},
|
||||
qQuenching_
|
||||
);
|
||||
|
||||
readFieldBackwardsCompatible(dict, {"qEvaporative"}, qEvaporative_);
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
dimPower/dimArea,
|
||||
{"qEvaporative"},
|
||||
qEvaporative_
|
||||
);
|
||||
|
||||
readFieldBackwardsCompatible(dict, {"dmdtf"}, dmdtf_);
|
||||
readFieldBackwardsCompatible
|
||||
(
|
||||
dict,
|
||||
dimDensity/dimTime,
|
||||
{"dmdtf"},
|
||||
dmdtf_
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,21 +44,15 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
accommodationCoeff_(dict.lookup<scalar>("accommodationCoeff")),
|
||||
Twall_("Twall", dict, p.size()),
|
||||
gamma_(dict.lookupOrDefault<scalar>("gamma", 1.4))
|
||||
accommodationCoeff_(dict.lookup<scalar>("accommodationCoeff", dimless)),
|
||||
Twall_("Twall", dimTemperature, dict, p.size()),
|
||||
gamma_(dict.lookupOrDefault<scalar>("gamma", dimless, 1.4))
|
||||
{
|
||||
if
|
||||
(
|
||||
mag(accommodationCoeff_) < small
|
||||
|| mag(accommodationCoeff_) > 2.0
|
||||
)
|
||||
if (mag(accommodationCoeff_) < small || mag(accommodationCoeff_) > 2.0)
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
dict
|
||||
) << "unphysical accommodationCoeff specified"
|
||||
<< "(0 < accommodationCoeff <= 1)" << endl
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "unphysical accommodationCoeff specified"
|
||||
<< "(0 < accommodationCoeff <= 2)" << endl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -66,7 +60,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
scalarField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,21 +45,15 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
accommodationCoeff_(dict.lookup<scalar>("accommodationCoeff")),
|
||||
Uwall_("Uwall", dict, p.size()),
|
||||
Uwall_("Uwall", dimVelocity, dict, p.size()),
|
||||
thermalCreep_(dict.lookupOrDefault("thermalCreep", true)),
|
||||
curvature_(dict.lookupOrDefault("curvature", true))
|
||||
{
|
||||
if
|
||||
(
|
||||
mag(accommodationCoeff_) < small
|
||||
|| mag(accommodationCoeff_) > 2.0
|
||||
)
|
||||
if (mag(accommodationCoeff_) < small || mag(accommodationCoeff_) > 2.0)
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
dict
|
||||
) << "unphysical accommodationCoeff_ specified"
|
||||
<< "(0 < accommodationCoeff_ <= 1)" << endl
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "unphysical accommodationCoeff_ specified"
|
||||
<< "(0 < accommodationCoeff_ <= 2)" << endl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
@ -67,14 +61,15 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
{
|
||||
fvPatchField<vector>::operator=
|
||||
(
|
||||
vectorField("value", dict, p.size())
|
||||
vectorField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
|
||||
if (dict.found("refValue") && dict.found("valueFraction"))
|
||||
{
|
||||
this->refValue() = vectorField("refValue", dict, p.size());
|
||||
this->refValue() =
|
||||
vectorField("refValue", iF.dimensions(), dict, p.size());
|
||||
this->valueFraction() =
|
||||
scalarField("valueFraction", dict, p.size());
|
||||
scalarField("valueFraction", unitFraction, dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,8 +50,8 @@ Foam::mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField
|
||||
)
|
||||
:
|
||||
transformFvPatchField<Type>(p, iF),
|
||||
refValue_("refValue", dict, p.size()),
|
||||
valueFraction_("valueFraction", dict, p.size())
|
||||
refValue_("refValue", iF.dimensions(), dict, p.size()),
|
||||
valueFraction_("valueFraction", unitFraction, dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -91,10 +91,7 @@ bool Foam::solvers::solid::read()
|
||||
|
||||
maxDeltaT_ =
|
||||
runTime.controlDict().found("maxDeltaT")
|
||||
? runTime.userTimeToTime
|
||||
(
|
||||
runTime.controlDict().lookup<scalar>("maxDeltaT")
|
||||
)
|
||||
? runTime.controlDict().lookup<scalar>("maxDeltaT", runTime.userUnits())
|
||||
: vGreat;
|
||||
|
||||
return true;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -38,9 +38,12 @@ hydrostaticDisplacementFvPatchVectorField
|
||||
)
|
||||
:
|
||||
tractionDisplacementFvPatchVectorField(p, iF),
|
||||
rhoLiquid_(dict.lookup<scalar>("rhoLiquid")),
|
||||
liquidSurfacePressure_(dict.lookup<scalar>("liquidSurfacePressure")),
|
||||
liquidSurfacePoint_(dict.lookup("liquidSurfacePoint"))
|
||||
rhoLiquid_(dict.lookup<scalar>("rhoLiquid", dimDensity)),
|
||||
liquidSurfacePressure_
|
||||
(
|
||||
dict.lookup<scalar>("liquidSurfacePressure", dimPressure)
|
||||
),
|
||||
liquidSurfacePoint_(dict.lookup<vector>("liquidSurfacePoint", dimLength))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -53,8 +53,17 @@ tractionDisplacementFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedGradientFvPatchVectorField(p, iF),
|
||||
traction_("traction", dict, p.size()),
|
||||
pressure_(Function1<scalar>::New("pressure", dict))
|
||||
traction_("traction", dimPressure, dict, p.size()),
|
||||
pressure_
|
||||
(
|
||||
Function1<scalar>::New
|
||||
(
|
||||
"pressure",
|
||||
db().time().userUnits(),
|
||||
dimPressure,
|
||||
dict
|
||||
)
|
||||
)
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
gradient() = Zero;
|
||||
@ -127,7 +136,7 @@ void Foam::tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
this->updateCoeffs(pressure_->value(this->db().time().userTimeValue()));
|
||||
this->updateCoeffs(pressure_->value(db().time().value()));
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +144,7 @@ void Foam::tractionDisplacementFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntry(os, "traction", traction_);
|
||||
writeEntry(os, pressure_());
|
||||
writeEntry(os, db().time().userUnits(), dimPressure, pressure_());
|
||||
writeEntry(os, "value", *this);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,8 +55,10 @@ class tractionDisplacementFvPatchVectorField
|
||||
// Private Data
|
||||
|
||||
vectorField traction_;
|
||||
|
||||
autoPtr<Function1<scalar>> pressure_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
|
||||
@ -53,7 +53,6 @@ Description
|
||||
#include "removePoints.H"
|
||||
#include "meshCheck.H"
|
||||
#include "polyTopoChangeMap.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -305,24 +304,25 @@ int main(int argc, char *argv[])
|
||||
#include "createPolyMesh.H"
|
||||
const word oldInstance = mesh.pointsInstance();
|
||||
|
||||
const scalar featureAngle = args.argRead<scalar>(1);
|
||||
const scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||
const scalar featureAngle = degToRad(args.argRead<scalar>(1));
|
||||
const scalar minCos = Foam::cos(featureAngle);
|
||||
|
||||
// Sin of angle between two consecutive edges on a face.
|
||||
// If sin(angle) larger than this the face will be considered concave.
|
||||
scalar concaveAngle = args.optionLookupOrDefault("concaveAngle", 30.0);
|
||||
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
|
||||
const scalar concaveAngle =
|
||||
degToRad(args.optionLookupOrDefault("concaveAngle", 30.0));
|
||||
const scalar concaveSin = Foam::sin(concaveAngle);
|
||||
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
const bool meshQuality = args.optionFound("meshQuality");
|
||||
|
||||
Info<< "Merging all faces of a cell" << nl
|
||||
<< " - which are on the same patch" << nl
|
||||
<< " - which make an angle < " << featureAngle << " degrees"
|
||||
<< nl
|
||||
<< " - which make an angle < " << radToDeg(featureAngle)
|
||||
<< " degrees" << nl
|
||||
<< " (cos:" << minCos << ')' << nl
|
||||
<< " - even when resulting face becomes concave by more than "
|
||||
<< concaveAngle << " degrees" << nl
|
||||
<< radToDeg(concaveAngle) << " degrees" << nl
|
||||
<< " (sin:" << concaveSin << ')' << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
@ -50,7 +50,6 @@ Description
|
||||
#include "cellSet.H"
|
||||
#include "cellModeller.H"
|
||||
#include "meshCutter.H"
|
||||
#include "unitConversion.H"
|
||||
#include "geomCellLooper.H"
|
||||
#include "plane.H"
|
||||
#include "edgeVertex.H"
|
||||
@ -548,9 +547,9 @@ int main(int argc, char *argv[])
|
||||
#include "createPolyMesh.H"
|
||||
const word oldInstance = mesh.pointsInstance();
|
||||
|
||||
const scalar featureAngle = args.argRead<scalar>(1);
|
||||
const scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||
const scalar minSin = Foam::sin(degToRad(featureAngle));
|
||||
const scalar featureAngle = degToRad(args.argRead<scalar>(1));
|
||||
const scalar minCos = Foam::cos(featureAngle);
|
||||
const scalar minSin = Foam::sin(featureAngle);
|
||||
|
||||
const bool readSet = args.optionFound("set");
|
||||
const bool geometry = args.optionFound("geometry");
|
||||
@ -559,7 +558,7 @@ int main(int argc, char *argv[])
|
||||
const scalar edgeTol = args.optionLookupOrDefault("tol", 0.2);
|
||||
|
||||
Info<< "Trying to split cells with internal angles > feature angle\n" << nl
|
||||
<< "featureAngle : " << featureAngle << nl
|
||||
<< "featureAngle : " << radToDeg(featureAngle) << nl
|
||||
<< "edge snapping tol : " << edgeTol << nl;
|
||||
if (readSet)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,6 @@ Description
|
||||
#include "IFstream.H"
|
||||
#include "OFstream.H"
|
||||
#include "pointField.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
@ -1429,7 +1429,11 @@ int main(int argc, char *argv[])
|
||||
// Un-merge any merged cyclics
|
||||
if (args.optionFound("includedAngle"))
|
||||
{
|
||||
polyMeshUnMergeCyclics(mesh, args.optionRead<scalar>("includedAngle"));
|
||||
polyMeshUnMergeCyclics
|
||||
(
|
||||
mesh,
|
||||
degToRad(args.optionRead<scalar>("includedAngle"))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -43,7 +43,6 @@ Description
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "mergedCyclicPolyPatch.H"
|
||||
#include "polyMeshUnMergeCyclics.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,6 @@ Description
|
||||
#include "Time.H"
|
||||
#include "repatchMesh.H"
|
||||
#include "repatcher.H"
|
||||
#include "unitConversion.H"
|
||||
#include "OFstream.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
@ -84,12 +83,12 @@ int main(int argc, char *argv[])
|
||||
<< " s\n" << endl << endl;
|
||||
|
||||
|
||||
const scalar featureAngle = args.argRead<scalar>(1);
|
||||
const scalar featureAngle = degToRad(args.argRead<scalar>(1));
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
const scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||
const scalar minCos = Foam::cos(featureAngle);
|
||||
|
||||
Info<< "Feature:" << featureAngle << endl
|
||||
Info<< "Feature:" << radToDeg(featureAngle) << endl
|
||||
<< "minCos :" << minCos << endl
|
||||
<< endl;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -168,6 +168,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
scalar nonOrthThreshold = 70;
|
||||
args.optionReadIfPresent("nonOrthThreshold", nonOrthThreshold);
|
||||
nonOrthThreshold = degToRad(nonOrthThreshold);
|
||||
|
||||
scalar skewThreshold = 4;
|
||||
args.optionReadIfPresent("skewThreshold", skewThreshold);
|
||||
|
||||
@ -61,7 +61,6 @@ Usage
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "unitConversion.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "polyTopoChangeMap.H"
|
||||
#include "PackedBoolList.H"
|
||||
@ -90,7 +89,7 @@ void simpleMarkFeatures
|
||||
labelList& multiCellFeaturePoints
|
||||
)
|
||||
{
|
||||
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||
const scalar minCos = Foam::cos(featureAngle);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
@ -393,10 +392,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
const scalar featureAngle = args.argRead<scalar>(1);
|
||||
const scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||
const scalar featureAngle = degToRad(args.argRead<scalar>(1));
|
||||
const scalar minCos = Foam::cos(featureAngle);
|
||||
|
||||
Info<< "Feature:" << featureAngle << endl
|
||||
Info<< "Feature:" << radToDeg(featureAngle) << endl
|
||||
<< "minCos :" << minCos << endl
|
||||
<< endl;
|
||||
|
||||
|
||||
@ -75,7 +75,6 @@ See also
|
||||
#include "pointSet.H"
|
||||
#include "transformField.H"
|
||||
#include "transformGeometricField.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -120,13 +120,10 @@ int main(int argc, char *argv[])
|
||||
// Read field
|
||||
volScalarField field(*iter(), mesh);
|
||||
|
||||
// lookup field from dictionary and convert field
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
// Lookup field from dictionary and convert field
|
||||
const label unitNumber =
|
||||
foamDataToFluentDict.lookupOrDefault<label>(field.name(), 0);
|
||||
if (unitNumber > 0)
|
||||
{
|
||||
Info<< " Converting field " << field.name() << endl;
|
||||
writeFluentField(field, unitNumber, fluentDataFile);
|
||||
@ -145,13 +142,10 @@ int main(int argc, char *argv[])
|
||||
// Read field
|
||||
volVectorField field(*iter(), mesh);
|
||||
|
||||
// lookup field from dictionary and convert field
|
||||
label unitNumber;
|
||||
if
|
||||
(
|
||||
foamDataToFluentDict.readIfPresent(field.name(), unitNumber)
|
||||
&& unitNumber > 0
|
||||
)
|
||||
// Lookup field from dictionary and convert field
|
||||
const label unitNumber =
|
||||
foamDataToFluentDict.lookupOrDefault<label>(field.name(), 0);
|
||||
if (unitNumber > 0)
|
||||
{
|
||||
Info<< " Converting field " << field.name() << endl;
|
||||
writeFluentField(field, unitNumber, fluentDataFile);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,8 +45,7 @@ Usage
|
||||
{
|
||||
file "pressureData";
|
||||
nHeaderLine 1; // number of header lines
|
||||
refColumn 0; // reference column index
|
||||
componentColumns (1); // component column indices
|
||||
columns (0 1); // column indices
|
||||
separator " "; // optional (defaults to ",")
|
||||
mergeSeparators no; // merge multiple separators
|
||||
outOfBounds clamp; // optional out-of-bounds handling
|
||||
@ -162,6 +161,7 @@ int main(int argc, char *argv[])
|
||||
Function1s::Table<scalar> pData
|
||||
(
|
||||
"pressure",
|
||||
{dimTime, dimPressure},
|
||||
dict.subDict("pressureData")
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2013-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,8 +46,6 @@ void processField
|
||||
return;
|
||||
}
|
||||
|
||||
const word timeName(mesh.time().name());
|
||||
|
||||
IOobjectList fieldObjbjects(objects.lookupClass(VolField<Type>::typeName));
|
||||
|
||||
if (fieldObjbjects.lookup(fieldName) != nullptr)
|
||||
|
||||
@ -36,7 +36,6 @@ Description
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
#include "CompactListList.H"
|
||||
#include "unitConversion.H"
|
||||
#include "pairPatchAgglomeration.H"
|
||||
#include "labelListIOList.H"
|
||||
#include "syncTools.H"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,7 +27,6 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "polyPatch.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "unitConversion.H"
|
||||
#include "blockMeshFunctions.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -197,7 +197,8 @@ namespace Foam
|
||||
// Either construct features from surface & featureAngle or read set.
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
const scalar includedAngle = dict.lookup<scalar>("includedAngle");
|
||||
const scalar includedAngle =
|
||||
dict.lookup<scalar>("includedAngle", unitDegrees);
|
||||
|
||||
autoPtr<surfaceFeatures> set
|
||||
(
|
||||
@ -451,7 +452,9 @@ namespace Foam
|
||||
(
|
||||
closenessDict.lookupOrDefault<scalar>
|
||||
(
|
||||
"internalAngleTolerance", 80
|
||||
"internalAngleTolerance",
|
||||
unitDegrees,
|
||||
80
|
||||
)
|
||||
);
|
||||
|
||||
@ -459,7 +462,9 @@ namespace Foam
|
||||
(
|
||||
closenessDict.lookupOrDefault<scalar>
|
||||
(
|
||||
"externalAngleTolerance", 80
|
||||
"externalAngleTolerance",
|
||||
unitDegrees,
|
||||
80
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@ Usage
|
||||
#include "indexedOctree.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "unitConversion.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "systemDict.H"
|
||||
|
||||
@ -114,41 +113,6 @@ void greenRefine
|
||||
}
|
||||
|
||||
|
||||
//scalar checkEdgeAngle
|
||||
//(
|
||||
// const triSurface& surf,
|
||||
// const label edgeIndex,
|
||||
// const label pointIndex,
|
||||
// const scalar& angle
|
||||
//)
|
||||
//{
|
||||
// const edge& e = surf.edges()[edgeIndex];
|
||||
|
||||
// vector eVec = e.vec(surf.localPoints());
|
||||
// eVec /= mag(eVec) + small;
|
||||
|
||||
// const labelList& pEdges = surf.pointEdges()[pointIndex];
|
||||
//
|
||||
// forAll(pEdges, eI)
|
||||
// {
|
||||
// const edge& nearE = surf.edges()[pEdges[eI]];
|
||||
|
||||
// vector nearEVec = nearE.vec(surf.localPoints());
|
||||
// nearEVec /= mag(nearEVec) + small;
|
||||
|
||||
// const scalar dot = eVec & nearEVec;
|
||||
// const scalar minCos = degToRad(angle);
|
||||
|
||||
// if (mag(dot) > minCos)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
||||
void createBoundaryEdgeTrees
|
||||
(
|
||||
const PtrList<triSurfaceMesh>& surfs,
|
||||
@ -429,15 +393,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (nearestHit.hit())
|
||||
{
|
||||
// bool rejectEdge =
|
||||
// checkEdgeAngle
|
||||
// (
|
||||
// surf,
|
||||
// nearestHit.index(),
|
||||
// pointi,
|
||||
// 30
|
||||
// );
|
||||
|
||||
if (dist2 > Foam::sqr(dist))
|
||||
{
|
||||
nearestHit.setMiss();
|
||||
|
||||
@ -60,7 +60,6 @@ See also
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "unitConversion.H"
|
||||
#include "MeshedSurfaces.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -724,7 +724,6 @@ void Foam::chemkinReader::addReaction
|
||||
(
|
||||
Afactor*ArrheniusCoeffs[0],
|
||||
ArrheniusCoeffs[1],
|
||||
ArrheniusCoeffs[2]/RR,
|
||||
FixedList<scalar, 4>(powerSeriesCoeffs)
|
||||
)
|
||||
);
|
||||
|
||||
@ -59,6 +59,7 @@ codeRead
|
||||
const Function1s::Table<scalar> initialDistribution
|
||||
(
|
||||
"initialDistribution",
|
||||
{dimLength, dimless},
|
||||
dictionary
|
||||
(
|
||||
"format", "foam",
|
||||
|
||||
@ -29,15 +29,6 @@ License
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::scalar Foam::CLASS::t() const
|
||||
{
|
||||
return this->db().time().userTimeValue();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -50,10 +41,19 @@ CONSTRUCT
|
||||
)
|
||||
:
|
||||
PARENT(p, iF),
|
||||
scalarData_(dict.lookup<scalar>("scalarData")),
|
||||
scalarData_(dict.lookup<scalar>("scalarData", unitAny)),
|
||||
data_(dict.lookup<TYPE>("data")),
|
||||
fieldData_("fieldData", dict, p.size()),
|
||||
timeVsData_(Function1<TYPE>::New("timeVsData", dict)),
|
||||
fieldData_("fieldData", iF.dimensions(), dict, p.size()),
|
||||
timeVsData_
|
||||
(
|
||||
Function1<TYPE>::New
|
||||
(
|
||||
"timeVsData",
|
||||
this->db().time().userUnits(),
|
||||
unitAny,
|
||||
dict
|
||||
)
|
||||
),
|
||||
wordData_(dict.lookupOrDefault<word>("wordName", "wordDefault")),
|
||||
labelData_(-1),
|
||||
boolData_(false)
|
||||
@ -61,7 +61,7 @@ CONSTRUCT
|
||||
this->refGrad() = Zero;
|
||||
this->valueFraction() = 0.0;
|
||||
|
||||
this->refValue() = FIELD("fieldData", dict, p.size());
|
||||
this->refValue() = FIELD("fieldData", iF.dimensions(), dict, p.size());
|
||||
FVPATCHF::operator=(this->refValue());
|
||||
|
||||
PARENT::evaluate();
|
||||
@ -70,7 +70,7 @@ CONSTRUCT
|
||||
// Initialise with the value entry if evaluation is not possible
|
||||
FVPATCHF::operator=
|
||||
(
|
||||
FIELD("value", dict, p.size())
|
||||
FIELD("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
this->refValue() = *this;
|
||||
*/
|
||||
@ -162,7 +162,7 @@ void Foam::CLASS::updateCoeffs()
|
||||
(
|
||||
data_
|
||||
+ fieldData_
|
||||
+ scalarData_*timeVsData_->value(t())
|
||||
+ scalarData_*timeVsData_->value(this->db().time().value())
|
||||
);
|
||||
|
||||
const scalarField& phip =
|
||||
@ -186,7 +186,7 @@ void Foam::CLASS::write
|
||||
writeEntry(os, "scalarData", scalarData_);
|
||||
writeEntry(os, "data", data_);
|
||||
writeEntry(os, "fieldData", fieldData_);
|
||||
writeEntry(os, timeVsData_());
|
||||
writeEntry(os, this->db().time().userUnits(), unitAny, timeVsData_());
|
||||
writeEntry(os, "wordData", wordData_);
|
||||
writeEntry(os, "value", *this);
|
||||
}
|
||||
|
||||
@ -118,12 +118,6 @@ class CONSTRUCT
|
||||
bool boolData_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return current time
|
||||
scalar t() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -29,7 +29,6 @@ License
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "read.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
|
||||
@ -28,7 +28,6 @@ License
|
||||
#include "fieldMapper.H"
|
||||
#include "pointFields.H"
|
||||
#include "read.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
|
||||
@ -69,6 +69,7 @@ Foam::Function1s::${typeName}Function1${TemplateType}::
|
||||
${typeName}Function1${TemplateType}
|
||||
(
|
||||
const word& entryName,
|
||||
const unitConversions& units,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
@ -130,7 +131,8 @@ Foam::Function1s::${typeName}Function1${TemplateType}::integral
|
||||
|
||||
void Foam::Function1s::${typeName}Function1${TemplateType}::write
|
||||
(
|
||||
Ostream& os
|
||||
Ostream& os,
|
||||
const unitConversions&
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
@ -69,6 +69,7 @@ public:
|
||||
${typeName}Function1${TemplateType}
|
||||
(
|
||||
const word& entryName,
|
||||
const unitConversions& units,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
@ -110,7 +111,7 @@ public:
|
||||
) const;
|
||||
|
||||
//- Write data to dictionary stream
|
||||
virtual void write(Ostream& os) const;
|
||||
virtual void write(Ostream& os, const unitConversions&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -69,6 +69,7 @@ Foam::Function2s::${typeName}Function2${TemplateType}::
|
||||
${typeName}Function2${TemplateType}
|
||||
(
|
||||
const word& entryName,
|
||||
const unitConversions& units,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
@ -118,7 +119,8 @@ Foam::Function2s::${typeName}Function2${TemplateType}::
|
||||
|
||||
void Foam::Function2s::${typeName}Function2${TemplateType}::write
|
||||
(
|
||||
Ostream& os
|
||||
Ostream& os,
|
||||
const unitConversions&
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
|
||||
@ -69,6 +69,7 @@ public:
|
||||
${typeName}Function2${TemplateType}
|
||||
(
|
||||
const word& entryName,
|
||||
const unitConversions& units,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
@ -107,7 +108,7 @@ public:
|
||||
}
|
||||
|
||||
//- Write data to dictionary stream
|
||||
virtual void write(Ostream& os) const;
|
||||
virtual void write(Ostream& os, const unitConversions&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -26,7 +26,6 @@ License
|
||||
#include "codedFunctionObjectTemplate.H"
|
||||
#include "volFields.H"
|
||||
#include "read.H"
|
||||
#include "unitConversion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -28,7 +28,6 @@ License
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "read.H"
|
||||
#include "unitConversion.H"
|
||||
#include "fvMatrix.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
|
||||
@ -29,7 +29,6 @@ License
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "read.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
|
||||
@ -173,7 +173,7 @@ DimensionedConstants
|
||||
}
|
||||
|
||||
|
||||
DimensionSets
|
||||
UnitConversions
|
||||
{
|
||||
unitSet SI; // USCS
|
||||
|
||||
@ -195,16 +195,7 @@ DimensionSets
|
||||
J [N m] 1;
|
||||
W [J s^-1] 1;
|
||||
|
||||
// Some non-symbolic units
|
||||
area [m^2] 1;
|
||||
volume [m^3] 1;
|
||||
density [kg m^-3] 1;
|
||||
acceleration [m s^-2] 1;
|
||||
kinematicPressure [Pa density^-1] 1;
|
||||
|
||||
// Scaled units. Supported in dimensionedType and
|
||||
// UniformDimensionedField. Not supported in DimensionedField or
|
||||
// GeometricField.
|
||||
// Scaled units
|
||||
g [kg] 1e-3;
|
||||
um [m] 1e-6;
|
||||
mm [m] 1e-3;
|
||||
@ -212,7 +203,22 @@ DimensionSets
|
||||
km [m] 1e3;
|
||||
us [s] 1e-6;
|
||||
ms [s] 1e-3;
|
||||
min [s] 60;
|
||||
hr [s] 3600;
|
||||
mol [kmol] 1e-3;
|
||||
|
||||
// Derived scaled units
|
||||
l [m^3] 1e-3;
|
||||
ml [m^3] 1e-6;
|
||||
rpm [rot/min] 1;
|
||||
bar [Pa] 1e5;
|
||||
atm [Pa] 101325;
|
||||
kPa [Pa] 1e3;
|
||||
MPa [Pa] 1e6;
|
||||
cal [J] 4.184;
|
||||
kcal [J] 4184;
|
||||
cSt [m^2/s] 1e-6;
|
||||
cP [kg/m/s] 1e-3;
|
||||
}
|
||||
|
||||
USCSCoeffs
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2016-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -92,7 +92,7 @@ protected:
|
||||
// - 0: no filtering
|
||||
// - 1: (1 - F1)
|
||||
// - 2: (1 - F2)
|
||||
direction FSST_;
|
||||
label FSST_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ turbulentMixingLengthDissipationRateFvScalarFieldSource
|
||||
)
|
||||
:
|
||||
fvScalarFieldSource(iF, dict),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength")),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength", dimLength)),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k"))
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ turbulentMixingLengthFrequencyFvScalarFieldSource
|
||||
)
|
||||
:
|
||||
fvScalarFieldSource(iF, dict),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength")),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength", dimLength)),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k"))
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,12 +46,15 @@ turbulentMixingLengthDissipationRateInletFvPatchScalarField
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength")),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength", dimLength)),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k"))
|
||||
{
|
||||
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
fvPatchScalarField::operator=
|
||||
(
|
||||
scalarField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,12 +46,15 @@ turbulentMixingLengthFrequencyInletFvPatchScalarField
|
||||
)
|
||||
:
|
||||
inletOutletFvPatchScalarField(p, iF),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength")),
|
||||
mixingLength_(dict.lookup<scalar>("mixingLength", dimLength)),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k"))
|
||||
{
|
||||
this->phiName_ = dict.lookupOrDefault<word>("phi", "phi");
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
fvPatchScalarField::operator=
|
||||
(
|
||||
scalarField("value", iF.dimensions(), dict, p.size())
|
||||
);
|
||||
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,7 +40,7 @@ Foam::fixedShearStressFvPatchVectorField::fixedShearStressFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF, dict, false),
|
||||
tau0_(dict.lookupOrDefault<vector>("tau", Zero))
|
||||
tau0_(dict.lookupOrDefault<vector>("tau", sqr(dimVelocity), Zero))
|
||||
{
|
||||
fvPatchField<vector>::operator=(patchInternalField());
|
||||
}
|
||||
|
||||
@ -50,13 +50,28 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
||||
? dict.lookupOrDefault<word>("rho", "rho")
|
||||
: word::null
|
||||
),
|
||||
D_(cyclicPatch().owner() ? dict.lookup<scalar>("D") : NaN),
|
||||
I_(cyclicPatch().owner() ? dict.lookup<scalar>("I") : NaN),
|
||||
length_(cyclicPatch().owner() ? dict.lookup<scalar>("length") : NaN),
|
||||
D_
|
||||
(
|
||||
cyclicPatch().owner()
|
||||
? dict.lookup<scalar>("D", dimless/dimArea)
|
||||
: NaN
|
||||
),
|
||||
I_
|
||||
(
|
||||
cyclicPatch().owner()
|
||||
? dict.lookup<scalar>("I", dimless/dimLength)
|
||||
: NaN
|
||||
),
|
||||
length_
|
||||
(
|
||||
cyclicPatch().owner()
|
||||
? dict.lookup<scalar>("length", dimLength)
|
||||
: NaN
|
||||
),
|
||||
relaxation_
|
||||
(
|
||||
cyclicPatch().owner()
|
||||
? dict.lookupOrDefault<scalar>("relaxation", 1)
|
||||
? dict.lookupOrDefault<scalar>("relaxation", unitFraction, 1)
|
||||
: NaN
|
||||
),
|
||||
jump0_(cyclicPatch().owner() ? jump()() : scalarField(p.size()))
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,7 +43,7 @@ kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<scalar>(p, iF, dict),
|
||||
Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", 1.9))
|
||||
Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", dimless, 1.9))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -217,8 +217,8 @@ nutURoughWallFunctionFvPatchScalarField::nutURoughWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
nutUWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
Ks_("Ks", dict, p.size()),
|
||||
Cs_("Cs", dict, p.size())
|
||||
Ks_("Ks", dimLength, dict, p.size()),
|
||||
Cs_("Cs", dimless, dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -73,9 +73,9 @@ Foam::nutWallFunctionFvPatchScalarField::nutWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF, dict),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", dimless, 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", dimless, 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", dimless, 9.8)),
|
||||
yPlusLam_(yPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -134,8 +134,8 @@ nutkRoughWallFunctionFvPatchScalarField::nutkRoughWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
nutkWallFunctionFvPatchScalarField(p, iF, dict),
|
||||
Ks_("Ks", dict, p.size()),
|
||||
Cs_("Cs", dict, p.size())
|
||||
Ks_("Ks", dimLength, dict, p.size()),
|
||||
Cs_("Cs", dimless, dict, p.size())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -136,7 +136,7 @@ Maxwell<BasicMomentumTransportModel>::Maxwell
|
||||
|
||||
nModes_(modeCoefficients_.size() ? modeCoefficients_.size() : 1),
|
||||
|
||||
nuM_("nuM", dimViscosity, this->coeffDict_.lookup("nuM")),
|
||||
nuM_("nuM", dimKinematicViscosity, this->coeffDict_.lookup("nuM")),
|
||||
|
||||
lambdas_(readModeCoefficients("lambda", dimTime)),
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,9 +57,9 @@ BirdCarreau
|
||||
)
|
||||
:
|
||||
strainRateViscosityModel(viscosityProperties, viscosity, U),
|
||||
nuInf_("nuInf", dimViscosity, 0),
|
||||
nuInf_("nuInf", dimKinematicViscosity, 0),
|
||||
k_("k", dimTime, 0),
|
||||
tauStar_( "tauStar", dimViscosity/dimTime, 0),
|
||||
tauStar_( "tauStar", dimKinematicViscosity/dimTime, 0),
|
||||
n_("n", dimless, 0),
|
||||
a_("a", dimless, 2)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,10 +56,10 @@ Foam::laminarModels::generalisedNewtonianViscosityModels::Casson::Casson
|
||||
)
|
||||
:
|
||||
strainRateViscosityModel(viscosityProperties, viscosity, U),
|
||||
m_("m", dimViscosity, 0),
|
||||
tau0_("tau0", dimViscosity/dimTime, 0),
|
||||
nuMin_("nuMin", dimViscosity, 0),
|
||||
nuMax_("nuMax", dimViscosity, 0)
|
||||
m_("m", dimKinematicViscosity, 0),
|
||||
tau0_("tau0", dimKinematicViscosity/dimTime, 0),
|
||||
nuMin_("nuMin", dimKinematicViscosity, 0),
|
||||
nuMax_("nuMax", dimKinematicViscosity, 0)
|
||||
{
|
||||
read(viscosityProperties);
|
||||
correct();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -58,9 +58,9 @@ CrossPowerLaw
|
||||
)
|
||||
:
|
||||
strainRateViscosityModel(viscosityProperties, viscosity, U),
|
||||
nuInf_("nuInf", dimViscosity, 0),
|
||||
nuInf_("nuInf", dimKinematicViscosity, 0),
|
||||
m_("m", dimTime, 0),
|
||||
tauStar_( "tauStar", dimViscosity/dimTime, 0),
|
||||
tauStar_( "tauStar", dimKinematicViscosity/dimTime, 0),
|
||||
n_("n", dimless, 0)
|
||||
{
|
||||
read(viscosityProperties);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -58,9 +58,9 @@ HerschelBulkley
|
||||
)
|
||||
:
|
||||
strainRateViscosityModel(viscosityProperties, viscosity, U),
|
||||
k_("k", dimViscosity, 0),
|
||||
k_("k", dimKinematicViscosity, 0),
|
||||
n_("n", dimless, 0),
|
||||
tau0_("tau0", dimViscosity/dimTime, 0)
|
||||
tau0_("tau0", dimKinematicViscosity/dimTime, 0)
|
||||
{
|
||||
read(viscosityProperties);
|
||||
correct();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,10 +57,10 @@ Foam::laminarModels::generalisedNewtonianViscosityModels::powerLaw::powerLaw
|
||||
)
|
||||
:
|
||||
strainRateViscosityModel(viscosityProperties, viscosity, U),
|
||||
k_("k", dimViscosity, 0),
|
||||
k_("k", dimKinematicViscosity, 0),
|
||||
n_("n", dimless, 0),
|
||||
nuMin_("nuMin", dimViscosity, 0),
|
||||
nuMax_("nuMax", dimViscosity, 0)
|
||||
nuMin_("nuMin", dimKinematicViscosity, 0),
|
||||
nuMax_("nuMax", dimKinematicViscosity, 0)
|
||||
{
|
||||
read(viscosityProperties);
|
||||
correct();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -63,6 +63,8 @@ strainRateFunction
|
||||
Function1<scalar>::New
|
||||
(
|
||||
"function",
|
||||
dimless/dimTime,
|
||||
dimKinematicViscosity,
|
||||
viscosityProperties.optionalSubDict(typeName + "Coeffs")
|
||||
)
|
||||
)
|
||||
@ -85,6 +87,8 @@ strainRateFunction::read
|
||||
strainRateFunction_ = Function1<scalar>::New
|
||||
(
|
||||
"function",
|
||||
dimless/dimTime,
|
||||
dimKinematicViscosity,
|
||||
viscosityProperties.optionalSubDict
|
||||
(
|
||||
typeName + "Coeffs"
|
||||
@ -109,7 +113,7 @@ nu
|
||||
(
|
||||
IOobject::groupName(typedName("nu"), nu0.group()),
|
||||
nu0.mesh(),
|
||||
dimensionedScalar(dimViscosity, 0)
|
||||
dimensionedScalar(dimKinematicViscosity, 0)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -76,7 +76,7 @@ strainRateViscosityModel::strainRateViscosityModel
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
U.mesh(),
|
||||
dimensionedScalar(dimViscosity, 0)
|
||||
dimensionedScalar(dimKinematicViscosity, 0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -65,8 +65,8 @@ lambdaThixotropic<BasicMomentumTransportModel>::lambdaThixotropic
|
||||
b_("b", dimless, this->coeffDict_),
|
||||
d_("d", dimless, this->coeffDict_),
|
||||
c_("c", pow(dimTime, d_.value() - scalar(1)), this->coeffDict_),
|
||||
nu0_("nu0", dimViscosity, this->coeffDict_),
|
||||
nuInf_("nuInf", dimViscosity, this->coeffDict_),
|
||||
nu0_("nu0", dimKinematicViscosity, this->coeffDict_),
|
||||
nuInf_("nuInf", dimKinematicViscosity, this->coeffDict_),
|
||||
K_(1 - sqrt(nuInf_/nu0_)),
|
||||
BinghamPlastic_(this->coeffDict_.found("sigmay")),
|
||||
sigmay_
|
||||
|
||||
@ -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
|
||||
@ -185,7 +185,7 @@ Foam::laminarModel<BasicMomentumTransportModel>::nut() const
|
||||
(
|
||||
this->groupName("nut"),
|
||||
this->mesh_,
|
||||
dimensionedScalar(dimViscosity, 0)
|
||||
dimensionedScalar(dimKinematicViscosity, 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ primitives/triad/triad.C
|
||||
primitives/omega/omega.C
|
||||
|
||||
# Run-time selectable functions
|
||||
primitives/functions/Function1/Function1/Function1UnitConversions.C
|
||||
primitives/functions/Function1/makeFunction1s.C
|
||||
primitives/functions/Function1/reverseRamp/reverseRamp.C
|
||||
primitives/functions/Function1/linearRamp/linearRamp.C
|
||||
@ -106,6 +107,7 @@ primitives/functions/Function1/Table/TableReader/makeTableReaders.C
|
||||
primitives/functions/Function1/unknownTypeFunction1/unknownTypeFunction1.C
|
||||
primitives/functions/Function1/omega1/omega1.C
|
||||
|
||||
primitives/functions/Function2/Function2/Function2UnitConversions.C
|
||||
primitives/functions/Function2/makeFunction2s.C
|
||||
|
||||
primitives/subModelBase/subModelBase.C
|
||||
@ -303,9 +305,15 @@ $(userTime)/userTime/userTimeNew.C
|
||||
$(userTime)/realTime/realTime.C
|
||||
$(userTime)/engineTime/engineTime.C
|
||||
|
||||
symbols/symbols.C
|
||||
dimensionSet/dimensionSet.C
|
||||
dimensionSet/dimensionSetIO.C
|
||||
dimensionSet/dimensionSets.C
|
||||
unitConversion/unitConversion.C
|
||||
unitConversion/unitConversionIO.C
|
||||
unitConversion/unitConversions.C
|
||||
unitConversion/namedUnitConversion.C
|
||||
unitConversion/namedUnitConversionIO.C
|
||||
dimensionedTypes/dimensionedScalar/dimensionedScalar.C
|
||||
dimensionedTypes/dimensionedSphericalTensor/dimensionedSphericalTensor.C
|
||||
dimensionedTypes/dimensionedSymmTensor/dimensionedSymmTensor.C
|
||||
|
||||
@ -118,8 +118,7 @@ void Foam::Time::setControls()
|
||||
|
||||
if (startFrom == "startTime")
|
||||
{
|
||||
controlDict_.lookup("startTime") >> startTime_;
|
||||
startTime_ = userTimeToTime(startTime_);
|
||||
startTime_ = controlDict_.lookup<scalar>("startTime", userUnits());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -242,11 +241,11 @@ void Foam::Time::setControls()
|
||||
|
||||
if (controlDict_.found("beginTime"))
|
||||
{
|
||||
beginTime_ = userTimeToTime(controlDict_.lookup<scalar>("beginTime"));
|
||||
beginTime_ = controlDict_.lookup<scalar>("beginTime", userUnits());
|
||||
}
|
||||
else if (timeDict.found("beginTime"))
|
||||
{
|
||||
beginTime_ = userTimeToTime(timeDict.lookup<scalar>("beginTime"));
|
||||
beginTime_ = timeDict.lookup<scalar>("beginTime", userUnits());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -259,7 +258,7 @@ void Foam::Time::setControls()
|
||||
{
|
||||
if (timeDict.found("deltaT"))
|
||||
{
|
||||
deltaT_ = userTimeToTime(timeDict.lookup<scalar>("deltaT"));
|
||||
deltaT_ = timeDict.lookup<scalar>("deltaT", userUnits());
|
||||
deltaTSave_ = deltaT_;
|
||||
deltaT0_ = deltaT_;
|
||||
}
|
||||
@ -267,7 +266,7 @@ void Foam::Time::setControls()
|
||||
|
||||
if (timeDict.found("deltaT0"))
|
||||
{
|
||||
deltaT0_ = userTimeToTime(timeDict.lookup<scalar>("deltaT0"));
|
||||
deltaT0_ = timeDict.lookup<scalar>("deltaT0", userUnits());
|
||||
}
|
||||
|
||||
if (timeDict.readIfPresent("index", startTimeIndex_))
|
||||
@ -414,7 +413,8 @@ Foam::Time::Time
|
||||
"OptimisationSwitches",
|
||||
"DebugSwitches",
|
||||
"DimensionedConstants",
|
||||
"DimensionSets"
|
||||
"DimensionSets",
|
||||
"UnitConversions"
|
||||
}
|
||||
);
|
||||
|
||||
@ -680,6 +680,7 @@ Foam::word Foam::Time::findInstance
|
||||
stopInstance
|
||||
)
|
||||
);
|
||||
|
||||
return io.instance();
|
||||
}
|
||||
|
||||
@ -860,11 +861,37 @@ Foam::word Foam::Time::userTimeName() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return timeName(userTimeValue()) + userTime_->unit();
|
||||
return timeName(userTimeValue()) + userTime_->unitName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const Foam::unitConversion& Foam::Time::userUnits() const
|
||||
{
|
||||
return userTime_->units();
|
||||
}
|
||||
|
||||
|
||||
const Foam::unitConversion& Foam::Time::writeIntervalUnits() const
|
||||
{
|
||||
static const unitConversion unitSeconds(dimTime);
|
||||
|
||||
switch (writeControl_)
|
||||
{
|
||||
case writeControl::timeStep:
|
||||
return unitless;
|
||||
case writeControl::runTime:
|
||||
case writeControl::adjustableRunTime:
|
||||
return userUnits();
|
||||
case writeControl::cpuTime:
|
||||
case writeControl::clockTime:
|
||||
return unitSeconds;
|
||||
}
|
||||
|
||||
return unitNone;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::Time::running() const
|
||||
{
|
||||
return value() < (endTime_ - 0.5*deltaT_);
|
||||
@ -986,12 +1013,12 @@ void Foam::Time::setTime(const instant& inst, const label newIndex)
|
||||
|
||||
if (timeDict.found("deltaT"))
|
||||
{
|
||||
deltaT_ = userTimeToTime(timeDict.lookup<scalar>("deltaT"));
|
||||
deltaT_ = timeDict.lookup<scalar>("deltaT", userUnits());
|
||||
}
|
||||
|
||||
if (timeDict.found("deltaT0"))
|
||||
{
|
||||
deltaT0_ = userTimeToTime(timeDict.lookup<scalar>("deltaT0"));
|
||||
deltaT0_ = timeDict.lookup<scalar>("deltaT0", userUnits());
|
||||
}
|
||||
|
||||
timeDict.readIfPresent("index", timeIndex_);
|
||||
|
||||
@ -423,6 +423,12 @@ public:
|
||||
//- Return current user time name with units
|
||||
word userTimeName() const;
|
||||
|
||||
//- Return the user-time unit conversion
|
||||
const unitConversion& userUnits() const;
|
||||
|
||||
//- Return the write interval units
|
||||
const unitConversion& writeIntervalUnits() const;
|
||||
|
||||
//- Return the list of function objects
|
||||
const functionObjectList& functionObjects() const
|
||||
{
|
||||
|
||||
@ -40,7 +40,7 @@ void Foam::Time::readDict()
|
||||
|
||||
if (!deltaTchanged_)
|
||||
{
|
||||
deltaT_ = userTimeToTime(controlDict_.lookup<scalar>("deltaT"));
|
||||
deltaT_ = controlDict_.lookup<scalar>("deltaT", userUnits());
|
||||
}
|
||||
|
||||
if (controlDict_.found("writeControl"))
|
||||
@ -51,18 +51,12 @@ void Foam::Time::readDict()
|
||||
);
|
||||
}
|
||||
|
||||
scalar newWriteInterval = writeInterval_;
|
||||
|
||||
if (controlDict_.readIfPresent("writeInterval", newWriteInterval))
|
||||
{
|
||||
if
|
||||
const scalar newWriteInterval =
|
||||
controlDict_.lookupBackwardsCompatible<scalar>
|
||||
(
|
||||
writeControl_ == writeControl::runTime
|
||||
|| writeControl_ == writeControl::adjustableRunTime
|
||||
)
|
||||
{
|
||||
newWriteInterval = userTimeToTime(newWriteInterval);
|
||||
}
|
||||
{"writeInterval", "writeFrequency"},
|
||||
writeIntervalUnits()
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
@ -74,11 +68,6 @@ void Foam::Time::readDict()
|
||||
<< "writeInterval < 1 for writeControl timeStep"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
controlDict_.lookup("writeFrequency") >> newWriteInterval;
|
||||
}
|
||||
|
||||
setWriteInterval(newWriteInterval);
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ Foam::userTimes::engine::engine(const dictionary& controlDict)
|
||||
userTime(controlDict),
|
||||
omega_(dict(controlDict))
|
||||
{
|
||||
addUnit(dimensionedScalar(unit(), dimTime, userTimeToTime(1)));
|
||||
addUnits(unitName(), unitConversion(dimTime, 0, 0, userTimeToTime(1)));
|
||||
}
|
||||
|
||||
|
||||
@ -73,16 +73,22 @@ Foam::scalar Foam::userTimes::engine::timeToUserTime(const scalar t) const
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::userTimes::engine::unit() const
|
||||
Foam::word Foam::userTimes::engine::unitName() const
|
||||
{
|
||||
return "CAD";
|
||||
}
|
||||
|
||||
|
||||
const Foam::unitConversion& Foam::userTimes::engine::units() const
|
||||
{
|
||||
return Foam::units()[unitName()];
|
||||
}
|
||||
|
||||
|
||||
bool Foam::userTimes::engine::read(const dictionary& controlDict)
|
||||
{
|
||||
omega_ = omega(dict(controlDict));
|
||||
addUnit(dimensionedScalar(unit(), dimTime, userTimeToTime(1)));
|
||||
addUnits(unitName(), unitConversion(dimTime, 0, 0, userTimeToTime(1)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -83,8 +83,11 @@ public:
|
||||
//- Return the time t in crank-angle
|
||||
virtual scalar timeToUserTime(const scalar t) const;
|
||||
|
||||
//- Return real-time unit (s)
|
||||
virtual word unit() const;
|
||||
//- Return engine-time unit name (CAD)
|
||||
virtual word unitName() const;
|
||||
|
||||
//- Return the engine-time unit conversion
|
||||
virtual const unitConversion& units() const;
|
||||
|
||||
//- Read the controlDict and set all the parameters
|
||||
virtual bool read(const dictionary& controlDict);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -66,12 +66,19 @@ Foam::scalar Foam::userTimes::real::timeToUserTime(const scalar t) const
|
||||
}
|
||||
|
||||
|
||||
Foam::word Foam::userTimes::real::unit() const
|
||||
Foam::word Foam::userTimes::real::unitName() const
|
||||
{
|
||||
return "s";
|
||||
}
|
||||
|
||||
|
||||
const Foam::unitConversion& Foam::userTimes::real::units() const
|
||||
{
|
||||
static const unitConversion unitSeconds(dimTime, 0, 0, 1);
|
||||
return unitSeconds;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::userTimes::real::read(const dictionary& controlDict)
|
||||
{
|
||||
return true;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define realTime_H
|
||||
|
||||
#include "userTime.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,7 +53,6 @@ class real
|
||||
:
|
||||
public userTime
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -77,8 +77,11 @@ public:
|
||||
//- Return t (s)
|
||||
virtual scalar timeToUserTime(const scalar t) const;
|
||||
|
||||
//- Return real-time unit (s)
|
||||
virtual word unit() const;
|
||||
//- Return real-time unit name (s)
|
||||
virtual word unitName() const;
|
||||
|
||||
//- Return the real-time unit conversion
|
||||
virtual const unitConversion& units() const;
|
||||
|
||||
//- Read the controlDict and set all the parameters
|
||||
virtual bool read(const dictionary& controlDict);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -96,7 +96,10 @@ public:
|
||||
virtual scalar timeToUserTime(const scalar t) const = 0;
|
||||
|
||||
//- Return user-time unit
|
||||
virtual word unit() const = 0;
|
||||
virtual word unitName() const = 0;
|
||||
|
||||
//- Return the user-time unit conversion
|
||||
virtual const unitConversion& units() const = 0;
|
||||
|
||||
//- Read the controlDict and set all the parameters
|
||||
virtual bool read(const dictionary& controlDict) = 0;
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "dictionaryEntry.H"
|
||||
#include "regExp.H"
|
||||
#include "OSHA1stream.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||
|
||||
@ -237,6 +238,83 @@ bool Foam::dictionary::findInPatterns
|
||||
}
|
||||
|
||||
|
||||
void Foam::dictionary::assertNoConvertUnits
|
||||
(
|
||||
const char* typeName,
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
ITstream& is
|
||||
) const
|
||||
{
|
||||
if (!defaultUnits.standard())
|
||||
{
|
||||
FatalIOErrorInFunction(is)
|
||||
<< "Unit conversions are not supported when reading "
|
||||
<< typeName << " types" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::readTypeAndConvertUnits
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
ITstream& is
|
||||
) const
|
||||
{
|
||||
// Read the units if they are before the value
|
||||
unitConversion units(defaultUnits);
|
||||
const bool haveUnits = units.readIfPresent(keyword, *this, is);
|
||||
|
||||
// Read the value
|
||||
T value = pTraits<T>(is);
|
||||
|
||||
// Read the units if they are after the value
|
||||
if (!haveUnits && !is.eof())
|
||||
{
|
||||
units.readIfPresent(keyword, *this, is);
|
||||
}
|
||||
|
||||
// Modify the value by the unit conversion
|
||||
units.makeStandard(value);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
#define IMPLEMENT_SPECIALISED_READ_TYPE(T, nullArg) \
|
||||
\
|
||||
template<> \
|
||||
Foam::T Foam::dictionary::readType \
|
||||
( \
|
||||
const word& keyword, \
|
||||
const unitConversion& defaultUnits, \
|
||||
ITstream& is \
|
||||
) const \
|
||||
{ \
|
||||
return readTypeAndConvertUnits<T>(keyword, defaultUnits, is); \
|
||||
} \
|
||||
\
|
||||
template<> \
|
||||
Foam::T Foam::dictionary::readType \
|
||||
( \
|
||||
const word& keyword, \
|
||||
ITstream& is \
|
||||
) const \
|
||||
{ \
|
||||
return readTypeAndConvertUnits<T>(keyword, unitAny, is); \
|
||||
}
|
||||
|
||||
#define IMPLEMENT_SPECIALISED_READ_LIST_TYPE(T, nullArg) \
|
||||
IMPLEMENT_SPECIALISED_READ_TYPE(List<Foam::T>, nullArg)
|
||||
|
||||
FOR_ALL_FIELD_TYPES(IMPLEMENT_SPECIALISED_READ_TYPE)
|
||||
FOR_ALL_FIELD_TYPES(IMPLEMENT_SPECIALISED_READ_LIST_TYPE)
|
||||
|
||||
#undef IMPLEMENT_SPECIALISED_READ_TYPE
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dictionary::dictionary()
|
||||
|
||||
@ -58,6 +58,7 @@ SourceFiles
|
||||
#include "wordReList.H"
|
||||
#include "Pair.H"
|
||||
#include "className.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -65,9 +66,10 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
class regExp;
|
||||
class dictionary;
|
||||
class regExp;
|
||||
class SHA1Digest;
|
||||
class unitConversion;
|
||||
|
||||
Istream& operator>>(Istream&, dictionary&);
|
||||
Ostream& operator<<(Ostream&, const dictionary&);
|
||||
@ -204,6 +206,37 @@ class dictionary
|
||||
DLList<autoPtr<regExp>>::iterator& reLink
|
||||
);
|
||||
|
||||
//- Check that no unit conversions are being performed
|
||||
void assertNoConvertUnits
|
||||
(
|
||||
const char* typeName,
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
ITstream& is
|
||||
) const;
|
||||
|
||||
//- Read a value, check its dimensions and convert its units
|
||||
template<class T>
|
||||
T readTypeAndConvertUnits
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
ITstream& is
|
||||
) const;
|
||||
|
||||
//- Read a value from the token stream
|
||||
template<class T>
|
||||
T readType
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
ITstream& is
|
||||
) const;
|
||||
|
||||
//- Read a value from the token stream
|
||||
template<class T>
|
||||
T readType(const word& keyword, ITstream& is) const;
|
||||
|
||||
|
||||
// Private Classes
|
||||
|
||||
@ -420,8 +453,7 @@ public:
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T,
|
||||
// if not found throw a fatal error.
|
||||
//- Find and return a T, if not found throw a fatal error.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
@ -432,8 +464,22 @@ public:
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, trying a list of keywords in sequence
|
||||
// if not found throw a fatal error relating to the first keyword
|
||||
//- Find and return a T, with dimension checking and unit
|
||||
// conversions, and if not found throw a fatal error.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
T lookup
|
||||
(
|
||||
const word&,
|
||||
const unitConversion&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, trying a list of keywords in sequence,
|
||||
// and if not found throw a fatal error relating to the first
|
||||
// (preferred) keyword.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
@ -444,8 +490,23 @@ public:
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T,
|
||||
// if not found return the given default value.
|
||||
//- Find and return a T, with dimension checking and unit
|
||||
// conversions, trying a list of keywords in sequence, and if not
|
||||
// found throw a fatal error relating to the first (preferred)
|
||||
// keyword.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
T lookupBackwardsCompatible
|
||||
(
|
||||
const wordList&,
|
||||
const unitConversion&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, if not found return the given default
|
||||
// value.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
@ -457,8 +518,23 @@ public:
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, trying a list of keywords in sequence
|
||||
// if not found throw a fatal error relating to the first keyword
|
||||
//- Find and return a T with dimension checking and unit
|
||||
// conversions, and if not found return the given default value.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
T lookupOrDefault
|
||||
(
|
||||
const word&,
|
||||
const unitConversion&,
|
||||
const T&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, trying a list of keywords in sequence,
|
||||
// and if not found throw a fatal error relating to the first
|
||||
// (preferred) keyword
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
@ -470,6 +546,22 @@ public:
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, with dimension checking and unit
|
||||
// conversions, trying a list of keywords in sequence, and if not
|
||||
// found throw a fatal error relating to the first (preferred)
|
||||
// keyword
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
T lookupOrDefaultBackwardsCompatible
|
||||
(
|
||||
const wordList&,
|
||||
const unitConversion&,
|
||||
const T&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return a T, if not found return the given
|
||||
// default value, and add to dictionary.
|
||||
// If recursive, search parent dictionaries.
|
||||
@ -483,7 +575,7 @@ public:
|
||||
bool patternMatch=true
|
||||
);
|
||||
|
||||
//- Find an entry if present, and assign to T
|
||||
//- Find an entry if present, and assign to T.
|
||||
// Returns true if the entry was found.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
@ -496,6 +588,21 @@ public:
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find an entry if present, and assign to T, with dimension
|
||||
// checking and unit conversions.
|
||||
// Returns true if the entry was found.
|
||||
// If recursive, search parent dictionaries.
|
||||
// If patternMatch, use regular expressions.
|
||||
template<class T>
|
||||
bool readIfPresent
|
||||
(
|
||||
const word&,
|
||||
const unitConversion&,
|
||||
T&,
|
||||
bool recursive=false,
|
||||
bool patternMatch=true
|
||||
) const;
|
||||
|
||||
//- Find and return an entry data stream pointer if present,
|
||||
// otherwise return nullptr.
|
||||
// If recursive, search parent dictionaries.
|
||||
@ -768,6 +875,36 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// Template Specialisations
|
||||
|
||||
//- Specialise readType for types for which unit conversions can be performed
|
||||
#define DECLARE_SPECIALISED_READ_TYPE(T, nullArg) \
|
||||
\
|
||||
template<> \
|
||||
T Foam::dictionary::readType \
|
||||
( \
|
||||
const word& keyword, \
|
||||
const unitConversion& defaultUnits, \
|
||||
ITstream& is \
|
||||
) const; \
|
||||
\
|
||||
template<> \
|
||||
T Foam::dictionary::readType \
|
||||
( \
|
||||
const word& keyword, \
|
||||
ITstream& is \
|
||||
) const;
|
||||
|
||||
#define DECLARE_SPECIALISED_READ_LIST_TYPE(T, nullArg) \
|
||||
DECLARE_SPECIALISED_READ_TYPE(List<T>, nullArg)
|
||||
|
||||
FOR_ALL_FIELD_TYPES(DECLARE_SPECIALISED_READ_TYPE);
|
||||
FOR_ALL_FIELD_TYPES(DECLARE_SPECIALISED_READ_LIST_TYPE);
|
||||
|
||||
#undef DECLARE_SPECIALISED_READ_TYPE
|
||||
#undef DECLARE_SPECIALISED_READ_FIELD_TYPE
|
||||
|
||||
|
||||
// Global Operators
|
||||
|
||||
//- Combine dictionaries.
|
||||
@ -888,6 +1025,16 @@ void writeEntry(Ostream& os, const dictionary& dict);
|
||||
template<class EntryType>
|
||||
void writeEntry(Ostream& os, const word& entryName, const EntryType& value);
|
||||
|
||||
//- Helper function to write the keyword and entry
|
||||
template<class EntryType>
|
||||
void writeEntry
|
||||
(
|
||||
Ostream& os,
|
||||
const word& entryName,
|
||||
const unitConversion& defaultUnits,
|
||||
const EntryType& value
|
||||
);
|
||||
|
||||
//- Helper function to write the keyword and entry only if the
|
||||
// values are not equal. The value is then output as value2
|
||||
template<class EntryType>
|
||||
@ -899,6 +1046,18 @@ void writeEntryIfDifferent
|
||||
const EntryType& value2
|
||||
);
|
||||
|
||||
//- Helper function to write the keyword and entry only if the
|
||||
// values are not equal. The value is then output as value2
|
||||
template<class EntryType>
|
||||
void writeEntryIfDifferent
|
||||
(
|
||||
Ostream& os,
|
||||
const word& entryName,
|
||||
const unitConversion& defaultUnits,
|
||||
const EntryType& value1,
|
||||
const EntryType& value2
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -26,6 +26,29 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "primitiveEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::readType
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
ITstream& is
|
||||
) const
|
||||
{
|
||||
assertNoConvertUnits(pTraits<T>::typeName, keyword, defaultUnits, is);
|
||||
|
||||
return pTraits<T>(is);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::readType(const word& keyword, ITstream& is) const
|
||||
{
|
||||
return pTraits<T>(is);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class ... KeysAndTs>
|
||||
@ -72,15 +95,34 @@ T Foam::dictionary::lookup
|
||||
|
||||
if (entryPtr == nullptr)
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
*this
|
||||
) << "keyword " << keyword << " is undefined in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "keyword " << keyword << " is undefined in dictionary "
|
||||
<< name() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
return readType<T>(keyword, entryPtr->stream());
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::lookup
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
|
||||
if (entryPtr == nullptr)
|
||||
{
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "keyword " << keyword << " is undefined in dictionary "
|
||||
<< name() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return readType<T>(keyword, defaultUnits, entryPtr->stream());
|
||||
}
|
||||
|
||||
|
||||
@ -97,7 +139,32 @@ T Foam::dictionary::lookupBackwardsCompatible
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
return readType<T>(entryPtr->keyword(), entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate error message using the first keyword
|
||||
return lookup<T>(keywords[0], recursive, patternMatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::lookupBackwardsCompatible
|
||||
(
|
||||
const wordList& keywords,
|
||||
const unitConversion& defaultUnits,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr =
|
||||
lookupEntryPtrBackwardsCompatible(keywords, recursive, patternMatch);
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return
|
||||
readType<T>(entryPtr->keyword(), defaultUnits, entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -120,7 +187,38 @@ T Foam::dictionary::lookupOrDefault
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
return readType<T>(keyword, entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (writeOptionalEntries)
|
||||
{
|
||||
IOInfoInFunction(*this)
|
||||
<< "Optional entry '" << keyword << "' is not present,"
|
||||
<< " returning the default value '" << deflt << "'"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return deflt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::lookupOrDefault
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
const T& deflt,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return readType<T>(keyword, defaultUnits, entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -151,7 +249,33 @@ T Foam::dictionary::lookupOrDefaultBackwardsCompatible
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
return readType<T>(entryPtr->keyword(), entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Generate debugging messages using the first keyword
|
||||
return lookupOrDefault<T>(keywords[0], deflt, recursive, patternMatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
T Foam::dictionary::lookupOrDefaultBackwardsCompatible
|
||||
(
|
||||
const wordList& keywords,
|
||||
const unitConversion& defaultUnits,
|
||||
const T& deflt,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr =
|
||||
lookupEntryPtrBackwardsCompatible(keywords, recursive, patternMatch);
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return
|
||||
readType<T>(entryPtr->keyword(), defaultUnits, entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -174,7 +298,7 @@ T Foam::dictionary::lookupOrAddDefault
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
return readType<T>(keyword, entryPtr->stream());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -205,7 +329,39 @@ bool Foam::dictionary::readIfPresent
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
entryPtr->stream() >> val;
|
||||
val = readType<T>(keyword, entryPtr->stream());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (writeOptionalEntries)
|
||||
{
|
||||
IOInfoInFunction(*this)
|
||||
<< "Optional entry '" << keyword << "' is not present,"
|
||||
<< " the default value '" << val << "' will be used."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
bool Foam::dictionary::readIfPresent
|
||||
(
|
||||
const word& keyword,
|
||||
const unitConversion& defaultUnits,
|
||||
T& val,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
|
||||
|
||||
if (entryPtr)
|
||||
{
|
||||
val = readType<T>(keyword, defaultUnits, entryPtr->stream());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -236,12 +392,9 @@ T Foam::dictionary::lookupScoped
|
||||
|
||||
if (entryPtr == nullptr)
|
||||
{
|
||||
FatalIOErrorInFunction
|
||||
(
|
||||
*this
|
||||
) << "keyword " << keyword << " is undefined in dictionary "
|
||||
<< name()
|
||||
<< exit(FatalIOError);
|
||||
FatalIOErrorInFunction(*this)
|
||||
<< "keyword " << keyword << " is undefined in dictionary "
|
||||
<< name() << exit(FatalIOError);
|
||||
}
|
||||
|
||||
return pTraits<T>(entryPtr->stream());
|
||||
@ -318,6 +471,21 @@ void Foam::writeEntry
|
||||
}
|
||||
|
||||
|
||||
template<class EntryType>
|
||||
void Foam::writeEntry
|
||||
(
|
||||
Ostream& os,
|
||||
const word& entryName,
|
||||
const unitConversion& defaultUnits,
|
||||
const EntryType& value
|
||||
)
|
||||
{
|
||||
writeKeyword(os, entryName);
|
||||
writeEntry(os, defaultUnits, value);
|
||||
os << token::END_STATEMENT << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class EntryType>
|
||||
void Foam::writeEntryIfDifferent
|
||||
(
|
||||
@ -334,4 +502,21 @@ void Foam::writeEntryIfDifferent
|
||||
}
|
||||
|
||||
|
||||
template<class EntryType>
|
||||
void Foam::writeEntryIfDifferent
|
||||
(
|
||||
Ostream& os,
|
||||
const word& entryName,
|
||||
const unitConversion& defaultUnits,
|
||||
const EntryType& value1,
|
||||
const EntryType& value2
|
||||
)
|
||||
{
|
||||
if (value1 != value2)
|
||||
{
|
||||
writeEntry(os, entryName, defaultUnits, value2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2024 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -127,7 +127,7 @@ void Foam::timeControl::read(const dictionary& dict)
|
||||
case timeControls::cpuTime:
|
||||
case timeControls::adjustableRunTime:
|
||||
{
|
||||
interval_ = time_.userTimeToTime(dict.lookup<scalar>(intervalName));
|
||||
interval_ = dict.lookup<scalar>(intervalName, time_.userUnits());
|
||||
|
||||
if (timeControl_ == timeControls::adjustableRunTime)
|
||||
{
|
||||
@ -150,15 +150,17 @@ void Foam::timeControl::read(const dictionary& dict)
|
||||
const word frequenciesName(prefix_ + "Frequencies");
|
||||
const bool repeat = dict.lookupOrDefault("writeRepeat", false);
|
||||
|
||||
timeDelta_ = dict.lookupOrDefault
|
||||
timeDelta_ =
|
||||
dict.lookupOrDefault
|
||||
(
|
||||
"timeDelta",
|
||||
1e-3*time_.deltaTValue()
|
||||
unitNone,
|
||||
1e-3*time_.userDeltaTValue()
|
||||
);
|
||||
|
||||
if (dict.found(timesName))
|
||||
{
|
||||
times_ = dict.lookup<scalarList>(timesName);
|
||||
times_ = dict.lookup<scalarList>(timesName, unitNone);
|
||||
}
|
||||
else if (dict.found(frequenciesName))
|
||||
{
|
||||
|
||||
@ -44,17 +44,8 @@ namespace functionObjects
|
||||
|
||||
void Foam::functionObjects::timeControl::readControls(const dictionary& dict)
|
||||
{
|
||||
if (!dict.readIfPresent("startTime", startTime_))
|
||||
{
|
||||
dict.readIfPresent("timeStart", startTime_);
|
||||
}
|
||||
startTime_ = time_.userTimeToTime(startTime_);
|
||||
|
||||
if (!dict.readIfPresent("endTime", endTime_))
|
||||
{
|
||||
dict.readIfPresent("timeEnd", endTime_);
|
||||
}
|
||||
endTime_ = time_.userTimeToTime(endTime_);
|
||||
dict.readIfPresent("startTime", time().userUnits(), startTime_);
|
||||
dict.readIfPresent("endTime", time().userUnits(), endTime_);
|
||||
}
|
||||
|
||||
|
||||
@ -83,10 +74,9 @@ Foam::functionObjects::timeControl::timeControl
|
||||
writeControl_(t, dict, "write"),
|
||||
foPtr_(functionObject::New(name, t, dict))
|
||||
{
|
||||
readControls(dict);
|
||||
writeControl_.read(dict);
|
||||
executeControl_.read(dict);
|
||||
|
||||
readControls(dict);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user