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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,7 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "solidRegionDiffNo.H"
|
||||
#include "fvc.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::solidRegionDiffNo
|
||||
(
|
||||
@ -34,21 +36,16 @@ Foam::scalar Foam::solidRegionDiffNo
|
||||
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
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* fvc::interpolate(kappa)
|
||||
/ fvc::interpolate(Cprho)
|
||||
sqr(mesh.surfaceInterpolation::deltaCoeffs())
|
||||
*fvc::interpolate(kappa)
|
||||
/fvc::interpolate(Cprho)
|
||||
);
|
||||
|
||||
DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaT().value();
|
||||
|
||||
meanDiNum = (average(kapparhoCpbyDelta)).value()*runTime.deltaT().value();
|
||||
const scalar DiNum = max(kapparhoCpbyDelta).value()*runTime.deltaTValue();
|
||||
const scalar meanDiNum =
|
||||
average(kapparhoCpbyDelta).value()*runTime.deltaTValue();
|
||||
|
||||
Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum
|
||||
<< " max: " << DiNum << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
#include "DDtU.H"
|
||||
#include "pUf/DDtU.H"
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ Usage
|
||||
value uniform 0.01;
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
See also
|
||||
Foam::alphatPhaseChangeJayatillekeWallFunctionFvPatchField
|
||||
|
||||
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
|
||||
// Note: in previous versions of the code, nut was initialised on
|
||||
// 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();
|
||||
// Correct nut
|
||||
turbulence->validate();
|
||||
|
||||
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user