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:
@ -245,6 +245,15 @@ template<class Container, class T, int nRows, int nColumns>
|
|||||||
List<Container> initListList(const T[nRows][nColumns]);
|
List<Container> initListList(const T[nRows][nColumns]);
|
||||||
|
|
||||||
|
|
||||||
|
//- Helper class for list to append y onto the end of x
|
||||||
|
template<class T>
|
||||||
|
class ListAppendEqOp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void operator()(List<T>& x, const List<T>& y) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
@ -684,4 +684,26 @@ Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void Foam::ListAppendEqOp<T>::operator()(List<T>& x, const List<T>& y) const
|
||||||
|
{
|
||||||
|
if (y.size())
|
||||||
|
{
|
||||||
|
if (x.size())
|
||||||
|
{
|
||||||
|
label sz = x.size();
|
||||||
|
x.setSize(sz + y.size());
|
||||||
|
forAll(y, i)
|
||||||
|
{
|
||||||
|
x[sz++] = y[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
x = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -90,40 +90,68 @@ EqOp(nopEq, (void)x)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#define Op(opName, op) \
|
#define Op(opName, op) \
|
||||||
\
|
\
|
||||||
template<class T, class T1, class T2> \
|
template<class T, class T1, class T2> \
|
||||||
class opName##Op3 \
|
class opName##Op3 \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
\
|
\
|
||||||
T operator()(const T1& x, const T2& y) const \
|
T operator()(const T1& x, const T2& y) const \
|
||||||
{ \
|
{ \
|
||||||
return op; \
|
return op; \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
template<class T1, class T2> \
|
template<class T1, class T2> \
|
||||||
class opName##Op2 \
|
class opName##Op2 \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
\
|
\
|
||||||
T1 operator()(const T1& x, const T2& y) const \
|
T1 operator()(const T1& x, const T2& y) const \
|
||||||
{ \
|
{ \
|
||||||
return op; \
|
return op; \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
template<class T> \
|
template<class T> \
|
||||||
class opName##Op \
|
class opName##Op \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
\
|
\
|
||||||
T operator()(const T& x, const T& y) const \
|
T operator()(const T& x, const T& y) const \
|
||||||
{ \
|
{ \
|
||||||
return op; \
|
return op; \
|
||||||
} \
|
} \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define weightedOp(opName, op) \
|
||||||
|
\
|
||||||
|
template<class Type, class CombineOp> \
|
||||||
|
class opName##WeightedOp \
|
||||||
|
{ \
|
||||||
|
const CombineOp& cop_; \
|
||||||
|
\
|
||||||
|
public: \
|
||||||
|
\
|
||||||
|
opName##WeightedOp(const CombineOp& cop) \
|
||||||
|
: \
|
||||||
|
cop_(cop) \
|
||||||
|
{} \
|
||||||
|
\
|
||||||
|
void operator() \
|
||||||
|
( \
|
||||||
|
Type& x, \
|
||||||
|
const label index, \
|
||||||
|
const Type& y, \
|
||||||
|
const scalar weight \
|
||||||
|
) const \
|
||||||
|
{ \
|
||||||
|
cop_(x, op); \
|
||||||
|
} \
|
||||||
|
}; \
|
||||||
|
|
||||||
|
|
||||||
Op(sum, x + y)
|
Op(sum, x + y)
|
||||||
|
|
||||||
@ -147,6 +175,8 @@ Op(lessEq, x <= y)
|
|||||||
Op(greater, x > y)
|
Op(greater, x > y)
|
||||||
Op(greaterEq, x >= y)
|
Op(greaterEq, x >= y)
|
||||||
|
|
||||||
|
weightedOp(multiply, weight * y)
|
||||||
|
|
||||||
#undef Op
|
#undef Op
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -344,11 +344,13 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove coalesced particles (diameter set to 0)
|
// remove coalesced parcels that fall below minimum mass threshold
|
||||||
forAllIter(typename SprayCloud<CloudType>, *this, iter)
|
forAllIter(typename SprayCloud<CloudType>, *this, iter)
|
||||||
{
|
{
|
||||||
parcelType& p = iter();
|
parcelType& p = iter();
|
||||||
if (p.mass() < VSMALL)
|
scalar mass = p.nParticle()*p.mass();
|
||||||
|
|
||||||
|
if (mass < td.cloud().constProps().minParticleMass())
|
||||||
{
|
{
|
||||||
this->deleteParticle(p);
|
this->deleteParticle(p);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,63 +27,6 @@ License
|
|||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "mapDistribute.H"
|
#include "mapDistribute.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
//- Helper class for list
|
|
||||||
template<class T>
|
|
||||||
class ListPlusEqOp
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void operator()(List<T>& x, const List<T> y) const
|
|
||||||
{
|
|
||||||
if (y.size())
|
|
||||||
{
|
|
||||||
if (x.size())
|
|
||||||
{
|
|
||||||
label sz = x.size();
|
|
||||||
x.setSize(sz + y.size());
|
|
||||||
forAll(y, i)
|
|
||||||
{
|
|
||||||
x[sz++] = y[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
x = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Combine operator for interpolateToSource/Target
|
|
||||||
template<class Type, class CombineOp>
|
|
||||||
class combineBinaryOp
|
|
||||||
{
|
|
||||||
const CombineOp& cop_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
combineBinaryOp(const CombineOp& cop)
|
|
||||||
:
|
|
||||||
cop_(cop)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void operator()
|
|
||||||
(
|
|
||||||
Type& x,
|
|
||||||
const label faceI,
|
|
||||||
const Type& y,
|
|
||||||
const scalar weight
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
cop_(x, weight*y);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class SourcePatch, class TargetPatch>
|
template<class SourcePatch, class TargetPatch>
|
||||||
@ -1550,7 +1493,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send data back to originating procs. Note that contributions
|
// send data back to originating procs. Note that contributions
|
||||||
// from different processors get added (ListPlusEqOp)
|
// from different processors get added (ListAppendEqOp)
|
||||||
|
|
||||||
mapDistribute::distribute
|
mapDistribute::distribute
|
||||||
(
|
(
|
||||||
@ -1560,7 +1503,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
map.constructMap(),
|
map.constructMap(),
|
||||||
map.subMap(),
|
map.subMap(),
|
||||||
tgtAddress_,
|
tgtAddress_,
|
||||||
ListPlusEqOp<label>(),
|
ListAppendEqOp<label>(),
|
||||||
labelList()
|
labelList()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1572,7 +1515,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
|||||||
map.constructMap(),
|
map.constructMap(),
|
||||||
map.subMap(),
|
map.subMap(),
|
||||||
tgtWeights_,
|
tgtWeights_,
|
||||||
ListPlusEqOp<scalar>(),
|
ListAppendEqOp<scalar>(),
|
||||||
scalarList()
|
scalarList()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1787,7 +1730,12 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
interpolateToSource(fld, combineBinaryOp<Type, CombineOp>(cop), tresult());
|
interpolateToSource
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
multiplyWeightedOp<Type, CombineOp>(cop),
|
||||||
|
tresult()
|
||||||
|
);
|
||||||
|
|
||||||
return tresult;
|
return tresult;
|
||||||
}
|
}
|
||||||
@ -1824,7 +1772,12 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
interpolateToTarget(fld, combineBinaryOp<Type, CombineOp>(cop), tresult());
|
interpolateToTarget
|
||||||
|
(
|
||||||
|
fld,
|
||||||
|
multiplyWeightedOp<Type, CombineOp>(cop),
|
||||||
|
tresult()
|
||||||
|
);
|
||||||
|
|
||||||
return tresult;
|
return tresult;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -191,7 +191,7 @@ void Foam::pressureTools::read(const dictionary& dict)
|
|||||||
|
|
||||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
||||||
|
|
||||||
if (p.dimensions() != p.dimensions())
|
if (p.dimensions() != dimPressure)
|
||||||
{
|
{
|
||||||
dict.lookup("rhoRef") >> rhoRef_;
|
dict.lookup("rhoRef") >> rhoRef_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,29 +24,55 @@ License
|
|||||||
Class
|
Class
|
||||||
Foam::pressureTools
|
Foam::pressureTools
|
||||||
|
|
||||||
|
Group
|
||||||
|
grpUtilitiesFunctionObjects
|
||||||
|
|
||||||
Description
|
Description
|
||||||
This function object includes tools to manipulate the pressure into
|
This function object includes tools to manipulate the pressure into
|
||||||
different forms. These currently include:
|
different forms. These currently include:
|
||||||
|
|
||||||
- static pressure
|
- static pressure
|
||||||
|
\f[
|
||||||
p_s = rho*p_k
|
p_s = \rho p_k
|
||||||
|
\f]
|
||||||
- total pressure
|
- total pressure
|
||||||
|
\f[
|
||||||
p_T = pRef + p_s + 0.5 rho |U|^2
|
p_T = p_{ref} + p_s + 0.5 \rho |U|^2
|
||||||
|
\f]
|
||||||
- static pressure coefficient
|
- static pressure coefficient
|
||||||
|
\f[
|
||||||
Cp_s = p_s / (0.5 rho |U|^2)
|
Cp_s = \frac{p_s}{0.5 \rho |U|^2}
|
||||||
|
\f]
|
||||||
- total pressure coefficient
|
- total pressure coefficient
|
||||||
|
\f[
|
||||||
Cp_T = p_T / (0.5 rho |U|^2)
|
Cp_T = \frac{p_T}{0.5 \rho |U|^2}
|
||||||
|
\f]
|
||||||
|
|
||||||
The function object will operate on both kinematic (p_k) and static
|
The function object will operate on both kinematic (p_k) and static
|
||||||
pressure (p_s) fields, and the result is written as a volScalarField.
|
pressure (p_s) fields, and the result is written as a volScalarField.
|
||||||
|
|
||||||
|
Example of function object specification to calculate pressure coefficient:
|
||||||
|
\verbatim
|
||||||
|
pressureTools1
|
||||||
|
{
|
||||||
|
type pressureTools;
|
||||||
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
||||||
|
...
|
||||||
|
calcTotal no;
|
||||||
|
calcCoeff yes;
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
\heading Function object usage
|
||||||
|
\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
|
||||||
|
\endtable
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pressureTools.C
|
pressureTools.C
|
||||||
IOpressureTools.H
|
IOpressureTools.H
|
||||||
|
|||||||
@ -1048,12 +1048,14 @@ void kinematicSingleLayer::info() const
|
|||||||
{
|
{
|
||||||
Info<< "\nSurface film: " << type() << endl;
|
Info<< "\nSurface film: " << type() << endl;
|
||||||
|
|
||||||
|
const vectorField& Uinternal = U_.internalField();
|
||||||
|
|
||||||
Info<< indent << "added mass = "
|
Info<< indent << "added mass = "
|
||||||
<< returnReduce<scalar>(addedMassTotal_, sumOp<scalar>()) << nl
|
<< returnReduce<scalar>(addedMassTotal_, sumOp<scalar>()) << nl
|
||||||
<< indent << "current mass = "
|
<< indent << "current mass = "
|
||||||
<< gSum((deltaRho_*magSf())()) << nl
|
<< gSum((deltaRho_*magSf())()) << nl
|
||||||
<< indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", "
|
<< indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", "
|
||||||
<< max(mag(U_)).value() << nl
|
<< gMax(mag(Uinternal)) << nl
|
||||||
<< indent << "min/max(delta) = " << min(delta_).value() << ", "
|
<< indent << "min/max(delta) = " << min(delta_).value() << ", "
|
||||||
<< max(delta_).value() << nl
|
<< max(delta_).value() << nl
|
||||||
<< indent << "coverage = "
|
<< indent << "coverage = "
|
||||||
|
|||||||
@ -727,8 +727,10 @@ void thermoSingleLayer::info() const
|
|||||||
{
|
{
|
||||||
kinematicSingleLayer::info();
|
kinematicSingleLayer::info();
|
||||||
|
|
||||||
Info<< indent << "min/max(T) = " << min(T_).value() << ", "
|
const scalarField& Tinternal = T_.internalField();
|
||||||
<< max(T_).value() << nl;
|
|
||||||
|
Info<< indent << "min/max(T) = " << gMin(Tinternal) << ", "
|
||||||
|
<< gMax(Tinternal) << nl;
|
||||||
|
|
||||||
phaseChange_->info(Info);
|
phaseChange_->info(Info);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user