mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -81,9 +81,7 @@ void Foam::ExplicitSetValue<Type>::setValue
|
||||
<< ">::setValue for source " << name_ << endl;
|
||||
}
|
||||
|
||||
List<Type> values(cells_.size());
|
||||
|
||||
UIndirectList<Type>(values, cells_) = injectionRate_[fieldI];
|
||||
List<Type> values(cells_.size(), injectionRate_[fieldI]);
|
||||
|
||||
eqn.setValues(cells_, values);
|
||||
}
|
||||
|
||||
@ -46,7 +46,9 @@ bool Foam::writeDictionary::tryFolder
|
||||
dictNames_[dictI],
|
||||
location,
|
||||
obr_,
|
||||
IOobject::MUST_READ
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (dictIO.headerOk())
|
||||
|
||||
@ -130,7 +130,7 @@ void Foam::DESModelRegions::write()
|
||||
Info<< type() << " output:" << nl;
|
||||
}
|
||||
|
||||
tmp<volScalarField> result;
|
||||
tmp<volScalarField> tresult;
|
||||
|
||||
label DESpresent = false;
|
||||
if (mesh.foundObject<icoModel>("turbulenceModel"))
|
||||
@ -142,7 +142,7 @@ void Foam::DESModelRegions::write()
|
||||
{
|
||||
const icoDESModel& des =
|
||||
dynamic_cast<const icoDESModel&>(model);
|
||||
result = des.LESRegion();
|
||||
tresult = des.LESRegion();
|
||||
DESpresent = true;
|
||||
}
|
||||
}
|
||||
@ -155,15 +155,17 @@ void Foam::DESModelRegions::write()
|
||||
{
|
||||
const cmpDESModel& des =
|
||||
dynamic_cast<const cmpDESModel&>(model);
|
||||
result = des.LESRegion();
|
||||
tresult = des.LESRegion();
|
||||
DESpresent = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (DESpresent)
|
||||
{
|
||||
const volScalarField& result = tresult();
|
||||
|
||||
scalar prc =
|
||||
gSum(result().internalField()*mesh.V())/gSum(mesh.V())*100.0;
|
||||
gSum(result.internalField()*mesh.V())/gSum(mesh.V())*100.0;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -174,9 +176,11 @@ void Foam::DESModelRegions::write()
|
||||
if (log_)
|
||||
{
|
||||
Info<< " LES = " << prc << " % (volume)" << nl
|
||||
<< " RES = " << 100.0 - prc << " % (volume)" << nl
|
||||
<< " RAS = " << 100.0 - prc << " % (volume)" << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
result.write();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -154,15 +154,20 @@ Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::pressureTools::convertToCoeff
|
||||
(
|
||||
const volScalarField& pCalculated,
|
||||
const volScalarField& pIn
|
||||
const volScalarField& p
|
||||
) const
|
||||
{
|
||||
tmp<volScalarField> tCoeff(pCalculated);
|
||||
tmp<volScalarField> tCoeff(p);
|
||||
|
||||
if (calcCoeff_)
|
||||
{
|
||||
tCoeff() /= pDyn(pIn) + dimensionedScalar("p0", dimPressure, SMALL);
|
||||
tCoeff() -= dimensionedScalar("pInf", dimPressure, pInf_);
|
||||
|
||||
const dimensionedScalar p0("p0", dimPressure, SMALL);
|
||||
const dimensionedVector U("U", dimVelocity, UInf_);
|
||||
const dimensionedScalar rho("rho", dimDensity, rhoInf_);
|
||||
|
||||
tCoeff() /= 0.5*rho*magSqr(U) + p0;
|
||||
}
|
||||
|
||||
return tCoeff;
|
||||
@ -182,13 +187,16 @@ Foam::pressureTools::pressureTools
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
calcTotal_(false),
|
||||
calcCoeff_(false),
|
||||
pName_("p"),
|
||||
UName_("U"),
|
||||
rhoName_("rho"),
|
||||
rhoRef_(1.0),
|
||||
calcTotal_(false),
|
||||
pRef_(0.0),
|
||||
rhoRef_(1.0)
|
||||
calcCoeff_(false),
|
||||
pInf_(0.0),
|
||||
UInf_(vector::zero),
|
||||
rhoInf_(0.0)
|
||||
{
|
||||
// Check if the available mesh is an fvMesh, otherwise deactivate
|
||||
if (!isA<fvMesh>(obr_))
|
||||
@ -241,6 +249,12 @@ void Foam::pressureTools::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
dict.lookup("calcCoeff") >> calcCoeff_;
|
||||
if (calcCoeff_)
|
||||
{
|
||||
dict.lookup("pInf") >> pInf_;
|
||||
dict.lookup("UInf") >> UInf_;
|
||||
dict.lookup("rhoInf") >> rhoInf_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +286,7 @@ void Foam::pressureTools::write()
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef(), p)
|
||||
convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef())
|
||||
);
|
||||
|
||||
pResult.write();
|
||||
|
||||
@ -41,15 +41,40 @@ Description
|
||||
\f]
|
||||
- static pressure coefficient
|
||||
\f[
|
||||
Cp_s = \frac{p_s}{0.5 \rho |U|^2}
|
||||
Cp_s = \frac{p_s - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}
|
||||
\f]
|
||||
- total pressure coefficient
|
||||
\f[
|
||||
Cp_T = \frac{p_T}{0.5 \rho |U|^2}
|
||||
Cp_T = \frac{p_T - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2}
|
||||
\f]
|
||||
|
||||
The function object will operate on both kinematic (p_k) and static
|
||||
pressure (p_s) fields, and the result is written as a volScalarField.
|
||||
where
|
||||
\vartable
|
||||
\rho | density [kg/m3]
|
||||
U | velocity [m/s]
|
||||
\rho_{\inf} | freestream density [kg/m3]
|
||||
p_{\inf} | freestream pressure [Pa]
|
||||
U_{\inf} | freestream velocity [m/s]
|
||||
p_k | kinematic pressure (p/rho)[m2/s2]
|
||||
p_s | pressure [Pa]
|
||||
p_T | total pressure [Pa]
|
||||
p_{ref} | reference pressure level [Pa]
|
||||
Cp_{s} | pressure coefficient
|
||||
Cp_{T} | total pressure coefficient
|
||||
\endvartable
|
||||
|
||||
The function object will operate on both kinematic (\f$ p_k \f$) and static
|
||||
pressure (\f$ p_s \f$) fields, and the result is written as a
|
||||
volScalarField.
|
||||
|
||||
The modes of operation are:
|
||||
\table
|
||||
Mode | calcTotal | calcCoeff
|
||||
static pressure | no | no
|
||||
total pressure | yes | no
|
||||
pressure coefficient | no | yes
|
||||
total pressure coefficient | yes | yes
|
||||
\endtable
|
||||
|
||||
Example of function object specification to calculate pressure coefficient:
|
||||
\verbatim
|
||||
@ -67,10 +92,13 @@ Description
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: pressureTools| yes |
|
||||
calcCoeff | Calculate pressure coefficient | yes |
|
||||
calcTotal | Calculate total coefficient | yes |
|
||||
rhoRef | Reference density for incompressible cases | no | 1
|
||||
pRef | Reference pressure for total pressure |no| 0.0
|
||||
calcTotal | Calculate total coefficient | yes |
|
||||
pRef | Reference pressure for total pressure | no | 0.0
|
||||
calcCoeff | Calculate pressure coefficient | yes |
|
||||
pInf | Freestream pressure for coefficient calculation | no |
|
||||
UInf | Freestream velocity for coefficient calculation | no |
|
||||
rhoInf | Freestream density for coefficient calculation | no |
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
@ -113,12 +141,6 @@ class pressureTools
|
||||
//- On/off switch
|
||||
bool active_;
|
||||
|
||||
//- Flag to calculate total pressure
|
||||
bool calcTotal_;
|
||||
|
||||
//- Flag to calculate pressure coefficient
|
||||
bool calcCoeff_;
|
||||
|
||||
//- Name of pressure field, default is "p"
|
||||
word pName_;
|
||||
|
||||
@ -128,13 +150,34 @@ class pressureTools
|
||||
//- Name of density field, default is "rho"
|
||||
word rhoName_;
|
||||
|
||||
//- Reference pressure level (used for total pressure)
|
||||
scalar pRef_;
|
||||
|
||||
//- Reference density value
|
||||
//- Reference density employed for incompressible cases
|
||||
scalar rhoRef_;
|
||||
|
||||
|
||||
// Total pressure calculation
|
||||
|
||||
//- Flag to calculate total pressure
|
||||
bool calcTotal_;
|
||||
|
||||
//- Reference pressure level
|
||||
scalar pRef_;
|
||||
|
||||
|
||||
// Pressure coefficient calculation
|
||||
|
||||
//- Flag to calculate pressure coefficient
|
||||
bool calcCoeff_;
|
||||
|
||||
//- Freestream pressure
|
||||
scalar pInf_;
|
||||
|
||||
//- Freestream velocity
|
||||
vector UInf_;
|
||||
|
||||
//- Freestream density
|
||||
scalar rhoInf_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Return the name of the derived pressure field
|
||||
@ -152,12 +195,8 @@ class pressureTools
|
||||
//- Calculate and return the dynamic pressure
|
||||
tmp<volScalarField> pDyn(const volScalarField& p) const;
|
||||
|
||||
//- Convert to coeff data by applying the pDyn scaling
|
||||
tmp<volScalarField> convertToCoeff
|
||||
(
|
||||
const volScalarField& pCalculated,
|
||||
const volScalarField& pIn
|
||||
) const;
|
||||
//- Convert to coeff by applying the freestream dynamic pressure scaling
|
||||
tmp<volScalarField> convertToCoeff(const volScalarField& p) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pressureTools(const pressureTools&);
|
||||
|
||||
@ -53,7 +53,7 @@ void SpalartAllmaras::updateSubGridScaleFields()
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::fv1() const
|
||||
{
|
||||
const volScalarField chi3(pow3(nuTilda_/nu()));
|
||||
const volScalarField chi3("chi3", pow3(nuTilda_/nu()));
|
||||
return chi3/(chi3 + pow3(Cv1_));
|
||||
}
|
||||
|
||||
@ -66,8 +66,8 @@ tmp<volScalarField> SpalartAllmaras::fv2() const
|
||||
|
||||
tmp<volScalarField> SpalartAllmaras::fv3() const
|
||||
{
|
||||
const volScalarField chi(nuTilda_/nu());
|
||||
const volScalarField chiByCv2((1/Cv2_)*chi);
|
||||
const volScalarField chi("chi", nuTilda_/nu());
|
||||
const volScalarField chiByCv2(chi/Cv2_);
|
||||
|
||||
return
|
||||
(scalar(1) + chi*fv1())
|
||||
|
||||
Reference in New Issue
Block a user