Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2011-04-06 16:16:15 +01:00
4 changed files with 27 additions and 107 deletions

View File

@ -39,7 +39,6 @@
# #
# Checks for # Checks for
# - illegal code, e.g. <TAB> # - illegal code, e.g. <TAB>
# - copyright is current, e.g. if present, contains XXX-<current-year>
# - columns greater than 80 for *.[CH] files # - columns greater than 80 for *.[CH] files
# #
# Note # Note
@ -138,8 +137,8 @@ checkIllegalCode()
{ {
echo "$hookName: check bad strings/characters etc ..." 1>&2 echo "$hookName: check bad strings/characters etc ..." 1>&2
reBad="(N""abla|"$'\t'")" reBad="("$'\t'")"
msgBad="N""abla or <TAB>" msgBad="<TAB>"
scope=$(gitScope $@) scope=$(gitScope $@)
@ -167,40 +166,6 @@ checkIllegalCode()
} }
#
# check that OpenCFD copyright is current
#
checkCopyright()
{
year=$(date +%Y)
echo "$hookName: check copyright ..." 1>&2
scope=$(gitScope $@)
badFiles=$(
for f in $fileList
do
# NB: need to have OpenCFD on a separate line to prevent
# this check being caught by itself!
#
# parse line numbers from grep output:
# <lineNr>: contents
#
lines=$(git grep -F -hn -e Copyright \
--and -e OpenCFD \
--and --not -e "$year" \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
done
)
dieOnBadFiles "Update copyright year, e.g. XXXX-$year"
}
# #
# limit line length to 80-columns # limit line length to 80-columns
# #
@ -308,9 +273,6 @@ bad=$(git diff-index --cached --check $against --) || die "$bad"
# check for illegal code, e.g. <TAB>, etc # check for illegal code, e.g. <TAB>, etc
checkIllegalCode checkIllegalCode
# ensure OpenCFD copyright contains correct year
checkCopyright
# ensure code conforms to 80 columns max # ensure code conforms to 80 columns max
checkLineLengthNonDirective checkLineLengthNonDirective

View File

@ -39,7 +39,6 @@
# #
# Checks for # Checks for
# - illegal code, e.g. <TAB> # - illegal code, e.g. <TAB>
# - copyright is current, e.g. if present, contains XXX-<current-year>
# - columns greater than 80 for *.[CH] files # - columns greater than 80 for *.[CH] files
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -101,8 +100,8 @@ checkIllegalCode()
{ {
echo "$hookName: check bad strings/characters etc ..." 1>&2 echo "$hookName: check bad strings/characters etc ..." 1>&2
reBad="(N""abla|"$'\t'"|"$'\r\n'")" reBad="("$'\t'"|"$'\r\n'")"
msgBad="N""abla, <TAB> or DOS-line-endings" msgBad="<TAB> or DOS-line-endings"
scope=$(gitScope $@) scope=$(gitScope $@)
@ -130,40 +129,6 @@ checkIllegalCode()
} }
#
# check that OpenCFD copyright is current
#
checkCopyright()
{
year=$(date +%Y)
echo "$hookName: check copyright ..." 1>&2
scope=$(gitScope $@)
badFiles=$(
for f in $fileList
do
# NB: need to have OpenCFD on a separate line to prevent
# this check being caught by itself!
#
# parse line numbers from grep output:
# <lineNr>: contents
#
lines=$(git grep -F -hn -e Copyright \
--and -e OpenCFD \
--and --not -e "$year" \
$scope"$f" |
sed -e 's@:.*@@' |
tr '\n' ' '
)
[ -n "$lines" ] && echo "$Indent$f -- lines: $lines"
done
)
dieOnBadFiles "Update copyright year, e.g. XXXX-$year"
}
# #
# limit line length to 80-columns # limit line length to 80-columns
# #
@ -297,9 +262,6 @@ do
# check for illegal code, e.g. <TAB>, etc # check for illegal code, e.g. <TAB>, etc
checkIllegalCode $newSHA1 checkIllegalCode $newSHA1
# ensure OpenCFD copyright contains correct year
checkCopyright $newSHA1
# ensure code conforms to 80 columns max # ensure code conforms to 80 columns max
checkLineLengthNonDirective $newSHA1 checkLineLengthNonDirective $newSHA1

View File

@ -102,7 +102,6 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
iterCounter_(0), iterCounter_(0),
pivotIndices_(0) pivotIndices_(0)
{ {
const polyBoundaryMesh& coarsePatches = coarseMesh_.boundaryMesh(); const polyBoundaryMesh& coarsePatches = coarseMesh_.boundaryMesh();
const volScalarField::GeometricBoundaryField& Qrp = Qr_.boundaryField(); const volScalarField::GeometricBoundaryField& Qrp = Qr_.boundaryField();
@ -116,7 +115,7 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
{ {
selectedPatches_[count] = QrPatchI.patch().index(); selectedPatches_[count] = QrPatchI.patch().index();
nLocalCoarseFaces_ += coarsePatches[patchI].size(); nLocalCoarseFaces_ += coarsePatches[patchI].size();
count ++; count++;
} }
} }
@ -124,8 +123,8 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
if (debug) if (debug)
{ {
Pout << "SelectedPatches:" << selectedPatches_ << endl; Pout<< "Selected patches:" << selectedPatches_ << endl;
Pout << "Number of coarse faces:" << nLocalCoarseFaces_ << endl; Pout<< "Number of coarse faces:" << nLocalCoarseFaces_ << endl;
} }
totalNCoarseFaces_ = nLocalCoarseFaces_; totalNCoarseFaces_ = nLocalCoarseFaces_;
@ -133,7 +132,7 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
if (Pstream::master()) if (Pstream::master())
{ {
Info << "Total number of clusters : " << totalNCoarseFaces_ << endl; Info<< "Total number of clusters : " << totalNCoarseFaces_ << endl;
} }
labelListIOList subMap labelListIOList subMap
@ -228,7 +227,7 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
new scalarSquareMatrix(totalNCoarseFaces_, totalNCoarseFaces_, 0.0) new scalarSquareMatrix(totalNCoarseFaces_, totalNCoarseFaces_, 0.0)
); );
Info << "Insert elemets in the matrix.." << endl; Info<< "Insert elements in the matrix..." << endl;
for (label procI = 0; procI < Pstream::nProcs(); procI++) for (label procI = 0; procI < Pstream::nProcs(); procI++)
{ {
@ -244,19 +243,19 @@ Foam::radiation::viewFactor::viewFactor(const volScalarField& T)
bool smoothing = readBool(coeffs_.lookup("smoothing")); bool smoothing = readBool(coeffs_.lookup("smoothing"));
if(smoothing) if (smoothing)
{ {
Info << "Smoothing the matrix..." << endl; Info<< "Smoothing the matrix..." << endl;
for(label i=0; i<totalNCoarseFaces_; i++) for (label i=0; i<totalNCoarseFaces_; i++)
{ {
scalar sumF = 0.0; scalar sumF = 0.0;
for(label j=0; j<totalNCoarseFaces_; j++) for (label j=0; j<totalNCoarseFaces_; j++)
{ {
sumF += Fmatrix_()[i][j]; sumF += Fmatrix_()[i][j];
} }
scalar delta = 1.0 - sumF; scalar delta = 1.0 - sumF;
for(label j=0; j<totalNCoarseFaces_; j++) for (label j=0; j<totalNCoarseFaces_; j++)
{ {
Fmatrix_()[i][j] *= (1.0 - delta/(sumF + 0.001)); Fmatrix_()[i][j] *= (1.0 - delta/(sumF + 0.001));
} }
@ -342,7 +341,7 @@ void Foam::radiation::viewFactor::calculate()
DynamicList<scalar> localCoarseEave(nLocalCoarseFaces_); DynamicList<scalar> localCoarseEave(nLocalCoarseFaces_);
DynamicList<scalar> localCoarseHoave(nLocalCoarseFaces_); DynamicList<scalar> localCoarseHoave(nLocalCoarseFaces_);
forAll (selectedPatches_, i) forAll(selectedPatches_, i)
{ {
label patchID = selectedPatches_[i]; label patchID = selectedPatches_[i];
@ -364,7 +363,7 @@ void Foam::radiation::viewFactor::calculate()
const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID]; const labelList& coarsePatchFace = coarseMesh_.patchFaceMap()[patchID];
const labelList& agglom = finalAgglom_[patchID]; const labelList& agglom = finalAgglom_[patchID];
label nAgglom = max(agglom)+1; label nAgglom = max(agglom) + 1;
labelListList coarseToFine(invertOneToMany(nAgglom, agglom)); labelListList coarseToFine(invertOneToMany(nAgglom, agglom));
@ -413,7 +412,7 @@ void Foam::radiation::viewFactor::calculate()
labelList localGlobalIds(nLocalCoarseFaces_); labelList localGlobalIds(nLocalCoarseFaces_);
for (label k = 0; k < nLocalCoarseFaces_; k++) for(label k = 0; k < nLocalCoarseFaces_; k++)
{ {
localGlobalIds[k] = globalNumbering.toGlobal(Pstream::myProcNo(), k); localGlobalIds[k] = globalNumbering.toGlobal(Pstream::myProcNo(), k);
} }
@ -479,14 +478,14 @@ void Foam::radiation::viewFactor::calculate()
} }
} }
Info<< "\nSolving view factor equations.." << endl; Info<< "\nSolving view factor equations..." << endl;
// Negative coming into the fluid // Negative coming into the fluid
LUsolve(C, q); LUsolve(C, q);
} }
else //Constant emissivity else //Constant emissivity
{ {
// Initial iter calculates CLU and chaches it // Initial iter calculates CLU and chaches it
if(iterCounter_ == 0) if (iterCounter_ == 0)
{ {
for (label i=0; i<totalNCoarseFaces_; i++) for (label i=0; i<totalNCoarseFaces_; i++)
{ {
@ -503,7 +502,7 @@ void Foam::radiation::viewFactor::calculate()
} }
} }
} }
Info<< "\nDecomposing C matrix.." << endl; Info<< "\nDecomposing C matrix..." << endl;
LUDecompose(CLU_(), pivotIndices_); LUDecompose(CLU_(), pivotIndices_);
} }
@ -538,7 +537,7 @@ void Foam::radiation::viewFactor::calculate()
label globCoarseId = 0; label globCoarseId = 0;
forAll (selectedPatches_, i) forAll(selectedPatches_, i)
{ {
const label patchID = selectedPatches_[i]; const label patchID = selectedPatches_[i];
scalarField& Qrp = Qr_.boundaryField()[patchID]; scalarField& Qrp = Qr_.boundaryField()[patchID];
@ -575,9 +574,9 @@ void Foam::radiation::viewFactor::calculate()
const scalarField& Qrp = Qr_.boundaryField()[patchID]; const scalarField& Qrp = Qr_.boundaryField()[patchID];
const scalarField& magSf = mesh_.magSf().boundaryField()[patchID]; const scalarField& magSf = mesh_.magSf().boundaryField()[patchID];
scalar heatFlux = gSum(Qrp*magSf); scalar heatFlux = gSum(Qrp*magSf);
Info << "Total heat flux at patch: " Info<< "Total heat flux at patch: "
<< patchID << " " << patchID << " "
<< heatFlux << " [W]" << endl; << heatFlux << " [W]" << endl;
} }
} }
@ -616,13 +615,13 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::viewFactor::Rp() const
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::radiation::viewFactor::Ru() const Foam::radiation::viewFactor::Ru() const
{ {
tmp<DimensionedField<scalar, volMesh> > tRu return tmp<DimensionedField<scalar, volMesh> >
( (
new DimensionedField<scalar, volMesh> new DimensionedField<scalar, volMesh>
( (
IOobject IOobject
( (
"tRu", "Ru",
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
@ -633,8 +632,6 @@ Foam::radiation::viewFactor::Ru() const
dimensionedScalar("zero", dimMass/dimLength/pow3(dimTime), 0.0) dimensionedScalar("zero", dimMass/dimLength/pow3(dimTime), 0.0)
) )
); );
return tRu;
} }

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) 2008-2011 OpenCFD Ltd. \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
inline const Foam::volScalarField& Foam::radiation::viewFactor::Qr() const inline const Foam::volScalarField& Foam::radiation::viewFactor::Qr() const
{ {
return Qr_; return Qr_;