Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2012-08-09 17:55:18 +01:00
21 changed files with 611 additions and 610 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -104,7 +104,7 @@ class codedFixedValueFvPatchField
// Private data
//- Dictionary contents for the boundary condition
mutable dictionary dict_;
const dictionary dict_;
const word redirectType_;

View File

@ -110,6 +110,7 @@ void reactingOneDim::updateQr()
const volScalarField kappaRad_(kappaRad());
// Propagate Qr through 1-D regions
label totalFaceId = 0;
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
@ -121,7 +122,7 @@ void reactingOneDim::updateQr()
{
const scalar Qr0 = Qrp[faceI];
point Cf0 = Cf[faceI];
const labelList& cells = boundaryFaceCells_[faceI];
const labelList& cells = boundaryFaceCells_[totalFaceId];
scalar kappaInt = 0.0;
forAll(cells, k)
{
@ -132,6 +133,7 @@ void reactingOneDim::updateQr()
Qr_[cellI] = Qr0*exp(-kappaInt);
Cf0 = Cf1;
}
totalFaceId ++;
}
}
@ -156,6 +158,7 @@ void reactingOneDim::updatePhiGas()
const volScalarField& HsiGas = tHsiGas();
const volScalarField& RRiGas = tRRiGas();
label totalFaceId = 0;
forAll(intCoupledPatchIDs_, i)
{
const label patchI = intCoupledPatchIDs_[i];
@ -164,7 +167,7 @@ void reactingOneDim::updatePhiGas()
forAll(phiGasp, faceI)
{
const labelList& cells = boundaryFaceCells_[faceI];
const labelList& cells = boundaryFaceCells_[totalFaceId];
scalar massInt = 0.0;
forAllReverse(cells, k)
{
@ -184,6 +187,7 @@ void reactingOneDim::updatePhiGas()
<< " is : " << massInt
<< " [kg/s] " << endl;
}
totalFaceId ++;
}
}
tHsiGas().clear();
@ -232,12 +236,22 @@ void reactingOneDim::solveContinuity()
Info<< "reactingOneDim::solveContinuity()" << endl;
}
solve
(
fvm::ddt(rho_)
==
- solidChemistry_->RRg()
);
if (moveMesh_)
{
const scalarField mass0 = rho_*regionMesh().V();
fvScalarMatrix rhoEqn
(
fvm::ddt(rho_)
==
- solidChemistry_->RRg()
);
rhoEqn.solve();
updateMesh(mass0);
}
}
@ -261,14 +275,15 @@ void reactingOneDim::solveSpeciesMass()
solidChemistry_->RRs(i)
);
if (moveMesh_)
if (regionMesh().moving())
{
surfaceScalarField phiRhoMesh
surfaceScalarField phiYiRhoMesh
(
fvc::interpolate(Yi*rho_)*regionMesh().phi()
);
YiEqn -= fvc::div(phiRhoMesh);
YiEqn += fvc::div(phiYiRhoMesh);
}
YiEqn.solve(regionMesh().solver("Yi"));
@ -303,14 +318,14 @@ void reactingOneDim::solveEnergy()
+ fvc::div(phiGas)
);
if (moveMesh_)
if (regionMesh().moving())
{
surfaceScalarField phiMesh
surfaceScalarField phihMesh
(
fvc::interpolate(rho_*h_)*regionMesh().phi()
);
hEqn -= fvc::div(phiMesh);
hEqn += fvc::div(phihMesh);
}
hEqn.relax();
@ -349,7 +364,18 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
pyrolysisModel(modelType, mesh),
solidChemistry_(solidChemistryModel::New(regionMesh())),
solidThermo_(solidChemistry_->solid()),
rho_(solidThermo_.rho()),
rho_
(
IOobject
(
"rho",
regionMesh().time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
solidThermo_.rho()
),
Ys_(solidThermo_.composition().Y()),
h_(solidThermo_.he()),
primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")),
@ -449,7 +475,18 @@ reactingOneDim::reactingOneDim
pyrolysisModel(modelType, mesh, dict),
solidChemistry_(solidChemistryModel::New(regionMesh())),
solidThermo_(solidChemistry_->solid()),
rho_(solidThermo_.rho()),
rho_
(
IOobject
(
"rho",
regionMesh().time().timeName(),
regionMesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
solidThermo_.rho()
),
Ys_(solidThermo_.composition().Y()),
h_(solidThermo_.he()),
primaryRadFluxName_(dict.lookupOrDefault<word>("radFluxName", "Qr")),
@ -681,17 +718,15 @@ void reactingOneDim::evolveRegion()
{
Info<< "\nEvolving pyrolysis in region: " << regionMesh().name() << endl;
const scalarField mass0 = rho_*regionMesh().V();
solidChemistry_->solve
(
time().value() - time().deltaTValue(),
time().deltaTValue()
);
solveContinuity();
calculateMassTransfer();
updateMesh(mass0);
solveContinuity();
chemistrySh_ = solidChemistry_->Sh()();
@ -704,9 +739,9 @@ void reactingOneDim::evolveRegion()
solveEnergy();
}
calculateMassTransfer();
solidThermo_.correct();
rho_ = solidThermo_.rho();
}

View File

@ -84,14 +84,8 @@ protected:
// Reference to solid thermo properties
// //- Absorption coefficient [1/m]
// const volScalarField& kappaRad_;
//
// //- Thermal conductivity [W/m/K]
// const volScalarField& kappa_;
//- Density [kg/m3]
volScalarField& rho_;
volScalarField rho_;
//- List of solid components
PtrList<volScalarField>& Ys_;
@ -221,8 +215,8 @@ public:
//- Fields
//- Return density [kg/m3]
virtual const volScalarField& rho() const;
//- Return const density [Kg/m3]
const volScalarField& rho() const;
//- Return const temperature [K]
virtual const volScalarField& T() const;

View File

@ -117,6 +117,8 @@ void Foam::regionModels::regionModel1D::initialise()
}
boundaryFaceOppositeFace_.setSize(localPyrolysisFaceI);
boundaryFaceFaces_.setSize(localPyrolysisFaceI);
boundaryFaceCells_.setSize(localPyrolysisFaceI);
surfaceScalarField& nMagSf = nMagSfPtr_();
@ -192,6 +194,7 @@ Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
const polyBoundaryMesh& bm = regionMesh().boundaryMesh();
label totalFaceId = 0;
forAll(intCoupledPatchIDs_, localPatchI)
{
label patchI = intCoupledPatchIDs_[localPatchI];
@ -200,8 +203,9 @@ Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
forAll(pp, patchFaceI)
{
const labelList& faces = boundaryFaceFaces_[patchFaceI];
const labelList& cells = boundaryFaceCells_[patchFaceI];
const labelList& faces = boundaryFaceFaces_[totalFaceId];
const labelList& cells = boundaryFaceCells_[totalFaceId];
const vector n = pp.faceNormals()[patchFaceI];
const vector sf = pp.faceAreas()[patchFaceI];
@ -231,7 +235,7 @@ Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
if
(
((nbrCf - (oldPoints[pointI] + newDelta)) & n)
mag((nbrCf - (oldPoints[pointI] + newDelta)) & n)
> minDelta
)
{
@ -242,19 +246,17 @@ Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
}
nbrCf = oldCf[i + 1] + localDelta;
}
// Modify boundary
const label bFaceI = boundaryFaceOppositeFace_[patchFaceI];
const label bFaceI = boundaryFaceOppositeFace_[totalFaceId];
const face f = regionMesh().faces()[bFaceI];
const label cellI = cells[cells.size() - 1];
newDelta += (deltaV[cellI]/mag(sf))*n;
forAll(f, pti)
{
const label pointI = f[pti];
if
(
((nbrCf - (oldPoints[pointI] + newDelta)) & n)
mag((nbrCf - (oldPoints[pointI] + newDelta)) & n)
> minDelta
)
{
@ -262,9 +264,9 @@ Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
cellMoveMap[cellI] = 1;
}
}
totalFaceId ++;
}
}
// Move points
regionMesh().movePoints(newPoints);

