Merge branch 'master' into dicts

This commit is contained in:
andy
2010-10-14 10:10:04 +01:00
60 changed files with 686 additions and 609 deletions

View File

@ -34,17 +34,14 @@ Description
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField SfUfbyDelta = scalarField sumPhi =
mesh.surfaceInterpolation::deltaCoeffs() fvc::surfaceSum(mag(phiSt))().internalField()
*mag(phiSt/fvc::interpolate(rho)); /rho.internalField();
StCoNum = StCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
max(SfUfbyDelta/mesh.magSf()).value()
*runTime.deltaTValue();
meanStCoNum = meanStCoNum =
(sum(SfUfbyDelta)/sum(mesh.magSf())).value() 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
*runTime.deltaTValue();
} }
Info<< "St courant Number mean: " << meanStCoNum Info<< "St courant Number mean: " << meanStCoNum

View File

@ -30,10 +30,10 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
{ {
scalar sumLocalContErr = runTime.deltaT().value()* scalar sumLocalContErr = runTime.deltaTValue()*
mag(fvc::div(phia))().weightedAverage(mesh.V()).value(); mag(fvc::div(phia))().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()* scalar globalContErr = runTime.deltaTValue()*
fvc::div(phia)().weightedAverage(mesh.V()).value(); fvc::div(phia)().weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr; cumulativeContErr += globalContErr;

View File

@ -36,23 +36,23 @@ scalar waveCoNum = 0.0;
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField SfUfbyDelta = scalarField sumPhi =
mesh.surfaceInterpolation::deltaCoeffs() fvc::surfaceSum(mag(phi))().internalField()
*mag(phi)/fvc::interpolate(h); /h.internalField();
CoNum = max(SfUfbyDelta/mesh.magSf()) CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanCoNum =
.value()*runTime.deltaTValue(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
// Gravity wave Courant number // Gravity wave Courant number
waveCoNum = waveCoNum = 0.25*gMax
0.5*max (
fvc::surfaceSum
( (
mesh.surfaceInterpolation::deltaCoeffs() fvc::interpolate(sqrt(h))*mesh.magSf()
*sqrt(fvc::interpolate(h)) )().internalField()/mesh.V().field()
).value()*sqrt(magg).value()*runTime.deltaTValue(); )*sqrt(magg).value()*runTime.deltaTValue();
} }
Info<< "Courant number mean: " << meanCoNum Info<< "Courant number mean: " << meanCoNum

View File

@ -35,19 +35,21 @@ scalar acousticCoNum = 0.0;
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField SfUfbyDelta = scalarField sumPhi =
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv); fvc::surfaceSum(mag(phiv))().internalField();
CoNum = max(SfUfbyDelta/mesh.magSf()) CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanCoNum =
.value()*runTime.deltaTValue(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
acousticCoNum = max acousticCoNum = 0.5*gMax
( (
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi)) fvc::surfaceSum
).value()*runTime.deltaTValue(); (
fvc::interpolate(scalar(1)/sqrt(psi))*mesh.magSf()
)().internalField()/mesh.V().field()
)*runTime.deltaTValue();
} }
Info<< "phiv Courant Number mean: " << meanCoNum Info<< "phiv Courant Number mean: " << meanCoNum

View File

@ -86,7 +86,7 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
} }
Info<< "\n end \n"; Info<< "End\n" << endl;
return 0; return 0;
} }

View File

