Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2012-05-14 09:54:47 +01:00
30 changed files with 275 additions and 157 deletions

View File

@ -152,13 +152,17 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
{
Pstream::mapCombineGather(polyhedralFaces, plusEqOp<label>());
Info<< " Breakdown of polyhedra by number of faces:" << endl;
Info<< " faces" << " number of cells" << endl;
Info<< " Breakdown of polyhedra by number of faces:" << nl
<< " faces" << " number of cells" << endl;
forAllConstIter(Map<label>, polyhedralFaces, iter)
labelList sortedKeys = polyhedralFaces.sortedToc();
forAll(sortedKeys, keyI)
{
label nFaces = sortedKeys[keyI];
Info<< setf(std::ios::right) << setw(13)
<< iter.key() << " " << iter() << nl;
<< nFaces << " " << polyhedralFaces[nFaces] << nl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -65,9 +65,9 @@ void Foam::lookupProfile::interpolateWeights
ddx = 0.0;
return;
}
else if (i2 == values.size())
else if (i2 == nElem)
{
i2 = values.size() - 1;
i2 = nElem - 1;
i1 = i2;
ddx = 0.0;
return;

View File

@ -38,7 +38,7 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::scalar Foam::seriesProfile::evaluate
Foam::scalar Foam::seriesProfile::evaluateDrag
(
const scalar& xIn,
const List<scalar>& values
@ -48,7 +48,26 @@ Foam::scalar Foam::seriesProfile::evaluate
forAll(values, i)
{
result += values[i]*sin((i + 1)*xIn);
result += values[i]*cos(i*xIn);
}
return result;
}
Foam::scalar Foam::seriesProfile::evaluateLift
(
const scalar& xIn,
const List<scalar>& values
) const
{
scalar result = 0.0;
forAll(values, i)
{
// note: first contribution always zero since sin(0) = 0, but
// keep zero base to be consitent with drag coeffs
result += values[i]*sin(i*xIn);
}
return result;
@ -108,8 +127,8 @@ Foam::seriesProfile::seriesProfile
void Foam::seriesProfile::Cdl(const scalar alpha, scalar& Cd, scalar& Cl) const
{
Cd = evaluate(alpha, CdCoeffs_);
Cl = evaluate(alpha, ClCoeffs_);
Cd = evaluateDrag(alpha, CdCoeffs_);
Cl = evaluateLift(alpha, ClCoeffs_);
}

View File

@ -28,7 +28,7 @@ Description
Series-up based profile data - drag and lift coefficients computed as
sum of cosine series
Cd = sum_i(CdCoeff)*sin(i*AOA)
Cd = sum_i(CdCoeff)*cos(i*AOA)
Cl = sum_i(ClCoeff)*sin(i*AOA)
where:
@ -79,12 +79,21 @@ protected:
// Protected Member Functions
//- Evaluate
scalar evaluate
(
const scalar& xIn,
const List<scalar>& values
) const;
// Evaluate
//- Drag
scalar evaluateDrag
(
const scalar& xIn,
const List<scalar>& values
) const;
//- Lift
scalar evaluateLift
(
const scalar& xIn,
const List<scalar>& values
) const;
public:

View File

@ -446,15 +446,15 @@ Foam::rotorDiskSource::rotorDiskSource
inletVelocity_(vector::zero),
tipEffect_(1.0),
flap_(),
trim_(trimModel::New(*this, coeffs_)),
blade_(coeffs_.subDict("blade")),
profiles_(coeffs_.subDict("profiles")),
x_(cells_.size(), vector::zero),
R_(cells_.size(), I),
invR_(cells_.size(), I),
area_(cells_.size(), 0.0),
coordSys_(false),
rMax_(0.0)
rMax_(0.0),
trim_(trimModel::New(*this, coeffs_)),
blade_(coeffs_.subDict("blade")),
profiles_(coeffs_.subDict("profiles"))
{
read(dict);
}
@ -521,9 +521,16 @@ void Foam::rotorDiskSource::calculate
scalar invDr = 0.0;
blade_.interpolate(radius, twist, chord, i1, i2, invDr);
// flip geometric angle if blade is spinning in reverse (clockwise)
scalar alphaGeom = alphag[i] + twist;
if (omega_ < 0)
{
alphaGeom = mathematical::pi - alphaGeom;
}
// effective angle of attack
scalar alphaEff =
mathematical::pi + atan2(Uc.z(), Uc.y()) - (alphag[i] + twist);
mathematical::pi + atan2(Uc.z(), Uc.y()) - alphaGeom;
if (alphaEff > mathematical::pi)
{

View File

@ -149,6 +149,7 @@ protected:
word rhoName_;
//- Rotational speed [rad/s]
// Positive anti-clockwise when looking along -ve lift direction
scalar omega_;
//- Number of blades
@ -167,15 +168,6 @@ protected:
//- Blade flap coefficients [rad/s]
flapData flap_;
//- Trim model
autoPtr<trimModel> trim_;
//- Blade data
bladeModel blade_;
//- Profile data
profileModelList profiles_;
//- Cell centre positions in local rotor frame
// (Cylindrical r, theta, z)
List<point> x_;
@ -195,6 +187,15 @@ protected:
//- Maximum radius
scalar rMax_;
//- Trim model
autoPtr<trimModel> trim_;
//- Blade data
bladeModel blade_;
//- Profile data
profileModelList profiles_;
// Protected Member Functions

View File

@ -67,7 +67,7 @@ void Foam::fixedTrim::read(const dictionary& dict)
scalar theta1c = degToRad(readScalar(coeffs_.lookup("theta1c")));
scalar theta1s = degToRad(readScalar(coeffs_.lookup("theta1s")));
const List<vector>& x = rotor_.x();
const List<point>& x = rotor_.x();
forAll(thetag_, i)
{
scalar psi = x[i].y();

View File

@ -129,11 +129,19 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
if (rhoName_ == "none")
{
// volumetric flow-rate if density not given
operator==(n*avgU);
}
else
{
// mass flow-rate
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate
operator==(n*avgU/rhop);
operator==(n*avgU/rhop);
}
}
else
{

View File

@ -30,8 +30,10 @@ Description
The basis of the patch (volumetric or mass) is determined by the
dimensions of the flux, phi.
The current density is used to correct the velocity when applying the
mass basis.
If the flux is mass-based
- the current density is used to correct the velocity
- volumetric flow rate can be applied by setting the 'rho' entry to 'none'
Example of the boundary condition specification:
\verbatim
@ -39,6 +41,7 @@ Description
{
type flowRateInletVelocity;
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
rho rho; // none | rho [m3/s or kg/s]
value uniform (0 0 0); // placeholder
}
\endverbatim

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -85,6 +85,7 @@ class CollisionRecordList
//- List of active wall collisions
DynamicList<WallCollisionRecord<WallType> > wallRecords_;
public:
// Constructors
@ -115,11 +116,11 @@ public:
//- Return the active pair collisions
inline const DynamicList<PairCollisionRecord<PairType> >&
pairRecords() const;
pairRecords() const;
//- Return the active wall collisions
inline const DynamicList<WallCollisionRecord<WallType> >&
wallRecords() const;
wallRecords() const;
// Fields representing the data from each record, i.e if the
// records 0-N containing each data members {a, b, c, d...}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -80,12 +80,15 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
)
{
scalar addedMass = 0.0;
scalar maxMassI = 0.0;
forAll(td.cloud().rhoTrans(), i)
{
addedMass += td.cloud().rhoTrans(i)[cellI];
scalar dm = td.cloud().rhoTrans(i)[cellI];
maxMassI = max(maxMassI, mag(dm));
addedMass += dm;
}
if (addedMass < ROOTVSMALL)
if (maxMassI < ROOTVSMALL)
{
return;
}
@ -95,16 +98,13 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
this->rhoc_ += addedMass/td.cloud().pMesh().cellVolumes()[cellI];
const scalar massCellNew = massCell + addedMass;
this->Uc_ += td.cloud().UTrans()[cellI]/massCellNew;
this->Uc_ = (this->Uc_*massCell + td.cloud().UTrans()[cellI])/massCellNew;
scalar CpEff = 0.0;
if (addedMass > ROOTVSMALL)
forAll(td.cloud().rhoTrans(), i)
{
forAll(td.cloud().rhoTrans(), i)
{
scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass;
CpEff += Y*td.cloud().composition().carrier().Cp(i, this->Tc_);
}
scalar Y = td.cloud().rhoTrans(i)[cellI]/addedMass;
CpEff += Y*td.cloud().composition().carrier().Cp(i, this->Tc_);
}
const scalar Cpc = td.CpInterp().psi()[cellI];
@ -152,7 +152,7 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
)
{
// No correction if total concentration of emitted species is small
if (sum(Cs) < SMALL)
if (!td.cloud().heatTransfer().BirdCorrection() || (sum(Cs) < SMALL))
{
return;
}

View File

@ -238,7 +238,7 @@ void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields
diameterParcelPatch_ =
filmModel.cloudDiameterTrans().boundaryField()[filmPatchI];
filmModel.toPrimary(filmPatchI, diameterParcelPatch_, maxOp<scalar>());
filmModel.toPrimary(filmPatchI, diameterParcelPatch_, maxEqOp<scalar>());
UFilmPatch_ = filmModel.Us().boundaryField()[filmPatchI];
filmModel.toPrimary(filmPatchI, UFilmPatch_);

View File

@ -59,16 +59,16 @@ namespace Foam
};
//- Combine operator for interpolateToSource/Target
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
class combineBinaryOp
{
const BinaryOp& bop_;
const CombineOp& cop_;
public:
combineBinaryOp(const BinaryOp& bop)
combineBinaryOp(const CombineOp& cop)
:
bop_(bop)
cop_(cop)
{}
void operator()
@ -79,7 +79,7 @@ namespace Foam
const scalar weight
) const
{
x = bop_(x, weight*y);
cop_(x, weight*y);
}
};
}
@ -917,22 +917,23 @@ Foam::scalar Foam::AMIInterpolation<SourcePatch, TargetPatch>::interArea
const primitivePatch& tgtPatch
) const
{
// quick reject if either face has zero area
if (srcMagSf_[srcFaceI] < ROOTVSMALL || tgtMagSf_[tgtFaceI] < ROOTVSMALL)
{
return 0.0;
}
const pointField& srcPoints = srcPatch.points();
const pointField& tgtPoints = tgtPatch.points();
// create intersection object
faceAreaIntersect inter(srcPoints, tgtPoints, reverseTarget_);
// references to candidate faces
const face& src = srcPatch[srcFaceI];
const face& tgt = tgtPatch[tgtFaceI];
// quick reject if either face has zero area
// Note: do not used stored face areas for target patch
if ((srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgt.mag(tgtPoints) < ROOTVSMALL))
{
return 0.0;
}
// create intersection object
faceAreaIntersect inter(srcPoints, tgtPoints, reverseTarget_);
// crude resultant norm
vector n(-src.normal(srcPoints));
if (reverseTarget_)
@ -1900,7 +1901,7 @@ template<class Type, class CombineOp>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const UList<Type>& fld,
const CombineOp& bop,
const CombineOp& cop,
List<Type>& result
) const
{
@ -1937,7 +1938,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
forAll(faces, i)
{
bop(result[faceI], faceI, work[faces[i]], weights[i]);
cop(result[faceI], faceI, work[faces[i]], weights[i]);
}
}
}
@ -1950,7 +1951,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
forAll(faces, i)
{
bop(result[faceI], faceI, fld[faces[i]], weights[i]);
cop(result[faceI], faceI, fld[faces[i]], weights[i]);
}
}
}
@ -1962,7 +1963,7 @@ template<class Type, class CombineOp>
void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const UList<Type>& fld,
const CombineOp& bop,
const CombineOp& cop,
List<Type>& result
) const
{
@ -1999,7 +2000,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
forAll(faces, i)
{
bop(result[faceI], faceI, work[faces[i]], weights[i]);
cop(result[faceI], faceI, work[faces[i]], weights[i]);
}
}
}
@ -2012,7 +2013,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
forAll(faces, i)
{
bop(result[faceI], faceI, fld[faces[i]], weights[i]);
cop(result[faceI], faceI, fld[faces[i]], weights[i]);
}
}
}
@ -2020,12 +2021,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
template<class SourcePatch, class TargetPatch>
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type> >
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const Field<Type>& fld,
const BinaryOp& bop
const CombineOp& cop
) const
{
tmp<Field<Type> > tresult
@ -2037,32 +2038,32 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
)
);
interpolateToSource(fld, combineBinaryOp<Type, BinaryOp>(bop), tresult());
interpolateToSource(fld, combineBinaryOp<Type, CombineOp>(cop), tresult());
return tresult;
}
template<class SourcePatch, class TargetPatch>
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type> >
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
(
const tmp<Field<Type> >& tFld,
const BinaryOp& bop
const CombineOp& cop
) const
{
return interpolateToSource(tFld(), bop);
return interpolateToSource(tFld(), cop);
}
template<class SourcePatch, class TargetPatch>
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type> >
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const Field<Type>& fld,
const BinaryOp& bop
const CombineOp& cop
) const
{
tmp<Field<Type> > tresult
@ -2074,22 +2075,22 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
)
);
interpolateToTarget(fld, combineBinaryOp<Type, BinaryOp>(bop), tresult());
interpolateToTarget(fld, combineBinaryOp<Type, CombineOp>(cop), tresult());
return tresult;
}
template<class SourcePatch, class TargetPatch>
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
Foam::tmp<Foam::Field<Type> >
Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
(
const tmp<Field<Type> >& tFld,
const BinaryOp& bop
const CombineOp& cop
) const
{
return interpolateToTarget(tFld(), bop);
return interpolateToTarget(tFld(), cop);
}
@ -2101,7 +2102,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
const Field<Type>& fld
) const
{
return interpolateToSource(fld, sumOp<Type>());
return interpolateToSource(fld, plusEqOp<Type>());
}
@ -2113,7 +2114,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
const tmp<Field<Type> >& tFld
) const
{
return interpolateToSource(tFld(), sumOp<Type>());
return interpolateToSource(tFld(), plusEqOp<Type>());
}
@ -2125,7 +2126,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
const Field<Type>& fld
) const
{
return interpolateToTarget(fld, sumOp<Type>());
return interpolateToTarget(fld, plusEqOp<Type>());
}
@ -2137,7 +2138,7 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
const tmp<Field<Type> >& tFld
) const
{
return interpolateToTarget(tFld(), sumOp<Type>());
return interpolateToTarget(tFld(), plusEqOp<Type>());
}