View File

@ -28,6 +28,7 @@ License
#include "polyMesh.H"
#include "polyPatch.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
@ -274,6 +275,49 @@ Foam::tmp<Foam::tensorField> Foam::sampledPatch::sample
}
Foam::tmp<Foam::scalarField> Foam::sampledPatch::sample
(
const surfaceScalarField& sField
) const
{
return sampleField(sField);
}
Foam::tmp<Foam::vectorField> Foam::sampledPatch::sample
(
const surfaceVectorField& sField
) const
{
return sampleField(sField);
}
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatch::sample
(
const surfaceSphericalTensorField& sField
) const
{
return sampleField(sField);
}
Foam::tmp<Foam::symmTensorField> Foam::sampledPatch::sample
(
const surfaceSymmTensorField& sField
) const
{
return sampleField(sField);
}
Foam::tmp<Foam::tensorField> Foam::sampledPatch::sample
(
const surfaceTensorField& sField
) const
{
return sampleField(sField);
}
Foam::tmp<Foam::scalarField> Foam::sampledPatch::interpolate
(
const interpolation<scalar>& interpolator

View File

@ -87,6 +87,13 @@ class sampledPatch
const GeometricField<Type, fvPatchField, volMesh>& vField
) const;
//- sample surface field on faces
template <class Type>
tmp<Field<Type> > sampleField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
) const;
template <class Type>
tmp<Field<Type> >
interpolateField(const interpolation<Type>&) const;
@ -203,6 +210,35 @@ public:
const volTensorField&
) const;
//- Surface sample field on surface
virtual tmp<scalarField> sample
(
const surfaceScalarField&
) const;
//- Surface Sample field on surface
virtual tmp<vectorField> sample
(
const surfaceVectorField&
) const;
//- Surface sample field on surface
virtual tmp<sphericalTensorField> sample
(
const surfaceSphericalTensorField&
) const;
//- Surface sample field on surface
virtual tmp<symmTensorField> sample
(
const surfaceSymmTensorField&
) const;
//- Surface sample field on surface
virtual tmp<tensorField> sample
(
const surfaceTensorField&
) const;
//- interpolate field on surface
virtual tmp<scalarField> interpolate

