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]);
|
||||
|
||||
|
||||
//- 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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -92,38 +92,66 @@ EqOp(nopEq, (void)x)
|
||||
|
||||
#define Op(opName, op) \
|
||||
\
|
||||
template<class T, class T1, class T2> \
|
||||
class opName##Op3 \
|
||||
{ \
|
||||
public: \
|
||||
template<class T, class T1, class T2> \
|
||||
class opName##Op3 \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
T operator()(const T1& x, const T2& y) const \
|
||||
{ \
|
||||
return op; \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
template<class T1, class T2> \
|
||||
class opName##Op2 \
|
||||
{ \
|
||||
public: \
|
||||
template<class T1, class T2> \
|
||||
class opName##Op2 \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
T1 operator()(const T1& x, const T2& y) const \
|
||||
{ \
|
||||
return op; \
|
||||
} \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
template<class T> \
|
||||
class opName##Op \
|
||||
{ \
|
||||
public: \
|
||||
template<class T> \
|
||||
class opName##Op \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
T operator()(const T& x, const T& y) const \
|
||||
{ \
|
||||
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)
|
||||
|
||||
@ -147,6 +175,8 @@ Op(lessEq, x <= y)
|
||||
Op(greater, x > y)
|
||||
Op(greaterEq, x >= y)
|
||||
|
||||
weightedOp(multiply, weight * y)
|
||||
|
||||
#undef Op
|
||||
|
||||
|
||||
|
||||
@ -344,11 +344,13 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
|
||||
i++;
|
||||
}
|
||||
|
||||
// remove coalesced particles (diameter set to 0)
|
||||
// remove coalesced parcels that fall below minimum mass threshold
|
||||
forAllIter(typename SprayCloud<CloudType>, *this, iter)
|
||||
{
|
||||
parcelType& p = iter();
|
||||
if (p.mass() < VSMALL)
|
||||
scalar mass = p.nParticle()*p.mass();
|
||||
|
||||
if (mass < td.cloud().constProps().minParticleMass())
|
||||
{
|
||||
this->deleteParticle(p);
|
||||
}
|
||||
|
||||
@ -27,63 +27,6 @@ License
|
||||
#include "meshTools.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 * * * * * * * * * * * //
|
||||
|
||||
template<class SourcePatch, class TargetPatch>
|
||||
@ -1550,7 +1493,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
}
|
||||
|
||||
// send data back to originating procs. Note that contributions
|
||||
// from different processors get added (ListPlusEqOp)
|
||||
// from different processors get added (ListAppendEqOp)
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
@ -1560,7 +1503,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
map.constructMap(),
|
||||
map.subMap(),
|
||||
tgtAddress_,
|
||||
ListPlusEqOp<label>(),
|
||||
ListAppendEqOp<label>(),
|
||||
labelList()
|
||||
);
|
||||
|
||||
@ -1572,7 +1515,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
|
||||
map.constructMap(),
|
||||
map.subMap(),
|
||||
tgtWeights_,
|
||||
ListPlusEqOp<scalar>(),
|
||||
ListAppendEqOp<scalar>(),
|
||||
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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ void Foam::pressureTools::read(const dictionary& dict)
|
||||
|
||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
||||
|
||||
if (p.dimensions() != p.dimensions())
|
||||
if (p.dimensions() != dimPressure)
|
||||
{
|
||||
dict.lookup("rhoRef") >> rhoRef_;
|
||||
}
|
||||
|
||||
@ -24,29 +24,55 @@ License
|
||||
Class
|
||||
Foam::pressureTools
|
||||
|
||||
Group
|
||||
grpUtilitiesFunctionObjects
|
||||
|
||||
Description
|
||||
This function object includes tools to manipulate the pressure into
|
||||
different forms. These currently include:
|
||||
|
||||
- static pressure
|
||||
|
||||
p_s = rho*p_k
|
||||
|
||||
\f[
|
||||
p_s = \rho p_k
|
||||
\f]
|
||||
- total pressure
|
||||
|
||||
p_T = pRef + p_s + 0.5 rho |U|^2
|
||||
|
||||
\f[
|
||||
p_T = p_{ref} + p_s + 0.5 \rho |U|^2
|
||||
\f]
|
||||
- static pressure coefficient
|
||||
|
||||
Cp_s = p_s / (0.5 rho |U|^2)
|
||||
|
||||
\f[
|
||||
Cp_s = \frac{p_s}{0.5 \rho |U|^2}
|
||||
\f]
|
||||
- total pressure coefficient
|
||||
|
||||
Cp_T = p_T / (0.5 rho |U|^2)
|
||||
\f[
|
||||
Cp_T = \frac{p_T}{0.5 \rho |U|^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.
|
||||
|
||||
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
|
||||
pressureTools.C
|
||||
IOpressureTools.H
|
||||
|
||||
@ -1048,12 +1048,14 @@ void kinematicSingleLayer::info() const
|
||||
{
|
||||
Info<< "\nSurface film: " << type() << endl;
|
||||
|
||||
const vectorField& Uinternal = U_.internalField();
|
||||
|
||||
Info<< indent << "added mass = "
|
||||
<< returnReduce<scalar>(addedMassTotal_, sumOp<scalar>()) << nl
|
||||
<< indent << "current mass = "
|
||||
<< gSum((deltaRho_*magSf())()) << nl
|
||||
<< indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", "
|
||||
<< max(mag(U_)).value() << nl
|
||||
<< indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", "
|
||||
<< gMax(mag(Uinternal)) << nl
|
||||
<< indent << "min/max(delta) = " << min(delta_).value() << ", "
|
||||
<< max(delta_).value() << nl
|
||||
<< indent << "coverage = "
|
||||
|
||||
@ -727,8 +727,10 @@ void thermoSingleLayer::info() const
|
||||
{
|
||||
kinematicSingleLayer::info();
|
||||
|
||||
Info<< indent << "min/max(T) = " << min(T_).value() << ", "
|
||||
<< max(T_).value() << nl;
|
||||
const scalarField& Tinternal = T_.internalField();
|
||||
|
||||
Info<< indent << "min/max(T) = " << gMin(Tinternal) << ", "
|
||||
<< gMax(Tinternal) << nl;
|
||||
|
||||
phaseChange_->info(Info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user