@ -43,10 +43,10 @@ if (mesh.nInternalFaces())
pos(alpha1 - 0.01)*pos(0.99 - alpha1) pos(alpha1 - 0.01)*pos(0.99 - alpha1)
*fvc::surfaceSum(mag(phi))().internalField(); *fvc::surfaceSum(mag(phi))().internalField();
alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaT().value(); alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanAlphaCoNum = meanAlphaCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaT().value(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Interface Courant Number mean: " << meanAlphaCoNum Info<< "Interface Courant Number mean: " << meanAlphaCoNum

View File

@ -42,12 +42,12 @@ if (adjustTimeStep)
( (
min min
( (
deltaTFact*runTime.deltaT().value(), deltaTFact*runTime.deltaTValue(),
maxDeltaT maxDeltaT
) )
); );
Info<< "deltaT = " << runTime.deltaT().value() << endl; Info<< "deltaT = " << runTime.deltaTValue() << endl;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -39,20 +39,16 @@ scalar meanAlphaCoNum = 0.0;
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField alpha1f = fvc::interpolate(alpha1); scalarField sumPhi = max
surfaceScalarField alpha2f = fvc::interpolate(alpha2);
surfaceScalarField SfUfbyDelta = max
( (
pos(alpha1f - 0.01)*pos(0.99 - alpha1f), pos(alpha1 - 0.01)*pos(0.99 - alpha1),
pos(alpha2f - 0.01)*pos(0.99 - alpha2f) pos(alpha2 - 0.01)*pos(0.99 - alpha2)
)*mesh.surfaceInterpolation::deltaCoeffs()*mag(phi); )*fvc::surfaceSum(mag(phi))().internalField();
alphaCoNum = max(SfUfbyDelta/mesh.magSf()) alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
.value()*runTime.deltaT().value();
meanAlphaCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanAlphaCoNum =
.value()*runTime.deltaT().value(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Interface Courant Number mean: " << meanAlphaCoNum Info<< "Interface Courant Number mean: " << meanAlphaCoNum

View File

@ -39,15 +39,14 @@ scalar meanAlphaCoNum = 0.0;
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField SfUfbyDelta = scalarField sumPhi =
mixture.nearInterface() mixture.nearInterface()().internalField()
*mesh.surfaceInterpolation::deltaCoeffs()*mag(phi); *fvc::surfaceSum(mag(phi))().internalField();
alphaCoNum = max(SfUfbyDelta/mesh.magSf()) alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
.value()*runTime.deltaT().value();
meanAlphaCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanAlphaCoNum =
.value()*runTime.deltaT().value(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Interface Courant Number mean: " << meanAlphaCoNum Info<< "Interface Courant Number mean: " << meanAlphaCoNum

View File

@ -457,12 +457,12 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::K
} }
Foam::tmp<Foam::surfaceScalarField> Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixture::nearInterface() const Foam::multiphaseMixture::nearInterface() const
{ {
tmp<surfaceScalarField> tnearInt tmp<volScalarField> tnearInt
( (
new surfaceScalarField new volScalarField
( (
IOobject IOobject
( (
@ -477,8 +477,7 @@ Foam::multiphaseMixture::nearInterface() const
forAllConstIter(PtrDictionary<phase>, phases_, iter) forAllConstIter(PtrDictionary<phase>, phases_, iter)
{ {
surfaceScalarField alphaf = fvc::interpolate(iter()); tnearInt() = max(tnearInt(), pos(iter() - 0.01)*pos(0.99 - iter()));
tnearInt() = max(tnearInt(), pos(alphaf - 0.01)*pos(0.99 - alphaf));
} }
return tnearInt; return tnearInt;

View File

@ -258,7 +258,7 @@ public:
//- Indicator of the proximity of the interface //- Indicator of the proximity of the interface
// Field values are 1 near and 0 away for the interface. // Field values are 1 near and 0 away for the interface.
tmp<surfaceScalarField> nearInterface() const; tmp<volScalarField> nearInterface() const;
//- Solve for the mixture phase-fractions //- Solve for the mixture phase-fractions
void solve(); void solve();

View File

@ -1,11 +1,10 @@
# include "CourantNo.H" # include "CourantNo.H"
{ {
scalar UrCoNum = max scalar UrCoNum = 0.5*gMax
( (
mesh.surfaceInterpolation::deltaCoeffs()*mag(phia - phib) fvc::surfaceSum(mag(phia - phib))().internalField()/mesh.V().field()
/mesh.magSf() )*runTime.deltaTValue();
).value()*runTime.deltaT().value();
Info<< "Max Ur Courant Number = " << UrCoNum << endl; Info<< "Max Ur Courant Number = " << UrCoNum << endl;

View File

@ -569,21 +569,31 @@ int main(int argc, char *argv[])
<< "as type patch. Please reset after mesh conversion as necessary." << "as type patch. Please reset after mesh conversion as necessary."
<< endl; << endl;
wordList patchTypes(patchFaces.size(), polyPatch::typeName); PtrList<dictionary> patchDicts;
wordList patchPhysicalTypes(patchFaces.size());
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", polyPatch::typeName, false);
}
polyMesh pShapeMesh polyMesh pShapeMesh
( (
IOobject IOobject
@ -596,10 +606,9 @@ int main(int argc, char *argv[])
cellShapes, cellShapes,
patchFaces, patchFaces,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );

View File

@ -578,7 +578,6 @@ int main(int argc, char *argv[])
wordList patchTypes(npatch); wordList patchTypes(npatch);
word defaultFacesName = "defaultFaces"; word defaultFacesName = "defaultFaces";
word defaultFacesType = wallPolyPatch::typeName; word defaultFacesType = wallPolyPatch::typeName;
wordList patchPhysicalTypes(npatch);
label nCreatedPatches = 0; label nCreatedPatches = 0;
@ -707,18 +706,30 @@ int main(int argc, char *argv[])
patchTypes.setSize(nCreatedPatches); patchTypes.setSize(nCreatedPatches);
patchNames.setSize(nCreatedPatches); patchNames.setSize(nCreatedPatches);
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", patchTypes[patchI], false);
}
polyMesh pShapeMesh polyMesh pShapeMesh
( (
IOobject IOobject
@ -731,10 +742,9 @@ int main(int argc, char *argv[])
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10

View File

@ -45,7 +45,6 @@ Description
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "cellShape.H" #include "cellShape.H"
#include "faceSet.H" #include "faceSet.H"
#include "cellSet.H" #include "cellSet.H"
@ -1542,17 +1541,6 @@ int main(int argc, char *argv[])
} }
repatcher.repatch(); repatcher.repatch();
preservePatchTypes
(
runTime,
runTime.constant(),
polyMesh::defaultRegion,
patchNames,
patchTypes,
defaultFacesName,
defaultFacesType,
patchPhysicalTypes
);
// Set the precision of the points data to 10 // Set the precision of the points data to 10
IOstream::defaultPrecision(10); IOstream::defaultPrecision(10);

View File

@ -818,24 +818,32 @@ int main(int argc, char *argv[])
// Scale points // Scale points
points *= scaleFactor; points *= scaleFactor;
wordList patchTypes(boundary.size(), polyPatch::typeName); PtrList<dictionary> patchDicts(boundary.size());
word defaultFacesName = "defaultFaces"; word defaultFacesName = "defaultFaces";
word defaultFacesType = emptyPolyPatch::typeName; word defaultFacesType = emptyPolyPatch::typeName;
wordList patchPhysicalTypes(boundary.size());
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Mesh will auto-write on construction // Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", polyPatch::typeName, false);
}
polyMesh pShapeMesh polyMesh pShapeMesh
( (
IOobject IOobject
@ -848,10 +856,9 @@ int main(int argc, char *argv[])
cells, cells,
boundary, boundary,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Set the precision of the points data to 10 // Set the precision of the points data to 10

View File

@ -459,7 +459,6 @@ wordList patchNames(nPatches);
wordList patchTypes(nPatches); wordList patchTypes(nPatches);
word defaultFacesName = "defaultFaces"; word defaultFacesName = "defaultFaces";
word defaultFacesType = emptyPolyPatch::typeName; word defaultFacesType = emptyPolyPatch::typeName;
wordList patchPhysicalTypes(nPatches);
label nAddedPatches = 0; label nAddedPatches = 0;
@ -535,17 +534,27 @@ forAll(boundary, patchi)
} }
} }
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
// Add information to dictionary
forAll(patchNames, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
// Add but not overwrite
patchDicts[patchI].add("type", patchTypes[patchI], false);
}
// Build the mesh and write it out // Build the mesh and write it out
polyMesh pShapeMesh polyMesh pShapeMesh
@ -560,10 +569,9 @@ polyMesh pShapeMesh
cellShapes, cellShapes,
boundary, boundary,
patchNames, patchNames,
patchTypes, patchDicts,
defaultFacesName, defaultFacesName,
defaultFacesType, defaultFacesType
patchPhysicalTypes
); );
Info << "Writing polyMesh" << endl; Info << "Writing polyMesh" << endl;

View File

@ -43,7 +43,6 @@ Description
#include "polyMesh.H" #include "polyMesh.H"
#include "wallPolyPatch.H" #include "wallPolyPatch.H"
#include "symmetryPolyPatch.H" #include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "cellShape.H" #include "cellShape.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "mergePoints.H" #include "mergePoints.H"

View File

@ -230,17 +230,28 @@ void sammMesh::readBoundary()
patchPhysicalTypes_.setSize(patchTypes_.size()); patchPhysicalTypes_.setSize(patchTypes_.size());
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime_, runTime_,
runTime_.constant(), runTime_.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames_, patchNames_,
patchTypes_, patchDicts,
defaultFacesName_, defaultFacesName_,
defaultFacesType_, defaultFacesType_
patchPhysicalTypes_
); );
forAll(patchDicts, patchI)
{
if (patchDicts.set(patchI))
{
const dictionary& dict = patchDicts[patchI];
dict.readIfPresent("type", patchTypes_[patchI]);
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchI]);
}
}
} }

