Commit 7df32db6 authored by mattijs's avatar mattijs
Browse files

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

parents 42cde11f aab426ec
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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_);
}
......
......@@ -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:
......
......@@ -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)
{
......
......@@ -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
......
......@@ -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();
......
......@@ -129,11 +129,19 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate
operator==(n*avgU/rhop);
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_);
operator==(n*avgU/rhop);
}
}
else
{
......
......@@ -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
......
......@@ -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...}
......
......@@ -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;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment