mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
MRG: Integrated Foundation code to commit 9f37c3c
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,7 +24,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "solidRegionDiffNo.H"
|
#include "solidRegionDiffNo.H"
|
||||||
#include "fvc.H"
|
#include "surfaceInterpolate.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::scalar Foam::solidRegionDiffNo
|
Foam::scalar Foam::solidRegionDiffNo
|
||||||
(
|
(
|
||||||
@ -34,21 +36,16 @@ Foam::scalar Foam::solidRegionDiffNo
|
|||||||
const volScalarField& kappa
|
const volScalarField& kappa
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalar DiNum = 0.0;
|
|
||||||
scalar meanDiNum = 0.0;
|
|
||||||
|
|
||||||
//- Take care: can have fluid domains with 0 cells so do not test for
|
|
||||||
// zero internal faces.
|
|
||||||
surfaceScalarField kapparhoCpbyDelta
|
surfaceScalarField kapparhoCpbyDelta
|
||||||
(
|
(
|
||||||
mesh.surfaceInterpolation::deltaCoeffs()
|
sqr(mesh.surfaceInterpolation::deltaCoeffs())
|
||||||
* fvc::interpolate(kappa)
|
*fvc::interpolate(kappa)
|
||||||
/ fvc::interpolate(Cprho)
|
/fvc::interpolate(Cprho)
|
||||||
);
|
);
|
||||||
|
|
||||||
DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaT().value();
|
const scalar DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaTValue();
|
||||||
|
const scalar meanDiNum =
|
||||||
meanDiNum = (average(kapparhoCpbyDelta)).value()*runTime.deltaT().value();
|
average(kapparhoCpbyDelta).value()*runTime.deltaTValue();
|
||||||
|
|
||||||
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
|
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
|
||||||
<< " max: " << DiNum << endl;
|
<< " max: " << DiNum << endl;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -131,6 +131,22 @@ void Foam::phaseSystem::generatePairsAndSubModels
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!phasePairs_.found(key))
|
||||||
|
{
|
||||||
|
phasePairs_.insert
|
||||||
|
(
|
||||||
|
key,
|
||||||
|
autoPtr<phasePair>
|
||||||
|
(
|
||||||
|
new phasePair
|
||||||
|
(
|
||||||
|
phaseModels_[key.first()],
|
||||||
|
phaseModels_[key.second()]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,5 +3,5 @@ tmp<surfaceScalarField> tddtPhi2;
|
|||||||
|
|
||||||
if (faceMomentum)
|
if (faceMomentum)
|
||||||
{
|
{
|
||||||
#include "DDtU.H"
|
#include "pUf/DDtU.H"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@ Usage
|
|||||||
value uniform 0.01;
|
value uniform 0.01;
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
SeeAlso
|
See also
|
||||||
Foam::alphatPhaseChangeJayatillekeWallFunctionFvPatchField
|
Foam::alphatPhaseChangeJayatillekeWallFunctionFvPatchField
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
|
|||||||
3
applications/test/cubicEqn/Make/files
Normal file
3
applications/test/cubicEqn/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Test-cubicEqn.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/Test-cubicEqn
|
||||||
3
applications/test/cubicEqn/Make/options
Normal file
3
applications/test/cubicEqn/Make/options
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
EXE_INC =
|
||||||
|
|
||||||
|
EXE_LIBS =
|
||||||
101
applications/test/cubicEqn/Test-cubicEqn.C
Normal file
101
applications/test/cubicEqn/Test-cubicEqn.C
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#include <ctime>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
|
#include "cubicEqn.H"
|
||||||
|
#include "IOstreams.H"
|
||||||
|
#include "stringList.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
scalar randomScalar(const scalar min, const scalar max)
|
||||||
|
{
|
||||||
|
static_assert
|
||||||
|
(
|
||||||
|
sizeof(long) == sizeof(scalar),
|
||||||
|
"Scalar and long are not the same size"
|
||||||
|
);
|
||||||
|
static std::default_random_engine generator(std::time(0));
|
||||||
|
static std::uniform_int_distribution<long>
|
||||||
|
distribution
|
||||||
|
(
|
||||||
|
std::numeric_limits<long>::min(),
|
||||||
|
std::numeric_limits<long>::max()
|
||||||
|
);
|
||||||
|
scalar x;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
long i = distribution(generator);
|
||||||
|
x = reinterpret_cast<scalar&>(i);
|
||||||
|
}
|
||||||
|
while (min > mag(x) || mag(x) > max || !std::isfinite(x));
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
void test(const Type& polynomialEqn, const scalar tol)
|
||||||
|
{
|
||||||
|
Roots<Type::nComponents - 1> r = polynomialEqn.roots();
|
||||||
|
|
||||||
|
const scalar nan = std::numeric_limits<scalar>::quiet_NaN();
|
||||||
|
const scalar inf = std::numeric_limits<scalar>::infinity();
|
||||||
|
|
||||||
|
FixedList<label, Type::nComponents - 1> t;
|
||||||
|
FixedList<scalar, Type::nComponents - 1> v(nan);
|
||||||
|
FixedList<scalar, Type::nComponents - 1> e(nan);
|
||||||
|
bool ok = true;
|
||||||
|
forAll(r, i)
|
||||||
|
{
|
||||||
|
t[i] = r.type(i);
|
||||||
|
switch (t[i])
|
||||||
|
{
|
||||||
|
case roots::real:
|
||||||
|
v[i] = polynomialEqn.value(r[i]);
|
||||||
|
e[i] = polynomialEqn.error(r[i]);
|
||||||
|
ok = ok && mag(v[i]) < tol*mag(e[i]);
|
||||||
|
break;
|
||||||
|
case roots::posInf:
|
||||||
|
v[i] = + inf;
|
||||||
|
e[i] = nan;
|
||||||
|
break;
|
||||||
|
case roots::negInf:
|
||||||
|
v[i] = - inf;
|
||||||
|
e[i] = nan;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
v[i] = e[i] = nan;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
Info<< "Coeffs: " << polynomialEqn << endl
|
||||||
|
<< " Types: " << t << endl
|
||||||
|
<< " Roots: " << r << endl
|
||||||
|
<< "Values: " << v << endl
|
||||||
|
<< "Errors: " << e << endl << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
const int nTests = 1000000;
|
||||||
|
for (int t = 0; t < nTests; ++ t)
|
||||||
|
{
|
||||||
|
test
|
||||||
|
(
|
||||||
|
cubicEqn
|
||||||
|
(
|
||||||
|
randomScalar(1e-50, 1e+50),
|
||||||
|
randomScalar(1e-50, 1e+50),
|
||||||
|
randomScalar(1e-50, 1e+50),
|
||||||
|
randomScalar(1e-50, 1e+50)
|
||||||
|
),
|
||||||
|
100
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info << nTests << " cubics tested" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@ -241,14 +241,8 @@ tmp<volScalarField> calcNut
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Hack to correct nut
|
// Correct nut
|
||||||
// Note: in previous versions of the code, nut was initialised on
|
turbulence->validate();
|
||||||
// construction of the turbulence model. This is no longer the
|
|
||||||
// case for the Templated Turbulence models. The call to correct
|
|
||||||
// below will evolve the turbulence model equations and update nut,
|
|
||||||
// whereas only nut update is required. Need to revisit.
|
|
||||||
// turbulence->correct();
|
|
||||||
turbulence->correctEnergyTransport();
|
|
||||||
|
|
||||||
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
|
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,7 @@ if [ "$FMT" = "webm" ] ; then
|
|||||||
if command -v avconv >/dev/null 2>&1 ; then
|
if command -v avconv >/dev/null 2>&1 ; then
|
||||||
echo "Creating image with avconv..."
|
echo "Creating image with avconv..."
|
||||||
avconv \
|
avconv \
|
||||||
-r $FPS \
|
-framerate $FPS \
|
||||||
$START_NUMBER \
|
$START_NUMBER \
|
||||||
-i ${DIR}/${IMAGE}.%04d.png \
|
-i ${DIR}/${IMAGE}.%04d.png \
|
||||||
-c:v libvpx -crf 15 -b:v 1M \
|
-c:v libvpx -crf 15 -b:v 1M \
|
||||||
@ -134,7 +134,7 @@ else
|
|||||||
if command -v avconv >/dev/null 2>&1 ; then
|
if command -v avconv >/dev/null 2>&1 ; then
|
||||||
echo "Creating image with avconv..."
|
echo "Creating image with avconv..."
|
||||||
avconv \
|
avconv \
|
||||||
-r $FPS \
|
-framerate $FPS \
|
||||||
$START_NUMBER \
|
$START_NUMBER \
|
||||||
-i ${DIR}/${IMAGE}.%04d.png \
|
-i ${DIR}/${IMAGE}.%04d.png \
|
||||||
-c:v libx264 -pix_fmt yuv420p \
|
-c:v libx264 -pix_fmt yuv420p \
|
||||||
|
|||||||
@ -33,7 +33,7 @@ cuttingPlane
|
|||||||
|
|
||||||
isosurface
|
isosurface
|
||||||
{
|
{
|
||||||
type isoSurface;
|
type isoSurfaceCell;
|
||||||
interpolate true;
|
interpolate true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,11 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
dynamicFvMesh solidBodyMotionFvMesh;
|
dynamicFvMesh dynamicMotionSolverFvMesh;
|
||||||
|
|
||||||
solidBodyMotionFvMeshCoeffs
|
solver solidBody;
|
||||||
|
|
||||||
|
solidBodyCoeffs
|
||||||
{
|
{
|
||||||
cellZone rotatingZone;
|
cellZone rotatingZone;
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,11 @@ FoamFile
|
|||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
dynamicFvMesh solidBodyMotionFvMesh;
|
dynamicFvMesh dynamicMotionSolverFvMesh;
|
||||||
|
|
||||||
solidBodyMotionFvMeshCoeffs
|
solver solidBody;
|
||||||
|
|
||||||
|
solidBodyCoeffs
|
||||||
{
|
{
|
||||||
cellZone rotatingZone;
|
cellZone rotatingZone;
|
||||||
|
|
||||||
|
|||||||
@ -78,8 +78,14 @@ primitives/quaternion/quaternion.C
|
|||||||
primitives/septernion/septernion.C
|
primitives/septernion/septernion.C
|
||||||
primitives/triad/triad.C
|
primitives/triad/triad.C
|
||||||
|
|
||||||
/* functions, data entries */
|
/* Run-time selectable functions */
|
||||||
primitives/functions/Function1/makeDataEntries.C
|
primitives/functions/Function1/makeDataEntries.C
|
||||||
|
primitives/functions/Function1/ramp/ramp.C
|
||||||
|
primitives/functions/Function1/linearRamp/linearRamp.C
|
||||||
|
primitives/functions/Function1/quadraticRamp/quadraticRamp.C
|
||||||
|
primitives/functions/Function1/quarterSineRamp/quarterSineRamp.C
|
||||||
|
primitives/functions/Function1/quarterCosineRamp/quarterCosineRamp.C
|
||||||
|
primitives/functions/Function1/halfCosineRamp/halfCosineRamp.C
|
||||||
primitives/functions/Polynomial/polynomialFunction.C
|
primitives/functions/Polynomial/polynomialFunction.C
|
||||||
|
|
||||||
primitives/subModelBase/subModelBase.C
|
primitives/subModelBase/subModelBase.C
|
||||||
@ -122,6 +128,9 @@ $(spatialVectorAlgebra)/SpatialVector/spatialVector/spatialVector.C
|
|||||||
$(spatialVectorAlgebra)/SpatialTensor/spatialTensor/spatialTensor.C
|
$(spatialVectorAlgebra)/SpatialTensor/spatialTensor/spatialTensor.C
|
||||||
$(spatialVectorAlgebra)/CompactSpatialTensor/compactSpatialTensor/compactSpatialTensor.C
|
$(spatialVectorAlgebra)/CompactSpatialTensor/compactSpatialTensor/compactSpatialTensor.C
|
||||||
|
|
||||||
|
primitives/polynomialEqns/cubicEqn/cubicEqn.C
|
||||||
|
primitives/polynomialEqns/quadraticEqn/quadraticEqn.C
|
||||||
|
|
||||||
containers/HashTables/HashTable/HashTableCore.C
|
containers/HashTables/HashTable/HashTableCore.C
|
||||||
containers/HashTables/StaticHashTable/StaticHashTableCore.C
|
containers/HashTables/StaticHashTable/StaticHashTableCore.C
|
||||||
containers/Lists/SortableList/ParSortableListName.C
|
containers/Lists/SortableList/ParSortableListName.C
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "tensor.H"
|
#include "tensor.H"
|
||||||
|
#include "cubicEqn.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
using namespace Foam::constant::mathematical;
|
using namespace Foam::constant::mathematical;
|
||||||
@ -70,125 +71,65 @@ const Foam::tensor Foam::tensor::I
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::vector Foam::eigenValues(const tensor& T)
|
Foam::vector Foam::eigenValues(const tensor& t)
|
||||||
{
|
{
|
||||||
// The eigenvalues
|
// Coefficients of the characteristic cubic polynomial (a = 1)
|
||||||
scalar i, ii, iii;
|
const scalar b =
|
||||||
|
- t.xx() - t.yy() - t.zz();
|
||||||
|
const scalar c =
|
||||||
|
t.xx()*t.yy() + t.xx()*t.zz() + t.yy()*t.zz()
|
||||||
|
- t.xy()*t.yx() - t.yz()*t.zy() - t.zx()*t.xz();
|
||||||
|
const scalar d =
|
||||||
|
- t.xx()*t.yy()*t.zz()
|
||||||
|
- t.xy()*t.yz()*t.zx() - t.xz()*t.zy()*t.yx()
|
||||||
|
+ t.xx()*t.yz()*t.zy() + t.yy()*t.zx()*t.xz() + t.zz()*t.xy()*t.yx();
|
||||||
|
|
||||||
// diagonal matrix
|
// Solve
|
||||||
const scalar onDiagMagSum =
|
Roots<3> roots = cubicEqn(1, b, c, d).roots();
|
||||||
(
|
|
||||||
mag(T.xx()) + mag(T.yy()) + mag(T.zz())
|
|
||||||
);
|
|
||||||
|
|
||||||
const scalar offDiagMagSum =
|
// Check the root types
|
||||||
(
|
vector lambda = vector::zero;
|
||||||
mag(T.xy()) + mag(T.xz()) + mag(T.yx())
|
forAll(roots, i)
|
||||||
+ mag(T.yz()) + mag(T.zx()) + mag(T.zy())
|
|
||||||
);
|
|
||||||
|
|
||||||
const scalar magSum = onDiagMagSum + offDiagMagSum;
|
|
||||||
|
|
||||||
if (offDiagMagSum < max(VSMALL, SMALL*magSum))
|
|
||||||
{
|
{
|
||||||
i = T.xx();
|
switch (roots.type(i))
|
||||||
ii = T.yy();
|
|
||||||
iii = T.zz();
|
|
||||||
}
|
|
||||||
|
|
||||||
// non-diagonal matrix
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Coefficients of the characteristic polynmial
|
|
||||||
// x^3 + a*x^2 + b*x + c = 0
|
|
||||||
scalar a =
|
|
||||||
- T.xx() - T.yy() - T.zz();
|
|
||||||
|
|
||||||
scalar b =
|
|
||||||
T.xx()*T.yy() + T.xx()*T.zz() + T.yy()*T.zz()
|
|
||||||
- T.xy()*T.yx() - T.yz()*T.zy() - T.zx()*T.xz();
|
|
||||||
|
|
||||||
scalar c =
|
|
||||||
- T.xx()*T.yy()*T.zz()
|
|
||||||
- T.xy()*T.yz()*T.zx() - T.xz()*T.zy()*T.yx()
|
|
||||||
+ T.xx()*T.yz()*T.zy() + T.yy()*T.zx()*T.xz() + T.zz()*T.xy()*T.yx();
|
|
||||||
|
|
||||||
// Auxillary variables
|
|
||||||
scalar aBy3 = a/3;
|
|
||||||
|
|
||||||
scalar P = (a*a - 3*b)/9; // == -p_wikipedia/3
|
|
||||||
scalar PPP = P*P*P;
|
|
||||||
|
|
||||||
scalar Q = (2*a*a*a - 9*a*b + 27*c)/54; // == q_wikipedia/2
|
|
||||||
scalar QQ = Q*Q;
|
|
||||||
|
|
||||||
// Three identical roots
|
|
||||||
if (mag(P) < SMALL*sqr(magSum) && mag(Q) < SMALL*pow3(magSum))
|
|
||||||
{
|
{
|
||||||
return vector(- aBy3, - aBy3, - aBy3);
|
case roots::real:
|
||||||
}
|
lambda[i] = roots[i];
|
||||||
|
break;
|
||||||
// Two identical roots and one distinct root
|
case roots::complex:
|
||||||
else if (mag(PPP - QQ) < SMALL*pow6(magSum))
|
WarningInFunction
|
||||||
{
|
<< "Complex eigenvalues detected for tensor: " << t
|
||||||
scalar sqrtP = sqrt(P);
|
<< endl;
|
||||||
scalar signQ = sign(Q);
|
lambda[i] = 0;
|
||||||
|
break;
|
||||||
i = ii = signQ*sqrtP - aBy3;
|
case roots::posInf:
|
||||||
iii = - 2*signQ*sqrtP - aBy3;
|
lambda[i] = VGREAT;
|
||||||
}
|
break;
|
||||||
|
case roots::negInf:
|
||||||
// Three distinct roots
|
lambda[i] = - VGREAT;
|
||||||
else if (PPP > QQ)
|
break;
|
||||||
{
|
case roots::nan:
|
||||||
scalar sqrtP = sqrt(P);
|
FatalErrorInFunction
|
||||||
scalar value = cos(acos(Q/sqrt(PPP))/3);
|
<< "Eigenvalue calculation failed for tensor: " << t
|
||||||
scalar delta = sqrt(3 - 3*value*value);
|
<< exit(FatalError);
|
||||||
|
|
||||||
i = - 2*sqrtP*value - aBy3;
|
|
||||||
ii = sqrtP*(value + delta) - aBy3;
|
|
||||||
iii = sqrtP*(value - delta) - aBy3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// One real root, two imaginary roots
|
|
||||||
// based on the above logic, PPP must be less than QQ
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "complex eigenvalues detected for tensor: " << T
|
|
||||||
<< endl;
|
|
||||||
|
|
||||||
if (mag(P) < SMALL*sqr(magSum))
|
|
||||||
{
|
|
||||||
i = cbrt(QQ/2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scalar w = cbrt(- Q - sqrt(QQ - PPP));
|
|
||||||
i = w + P/w - aBy3;
|
|
||||||
}
|
|
||||||
|
|
||||||
return vector(-VGREAT, i, VGREAT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the eigenvalues into ascending order
|
// Sort the eigenvalues into ascending order
|
||||||
if (i > ii)
|
if (lambda.x() > lambda.y())
|
||||||
{
|
{
|
||||||
Swap(i, ii);
|
Swap(lambda.x(), lambda.y());
|
||||||
|
}
|
||||||
|
if (lambda.y() > lambda.z())
|
||||||
|
{
|
||||||
|
Swap(lambda.y(), lambda.z());
|
||||||
|
}
|
||||||
|
if (lambda.x() > lambda.y())
|
||||||
|
{
|
||||||
|
Swap(lambda.x(), lambda.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ii > iii)
|
return lambda;
|
||||||
{
|
|
||||||
Swap(ii, iii);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i > ii)
|
|
||||||
{
|
|
||||||
Swap(i, ii);
|
|
||||||
}
|
|
||||||
|
|
||||||
return vector(i, ii, iii);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,6 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "tensor2D.H"
|
#include "tensor2D.H"
|
||||||
|
#include "quadraticEqn.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -85,95 +86,96 @@ const Foam::tensor2D Foam::tensor2D::I
|
|||||||
|
|
||||||
Foam::vector2D Foam::eigenValues(const tensor2D& t)
|
Foam::vector2D Foam::eigenValues(const tensor2D& t)
|
||||||
{
|
{
|
||||||
scalar i = 0;
|
// Coefficients of the characteristic quadratic polynomial (a = 1)
|
||||||
scalar ii = 0;
|
const scalar b = - t.xx() - t.yy();
|
||||||
|
const scalar c = t.xx()*t.yy() - t.xy()*t.yx();
|
||||||
|
|
||||||
if (mag(t.xy()) < SMALL && mag(t.yx()) < SMALL)
|
// Solve
|
||||||
|
Roots<2> roots = quadraticEqn(1, b, c).roots();
|
||||||
|
|
||||||
|
// Check the root types
|
||||||
|
vector2D lambda = vector2D::zero;
|
||||||
|
forAll(roots, i)
|
||||||
{
|
{
|
||||||
i = t.xx();
|
switch (roots.type(i))
|
||||||
ii = t.yy();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
scalar mb = t.xx() + t.yy();
|
|
||||||
scalar c = t.xx()*t.yy() - t.xy()*t.yx();
|
|
||||||
|
|
||||||
// If there is a zero root
|
|
||||||
if (mag(c) < SMALL)
|
|
||||||
{
|
{
|
||||||
i = 0;
|
case roots::real:
|
||||||
ii = mb;
|
lambda[i] = roots[i];
|
||||||
}
|
break;
|
||||||
else
|
case roots::complex:
|
||||||
{
|
WarningInFunction
|
||||||
scalar disc = sqr(mb) - 4*c;
|
<< "Complex eigenvalues detected for tensor: " << t
|
||||||
|
<< endl;
|
||||||
if (disc > 0)
|
lambda[i] = 0;
|
||||||
{
|
break;
|
||||||
scalar q = sqrt(disc);
|
case roots::posInf:
|
||||||
|
lambda[i] = VGREAT;
|
||||||
i = 0.5*(mb - q);
|
break;
|
||||||
ii = 0.5*(mb + q);
|
case roots::negInf:
|
||||||
}
|
lambda[i] = - VGREAT;
|
||||||
else
|
break;
|
||||||
{
|
case roots::nan:
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "zero and complex eigenvalues in tensor2D: " << t
|
<< "Eigenvalue calculation failed for tensor: " << t
|
||||||
<< abort(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the eigenvalues into ascending order
|
// Sort the eigenvalues into ascending order
|
||||||
if (i > ii)
|
if (lambda.x() > lambda.y())
|
||||||
{
|
{
|
||||||
Swap(i, ii);
|
Swap(lambda.x(), lambda.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
return vector2D(i, ii);
|
return lambda;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::vector2D Foam::eigenVector(const tensor2D& t, const scalar lambda)
|
Foam::vector2D Foam::eigenVector
|
||||||
|
(
|
||||||
|
const tensor2D& T,
|
||||||
|
const scalar lambda,
|
||||||
|
const vector2D& direction1
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (lambda < SMALL)
|
// Construct the linear system for this eigenvalue
|
||||||
|
tensor2D A(T - lambda*tensor2D::I);
|
||||||
|
|
||||||
|
// Evaluate the eigenvector using the largest divisor
|
||||||
|
if (mag(A.yy()) > mag(A.xx()) && mag(A.yy()) > SMALL)
|
||||||
{
|
{
|
||||||
return vector2D::zero;
|
vector2D ev(1, - A.yx()/A.yy());
|
||||||
|
|
||||||
|
return ev/mag(ev);
|
||||||
|
}
|
||||||
|
else if (mag(A.xx()) > SMALL)
|
||||||
|
{
|
||||||
|
vector2D ev(- A.xy()/A.xx(), 1);
|
||||||
|
|
||||||
|
return ev/mag(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mag(t.xy()) < SMALL && mag(t.yx()) < SMALL)
|
// Repeated eigenvalue
|
||||||
{
|
return vector2D(- direction1.y(), direction1.x());
|
||||||
if (lambda > min(t.xx(), t.yy()))
|
|
||||||
{
|
|
||||||
return vector2D(1, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return vector2D(0, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mag(t.xy()) < SMALL)
|
|
||||||
{
|
|
||||||
return vector2D(lambda - t.yy(), t.yx());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return vector2D(t.xy(), lambda - t.yy());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tensor2D Foam::eigenVectors(const tensor2D& t)
|
Foam::tensor2D Foam::eigenVectors(const tensor2D& T, const vector2D& lambdas)
|
||||||
{
|
{
|
||||||
vector2D evals(eigenValues(t));
|
vector2D Ux(1, 0), Uy(0, 1);
|
||||||
|
|
||||||
tensor2D evs
|
Ux = eigenVector(T, lambdas.x(), Uy);
|
||||||
(
|
Uy = eigenVector(T, lambdas.y(), Ux);
|
||||||
eigenVector(t, evals.x()),
|
|
||||||
eigenVector(t, evals.y())
|
|
||||||
);
|
|
||||||
|
|
||||||
return evs;
|
return tensor2D(Ux, Uy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::tensor2D Foam::eigenVectors(const tensor2D& T)
|
||||||
|
{
|
||||||
|
const vector2D lambdas(eigenValues(T));
|
||||||
|
|
||||||
|
return eigenVectors(T, lambdas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -49,7 +49,13 @@ namespace Foam
|
|||||||
typedef Tensor2D<scalar> tensor2D;
|
typedef Tensor2D<scalar> tensor2D;
|
||||||
|
|
||||||
vector2D eigenValues(const tensor2D& t);
|
vector2D eigenValues(const tensor2D& t);
|
||||||
vector2D eigenVector(const tensor2D& t, const scalar lambda);
|
vector2D eigenVector
|
||||||
|
(
|
||||||
|
const tensor2D& t,
|
||||||
|
const scalar lambda,
|
||||||
|
const vector2D& direction1
|
||||||
|
);
|
||||||
|
tensor2D eigenVectors(const tensor2D& t, const vector2D& lambdas);
|
||||||
tensor2D eigenVectors(const tensor2D& t);
|
tensor2D eigenVectors(const tensor2D& t);
|
||||||
|
|
||||||
//- Data associated with tensor2D type are contiguous
|
//- Data associated with tensor2D type are contiguous
|
||||||
|
|||||||
@ -204,18 +204,16 @@ Foam::Function1Types::CSV<Type>::CSV
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& ext,
|
|
||||||
const fileName& fName
|
const fileName& fName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TableBase<Type>(entryName, dict.subDict(entryName + ext)),
|
TableBase<Type>(entryName, dict),
|
||||||
coeffs_(dict.subDict(entryName + ext)),
|
nHeaderLine_(readLabel(dict.lookup("nHeaderLine"))),
|
||||||
nHeaderLine_(readLabel(coeffs_.lookup("nHeaderLine"))),
|
refColumn_(readLabel(dict.lookup("refColumn"))),
|
||||||
refColumn_(readLabel(coeffs_.lookup("refColumn"))),
|
componentColumns_(dict.lookup("componentColumns")),
|
||||||
componentColumns_(coeffs_.lookup("componentColumns")),
|
separator_(dict.lookupOrDefault<string>("separator", string(","))[0]),
|
||||||
separator_(coeffs_.lookupOrDefault<string>("separator", string(","))[0]),
|
mergeSeparators_(readBool(dict.lookup("mergeSeparators"))),
|
||||||
mergeSeparators_(readBool(coeffs_.lookup("mergeSeparators"))),
|
fName_(fName != fileName::null ? fName : dict.lookup("file"))
|
||||||
fName_(fName != fileName::null ? fName : coeffs_.lookup("file"))
|
|
||||||
{
|
{
|
||||||
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
if (componentColumns_.size() != pTraits<Type>::nComponents)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,9 +25,11 @@ Class
|
|||||||
Foam::Function1Types::CSV
|
Foam::Function1Types::CSV
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated CSV container data entry. Reference column is always a scalar,
|
Templated CSV function.
|
||||||
e.g. time
|
|
||||||
|
|
||||||
|
Reference column is always a scalar, e.g. time.
|
||||||
|
|
||||||
|
Usage:
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName> csvFile;
|
<entryName> csvFile;
|
||||||
<entryName>Coeffs
|
<entryName>Coeffs
|
||||||
@ -75,9 +77,6 @@ class CSV
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Coefficients dictionary (for convenience on reading)
|
|
||||||
dictionary coeffs_;
|
|
||||||
|
|
||||||
//- Number header lines
|
//- Number header lines
|
||||||
label nHeaderLine_;
|
label nHeaderLine_;
|
||||||
|
|
||||||
@ -122,7 +121,6 @@ public:
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& ext = "Coeffs",
|
|
||||||
const fileName& fName = fileName::null
|
const fileName& fName = fileName::null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,9 +25,9 @@ Class
|
|||||||
Foam::Function1Types::Constant
|
Foam::Function1Types::Constant
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated basic entry that holds a constant value.
|
Templated function that returns a constant value.
|
||||||
|
|
||||||
Usage - for entry \<entryName\> having the value <value>:
|
Usage - for entry \<entryName\> returning the value <value>:
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName> constant <value>
|
<entryName> constant <value>
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -195,6 +195,14 @@ public:
|
|||||||
add##SS##Type##ConstructorToTable_;
|
add##SS##Type##ConstructorToTable_;
|
||||||
|
|
||||||
|
|
||||||
|
#define makeScalarFunction1(SS) \
|
||||||
|
\
|
||||||
|
defineTypeNameAndDebug(SS, 0); \
|
||||||
|
\
|
||||||
|
Function1<scalar>::adddictionaryConstructorToTable<SS> \
|
||||||
|
add##SS##ConstructorToTable_;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -34,39 +34,70 @@ Foam::autoPtr<Foam::Function1<Type>> Foam::Function1<Type>::New
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Istream& is(dict.lookup(entryName, false));
|
if (dict.isDict(entryName))
|
||||||
|
|
||||||
token firstToken(is);
|
|
||||||
word Function1Type;
|
|
||||||
|
|
||||||
if (!firstToken.isWord())
|
|
||||||
{
|
{
|
||||||
is.putBack(firstToken);
|
const dictionary& coeffsDict(dict.subDict(entryName));
|
||||||
return autoPtr<Function1<Type>>
|
|
||||||
(
|
const word Function1Type(coeffsDict.lookup("type"));
|
||||||
new Function1Types::Constant<Type>(entryName, is)
|
|
||||||
);
|
typename dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(Function1Type);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown Function1 type "
|
||||||
|
<< Function1Type << " for Function1 "
|
||||||
|
<< entryName << nl << nl
|
||||||
|
<< "Valid Function1 types are:" << nl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cstrIter()(entryName, coeffsDict);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Function1Type = firstToken.wordToken();
|
Istream& is(dict.lookup(entryName, false));
|
||||||
|
|
||||||
|
token firstToken(is);
|
||||||
|
word Function1Type;
|
||||||
|
|
||||||
|
if (!firstToken.isWord())
|
||||||
|
{
|
||||||
|
is.putBack(firstToken);
|
||||||
|
return autoPtr<Function1<Type>>
|
||||||
|
(
|
||||||
|
new Function1Types::Constant<Type>(entryName, is)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Function1Type = firstToken.wordToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
typename dictionaryConstructorTable::iterator cstrIter =
|
||||||
|
dictionaryConstructorTablePtr_->find(Function1Type);
|
||||||
|
|
||||||
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unknown Function1 type "
|
||||||
|
<< Function1Type << " for Function1 "
|
||||||
|
<< entryName << nl << nl
|
||||||
|
<< "Valid Function1 types are:" << nl
|
||||||
|
<< dictionaryConstructorTablePtr_->sortedToc() << nl
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cstrIter()
|
||||||
|
(
|
||||||
|
entryName,
|
||||||
|
dict.found(entryName + "Coeffs")
|
||||||
|
? dict.subDict(entryName + "Coeffs")
|
||||||
|
: dict
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
typename dictionaryConstructorTable::iterator cstrIter =
|
|
||||||
dictionaryConstructorTablePtr_->find(Function1Type);
|
|
||||||
|
|
||||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Unknown Function1 type "
|
|
||||||
<< Function1Type << " for Function1 "
|
|
||||||
<< entryName << nl << nl
|
|
||||||
<< "Valid Function1 types are:" << nl
|
|
||||||
<< dictionaryConstructorTablePtr_->sortedToc() << nl
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cstrIter()(entryName, dict);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
89
src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C
Normal file
89
src/OpenFOAM/primitives/functions/Function1/Scale/Scale.C
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "Scale.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::Scale<Type>::read(const dictionary& coeffs)
|
||||||
|
{
|
||||||
|
scale_ = Function1<scalar>::New("scale", coeffs);
|
||||||
|
value_ = Function1<Type>::New("value", coeffs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::Scale<Type>::Scale
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<Type>(entryName)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::Scale<Type>::Scale(const Scale<Type>& se)
|
||||||
|
:
|
||||||
|
Function1<Type>(se),
|
||||||
|
scale_(se.scale_, false),
|
||||||
|
value_(se.value_, false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::Scale<Type>::~Scale()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::Function1Types::Scale<Type>::value(const scalar t) const
|
||||||
|
{
|
||||||
|
return scale_->value(t)*value_->value(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::Scale<Type>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
Function1<Type>::writeData(os);
|
||||||
|
os << token::END_STATEMENT << nl;
|
||||||
|
os << indent << word(this->name() + "Coeffs") << nl;
|
||||||
|
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
scale_->writeData(os);
|
||||||
|
value_->writeData(os);
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
165
src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H
Normal file
165
src/OpenFOAM/primitives/functions/Function1/Scale/Scale.H
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::Scale
|
||||||
|
|
||||||
|
Description
|
||||||
|
Function1 which scales a given 'value' function by a scalar 'scale'
|
||||||
|
function.
|
||||||
|
|
||||||
|
This is particularly useful to ramp a time-varying value by one of the
|
||||||
|
monotonic ramp functions.
|
||||||
|
|
||||||
|
Usage for a vector:
|
||||||
|
\verbatim
|
||||||
|
<entryName>
|
||||||
|
{
|
||||||
|
type scale;
|
||||||
|
|
||||||
|
scale
|
||||||
|
{
|
||||||
|
type linearRamp;
|
||||||
|
|
||||||
|
start 0;
|
||||||
|
duration 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
value
|
||||||
|
{
|
||||||
|
type sine;
|
||||||
|
|
||||||
|
frequency 10;
|
||||||
|
amplitude 1;
|
||||||
|
scale (1 0.1 0);
|
||||||
|
level (10 1 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Where:
|
||||||
|
\table
|
||||||
|
Property | Description | Required
|
||||||
|
value | Function of type Function1<Type> | yes
|
||||||
|
scale | Scaling function of type Function1<scalar> | yes
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
Scale.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Scale_H
|
||||||
|
#define Scale_H
|
||||||
|
|
||||||
|
#include "Function1.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class Scale Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class Scale
|
||||||
|
:
|
||||||
|
public Function1<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Scalar scaling function
|
||||||
|
autoPtr<Function1<scalar>> scale_;
|
||||||
|
|
||||||
|
//- Value function
|
||||||
|
autoPtr<Function1<Type>> value_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read the coefficients from the given dictionary
|
||||||
|
void read(const dictionary& coeffs);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const Scale<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
TypeName("scale");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
Scale
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Copy constructor
|
||||||
|
Scale(const Scale<Type>& se);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<Function1<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<Function1<Type>>(new Scale<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~Scale();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
Type value(const scalar t) const;
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "Scale.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,13 +43,12 @@ template<class Type>
|
|||||||
Foam::Function1Types::Sine<Type>::Sine
|
Foam::Function1Types::Sine<Type>::Sine
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const word& ext
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName)
|
Function1<Type>(entryName)
|
||||||
{
|
{
|
||||||
read(dict.subDict(entryName + ext));
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -132,8 +132,7 @@ public:
|
|||||||
Sine
|
Sine
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const word& ext = "Coeffs"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,13 +43,12 @@ template<class Type>
|
|||||||
Foam::Function1Types::Square<Type>::Square
|
Foam::Function1Types::Square<Type>::Square
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const word& ext
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName)
|
Function1<Type>(entryName)
|
||||||
{
|
{
|
||||||
read(dict.subDict(entryName + ext));
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -139,8 +139,7 @@ public:
|
|||||||
Square
|
Square
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const word& ext = "Coeffs"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,10 +25,12 @@ Class
|
|||||||
Foam::Function1Types::Table
|
Foam::Function1Types::Table
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated table container data entry. Items are stored in a list of
|
Templated table container function.
|
||||||
Tuple2's. First column is always stored as scalar entries. Data is read
|
|
||||||
in Tuple2 form, e.g. for an entry \<entryName\> that is (scalar, vector):
|
|
||||||
|
|
||||||
|
Items are stored in a list of Tuple2's. First column is always stored as
|
||||||
|
scalar entries. Data is read in Tuple2 form.
|
||||||
|
|
||||||
|
Usage:
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName> table
|
<entryName> table
|
||||||
(
|
(
|
||||||
|
|||||||
@ -34,11 +34,10 @@ Foam::Function1Types::TableFile<Type>::TableFile
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TableBase<Type>(entryName, dict.subDict(entryName + "Coeffs")),
|
TableBase<Type>(entryName, dict),
|
||||||
fName_("none")
|
fName_("none")
|
||||||
{
|
{
|
||||||
const dictionary coeffs(dict.subDict(entryName + "Coeffs"));
|
dict.lookup("file") >> fName_;
|
||||||
coeffs.lookup("file") >> fName_;
|
|
||||||
|
|
||||||
fileName expandedFile(fName_);
|
fileName expandedFile(fName_);
|
||||||
IFstream is(expandedFile.expand());
|
IFstream is(expandedFile.expand());
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,8 +25,9 @@ Class
|
|||||||
Foam::Function1Types::TableFile
|
Foam::Function1Types::TableFile
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Templated table container data entry where data is read from file.
|
Templated table container function where data is read from file.
|
||||||
|
|
||||||
|
Usage:
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName> tableFile;
|
<entryName> tableFile;
|
||||||
<entryName>Coeffs
|
<entryName>Coeffs
|
||||||
@ -37,7 +38,7 @@ Description
|
|||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
Items are stored in a list of Tuple2's. First column is always stored as
|
Data is stored as a list of Tuple2's. First column is always stored as
|
||||||
scalar entries. Data is read in the form, e.g. for an entry \<entryName\>
|
scalar entries. Data is read in the form, e.g. for an entry \<entryName\>
|
||||||
that is (scalar, vector):
|
that is (scalar, vector):
|
||||||
\verbatim
|
\verbatim
|
||||||
@ -47,7 +48,6 @@ Description
|
|||||||
);
|
);
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
TableFile.C
|
TableFile.C
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -0,0 +1,66 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "halfCosineRamp.H"
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
makeScalarFunction1(halfCosineRamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::halfCosineRamp::halfCosineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ramp(entryName, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::halfCosineRamp::~halfCosineRamp()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::Function1Types::halfCosineRamp::value(const scalar t) const
|
||||||
|
{
|
||||||
|
return 0.5*(1 - cos(constant::mathematical::pi*linearRamp(t)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::halfCosineRamp
|
||||||
|
|
||||||
|
Description
|
||||||
|
Half-cosine ramp function starting from 0 and increasing to 1 from \c start
|
||||||
|
over the \c duration and remaining at 1 thereafter.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1Types::ramp
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
halfCosineRamp.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef halfCosineRamp_H
|
||||||
|
#define halfCosineRamp_H
|
||||||
|
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class halfCosineRamp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class halfCosineRamp
|
||||||
|
:
|
||||||
|
public ramp
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const halfCosineRamp&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
TypeName("halfCosineRamp");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
halfCosineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~halfCosineRamp();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
scalar value(const scalar t) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,65 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "linearRamp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
makeScalarFunction1(linearRamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::linearRamp::linearRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ramp(entryName, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::linearRamp::~linearRamp()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::Function1Types::linearRamp::value(const scalar t) const
|
||||||
|
{
|
||||||
|
return ramp::linearRamp(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::linearRamp
|
||||||
|
|
||||||
|
Description
|
||||||
|
Linear ramp function starting from 0 and increasing linearRamply to 1 from
|
||||||
|
\c start over the \c duration and remaining at 1 thereafter.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1Types::ramp
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
linearRamp.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef linearRamp_H
|
||||||
|
#define linearRamp_H
|
||||||
|
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class linearRamp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class linearRamp
|
||||||
|
:
|
||||||
|
public ramp
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const linearRamp&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
TypeName("linearRamp");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
linearRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~linearRamp();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
scalar value(const scalar t) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -24,12 +24,15 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Constant.H"
|
#include "Constant.H"
|
||||||
|
#include "ZeroConstant.H"
|
||||||
|
#include "OneConstant.H"
|
||||||
#include "PolynomialEntry.H"
|
#include "PolynomialEntry.H"
|
||||||
#include "Sine.H"
|
#include "Sine.H"
|
||||||
#include "Square.H"
|
#include "Square.H"
|
||||||
#include "CSV.H"
|
#include "CSV.H"
|
||||||
#include "Table.H"
|
#include "Table.H"
|
||||||
#include "TableFile.H"
|
#include "TableFile.H"
|
||||||
|
#include "Scale.H"
|
||||||
|
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
@ -38,12 +41,15 @@ License
|
|||||||
#define makeFunction1s(Type) \
|
#define makeFunction1s(Type) \
|
||||||
makeFunction1(Type); \
|
makeFunction1(Type); \
|
||||||
makeFunction1Type(Constant, Type); \
|
makeFunction1Type(Constant, Type); \
|
||||||
|
makeFunction1Type(ZeroConstant, Type); \
|
||||||
|
makeFunction1Type(OneConstant, Type); \
|
||||||
makeFunction1Type(Polynomial, Type); \
|
makeFunction1Type(Polynomial, Type); \
|
||||||
makeFunction1Type(Sine, Type); \
|
makeFunction1Type(Sine, Type); \
|
||||||
makeFunction1Type(Square, Type); \
|
makeFunction1Type(Square, Type); \
|
||||||
makeFunction1Type(CSV, Type); \
|
makeFunction1Type(CSV, Type); \
|
||||||
makeFunction1Type(Table, Type); \
|
makeFunction1Type(Table, Type); \
|
||||||
makeFunction1Type(TableFile, Type);
|
makeFunction1Type(TableFile, Type); \
|
||||||
|
makeFunction1Type(Scale, Type);
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,65 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "quadraticRamp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
makeScalarFunction1(quadraticRamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::quadraticRamp::quadraticRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ramp(entryName, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::quadraticRamp::~quadraticRamp()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::Function1Types::quadraticRamp::value(const scalar t) const
|
||||||
|
{
|
||||||
|
return sqr(linearRamp(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::quadraticRamp
|
||||||
|
|
||||||
|
Description
|
||||||
|
Quadratic ramp function starting from 0 and increasing quadraticRampally
|
||||||
|
to 1 from \c t_0 over the \c duration and remaining at 1 thereafter.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1Types::ramp
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
quadraticRamp.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef quadraticRamp_H
|
||||||
|
#define quadraticRamp_H
|
||||||
|
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class quadraticRamp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class quadraticRamp
|
||||||
|
:
|
||||||
|
public ramp
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const quadraticRamp&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
TypeName("quadraticRamp");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
quadraticRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~quadraticRamp();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
scalar value(const scalar t) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "quarterCosineRamp.H"
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
makeScalarFunction1(quarterCosineRamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::quarterCosineRamp::quarterCosineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ramp(entryName, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::quarterCosineRamp::~quarterCosineRamp()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::Function1Types::quarterCosineRamp::value
|
||||||
|
(
|
||||||
|
const scalar t
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return 1 - cos(0.5*constant::mathematical::pi*linearRamp(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::quarterCosineRamp
|
||||||
|
|
||||||
|
Description
|
||||||
|
Quarter-cosine ramp function starting from 0 and increasing to 1 from \c
|
||||||
|
start over the \c duration and remaining at 1 thereafter.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1Types::ramp
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
quarterCosineRamp.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef quarterCosineRamp_H
|
||||||
|
#define quarterCosineRamp_H
|
||||||
|
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class quarterCosineRamp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class quarterCosineRamp
|
||||||
|
:
|
||||||
|
public ramp
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const quarterCosineRamp&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
TypeName("quarterCosineRamp");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
quarterCosineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~quarterCosineRamp();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
scalar value(const scalar t) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "quarterSineRamp.H"
|
||||||
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
makeScalarFunction1(quarterSineRamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::quarterSineRamp::quarterSineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ramp(entryName, dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::quarterSineRamp::~quarterSineRamp()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::scalar Foam::Function1Types::quarterSineRamp::value(const scalar t) const
|
||||||
|
{
|
||||||
|
return sin(0.5*constant::mathematical::pi*linearRamp(t));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::quarterSineRamp
|
||||||
|
|
||||||
|
Description
|
||||||
|
Quarter-sine ramp function starting from 0 and increasing to 1 from \c start
|
||||||
|
over the \c duration and remaining at 1 thereafter.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1Types::ramp
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
quarterSineRamp.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef quarterSineRamp_H
|
||||||
|
#define quarterSineRamp_H
|
||||||
|
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class quarterSineRamp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class quarterSineRamp
|
||||||
|
:
|
||||||
|
public ramp
|
||||||
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const quarterSineRamp&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
TypeName("quarterSineRamp");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
quarterSineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~quarterSineRamp();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
scalar value(const scalar t) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
69
src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C
Normal file
69
src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::Function1Types::ramp::read(const dictionary& coeffs)
|
||||||
|
{
|
||||||
|
start_ = coeffs.lookupOrDefault<scalar>("start", 0);
|
||||||
|
duration_ = coeffs.lookupType<scalar>("duration");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Function1Types::ramp::ramp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<scalar>(entryName)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Function1Types::ramp::~ramp()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::Function1Types::ramp::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
Function1<scalar>::writeData(os);
|
||||||
|
os << token::END_STATEMENT << nl;
|
||||||
|
os << indent << word(this->name() + "Coeffs") << nl;
|
||||||
|
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
os.writeKeyword("start") << start_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
|
||||||
|
os << decrIndent << indent << token::END_BLOCK << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
150
src/OpenFOAM/primitives/functions/Function1/ramp/ramp.H
Normal file
150
src/OpenFOAM/primitives/functions/Function1/ramp/ramp.H
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::ramp
|
||||||
|
|
||||||
|
Description
|
||||||
|
Ramp function base class for the set of scalar functions starting from 0 and
|
||||||
|
increasing monotonically to 1 from \c start over the \c duration and
|
||||||
|
remaining at 1 thereafter.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
\verbatim
|
||||||
|
<entryName> <rampFunction>;
|
||||||
|
<entryName>Coeffs
|
||||||
|
{
|
||||||
|
start 10;
|
||||||
|
duration 20;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
or
|
||||||
|
\verbatim
|
||||||
|
<entryName>
|
||||||
|
{
|
||||||
|
type <rampFunction>;
|
||||||
|
start 10;
|
||||||
|
duration 20;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Where:
|
||||||
|
\table
|
||||||
|
Property | Description | Required | Default value
|
||||||
|
start | Start time | no | 0
|
||||||
|
duration | Duration | yes |
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::Function1
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
ramp.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef ramp_H
|
||||||
|
#define ramp_H
|
||||||
|
|
||||||
|
#include "Function1.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class ramp Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class ramp
|
||||||
|
:
|
||||||
|
public Function1<scalar>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Start-time of the ramp function
|
||||||
|
scalar start_;
|
||||||
|
|
||||||
|
//- Duration of the ramp function
|
||||||
|
scalar duration_;
|
||||||
|
|
||||||
|
//- Simple linear ramp function
|
||||||
|
// which form the basis of many more complex ramp functions
|
||||||
|
inline scalar linearRamp(const scalar t) const
|
||||||
|
{
|
||||||
|
return max(min((t - start_)/duration_, 1), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read the coefficients from the given dictionary
|
||||||
|
void read(const dictionary& coeffs);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const ramp&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name and dictionary
|
||||||
|
ramp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~ramp();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value for time t
|
||||||
|
scalar value(const scalar t) const = 0;
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
131
src/OpenFOAM/primitives/polynomialEqns/Roots.H
Normal file
131
src/OpenFOAM/primitives/polynomialEqns/Roots.H
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Roots
|
||||||
|
|
||||||
|
Description
|
||||||
|
Templated storage for the roots of polynomial equations, plus flags to
|
||||||
|
indicate the nature of the roots.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
RootsI.H
|
||||||
|
Roots.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Roots_H
|
||||||
|
#define Roots_H
|
||||||
|
|
||||||
|
#include "VectorSpace.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace roots
|
||||||
|
{
|
||||||
|
|
||||||
|
//- Types of root
|
||||||
|
enum type
|
||||||
|
{
|
||||||
|
real = 0,
|
||||||
|
complex,
|
||||||
|
posInf,
|
||||||
|
negInf,
|
||||||
|
nan
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class Roots Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<direction N>
|
||||||
|
class Roots
|
||||||
|
:
|
||||||
|
public VectorSpace<Roots<N>, scalar, N>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Root types, encoded into a single integer
|
||||||
|
label types_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline Roots();
|
||||||
|
|
||||||
|
//- Construct with a uniform value
|
||||||
|
inline Roots(const roots::type t, const scalar x);
|
||||||
|
|
||||||
|
//- Construct by concatenation
|
||||||
|
inline Roots
|
||||||
|
(
|
||||||
|
const roots::type t,
|
||||||
|
const scalar x,
|
||||||
|
const Roots<N - 1>& xs
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by concatenation
|
||||||
|
inline Roots
|
||||||
|
(
|
||||||
|
const Roots<N - 1>& xs,
|
||||||
|
const roots::type t,
|
||||||
|
const scalar x
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by concatenation
|
||||||
|
template <direction M>
|
||||||
|
inline Roots(const Roots<M>& xs, const Roots<N - M>& ys);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Set the type of the i-th root
|
||||||
|
inline void type(const direction i, const roots::type t);
|
||||||
|
|
||||||
|
//- Return the type of the i-th root
|
||||||
|
inline roots::type type(const direction i) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "RootsI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
136
src/OpenFOAM/primitives/polynomialEqns/RootsI.H
Normal file
136
src/OpenFOAM/primitives/polynomialEqns/RootsI.H
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
inline Foam::Roots<N>::Roots()
|
||||||
|
:
|
||||||
|
types_(0)
|
||||||
|
{
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
type(i, roots::nan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
inline Foam::Roots<N>::Roots(const roots::type t, const scalar x)
|
||||||
|
:
|
||||||
|
types_(0)
|
||||||
|
{
|
||||||
|
forAll(*this, i)
|
||||||
|
{
|
||||||
|
this->v_[i] = x;
|
||||||
|
type(i, t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
inline Foam::Roots<N>::Roots
|
||||||
|
(
|
||||||
|
const roots::type t,
|
||||||
|
const scalar x,
|
||||||
|
const Roots<N - 1>& xs
|
||||||
|
)
|
||||||
|
:
|
||||||
|
types_(0)
|
||||||
|
{
|
||||||
|
this->v_[0] = x;
|
||||||
|
type(0, t);
|
||||||
|
forAll(xs, i)
|
||||||
|
{
|
||||||
|
this->v_[i+1] = xs[i];
|
||||||
|
type(i + 1, xs.type(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
inline Foam::Roots<N>::Roots
|
||||||
|
(
|
||||||
|
const Roots<N - 1>& xs,
|
||||||
|
const roots::type t,
|
||||||
|
const scalar x
|
||||||
|
)
|
||||||
|
:
|
||||||
|
types_(0)
|
||||||
|
{
|
||||||
|
forAll(xs, i)
|
||||||
|
{
|
||||||
|
this->v_[i] = xs[i];
|
||||||
|
type(i, xs.type(i));
|
||||||
|
}
|
||||||
|
this->v_[N-1] = x;
|
||||||
|
type(N - 1, t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
template <Foam::direction M>
|
||||||
|
inline Foam::Roots<N>::Roots
|
||||||
|
(
|
||||||
|
const Roots<M>& xs,
|
||||||
|
const Roots<N - M>& ys
|
||||||
|
)
|
||||||
|
:
|
||||||
|
types_(0)
|
||||||
|
{
|
||||||
|
forAll(xs, i)
|
||||||
|
{
|
||||||
|
this->v_[i] = xs[i];
|
||||||
|
type(i, xs.type(i));
|
||||||
|
}
|
||||||
|
forAll(ys, i)
|
||||||
|
{
|
||||||
|
this->v_[i + M] = ys[i];
|
||||||
|
type(i + M, ys.type(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
inline void Foam::Roots<N>::type
|
||||||
|
(
|
||||||
|
const direction i,
|
||||||
|
const roots::type t
|
||||||
|
)
|
||||||
|
{
|
||||||
|
types_ += (t - type(i)) << 3*i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <Foam::direction N>
|
||||||
|
inline Foam::roots::type Foam::Roots<N>::type(const direction i) const
|
||||||
|
{
|
||||||
|
return static_cast<roots::type>((types_ >> 3*i) & 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
164
src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.C
Normal file
164
src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.C
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "linearEqn.H"
|
||||||
|
#include "quadraticEqn.H"
|
||||||
|
#include "cubicEqn.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Roots<3> Foam::cubicEqn::roots() const
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
|
This function solves a cubic equation of the following form:
|
||||||
|
|
||||||
|
a*x^3 + b*x^2 + c*x + d = 0
|
||||||
|
x^3 + B*x^2 + C*x + D = 0
|
||||||
|
|
||||||
|
The following two substitutions are used:
|
||||||
|
|
||||||
|
x = t - B/3
|
||||||
|
t = w - P/3/w
|
||||||
|
|
||||||
|
This reduces the problem to a quadratic in w^3.
|
||||||
|
|
||||||
|
w^6 + Q*w^3 - P = 0
|
||||||
|
|
||||||
|
Where Q and P are given in the code below.
|
||||||
|
|
||||||
|
The properties of the cubic can be related to the properties of this
|
||||||
|
quadratic in w^3. If it has a repeated root a zero, the cubic has a tripl
|
||||||
|
root. If it has a repeated root not at zero, the cubic has two real roots,
|
||||||
|
one repeated and one not. If it has two complex roots, the cubic has three
|
||||||
|
real roots. If it has two real roots, then the cubic has one real root and
|
||||||
|
two complex roots.
|
||||||
|
|
||||||
|
This is solved for the most numerically accurate value of w^3. See the
|
||||||
|
quadratic function for details on how to pick a value. This single value of
|
||||||
|
w^3 can yield up to three cube roots for w, which relate to the three
|
||||||
|
solutions for x.
|
||||||
|
|
||||||
|
Only a single root, or pair of conjugate roots, is directly evaluated; the
|
||||||
|
one, or ones with the lowest relative numerical error. Root identities are
|
||||||
|
then used to recover the remaining roots, possibly utilising a quadratic
|
||||||
|
and/or linear solution. This seems to be a good way of maintaining the
|
||||||
|
accuracy of roots at very different magnitudes.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const scalar a = this->a();
|
||||||
|
const scalar b = this->b();
|
||||||
|
const scalar c = this->c();
|
||||||
|
const scalar d = this->d();
|
||||||
|
|
||||||
|
if (a == 0)
|
||||||
|
{
|
||||||
|
return Roots<3>(quadraticEqn(b, c, d).roots(), roots::nan, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is assumed not to over- or under-flow. If it does, all bets are off.
|
||||||
|
const scalar p = c*a - b*b/3;
|
||||||
|
const scalar q = b*b*b*(2.0/27.0) - b*c*a/3 + d*a*a;
|
||||||
|
const scalar disc = p*p*p/27 + q*q/4;
|
||||||
|
|
||||||
|
// How many roots of what types are available?
|
||||||
|
const bool oneReal = disc == 0 && p == 0;
|
||||||
|
const bool twoReal = disc == 0 && p != 0;
|
||||||
|
const bool threeReal = disc < 0;
|
||||||
|
//const bool oneRealTwoComplex = disc > 0;
|
||||||
|
|
||||||
|
static const scalar sqrt3 = sqrt(3.0);
|
||||||
|
|
||||||
|
scalar x;
|
||||||
|
|
||||||
|
if (oneReal)
|
||||||
|
{
|
||||||
|
const Roots<1> r = linearEqn(- a, b/3).roots();
|
||||||
|
return Roots<3>(r.type(0), r[0]);
|
||||||
|
}
|
||||||
|
else if (twoReal)
|
||||||
|
{
|
||||||
|
if (q*b > 0)
|
||||||
|
{
|
||||||
|
x = - 2*cbrt(q/2) - b/3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = cbrt(q/2) - b/3;
|
||||||
|
const Roots<1> r = linearEqn(- a, x).roots();
|
||||||
|
return Roots<3>(Roots<2>(r, r), linearEqn(x*x, a*d).roots());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (threeReal)
|
||||||
|
{
|
||||||
|
const scalar wCbRe = - q/2, wCbIm = sqrt(- disc);
|
||||||
|
const scalar wAbs = cbrt(hypot(wCbRe, wCbIm));
|
||||||
|
const scalar wArg = atan2(wCbIm, wCbRe)/3;
|
||||||
|
const scalar wRe = wAbs*cos(wArg), wIm = wAbs*sin(wArg);
|
||||||
|
if (b > 0)
|
||||||
|
{
|
||||||
|
x = - wRe - mag(wIm)*sqrt3 - b/3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = 2*wRe - b/3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // if (oneRealTwoComplex)
|
||||||
|
{
|
||||||
|
const scalar wCb = - q/2 - sign(q)*sqrt(disc);
|
||||||
|
const scalar w = cbrt(wCb);
|
||||||
|
const scalar t = w - p/(3*w);
|
||||||
|
if (p + t*b < 0)
|
||||||
|
{
|
||||||
|
x = t - b/3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const scalar xRe = - t/2 - b/3, xIm = sqrt3/2*(w + p/3/w);
|
||||||
|
x = - a*a*d/(xRe*xRe + xIm*xIm);
|
||||||
|
|
||||||
|
// This form of solving for the remaining roots seems more stable
|
||||||
|
// for this case. This has been determined by trial and error.
|
||||||
|
return
|
||||||
|
Roots<3>
|
||||||
|
(
|
||||||
|
linearEqn(- a, x).roots(),
|
||||||
|
quadraticEqn(a*x, x*x + b*x, - a*d).roots()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
Roots<3>
|
||||||
|
(
|
||||||
|
linearEqn(- a, x).roots(),
|
||||||
|
quadraticEqn(- x*x, c*x + a*d, d*x).roots()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
115
src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.H
Normal file
115
src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqn.H
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::cubicEqn
|
||||||
|
|
||||||
|
Description
|
||||||
|
Cubic equation of the form a*x^3 + b*x^2 + c*x + d = 0
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
cubicEqnI.H
|
||||||
|
cubicEqn.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef cubicEqn_H
|
||||||
|
#define cubicEqn_H
|
||||||
|
|
||||||
|
#include "Roots.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class cubicEqn Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class cubicEqn
|
||||||
|
:
|
||||||
|
public VectorSpace<cubicEqn, scalar, 4>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Component labeling enumeration
|
||||||
|
enum components { A, B, C, D };
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline cubicEqn();
|
||||||
|
|
||||||
|
//- Construct initialized to zero
|
||||||
|
inline cubicEqn(const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
inline cubicEqn
|
||||||
|
(
|
||||||
|
const scalar a,
|
||||||
|
const scalar b,
|
||||||
|
const scalar c,
|
||||||
|
const scalar d
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
inline scalar a() const;
|
||||||
|
inline scalar b() const;
|
||||||
|
inline scalar c() const;
|
||||||
|
inline scalar d() const;
|
||||||
|
|
||||||
|
inline scalar& a();
|
||||||
|
inline scalar& b();
|
||||||
|
inline scalar& c();
|
||||||
|
inline scalar& d();
|
||||||
|
|
||||||
|
//- Evaluate at x
|
||||||
|
inline scalar value(const scalar x) const;
|
||||||
|
|
||||||
|
//- Estimate the error of evaluation at x
|
||||||
|
inline scalar error(const scalar x) const;
|
||||||
|
|
||||||
|
//- Get the roots
|
||||||
|
Roots<3> roots() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "cubicEqnI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
115
src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqnI.H
Normal file
115
src/OpenFOAM/primitives/polynomialEqns/cubicEqn/cubicEqnI.H
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::cubicEqn::cubicEqn()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::cubicEqn::cubicEqn(const Foam::zero)
|
||||||
|
:
|
||||||
|
VectorSpace<cubicEqn, scalar, 4>(Foam::zero())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::cubicEqn::cubicEqn
|
||||||
|
(
|
||||||
|
const scalar a,
|
||||||
|
const scalar b,
|
||||||
|
const scalar c,
|
||||||
|
const scalar d
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this->v_[A] = a;
|
||||||
|
this->v_[B] = b;
|
||||||
|
this->v_[C] = c;
|
||||||
|
this->v_[D] = d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cubicEqn::a() const
|
||||||
|
{
|
||||||
|
return this->v_[A];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cubicEqn::b() const
|
||||||
|
{
|
||||||
|
return this->v_[B];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cubicEqn::c() const
|
||||||
|
{
|
||||||
|
return this->v_[C];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cubicEqn::d() const
|
||||||
|
{
|
||||||
|
return this->v_[D];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::cubicEqn::a()
|
||||||
|
{
|
||||||
|
return this->v_[A];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::cubicEqn::b()
|
||||||
|
{
|
||||||
|
return this->v_[B];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::cubicEqn::c()
|
||||||
|
{
|
||||||
|
return this->v_[C];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::cubicEqn::d()
|
||||||
|
{
|
||||||
|
return this->v_[D];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cubicEqn::value(const scalar x) const
|
||||||
|
{
|
||||||
|
return x*(x*(x*a() + b()) + c()) + d();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::cubicEqn::error(const scalar x) const
|
||||||
|
{
|
||||||
|
return mag(SMALL*x*(x*(x*3*a() + 2*b()) + c()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
104
src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqn.H
Normal file
104
src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqn.H
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::linearEqn
|
||||||
|
|
||||||
|
Description
|
||||||
|
Linear equation of the form a*x + b = 0
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
linearEqnI.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef linearEqn_H
|
||||||
|
#define linearEqn_H
|
||||||
|
|
||||||
|
#include "Roots.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class linearEqn Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class linearEqn
|
||||||
|
:
|
||||||
|
public VectorSpace<linearEqn, scalar, 2>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Component labeling enumeration
|
||||||
|
enum components { A, B };
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline linearEqn();
|
||||||
|
|
||||||
|
//- Construct initialized to zero
|
||||||
|
inline linearEqn(const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
inline linearEqn(const scalar a, const scalar b);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
inline scalar a() const;
|
||||||
|
inline scalar b() const;
|
||||||
|
|
||||||
|
inline scalar& a();
|
||||||
|
inline scalar& b();
|
||||||
|
|
||||||
|
//- Evaluate at x
|
||||||
|
inline scalar value(const scalar x) const;
|
||||||
|
|
||||||
|
//- Estimate the error of evaluation at x
|
||||||
|
inline scalar error(const scalar x) const;
|
||||||
|
|
||||||
|
//- Get the roots
|
||||||
|
inline Roots<1> roots() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "linearEqnI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
111
src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqnI.H
Normal file
111
src/OpenFOAM/primitives/polynomialEqns/linearEqn/linearEqnI.H
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::linearEqn::linearEqn()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::linearEqn::linearEqn(const Foam::zero)
|
||||||
|
:
|
||||||
|
VectorSpace<linearEqn, scalar, 2>(Foam::zero())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::linearEqn::linearEqn(const scalar a, const scalar b)
|
||||||
|
{
|
||||||
|
this->v_[A] = a;
|
||||||
|
this->v_[B] = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::linearEqn::a() const
|
||||||
|
{
|
||||||
|
return this->v_[A];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::linearEqn::b() const
|
||||||
|
{
|
||||||
|
return this->v_[B];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::linearEqn::a()
|
||||||
|
{
|
||||||
|
return this->v_[A];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::linearEqn::b()
|
||||||
|
{
|
||||||
|
return this->v_[B];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::linearEqn::value(const scalar x) const
|
||||||
|
{
|
||||||
|
return x*a() + b();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::linearEqn::error(const scalar x) const
|
||||||
|
{
|
||||||
|
return mag(SMALL*x*a());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::Roots<1> Foam::linearEqn::roots() const
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
|
This function solves a linear equation of the following form:
|
||||||
|
|
||||||
|
a*x + b = 0
|
||||||
|
x + B = 0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const scalar a = this->a();
|
||||||
|
const scalar b = this->b();
|
||||||
|
|
||||||
|
if (a == 0)
|
||||||
|
{
|
||||||
|
return Roots<1>(roots::nan, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mag(b/VGREAT) >= mag(a))
|
||||||
|
{
|
||||||
|
return Roots<1>(sign(a) == sign(b) ? roots::negInf : roots::posInf, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Roots<1>(roots::real, - b/a);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "linearEqn.H"
|
||||||
|
#include "quadraticEqn.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::Roots<2> Foam::quadraticEqn::roots() const
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
|
This function solves a quadraticEqn equation of the following form:
|
||||||
|
|
||||||
|
a*x^2 + b*x + c = 0
|
||||||
|
x^2 + B*x + C = 0
|
||||||
|
|
||||||
|
The quadraticEqn formula is as follows:
|
||||||
|
|
||||||
|
x = - B/2 +- sqrt(B*B - 4*C)/2
|
||||||
|
|
||||||
|
If the sqrt generates a complex number, this provides the result. If not
|
||||||
|
then the real root with the smallest floating point error is calculated.
|
||||||
|
|
||||||
|
x0 = - B/2 - sign(B)*sqrt(B*B - 4*C)/2
|
||||||
|
|
||||||
|
The other root is the obtained using an identity.
|
||||||
|
|
||||||
|
x1 = C/x0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const scalar a = this->a();
|
||||||
|
const scalar b = this->b();
|
||||||
|
const scalar c = this->c();
|
||||||
|
|
||||||
|
if (a == 0)
|
||||||
|
{
|
||||||
|
return Roots<2>(linearEqn(b, c).roots(), roots::nan, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is assumed not to over- or under-flow. If it does, all bets are off.
|
||||||
|
const scalar disc = b*b/4 - a*c;
|
||||||
|
|
||||||
|
// How many roots of what types are available?
|
||||||
|
const bool oneReal = disc == 0;
|
||||||
|
const bool twoReal = disc > 0;
|
||||||
|
//const bool twoComplex = disc < 0;
|
||||||
|
|
||||||
|
if (oneReal)
|
||||||
|
{
|
||||||
|
const Roots<1> r = linearEqn(- a, b/2).roots();
|
||||||
|
return Roots<2>(r, r);
|
||||||
|
}
|
||||||
|
else if (twoReal)
|
||||||
|
{
|
||||||
|
const scalar x = - b/2 - sign(b)*sqrt(disc);
|
||||||
|
return Roots<2>(linearEqn(- a, x).roots(), linearEqn(- x, c).roots());
|
||||||
|
}
|
||||||
|
else // if (twoComplex)
|
||||||
|
{
|
||||||
|
return Roots<2>(roots::complex, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::quadraticEqn
|
||||||
|
|
||||||
|
Description
|
||||||
|
Quadratic equation of the form a*x^2 + b*x + c = 0
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
quadraticEqnI.H
|
||||||
|
quadraticEqn.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef quadraticEqn_H
|
||||||
|
#define quadraticEqn_H
|
||||||
|
|
||||||
|
#include "Roots.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class quadraticEqn Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class quadraticEqn
|
||||||
|
:
|
||||||
|
public VectorSpace<quadraticEqn, scalar, 3>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Component labeling enumeration
|
||||||
|
enum components { A, B, C };
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct null
|
||||||
|
inline quadraticEqn();
|
||||||
|
|
||||||
|
//- Construct initialized to zero
|
||||||
|
inline quadraticEqn(const Foam::zero);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
inline quadraticEqn(const scalar a, const scalar b, const scalar c);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
// Access
|
||||||
|
|
||||||
|
inline scalar a() const;
|
||||||
|
inline scalar b() const;
|
||||||
|
inline scalar c() const;
|
||||||
|
|
||||||
|
inline scalar& a();
|
||||||
|
inline scalar& b();
|
||||||
|
inline scalar& c();
|
||||||
|
|
||||||
|
//- Evaluate at x
|
||||||
|
inline scalar value(const scalar x) const;
|
||||||
|
|
||||||
|
//- Estimate the error of evaluation at x
|
||||||
|
inline scalar error(const scalar x) const;
|
||||||
|
|
||||||
|
//- Get the roots
|
||||||
|
Roots<2> roots() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "quadraticEqnI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::quadraticEqn::quadraticEqn()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::quadraticEqn::quadraticEqn(const Foam::zero)
|
||||||
|
:
|
||||||
|
VectorSpace<quadraticEqn, scalar, 3>(Foam::zero())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::quadraticEqn::quadraticEqn
|
||||||
|
(
|
||||||
|
const scalar a,
|
||||||
|
const scalar b,
|
||||||
|
const scalar c
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this->v_[A] = a;
|
||||||
|
this->v_[B] = b;
|
||||||
|
this->v_[C] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::quadraticEqn::a() const
|
||||||
|
{
|
||||||
|
return this->v_[A];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::quadraticEqn::b() const
|
||||||
|
{
|
||||||
|
return this->v_[B];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::quadraticEqn::c() const
|
||||||
|
{
|
||||||
|
return this->v_[C];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::quadraticEqn::a()
|
||||||
|
{
|
||||||
|
return this->v_[A];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::quadraticEqn::b()
|
||||||
|
{
|
||||||
|
return this->v_[B];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar& Foam::quadraticEqn::c()
|
||||||
|
{
|
||||||
|
return this->v_[C];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::quadraticEqn::value(const scalar x) const
|
||||||
|
{
|
||||||
|
return x*(x*a() + b()) + c();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::scalar Foam::quadraticEqn::error(const scalar x) const
|
||||||
|
{
|
||||||
|
return mag(SMALL*x*(x*2*a() + b()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -102,13 +102,6 @@ public:
|
|||||||
//- Re-read model coefficients if they have changed
|
//- Re-read model coefficients if they have changed
|
||||||
virtual bool read() = 0;
|
virtual bool read() = 0;
|
||||||
|
|
||||||
//- Return non-const access to the turbulence viscosity
|
|
||||||
// to allow modification by means other than derivation
|
|
||||||
volScalarField& evNut()
|
|
||||||
{
|
|
||||||
return nut_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return the turbulence viscosity
|
//- Return the turbulence viscosity
|
||||||
virtual tmp<volScalarField> nut() const
|
virtual tmp<volScalarField> nut() const
|
||||||
{
|
{
|
||||||
|
|||||||
248
src/combustionModels/EDC/EDC.C
Normal file
248
src/combustionModels/EDC/EDC.C
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "EDC.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::combustionModels::EDC<Type>::EDC
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& combustionProperties,
|
||||||
|
const word& phaseName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
laminar<Type>(modelType, mesh, combustionProperties, phaseName),
|
||||||
|
version_
|
||||||
|
(
|
||||||
|
EDCversionNames
|
||||||
|
[
|
||||||
|
this->coeffs().lookupOrDefault
|
||||||
|
(
|
||||||
|
"version",
|
||||||
|
word(EDCversionNames[EDCdefaultVersion])
|
||||||
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
|
C1_(this->coeffs().lookupOrDefault("C1", 0.05774)),
|
||||||
|
C2_(this->coeffs().lookupOrDefault("C2", 0.5)),
|
||||||
|
Cgamma_(this->coeffs().lookupOrDefault("Cgamma", 2.1377)),
|
||||||
|
Ctau_(this->coeffs().lookupOrDefault("Ctau", 0.4083)),
|
||||||
|
exp1_(this->coeffs().lookupOrDefault("exp1", EDCexp1[int(version_)])),
|
||||||
|
exp2_(this->coeffs().lookupOrDefault("exp2", EDCexp2[int(version_)])),
|
||||||
|
kappa_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
IOobject::groupName(typeName + ":kappa", phaseName),
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("kappa", dimless, 0)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::combustionModels::EDC<Type>::~EDC()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::combustionModels::EDC<Type>::correct()
|
||||||
|
{
|
||||||
|
if (this->active())
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tepsilon(this->turbulence().epsilon());
|
||||||
|
const volScalarField& epsilon = tepsilon();
|
||||||
|
|
||||||
|
tmp<volScalarField> tmu(this->turbulence().mu());
|
||||||
|
const volScalarField& mu = tmu();
|
||||||
|
|
||||||
|
tmp<volScalarField> tk(this->turbulence().k());
|
||||||
|
const volScalarField& k = tk();
|
||||||
|
|
||||||
|
tmp<volScalarField> trho(this->rho());
|
||||||
|
const volScalarField& rho = trho();
|
||||||
|
|
||||||
|
scalarField tauStar(epsilon.size(), 0);
|
||||||
|
|
||||||
|
if (version_ == EDCversions::v2016)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> ttc(this->chemistryPtr_->tc());
|
||||||
|
const volScalarField& tc = ttc();
|
||||||
|
|
||||||
|
forAll(tauStar, i)
|
||||||
|
{
|
||||||
|
const scalar nu = mu[i]/(rho[i] + SMALL);
|
||||||
|
|
||||||
|
const scalar Da =
|
||||||
|
max(min(sqrt(nu/(epsilon[i] + SMALL))/tc[i], 10), 1e-10);
|
||||||
|
|
||||||
|
const scalar ReT = sqr(k[i])/(nu*epsilon[i] + SMALL);
|
||||||
|
const scalar CtauI = min(C1_/(Da*sqrt(ReT + 1)), 2.1377);
|
||||||
|
|
||||||
|
const scalar CgammaI =
|
||||||
|
max(min(C2_*sqrt(Da*(ReT + 1)), 5), 0.4082);
|
||||||
|
|
||||||
|
const scalar gammaL =
|
||||||
|
CgammaI*pow025(nu*epsilon[i]/(sqr(k[i]) + SMALL));
|
||||||
|
|
||||||
|
tauStar[i] = CtauI*sqrt(nu/(epsilon[i] + SMALL));
|
||||||
|
|
||||||
|
if (gammaL >= 1)
|
||||||
|
{
|
||||||
|
kappa_[i] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kappa_[i] =
|
||||||
|
max
|
||||||
|
(
|
||||||
|
min
|
||||||
|
(
|
||||||
|
pow(gammaL, exp1_)/(1 - pow(gammaL, exp2_)),
|
||||||
|
1
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
forAll(tauStar, i)
|
||||||
|
{
|
||||||
|
const scalar nu = mu[i]/(rho[i] + SMALL);
|
||||||
|
const scalar gammaL =
|
||||||
|
Cgamma_*pow025(nu*epsilon[i]/(sqr(k[i]) + SMALL));
|
||||||
|
|
||||||
|
tauStar[i] = Ctau_*sqrt(nu/(epsilon[i] + SMALL));
|
||||||
|
if (gammaL >= 1)
|
||||||
|
{
|
||||||
|
kappa_[i] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
kappa_[i] =
|
||||||
|
max
|
||||||
|
(
|
||||||
|
min
|
||||||
|
(
|
||||||
|
pow(gammaL, exp1_)/(1 - pow(gammaL, exp2_)),
|
||||||
|
1
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->chemistryPtr_->solve(tauStar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::fvScalarMatrix>
|
||||||
|
Foam::combustionModels::EDC<Type>::R(volScalarField& Y) const
|
||||||
|
{
|
||||||
|
return kappa_*laminar<Type>::R(Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::volScalarField>
|
||||||
|
Foam::combustionModels::EDC<Type>::Qdot() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tQdot
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
IOobject::groupName(typeName + ":Qdot", this->phaseName_),
|
||||||
|
this->mesh().time().timeName(),
|
||||||
|
this->mesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
this->mesh(),
|
||||||
|
dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this->active())
|
||||||
|
{
|
||||||
|
tQdot.ref() = kappa_*this->chemistryPtr_->Qdot();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tQdot;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::combustionModels::EDC<Type>::read()
|
||||||
|
{
|
||||||
|
if (Type::read())
|
||||||
|
{
|
||||||
|
version_ =
|
||||||
|
(
|
||||||
|
EDCversionNames
|
||||||
|
[
|
||||||
|
this->coeffs().lookupOrDefault
|
||||||
|
(
|
||||||
|
"version",
|
||||||
|
word(EDCversionNames[EDCdefaultVersion])
|
||||||
|
)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
C1_ = this->coeffs().lookupOrDefault("C1", 0.05774);
|
||||||
|
C2_ = this->coeffs().lookupOrDefault("C2", 0.5);
|
||||||
|
Cgamma_ = this->coeffs().lookupOrDefault("Cgamma", 2.1377);
|
||||||
|
Ctau_ = this->coeffs().lookupOrDefault("Ctau", 0.4083);
|
||||||
|
exp1_ = this->coeffs().lookupOrDefault("exp1", EDCexp1[int(version_)]);
|
||||||
|
exp2_ = this->coeffs().lookupOrDefault("exp2", EDCexp2[int(version_)]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
214
src/combustionModels/EDC/EDC.H
Normal file
214
src/combustionModels/EDC/EDC.H
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::combustionModels::EDC
|
||||||
|
|
||||||
|
Description
|
||||||
|
Eddy Dissipation Concept (EDC) turbulent combustion model.
|
||||||
|
|
||||||
|
This model considers that the reaction occurs in the regions of the flow
|
||||||
|
where the dissipation of turbulence kinetic energy takes place (fine
|
||||||
|
structures). The mass fraction of the fine structures and the mean residence
|
||||||
|
time are provided by an energy cascade model.
|
||||||
|
|
||||||
|
There are many versions and developments of the EDC model, 4 of which are
|
||||||
|
currently supported in this implementation: v1981, v1996, v2005 and
|
||||||
|
v2016. The model variant is selected using the optional \c version entry in
|
||||||
|
the \c EDCCoeffs dictionary, \eg
|
||||||
|
|
||||||
|
\verbatim
|
||||||
|
EDCCoeffs
|
||||||
|
{
|
||||||
|
version v2016;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
The default version is \c v2015 if the \c version entry is not specified.
|
||||||
|
|
||||||
|
Model versions and references:
|
||||||
|
\verbatim
|
||||||
|
Version v2005:
|
||||||
|
|
||||||
|
Cgamma = 2.1377
|
||||||
|
Ctau = 0.4083
|
||||||
|
kappa = gammaL^exp1 / (1 - gammaL^exp2),
|
||||||
|
|
||||||
|
where exp1 = 2, and exp2 = 2.
|
||||||
|
|
||||||
|
Magnussen, B. F. (2005, June).
|
||||||
|
The Eddy Dissipation Concept -
|
||||||
|
A Bridge Between Science and Technology.
|
||||||
|
In ECCOMAS thematic conference on computational combustion
|
||||||
|
(pp. 21-24).
|
||||||
|
|
||||||
|
Version v1981:
|
||||||
|
|
||||||
|
Changes coefficients exp1 = 3 and exp2 = 3
|
||||||
|
|
||||||
|
Magnussen, B. (1981, January).
|
||||||
|
On the structure of turbulence and a generalized
|
||||||
|
eddy dissipation concept for chemical reaction in turbulent flow.
|
||||||
|
In 19th Aerospace Sciences Meeting (p. 42).
|
||||||
|
|
||||||
|
Version v1996:
|
||||||
|
|
||||||
|
Changes coefficients exp1 = 2 and exp2 = 3
|
||||||
|
|
||||||
|
Gran, I. R., & Magnussen, B. F. (1996).
|
||||||
|
A numerical study of a bluff-body stabilized diffusion flame.
|
||||||
|
Part 2. Influence of combustion modeling and finite-rate chemistry.
|
||||||
|
Combustion Science and Technology, 119(1-6), 191-217.
|
||||||
|
|
||||||
|
Version v2016:
|
||||||
|
|
||||||
|
Use local constants computed from the turbulent Da and Re numbers.
|
||||||
|
|
||||||
|
Parente, A., Malik, M. R., Contino, F., Cuoci, A., & Dally, B. B.
|
||||||
|
(2016).
|
||||||
|
Extension of the Eddy Dissipation Concept for
|
||||||
|
turbulence/chemistry interactions to MILD combustion.
|
||||||
|
Fuel, 163, 98-111.
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
EDC.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef EDC_H
|
||||||
|
#define EDC_H
|
||||||
|
|
||||||
|
#include "../laminar/laminar.H"
|
||||||
|
#include "NamedEnum.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace combustionModels
|
||||||
|
{
|
||||||
|
|
||||||
|
//- EDC model versions
|
||||||
|
enum class EDCversions
|
||||||
|
{
|
||||||
|
v1981,
|
||||||
|
v1996,
|
||||||
|
v2005,
|
||||||
|
v2016
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const NamedEnum<EDCversions, 4> EDCversionNames;
|
||||||
|
extern const EDCversions EDCdefaultVersion;
|
||||||
|
|
||||||
|
const scalar EDCexp1[] = {3, 2, 2, 2};
|
||||||
|
const scalar EDCexp2[] = {3, 3, 2, 2};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class EDC Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class EDC
|
||||||
|
:
|
||||||
|
public laminar<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- The selected model version
|
||||||
|
EDCversions version_;
|
||||||
|
|
||||||
|
scalar C1_;
|
||||||
|
scalar C2_;
|
||||||
|
scalar Cgamma_;
|
||||||
|
scalar Ctau_;
|
||||||
|
scalar exp1_;
|
||||||
|
scalar exp2_;
|
||||||
|
|
||||||
|
//- Mixing parameter
|
||||||
|
volScalarField kappa_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow copy construct
|
||||||
|
EDC(const EDC&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const EDC&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("EDC");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
EDC
|
||||||
|
(
|
||||||
|
const word& modelType,
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& combustionProperties,
|
||||||
|
const word& phaseName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~EDC();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Correct combustion rate
|
||||||
|
virtual void correct();
|
||||||
|
|
||||||
|
//- Fuel consumption rate matrix.
|
||||||
|
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
|
||||||
|
|
||||||
|
//- Heat release rate [kg/m/s3]
|
||||||
|
virtual tmp<volScalarField> Qdot() const;
|
||||||
|
|
||||||
|
//- Update properties from given dictionary
|
||||||
|
virtual bool read();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace combustionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "EDC.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
61
src/combustionModels/EDC/EDCs.C
Normal file
61
src/combustionModels/EDC/EDCs.C
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "makeCombustionTypes.H"
|
||||||
|
|
||||||
|
#include "psiChemistryCombustion.H"
|
||||||
|
#include "rhoChemistryCombustion.H"
|
||||||
|
#include "EDC.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<>
|
||||||
|
const char* Foam::NamedEnum
|
||||||
|
<
|
||||||
|
Foam::combustionModels::EDCversions,
|
||||||
|
4
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"v1981",
|
||||||
|
"v1996",
|
||||||
|
"v2005",
|
||||||
|
"v2016"
|
||||||
|
};
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::combustionModels::EDCversions, 4>
|
||||||
|
Foam::combustionModels::EDCversionNames;
|
||||||
|
|
||||||
|
const Foam::combustionModels::EDCversions
|
||||||
|
Foam::combustionModels::EDCdefaultVersion
|
||||||
|
(
|
||||||
|
Foam::combustionModels::EDCversions::v2005
|
||||||
|
);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makeCombustionTypes(EDC, psiChemistryCombustion, psiCombustionModel);
|
||||||
|
makeCombustionTypes(EDC, rhoChemistryCombustion, rhoCombustionModel);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -14,6 +14,7 @@ diffusion/diffusions.C
|
|||||||
infinitelyFastChemistry/infinitelyFastChemistrys.C
|
infinitelyFastChemistry/infinitelyFastChemistrys.C
|
||||||
|
|
||||||
PaSR/PaSRs.C
|
PaSR/PaSRs.C
|
||||||
|
EDC/EDCs.C
|
||||||
|
|
||||||
eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C
|
eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "surfaceInterpolate.H"
|
#include "surfaceInterpolate.H"
|
||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
#include "fvMatrices.H"
|
#include "fvMatrices.H"
|
||||||
|
#include "Constant.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ scalar CrankNicolsonDdtScheme<Type>::coef_
|
|||||||
{
|
{
|
||||||
if (mesh().time().timeIndex() > ddt0.startTimeIndex())
|
if (mesh().time().timeIndex() > ddt0.startTimeIndex())
|
||||||
{
|
{
|
||||||
return 1 + ocCoeff_;
|
return 1 + ocCoeff();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -218,7 +219,7 @@ scalar CrankNicolsonDdtScheme<Type>::coef0_
|
|||||||
{
|
{
|
||||||
if (mesh().time().timeIndex() > ddt0.startTimeIndex() + 1)
|
if (mesh().time().timeIndex() > ddt0.startTimeIndex() + 1)
|
||||||
{
|
{
|
||||||
return 1 + ocCoeff_;
|
return 1 + ocCoeff();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -256,9 +257,9 @@ tmp<GeoField> CrankNicolsonDdtScheme<Type>::offCentre_
|
|||||||
const GeoField& ddt0
|
const GeoField& ddt0
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (ocCoeff_ < 1)
|
if (ocCoeff() < 1)
|
||||||
{
|
{
|
||||||
return ocCoeff_*ddt0;
|
return ocCoeff()*ddt0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -277,7 +278,70 @@ const FieldField<fvPatchField, Type>& ff
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
CrankNicolsonDdtScheme<Type>::CrankNicolsonDdtScheme(const fvMesh& mesh)
|
||||||
|
:
|
||||||
|
ddtScheme<Type>(mesh),
|
||||||
|
ocCoeff_(new Function1Types::Constant<scalar>("ocCoeff", 1))
|
||||||
|
{
|
||||||
|
// Ensure the old-old-time cell volumes are available
|
||||||
|
// for moving meshes
|
||||||
|
if (mesh.moving())
|
||||||
|
{
|
||||||
|
mesh.V00();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
CrankNicolsonDdtScheme<Type>::CrankNicolsonDdtScheme
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
Istream& is
|
||||||
|
)
|
||||||
|
:
|
||||||
|
ddtScheme<Type>(mesh, is)
|
||||||
|
{
|
||||||
|
token firstToken(is);
|
||||||
|
|
||||||
|
if (firstToken.isNumber())
|
||||||
|
{
|
||||||
|
const scalar ocCoeff = firstToken.scalarToken();
|
||||||
|
if (ocCoeff < 0 || ocCoeff > 1)
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction
|
||||||
|
(
|
||||||
|
is
|
||||||
|
) << "Off-centreing coefficient = " << ocCoeff
|
||||||
|
<< " should be >= 0 and <= 1"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
ocCoeff_ = new Function1Types::Constant<scalar>
|
||||||
|
(
|
||||||
|
"ocCoeff",
|
||||||
|
ocCoeff
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
is.putBack(firstToken);
|
||||||
|
dictionary dict(is);
|
||||||
|
ocCoeff_ = Function1<scalar>::New("ocCoeff", dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure the old-old-time cell volumes are available
|
||||||
|
// for moving meshes
|
||||||
|
if (mesh.moving())
|
||||||
|
{
|
||||||
|
mesh.V00();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
tmp<GeometricField<Type, fvPatchField, volMesh>>
|
||||||
|
|||||||
@ -35,13 +35,28 @@ Description
|
|||||||
geometries and it is necessary to "off-centre" the scheme to stabilize it
|
geometries and it is necessary to "off-centre" the scheme to stabilize it
|
||||||
while retaining greater temporal accuracy than the first-order
|
while retaining greater temporal accuracy than the first-order
|
||||||
Euler-implicit scheme. Off-centering is specified via the mandatory
|
Euler-implicit scheme. Off-centering is specified via the mandatory
|
||||||
coefficient in the range [0,1] following the scheme name e.g.
|
coefficient \c ocCoeff in the range [0,1] following the scheme name e.g.
|
||||||
\verbatim
|
\verbatim
|
||||||
ddtSchemes
|
ddtSchemes
|
||||||
{
|
{
|
||||||
default CrankNicolson 0.9;
|
default CrankNicolson 0.9;
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
or with an optional "ramp" function to transition from the Euler scheme to
|
||||||
|
Crank-Nicolson over a initial period to avoid start-up problems, e.g.
|
||||||
|
\verbatim
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default CrankNicolson
|
||||||
|
ocCoeff
|
||||||
|
{
|
||||||
|
type scale;
|
||||||
|
scale linearRamp;
|
||||||
|
duration 0.01;
|
||||||
|
value 0.9;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
With a coefficient of 1 the scheme is fully centred and second-order,
|
With a coefficient of 1 the scheme is fully centred and second-order,
|
||||||
with a coefficient of 0 the scheme is equivalent to Euler-implicit.
|
with a coefficient of 0 the scheme is equivalent to Euler-implicit.
|
||||||
A coefficient of 0.9 has been found to be suitable for a range of cases for
|
A coefficient of 0.9 has been found to be suitable for a range of cases for
|
||||||
@ -79,6 +94,7 @@ SourceFiles
|
|||||||
#define CrankNicolsonDdtScheme_H
|
#define CrankNicolsonDdtScheme_H
|
||||||
|
|
||||||
#include "ddtScheme.H"
|
#include "ddtScheme.H"
|
||||||
|
#include "Function1.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -140,8 +156,9 @@ class CrankNicolsonDdtScheme
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Off-centering coefficient, 1 -> CN, less than one blends with EI
|
//- Off-centering coefficient function
|
||||||
scalar ocCoeff_;
|
// 1 -> CN, less than one blends with EI
|
||||||
|
autoPtr<Function1<scalar>> ocCoeff_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -197,42 +214,10 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh
|
//- Construct from mesh
|
||||||
CrankNicolsonDdtScheme(const fvMesh& mesh)
|
CrankNicolsonDdtScheme(const fvMesh& mesh);
|
||||||
:
|
|
||||||
ddtScheme<Type>(mesh),
|
|
||||||
ocCoeff_(1.0)
|
|
||||||
{
|
|
||||||
// Ensure the old-old-time cell volumes are available
|
|
||||||
// for moving meshes
|
|
||||||
if (mesh.moving())
|
|
||||||
{
|
|
||||||
mesh.V00();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Construct from mesh and Istream
|
//- Construct from mesh and Istream
|
||||||
CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is)
|
CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is);
|
||||||
:
|
|
||||||
ddtScheme<Type>(mesh, is),
|
|
||||||
ocCoeff_(readScalar(is))
|
|
||||||
{
|
|
||||||
if (ocCoeff_ < 0 || ocCoeff_ > 1)
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction
|
|
||||||
(
|
|
||||||
is
|
|
||||||
) << "Off-centreing coefficient = " << ocCoeff_
|
|
||||||
<< " should be >= 0 and <= 1"
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure the old-old-time cell volumes are available
|
|
||||||
// for moving meshes
|
|
||||||
if (mesh.moving())
|
|
||||||
{
|
|
||||||
mesh.V00();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -243,10 +228,10 @@ public:
|
|||||||
return fv::ddtScheme<Type>::mesh();
|
return fv::ddtScheme<Type>::mesh();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return the off-centreing coefficient
|
//- Return the current off-centreing coefficient
|
||||||
scalar ocCoeff() const
|
scalar ocCoeff() const
|
||||||
{
|
{
|
||||||
return ocCoeff_;
|
return ocCoeff_->value(mesh().time().value());
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<GeometricField<Type, fvPatchField, volMesh>> fvcDdt
|
tmp<GeometricField<Type, fvPatchField, volMesh>> fvcDdt
|
||||||
|
|||||||
@ -76,6 +76,17 @@ void Foam::functionObjects::fieldAverage::initialize()
|
|||||||
{
|
{
|
||||||
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
|
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check if totalTime_ has been set otherwise initialize
|
||||||
|
forAll(totalTime_, fieldi)
|
||||||
|
{
|
||||||
|
if (totalTime_[fieldi] < 0)
|
||||||
|
{
|
||||||
|
totalTime_[fieldi] = obr_.time().deltaTValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|
||||||
@ -224,8 +235,10 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
|
|||||||
totalIter_.clear();
|
totalIter_.clear();
|
||||||
totalIter_.setSize(faItems_.size(), 1);
|
totalIter_.setSize(faItems_.size(), 1);
|
||||||
|
|
||||||
|
// Initialize totalTime with negative values
|
||||||
|
// to indicate that it has not been set
|
||||||
totalTime_.clear();
|
totalTime_.clear();
|
||||||
totalTime_.setSize(faItems_.size(), obr().time().deltaTValue());
|
totalTime_.setSize(faItems_.size(), -1);
|
||||||
|
|
||||||
if (restartOnRestart_ || restartOnOutput_)
|
if (restartOnRestart_ || restartOnOutput_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -28,11 +28,13 @@ Group
|
|||||||
grpUtilitiesFunctionObjects
|
grpUtilitiesFunctionObjects
|
||||||
|
|
||||||
Description
|
Description
|
||||||
This function object overrides the calculation time step. Can only be used
|
This function object overrides the calculation time step.
|
||||||
with solvers with adjustTimeStep control (e.g. pimpleFoam). It makes no
|
|
||||||
attempt to co-operate with other time step 'controllers', e.g. maxCo, other
|
Can only be used with solvers with adjustTimeStep control (e.g.
|
||||||
functionObjects. Supports 'enabled' flag but none of the other options
|
pimpleFoam). It makes no attempt to co-operate with other time step
|
||||||
'timeStart', 'timeEnd', 'writeControl' etc.
|
'controllers', e.g. maxCo, other functionObjects. Supports 'enabled'
|
||||||
|
flag but none of the other options 'timeStart', 'timeEnd', 'writeControl'
|
||||||
|
etc.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
Example of function object specification to manipulate the time step:
|
Example of function object specification to manipulate the time step:
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -408,6 +408,11 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
|
|||||||
// All interactions done
|
// All interactions done
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (pp.coupled())
|
||||||
|
{
|
||||||
|
// Don't apply the patchInteraction models to coupled boundaries
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Invoke patch interaction model
|
// Invoke patch interaction model
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -190,6 +190,10 @@ bool Foam::LocalInteraction<CloudType>::correct
|
|||||||
|
|
||||||
switch (it)
|
switch (it)
|
||||||
{
|
{
|
||||||
|
case PatchInteractionModel<CloudType>::itNone:
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case PatchInteractionModel<CloudType>::itEscape:
|
case PatchInteractionModel<CloudType>::itEscape:
|
||||||
{
|
{
|
||||||
scalar dm = p.mass()*p.nParticle();
|
scalar dm = p.mass()*p.nParticle();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -74,7 +74,6 @@ Foam::patchInteractionDataList::patchInteractionDataList
|
|||||||
(
|
(
|
||||||
!pp.coupled()
|
!pp.coupled()
|
||||||
&& !isA<emptyPolyPatch>(pp)
|
&& !isA<emptyPolyPatch>(pp)
|
||||||
&& !isA<cyclicAMIPolyPatch>(pp)
|
|
||||||
&& applyToPatch(pp.index()) < 0
|
&& applyToPatch(pp.index()) < 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -51,6 +51,11 @@ Foam::word Foam::PatchInteractionModel<CloudType>::interactionTypeToWord
|
|||||||
|
|
||||||
switch (itEnum)
|
switch (itEnum)
|
||||||
{
|
{
|
||||||
|
case itNone:
|
||||||
|
{
|
||||||
|
it = "none";
|
||||||
|
break;
|
||||||
|
}
|
||||||
case itRebound:
|
case itRebound:
|
||||||
{
|
{
|
||||||
it = "rebound";
|
it = "rebound";
|
||||||
@ -82,6 +87,10 @@ Foam::PatchInteractionModel<CloudType>::wordToInteractionType
|
|||||||
const word& itWord
|
const word& itWord
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if (itWord == "none")
|
||||||
|
{
|
||||||
|
return itNone;
|
||||||
|
}
|
||||||
if (itWord == "rebound")
|
if (itWord == "rebound")
|
||||||
{
|
{
|
||||||
return itRebound;
|
return itRebound;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -68,6 +68,7 @@ public:
|
|||||||
// Interaction types
|
// Interaction types
|
||||||
enum interactionType
|
enum interactionType
|
||||||
{
|
{
|
||||||
|
itNone,
|
||||||
itRebound,
|
itRebound,
|
||||||
itStick,
|
itStick,
|
||||||
itEscape,
|
itEscape,
|
||||||
|
|||||||
@ -114,6 +114,10 @@ bool Foam::StandardWallInteraction<CloudType>::correct
|
|||||||
{
|
{
|
||||||
switch (interactionType_)
|
switch (interactionType_)
|
||||||
{
|
{
|
||||||
|
case PatchInteractionModel<CloudType>::itNone:
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case PatchInteractionModel<CloudType>::itEscape:
|
case PatchInteractionModel<CloudType>::itEscape:
|
||||||
{
|
{
|
||||||
keepParticle = false;
|
keepParticle = false;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -111,13 +111,13 @@ Foam::vector Foam::ThermoSurfaceFilm<CloudType>::splashDirection
|
|||||||
const vector& nf
|
const vector& nf
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// azimuthal angle [rad]
|
// Azimuthal angle [rad]
|
||||||
const scalar phiSi = twoPi*rndGen_.sample01<scalar>();
|
const scalar phiSi = twoPi*rndGen_.sample01<scalar>();
|
||||||
|
|
||||||
// ejection angle [rad]
|
// Ejection angle [rad]
|
||||||
const scalar thetaSi = pi/180.0*(rndGen_.sample01<scalar>()*(50 - 5) + 5);
|
const scalar thetaSi = pi/180.0*(rndGen_.sample01<scalar>()*(50 - 5) + 5);
|
||||||
|
|
||||||
// direction vector of new parcel
|
// Direction vector of new parcel
|
||||||
const scalar alpha = sin(thetaSi);
|
const scalar alpha = sin(thetaSi);
|
||||||
const scalar dcorr = cos(thetaSi);
|
const scalar dcorr = cos(thetaSi);
|
||||||
const vector normal = alpha*(tanVec1*cos(phiSi) + tanVec2*sin(phiSi));
|
const vector normal = alpha*(tanVec1*cos(phiSi) + tanVec2*sin(phiSi));
|
||||||
@ -226,7 +226,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::drySplashInteraction
|
|||||||
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
|
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
|
||||||
const vector& nf = pp.faceNormals()[facei];
|
const vector& nf = pp.faceNormals()[facei];
|
||||||
|
|
||||||
// local pressure
|
// Local pressure
|
||||||
const scalar pc = thermo_.thermo().p()[p.cell()];
|
const scalar pc = thermo_.thermo().p()[p.cell()];
|
||||||
|
|
||||||
// Retrieve parcel properties
|
// Retrieve parcel properties
|
||||||
@ -247,13 +247,13 @@ void Foam::ThermoSurfaceFilm<CloudType>::drySplashInteraction
|
|||||||
// Critical Weber number
|
// Critical Weber number
|
||||||
const scalar Wec = Adry_*pow(La, -0.183);
|
const scalar Wec = Adry_*pow(La, -0.183);
|
||||||
|
|
||||||
if (We < Wec) // adhesion - assume absorb
|
if (We < Wec) // Adhesion - assume absorb
|
||||||
{
|
{
|
||||||
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
||||||
}
|
}
|
||||||
else // splash
|
else // Splash
|
||||||
{
|
{
|
||||||
// ratio of incident mass to splashing mass
|
// Ratio of incident mass to splashing mass
|
||||||
const scalar mRatio = 0.2 + 0.6*rndGen_.sample01<scalar>();
|
const scalar mRatio = 0.2 + 0.6*rndGen_.sample01<scalar>();
|
||||||
splashInteraction
|
splashInteraction
|
||||||
(filmModel, p, pp, facei, mRatio, We, Wec, sigma, keepParticle);
|
(filmModel, p, pp, facei, mRatio, We, Wec, sigma, keepParticle);
|
||||||
@ -282,7 +282,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
|
|||||||
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
|
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
|
||||||
const vector& nf = pp.faceNormals()[facei];
|
const vector& nf = pp.faceNormals()[facei];
|
||||||
|
|
||||||
// local pressure
|
// Local pressure
|
||||||
const scalar pc = thermo_.thermo().p()[p.cell()];
|
const scalar pc = thermo_.thermo().p()[p.cell()];
|
||||||
|
|
||||||
// Retrieve parcel properties
|
// Retrieve parcel properties
|
||||||
@ -305,31 +305,31 @@ void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
|
|||||||
// Critical Weber number
|
// Critical Weber number
|
||||||
const scalar Wec = Awet_*pow(La, -0.183);
|
const scalar Wec = Awet_*pow(La, -0.183);
|
||||||
|
|
||||||
if (We < 1) // adhesion - assume absorb
|
if (We < 2) // Adhesion - assume absorb
|
||||||
{
|
{
|
||||||
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
||||||
}
|
}
|
||||||
else if ((We >= 1) && (We < 20)) // bounce
|
else if ((We >= 2) && (We < 20)) // Bounce
|
||||||
{
|
{
|
||||||
// incident angle of impingement
|
// Incident angle of impingement
|
||||||
const scalar theta = pi/2 - acos(U/mag(U) & nf);
|
const scalar theta = pi/2 - acos(U/mag(U) & nf);
|
||||||
|
|
||||||
// restitution coefficient
|
// Restitution coefficient
|
||||||
const scalar epsilon = 0.993 - theta*(1.76 - theta*(1.56 - theta*0.49));
|
const scalar epsilon = 0.993 - theta*(1.76 - theta*(1.56 - theta*0.49));
|
||||||
|
|
||||||
// update parcel velocity
|
// Update parcel velocity
|
||||||
U = -epsilon*(Un) + 5/7*(Ut);
|
U = -epsilon*(Un) + 5/7*(Ut);
|
||||||
|
|
||||||
keepParticle = true;
|
keepParticle = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ((We >= 20) && (We < Wec)) // spread - assume absorb
|
else if ((We >= 20) && (We < Wec)) // Spread - assume absorb
|
||||||
{
|
{
|
||||||
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
||||||
}
|
}
|
||||||
else // splash
|
else // Splash
|
||||||
{
|
{
|
||||||
// ratio of incident mass to splashing mass
|
// Ratio of incident mass to splashing mass
|
||||||
// splash mass can be > incident mass due to film entrainment
|
// splash mass can be > incident mass due to film entrainment
|
||||||
const scalar mRatio = 0.2 + 0.9*rndGen_.sample01<scalar>();
|
const scalar mRatio = 0.2 + 0.9*rndGen_.sample01<scalar>();
|
||||||
splashInteraction
|
splashInteraction
|
||||||
@ -371,24 +371,24 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
|||||||
const vector& posC = mesh.C()[p.cell()];
|
const vector& posC = mesh.C()[p.cell()];
|
||||||
const vector& posCf = mesh.Cf().boundaryField()[pp.index()][facei];
|
const vector& posCf = mesh.Cf().boundaryField()[pp.index()][facei];
|
||||||
|
|
||||||
// total mass of (all) splashed parcels
|
// Total mass of (all) splashed parcels
|
||||||
const scalar mSplash = m*mRatio;
|
const scalar mSplash = m*mRatio;
|
||||||
|
|
||||||
// number of splashed particles per incoming particle
|
// Number of splashed particles per incoming particle
|
||||||
const scalar Ns = 5.0*(We/Wec - 1.0);
|
const scalar Ns = 5.0*(We/Wec - 1.0);
|
||||||
|
|
||||||
// average diameter of splashed particles
|
// Average diameter of splashed particles
|
||||||
const scalar dBarSplash = 1/cbrt(6.0)*cbrt(mRatio/Ns)*d + ROOTVSMALL;
|
const scalar dBarSplash = 1/cbrt(6.0)*cbrt(mRatio/Ns)*d + ROOTVSMALL;
|
||||||
|
|
||||||
// cumulative diameter splash distribution
|
// Cumulative diameter splash distribution
|
||||||
const scalar dMax = 0.9*cbrt(mRatio)*d;
|
const scalar dMax = 0.9*cbrt(mRatio)*d;
|
||||||
const scalar dMin = 0.1*dMax;
|
const scalar dMin = 0.1*dMax;
|
||||||
const scalar K = exp(-dMin/dBarSplash) - exp(-dMax/dBarSplash);
|
const scalar K = exp(-dMin/dBarSplash) - exp(-dMax/dBarSplash);
|
||||||
|
|
||||||
// surface energy of secondary parcels [J]
|
// Surface energy of secondary parcels [J]
|
||||||
scalar ESigmaSec = 0;
|
scalar ESigmaSec = 0;
|
||||||
|
|
||||||
// sample splash distribution to determine secondary parcel diameters
|
// Sample splash distribution to determine secondary parcel diameters
|
||||||
scalarList dNew(parcelsPerSplash_);
|
scalarList dNew(parcelsPerSplash_);
|
||||||
scalarList npNew(parcelsPerSplash_);
|
scalarList npNew(parcelsPerSplash_);
|
||||||
forAll(dNew, i)
|
forAll(dNew, i)
|
||||||
@ -399,26 +399,26 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
|||||||
ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]);
|
ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// incident kinetic energy [J]
|
// Incident kinetic energy [J]
|
||||||
const scalar EKIn = 0.5*m*magSqr(Urel);
|
const scalar EKIn = 0.5*m*magSqr(Urel);
|
||||||
|
|
||||||
// incident surface energy [J]
|
// Incident surface energy [J]
|
||||||
const scalar ESigmaIn = np*sigma*p.areaS(d);
|
const scalar ESigmaIn = np*sigma*p.areaS(d);
|
||||||
|
|
||||||
// dissipative energy
|
// Dissipative energy
|
||||||
const scalar Ed = max(0.8*EKIn, np*Wec/12*pi*sigma*sqr(d));
|
const scalar Ed = max(0.8*EKIn, np*Wec/12*pi*sigma*sqr(d));
|
||||||
|
|
||||||
// total energy [J]
|
// Total energy [J]
|
||||||
const scalar EKs = EKIn + ESigmaIn - ESigmaSec - Ed;
|
const scalar EKs = EKIn + ESigmaIn - ESigmaSec - Ed;
|
||||||
|
|
||||||
// switch to absorb if insufficient energy for splash
|
// Switch to absorb if insufficient energy for splash
|
||||||
if (EKs <= 0)
|
if (EKs <= 0)
|
||||||
{
|
{
|
||||||
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
absorbInteraction(filmModel, p, pp, facei, m, keepParticle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper variables to calculate magUns0
|
// Helper variables to calculate magUns0
|
||||||
const scalar logD = log(d);
|
const scalar logD = log(d);
|
||||||
const scalar coeff2 = log(dNew[0]) - logD + ROOTVSMALL;
|
const scalar coeff2 = log(dNew[0]) - logD + ROOTVSMALL;
|
||||||
scalar coeff1 = 0.0;
|
scalar coeff1 = 0.0;
|
||||||
@ -427,7 +427,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
|||||||
coeff1 += sqr(log(dNew[i]) - logD);
|
coeff1 += sqr(log(dNew[i]) - logD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// magnitude of the normal velocity of the first splashed parcel
|
// Magnitude of the normal velocity of the first splashed parcel
|
||||||
const scalar magUns0 =
|
const scalar magUns0 =
|
||||||
sqrt(2.0*parcelsPerSplash_*EKs/mSplash/(1.0 + coeff1/sqr(coeff2)));
|
sqrt(2.0*parcelsPerSplash_*EKs/mSplash/(1.0 + coeff1/sqr(coeff2)));
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
|||||||
pPtr->typeId() = splashParcelType_;
|
pPtr->typeId() = splashParcelType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// perturb new parcels towards the owner cell centre
|
// Perturb new parcels towards the owner cell centre
|
||||||
pPtr->position() += 0.5*rndGen_.sample01<scalar>()*(posC - posCf);
|
pPtr->position() += 0.5*rndGen_.sample01<scalar>()*(posC - posCf);
|
||||||
|
|
||||||
pPtr->nParticle() = npNew[i];
|
pPtr->nParticle() = npNew[i];
|
||||||
@ -466,7 +466,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
|||||||
nParcelsSplashed_++;
|
nParcelsSplashed_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// transfer remaining part of parcel to film 0 - splashMass can be -ve
|
// Transfer remaining part of parcel to film 0 - splashMass can be -ve
|
||||||
// if entraining from the film
|
// if entraining from the film
|
||||||
const scalar mDash = m - mSplash;
|
const scalar mDash = m - mSplash;
|
||||||
absorbInteraction(filmModel, p, pp, facei, mDash, keepParticle);
|
absorbInteraction(filmModel, p, pp, facei, mDash, keepParticle);
|
||||||
@ -613,11 +613,11 @@ bool Foam::ThermoSurfaceFilm<CloudType>::transferParcel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// transfer parcel/parcel interactions complete
|
// Transfer parcel/parcel interactions complete
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parcel not interacting with film
|
// Parcel not interacting with film
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,7 +39,7 @@ Description
|
|||||||
Bai and Gosman, `Mathematical modelling of wall films formed by
|
Bai and Gosman, `Mathematical modelling of wall films formed by
|
||||||
impinging sprays', SAE 960626, 1996
|
impinging sprays', SAE 960626, 1996
|
||||||
|
|
||||||
Bai et al, `Modelling off gasoline spray impingement', Atom. Sprays,
|
Bai et al, `Modelling of gasoline spray impingement', Atom. Sprays,
|
||||||
vol 12, pp 1-27, 2002
|
vol 12, pp 1-27, 2002
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,13 +25,11 @@ License
|
|||||||
|
|
||||||
#include "reactingOneDim.H"
|
#include "reactingOneDim.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "surfaceInterpolate.H"
|
|
||||||
#include "fvm.H"
|
#include "fvm.H"
|
||||||
#include "fvcDiv.H"
|
#include "fvcDiv.H"
|
||||||
#include "fvcVolumeIntegrate.H"
|
#include "fvcVolumeIntegrate.H"
|
||||||
#include "fvMatrices.H"
|
|
||||||
#include "absorptionEmissionModel.H"
|
|
||||||
#include "fvcLaplacian.H"
|
#include "fvcLaplacian.H"
|
||||||
|
#include "absorptionEmissionModel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -239,22 +237,21 @@ void reactingOneDim::solveContinuity()
|
|||||||
InfoInFunction << endl;
|
InfoInFunction << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!moveMesh_)
|
if (!moveMesh_)
|
||||||
{
|
{
|
||||||
fvScalarMatrix rhoEqn
|
fvScalarMatrix rhoEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(rho_)
|
fvm::ddt(rho_) == -solidChemistry_->RRg()
|
||||||
==
|
|
||||||
- solidChemistry_->RRg()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
rhoEqn.solve();
|
rhoEqn.solve();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const scalarField deltaV =
|
const scalarField deltaV
|
||||||
-solidChemistry_->RRg()*regionMesh().V()*time_.deltaT()/rho_;
|
(
|
||||||
|
-solidChemistry_->RRg()*regionMesh().V()*time_.deltaT()/rho_
|
||||||
|
);
|
||||||
|
|
||||||
updateMesh(deltaV);
|
updateMesh(deltaV);
|
||||||
}
|
}
|
||||||
@ -276,9 +273,7 @@ void reactingOneDim::solveSpeciesMass()
|
|||||||
|
|
||||||
fvScalarMatrix YiEqn
|
fvScalarMatrix YiEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(rho_, Yi)
|
fvm::ddt(rho_, Yi) == solidChemistry_->RRs(i)
|
||||||
==
|
|
||||||
solidChemistry_->RRs(i)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (regionMesh().moving())
|
if (regionMesh().moving())
|
||||||
@ -624,9 +619,9 @@ scalar reactingOneDim::solidRegionDiffNo() const
|
|||||||
{
|
{
|
||||||
surfaceScalarField KrhoCpbyDelta
|
surfaceScalarField KrhoCpbyDelta
|
||||||
(
|
(
|
||||||
regionMesh().surfaceInterpolation::deltaCoeffs()
|
sqr(regionMesh().surfaceInterpolation::deltaCoeffs())
|
||||||
* fvc::interpolate(kappa())
|
*fvc::interpolate(kappa())
|
||||||
/ fvc::interpolate(Cp()*rho_)
|
/fvc::interpolate(Cp()*rho_)
|
||||||
);
|
);
|
||||||
|
|
||||||
DiNum = max(KrhoCpbyDelta.primitiveField())*time().deltaTValue();
|
DiNum = max(KrhoCpbyDelta.primitiveField())*time().deltaTValue();
|
||||||
|
|||||||
@ -63,31 +63,6 @@ void Foam::regionModels::regionModel::constructMeshObjects()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::regionModels::regionModel::constructMeshObjects
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// construct region mesh
|
|
||||||
if (!time_.foundObject<fvMesh>(regionName_))
|
|
||||||
{
|
|
||||||
regionMeshPtr_.reset
|
|
||||||
(
|
|
||||||
new fvMesh
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
regionName_,
|
|
||||||
time_.timeName(),
|
|
||||||
time_,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::regionModels::regionModel::initialise()
|
void Foam::regionModels::regionModel::initialise()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -484,7 +459,7 @@ Foam::regionModels::regionModel::regionModel
|
|||||||
{
|
{
|
||||||
if (active_)
|
if (active_)
|
||||||
{
|
{
|
||||||
constructMeshObjects(dict);
|
constructMeshObjects();
|
||||||
initialise();
|
initialise();
|
||||||
|
|
||||||
if (readFields)
|
if (readFields)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -73,9 +73,6 @@ private:
|
|||||||
//- Construct region mesh and fields
|
//- Construct region mesh and fields
|
||||||
void constructMeshObjects();
|
void constructMeshObjects();
|
||||||
|
|
||||||
//- Construct region mesh and dictionary
|
|
||||||
void constructMeshObjects(const dictionary& dict);
|
|
||||||
|
|
||||||
//- Initialise the region
|
//- Initialise the region
|
||||||
void initialise();
|
void initialise();
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,9 @@ KINEMATICMODELS=submodels/kinematic
|
|||||||
$(KINEMATICMODELS)/force/force/force.C
|
$(KINEMATICMODELS)/force/force/force.C
|
||||||
$(KINEMATICMODELS)/force/force/forceNew.C
|
$(KINEMATICMODELS)/force/force/forceNew.C
|
||||||
$(KINEMATICMODELS)/force/forceList/forceList.C
|
$(KINEMATICMODELS)/force/forceList/forceList.C
|
||||||
$(KINEMATICMODELS)/force/contactAngleForce/contactAngleForce.C
|
$(KINEMATICMODELS)/force/contactAngleForces/contactAngleForce/contactAngleForce.C
|
||||||
|
$(KINEMATICMODELS)/force/contactAngleForces/distribution/distributionContactAngleForce.C
|
||||||
|
$(KINEMATICMODELS)/force/contactAngleForces/temperatureDependent/temperatureDependentContactAngleForce.C
|
||||||
$(KINEMATICMODELS)/force/thermocapillaryForce/thermocapillaryForce.C
|
$(KINEMATICMODELS)/force/thermocapillaryForce/thermocapillaryForce.C
|
||||||
|
|
||||||
$(KINEMATICMODELS)/injectionModel/injectionModel/injectionModel.C
|
$(KINEMATICMODELS)/injectionModel/injectionModel/injectionModel.C
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -42,7 +42,6 @@ namespace surfaceFilmModels
|
|||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(contactAngleForce, 0);
|
defineTypeNameAndDebug(contactAngleForce, 0);
|
||||||
addToRunTimeSelectionTable(force, contactAngleForce, dictionary);
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -93,21 +92,13 @@ void contactAngleForce::initialise()
|
|||||||
|
|
||||||
contactAngleForce::contactAngleForce
|
contactAngleForce::contactAngleForce
|
||||||
(
|
(
|
||||||
|
const word& typeName,
|
||||||
surfaceFilmModel& owner,
|
surfaceFilmModel& owner,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
force(typeName, owner, dict),
|
force(typeName, owner, dict),
|
||||||
Ccf_(readScalar(coeffDict_.lookup("Ccf"))),
|
Ccf_(readScalar(coeffDict_.lookup("Ccf"))),
|
||||||
rndGen_(label(0), -1),
|
|
||||||
distribution_
|
|
||||||
(
|
|
||||||
distributionModels::distributionModel::New
|
|
||||||
(
|
|
||||||
coeffDict_.subDict("contactAngleDistribution"),
|
|
||||||
rndGen_
|
|
||||||
)
|
|
||||||
),
|
|
||||||
mask_
|
mask_
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
@ -163,7 +154,10 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
|
|||||||
const volScalarField& alpha = owner_.alpha();
|
const volScalarField& alpha = owner_.alpha();
|
||||||
const volScalarField& sigma = owner_.sigma();
|
const volScalarField& sigma = owner_.sigma();
|
||||||
|
|
||||||
volVectorField gradAlpha(fvc::grad(alpha));
|
const tmp<volScalarField> ttheta = theta();
|
||||||
|
const volScalarField& theta = ttheta();
|
||||||
|
|
||||||
|
const volVectorField gradAlpha(fvc::grad(alpha));
|
||||||
|
|
||||||
forAll(nbr, facei)
|
forAll(nbr, facei)
|
||||||
{
|
{
|
||||||
@ -185,14 +179,14 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
|
|||||||
const scalar invDx = owner_.regionMesh().deltaCoeffs()[facei];
|
const scalar invDx = owner_.regionMesh().deltaCoeffs()[facei];
|
||||||
const vector n =
|
const vector n =
|
||||||
gradAlpha[celli]/(mag(gradAlpha[celli]) + ROOTVSMALL);
|
gradAlpha[celli]/(mag(gradAlpha[celli]) + ROOTVSMALL);
|
||||||
scalar theta = cos(degToRad(distribution_->sample()));
|
const scalar cosTheta = cos(degToRad(theta[celli]));
|
||||||
force[celli] += Ccf_*n*sigma[celli]*(1.0 - theta)/invDx;
|
force[celli] += Ccf_*n*sigma[celli]*(1 - cosTheta)/invDx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(alpha.boundaryField(), patchi)
|
forAll(alpha.boundaryField(), patchi)
|
||||||
{
|
{
|
||||||
if (!owner().isCoupledPatch(patchi))
|
if (!owner_.isCoupledPatch(patchi))
|
||||||
{
|
{
|
||||||
const fvPatchField<scalar>& alphaf = alpha.boundaryField()[patchi];
|
const fvPatchField<scalar>& alphaf = alpha.boundaryField()[patchi];
|
||||||
const fvPatchField<scalar>& maskf = mask_.boundaryField()[patchi];
|
const fvPatchField<scalar>& maskf = mask_.boundaryField()[patchi];
|
||||||
@ -210,9 +204,9 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
|
|||||||
const vector n =
|
const vector n =
|
||||||
gradAlpha[cellO]
|
gradAlpha[cellO]
|
||||||
/(mag(gradAlpha[cellO]) + ROOTVSMALL);
|
/(mag(gradAlpha[cellO]) + ROOTVSMALL);
|
||||||
scalar theta = cos(degToRad(distribution_->sample()));
|
const scalar cosTheta = cos(degToRad(theta[cellO]));
|
||||||
force[cellO] +=
|
force[cellO] +=
|
||||||
Ccf_*n*sigma[cellO]*(1.0 - theta)/invDx[facei];
|
Ccf_*n*sigma[cellO]*(1 - cosTheta)/invDx[facei];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -22,10 +22,10 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::contactAngleForce
|
Foam::regionModels::surfaceFilmModels::contactAngleForce
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Film contact angle force
|
Base-class for film contact angle force models.
|
||||||
|
|
||||||
The effect of the contact angle force can be ignored over a specified
|
The effect of the contact angle force can be ignored over a specified
|
||||||
distance from patches.
|
distance from patches.
|
||||||
@ -39,8 +39,6 @@ SourceFiles
|
|||||||
#define contactAngleForce_H
|
#define contactAngleForce_H
|
||||||
|
|
||||||
#include "force.H"
|
#include "force.H"
|
||||||
#include "distributionModel.H"
|
|
||||||
#include "cachedRandom.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -59,19 +57,11 @@ class contactAngleForce
|
|||||||
:
|
:
|
||||||
public force
|
public force
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Coefficient applied to the contact angle force
|
//- Coefficient applied to the contact angle force
|
||||||
scalar Ccf_;
|
scalar Ccf_;
|
||||||
|
|
||||||
//- Random number generator
|
|
||||||
cachedRandom rndGen_;
|
|
||||||
|
|
||||||
//- Parcel size PDF model
|
|
||||||
const autoPtr<distributionModels::distributionModel> distribution_;
|
|
||||||
|
|
||||||
//- Mask over which force is applied
|
//- Mask over which force is applied
|
||||||
volScalarField mask_;
|
volScalarField mask_;
|
||||||
|
|
||||||
@ -88,6 +78,12 @@ private:
|
|||||||
void operator=(const contactAngleForce&);
|
void operator=(const contactAngleForce&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Return the contact angle field
|
||||||
|
virtual tmp<volScalarField> theta() const = 0;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -99,6 +95,7 @@ public:
|
|||||||
//- Construct from surface film model
|
//- Construct from surface film model
|
||||||
contactAngleForce
|
contactAngleForce
|
||||||
(
|
(
|
||||||
|
const word& typeName,
|
||||||
surfaceFilmModel& owner,
|
surfaceFilmModel& owner,
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
@ -110,10 +107,8 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Evolution
|
//- Correct
|
||||||
|
virtual tmp<fvVectorMatrix> correct(volVectorField& U);
|
||||||
//- Correct
|
|
||||||
virtual tmp<fvVectorMatrix> correct(volVectorField& U);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "distributionContactAngleForce.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
namespace surfaceFilmModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(distributionContactAngleForce, 0);
|
||||||
|
addToRunTimeSelectionTable(force, distributionContactAngleForce, dictionary);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
distributionContactAngleForce::distributionContactAngleForce
|
||||||
|
(
|
||||||
|
surfaceFilmModel& owner,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
contactAngleForce(typeName, owner, dict),
|
||||||
|
rndGen_(label(0), -1),
|
||||||
|
distribution_
|
||||||
|
(
|
||||||
|
distributionModels::distributionModel::New
|
||||||
|
(
|
||||||
|
coeffDict_.subDict("distribution"),
|
||||||
|
rndGen_
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
distributionContactAngleForce::~distributionContactAngleForce()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tmp<volScalarField> distributionContactAngleForce::theta() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> ttheta
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
typeName + ":theta",
|
||||||
|
owner_.time().timeName(),
|
||||||
|
owner_.regionMesh()
|
||||||
|
),
|
||||||
|
owner_.regionMesh(),
|
||||||
|
dimensionedScalar("0", dimless, 0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField& theta = ttheta.ref();
|
||||||
|
volScalarField::Internal& thetai = theta.ref();
|
||||||
|
|
||||||
|
forAll(thetai, celli)
|
||||||
|
{
|
||||||
|
thetai[celli] = distribution_->sample();
|
||||||
|
}
|
||||||
|
|
||||||
|
forAll(theta.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (!owner_.isCoupledPatch(patchi))
|
||||||
|
{
|
||||||
|
fvPatchField<scalar>& thetaf = theta.boundaryFieldRef()[patchi];
|
||||||
|
|
||||||
|
forAll(thetaf, facei)
|
||||||
|
{
|
||||||
|
thetaf[facei] = distribution_->sample();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ttheta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace surfaceFilmModels
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
/*---------------------------------------------------------------------------* \
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionModels::surfaceFilmModels::distributionContactAngleForce
|
||||||
|
|
||||||
|
Description
|
||||||
|
PDF distribution based film contact angle force
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::regionModels::surfaceFilmModels::contactAngleForce
|
||||||
|
Foam::distributionModels::distributionModel
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
distributionContactAngleForce.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef distributionContactAngleForce_H
|
||||||
|
#define distributionContactAngleForce_H
|
||||||
|
|
||||||
|
#include "contactAngleForce.H"
|
||||||
|
#include "distributionModel.H"
|
||||||
|
#include "cachedRandom.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
namespace surfaceFilmModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class distributionContactAngleForce Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class distributionContactAngleForce
|
||||||
|
:
|
||||||
|
public contactAngleForce
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Random number generator
|
||||||
|
cachedRandom rndGen_;
|
||||||
|
|
||||||
|
//- Parcel size PDF model
|
||||||
|
const autoPtr<distributionModels::distributionModel> distribution_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
distributionContactAngleForce(const distributionContactAngleForce&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const distributionContactAngleForce&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Return the contact angle field
|
||||||
|
virtual tmp<volScalarField> theta() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("distributionContactAngle");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from surface film model
|
||||||
|
distributionContactAngleForce
|
||||||
|
(
|
||||||
|
surfaceFilmModel& owner,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~distributionContactAngleForce();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace surfaceFilmModels
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,111 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "temperatureDependentContactAngleForce.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
namespace surfaceFilmModels
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(temperatureDependentContactAngleForce, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
force,
|
||||||
|
temperatureDependentContactAngleForce,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
temperatureDependentContactAngleForce::temperatureDependentContactAngleForce
|
||||||
|
(
|
||||||
|
surfaceFilmModel& owner,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
contactAngleForce(typeName, owner, dict),
|
||||||
|
thetaPtr_(Function1<scalar>::New("theta", coeffDict_))
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
temperatureDependentContactAngleForce::~temperatureDependentContactAngleForce()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
tmp<volScalarField> temperatureDependentContactAngleForce::theta() const
|
||||||
|
{
|
||||||
|
tmp<volScalarField> ttheta
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
typeName + ":theta",
|
||||||
|
owner_.time().timeName(),
|
||||||
|
owner_.regionMesh()
|
||||||
|
),
|
||||||
|
owner_.regionMesh(),
|
||||||
|
dimensionedScalar("0", dimless, 0)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
volScalarField& theta = ttheta.ref();
|
||||||
|
|
||||||
|
const volScalarField& T = owner_.T();
|
||||||
|
|
||||||
|
theta.ref().field() = thetaPtr_->value(T());
|
||||||
|
|
||||||
|
forAll(theta.boundaryField(), patchi)
|
||||||
|
{
|
||||||
|
if (!owner_.isCoupledPatch(patchi))
|
||||||
|
{
|
||||||
|
theta.boundaryFieldRef()[patchi] =
|
||||||
|
thetaPtr_->value(T.boundaryField()[patchi]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ttheta;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace surfaceFilmModels
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::regionModels::surfaceFilmModels::temperatureDependentContactAngleForce
|
||||||
|
|
||||||
|
Description
|
||||||
|
Temperature dependent contact angle force
|
||||||
|
|
||||||
|
The contact angle in degrees is specified as a \c Function1 type, to
|
||||||
|
enable the use of, e.g. contant, polynomial, table values.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::regionModels::surfaceFilmModels::contactAngleForce
|
||||||
|
Foam::Function1Types
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
temperatureDependentContactAngleForce.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef temperatureDependentContactAngleForce_H
|
||||||
|
#define temperatureDependentContactAngleForce_H
|
||||||
|
|
||||||
|
#include "contactAngleForce.H"
|
||||||
|
#include "Function1.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace regionModels
|
||||||
|
{
|
||||||
|
namespace surfaceFilmModels
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class temperatureDependentContactAngleForce Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class temperatureDependentContactAngleForce
|
||||||
|
:
|
||||||
|
public contactAngleForce
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Contact angle function
|
||||||
|
autoPtr<Function1<scalar>> thetaPtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private member functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
temperatureDependentContactAngleForce
|
||||||
|
(
|
||||||
|
const temperatureDependentContactAngleForce&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const temperatureDependentContactAngleForce&);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//- Return the contact angle field
|
||||||
|
virtual tmp<volScalarField> theta() const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("temperatureDependentContactAngle");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from surface film model
|
||||||
|
temperatureDependentContactAngleForce
|
||||||
|
(
|
||||||
|
surfaceFilmModel& owner,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~temperatureDependentContactAngleForce();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace surfaceFilmModels
|
||||||
|
} // End namespace regionModels
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -30,6 +30,7 @@ License
|
|||||||
#include "pointConstraints.H"
|
#include "pointConstraints.H"
|
||||||
#include "uniformDimensionedFields.H"
|
#include "uniformDimensionedFields.H"
|
||||||
#include "forces.H"
|
#include "forces.H"
|
||||||
|
#include "OneConstant.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -115,6 +116,7 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
|
|||||||
test_(coeffDict().lookupOrDefault<Switch>("test", false)),
|
test_(coeffDict().lookupOrDefault<Switch>("test", false)),
|
||||||
rhoInf_(1.0),
|
rhoInf_(1.0),
|
||||||
rhoName_(coeffDict().lookupOrDefault<word>("rho", "rho")),
|
rhoName_(coeffDict().lookupOrDefault<word>("rho", "rho")),
|
||||||
|
ramp_(nullptr),
|
||||||
curTimeIndex_(-1)
|
curTimeIndex_(-1)
|
||||||
{
|
{
|
||||||
if (rhoName_ == "rhoInf")
|
if (rhoName_ == "rhoInf")
|
||||||
@ -122,6 +124,15 @@ Foam::rigidBodyMeshMotion::rigidBodyMeshMotion
|
|||||||
rhoInf_ = readScalar(coeffDict().lookup("rhoInf"));
|
rhoInf_ = readScalar(coeffDict().lookup("rhoInf"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (coeffDict().found("ramp"))
|
||||||
|
{
|
||||||
|
ramp_ = Function1<scalar>::New("ramp", coeffDict());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ramp_ = new Function1Types::OneConstant<scalar>("ramp");
|
||||||
|
}
|
||||||
|
|
||||||
const dictionary& bodiesDict = coeffDict().subDict("bodies");
|
const dictionary& bodiesDict = coeffDict().subDict("bodies");
|
||||||
|
|
||||||
forAllConstIter(IDLList<entry>, bodiesDict, iter)
|
forAllConstIter(IDLList<entry>, bodiesDict, iter)
|
||||||
@ -232,10 +243,12 @@ void Foam::rigidBodyMeshMotion::solve()
|
|||||||
curTimeIndex_ = this->db().time().timeIndex();
|
curTimeIndex_ = this->db().time().timeIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scalar ramp = ramp_->value(t.value());
|
||||||
|
|
||||||
if (db().foundObject<uniformDimensionedVectorField>("g"))
|
if (db().foundObject<uniformDimensionedVectorField>("g"))
|
||||||
{
|
{
|
||||||
model_.g() =
|
model_.g() =
|
||||||
db().lookupObject<uniformDimensionedVectorField>("g").value();
|
ramp*db().lookupObject<uniformDimensionedVectorField>("g").value();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_)
|
if (test_)
|
||||||
@ -270,7 +283,7 @@ void Foam::rigidBodyMeshMotion::solve()
|
|||||||
functionObjects::forces f("forces", db(), forcesDict);
|
functionObjects::forces f("forces", db(), forcesDict);
|
||||||
f.calcForcesMoment();
|
f.calcForcesMoment();
|
||||||
|
|
||||||
fx[bodyID] = spatialVector(f.momentEff(), f.forceEff());
|
fx[bodyID] = ramp*spatialVector(f.momentEff(), f.forceEff());
|
||||||
}
|
}
|
||||||
|
|
||||||
model_.solve
|
model_.solve
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -43,6 +43,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "displacementMotionSolver.H"
|
#include "displacementMotionSolver.H"
|
||||||
#include "rigidBodyMotion.H"
|
#include "rigidBodyMotion.H"
|
||||||
|
#include "ramp.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -119,6 +120,9 @@ class rigidBodyMeshMotion
|
|||||||
// as rhoInf
|
// as rhoInf
|
||||||
word rhoName_;
|
word rhoName_;
|
||||||
|
|
||||||
|
//- Ramp the forces according to the specified function and period
|
||||||
|
autoPtr<Function1<scalar>> ramp_;
|
||||||
|
|
||||||
//- Current time index (used for updating)
|
//- Current time index (used for updating)
|
||||||
label curTimeIndex_;
|
label curTimeIndex_;
|
||||||
|
|
||||||
|
|||||||
@ -616,6 +616,8 @@ Foam::scalar Foam::TDACChemistryModel<CompType, ThermoType>::solve
|
|||||||
scalar solveChemistryCpuTime_ = 0;
|
scalar solveChemistryCpuTime_ = 0;
|
||||||
scalar searchISATCpuTime_ = 0;
|
scalar searchISATCpuTime_ = 0;
|
||||||
|
|
||||||
|
this->resetTabulationResults();
|
||||||
|
|
||||||
// Average number of active species
|
// Average number of active species
|
||||||
scalar nActiveSpecies = 0;
|
scalar nActiveSpecies = 0;
|
||||||
scalar nAvg = 0;
|
scalar nAvg = 0;
|
||||||
|
|||||||
@ -283,6 +283,8 @@ public:
|
|||||||
void setTabulationResultsGrow(const label celli);
|
void setTabulationResultsGrow(const label celli);
|
||||||
|
|
||||||
void setTabulationResultsRetrieve(const label celli);
|
void setTabulationResultsRetrieve(const label celli);
|
||||||
|
|
||||||
|
inline void resetTabulationResults();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -165,4 +165,14 @@ Foam::TDACChemistryModel<CompType, ThermoType>::specieComp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class CompType, class ThermoType>
|
||||||
|
void Foam::TDACChemistryModel<CompType, ThermoType>::resetTabulationResults()
|
||||||
|
{
|
||||||
|
forAll(tabulationResults_, tabi)
|
||||||
|
{
|
||||||
|
tabulationResults_[tabi] = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -222,6 +222,12 @@ Foam::interfaceProperties::nearInterface() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::interfaceProperties::correct()
|
||||||
|
{
|
||||||
|
calculateK();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::interfaceProperties::read()
|
bool Foam::interfaceProperties::read()
|
||||||
{
|
{
|
||||||
alpha1_.mesh().solverDict(alpha1_.name()).lookup("cAlpha") >> cAlpha_;
|
alpha1_.mesh().solverDict(alpha1_.name()).lookup("cAlpha") >> cAlpha_;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -127,16 +127,6 @@ public:
|
|||||||
return nHatf_;
|
return nHatf_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const volScalarField& K() const
|
|
||||||
{
|
|
||||||
return K_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dimensionedScalar& sigma() const
|
|
||||||
{
|
|
||||||
return sigma_;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp<volScalarField> sigmaK() const
|
tmp<volScalarField> sigmaK() const
|
||||||
{
|
{
|
||||||
return sigma_*K_;
|
return sigma_*K_;
|
||||||
@ -148,10 +138,7 @@ public:
|
|||||||
// Field values are 1 near and 0 away for the interface.
|
// Field values are 1 near and 0 away for the interface.
|
||||||
tmp<volScalarField> nearInterface() const;
|
tmp<volScalarField> nearInterface() const;
|
||||||
|
|
||||||
void correct()
|
void correct();
|
||||||
{
|
|
||||||
calculateK();
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read transportProperties dictionary
|
//- Read transportProperties dictionary
|
||||||
bool read();
|
bool read();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -76,7 +76,7 @@ class temperatureDependentAlphaContactAngleFvPatchScalarField
|
|||||||
//- Name of temperature field, default = "T"
|
//- Name of temperature field, default = "T"
|
||||||
word TName_;
|
word TName_;
|
||||||
|
|
||||||
//- Equilibrium contact angle table
|
//- Equilibrium contact angle function
|
||||||
autoPtr<Function1<scalar>> theta0_;
|
autoPtr<Function1<scalar>> theta0_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -19,66 +19,71 @@ convertToMeters 0.001;
|
|||||||
vertices
|
vertices
|
||||||
(
|
(
|
||||||
(-20.6 0 -0.5)
|
(-20.6 0 -0.5)
|
||||||
(-20.6 3 -0.5)
|
|
||||||
(-20.6 12.7 -0.5)
|
|
||||||
(-20.6 25.4 -0.5)
|
(-20.6 25.4 -0.5)
|
||||||
(0 -25.4 -0.5)
|
(0 -25.4 -0.5)
|
||||||
(0 -5 -0.5)
|
|
||||||
(0 0 -0.5)
|
(0 0 -0.5)
|
||||||
(0 3 -0.5)
|
|
||||||
(0 12.7 -0.5)
|
|
||||||
(0 25.4 -0.5)
|
(0 25.4 -0.5)
|
||||||
(206 -25.4 -0.5)
|
(206 -25.4 -0.5)
|
||||||
(206 -8.5 -0.5)
|
|
||||||
(206 0 -0.5)
|
(206 0 -0.5)
|
||||||
(206 6.5 -0.5)
|
|
||||||
(206 17 -0.5)
|
|
||||||
(206 25.4 -0.5)
|
(206 25.4 -0.5)
|
||||||
(290 -16.6 -0.5)
|
(290 -16.6 -0.5)
|
||||||
(290 -6.3 -0.5)
|
|
||||||
(290 0 -0.5)
|
(290 0 -0.5)
|
||||||
(290 4.5 -0.5)
|
|
||||||
(290 11 -0.5)
|
|
||||||
(290 16.6 -0.5)
|
(290 16.6 -0.5)
|
||||||
|
|
||||||
(-20.6 0 0.5)
|
(-20.6 0 0.5)
|
||||||
(-20.6 3 0.5)
|
|
||||||
(-20.6 12.7 0.5)
|
|
||||||
(-20.6 25.4 0.5)
|
(-20.6 25.4 0.5)
|
||||||
(0 -25.4 0.5)
|
(0 -25.4 0.5)
|
||||||
(0 -5 0.5)
|
|
||||||
(0 0 0.5)
|
(0 0 0.5)
|
||||||
(0 3 0.5)
|
|
||||||
(0 12.7 0.5)
|
|
||||||
(0 25.4 0.5)
|
(0 25.4 0.5)
|
||||||
(206 -25.4 0.5)
|
(206 -25.4 0.5)
|
||||||
(206 -8.5 0.5)
|
|
||||||
(206 0 0.5)
|
(206 0 0.5)
|
||||||
(206 6.5 0.5)
|
|
||||||
(206 17 0.5)
|
|
||||||
(206 25.4 0.5)
|
(206 25.4 0.5)
|
||||||
(290 -16.6 0.5)
|
(290 -16.6 0.5)
|
||||||
(290 -6.3 0.5)
|
|
||||||
(290 0 0.5)
|
(290 0 0.5)
|
||||||
(290 4.5 0.5)
|
|
||||||
(290 11 0.5)
|
|
||||||
(290 16.6 0.5)
|
(290 16.6 0.5)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
negY
|
||||||
|
(
|
||||||
|
(2 4 1)
|
||||||
|
(1 3 0.3)
|
||||||
|
);
|
||||||
|
|
||||||
|
posY
|
||||||
|
(
|
||||||
|
(1 4 2)
|
||||||
|
(2 3 4)
|
||||||
|
(2 4 0.25)
|
||||||
|
);
|
||||||
|
|
||||||
|
posYR
|
||||||
|
(
|
||||||
|
(2 1 1)
|
||||||
|
(1 1 0.25)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 6 7 1 22 28 29 23) (18 7 1) simpleGrading (0.5 1.8 1)
|
hex (0 3 4 1 11 14 15 12)
|
||||||
hex (1 7 8 2 23 29 30 24) (18 10 1) simpleGrading (0.5 4 1)
|
(18 30 1)
|
||||||
hex (2 8 9 3 24 30 31 25) (18 13 1) simpleGrading (0.5 0.25 1)
|
simpleGrading (0.5 $posY 1)
|
||||||
hex (4 10 11 5 26 32 33 27) (180 18 1) simpleGrading (4 1 1)
|
|
||||||
hex (5 11 12 6 27 33 34 28) (180 9 1) edgeGrading (4 4 4 4 0.5 1 1 0.5 1 1 1 1)
|
hex (2 5 6 3 13 16 17 14)
|
||||||
hex (6 12 13 7 28 34 35 29) (180 7 1) edgeGrading (4 4 4 4 1.8 1 1 1.8 1 1 1 1)
|
(180 27 1)
|
||||||
hex (7 13 14 8 29 35 36 30) (180 10 1) edgeGrading (4 4 4 4 4 1 1 4 1 1 1 1)
|
edgeGrading (4 4 4 4 $negY 1 1 $negY 1 1 1 1)
|
||||||
hex (8 14 15 9 30 36 37 31) (180 13 1) simpleGrading (4 0.25 1)
|
|
||||||
hex (10 16 17 11 32 38 39 33) (25 18 1) simpleGrading (2.5 1 1)
|
hex (3 6 7 4 14 17 18 15)
|
||||||
hex (11 17 18 12 33 39 40 34) (25 9 1) simpleGrading (2.5 1 1)
|
(180 30 1)
|
||||||
hex (12 18 19 13 34 40 41 35) (25 7 1) simpleGrading (2.5 1 1)
|
edgeGrading (4 4 4 4 $posY $posYR $posYR $posY 1 1 1 1)
|
||||||
hex (13 19 20 14 35 41 42 36) (25 10 1) simpleGrading (2.5 1 1)
|
|
||||||
hex (14 20 21 15 36 42 43 37) (25 13 1) simpleGrading (2.5 0.25 1)
|
hex (5 8 9 6 16 19 20 17)
|
||||||
|
(25 27 1)
|
||||||
|
simpleGrading (2.5 1 1)
|
||||||
|
|
||||||
|
hex (6 9 10 7 17 20 21 18)
|
||||||
|
(25 30 1)
|
||||||
|
simpleGrading (2.5 $posYR 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
@ -92,9 +97,7 @@ boundary
|
|||||||
type patch;
|
type patch;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(0 22 23 1)
|
(0 1 12 11)
|
||||||
(1 23 24 2)
|
|
||||||
(2 24 25 3)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
@ -102,11 +105,8 @@ boundary
|
|||||||
type patch;
|
type patch;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(16 17 39 38)
|
(8 9 20 19)
|
||||||
(17 18 40 39)
|
(9 10 21 20)
|
||||||
(18 19 41 40)
|
|
||||||
(19 20 42 41)
|
|
||||||
(20 21 43 42)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
upperWall
|
upperWall
|
||||||
@ -114,9 +114,9 @@ boundary
|
|||||||
type wall;
|
type wall;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(3 25 31 9)
|
(1 4 15 12)
|
||||||
(9 31 37 15)
|
(4 7 18 15)
|
||||||
(15 37 43 21)
|
(7 10 21 18)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
lowerWall
|
lowerWall
|
||||||
@ -124,11 +124,10 @@ boundary
|
|||||||
type wall;
|
type wall;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(0 6 28 22)
|
(0 3 14 11)
|
||||||
(6 5 27 28)
|
(3 2 13 14)
|
||||||
(5 4 26 27)
|
(2 5 16 13)
|
||||||
(4 10 32 26)
|
(5 8 19 16)
|
||||||
(10 16 38 32)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
frontAndBack
|
frontAndBack
|
||||||
@ -136,38 +135,18 @@ boundary
|
|||||||
type empty;
|
type empty;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(22 28 29 23)
|
(0 3 4 1)
|
||||||
(23 29 30 24)
|
(2 5 6 3)
|
||||||
(24 30 31 25)
|
(3 6 7 4)
|
||||||
(26 32 33 27)
|
(5 8 9 6)
|
||||||
(27 33 34 28)
|
(6 9 10 7)
|
||||||
(28 34 35 29)
|
(11 14 15 12)
|
||||||
(29 35 36 30)
|
(13 16 17 14)
|
||||||
(30 36 37 31)
|
(14 17 18 15)
|
||||||
(32 38 39 33)
|
(16 19 20 17)
|
||||||
(33 39 40 34)
|
(17 20 21 18)
|
||||||
(34 40 41 35)
|
|
||||||
(35 41 42 36)
|
|
||||||
(36 42 43 37)
|
|
||||||
(0 1 7 6)
|
|
||||||
(1 2 8 7)
|
|
||||||
(2 3 9 8)
|
|
||||||
(4 5 11 10)
|
|
||||||
(5 6 12 11)
|
|
||||||
(6 7 13 12)
|
|
||||||
(7 8 14 13)
|
|
||||||
(8 9 15 14)
|
|
||||||
(10 11 17 16)
|
|
||||||
(11 12 18 17)
|
|
||||||
(12 13 19 18)
|
|
||||||
(13 14 20 19)
|
|
||||||
(14 15 21 20)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mergePatchPairs
|
|
||||||
(
|
|
||||||
);
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -19,66 +19,71 @@ convertToMeters 0.001;
|
|||||||
vertices
|
vertices
|
||||||
(
|
(
|
||||||
(-20.6 0 -0.5)
|
(-20.6 0 -0.5)
|
||||||
(-20.6 3 -0.5)
|
|
||||||
(-20.6 12.7 -0.5)
|
|
||||||
(-20.6 25.4 -0.5)
|
(-20.6 25.4 -0.5)
|
||||||
(0 -25.4 -0.5)
|
(0 -25.4 -0.5)
|
||||||
(0 -5 -0.5)
|
|
||||||
(0 0 -0.5)
|
(0 0 -0.5)
|
||||||
(0 3 -0.5)
|
|
||||||
(0 12.7 -0.5)
|
|
||||||
(0 25.4 -0.5)
|
(0 25.4 -0.5)
|
||||||
(206 -25.4 -0.5)
|
(206 -25.4 -0.5)
|
||||||
(206 -8.5 -0.5)
|
|
||||||
(206 0 -0.5)
|
(206 0 -0.5)
|
||||||
(206 6.5 -0.5)
|
|
||||||
(206 17 -0.5)
|
|
||||||
(206 25.4 -0.5)
|
(206 25.4 -0.5)
|
||||||
(290 -16.6 -0.5)
|
(290 -16.6 -0.5)
|
||||||
(290 -6.3 -0.5)
|
|
||||||
(290 0 -0.5)
|
(290 0 -0.5)
|
||||||
(290 4.5 -0.5)
|
|
||||||
(290 11 -0.5)
|
|
||||||
(290 16.6 -0.5)
|
(290 16.6 -0.5)
|
||||||
|
|
||||||
(-20.6 0 0.5)
|
(-20.6 0 0.5)
|
||||||
(-20.6 3 0.5)
|
|
||||||
(-20.6 12.7 0.5)
|
|
||||||
(-20.6 25.4 0.5)
|
(-20.6 25.4 0.5)
|
||||||
(0 -25.4 0.5)
|
(0 -25.4 0.5)
|
||||||
(0 -5 0.5)
|
|
||||||
(0 0 0.5)
|
(0 0 0.5)
|
||||||
(0 3 0.5)
|
|
||||||
(0 12.7 0.5)
|
|
||||||
(0 25.4 0.5)
|
(0 25.4 0.5)
|
||||||
(206 -25.4 0.5)
|
(206 -25.4 0.5)
|
||||||
(206 -8.5 0.5)
|
|
||||||
(206 0 0.5)
|
(206 0 0.5)
|
||||||
(206 6.5 0.5)
|
|
||||||
(206 17 0.5)
|
|
||||||
(206 25.4 0.5)
|
(206 25.4 0.5)
|
||||||
(290 -16.6 0.5)
|
(290 -16.6 0.5)
|
||||||
(290 -6.3 0.5)
|
|
||||||
(290 0 0.5)
|
(290 0 0.5)
|
||||||
(290 4.5 0.5)
|
|
||||||
(290 11 0.5)
|
|
||||||
(290 16.6 0.5)
|
(290 16.6 0.5)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
negY
|
||||||
|
(
|
||||||
|
(2 4 1)
|
||||||
|
(1 3 0.3)
|
||||||
|
);
|
||||||
|
|
||||||
|
posY
|
||||||
|
(
|
||||||
|
(1 4 2)
|
||||||
|
(2 3 4)
|
||||||
|
(2 4 0.25)
|
||||||
|
);
|
||||||
|
|
||||||
|
posYR
|
||||||
|
(
|
||||||
|
(2 1 1)
|
||||||
|
(1 1 0.25)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 6 7 1 22 28 29 23) (18 7 1) simpleGrading (0.5 1.8 1)
|
hex (0 3 4 1 11 14 15 12)
|
||||||
hex (1 7 8 2 23 29 30 24) (18 10 1) simpleGrading (0.5 4 1)
|
(18 30 1)
|
||||||
hex (2 8 9 3 24 30 31 25) (18 13 1) simpleGrading (0.5 0.25 1)
|
simpleGrading (0.5 $posY 1)
|
||||||
hex (4 10 11 5 26 32 33 27) (180 18 1) simpleGrading (4 1 1)
|
|
||||||
hex (5 11 12 6 27 33 34 28) (180 9 1) edgeGrading (4 4 4 4 0.5 1 1 0.5 1 1 1 1)
|
hex (2 5 6 3 13 16 17 14)
|
||||||
hex (6 12 13 7 28 34 35 29) (180 7 1) edgeGrading (4 4 4 4 1.8 1 1 1.8 1 1 1 1)
|
(180 27 1)
|
||||||
hex (7 13 14 8 29 35 36 30) (180 10 1) edgeGrading (4 4 4 4 4 1 1 4 1 1 1 1)
|
edgeGrading (4 4 4 4 $negY 1 1 $negY 1 1 1 1)
|
||||||
hex (8 14 15 9 30 36 37 31) (180 13 1) simpleGrading (4 0.25 1)
|
|
||||||
hex (10 16 17 11 32 38 39 33) (25 18 1) simpleGrading (2.5 1 1)
|
hex (3 6 7 4 14 17 18 15)
|
||||||
hex (11 17 18 12 33 39 40 34) (25 9 1) simpleGrading (2.5 1 1)
|
(180 30 1)
|
||||||
hex (12 18 19 13 34 40 41 35) (25 7 1) simpleGrading (2.5 1 1)
|
edgeGrading (4 4 4 4 $posY $posYR $posYR $posY 1 1 1 1)
|
||||||
hex (13 19 20 14 35 41 42 36) (25 10 1) simpleGrading (2.5 1 1)
|
|
||||||
hex (14 20 21 15 36 42 43 37) (25 13 1) simpleGrading (2.5 0.25 1)
|
hex (5 8 9 6 16 19 20 17)
|
||||||
|
(25 27 1)
|
||||||
|
simpleGrading (2.5 1 1)
|
||||||
|
|
||||||
|
hex (6 9 10 7 17 20 21 18)
|
||||||
|
(25 30 1)
|
||||||
|
simpleGrading (2.5 $posYR 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
@ -92,9 +97,7 @@ boundary
|
|||||||
type patch;
|
type patch;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(0 22 23 1)
|
(0 1 12 11)
|
||||||
(1 23 24 2)
|
|
||||||
(2 24 25 3)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
outlet
|
outlet
|
||||||
@ -102,11 +105,8 @@ boundary
|
|||||||
type patch;
|
type patch;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(16 17 39 38)
|
(8 9 20 19)
|
||||||
(17 18 40 39)
|
(9 10 21 20)
|
||||||
(18 19 41 40)
|
|
||||||
(19 20 42 41)
|
|
||||||
(20 21 43 42)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
upperWall
|
upperWall
|
||||||
@ -114,9 +114,9 @@ boundary
|
|||||||
type wall;
|
type wall;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(3 25 31 9)
|
(1 4 15 12)
|
||||||
(9 31 37 15)
|
(4 7 18 15)
|
||||||
(15 37 43 21)
|
(7 10 21 18)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
lowerWall
|
lowerWall
|
||||||
@ -124,11 +124,10 @@ boundary
|
|||||||
type wall;
|
type wall;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(0 6 28 22)
|
(0 3 14 11)
|
||||||
(6 5 27 28)
|
(3 2 13 14)
|
||||||
(5 4 26 27)
|
(2 5 16 13)
|
||||||
(4 10 32 26)
|
(5 8 19 16)
|
||||||
(10 16 38 32)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
frontAndBack
|
frontAndBack
|
||||||
@ -136,38 +135,18 @@ boundary
|
|||||||
type empty;
|
type empty;
|
||||||
faces
|
faces
|
||||||
(
|
(
|
||||||
(22 28 29 23)
|
(0 3 4 1)
|
||||||
(23 29 30 24)
|
(2 5 6 3)
|
||||||
(24 30 31 25)
|
(3 6 7 4)
|
||||||
(26 32 33 27)
|
(5 8 9 6)
|
||||||
(27 33 34 28)
|
(6 9 10 7)
|
||||||
(28 34 35 29)
|
(11 14 15 12)
|
||||||
(29 35 36 30)
|
(13 16 17 14)
|
||||||
(30 36 37 31)
|
(14 17 18 15)
|
||||||
(32 38 39 33)
|
(16 19 20 17)
|
||||||
(33 39 40 34)
|
(17 20 21 18)
|
||||||
(34 40 41 35)
|
|
||||||
(35 41 42 36)
|
|
||||||
(36 42 43 37)
|
|
||||||
(0 1 7 6)
|
|
||||||
(1 2 8 7)
|
|
||||||
(2 3 9 8)
|
|
||||||
(4 5 11 10)
|
|
||||||
(5 6 12 11)
|
|
||||||
(6 7 13 12)
|
|
||||||
(7 8 14 13)
|
|
||||||
(8 9 15 14)
|
|
||||||
(10 11 17 16)
|
|
||||||
(11 12 18 17)
|
|
||||||
(12 13 19 18)
|
|
||||||
(13 14 20 19)
|
|
||||||
(14 15 21 20)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mergePatchPairs
|
|
||||||
(
|
|
||||||
);
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/CH4
Normal file
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/CH4
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
location "0";
|
||||||
|
object CH4;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inletfuel
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0.245642;
|
||||||
|
}
|
||||||
|
inletair
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform 0;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
axis
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
leftside
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnerwall
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnertip
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
front
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
back
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
42
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/G
Normal file
42
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/G
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------* \
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
object G;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 0 -3 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type MarshakRadiation;
|
||||||
|
T T;
|
||||||
|
emissivityMode lookup;
|
||||||
|
emissivity uniform 1.0;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
front
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
back
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/H2
Normal file
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/H2
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
location "0";
|
||||||
|
object H2;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inletfuel
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0.046496;
|
||||||
|
}
|
||||||
|
inletair
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform 0;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
axis
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
leftside
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnerwall
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnertip
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
front
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
back
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/H2O
Normal file
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/H2O
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
location "0";
|
||||||
|
object H2;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0.005008;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inletfuel
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
inletair
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0.005008;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform 0.005008;
|
||||||
|
value uniform 0.005008;
|
||||||
|
}
|
||||||
|
axis
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
leftside
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnerwall
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnertip
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
front
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
back
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/N2
Normal file
67
tutorials/combustion/reactingFoam/RAS/DLR_A_LTS/0/N2
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class volScalarField;
|
||||||
|
location "0";
|
||||||
|
object N2;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0.763149;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inletfuel
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0.707861;
|
||||||
|
}
|
||||||
|
inletair
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0.763149;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform 0.763149;
|
||||||
|
value uniform 0.763149;
|
||||||
|
}
|
||||||
|
axis
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
leftside
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnerwall
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
burnertip
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
front
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
back
|
||||||
|
{
|
||||||
|
type wedge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user