View File

@ -228,17 +228,28 @@ void starMesh::readBoundary()
patchPhysicalTypes_.setSize(patchTypes_.size()); patchPhysicalTypes_.setSize(patchTypes_.size());
PtrList<dictionary> patchDicts;
preservePatchTypes preservePatchTypes
( (
runTime_, runTime_,
runTime_.constant(), runTime_.constant(),
polyMesh::defaultRegion, polyMesh::meshSubDir,
patchNames_, patchNames_,
patchTypes_, patchDicts,
defaultFacesName_, defaultFacesName_,
defaultFacesType_, defaultFacesType_
patchPhysicalTypes_
); );
forAll(patchDicts, patchI)
{
if (patchDicts.set(patchI))
{
const dictionary& dict = patchDicts[patchI];
dict.readIfPresent("type", patchTypes_[patchI]);
dict.readIfPresent("physicalType", patchPhysicalTypes_[patchI]);
}
}
} }

View File

@ -52,7 +52,6 @@ Usage
#include "blockMesh.H" #include "blockMesh.H"
#include "attachPolyTopoChanger.H" #include "attachPolyTopoChanger.H"
#include "preservePatchTypes.H"
#include "emptyPolyPatch.H" #include "emptyPolyPatch.H"
#include "cellSet.H" #include "cellSet.H"
@ -219,6 +218,7 @@ int main(int argc, char *argv[])
xferCopy(blocks.points()), // could we re-use space? xferCopy(blocks.points()), // could we re-use space?
blocks.cells(), blocks.cells(),
blocks.patches(), blocks.patches(),
blocks.patchNames(),
blocks.patchDicts(), blocks.patchDicts(),
defaultFacesName, defaultFacesName,
defaultFacesType defaultFacesType

View File

@ -11,7 +11,7 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-ldecompositionMethods \ -ldecompositionMethods \
-L$(FOAM_MPI_LIBBIN) -lptscotchDecomp \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-lmeshTools \ -lmeshTools \
-ldynamicMesh \ -ldynamicMesh \
-lautoMesh -lautoMesh

View File