View File

@ -429,36 +429,36 @@ public:
//- Interpolate from target to source with supplied binary op
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
tmp<Field<Type> > interpolateToSource
(
const Field<Type>& fld,
const BinaryOp& bop
const CombineOp& cop
) const;
//- Interpolate from target tmp field to source with supplied
// binary op
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
tmp<Field<Type> > interpolateToSource
(
const tmp<Field<Type> >& tFld,
const BinaryOp& bop
const CombineOp& cop
) const;
//- Interpolate from source to target with supplied op
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
tmp<Field<Type> > interpolateToTarget
(
const Field<Type>& fld,
const BinaryOp& bop
const CombineOp& cop
) const;
//- Interpolate from source tmp field to target with supplied op
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
tmp<Field<Type> > interpolateToTarget
(
const tmp<Field<Type> >& tFld,
const BinaryOp& bop
const CombineOp& cop
) const;
//- Interpolate from target to source

View File

@ -376,16 +376,16 @@ public:
void distribute(List<Type>& lst) const;
//- Wrapper around map/interpolate data distribution with operation
template<class Type, class BinaryOp>
void distribute(List<Type>& lst, const BinaryOp& bop) const;
template<class Type, class CombineOp>
void distribute(List<Type>& lst, const CombineOp& cop) const;
//- Wrapper around map/interpolate data distribution
template<class Type>
void reverseDistribute(List<Type>& lst) const;
//- Wrapper around map/interpolate data distribution with operation
template<class Type, class BinaryOp>
void reverseDistribute(List<Type>& lst, const BinaryOp& bop) const;
template<class Type, class CombineOp>
void reverseDistribute(List<Type>& lst, const CombineOp& cop) const;
// I/O

