From aa684c3ea3df298291dab43e338740cfce5f0e2f Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 16 Nov 2009 11:23:06 +0000 Subject: [PATCH 1/3] adding new BC --- ...ranslatingWallVelocityFvPatchVectorField.C | 142 ++++++++++++++++ ...ranslatingWallVelocityFvPatchVectorField.H | 155 ++++++++++++++++++ 2 files changed, 297 insertions(+) create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C create mode 100644 src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.H diff --git a/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C new file mode 100644 index 0000000000..ef3fb96aa1 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "translatingWallVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +translatingWallVelocityFvPatchVectorField:: +translatingWallVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + U_(vector::zero) +{} + + +translatingWallVelocityFvPatchVectorField:: +translatingWallVelocityFvPatchVectorField +( + const translatingWallVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + U_(ptf.U_) +{} + + +translatingWallVelocityFvPatchVectorField:: +translatingWallVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF), + U_(dict.lookup("U")) +{ + // Evaluate the wall velocity + updateCoeffs(); +} + + +translatingWallVelocityFvPatchVectorField:: +translatingWallVelocityFvPatchVectorField +( + const translatingWallVelocityFvPatchVectorField& twvpvf +) +: + fixedValueFvPatchField(twvpvf), + U_(twvpvf.U_) +{} + + +translatingWallVelocityFvPatchVectorField:: +translatingWallVelocityFvPatchVectorField +( + const translatingWallVelocityFvPatchVectorField& twvpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(twvpvf, iF), + U_(twvpvf.U_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void translatingWallVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Remove the component of U normal to the wall in case the wall is not flat + vectorField n = patch().nf(); + vectorField::operator=(U_ - n*(n & U_)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void translatingWallVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + os.writeKeyword("U") << U_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchVectorField, + translatingWallVelocityFvPatchVectorField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.H new file mode 100644 index 0000000000..68345ae537 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/translatingWallVelocity/translatingWallVelocityFvPatchVectorField.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::translatingWallVelocityFvPatchVectorField + +Description + Foam::translatingWallVelocityFvPatchVectorField + +SourceFiles + translatingWallVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef translatingWallVelocityFvPatchVectorField_H +#define translatingWallVelocityFvPatchVectorField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class translatingWallVelocityFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +class translatingWallVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Origin of the rotation + vector U_; + + +public: + + //- Runtime type information + TypeName("translatingWallVelocity"); + + + // Constructors + + //- Construct from patch and internal field + translatingWallVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + translatingWallVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given a + // translatingWallVelocityFvPatchVectorField onto a new patch + translatingWallVelocityFvPatchVectorField + ( + const translatingWallVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + translatingWallVelocityFvPatchVectorField + ( + const translatingWallVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new translatingWallVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + translatingWallVelocityFvPatchVectorField + ( + const translatingWallVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new translatingWallVelocityFvPatchVectorField(*this, iF) + ); + } + + + + // Member functions + + // Access functions + + //- Return the velocity + const vector& U() const + { + return U_; + } + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From fbc7c5bccf2e9b8301e1746973abcb5d2024cc4a Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 16 Nov 2009 14:20:10 +0000 Subject: [PATCH 2/3] Set gcc-4.4.2 as the default gcc compiler version. --- etc/bashrc | 4 ++-- etc/cshrc | 4 ++-- etc/settings.csh | 4 ++-- etc/settings.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/bashrc b/etc/bashrc index df864b40e1..308d33bf84 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -82,8 +82,8 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE -# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Compiler: set to Gcc, Gcc43, Gcc44, or Icc (for Intel's icc) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : ${WM_COMPILER:=Gcc}; export WM_COMPILER export WM_COMPILER_ARCH= diff --git a/etc/cshrc b/etc/cshrc index f5fe32d26e..9ef6fb2d06 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -76,8 +76,8 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX -# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc) -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Compiler: set to Gcc, Gcc43, Gcc44 or Icc (for Intel's icc) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc setenv WM_COMPILER_ARCH diff --git a/etc/settings.csh b/etc/settings.csh index 1b33c5c42d..d970f03942 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -87,12 +87,12 @@ switch ("$compilerInstall") case OpenFOAM: switch ("$WM_COMPILER") case Gcc: - setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH + setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib breaksw case Gcc44: - setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH + setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib breaksw diff --git a/etc/settings.sh b/etc/settings.sh index f1abf12423..02b3172307 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -111,12 +111,12 @@ case "${compilerInstall:-OpenFOAM}" in OpenFOAM) case "$WM_COMPILER" in Gcc) - export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH + export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib ;; Gcc44) - export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH + export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib ;; From b93d762e5a97f375519a9a9c71b0353b1d55457b Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 16 Nov 2009 15:24:48 +0000 Subject: [PATCH 3/3] Correction to the ordering of nsided and nfaced elements provided by Francesco Del Citto. --- .../foamToEnsight/ensightMesh.C | 784 +++++++++++++----- .../foamToEnsight/ensightMesh.H | 93 ++- 2 files changed, 678 insertions(+), 199 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index c3262e6b9c..4796f4b4f1 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -428,7 +428,43 @@ void Foam::ensightMesh::writePrimsBinary } -void Foam::ensightMesh::writePolys +void Foam::ensightMesh::writePolysNFaces +( + const labelList& polys, + const cellList& cellFaces, + OFstream& ensightGeometryFile +) const +{ + forAll(polys, i) + { + ensightGeometryFile + << setw(10) << cellFaces[polys[i]].size() << nl; + } +} + + +void Foam::ensightMesh::writePolysNPointsPerFace +( + const labelList& polys, + const cellList& cellFaces, + const faceList& faces, + OFstream& ensightGeometryFile +) const +{ + forAll(polys, i) + { + const labelList& cf = cellFaces[polys[i]]; + + forAll(cf, faceI) + { + ensightGeometryFile + << setw(10) << faces[cf[faceI]].size() << nl; + } + } +} + + +void Foam::ensightMesh::writePolysPoints ( const labelList& polys, const cellList& cellFaces, @@ -437,50 +473,190 @@ void Foam::ensightMesh::writePolys OFstream& ensightGeometryFile ) const { - if (polys.size()) + label po = pointOffset + 1; + + forAll(polys, i) { - ensightGeometryFile - << "nfaced" << nl << setw(10) << polys.size() << nl; + const labelList& cf = cellFaces[polys[i]]; - label po = pointOffset + 1; - - forAll(polys, i) + forAll(cf, faceI) { - ensightGeometryFile - << setw(10) << cellFaces[polys[i]].size() << nl; - } + const face& f = faces[cf[faceI]]; - forAll(polys, i) - { - const labelList& cf = cellFaces[polys[i]]; - - forAll(cf, faceI) + forAll(f, pointI) { - ensightGeometryFile - << setw(10) << faces[cf[faceI]].size() << nl; - } - } - - forAll(polys, i) - { - const labelList& cf = cellFaces[polys[i]]; - - forAll(cf, faceI) - { - const face& f = faces[cf[faceI]]; - - forAll(f, pointI) - { - ensightGeometryFile << setw(10) << f[pointI] + po; - } - ensightGeometryFile << nl; + ensightGeometryFile << setw(10) << f[pointI] + po; } + ensightGeometryFile << nl; } } } -void Foam::ensightMesh::writePolysBinary +void Foam::ensightMesh::writeAllPolys +( + const labelList& pointOffsets, + OFstream& ensightGeometryFile +) const +{ + if (meshCellSets_.nPolys) + { + const cellList& cellFaces = mesh_.cells(); + const faceList& faces = mesh_.faces(); + + if (Pstream::master()) + { + ensightGeometryFile + << "nfaced" << nl << setw(10) << meshCellSets_.nPolys << nl; + } + + // Number of faces for each poly cell + if (Pstream::master()) + { + // Master + writePolysNFaces + ( + meshCellSets_.polys, + cellFaces, + ensightGeometryFile + ); + // Slaves + for (int slave=1; slave