@ -0,0 +1,47 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 3 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, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "SetPatchFields.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template<class GeoField>
void Foam::SetPatchFields
(
PtrList<GeoField>& fields,
const label patchI,
const typename GeoField::value_type& initVal
)
{
forAll(fields, i)
{
typename GeoField::PatchFieldType& pfld =
fields[i].boundaryField()[patchI];
pfld == initVal;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 3 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, see <http://www.gnu.org/licenses/>.
Global
Foam::SetPatchFields
Description
Helper routine to initialise a patch field to a constant value
SourceFiles
SetPatchFields.C
\*---------------------------------------------------------------------------*/
#ifndef SetPatchFields_H
#define SetPatchFields_H
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//- Helper routine to read fields
template<class GeoField>
void SetPatchFields
(
PtrList<GeoField>& fields,
const label patchI,
const typename GeoField::value_type& initVal
);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "SetPatchFields.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -43,6 +43,8 @@ Description
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "ZoneIDs.H" #include "ZoneIDs.H"
#include "fvMeshMapper.H"
#include "SetPatchFields.H"
using namespace Foam; using namespace Foam;
@ -241,45 +243,39 @@ int main(int argc, char *argv[])
IOobjectList objects(mesh, runTime.timeName()); IOobjectList objects(mesh, runTime.timeName());
// Read vol fields. // Read vol fields.
if (args.optionFound("updateFields")) Info<< "Reading geometric fields" << nl << endl;
{ PtrList<volScalarField> vsFlds;
Info<< "Reading geometric fields" << nl << endl; ReadFields(mesh, objects, vsFlds);
PtrList<volScalarField> vsFlds;
ReadFields(mesh, objects, vsFlds);
PtrList<volVectorField> vvFlds; PtrList<volVectorField> vvFlds;
ReadFields(mesh, objects, vvFlds); ReadFields(mesh, objects, vvFlds);
PtrList<volSphericalTensorField> vstFlds; PtrList<volSphericalTensorField> vstFlds;
ReadFields(mesh, objects, vstFlds); ReadFields(mesh, objects, vstFlds);
PtrList<volSymmTensorField> vsymtFlds; PtrList<volSymmTensorField> vsymtFlds;
ReadFields(mesh, objects, vsymtFlds); ReadFields(mesh, objects, vsymtFlds);
PtrList<volTensorField> vtFlds; PtrList<volTensorField> vtFlds;
ReadFields(mesh, objects, vtFlds); ReadFields(mesh, objects, vtFlds);
// Read surface fields. // Read surface fields.
PtrList<surfaceScalarField> ssFlds; PtrList<surfaceScalarField> ssFlds;
ReadFields(mesh, objects, ssFlds); ReadFields(mesh, objects, ssFlds);
PtrList<surfaceVectorField> svFlds; PtrList<surfaceVectorField> svFlds;
ReadFields(mesh, objects, svFlds); ReadFields(mesh, objects, svFlds);
PtrList<surfaceSphericalTensorField> sstFlds; PtrList<surfaceSphericalTensorField> sstFlds;
ReadFields(mesh, objects, sstFlds); ReadFields(mesh, objects, sstFlds);
PtrList<surfaceSymmTensorField> ssymtFlds; PtrList<surfaceSymmTensorField> ssymtFlds;
ReadFields(mesh, objects, ssymtFlds); ReadFields(mesh, objects, ssymtFlds);
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
}
else
{
Info<< "Not updating geometric fields" << nl << endl;
}
// Mesh change container // Mesh change container
polyTopoChange meshMod(mesh); polyTopoChange meshMod(mesh);
@ -484,6 +480,58 @@ int main(int argc, char *argv[])
// Update fields // Update fields
mesh.updateMesh(map); mesh.updateMesh(map);
// Correct boundary faces mapped-out-of-nothing.
{
fvMeshMapper mapper(mesh, map);
bool hasWarned = false;
forAll(newMasterPatches, i)
{
label patchI = newMasterPatches[i];
const fvPatchMapper& pm = mapper.boundaryMap()[patchI];
if (pm.sizeBeforeMapping() == 0)
{
if (!hasWarned)
{
hasWarned = true;
WarningIn(args.executable())
<< "Setting field on boundary faces to zero." << endl
<< "You might have to edit these fields." << endl;
}
SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(vvFlds, patchI, pTraits<vector>::zero);
SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero);
SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(svFlds, patchI, pTraits<vector>::zero);
SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(stFlds, patchI, pTraits<tensor>::zero);
}
}
forAll(newSlavePatches, i)
{
label patchI = newSlavePatches[i];
const fvPatchMapper& pm = mapper.boundaryMap()[patchI];
if (pm.sizeBeforeMapping() == 0)
{
SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(vvFlds, patchI, pTraits<vector>::zero);
SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero);
SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero);
SetPatchFields(svFlds, patchI, pTraits<vector>::zero);
SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero);
SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero);
SetPatchFields(stFlds, patchI, pTraits<tensor>::zero);
}
}
}
// Move mesh (since morphing might not do this) // Move mesh (since morphing might not do this)
if (map().hasMotionPoints()) if (map().hasMotionPoints())
{ {

View File

@ -7,6 +7,6 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lgenericPatchFields \ -lgenericPatchFields \
-ldecompositionMethods -lmetisDecomp -lscotchDecomp \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
-llagrangian \ -llagrangian \
-lmeshTools -lmeshTools

View File

@ -7,6 +7,6 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-ldecompositionMethods \ -ldecompositionMethods \
-L$(FOAM_MPI_LIBBIN) -lptscotchDecomp \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-lmeshTools \ -lmeshTools \
-ldynamicMesh -ldynamicMesh

View File

@ -163,6 +163,7 @@ void Foam::ensightMesh::correct()
prisms.setSize(nPrisms); prisms.setSize(nPrisms);
wedges.setSize(nWedges); wedges.setSize(nWedges);
hexes.setSize(nHexes); hexes.setSize(nHexes);
hexesWedges.setSize(nHexesWedges);
polys.setSize(nPolys); polys.setSize(nPolys);
meshCellSets_.nTets = nTets; meshCellSets_.nTets = nTets;

View File

@ -280,6 +280,7 @@ public:
const Xfer<pointField>& points, const Xfer<pointField>& points,
const cellShapeList& shapes, const cellShapeList& shapes,
const faceListList& boundaryFaces, const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
const PtrList<dictionary>& boundaryDicts, const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName, const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType, const word& defaultBoundaryPatchType,

View File

@ -698,6 +698,7 @@ Foam::polyMesh::polyMesh
const Xfer<pointField>& points, const Xfer<pointField>& points,
const cellShapeList& cellsAsShapes, const cellShapeList& cellsAsShapes,
const faceListList& boundaryFaces, const faceListList& boundaryFaces,
const wordList& boundaryPatchNames,
const PtrList<dictionary>& boundaryDicts, const PtrList<dictionary>& boundaryDicts,
const word& defaultBoundaryPatchName, const word& defaultBoundaryPatchName,
const word& defaultBoundaryPatchType, const word& defaultBoundaryPatchType,
@ -832,12 +833,6 @@ Foam::polyMesh::polyMesh
// Remove all of the old mesh files if they exist // Remove all of the old mesh files if they exist
removeFiles(instance()); removeFiles(instance());
wordList boundaryPatchNames(boundaryDicts.size());
forAll(boundaryDicts, patchI)
{
boundaryDicts[patchI].lookup("name") >> boundaryPatchNames[patchI];
}
// Calculate faces and cells // Calculate faces and cells
labelList patchSizes; labelList patchSizes;
labelList patchStarts; labelList patchStarts;
@ -858,7 +853,7 @@ Foam::polyMesh::polyMesh
// Warning: Patches can only be added once the face list is // Warning: Patches can only be added once the face list is
// completed, as they hold a subList of the face list // completed, as they hold a subList of the face list
forAll(boundaryFaces, patchI) forAll(boundaryDicts, patchI)
{ {
dictionary patchDict(boundaryDicts[patchI]); dictionary patchDict(boundaryDicts[patchI]);

View File

@ -91,44 +91,58 @@ void Foam::cyclicPolyPatch::calcTransforms()
// Half0 // Half0
const cyclicPolyPatch& half0 = *this; const cyclicPolyPatch& half0 = *this;
const pointField& half0Ctrs = half0.faceCentres();
if (debug)
{
fileName casePath(boundaryMesh().mesh().time().path());
fileName nm0(casePath/name()+"_faces.obj");
Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name()
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0, half0.points());
}
vectorField half0Areas(half0.size()); vectorField half0Areas(half0.size());
forAll(half0, facei) forAll(half0, facei)
{ {
half0Areas[facei] = half0[facei].normal(half0.points()); half0Areas[facei] = half0[facei].normal(half0.points());
} }
// Half1 // Half1
const cyclicPolyPatch& half1 = neighbPatch(); const cyclicPolyPatch& half1 = neighbPatch();
vectorField half1Areas(half1.size());
const pointField& half1Ctrs = half1.faceCentres(); forAll(half1, facei)
// Dump halves
if (debug)
{ {
fileName casePath(boundaryMesh().mesh().time().path()); half1Areas[facei] = half1[facei].normal(half1.points());
}
calcTransforms
(
half0,
half0.faceCentres(),
half0Areas,
half1.faceCentres(),
half1Areas
);
}
}
void Foam::cyclicPolyPatch::calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
)
{
if (debug && owner())
{
fileName casePath(boundaryMesh().mesh().time().path());
{
fileName nm0(casePath/name()+"_faces.obj");
Pout<< "cyclicPolyPatch::calcTransforms : Writing " << name()
<< " faces to OBJ file " << nm0 << endl;
writeOBJ(nm0, half0, half0.points());
}
const cyclicPolyPatch& half1 = neighbPatch();
{
fileName nm1(casePath/half1.name()+"_faces.obj"); fileName nm1(casePath/half1.name()+"_faces.obj");
Pout<< "cyclicPolyPatch::calcTransforms : Writing " << half1.name() Pout<< "cyclicPolyPatch::calcTransforms : Writing " << half1.name()
<< " faces to OBJ file " << nm1 << endl; << " faces to OBJ file " << nm1 << endl;
writeOBJ(nm1, half1, half1.points()); writeOBJ(nm1, half1, half1.points());
}
{
OFstream str(casePath/name()+"_to_" + half1.name() + ".obj"); OFstream str(casePath/name()+"_to_" + half1.name() + ".obj");
label vertI = 0; label vertI = 0;
Pout<< "cyclicPolyPatch::calcTransforms :" Pout<< "cyclicPolyPatch::calcTransforms :"
@ -145,35 +159,10 @@ void Foam::cyclicPolyPatch::calcTransforms()
str << "l " << vertI-1 << ' ' << vertI << nl; str << "l " << vertI-1 << ' ' << vertI << nl;
} }
} }
vectorField half1Areas(half1.size());
forAll(half1, facei)
{
half1Areas[facei] = half1[facei].normal(half1.points());
}
calcTransforms
(
half0,
half0Ctrs,
half0Areas,
half1Ctrs,
half1Areas
);
} }
}
void Foam::cyclicPolyPatch::calcTransforms
(
const primitivePatch& half0,
const UList<point>& half0Ctrs,
const UList<point>& half0Areas,
const UList<point>& half1Ctrs,
const UList<point>& half1Areas
)
{
if (half0Ctrs.size() != half1Ctrs.size()) if (half0Ctrs.size() != half1Ctrs.size())
{ {
FatalErrorIn FatalErrorIn

View File

@ -25,7 +25,6 @@ License
#include "preservePatchTypes.H" #include "preservePatchTypes.H"
#include "polyBoundaryMeshEntries.H" #include "polyBoundaryMeshEntries.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
@ -35,14 +34,16 @@ void Foam::preservePatchTypes
const word& meshInstance, const word& meshInstance,
const fileName& meshDir, const fileName& meshDir,
const wordList& patchNames, const wordList& patchNames,
wordList& patchTypes, PtrList<dictionary>& patchDicts,
const word& defaultFacesName, const word& defaultFacesName,
word& defaultFacesType, word& defaultFacesType
wordList& patchPhysicalTypes
) )
{ {
patchDicts.setSize(patchNames.size());
dictionary patchDictionary; dictionary patchDictionary;
// Read boundary file as single dictionary
{ {
IOobject patchEntriesHeader IOobject patchEntriesHeader
( (
@ -67,35 +68,27 @@ void Foam::preservePatchTypes
} }
} }
if (patchDictionary.size()) forAll(patchNames, patchi)
{ {
forAll(patchNames, patchi) if (patchDictionary.found(patchNames[patchi]))
{
if (patchDictionary.found(patchNames[patchi]))
{
const dictionary& patchDict =
patchDictionary.subDict(patchNames[patchi]);
patchDict.lookup("type") >> patchTypes[patchi];
patchDict.readIfPresent("geometricType", patchTypes[patchi]);
patchDict.readIfPresent
(
"physicalType",
patchPhysicalTypes[patchi]
);
}
}
if (patchDictionary.found(defaultFacesName))
{ {
const dictionary& patchDict = const dictionary& patchDict =
patchDictionary.subDict(defaultFacesName); patchDictionary.subDict(patchNames[patchi]);
patchDict.readIfPresent("geometricType", defaultFacesType); patchDicts.set(patchi, patchDict.clone());
patchDicts[patchi].remove("nFaces");
patchDicts[patchi].remove("startFace");
} }
} }
if (patchDictionary.found(defaultFacesName))
{
const dictionary& patchDict =
patchDictionary.subDict(defaultFacesName);
patchDict.readIfPresent("geometricType", defaultFacesType);
}
Info<< nl << "Default patch type set to " << defaultFacesType << endl; Info<< nl << "Default patch type set to " << defaultFacesType << endl;
} }

View File

@ -37,6 +37,7 @@ SourceFiles
#include "fileName.H" #include "fileName.H"
#include "wordList.H" #include "wordList.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,10 +53,9 @@ void preservePatchTypes
const word& meshInstance, const word& meshInstance,
const fileName& meshDir, const fileName& meshDir,
const wordList& patchNames, const wordList& patchNames,
wordList& patchTypes, PtrList<dictionary>& patchDicts,
const word& defaultFacesName, const word& defaultFacesName,
word& defaultFacesType, word& defaultFacesType
wordList& patchPhysicalTypes
); );
} // End namespace Foam } // End namespace Foam

