Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-12-07 15:20:19 +01:00
78 changed files with 3281 additions and 101119 deletions

View File

@ -27,6 +27,7 @@ $(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
cuttingPlane/cuttingPlane.C
sampledSurface/sampledPatch/sampledPatch.C
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
sampledSurface/sampledPlane/sampledPlane.C
sampledSurface/isoSurface/isoSurface.C
sampledSurface/isoSurface/sampledIsoSurface.C

View File

@ -157,6 +157,10 @@ void Foam::sampledPatch::remapFaces
if (&faceMap && faceMap.size())
{
MeshStorage::remapFaces(faceMap);
patchFaceLabels_ = labelList
(
UIndirectList<label>(patchFaceLabels_, faceMap)
);
}
}

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "sampledPatchInternalField.H"
#include "dictionary.H"
#include "polyMesh.H"
#include "polyPatch.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(sampledPatchInternalField, 0);
addNamedToRunTimeSelectionTable
(
sampledSurface,
sampledPatchInternalField,
word,
patchInternalField
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sampledPatchInternalField::sampledPatchInternalField
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
)
:
sampledPatch(name, mesh, dict),
directMappedPatchBase
(
mesh.boundaryMesh()[sampledPatch::patchIndex()],
mesh.name(), // sampleRegion
directMappedPatchBase::NEARESTCELL, // sampleMode
word::null, // samplePatch
-readScalar(dict.lookup("distance"))
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sampledPatchInternalField::~sampledPatchInternalField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::sampledPatchInternalField::sample
(
const volScalarField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::vectorField> Foam::sampledPatchInternalField::sample
(
const volVectorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatchInternalField::sample
(
const volSphericalTensorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::symmTensorField> Foam::sampledPatchInternalField::sample
(
const volSymmTensorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::tensorField> Foam::sampledPatchInternalField::sample
(
const volTensorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::scalarField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<scalar>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::vectorField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<vector>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledPatchInternalField::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::symmTensorField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<symmTensor>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::tensorField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<tensor>& interpolator
) const
{
return interpolateField(interpolator);
}
void Foam::sampledPatchInternalField::print(Ostream& os) const
{
os << "sampledPatchInternalField: " << name() << " :"
<< " patch:" << patchName()
<< " faces:" << faces().size()
<< " points:" << points().size();
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::sampledPatchInternalField
Description
Variation of sampledPatch that samples the internalField (at a given
normal distance from the patch) instead of the patchField.
Note:
- interpolate=false : get cell value on faces
- interpolate=true : interpolate inside cell and interpolate to points
There is no option to get interpolated value inside the cell on the faces.
SourceFiles
sampledPatchInternalField.C
\*---------------------------------------------------------------------------*/
#ifndef sampledPatchInternalField_H
#define sampledPatchInternalField_H
#include "sampledPatch.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class sampledPatchInternalField Declaration
\*---------------------------------------------------------------------------*/
class sampledPatchInternalField
:
public sampledPatch,
public directMappedPatchBase
{
// Private Member Functions
//- sample field on faces
template <class Type>
tmp<Field<Type> > sampleField
(
const GeometricField<Type, fvPatchField, volMesh>& vField
) const;
template <class Type>
tmp<Field<Type> > interpolateField(const interpolation<Type>&) const;
public:
//- Runtime type information
TypeName("sampledPatchInternalField");
// Constructors
//- Construct from dictionary
sampledPatchInternalField
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~sampledPatchInternalField();
// Member Functions
//- sample field on surface
virtual tmp<scalarField> sample
(
const volScalarField&
) const;
//- sample field on surface
virtual tmp<vectorField> sample
(
const volVectorField&
) const;
//- sample field on surface
virtual tmp<sphericalTensorField> sample
(
const volSphericalTensorField&
) const;
//- sample field on surface
virtual tmp<symmTensorField> sample
(
const volSymmTensorField&
) const;
//- sample field on surface
virtual tmp<tensorField> sample
(
const volTensorField&
) const;
//- interpolate field on surface
virtual tmp<scalarField> interpolate
(
const interpolation<scalar>&
) const;
//- interpolate field on surface
virtual tmp<vectorField> interpolate
(
const interpolation<vector>&
) const;
//- interpolate field on surface
virtual tmp<sphericalTensorField> interpolate
(
const interpolation<sphericalTensor>&
) const;
//- interpolate field on surface
virtual tmp<symmTensorField> interpolate
(
const interpolation<symmTensor>&
) const;
//- interpolate field on surface
virtual tmp<tensorField> interpolate
(
const interpolation<tensor>&
) const;
//- Write
virtual void print(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "sampledPatchInternalFieldTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "sampledPatchInternalField.H"
#include "interpolationCellPoint.H"
#include "PrimitivePatchInterpolation.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledPatchInternalField::sampleField
(
const GeometricField<Type, fvPatchField, volMesh>& vField
) const
{
const mapDistribute& distMap = map();
// One value per face
tmp<Field<Type> > tvalues(new Field<Type>(patchFaceLabels().size()));
Field<Type>& values = tvalues();
if (patchIndex() != -1)
{
Field<Type> interpVals = vField.internalField();
distMap.distribute(interpVals);
forAll(patchFaceLabels(), elemI)
{
values[elemI] = interpVals[patchFaceLabels()[elemI]];
}
}
return tvalues;
}
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledPatchInternalField::interpolateField
(
const interpolation<Type>& interpolator
) const
{
// One value per vertex
if (patchIndex() != -1)
{
// See directMappedFixedValueFvPatchField
const mapDistribute& distMap = map();
const polyPatch& pp = mesh().boundaryMesh()[patchIndex()];
// Send back sample points to processor that holds the cell.
// Mark cells with point::max so we know which ones we need
// to interpolate (since expensive).
vectorField samples(pp.faceCentres());
distMap.reverseDistribute(mesh().nCells(), point::max, samples);
Field<Type> patchVals(mesh().nCells());
forAll(samples, cellI)
{
if (samples[cellI] != point::max)
{
patchVals[cellI] = interpolator.interpolate
(
samples[cellI],
cellI
);
}
}
distMap.distribute(patchVals);
// Now patchVals holds the interpolated data in patch face order.
// Interpolate to points. Note: points are patch.localPoints() so
// can use standard interpolation
return PrimitivePatchInterpolation<primitivePatch>
(
pp
).faceToPointInterpolate(patchVals);
}
else
{
return tmp<Field<Type> >(new Field<Type>(points().size()));
}
}
// ************************************************************************* //