View File

@ -41,11 +41,11 @@ void Foam::mappedPatchBase::distribute(List<Type>& lst) const
}
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
void Foam::mappedPatchBase::distribute
(
List<Type>& lst,
const BinaryOp& bop
const CombineOp& cop
) const
{
switch (mode_)
@ -55,7 +55,7 @@ void Foam::mappedPatchBase::distribute
lst = AMI().interpolateToSource
(
Field<Type>(lst.xfer()),
bop
cop
);
break;
}
@ -69,7 +69,7 @@ void Foam::mappedPatchBase::distribute
map().subMap(),
map().constructMap(),
lst,
bop,
cop,
pTraits<Type>::zero
);
}
@ -96,11 +96,11 @@ void Foam::mappedPatchBase::reverseDistribute(List<Type>& lst) const
}
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
void Foam::mappedPatchBase::reverseDistribute
(
List<Type>& lst,
const BinaryOp& bop
const CombineOp& cop
) const
{
switch (mode_)
@ -110,7 +110,7 @@ void Foam::mappedPatchBase::reverseDistribute
lst = AMI().interpolateToTarget
(
Field<Type>(lst.xfer()),
bop
cop
);
break;
}
@ -125,7 +125,7 @@ void Foam::mappedPatchBase::reverseDistribute
map().constructMap(),
map().subMap(),
lst,
bop,
cop,
pTraits<Type>::zero
);
break;