View File

@ -272,10 +272,10 @@ const Foam::point& Foam::plane::refPoint() const
} }
// Return coefficcients for plane equation: ax + by + cz + d = 0 // Return coefficients for plane equation: ax + by + cz + d = 0
Foam::scalarList Foam::plane::planeCoeffs() const Foam::FixedList<Foam::scalar, 4> Foam::plane::planeCoeffs() const
{ {
scalarList C(4); FixedList<scalar, 4> C(4);
scalar magX = mag(unitVector_.x()); scalar magX = mag(unitVector_.x());
scalar magY = mag(unitVector_.y()); scalar magY = mag(unitVector_.y());
@ -291,8 +291,8 @@ Foam::scalarList Foam::plane::planeCoeffs() const
} }
else else
{ {
C[0] = 0; C[0] = unitVector_.x()/unitVector_.z();
C[1] = 0; C[1] = unitVector_.y()/unitVector_.z();
C[2] = 1; C[2] = 1;
} }
} }
@ -300,14 +300,14 @@ Foam::scalarList Foam::plane::planeCoeffs() const
{ {
if (magY > magZ) if (magY > magZ)
{ {
C[0] = 0; C[0] = unitVector_.x()/unitVector_.y();
C[1] = 1; C[1] = 1;
C[2] = unitVector_.z()/unitVector_.y(); C[2] = unitVector_.z()/unitVector_.y();
} }
else else
{ {
C[0] = 0; C[0] = unitVector_.x()/unitVector_.z();
C[1] = 0; C[1] = unitVector_.y()/unitVector_.z();
C[2] = 1; C[2] = 1;
} }
} }
@ -422,19 +422,18 @@ Foam::point Foam::plane::planePlaneIntersect
const plane& plane3 const plane& plane3
) const ) const
{ {
List<scalarList> pcs(3); FixedList<scalar, 4> coeffs1(planeCoeffs());
pcs[0]= planeCoeffs(); FixedList<scalar, 4> coeffs2(plane2.planeCoeffs());
pcs[1]= plane2.planeCoeffs(); FixedList<scalar, 4> coeffs3(plane3.planeCoeffs());
pcs[2]= plane3.planeCoeffs();
tensor a tensor a
( (
pcs[0][0],pcs[0][1],pcs[0][2], coeffs1[0],coeffs1[1],coeffs1[2],
pcs[1][0],pcs[1][1],pcs[1][2], coeffs2[0],coeffs2[1],coeffs2[2],
pcs[2][0],pcs[2][1],pcs[2][2] coeffs3[0],coeffs3[1],coeffs3[2]
); );
vector b(pcs[0][3],pcs[1][3],pcs[2][3]); vector b(coeffs1[3],coeffs2[3],coeffs3[3]);
return (inv(a) & (-b)); return (inv(a) & (-b));
} }

View File

@ -149,7 +149,7 @@ public:
//- Return coefficients for the //- Return coefficients for the
// plane equation: ax + by + cz + d = 0 // plane equation: ax + by + cz + d = 0
scalarList planeCoeffs() const; FixedList<scalar, 4> planeCoeffs() const;
//- Return nearest point in the plane for the given point //- Return nearest point in the plane for the given point
point nearestPoint(const point& p) const; point nearestPoint(const point& p) const;

View File

