mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: near-wall sampling : new 'patchInternalField' sampledSurface, new 'nearWallFields' functionObject
This commit is contained in:
@ -166,6 +166,18 @@ surfaces
|
|||||||
// triangulate false;
|
// triangulate false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
movingNearWall_interpolated
|
||||||
|
{
|
||||||
|
// Sample cell values off patch. Does not need to be the near-wall
|
||||||
|
// cell, can be arbitrarily far away.
|
||||||
|
type patchInternalField;
|
||||||
|
patchName movingWall;
|
||||||
|
distance 0.0001;
|
||||||
|
interpolate true;
|
||||||
|
// Optional: whether to leave as faces (=default) or triangulate
|
||||||
|
// triangulate false;
|
||||||
|
}
|
||||||
|
|
||||||
interpolatedIso
|
interpolatedIso
|
||||||
{
|
{
|
||||||
// Iso surface for interpolated values only
|
// Iso surface for interpolated values only
|
||||||
|
|||||||
@ -142,6 +142,7 @@ $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocit
|
|||||||
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
|
||||||
|
$(derivedFvPatchFields)/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/slip/slipFvPatchFields.C
|
$(derivedFvPatchFields)/slip/slipFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
|
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
||||||
|
|||||||
@ -0,0 +1,380 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "selfContainedDirectMappedFixedValueFvPatchField.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "interpolationCell.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
directMappedPatchBase(p.patch()),
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
fieldName_(iF.name()),
|
||||||
|
setAverage_(false),
|
||||||
|
average_(pTraits<Type>::zero),
|
||||||
|
interpolationScheme_(interpolationCell<Type>::typeName)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf,
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const fvPatchFieldMapper& mapper
|
||||||
|
)
|
||||||
|
:
|
||||||
|
directMappedPatchBase(p.patch(), ptf),
|
||||||
|
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_),
|
||||||
|
interpolationScheme_(ptf.interpolationScheme_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
directMappedPatchBase(p.patch(), dict),
|
||||||
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
|
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
|
||||||
|
setAverage_(readBool(dict.lookup("setAverage"))),
|
||||||
|
average_(pTraits<Type>(dict.lookup("average"))),
|
||||||
|
interpolationScheme_(interpolationCell<Type>::typeName)
|
||||||
|
{
|
||||||
|
if (mode() == directMappedPatchBase::NEARESTCELL)
|
||||||
|
{
|
||||||
|
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch& p,
|
||||||
|
const DimensionedField<Type, volMesh>& iF,
|
||||||
|
|
||||||
|
// directMappedPatchBase
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance,
|
||||||
|
|
||||||
|
// My settings
|
||||||
|
const word& fieldName,
|
||||||
|
const bool setAverage,
|
||||||
|
const Type average,
|
||||||
|
const word& interpolationScheme
|
||||||
|
)
|
||||||
|
:
|
||||||
|
directMappedPatchBase
|
||||||
|
(
|
||||||
|
p.patch(),
|
||||||
|
sampleRegion,
|
||||||
|
sampleMode,
|
||||||
|
samplePatch,
|
||||||
|
distance
|
||||||
|
),
|
||||||
|
fixedValueFvPatchField<Type>(p, iF),
|
||||||
|
fieldName_(fieldName),
|
||||||
|
setAverage_(setAverage),
|
||||||
|
average_(average),
|
||||||
|
interpolationScheme_(interpolationScheme)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf
|
||||||
|
)
|
||||||
|
:
|
||||||
|
directMappedPatchBase(ptf.patch().patch(), ptf),
|
||||||
|
fixedValueFvPatchField<Type>(ptf),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_),
|
||||||
|
interpolationScheme_(ptf.interpolationScheme_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf,
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
)
|
||||||
|
:
|
||||||
|
directMappedPatchBase(ptf.patch().patch(), ptf),
|
||||||
|
fixedValueFvPatchField<Type>(ptf, iF),
|
||||||
|
fieldName_(ptf.fieldName_),
|
||||||
|
setAverage_(ptf.setAverage_),
|
||||||
|
average_(ptf.average_),
|
||||||
|
interpolationScheme_(ptf.interpolationScheme_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::sampleField() const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
|
||||||
|
|
||||||
|
if (sameRegion())
|
||||||
|
{
|
||||||
|
if (fieldName_ == this->dimensionedInternalField().name())
|
||||||
|
{
|
||||||
|
// Optimisation: bypass field lookup
|
||||||
|
return
|
||||||
|
dynamic_cast<const fieldType&>
|
||||||
|
(
|
||||||
|
this->dimensionedInternalField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
|
||||||
|
return thisMesh.lookupObject<fieldType>(fieldName_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nbrMesh.lookupObject<fieldType>(fieldName_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const interpolation<Type>&
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField<Type>::interpolator() const
|
||||||
|
{
|
||||||
|
if (!interpolator_.valid())
|
||||||
|
{
|
||||||
|
interpolator_ = interpolation<Type>::New
|
||||||
|
(
|
||||||
|
interpolationScheme_,
|
||||||
|
sampleField()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return interpolator_();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||||
|
{
|
||||||
|
if (this->updated())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||||
|
|
||||||
|
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
|
||||||
|
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
|
||||||
|
const mapDistribute& distMap = directMappedPatchBase::map();
|
||||||
|
|
||||||
|
// Result of obtaining remote values
|
||||||
|
Field<Type> newValues;
|
||||||
|
|
||||||
|
switch (mode())
|
||||||
|
{
|
||||||
|
case NEARESTCELL:
|
||||||
|
{
|
||||||
|
if (interpolationScheme_ != interpolationCell<Type>::typeName)
|
||||||
|
{
|
||||||
|
// Need to do interpolation so need cells to sample.
|
||||||
|
|
||||||
|
// Send back sample points to the processor that holds the cell
|
||||||
|
vectorField samples(samplePoints());
|
||||||
|
distMap.reverseDistribute
|
||||||
|
(
|
||||||
|
(sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()),
|
||||||
|
point::max,
|
||||||
|
samples
|
||||||
|
);
|
||||||
|
|
||||||
|
const interpolation<Type>& interp = interpolator();
|
||||||
|
|
||||||
|
newValues.setSize(samples.size(), pTraits<Type>::max);
|
||||||
|
forAll(samples, cellI)
|
||||||
|
{
|
||||||
|
if (samples[cellI] != point::max)
|
||||||
|
{
|
||||||
|
newValues[cellI] = interp.interpolate
|
||||||
|
(
|
||||||
|
samples[cellI],
|
||||||
|
cellI
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValues = sampleField();
|
||||||
|
}
|
||||||
|
|
||||||
|
distMap.distribute(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NEARESTPATCHFACE:
|
||||||
|
{
|
||||||
|
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
|
||||||
|
(
|
||||||
|
samplePatch()
|
||||||
|
);
|
||||||
|
if (nbrPatchID < 0)
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"void selfContainedDirectMappedFixedValueFvPatchField<Type>::"
|
||||||
|
"updateCoeffs()"
|
||||||
|
)<< "Unable to find sample patch " << samplePatch()
|
||||||
|
<< " in region " << sampleRegion()
|
||||||
|
<< " for patch " << this->patch().name() << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
|
newValues = nbrField.boundaryField()[nbrPatchID];
|
||||||
|
distMap.distribute(newValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NEARESTFACE:
|
||||||
|
{
|
||||||
|
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
|
||||||
|
|
||||||
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
|
forAll(nbrField.boundaryField(), patchI)
|
||||||
|
{
|
||||||
|
const fvPatchField<Type>& pf =
|
||||||
|
nbrField.boundaryField()[patchI];
|
||||||
|
label faceStart = pf.patch().start();
|
||||||
|
|
||||||
|
forAll(pf, faceI)
|
||||||
|
{
|
||||||
|
allValues[faceStart++] = pf[faceI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
distMap.distribute(allValues);
|
||||||
|
|
||||||
|
newValues.transfer(allValues);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()"
|
||||||
|
)<< "Unknown sampling mode: " << mode()
|
||||||
|
<< nl << abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setAverage_)
|
||||||
|
{
|
||||||
|
Type averagePsi =
|
||||||
|
gSum(this->patch().magSf()*newValues)
|
||||||
|
/gSum(this->patch().magSf());
|
||||||
|
|
||||||
|
if (mag(averagePsi)/mag(average_) > 0.5)
|
||||||
|
{
|
||||||
|
newValues *= mag(average_)/mag(averagePsi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newValues += (average_ - averagePsi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->operator==(newValues);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "selfContainedDirectMapped on field:"
|
||||||
|
<< this->dimensionedInternalField().name()
|
||||||
|
<< " patch:" << this->patch().name()
|
||||||
|
<< " avg:" << gAverage(*this)
|
||||||
|
<< " min:" << gMin(*this)
|
||||||
|
<< " max:" << gMax(*this)
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void selfContainedDirectMappedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||||
|
{
|
||||||
|
fvPatchField<Type>::write(os);
|
||||||
|
directMappedPatchBase::write(os);
|
||||||
|
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
|
||||||
|
os.writeKeyword("interpolationScheme") << interpolationScheme_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
this->writeEntry("value", os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,200 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
|
||||||
|
Description
|
||||||
|
Self-contained version of directMapped. Does not use information on
|
||||||
|
patch, instead holds it locally (and possibly duplicate) so use
|
||||||
|
normal directMapped in preference and only use this if you cannot
|
||||||
|
change the underlying patch type to directMapped.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef selfContainedDirectMappedFixedValueFvPatchField_H
|
||||||
|
#define selfContainedDirectMappedFixedValueFvPatchField_H
|
||||||
|
|
||||||
|
#include "directMappedPatchBase.H"
|
||||||
|
#include "fixedValueFvPatchFields.H"
|
||||||
|
#include "interpolation.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class selfContainedDirectMappedFixedValueFvPatch Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
:
|
||||||
|
public directMappedPatchBase,
|
||||||
|
public fixedValueFvPatchField<Type>
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Name of field to sample - defaults to field associated with this
|
||||||
|
// patchField if not specified
|
||||||
|
word fieldName_;
|
||||||
|
|
||||||
|
//- If true adjust the mapped field to maintain average value average_
|
||||||
|
const bool setAverage_;
|
||||||
|
|
||||||
|
//- Average value the mapped field is adjusted to maintain if
|
||||||
|
// setAverage_ is set true
|
||||||
|
const Type average_;
|
||||||
|
|
||||||
|
//- Interpolation scheme to use for nearestcell mode
|
||||||
|
word interpolationScheme_;
|
||||||
|
|
||||||
|
mutable autoPtr<interpolation<Type> > interpolator_;
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Field to sample. Either on my or nbr mesh
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
|
||||||
|
|
||||||
|
//- Access the interpolation method
|
||||||
|
const interpolation<Type>& interpolator() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("selfContainedDirectMapped");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from patch and internal field
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and dictionary
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const dictionary&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from patch, internal field and distance for normal type
|
||||||
|
// sampling
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
|
||||||
|
// directMappedPatchBase
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode sampleMode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance,
|
||||||
|
|
||||||
|
// My settings
|
||||||
|
const word& fieldName,
|
||||||
|
const bool setAverage,
|
||||||
|
const Type average,
|
||||||
|
const word& interpolationScheme
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct by mapping given selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
// onto a new patch
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const selfContainedDirectMappedFixedValueFvPatchField<Type>&,
|
||||||
|
const fvPatch&,
|
||||||
|
const DimensionedField<Type, volMesh>&,
|
||||||
|
const fvPatchFieldMapper&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct as copy
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const selfContainedDirectMappedFixedValueFvPatchField<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<fvPatchField<Type> > clone() const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new selfContainedDirectMappedFixedValueFvPatchField<Type>(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Construct as copy setting internal field reference
|
||||||
|
selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
(
|
||||||
|
const selfContainedDirectMappedFixedValueFvPatchField<Type>&,
|
||||||
|
const DimensionedField<Type, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone setting internal field reference
|
||||||
|
virtual tmp<fvPatchField<Type> > clone
|
||||||
|
(
|
||||||
|
const DimensionedField<Type, volMesh>& iF
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return tmp<fvPatchField<Type> >
|
||||||
|
(
|
||||||
|
new selfContainedDirectMappedFixedValueFvPatchField<Type>(*this, iF)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
|
||||||
|
// Evaluation functions
|
||||||
|
|
||||||
|
//- Update the coefficients associated with the patch field
|
||||||
|
virtual void updateCoeffs();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write(Ostream&) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "selfContainedDirectMappedFixedValueFvPatchField.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "selfContainedDirectMappedFixedValueFvPatchFields.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchFields(selfContainedDirectMappedFixedValue);
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef selfContainedDirectMappedFixedValueFvPatchFields_H
|
||||||
|
#define selfContainedDirectMappedFixedValueFvPatchFields_H
|
||||||
|
|
||||||
|
#include "selfContainedDirectMappedFixedValueFvPatchField.H"
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(selfContainedDirectMappedFixedValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef selfContainedDirectMappedFixedValueFvPatchFieldsFwd_H
|
||||||
|
#define selfContainedDirectMappedFixedValueFvPatchFieldsFwd_H
|
||||||
|
|
||||||
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type> class selfContainedDirectMappedFixedValueFvPatchField;
|
||||||
|
|
||||||
|
makePatchTypeFieldTypedefs(selfContainedDirectMappedFixedValue)
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C
|
|||||||
fieldValues/cellSource/cellSource.C
|
fieldValues/cellSource/cellSource.C
|
||||||
fieldValues/cellSource/cellSourceFunctionObject.C
|
fieldValues/cellSource/cellSourceFunctionObject.C
|
||||||
|
|
||||||
|
nearWallFields/nearWallFields.C
|
||||||
|
nearWallFields/nearWallFieldsFunctionObject.C
|
||||||
|
|
||||||
readFields/readFields.C
|
readFields/readFields.C
|
||||||
readFields/readFieldsFunctionObject.C
|
readFields/readFieldsFunctionObject.C
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,49 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-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/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::IOnearWallFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
Instance of the generic IOOutputFilter for nearWallFields.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOnearWallFields_H
|
||||||
|
#define IOnearWallFields_H
|
||||||
|
|
||||||
|
#include "nearWallFields.H"
|
||||||
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOOutputFilter<nearWallFields> IOnearWallFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,179 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-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 "nearWallFields.H"
|
||||||
|
//#include "volFields.H"
|
||||||
|
//#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
|
||||||
|
//#include "interpolationCellPoint.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(nearWallFields, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::nearWallFields::nearWallFields
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
obr_(obr),
|
||||||
|
active_(true),
|
||||||
|
fieldSet_()
|
||||||
|
{
|
||||||
|
// Check if the available mesh is an fvMesh otherise deactivate
|
||||||
|
if (!isA<fvMesh>(obr_))
|
||||||
|
{
|
||||||
|
active_ = false;
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"nearWallFields::nearWallFields"
|
||||||
|
"("
|
||||||
|
"const word&, "
|
||||||
|
"const objectRegistry&, "
|
||||||
|
"const dictionary&, "
|
||||||
|
"const bool"
|
||||||
|
")"
|
||||||
|
) << "No fvMesh available, deactivating."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::nearWallFields::~nearWallFields()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::nearWallFields::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||||
|
|
||||||
|
dict.lookup("fields") >> fieldSet_;
|
||||||
|
patchSet_ =
|
||||||
|
mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches")));
|
||||||
|
distance_ = readScalar(dict.lookup("distance"));
|
||||||
|
|
||||||
|
|
||||||
|
// Clear out any previously loaded fields
|
||||||
|
vsf_.clear();
|
||||||
|
vvf_.clear();
|
||||||
|
vSpheretf_.clear();
|
||||||
|
vSymmtf_.clear();
|
||||||
|
vtf_.clear();
|
||||||
|
fieldMap_.clear();
|
||||||
|
reverseFieldMap_.clear();
|
||||||
|
|
||||||
|
|
||||||
|
// Generate fields with selfContainedDirectMapped bc.
|
||||||
|
|
||||||
|
// Convert field to map
|
||||||
|
fieldMap_.resize(2*fieldSet_.size());
|
||||||
|
reverseFieldMap_.resize(2*fieldSet_.size());
|
||||||
|
forAll(fieldSet_, setI)
|
||||||
|
{
|
||||||
|
const word& fldName = fieldSet_[setI].first();
|
||||||
|
const word& sampleFldName = fieldSet_[setI].second();
|
||||||
|
|
||||||
|
fieldMap_.insert(fldName, sampleFldName);
|
||||||
|
reverseFieldMap_.insert(sampleFldName, fldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
createFields(vsf_);
|
||||||
|
createFields(vvf_);
|
||||||
|
createFields(vSpheretf_);
|
||||||
|
createFields(vSymmtf_);
|
||||||
|
createFields(vtf_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::nearWallFields::execute()
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
sampleFields(vsf_);
|
||||||
|
sampleFields(vvf_);
|
||||||
|
sampleFields(vSpheretf_);
|
||||||
|
sampleFields(vSymmtf_);
|
||||||
|
sampleFields(vtf_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::nearWallFields::end()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::nearWallFields::write()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
Info<< "Writing sampled fields to " << obr_.time().timeName()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
forAll(vsf_, i)
|
||||||
|
{
|
||||||
|
vsf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(vvf_, i)
|
||||||
|
{
|
||||||
|
vvf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(vSpheretf_, i)
|
||||||
|
{
|
||||||
|
vSpheretf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(vSymmtf_, i)
|
||||||
|
{
|
||||||
|
vSymmtf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(vtf_, i)
|
||||||
|
{
|
||||||
|
vtf_[i].write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,206 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-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::nearWallFields
|
||||||
|
|
||||||
|
Description
|
||||||
|
Samples near-patch volFields
|
||||||
|
|
||||||
|
Holds fields
|
||||||
|
- every timestep the field get updated with new values
|
||||||
|
- at write it writes the fields
|
||||||
|
so this functionObject can either be used to calculate a new field
|
||||||
|
as a postprocessing step or (since the fields are registered)
|
||||||
|
use these in another functionObject (e.g. faceSource).
|
||||||
|
|
||||||
|
surfaceValues
|
||||||
|
{
|
||||||
|
type nearWallFields;
|
||||||
|
..
|
||||||
|
enabled true;
|
||||||
|
outputControl outputTime;
|
||||||
|
..
|
||||||
|
// Name of volField and corresponding surfaceField
|
||||||
|
fields ((p pNear)(U UNear));
|
||||||
|
// Name of patch to sample
|
||||||
|
patches (movingWall);
|
||||||
|
// Distance away from the wall
|
||||||
|
distance 0.13; // distance away from wall
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nearWallFields.C
|
||||||
|
IOnearWallFields.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nearWallFields_H
|
||||||
|
#define nearWallFields_H
|
||||||
|
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class dictionary;
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class nearWallFields Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class nearWallFields
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Name of this set of nearWallFields object
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- on/off switch
|
||||||
|
bool active_;
|
||||||
|
|
||||||
|
// Read from dictionary
|
||||||
|
|
||||||
|
//- Fields to process
|
||||||
|
List<Tuple2<word, word> > fieldSet_;
|
||||||
|
|
||||||
|
//- Patches to sample
|
||||||
|
labelHashSet patchSet_;
|
||||||
|
|
||||||
|
//- Distance away from wall
|
||||||
|
scalar distance_;
|
||||||
|
|
||||||
|
//- From original field to sampled result
|
||||||
|
HashTable<word> fieldMap_;
|
||||||
|
|
||||||
|
//- From resulting back to original field
|
||||||
|
HashTable<word> reverseFieldMap_;
|
||||||
|
|
||||||
|
//- Locally constructed fields
|
||||||
|
PtrList<volScalarField> vsf_;
|
||||||
|
PtrList<volVectorField> vvf_;
|
||||||
|
PtrList<volSphericalTensorField> vSpheretf_;
|
||||||
|
PtrList<volSymmTensorField> vSymmtf_;
|
||||||
|
PtrList<volTensorField> vtf_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
nearWallFields(const nearWallFields&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const nearWallFields&);
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void createFields
|
||||||
|
(
|
||||||
|
PtrList<GeometricField<Type, fvPatchField, volMesh> >&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void sampleFields
|
||||||
|
(
|
||||||
|
PtrList<GeometricField<Type, fvPatchField, volMesh> >&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("nearWallFields");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and dictionary.
|
||||||
|
// Allow the possibility to load fields from files
|
||||||
|
nearWallFields
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~nearWallFields();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name of the nearWallFields object
|
||||||
|
virtual const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the field min/max data
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Execute, currently does nothing
|
||||||
|
virtual void execute();
|
||||||
|
|
||||||
|
//- Execute at the final time-loop, currently does nothing
|
||||||
|
virtual void end();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write();
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void movePoints(const pointField&)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "nearWallFieldsTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-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 "nearWallFieldsFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineNamedTemplateTypeNameAndDebug
|
||||||
|
(
|
||||||
|
nearWallFieldsFunctionObject,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
nearWallFieldsFunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-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/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::nearWallFieldsFunctionObject
|
||||||
|
|
||||||
|
Description
|
||||||
|
FunctionObject wrapper around nearWallFields to allow
|
||||||
|
them to be created via the functions entry within controlDict.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
nearWallFieldsFunctionObject.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef nearWallFieldsFunctionObject_H
|
||||||
|
#define nearWallFieldsFunctionObject_H
|
||||||
|
|
||||||
|
#include "nearWallFields.H"
|
||||||
|
#include "OutputFilterFunctionObject.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef OutputFilterFunctionObject<nearWallFields>
|
||||||
|
nearWallFieldsFunctionObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-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 "nearWallFields.H"
|
||||||
|
#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
|
||||||
|
#include "interpolationCellPoint.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::nearWallFields::createFields
|
||||||
|
(
|
||||||
|
PtrList<GeometricField<Type, fvPatchField, volMesh> >& sflds
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
|
||||||
|
|
||||||
|
HashTable<const vfType*> flds(obr_.lookupClass<vfType>());
|
||||||
|
|
||||||
|
forAllConstIter(typename HashTable<const vfType*>, flds, iter)
|
||||||
|
{
|
||||||
|
const vfType& fld = *iter();
|
||||||
|
|
||||||
|
if (fieldMap_.found(fld.name()))
|
||||||
|
{
|
||||||
|
const word& sampleFldName = fieldMap_[fld.name()];
|
||||||
|
|
||||||
|
if (obr_.found(sampleFldName))
|
||||||
|
{
|
||||||
|
Info<< " a field " << sampleFldName
|
||||||
|
<< " already exists on the mesh."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
label sz = sflds.size();
|
||||||
|
sflds.setSize(sz+1);
|
||||||
|
|
||||||
|
IOobject io(fld);
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
io.rename(sampleFldName);
|
||||||
|
|
||||||
|
sflds.set(sz, new vfType(io, fld));
|
||||||
|
vfType& sampleFld = sflds[sz];
|
||||||
|
|
||||||
|
// Reset the bcs to be directMapped
|
||||||
|
forAllConstIter(labelHashSet, patchSet_, iter)
|
||||||
|
{
|
||||||
|
label patchI = iter.key();
|
||||||
|
|
||||||
|
sampleFld.boundaryField().set
|
||||||
|
(
|
||||||
|
patchI,
|
||||||
|
new selfContainedDirectMappedFixedValueFvPatchField
|
||||||
|
<Type>
|
||||||
|
(
|
||||||
|
sampleFld.mesh().boundary()[patchI],
|
||||||
|
sampleFld.dimensionedInternalField(),
|
||||||
|
|
||||||
|
sampleFld.mesh().name(),
|
||||||
|
directMappedPatchBase::NEARESTCELL,
|
||||||
|
word::null, // samplePatch
|
||||||
|
-distance_,
|
||||||
|
|
||||||
|
sampleFld.name(), // fieldName
|
||||||
|
false, // setAverage
|
||||||
|
pTraits<Type>::zero, // average
|
||||||
|
interpolationCellPoint<Type>::typeName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " created " << sampleFld.name() << " to sample "
|
||||||
|
<< fld.name() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::nearWallFields::sampleFields
|
||||||
|
(
|
||||||
|
PtrList<GeometricField<Type, fvPatchField, volMesh> >& sflds
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
|
||||||
|
|
||||||
|
forAll(sflds, i)
|
||||||
|
{
|
||||||
|
const word& fldName = reverseFieldMap_[sflds[i].name()];
|
||||||
|
const vfType& fld = obr_.lookupObject<vfType>(fldName);
|
||||||
|
|
||||||
|
// Take over internal and boundary values
|
||||||
|
sflds[i] == fld;
|
||||||
|
// Evaluate to update the directMapped
|
||||||
|
sflds[i].correctBoundaryConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -27,6 +27,7 @@ $(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
|||||||
cuttingPlane/cuttingPlane.C
|
cuttingPlane/cuttingPlane.C
|
||||||
|
|
||||||
sampledSurface/sampledPatch/sampledPatch.C
|
sampledSurface/sampledPatch/sampledPatch.C
|
||||||
|
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
|
||||||
sampledSurface/sampledPlane/sampledPlane.C
|
sampledSurface/sampledPlane/sampledPlane.C
|
||||||
sampledSurface/isoSurface/isoSurface.C
|
sampledSurface/isoSurface/isoSurface.C
|
||||||
sampledSurface/isoSurface/sampledIsoSurface.C
|
sampledSurface/isoSurface/sampledIsoSurface.C
|
||||||
|
|||||||
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user