View File

@ -157,9 +157,22 @@ void Foam::fieldMinMax::writeFileHeader()
{
fieldMinMaxFilePtr_()
<< "# Time" << token::TAB << "field" << token::TAB
<< "min" << token::TAB << "position(min)" << token::TAB
<< "max" << token::TAB << "position(max)" << token::TAB
<< endl;
<< "min" << token::TAB << "position(min)";
if (Pstream::parRun())
{
fieldMinMaxFilePtr_() << token::TAB << "proc";
}
fieldMinMaxFilePtr_()
<< token::TAB << "max" << token::TAB << "position(max)";
if (Pstream::parRun())
{
fieldMinMaxFilePtr_() << token::TAB << "proc";
}
fieldMinMaxFilePtr_() << endl;
}
}

View File

@ -88,16 +88,43 @@ void Foam::fieldMinMax::calcMinMaxFields
fieldMinMaxFilePtr_()
<< obr_.time().value() << token::TAB
<< fieldName << token::TAB
<< minValue << token::TAB << minC << token::TAB
<< maxValue << token::TAB << maxC << endl;
<< minValue << token::TAB << minC;
if (Pstream::parRun())
{
fieldMinMaxFilePtr_() << token::TAB << minI;
}
fieldMinMaxFilePtr_()
<< token::TAB << maxValue << token::TAB << maxC;
if (Pstream::parRun())
{
fieldMinMaxFilePtr_() << token::TAB << maxI;
}
fieldMinMaxFilePtr_() << endl;
}
if (log_)
{
Info<< " min(mag(" << fieldName << ")) = "
<< minValue << " at position " << minC << nl
<< " max(mag(" << fieldName << ")) = "
<< maxValue << " at position " << maxC << nl;
<< minValue << " at position " << minC;
if (Pstream::parRun())
{
Info<< " on processor " << minI;
}
Info<< nl << " max(mag(" << fieldName << ")) = "
<< maxValue << " at position " << maxC;
if (Pstream::parRun())
{
Info<< " on processor " << maxI;
}
Info<< endl;
}
}
break;
@ -142,16 +169,43 @@ void Foam::fieldMinMax::calcMinMaxFields
fieldMinMaxFilePtr_()
<< obr_.time().value() << token::TAB
<< fieldName << token::TAB
<< minValue << token::TAB << minC << token::TAB
<< maxValue << token::TAB << maxC << endl;
<< minValue << token::TAB << minC;
if (Pstream::parRun())
{
fieldMinMaxFilePtr_() << token::TAB << minI;
}
fieldMinMaxFilePtr_()
<< token::TAB << maxValue << token::TAB << maxC;
if (Pstream::parRun())
{
fieldMinMaxFilePtr_() << token::TAB << maxI;
}
fieldMinMaxFilePtr_() << endl;
}
if (log_)
{
Info<< " min(" << fieldName << ") = "
<< minValue << " at position " << minC << nl
<< " max(" << fieldName << ") = "
<< maxValue << " at position " << maxC << nl;
<< minValue << " at position " << minC;
if (Pstream::parRun())
{
Info<< " on processor " << minI;
}
Info<< nl << " max(" << fieldName << ") = "
<< maxValue << " at position " << maxC;
if (Pstream::parRun())
{
Info<< " on processor " << maxI;
}
Info<< endl;
}
}
break;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -117,6 +117,7 @@ protected:
//- List of patch IDs internally coupled with the primary region
labelList intCoupledPatchIDs_;
//- Region name
word regionName_;
@ -235,21 +236,21 @@ public:
) const;
//- Convert a local region field to the primary region with op
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
void toPrimary
(
const label regionPatchI,
List<Type>& regionField,
const BinaryOp& bop
const CombineOp& cop
) const;
//- Convert a primary region field to the local region with op
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
void toRegion
(
const label regionPatchI,
List<Type>& primaryFieldField,
const BinaryOp& bop
const CombineOp& cop
) const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -77,12 +77,12 @@ void Foam::regionModels::regionModel::toRegion
}
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
void Foam::regionModels::regionModel::toPrimary
(
const label regionPatchI,
List<Type>& regionField,
const BinaryOp& bop
const CombineOp& cop
) const
{
forAll(intCoupledPatchIDs_, i)
@ -94,7 +94,7 @@ void Foam::regionModels::regionModel::toPrimary
(
regionMesh().boundaryMesh()[regionPatchI]
);
mpb.reverseDistribute(regionField, bop);
mpb.reverseDistribute(regionField, cop);
return;
}
}
@ -105,19 +105,19 @@ void Foam::regionModels::regionModel::toPrimary
"("
"const label, "
"List<Type>&, "
"const BinaryOp&"
"const CombineOp&"
") const"
) << "Region patch ID " << regionPatchI << " not found in region mesh"
<< abort(FatalError);
}
template<class Type, class BinaryOp>
template<class Type, class CombineOp>
void Foam::regionModels::regionModel::toRegion
(
const label regionPatchI,
List<Type>& primaryField,
const BinaryOp& bop
const CombineOp& cop
) const
{
forAll(intCoupledPatchIDs_, i)
@ -129,14 +129,14 @@ void Foam::regionModels::regionModel::toRegion
(
regionMesh().boundaryMesh()[regionPatchI]
);
mpb.distribute(primaryField, bop);
mpb.distribute(primaryField, cop);
return;
}
}
FatalErrorIn
(
"const void toRegion(const label, List<Type>&, const BinaryOp&) const"
"const void toRegion(const label, List<Type>&, const CombineOp&) const"
) << "Region patch ID " << regionPatchI << " not found in region mesh"
<< abort(FatalError);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -879,22 +879,19 @@ scalar kinematicSingleLayer::CourantNumber() const
if (regionMesh().nInternalFaces() > 0)
{
const scalar deltaT = time_.deltaTValue();
const scalarField sumPhi(fvc::surfaceSum(mag(phi_)));
const surfaceScalarField SfUfbyDelta
(
regionMesh().surfaceInterpolation::deltaCoeffs()*mag(phi_)
);
const surfaceScalarField rhoDelta(fvc::interpolate(rho_*delta_));
const surfaceScalarField& magSf = regionMesh().magSf();
const scalarField& V = regionMesh().V();
forAll(rhoDelta, i)
forAll(deltaRho_, i)
{
if (rhoDelta[i] > ROOTVSMALL)
if (deltaRho_[i] > SMALL)
{
CoNum = max(CoNum, SfUfbyDelta[i]/rhoDelta[i]/magSf[i]*deltaT);
CoNum = max(CoNum, sumPhi[i]/deltaRho_[i]/V[i]);
}
}
CoNum *= 0.5*time_.deltaTValue();
}
reduce(CoNum, maxOp<scalar>());