@ -412,6 +412,8 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
List<polyPatch*> p(nPatches); List<polyPatch*> p(nPatches);
// All patch dictionaries
PtrList<dictionary> patchDicts(patchNames_.size());
// Default boundary patch types // Default boundary patch types
word defaultFacesType(emptyPolyPatch::typeName); word defaultFacesType(emptyPolyPatch::typeName);
@ -422,20 +424,37 @@ Foam::meshReader::polyBoundaryPatches(const polyMesh& mesh)
mesh.instance(), mesh.instance(),
mesh.meshDir(), mesh.meshDir(),
patchNames_, patchNames_,
patchTypes_, patchDicts,
"defaultFaces", "defaultFaces",
defaultFacesType, defaultFacesType
patchPhysicalTypes_
); );
forAll(patchDicts, patchI)
{
if (!patchDicts.set(patchI))
{
patchDicts.set(patchI, new dictionary());
}
dictionary& patchDict = patchDicts[patchI];
// add but not overwrite type
patchDict.add("type", patchTypes_[patchI], false);
if (patchPhysicalTypes_.size() && patchPhysicalTypes_[patchI].size())
{
patchDict.add("startFace", patchPhysicalTypes_[patchI], false);
}
// overwrite sizes and start
patchDict.add("nFaces", patchSizes_[patchI], true);
patchDict.add("startFace", patchStarts_[patchI], true);
}
forAll(patchStarts_, patchI) forAll(patchStarts_, patchI)
{ {
p[patchI] = polyPatch::New p[patchI] = polyPatch::New
( (
patchTypes_[patchI],
patchNames_[patchI], patchNames_[patchI],
patchSizes_[patchI], patchDicts[patchI],
patchStarts_[patchI],
patchI, patchI,
mesh.boundaryMesh() mesh.boundaryMesh()
).ptr(); ).ptr();

View File

@ -34,14 +34,13 @@ scalar meanMeshCoNum = 0.0;
if (mesh.nInternalFaces()) if (mesh.nInternalFaces())
{ {
surfaceScalarField SfUfbyDelta = scalarField sumPhi =
mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi()); fvc::surfaceSum(mag(mesh.phi()))().internalField();
meshCoNum = max(SfUfbyDelta/mesh.magSf()) meshCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
.value()*runTime.deltaTValue();
meanMeshCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf())) meanMeshCoNum =
.value()*runTime.deltaTValue(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Mesh Courant Number mean: " << meanMeshCoNum Info<< "Mesh Courant Number mean: " << meanMeshCoNum

View File

@ -38,10 +38,10 @@ if (mesh.nInternalFaces())
fvc::surfaceSum(mag(phi))().internalField() fvc::surfaceSum(mag(phi))().internalField()
/rho.internalField(); /rho.internalField();
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaT().value(); CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanCoNum = meanCoNum =
0.5*(gSum(sumPhi)/sum(mesh.V().field()))*runTime.deltaT().value(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Courant Number mean: " << meanCoNum Info<< "Courant Number mean: " << meanCoNum

View File

@ -37,10 +37,10 @@ if (mesh.nInternalFaces())
scalarField sumPhi = scalarField sumPhi =
fvc::surfaceSum(mag(phi))().internalField(); fvc::surfaceSum(mag(phi))().internalField();
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaT().value(); CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanCoNum = meanCoNum =
0.5*(gSum(sumPhi)/sum(mesh.V().field()))*runTime.deltaT().value(); 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Courant Number mean: " << meanCoNum Info<< "Courant Number mean: " << meanCoNum

View File

@ -260,7 +260,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
allValues allValues
); );
newValues = this->patch().patchSlice(allValues); newValues.transfer(allValues);
break; break;
} }

View File

@ -198,7 +198,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
distMap.constructMap(), distMap.constructMap(),
allUValues allUValues
); );
newUValues = patch().patchSlice(allUValues); newUValues.transfer(allUValues);
mapDistribute::distribute mapDistribute::distribute
( (
@ -209,7 +209,7 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
distMap.constructMap(), distMap.constructMap(),
allPhiValues allPhiValues
); );
newPhiValues = patch().patchSlice(allPhiValues); newPhiValues.transfer(allPhiValues);
break; break;
} }

View File

@ -89,7 +89,6 @@ Foam::PtrList<Foam::dictionary> Foam::blockMesh::patchDicts() const
patchTopologies[patchI].write(os); patchTopologies[patchI].write(os);
IStringStream is(os.str()); IStringStream is(os.str());
patchDicts.set(patchI, new dictionary(is)); patchDicts.set(patchI, new dictionary(is));
patchDicts[patchI].set("name", patchTopologies[patchI].name());
} }
return patchDicts; return patchDicts;
} }
@ -134,12 +133,12 @@ const Foam::faceListList& Foam::blockMesh::patches() const
} }
//Foam::wordList Foam::blockMesh::patchNames() const Foam::wordList Foam::blockMesh::patchNames() const
//{ {
// return topology().boundaryMesh().names(); return topology().boundaryMesh().names();
//} }
//
//
//Foam::wordList Foam::blockMesh::patchTypes() const //Foam::wordList Foam::blockMesh::patchTypes() const
//{ //{
// return topology().boundaryMesh().types(); // return topology().boundaryMesh().types();

View File

@ -121,6 +121,7 @@ class blockMesh
bool readBoundary bool readBoundary
( (
const dictionary& meshDescription, const dictionary& meshDescription,
wordList& patchNames,
faceListList& tmpBlocksPatches, faceListList& tmpBlocksPatches,
PtrList<dictionary>& patchDicts PtrList<dictionary>& patchDicts
); );
@ -185,8 +186,8 @@ public:
//- Get patch information from the topology mesh //- Get patch information from the topology mesh
PtrList<dictionary> patchDicts() const; PtrList<dictionary> patchDicts() const;
// wordList patchNames() const; wordList patchNames() const;
//
// wordList patchTypes() const; // wordList patchTypes() const;
// //
// wordList patchPhysicalTypes() const; // wordList patchPhysicalTypes() const;

View File

