From 23cf5d94cd937aae0a912f01da023f43a9a09d2c Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 3 Nov 2009 14:33:01 +0000 Subject: [PATCH 01/32] code tidying --- .../vtkPV3Foam/vtkPV3FoamFaceField.H | 21 ++++++++++--------- .../vtkPV3Foam/vtkPV3FoamMeshLagrangian.C | 4 ++-- .../vtkPV3Foam/vtkPV3FoamMeshPatch.C | 13 ++++-------- .../vtkPV3Foam/vtkPV3FoamMeshSet.C | 12 +++++------ .../vtkPV3Foam/vtkPV3FoamMeshVolume.C | 8 +++---- .../vtkPV3Foam/vtkPV3FoamMeshZone.C | 10 ++++----- .../vtkPV3Foam/vtkPV3FoamPatchField.H | 18 ++++++++-------- .../vtkPV3Foam/vtkPV3FoamPointFields.H | 6 +++--- .../vtkPV3Foam/vtkPV3FoamUpdateInfo.C | 4 +--- .../vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H | 3 ++- .../vtkPV3Foam/vtkPV3FoamUtils.C | 1 + 11 files changed, 45 insertions(+), 55 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H index dba8d97d37..14c0d5f9b9 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H @@ -35,6 +35,7 @@ InClass #include "vtkFloatArray.h" #include "vtkMultiBlockDataSet.h" #include "vtkPolyData.h" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -53,11 +54,11 @@ void Foam::vtkPV3Foam::convertFaceField const labelList& faceOwner = mesh.faceOwner(); const labelList& faceNeigh = mesh.faceNeighbour(); - vtkFloatArray *cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples( faceLabels.size() ); - cellData->SetNumberOfComponents( nComp ); - cellData->Allocate( nComp*faceLabels.size() ); - cellData->SetName( tf.name().c_str() ); + vtkFloatArray* cellData = vtkFloatArray::New(); + cellData->SetNumberOfTuples(faceLabels.size()); + cellData->SetNumberOfComponents(nComp); + cellData->Allocate(nComp*faceLabels.size()); + cellData->SetName(tf.name().c_str()); if (debug) { @@ -123,11 +124,11 @@ void Foam::vtkPV3Foam::convertFaceField const labelList& faceOwner = mesh.faceOwner(); const labelList& faceNeigh = mesh.faceNeighbour(); - vtkFloatArray *cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples( fSet.size() ); - cellData->SetNumberOfComponents( nComp ); - cellData->Allocate( nComp*fSet.size() ); - cellData->SetName( tf.name().c_str() ); + vtkFloatArray* cellData = vtkFloatArray::New(); + cellData->SetNumberOfTuples(fSet.size()); + cellData->SetNumberOfComponents(nComp); + cellData->Allocate(nComp*fSet.size()); + cellData->SetName(tf.name().c_str()); if (debug) { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index e653b05adb..0d46db1d49 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -80,8 +80,8 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh vtkPoints* vtkpoints = vtkPoints::New(); vtkCellArray* vtkcells = vtkCellArray::New(); - vtkpoints->Allocate( parcels.size() ); - vtkcells->Allocate( parcels.size() ); + vtkpoints->Allocate(parcels.size()); + vtkcells->Allocate(parcels.size()); vtkIdType particleId = 0; forAllConstIter(Cloud, parcels, iter) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index d7c0f2f013..ace25f527f 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "vtkPV3Foam.H" @@ -40,10 +38,7 @@ Description // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh -( - const polyPatch& p -) +vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p) { vtkPolyData* vtkmesh = vtkPolyData::New(); @@ -56,8 +51,8 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh // Convert Foam mesh vertices to VTK const Foam::pointField& points = p.localPoints(); - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate( points.size() ); + vtkPoints* vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(points.size()); forAll(points, i) { vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); @@ -71,7 +66,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh const faceList& faces = p.localFaces(); vtkCellArray* vtkcells = vtkCellArray::New(); - vtkcells->Allocate( faces.size() ); + vtkcells->Allocate(faces.size()); forAll(faces, faceI) { const face& f = faces[faceI]; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C index f363beae45..431df1f9c5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "vtkPV3Foam.H" @@ -71,8 +69,8 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh // Convert Foam mesh vertices to VTK const pointField& points = p.localPoints(); - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate( points.size() ); + vtkPoints* vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(points.size()); forAll(points, i) { vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); @@ -84,7 +82,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh const faceList& faces = p.localFaces(); vtkCellArray* vtkcells = vtkCellArray::New(); - vtkcells->Allocate( faces.size() ); + vtkcells->Allocate(faces.size()); forAll(faces, faceI) { @@ -127,8 +125,8 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh const pointField& meshPoints = mesh.points(); - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate( pSet.size() ); + vtkPoints* vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(pSet.size()); forAllConstIter(pointSet, pSet, iter) { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index e1fd59ccd0..b39dfd453f 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "vtkPV3Foam.H" @@ -136,8 +134,8 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh } // Convert Foam mesh vertices to VTK - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate( mesh.nPoints() + nAddPoints ); + vtkPoints* vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(mesh.nPoints() + nAddPoints); const Foam::pointField& points = mesh.points(); @@ -152,7 +150,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh Info<< "... converting cells" << endl; } - vtkmesh->Allocate( mesh.nCells() + nAddCells ); + vtkmesh->Allocate(mesh.nCells() + nAddCells); // Set counters for additional points and additional cells label addPointI = 0, addCellI = 0; diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 0a21310a63..9b8bcb956d 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C @@ -22,8 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - \*---------------------------------------------------------------------------*/ #include "vtkPV3Foam.H" @@ -69,7 +67,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh const pointField& points = p.localPoints(); vtkPoints* vtkpoints = vtkPoints::New(); - vtkpoints->Allocate( points.size() ); + vtkpoints->Allocate(points.size()); forAll(points, i) { vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); @@ -83,7 +81,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh const faceList& faces = p.localFaces(); vtkCellArray* vtkcells = vtkCellArray::New(); - vtkcells->Allocate( faces.size() ); + vtkcells->Allocate(faces.size()); forAll(faces, faceI) { @@ -126,8 +124,8 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh const pointField& meshPoints = mesh.points(); - vtkPoints *vtkpoints = vtkPoints::New(); - vtkpoints->Allocate( pointLabels.size() ); + vtkPoints* vtkpoints = vtkPoints::New(); + vtkpoints->Allocate(pointLabels.size()); forAll(pointLabels, pointI) { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H index 7b7de4d022..bfa2d1ac46 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H @@ -52,10 +52,10 @@ void Foam::vtkPV3Foam::convertPatchField const label nComp = pTraits::nComponents; vtkFloatArray* cellData = vtkFloatArray::New(); - cellData->SetNumberOfTuples( ptf.size() ); - cellData->SetNumberOfComponents( nComp ); - cellData->Allocate( nComp*ptf.size() ); - cellData->SetName( name.c_str() ); + cellData->SetNumberOfTuples(ptf.size()); + cellData->SetNumberOfComponents(nComp); + cellData->Allocate(nComp*ptf.size()); + cellData->SetName(name.c_str()); float vec[nComp]; forAll(ptf, i) @@ -91,11 +91,11 @@ void Foam::vtkPV3Foam::convertPatchPointField { const label nComp = pTraits::nComponents; - vtkFloatArray *pointData = vtkFloatArray::New(); - pointData->SetNumberOfTuples( pptf.size() ); - pointData->SetNumberOfComponents( nComp ); - pointData->Allocate( nComp*pptf.size() ); - pointData->SetName( name.c_str() ); + vtkFloatArray* pointData = vtkFloatArray::New(); + pointData->SetNumberOfTuples(pptf.size()); + pointData->SetNumberOfComponents(nComp); + pointData->Allocate(nComp*pptf.size()); + pointData->SetName(name.c_str()); float vec[nComp]; forAll(pptf, i) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 3a609b2bde..5e3ae1df42 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H @@ -110,9 +110,9 @@ void Foam::vtkPV3Foam::convertPointFields ++partId ) { - const word patchName = getPartName(partId); + const word patchName = getPartName(partId); const label datasetNo = partDataset_[partId]; - const label patchId = patches.findPatchID(patchName); + const label patchId = patches.findPatchID(patchName); if (!partStatus_[partId] || datasetNo < 0 || patchId < 0) { @@ -187,7 +187,7 @@ void Foam::vtkPV3Foam::convertPointField nPoints = ptf.size(); } - vtkFloatArray *pointData = vtkFloatArray::New(); + vtkFloatArray* pointData = vtkFloatArray::New(); pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size()); pointData->SetNumberOfComponents(nComp); pointData->Allocate(nComp*(nPoints + addPointCellLabels.size())); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index 59e445e341..5bb2143c2a 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C @@ -140,7 +140,6 @@ void Foam::vtkPV3Foam::updateInfoInternalMesh() Info<< " Foam::vtkPV3Foam::updateInfoInternalMesh" << endl; } - } @@ -440,14 +439,13 @@ void Foam::vtkPV3Foam::updateInfoLagrangianFields() << endl; } - vtkDataArraySelection *fieldSelection = + vtkDataArraySelection* fieldSelection = reader_->GetLagrangianFieldSelection(); // preserve the enabled selections stringList enabledEntries = getSelectedArrayEntries(fieldSelection); fieldSelection->RemoveAllArrays(); - // // TODO - currently only get fields from ONE cloud // have to decide if the second set of fields get mixed in // or dealt with separately diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H index 7e28460a46..4d35525efe 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H @@ -35,7 +35,7 @@ InClass template class patchType, class meshType> void Foam::vtkPV3Foam::updateInfoFields ( - vtkDataArraySelection *select + vtkDataArraySelection* select ) { if (debug) @@ -112,4 +112,5 @@ void Foam::vtkPV3Foam::updateInfoFields // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C index a9d12c303a..9683a15914 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C @@ -69,6 +69,7 @@ namespace Foam } // End namespace Foam + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::vtkPV3Foam::AddToBlock From 5c9f1ea23b9f050fd9dbfa02b46eb38d66668de7 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Nov 2009 16:16:55 +0000 Subject: [PATCH 02/32] allow read restart --- ...iffusiveRadiationMixedFvPatchScalarField.C | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index 42f3ec841d..f8e63679a2 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -81,23 +81,28 @@ greyDiffusiveRadiationMixedFvPatchScalarField TName_(dict.lookup("T")), emissivity_(readScalar(dict.lookup("emissivity"))) { - const scalarField& Tp = - patch().lookupPatchField(TName_); - - refValue() = - emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/pi; - - refGrad() = 0.0; - if (dict.found("value")) { fvPatchScalarField::operator= ( scalarField("value", dict, p.size()) ); + refValue() = scalarField("refValue", dict, p.size()); + refGrad() = scalarField("refGradient", dict, p.size()); + valueFraction() = scalarField("valueFraction", dict, p.size()); } else { + // No value given. Restart as fixedValue b.c. + + const scalarField& Tp = + patch().lookupPatchField(TName_); + + refValue() = + emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/pi; + refGrad() = 0.0; + valueFraction() = 1.0; + fvPatchScalarField::operator=(refValue()); } } @@ -220,10 +225,9 @@ void Foam::radiation::greyDiffusiveRadiationMixedFvPatchScalarField::write Ostream& os ) const { - fvPatchScalarField::write(os); + mixedFvPatchScalarField::write(os); os.writeKeyword("T") << TName_ << token::END_STATEMENT << nl; os.writeKeyword("emissivity") << emissivity_ << token::END_STATEMENT << nl; - writeEntry("value", os); } From 3dd6db6d99645c261bd2f5530277ed17afb9ce9c Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Nov 2009 16:17:20 +0000 Subject: [PATCH 03/32] typo in header --- .../mutkRoughWallFunctionFvPatchScalarField.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H index 479fd7b9ab..1b31255261 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::compressible::RASModels::nutRoughWallFunctionFvPatchScalarField + Foam::compressible::RASModels::mutRoughWallFunctionFvPatchScalarField Description Boundary condition for turbulent (kinematic) viscosity when using wall From 84627ec9ffa30881504ca4290541900e890d2fc0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 6 Nov 2009 11:12:42 +0000 Subject: [PATCH 04/32] allow external setting of WM variables --- etc/cshrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/etc/cshrc b/etc/cshrc index 39a5210ca0..f5fe32d26e 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -32,7 +32,7 @@ #------------------------------------------------------------------------------ setenv WM_PROJECT OpenFOAM -setenv WM_PROJECT_VERSION dev +if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION 1.6 ################################################################################ # USER EDITABLE PART @@ -120,7 +120,6 @@ case Linux: case x86_64: switch ($WM_ARCH_OPTION) case 32: - setenv WM_ARCH linux setenv WM_COMPILER_ARCH '-64' setenv WM_CC 'gcc' setenv WM_CXX 'g++' From e7347dbd624989eea8d9b8f4614128f0c8f711bb Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 9 Nov 2009 10:15:07 +0000 Subject: [PATCH 05/32] removed unnecessary interpolation of h - not used --- .../solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C | 1 - 1 file changed, 1 deletion(-) diff --git a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C index bd1989f433..757ad95e25 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C +++ b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C @@ -90,7 +90,6 @@ int main(int argc, char *argv[]) // --- PISO loop for (int corr=0; corr Date: Tue, 10 Nov 2009 13:18:35 +0000 Subject: [PATCH 06/32] fieldname is a word; not fileName --- .../sampledSurface/writers/dx/dxSurfaceWriter.C | 2 +- .../sampledSurface/writers/dx/dxSurfaceWriter.H | 2 +- .../writers/foamFile/foamFileSurfaceWriter.C | 2 +- .../writers/foamFile/foamFileSurfaceWriter.H | 2 +- .../writers/null/nullSurfaceWriter.C | 2 +- .../writers/null/nullSurfaceWriter.H | 2 +- .../writers/proxy/proxySurfaceWriter.H | 2 +- .../sampledSurface/writers/raw/rawSurfaceWriter.C | 14 +++++++------- .../sampledSurface/writers/raw/rawSurfaceWriter.H | 12 ++++++------ .../sampledSurface/writers/surfaceWriter.H | 2 +- .../sampledSurface/writers/vtk/vtkSurfaceWriter.C | 2 +- .../sampledSurface/writers/vtk/vtkSurfaceWriter.H | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C index a5c613b15d..49e088bb83 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C @@ -249,7 +249,7 @@ void Foam::dxSurfaceWriter::write const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose ) const diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H index fcce2e6af2..8dc9164ec2 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H @@ -88,7 +88,7 @@ public: const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose = false ) const; diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C index 0d68df2044..7f617911c6 100644 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C @@ -84,7 +84,7 @@ void Foam::foamFileSurfaceWriter::write const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose ) const diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H index 207f36c962..8ef12cda31 100644 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H @@ -95,7 +95,7 @@ public: const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose = false ) const; diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C index 1409750c05..56fcaad321 100644 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C @@ -53,7 +53,7 @@ void Foam::nullSurfaceWriter::write const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose ) const diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H index 24a3f70d4c..475617d48b 100644 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H @@ -80,7 +80,7 @@ public: const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose = false ) const; diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H index ceeec731a7..e0dd1dc596 100644 --- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H @@ -102,7 +102,7 @@ public: const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose = false ) const diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C index bab2ad38f3..c916fe16c3 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C @@ -65,7 +65,7 @@ void Foam::rawSurfaceWriter::writeGeometry template void Foam::rawSurfaceWriter::writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const scalarField& values, @@ -101,7 +101,7 @@ void Foam::rawSurfaceWriter::writeData template void Foam::rawSurfaceWriter::writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const vectorField& values, @@ -144,7 +144,7 @@ void Foam::rawSurfaceWriter::writeData template void Foam::rawSurfaceWriter::writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const sphericalTensorField& values, @@ -183,7 +183,7 @@ void Foam::rawSurfaceWriter::writeData template void Foam::rawSurfaceWriter::writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const symmTensorField& values, @@ -232,7 +232,7 @@ void Foam::rawSurfaceWriter::writeData template void Foam::rawSurfaceWriter::writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const tensorField& values, @@ -344,7 +344,7 @@ namespace Foam const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose ) const @@ -359,7 +359,7 @@ void Foam::rawSurfaceWriter::write const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose ) const diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index fc9fc0804a..353399c893 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -70,7 +70,7 @@ class rawSurfaceWriter static void writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const scalarField& values, @@ -79,7 +79,7 @@ class rawSurfaceWriter static void writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const vectorField& values, @@ -88,7 +88,7 @@ class rawSurfaceWriter static void writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const sphericalTensorField& values, @@ -97,7 +97,7 @@ class rawSurfaceWriter static void writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const symmTensorField& values, @@ -106,7 +106,7 @@ class rawSurfaceWriter static void writeData ( - const fileName& fieldName, + const word& fieldName, const pointField& points, const faceList& faces, const tensorField& values, @@ -152,7 +152,7 @@ public: const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose = false ) const; diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index b645c522ef..0bee6afe8a 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -128,7 +128,7 @@ public: const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, - const fileName& fieldName, // name of field + const word& fieldName, // name of field const Field& values, const bool verbose = false ) const = 0; diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C index 7ecfd6949d..5967a54211 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C @@ -266,7 +266,7 @@ void Foam::vtkSurfaceWriter::write const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose ) const diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H index 1b8736f103..da0c3ef589 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H @@ -97,7 +97,7 @@ public: const fileName& surfaceName, const pointField& points, const faceList& faces, - const fileName& fieldName, + const word& fieldName, const Field& values, const bool verbose = false ) const; From 13bddac8f098ac10bb1dcdbfd12488232062a142 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 11 Nov 2009 11:29:22 +0000 Subject: [PATCH 07/32] singleCellFvMesh and application --- .../manipulation/singleCellMesh/Make/files | 3 + .../manipulation/singleCellMesh/Make/options | 6 + .../singleCellMesh/singleCellMesh.C | 142 ++++ .../primitivePatch/uindirectPrimitivePatch.H | 53 ++ src/finiteVolume/Make/files | 1 + .../singleCellFvMesh/singleCellFvMesh.C | 640 ++++++++++++++++++ .../singleCellFvMesh/singleCellFvMesh.H | 245 +++++++ .../singleCellFvMeshInterpolate.C | 132 ++++ 8 files changed, 1222 insertions(+) create mode 100644 applications/utilities/mesh/manipulation/singleCellMesh/Make/files create mode 100644 applications/utilities/mesh/manipulation/singleCellMesh/Make/options create mode 100644 applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C create mode 100644 src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H create mode 100644 src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C create mode 100644 src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H create mode 100644 src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/Make/files b/applications/utilities/mesh/manipulation/singleCellMesh/Make/files new file mode 100644 index 0000000000..db941393b0 --- /dev/null +++ b/applications/utilities/mesh/manipulation/singleCellMesh/Make/files @@ -0,0 +1,3 @@ +singleCellMesh.C + +EXE = $(FOAM_APPBIN)/singleCellMesh diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/Make/options b/applications/utilities/mesh/manipulation/singleCellMesh/Make/options new file mode 100644 index 0000000000..89e52b6d52 --- /dev/null +++ b/applications/utilities/mesh/manipulation/singleCellMesh/Make/options @@ -0,0 +1,6 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -lfiniteVolume + diff --git a/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C new file mode 100644 index 0000000000..fe1e2850b9 --- /dev/null +++ b/applications/utilities/mesh/manipulation/singleCellMesh/singleCellMesh.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 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 + +Application + singleCellMesh + +Description + Removes all but one cells of the mesh. Used to generate mesh and fields + that can be used for boundary-only data. + Might easily result in illegal mesh though so only look at boundaries + in paraview. + +\*---------------------------------------------------------------------------*/ + + +#include "argList.H" +#include "fvMesh.H" +#include "volFields.H" +#include "Time.H" +#include "ReadFields.H" +#include "singleCellFvMesh.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void interpolateFields +( + const singleCellFvMesh& scMesh, + const PtrList& flds +) +{ + forAll(flds, i) + { + tmp scFld = scMesh.interpolate(flds[i]); + GeoField* scFldPtr = scFld.ptr(); + scFldPtr->writeOpt() = IOobject::AUTO_WRITE; + scFldPtr->store(); + } +} + + +// Main program: + +int main(int argc, char *argv[]) +{ + Foam::argList::validOptions.insert("overwrite", ""); +# include "addTimeOptions.H" +# include "setRootCase.H" +# include "createTime.H" + // Get times list + instantList Times = runTime.times(); +# include "checkTimeOptions.H" + runTime.setTime(Times[startTime], startTime); +# include "createMesh.H" + const word oldInstance = mesh.pointsInstance(); + + bool overwrite = args.optionFound("overwrite"); + + + // Read objects in time directory + IOobjectList objects(mesh, runTime.timeName()); + + // Read vol fields. + PtrList vsFlds; + ReadFields(mesh, objects, vsFlds); + + PtrList vvFlds; + ReadFields(mesh, objects, vvFlds); + + PtrList vstFlds; + ReadFields(mesh, objects, vstFlds); + + PtrList vsymtFlds; + ReadFields(mesh, objects, vsymtFlds); + + PtrList vtFlds; + ReadFields(mesh, objects, vtFlds); + + + if (!overwrite) + { + runTime++; + } + + // Create the mesh + singleCellFvMesh scMesh + ( + IOobject + ( + mesh.name(), + mesh.polyMesh::instance(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + + // Map and store the fields on the scMesh. + interpolateFields(scMesh, vsFlds); + interpolateFields(scMesh, vvFlds); + interpolateFields(scMesh, vstFlds); + interpolateFields(scMesh, vsymtFlds); + interpolateFields(scMesh, vtFlds); + + + // Write + Info<< "Writing mesh to time " << runTime.timeName() << endl; + scMesh.write(); + + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H new file mode 100644 index 0000000000..4afb30dd22 --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Typedef + Foam::uindirectPrimitivePatch + +Description + Foam::uindirectPrimitivePatch + +\*---------------------------------------------------------------------------*/ + +#ifndef uindirectPrimitivePatch_H +#define uindirectPrimitivePatch_H + +#include "PrimitivePatch.H" +#include "face.H" +#include "UIndirectList.H" +#include "pointField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef PrimitivePatch + uindirectPrimitivePatch; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index c387ac994d..5fe44b9357 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -1,6 +1,7 @@ fvMesh/fvMeshGeometry.C fvMesh/fvMesh.C +fvMesh/singleCellFvMesh/singleCellFvMesh.C fvMesh/fvMeshSubset/fvMeshSubset.C fvBoundaryMesh = fvMesh/fvBoundaryMesh diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C new file mode 100644 index 0000000000..65965f15d9 --- /dev/null +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C @@ -0,0 +1,640 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 "singleCellFvMesh.H" +#include "syncTools.H" +#include "uindirectPrimitivePatch.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// Conversion is a two step process: +// - from original (fine) patch faces to agglomerations (aggloms might not +// be in correct patch order) +// - from agglomerations to coarse patch faces +void Foam::singleCellFvMesh::agglomerateMesh +( + const fvMesh& mesh, + const labelListList& agglom +) +{ + const polyBoundaryMesh& oldPatches = mesh.boundaryMesh(); + + // Check agglomeration within patch face range and continuous + labelList nAgglom(oldPatches.size()); + + forAll(oldPatches, patchI) + { + const polyPatch& pp = oldPatches[patchI]; + + nAgglom[patchI] = max(agglom[patchI])+1; + + forAll(pp, i) + { + if (agglom[patchI][i] < 0 || agglom[patchI][i] >= pp.size()) + { + FatalErrorIn + ( + "singleCellFvMesh::agglomerateMesh(..)" + ) << "agglomeration on patch " << patchI + << " is out of range 0.." << pp.size()-1 + << exit(FatalError); + } + } + } + + // Check agglomeration is sync + { + // Get neighbouring agglomeration + labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces()); + forAll(oldPatches, patchI) + { + const polyPatch& pp = oldPatches[patchI]; + + if (pp.coupled()) + { + label offset = pp.start()-mesh.nInternalFaces(); + forAll(pp, i) + { + nbrAgglom[offset+i] = agglom[patchI][i]; + } + } + } + syncTools::swapBoundaryFaceList(mesh, nbrAgglom, false); + + + // Get correspondence between this agglomeration and remote one + Map