Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2013-08-19 11:49:39 +01:00
6 changed files with 89 additions and 40 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -90,6 +90,11 @@ Foam::labelPairList Foam::globalPoints::addSendTransform
const labelPairList& info const labelPairList& info
) const ) const
{ {
scalar tol = refCast<const coupledPolyPatch>
(
mesh_.boundaryMesh()[patchI]
).matchTolerance();
labelPairList sendInfo(info.size()); labelPairList sendInfo(info.size());
forAll(info, i) forAll(info, i)
@ -111,7 +116,8 @@ Foam::labelPairList Foam::globalPoints::addSendTransform
( (
globalIndexAndTransform::transformIndex(info[i]), globalIndexAndTransform::transformIndex(info[i]),
patchI, patchI,
true // patchI is sending side true, // patchI is sending side
tol // tolerance for comparison
) )
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -195,7 +195,8 @@ public:
( (
const label transformIndex, const label transformIndex,
const label patchI, const label patchI,
const bool isSendingSide = true const bool isSendingSide = true,
const scalar tol = SMALL
) const; ) const;
//- Combine two transformIndices //- Combine two transformIndices

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -190,7 +190,8 @@ Foam::label Foam::globalIndexAndTransform::addToTransformIndex
( (
const label transformIndex, const label transformIndex,
const label patchI, const label patchI,
const bool isSendingSide const bool isSendingSide,
const scalar tol
) const ) const
{ {
const Pair<label>& transSign = patchTransformSign_[patchI]; const Pair<label>& transSign = patchTransformSign_[patchI];
@ -228,21 +229,49 @@ Foam::label Foam::globalIndexAndTransform::addToTransformIndex
} }
else if (sign == permutation[matchTransI]) else if (sign == permutation[matchTransI])
{ {
FatalErrorIn // This is usually illegal. The only exception is for points
( // on the axis of a 180 degree cyclic wedge when the
"Foam::label " // transformation is going to be (-1 0 0 0 -1 0 0 0 +1)
"Foam::globalIndexAndTransform::addToTransformIndex\n" // (or a different permutation but always two times -1 and
"(\n" // once +1)
"const label,\n" bool antiCyclic = false;
"const label,\n"
"const bool\n" const vectorTensorTransform& vt = transforms_[matchTransI];
") const\n" if (mag(vt.t()) < SMALL && vt.hasR())
) << "More than one patch accessing the same transform " {
<< "but not of the same sign." << endl const tensor& R = vt.R();
<< "patch:" << mesh_.boundaryMesh()[patchI].name() scalar sumDiag = tr(R);
<< " transform:" << matchTransI << " sign:" << sign scalar sumMagDiag = mag(R.xx())+mag(R.yy())+mag(R.zz());
<< " current transforms:" << permutation
<< exit(FatalError); if (mag(sumMagDiag-3) < tol && mag(sumDiag+1) < tol)
{
antiCyclic = true;
}
}
if (antiCyclic)
{
// 180 degree rotational. Reset transformation.
permutation[matchTransI] = 0;
}
else
{
FatalErrorIn
(
"Foam::label "
"Foam::globalIndexAndTransform::addToTransformIndex\n"
"(\n"
"const label,\n"
"const label,\n"
"const bool\n"
") const\n"
) << "More than one patch accessing the same transform "
<< "but not of the same sign." << endl
<< "patch:" << mesh_.boundaryMesh()[patchI].name()
<< " transform:" << matchTransI << " sign:" << sign
<< " current transforms:" << permutation
<< exit(FatalError);
}
} }
else else
{ {

View File

@ -201,6 +201,7 @@ void Foam::nastranSurfaceWriter::writeTemplate
{ {
v += values[f[fptI]]; v += values[f[fptI]];
} }
v /= f.size();
writeFaceValue(nasFieldName, v, ++n, os); writeFaceValue(nasFieldName, v, ++n, os);
} }

View File

@ -197,7 +197,14 @@ updateCoeffs()
const vector& myRayId = dom.IRay(rayId).d(); const vector& myRayId = dom.IRay(rayId).d();
const scalarField& Ir = dom.Qin().boundaryField()[patchI]; // Use updated Ir while iterating over rays
// avoids to used lagged Qin
scalarField Ir = dom.IRay(0).Qin().boundaryField()[patchI];
for (label rayI=1; rayI < dom.nRay(); rayI++)
{
Ir += dom.IRay(rayI).Qin().boundaryField()[patchI];
}
forAll(Iw, faceI) forAll(Iw, faceI)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -187,7 +187,9 @@ updateCoeffs()
radiativeIntensityRay& ray = radiativeIntensityRay& ray =
const_cast<radiativeIntensityRay&>(dom.IRay(rayId)); const_cast<radiativeIntensityRay&>(dom.IRay(rayId));
ray.Qr().boundaryField()[patchI] += Iw*(n & ray.dAve()); const scalarField nAve(n & ray.dAve());
ray.Qr().boundaryField()[patchI] += Iw*nAve;
const scalarField Eb const scalarField Eb
( (
@ -196,23 +198,20 @@ updateCoeffs()
scalarField temissivity = emissivity(); scalarField temissivity = emissivity();
scalarField& Qem = ray.Qem().boundaryField()[patchI];
scalarField& Qin = ray.Qin().boundaryField()[patchI];
// Use updated Ir while iterating over rays
// avoids to used lagged Qin
scalarField Ir = dom.IRay(0).Qin().boundaryField()[patchI];
for (label rayI=1; rayI < dom.nRay(); rayI++)
{
Ir += dom.IRay(rayI).Qin().boundaryField()[patchI];
}
forAll(Iw, faceI) forAll(Iw, faceI)
{ {
scalar Ir = 0.0;
for (label rayI=0; rayI < dom.nRay(); rayI++)
{
const vector& d = dom.IRay(rayI).d();
const scalarField& IFace =
dom.IRay(rayI).ILambda(lambdaId).boundaryField()[patchI];
if ((-n[faceI] & d) < 0.0) // qin into the wall
{
const vector& dAve = dom.IRay(rayI).dAve();
Ir = Ir + IFace[faceI]*mag(n[faceI] & dAve);
}
}
const vector& d = dom.IRay(rayId).d(); const vector& d = dom.IRay(rayId).d();
if ((-n[faceI] & d) > 0.0) if ((-n[faceI] & d) > 0.0)
@ -222,9 +221,12 @@ updateCoeffs()
valueFraction()[faceI] = 1.0; valueFraction()[faceI] = 1.0;
refValue()[faceI] = refValue()[faceI] =
( (
Ir*(1.0 - temissivity[faceI]) Ir[faceI]*(1.0 - temissivity[faceI])
+ temissivity[faceI]*Eb[faceI] + temissivity[faceI]*Eb[faceI]
)/pi; )/pi;
// Emmited heat flux from this ray direction
Qem[faceI] = refValue()[faceI]*nAve[faceI];
} }
else else
{ {
@ -232,6 +234,9 @@ updateCoeffs()
valueFraction()[faceI] = 0.0; valueFraction()[faceI] = 0.0;
refGrad()[faceI] = 0.0; refGrad()[faceI] = 0.0;
refValue()[faceI] = 0.0; //not used refValue()[faceI] = 0.0; //not used
// Incident heat flux on this ray direction
Qin[faceI] = Iw[faceI]*nAve[faceI];
} }
} }