@ -189,6 +189,7 @@ bool Foam::blockMesh::readPatches
bool Foam::blockMesh::readBoundary bool Foam::blockMesh::readBoundary
( (
const dictionary& meshDescription, const dictionary& meshDescription,
wordList& patchNames,
faceListList& tmpBlocksPatches, faceListList& tmpBlocksPatches,
PtrList<dictionary>& patchDicts PtrList<dictionary>& patchDicts
) )
@ -201,6 +202,7 @@ bool Foam::blockMesh::readBoundary
meshDescription.lookup("boundary") meshDescription.lookup("boundary")
); );
patchNames.setSize(patchesInfo.size());
tmpBlocksPatches.setSize(patchesInfo.size()); tmpBlocksPatches.setSize(patchesInfo.size());
patchDicts.setSize(patchesInfo.size()); patchDicts.setSize(patchesInfo.size());
@ -215,9 +217,9 @@ bool Foam::blockMesh::readBoundary
<< " valid dictionary." << exit(FatalIOError); << " valid dictionary." << exit(FatalIOError);
} }
// Construct dictionary and add name patchNames[patchI] = patchInfo.keyword();
// Construct dictionary
patchDicts.set(patchI, new dictionary(patchInfo.dict())); patchDicts.set(patchI, new dictionary(patchInfo.dict()));
patchDicts[patchI].set("name", patchInfo.keyword());
// Read block faces // Read block faces
patchDicts[patchI].lookup("faces") >> tmpBlocksPatches[patchI]; patchDicts[patchI].lookup("faces") >> tmpBlocksPatches[patchI];
@ -472,7 +474,8 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
Info<< nl << "Reading physicalType from existing boundary file" << endl; Info<< nl << "Reading physicalType from existing boundary file" << endl;
wordList patchPhysicalTypes(tmpBlocksPatches.size()); PtrList<dictionary> patchDicts(patchNames.size());
word defaultFacesType;
preservePatchTypes preservePatchTypes
( (
@ -480,31 +483,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
meshDescription.time().constant(), meshDescription.time().constant(),
polyMesh::meshSubDir, polyMesh::meshSubDir,
patchNames, patchNames,
patchTypes, patchDicts,
defaultPatchName, defaultPatchName,
defaultPatchType, defaultPatchType
patchPhysicalTypes
); );
// Convert into dictionary // Add cyclic info (might not be present from older file)
PtrList<dictionary> patchDicts(patchNames.size());
forAll(patchDicts, patchI) forAll(patchDicts, patchI)
{ {
patchDicts.set(patchI, new dictionary()); if (!patchDicts.set(patchI))
patchDicts[patchI].set("name", patchNames[patchI]); {
patchDicts[patchI].set("type", patchTypes[patchI]); patchDicts.set(patchI, new dictionary());
}
dictionary& dict = patchDicts[patchI];
// Add but not override type
dict.add("type", patchTypes[patchI], false);
// Override neighbourpatch name
if (nbrPatchNames[patchI] != word::null) if (nbrPatchNames[patchI] != word::null)
{ {
patchDicts[patchI].set("neighbourPatch", nbrPatchNames[patchI]); dict.set("neighbourPatch", nbrPatchNames[patchI]);
}
if (patchPhysicalTypes[patchI] != word::null)
{
patchDicts[patchI].set
(
"physicalType",
patchPhysicalTypes[patchI]
);
} }
} }
@ -523,6 +524,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
xferCopy(blockPointField_), // copy these points, do NOT move xferCopy(blockPointField_), // copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames,
patchDicts, patchDicts,
defaultPatchName, defaultPatchName,
defaultPatchType defaultPatchType
@ -530,12 +532,14 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
} }
else if (meshDescription.found("boundary")) else if (meshDescription.found("boundary"))
{ {
wordList patchNames;
faceListList tmpBlocksPatches; faceListList tmpBlocksPatches;
PtrList<dictionary> patchDicts; PtrList<dictionary> patchDicts;
topologyOK = topologyOK && readBoundary topologyOK = topologyOK && readBoundary
( (
meshDescription, meshDescription,
patchNames,
tmpBlocksPatches, tmpBlocksPatches,
patchDicts patchDicts
); );
@ -553,6 +557,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
cellShapeList tmpBlockCells(blocks.size()); cellShapeList tmpBlockCells(blocks.size());
createCellShapes(tmpBlockCells); createCellShapes(tmpBlockCells);
// Extract
blockMeshPtr = new polyMesh blockMeshPtr = new polyMesh
( (
@ -568,6 +573,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
xferCopy(blockPointField_), // copy these points, do NOT move xferCopy(blockPointField_), // copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames,
patchDicts, patchDicts,
defaultPatchName, defaultPatchName,
defaultPatchType defaultPatchType

View File

@ -163,7 +163,7 @@ Foam::label Foam::probes::prepare()
if (debug) if (debug)
{ {
Info<< "open probe stream: " << sPtr->name() << endl; Info<< "open probe stream: " << sPtr->name() << endl;
} }
probeFilePtrs_.insert(fieldName, sPtr); probeFilePtrs_.insert(fieldName, sPtr);

View File

@ -34,14 +34,7 @@ Description
#include "Time.H" #include "Time.H"
#include "IFstream.H" #include "IFstream.H"
#include "OFstream.H" #include "OFstream.H"
#include "meshTools.H" #include "pointField.H"
#include "polyMesh.H"
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "preservePatchTypes.H"
#include "cellShape.H"
#include "cellModeller.H"
#include "mergePoints.H"
#include "unitConversion.H" #include "unitConversion.H"
using namespace Foam; using namespace Foam;

View File

@ -1,24 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "0/uniform/lagrangian/dsmc";
object particleProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
processor0
{
particleCount 63978;
}
// ************************************************************************* //

View File

@ -1,24 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "0/uniform/lagrangian/dsmc";
object particleProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
processor0
{
particleCount 63978;
}
// ************************************************************************* //

View File

@ -1,14 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Get application name
application=`getApplication`
runApplication blockMesh
runApplication changeDictionary
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -85,69 +85,90 @@ edges
( (
); );
patches boundary
( (
patch inlet inlet
( {
(0 22 23 1) type directMappedPatch;
(1 23 24 2) offset ( 0.0495 0 0 );
(2 24 25 3) sampleRegion region0;
) sampleMode nearestCell;
patch outlet samplePatch none;
(
(16 17 39 38)
(17 18 40 39)
(18 19 41 40)
(19 20 42 41)
(20 21 43 42)
)
wall upperWall
(
(3 25 31 9)
(9 31 37 15)
(15 37 43 21)
)
wall lowerWall
(
(0 6 28 22)
(6 5 27 28)
(5 4 26 27)
(4 10 32 26)
(10 16 38 32)
)
empty frontAndBack
(
(22 28 29 23)
(23 29 30 24)
(24 30 31 25)
(26 32 33 27)
(27 33 34 28)
(28 34 35 29)
(29 35 36 30)
(30 36 37 31)
(32 38 39 33)
(33 39 40 34)
(34 40 41 35)
(35 41 42 36)
(36 42 43 37)
(0 1 7 6)
(1 2 8 7)
(2 3 9 8)
(4 5 11 10)
(5 6 12 11)
(6 7 13 12)
(7 8 14 13)
(8 9 15 14)
(10 11 17 16)
(11 12 18 17)
(12 13 19 18)
(13 14 20 19)
(14 15 21 20)
)
);
mergePatchPairs faces
( (
(0 22 23 1)
(1 23 24 2)
(2 24 25 3)
);
}
outlet
{
type patch;
faces
(
(16 17 39 38)
(17 18 40 39)
(18 19 41 40)
(19 20 42 41)
(20 21 43 42)
);
}
upperWall
{
type wall;
faces
(
(3 25 31 9)
(9 31 37 15)
(15 37 43 21)
);
}
lowerWall
{
type wall;
faces
(
(0 6 28 22)
(6 5 27 28)
(5 4 26 27)
(4 10 32 26)
(10 16 38 32)
);
}
frontAndBack
{
type empty;
faces
(
(22 28 29 23)
(23 29 30 24)
(24 30 31 25)
(26 32 33 27)
(27 33 34 28)
(28 34 35 29)
(29 35 36 30)
(30 36 37 31)
(32 38 39 33)
(33 39 40 34)
(34 40 41 35)
(35 41 42 36)
(36 42 43 37)
(0 1 7 6)
(1 2 8 7)
(2 3 9 8)
(4 5 11 10)
(5 6 12 11)
(6 7 13 12)
(7 8 14 13)
(8 9 15 14)
(10 11 17 16)
(11 12 18 17)
(12 13 19 18)
(13 14 20 19)
(14 15 21 20)
);
}
); );
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
5
(
inlet
{
type directMappedPatch;
nFaces 30;
startFace 27238;
sampleMode nearestCell;
sampleRegion region0;
samplePatch none;
offset ( 0.0495 0 0 );
}
outlet
{
type patch;
nFaces 57;
startFace 27268;
}
upperWall
{
type wall;
nFaces 275;
startFace 27325;
}
lowerWall
{
type wall;
nFaces 302;
startFace 27600;
}
frontAndBack
{
type empty;
nFaces 27570;
startFace 27902;
}
)
// ************************************************************************* //

View File

@ -1,34 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object changeDictionaryDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
{
boundary
{
inlet
{
type directMappedPatch;
offset ( 0.0495 0 0 );
sampleRegion region0;
sampleMode nearestCell;
samplePatch none;
}
}
}
// ************************************************************************* //

View File

@ -1,30 +0,0 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
(
cd throttle || exit
rm -rf constant/polyMesh/sets > /dev/null 2>&1
rm -rf 0/polyMesh > /dev/null 2>&1
rm system/topoSetDict > /dev/null 2>&1
cleanCase
)
(
cd throttle3D || exit
rm -rf constant/polyMesh/sets > /dev/null 2>&1
rm -rf 0 > /dev/null 2>&1
cp -r 0.org 0
rm system/topoSetDict > /dev/null 2>&1
rm -rf processor[0-9] > /dev/null 2>&1
cleanCase
)
# ----------------------------------------------------------------- end-of-file

View File

@ -1,50 +1,14 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Set application name
application="cavitatingFoam"
refineMeshByCellSet()
{
while [ $# -ge 1 ]
do
echo "creating cell set for primary zone - $1"
cp system/topoSetDict.$1 system/topoSetDict
topoSet > log.topoSet.$1 2>&1
echo "refining primary zone - $1"
refineMesh -dict -overwrite > log.refineMesh.$1 2>&1
shift
done
}
( (
cd throttle || exit cd throttle || exit
./Allrun
runApplication blockMesh
refineMeshByCellSet 1 2 3
runApplication $application
) )
( (
cd throttle3D || exit cd throttle3D || exit
./Allrun
cp -r 0.org 0
runApplication blockMesh
refineMeshByCellSet 1 2 3
echo "mapping fields from 2D throttle case"
mapFields ../throttle -sourceTime latestTime > log.mapFields 2>&1
runApplication decomposePar
runParallel $application 4
runApplication reconstructPar
) )
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf constant/polyMesh/sets > /dev/null 2>&1
rm -rf 0/polyMesh > /dev/null 2>&1
rm system/topoSetDict > /dev/null 2>&1
cleanCase
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,28 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Set application name
application="cavitatingFoam"
refineMeshByCellSet()
{
while [ $# -ge 1 ]
do
echo "creating cell set for primary zone - $1"
cp system/topoSetDict.$1 system/topoSetDict
topoSet > log.topoSet.$1 2>&1
echo "refining primary zone - $1"
refineMesh -dict -overwrite > log.refineMesh.$1 2>&1
shift
done
}
runApplication blockMesh
refineMeshByCellSet 1 2 3
runApplication $application
# ----------------------------------------------------------------- end-of-file

View File

@ -21,25 +21,25 @@ FoamFile
{ {
type patch; type patch;
nFaces 51; nFaces 51;
startFace 15151; startFace 35380;
} }
outlet outlet
{ {
type patch; type patch;
nFaces 51; nFaces 51;
startFace 15202; startFace 35431;
} }
walls walls
{ {
type wall; type wall;
nFaces 436; nFaces 640;
startFace 15253; startFace 35482;
} }
frontBack frontBack
{ {
type empty; type empty;
nFaces 15420; nFaces 35580;
startFace 15689; startFace 36122;
} }
) )

View File

@ -0,0 +1,14 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf constant/polyMesh/sets > /dev/null 2>&1
rm -rf 0 > /dev/null 2>&1
cp -r 0.org 0
rm system/topoSetDict > /dev/null 2>&1
rm -rf processor[0-9] > /dev/null 2>&1
cleanCase
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,36 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Set application name
application="cavitatingFoam"
refineMeshByCellSet()
{
while [ $# -ge 1 ]
do
echo "creating cell set for primary zone - $1"
cp system/topoSetDict.$1 system/topoSetDict
topoSet > log.topoSet.$1 2>&1
echo "refining primary zone - $1"
refineMesh -dict -overwrite > log.refineMesh.$1 2>&1
shift
done
}
cp -r 0.org 0
runApplication blockMesh
refineMeshByCellSet 1 2 3
echo "mapping fields from 2D throttle case"
mapFields ../throttle -sourceTime latestTime > log.mapFields 2>&1
runApplication decomposePar
runParallel $application 4
runApplication reconstructPar
# ----------------------------------------------------------------- end-of-file

View File

@ -184,14 +184,14 @@ do
# Set colour # Set colour
colour="${colourList[$colourIndex]}" colour="${colourList[$colourIndex]}"
if [ "$host" = "$HOST" ]; then if [ "$host" = "$HOSTNAME" ]; then
eval $* 2>&1 | colourPipe "$colour" eval $* 2>&1 | colourPipe "$colour"
else else
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe "$colour" ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe "$colour"
fi fi
retval=$? retval=$?
else else
if [ "$host" = "$HOST" ]; then if [ "$host" = "$HOSTNAME" ]; then
eval $* 2>&1 eval $* 2>&1
else else
ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1