View File

@ -48,6 +48,27 @@ Foam::sampledPatch::sampleField
}
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledPatch::sampleField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
) const
{
// One value per face
tmp<Field<Type> > tvalues(new Field<Type>(patchFaceLabels_.size()));
Field<Type>& values = tvalues();
forAll(patchFaceLabels_, i)
{
label patchI = patchIDs_[patchIndex_[i]];
values[i] = sField.boundaryField()[patchI][patchFaceLabels_[i]];
}
return tvalues;
}
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledPatch::interpolateField

View File

@ -240,6 +240,55 @@ Foam::scalar Foam::sampledSurface::area() const
}
Foam::tmp<Foam::scalarField> Foam::sampledSurface::sample
(
const surfaceScalarField& sField
) const
{
notImplemented("tmp<Foam::scalarField> sampledSurface::sample");
return tmp<scalarField>(NULL);
}
Foam::tmp<Foam::vectorField> Foam::sampledSurface::sample
(
const surfaceVectorField& sField
) const
{
notImplemented("tmp<Foam::vectorField> sampledSurface::sample");
return tmp<vectorField>(NULL);
}
Foam::tmp<Foam::sphericalTensorField> Foam::sampledSurface::sample
(
const surfaceSphericalTensorField& sField
) const
{
notImplemented("tmp<Foam::sphericalTensorField> sampledSurface::sample");
return tmp<sphericalTensorField>(NULL);
}
Foam::tmp<Foam::symmTensorField> Foam::sampledSurface::sample
(
const surfaceSymmTensorField& sField
) const
{
notImplemented("tmp<Foam::symmTensorField> sampledSurface::sample");
return tmp<symmTensorField>(NULL);
}
Foam::tmp<Foam::tensorField> Foam::sampledSurface::sample
(
const surfaceTensorField& sField
) const
{
notImplemented("tmp<Foam::tensorField> sampledSurface::sample");
return tmp<tensorField>(NULL);
}
Foam::tmp<Foam::Field<Foam::scalar> >
Foam::sampledSurface::project(const Field<scalar>& field) const
{

View File

@ -57,6 +57,8 @@ SourceFiles
#include "runTimeSelectionTables.H"
#include "autoPtr.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "surfaceMesh.H"
#include "polyMesh.H"
#include "coordinateSystems.H"
#include "interpolation.H"
@ -352,6 +354,35 @@ public:
const volTensorField&
) const = 0;
//- Surface sample field on surface
virtual tmp<scalarField> sample
(
const surfaceScalarField&
) const;
//- Surface Sample field on surface
virtual tmp<vectorField> sample
(
const surfaceVectorField&
) const;
//- Surface sample field on surface
virtual tmp<sphericalTensorField> sample
(
const surfaceSphericalTensorField&
) const;
//- Surface sample field on surface
virtual tmp<symmTensorField> sample
(
const surfaceSymmTensorField&
) const;
//- Surface sample field on surface
virtual tmp<tensorField> sample
(
const surfaceTensorField&
) const;
//- Interpolate field on surface
virtual tmp<scalarField> interpolate

View File

@ -95,12 +95,7 @@ Foam::sampledSurfaces::sampledSurfaces
fieldSelection_(),
interpolationScheme_(word::null),
mergeList_(),
formatter_(NULL),
scalarFields_(),
vectorFields_(),
sphericalTensorFields_(),
symmTensorFields_(),
tensorFields_()
formatter_(NULL)
{
if (Pstream::parRun())
{
@ -154,13 +149,6 @@ void Foam::sampledSurfaces::write()
{
if (debug)
{
Pout<< "timeName = " << mesh_.time().timeName() << nl
<< "scalarFields " << scalarFields_ << nl
<< "vectorFields " << vectorFields_ << nl
<< "sphTensorFields " << sphericalTensorFields_ << nl
<< "symTensorFields " << symmTensorFields_ <<nl
<< "tensorFields " << tensorFields_ <<nl;
Pout<< "Creating directory "
<< outputPath_/mesh_.time().timeName() << nl << endl;
@ -176,11 +164,19 @@ void Foam::sampledSurfaces::write()
writeGeometry();
}
sampleAndWrite(scalarFields_);
sampleAndWrite(vectorFields_);
sampleAndWrite(sphericalTensorFields_);
sampleAndWrite(symmTensorFields_);
sampleAndWrite(tensorFields_);
const IOobjectList objects(mesh_, mesh_.time().timeName());
sampleAndWrite<volScalarField>(objects);
sampleAndWrite<volVectorField>(objects);
sampleAndWrite<volSphericalTensorField>(objects);
sampleAndWrite<volSymmTensorField>(objects);
sampleAndWrite<volTensorField>(objects);
sampleAndWrite<surfaceScalarField>(objects);
sampleAndWrite<surfaceVectorField>(objects);
sampleAndWrite<surfaceSphericalTensorField>(objects);
sampleAndWrite<surfaceSymmTensorField>(objects);
sampleAndWrite<surfaceTensorField>(objects);
}
}
@ -192,7 +188,6 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
if (surfacesFound)
{
dict.lookup("fields") >> fieldSelection_;
clearFieldGroups();
dict.lookup("interpolationScheme") >> interpolationScheme_;
const word writeType(dict.lookup("surfaceFormat"));

View File

@ -40,7 +40,9 @@ SourceFiles
#include "sampledSurface.H"
#include "surfaceWriter.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "wordReList.H"
#include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,21 +62,6 @@ class sampledSurfaces
{
// Private classes
//- Class used for grouping field types
template<class Type>
class fieldGroup
:
public DynamicList<word>
{
public:
//- Construct null
fieldGroup()
:
DynamicList<word>(0)
{}
};
//- Class used for surface merging information
class mergeInfo
@ -137,35 +124,43 @@ class sampledSurfaces
//- Surface formatter
autoPtr<surfaceWriter> formatter_;
//- Categorized scalar/vector/tensor fields
fieldGroup<scalar> scalarFields_;
fieldGroup<vector> vectorFields_;
fieldGroup<sphericalTensor> sphericalTensorFields_;
fieldGroup<symmTensor> symmTensorFields_;
fieldGroup<tensor> tensorFields_;
// Private Member Functions
//- Clear old field groups
void clearFieldGroups();
//- Append fieldName to the appropriate group
label appendFieldGroup(const word& fieldName, const word& fieldType);
//- Classify field types, returns the number of fields
//- Return number of fields
label classifyFields();
//- Write geometry only
void writeGeometry() const;
//- Write sampled fieldName on surface and on outputDir path
template<class Type>
void writeSurface
(
const Field<Type>& values,
const label surfI,
const word& fieldName,
const fileName& outputDir
);
//- Sample and write a particular volume field
template<class Type>
void sampleAndWrite(const GeometricField<Type, fvPatchField, volMesh>&);
void sampleAndWrite
(
const GeometricField<Type, fvPatchField, volMesh>&
);
//- Sample and write a particular surface field
template<class Type>
void sampleAndWrite
(
const GeometricField<Type, fvsPatchField, surfaceMesh>&
);
//- Sample and write all the fields of the given type
template<class Type>
void sampleAndWrite(fieldGroup<Type>&);
void sampleAndWrite(const IOobjectList& allObjects);
//- Disallow default bitwise copy construct and assignment
sampledSurfaces(const sampledSurfaces&);

View File

@ -30,94 +30,22 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::sampledSurfaces::clearFieldGroups()
{
scalarFields_.clear();
vectorFields_.clear();
sphericalTensorFields_.clear();
symmTensorFields_.clear();
tensorFields_.clear();
}
Foam::label Foam::sampledSurfaces::appendFieldGroup
(
const word& fieldName,
const word& fieldType
)
{
if (fieldType == volScalarField::typeName)
{
scalarFields_.append(fieldName);
return 1;
}
else if (fieldType == volVectorField::typeName)
{
vectorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSphericalTensorField::typeName)
{
sphericalTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volSymmTensorField::typeName)
{
symmTensorFields_.append(fieldName);
return 1;
}
else if (fieldType == volTensorField::typeName)
{
tensorFields_.append(fieldName);
return 1;
}
return 0;
}
Foam::label Foam::sampledSurfaces::classifyFields()
{
label nFields = 0;
clearFieldGroups();
// check files for a particular time
// check files for a particular time
if (loadFromFiles_)
{
IOobjectList objects(mesh_, mesh_.time().timeName());
wordList allFields = objects.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
objects.find(fieldName)()->headerClassName()
);
}
return indices.size();
}
else
{
wordList allFields = mesh_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(indices, fieldI)
{
const word& fieldName = allFields[indices[fieldI]];
nFields += appendFieldGroup
(
fieldName,
mesh_.find(fieldName)()->type()
);
}
return indices.size();
}
return nFields;
}

View File

@ -25,10 +25,86 @@ License
#include "sampledSurfaces.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "ListListOps.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::sampledSurfaces::writeSurface
(
const Field<Type>& values,
const label surfI,
const word& fieldName,
const fileName& outputDir
)
{
const sampledSurface& s = operator[](surfI);
if (Pstream::parRun())
{
// Collect values from all processors
List<Field<Type> > gatheredValues(Pstream::nProcs());
gatheredValues[Pstream::myProcNo()] = values;
Pstream::gatherList(gatheredValues);
if (Pstream::master())
{
// Combine values into single field
Field<Type> allValues
(
ListListOps::combine<Field<Type> >
(
gatheredValues,
accessOp<Field<Type> >()
)
);
// Renumber (point data) to correspond to merged points
if (mergeList_[surfI].pointsMap.size() == allValues.size())
{
inplaceReorder(mergeList_[surfI].pointsMap, allValues);
allValues.setSize(mergeList_[surfI].points.size());
}
// Write to time directory under outputPath_
// skip surface without faces (eg, a failed cut-plane)
if (mergeList_[surfI].faces.size())
{
formatter_->write
(
outputDir,
s.name(),
mergeList_[surfI].points,
mergeList_[surfI].faces,
fieldName,
allValues,
s.interpolate()
);
}
}
}
else
{
// Write to time directory under outputPath_
// skip surface without faces (eg, a failed cut-plane)
if (s.faces().size())
{
formatter_->write
(
outputDir,
s.name(),
s.points(),
s.faces(),
fieldName,
values,
s.interpolate()
);
}
}
}
template<class Type>
void Foam::sampledSurfaces::sampleAndWrite
(
@ -65,125 +141,64 @@ void Foam::sampledSurfaces::sampleAndWrite
values = s.sample(vField);
}
if (Pstream::parRun())
{
// Collect values from all processors
List<Field<Type> > gatheredValues(Pstream::nProcs());
gatheredValues[Pstream::myProcNo()] = values;
Pstream::gatherList(gatheredValues);
if (Pstream::master())
{
// Combine values into single field
Field<Type> allValues
(
ListListOps::combine<Field<Type> >
(
gatheredValues,
accessOp<Field<Type> >()
)
);
// Renumber (point data) to correspond to merged points
if (mergeList_[surfI].pointsMap.size() == allValues.size())
{
inplaceReorder(mergeList_[surfI].pointsMap, allValues);
allValues.setSize(mergeList_[surfI].points.size());
}
// Write to time directory under outputPath_
// skip surface without faces (eg, a failed cut-plane)
if (mergeList_[surfI].faces.size())
{
formatter_->write
(
outputDir,
s.name(),
mergeList_[surfI].points,
mergeList_[surfI].faces,
fieldName,
allValues,
s.interpolate()
);
}
}
}
else
{
// Write to time directory under outputPath_
// skip surface without faces (eg, a failed cut-plane)
if (s.faces().size())
{
formatter_->write
(
outputDir,
s.name(),
s.points(),
s.faces(),
fieldName,
values,
s.interpolate()
);
}
}
writeSurface<Type>(values, surfI, fieldName, outputDir);
}
}
template<class Type>
void Foam::sampledSurfaces::sampleAndWrite
(
fieldGroup<Type>& fields
const GeometricField<Type, fvsPatchField, surfaceMesh>& sField
)
{
if (fields.size())
const word& fieldName = sField.name();
const fileName outputDir = outputPath_/sField.time().timeName();
forAll(*this, surfI)
{
forAll(fields, fieldI)
const sampledSurface& s = operator[](surfI);
Field<Type> values = s.sample(sField);
writeSurface<Type>(values, surfI, fieldName, outputDir);
}
}
template<class GeoField>
void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& allObjects)
{
IOobjectList fields = allObjects.lookupClass(GeoField::typeName);
forAllConstIter(IOobjectList, fields, fieldIter)
{
forAll (fieldSelection_, fieldI)
{
if (Pstream::master() && verbose_)
const wordRe field = fieldSelection_[fieldI];
if (field.match(fieldIter()->name()))
{
Pout<< "sampleAndWrite: " << fields[fieldI] << endl;
}
if (loadFromFiles_)
{
sampleAndWrite
(
GeometricField<Type, fvPatchField, volMesh>
(
IOobject
(
fields[fieldI],
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
mesh_
)
);
}
else
{
objectRegistry::const_iterator iter =
mesh_.find(fields[fieldI]);
if
(
iter != objectRegistry::end()
&& iter()->type()
== GeometricField<Type, fvPatchField, volMesh>::typeName
)
if (Pstream::master() && verbose_)
{
sampleAndWrite
(
mesh_.lookupObject
<GeometricField<Type, fvPatchField, volMesh> >
(
fields[fieldI]
)
);
Pout<< "sampleAndWrite: " << field << endl;
}
if (loadFromFiles_)
{
fieldIter()->readOpt() = IOobject::MUST_READ;
sampleAndWrite
(
GeoField
(
*fieldIter(),
mesh_
)
);
}
else
{
sampleAndWrite
(
mesh_.lookupObject<GeoField>(fieldIter()->name())
);
}
}
}