diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 5f976c11ec..14de7bc1e7 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -151,7 +151,6 @@ $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocit $(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C -$(derivedFvPatchFields)/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/slip/slipFvPatchFields.C $(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C deleted file mode 100644 index e13eacc4bf..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C +++ /dev/null @@ -1,393 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ 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 . - -\*---------------------------------------------------------------------------*/ - -#include "selfContainedMappedFixedValueFvPatchField.H" -#include "volFields.H" -#include "interpolationCell.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -selfContainedMappedFixedValueFvPatchField:: -selfContainedMappedFixedValueFvPatchField -( - const fvPatch& p, - const DimensionedField& iF -) -: - mappedPatchBase(p.patch()), - fixedValueFvPatchField(p, iF), - fieldName_(iF.name()), - setAverage_(false), - average_(pTraits::zero), - interpolationScheme_(interpolationCell::typeName) -{} - - -template -selfContainedMappedFixedValueFvPatchField:: -selfContainedMappedFixedValueFvPatchField -( - const selfContainedMappedFixedValueFvPatchField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - mappedPatchBase(p.patch(), ptf), - fixedValueFvPatchField(ptf, p, iF, mapper), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) -{} - - -template -selfContainedMappedFixedValueFvPatchField:: -selfContainedMappedFixedValueFvPatchField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - mappedPatchBase(p.patch(), dict), - fixedValueFvPatchField(p, iF, dict), - fieldName_(dict.lookupOrDefault("fieldName", iF.name())), - setAverage_(readBool(dict.lookup("setAverage"))), - average_(pTraits(dict.lookup("average"))), - interpolationScheme_(interpolationCell::typeName) -{ - if (mode() == mappedPatchBase::NEARESTCELL) - { - dict.lookup("interpolationScheme") >> interpolationScheme_; - } -} - - -template -selfContainedMappedFixedValueFvPatchField:: -selfContainedMappedFixedValueFvPatchField -( - const fvPatch& p, - const DimensionedField& iF, - - // mappedPatchBase - 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 -) -: - mappedPatchBase - ( - p.patch(), - sampleRegion, - sampleMode, - samplePatch, - distance - ), - fixedValueFvPatchField(p, iF), - fieldName_(fieldName), - setAverage_(setAverage), - average_(average), - interpolationScheme_(interpolationScheme) -{} - - -template -selfContainedMappedFixedValueFvPatchField:: -selfContainedMappedFixedValueFvPatchField -( - const selfContainedMappedFixedValueFvPatchField& ptf -) -: - mappedPatchBase(ptf.patch().patch(), ptf), - fixedValueFvPatchField(ptf), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) -{} - - -template -selfContainedMappedFixedValueFvPatchField:: -selfContainedMappedFixedValueFvPatchField -( - const selfContainedMappedFixedValueFvPatchField& ptf, - const DimensionedField& iF -) -: - mappedPatchBase(ptf.patch().patch(), ptf), - fixedValueFvPatchField(ptf, iF), - fieldName_(ptf.fieldName_), - setAverage_(ptf.setAverage_), - average_(ptf.average_), - interpolationScheme_(ptf.interpolationScheme_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -const GeometricField& -selfContainedMappedFixedValueFvPatchField::sampleField() const -{ - typedef GeometricField fieldType; - - const fvMesh& nbrMesh = refCast(sampleMesh()); - - if (sameRegion()) - { - if (fieldName_ == this->dimensionedInternalField().name()) - { - // Optimisation: bypass field lookup - return - dynamic_cast - ( - this->dimensionedInternalField() - ); - } - else - { - const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); - return thisMesh.lookupObject(fieldName_); - } - } - else - { - return nbrMesh.lookupObject(fieldName_); - } -} - - -template -const interpolation& -selfContainedMappedFixedValueFvPatchField::interpolator() const -{ - if (!interpolator_.valid()) - { - interpolator_ = interpolation::New - ( - interpolationScheme_, - sampleField() - ); - } - return interpolator_(); -} - - -template -void selfContainedMappedFixedValueFvPatchField::updateCoeffs() -{ - if (this->updated()) - { - return; - } - - typedef GeometricField fieldType; - - // Since we're inside initEvaluate/evaluate there might be processor - // comms underway. Change the tag we use. - int oldTag = UPstream::msgType(); - UPstream::msgType() = oldTag+1; - - const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); - const fvMesh& nbrMesh = refCast(sampleMesh()); - - // Result of obtaining remote values - Field newValues; - - switch (mode()) - { - case NEARESTCELL: - { - const mapDistribute& distMap = mappedPatchBase::map(); - - if (interpolationScheme_ != interpolationCell::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& interp = interpolator(); - - newValues.setSize(samples.size(), pTraits::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: case NEARESTPATCHFACEAMI: - { - const label nbrPatchID = - nbrMesh.boundaryMesh().findPatchID(samplePatch()); - if (nbrPatchID < 0) - { - FatalErrorIn - ( - "void " - "selfContainedMappedFixedValueFvPatchField::" - "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]; - this->distribute(newValues); - - break; - } - case NEARESTFACE: - { - Field allValues(nbrMesh.nFaces(), pTraits::zero); - - const fieldType& nbrField = sampleField(); - - forAll(nbrField.boundaryField(), patchI) - { - const fvPatchField& pf = - nbrField.boundaryField()[patchI]; - label faceStart = pf.patch().start(); - - forAll(pf, faceI) - { - allValues[faceStart++] = pf[faceI]; - } - } - - this->distribute(allValues); - - newValues.transfer(allValues); - - break; - } - default: - { - FatalErrorIn - ( - "selfContainedMappedFixedValueFvPatchField::" - "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<< "selfContainedMapped on field:" - << this->dimensionedInternalField().name() - << " patch:" << this->patch().name() - << " avg:" << gAverage(*this) - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << endl; - } - - // Restore tag - UPstream::msgType() = oldTag; - - fixedValueFvPatchField::updateCoeffs(); -} - - -template -void selfContainedMappedFixedValueFvPatchField::write(Ostream& os) -const -{ - fvPatchField::write(os); - mappedPatchBase::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 - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.H deleted file mode 100644 index 030f9a9d44..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.H +++ /dev/null @@ -1,211 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ 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 . - -Class - Foam::selfContainedMappedFixedValueFvPatchField - -Description - Self-contained version of mapped. Does not use information on - patch, instead holds it locally (and possibly duplicate) so use - normal mapped in preference and only use this if you cannot - change the underlying patch type to mapped. - -SourceFiles - selfContainedMappedFixedValueFvPatchField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef selfContainedMappedFixedValueFvPatchField_H -#define selfContainedMappedFixedValueFvPatchField_H - -#include "mappedPatchBase.H" -#include "fixedValueFvPatchFields.H" -#include "interpolation.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class selfContainedMappedFixedValueFvPatchField Declaration -\*---------------------------------------------------------------------------*/ - -template -class selfContainedMappedFixedValueFvPatchField -: - public mappedPatchBase, - public fixedValueFvPatchField -{ - // 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 > interpolator_; - - - // Private Member Functions - - //- Field to sample. Either on my or nbr mesh - const GeometricField& sampleField() const; - - //- Access the interpolation method - const interpolation& interpolator() const; - - -public: - - //- Runtime type information - TypeName("selfContainedMapped"); - - - // Constructors - - //- Construct from patch and internal field - selfContainedMappedFixedValueFvPatchField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - selfContainedMappedFixedValueFvPatchField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct from patch, internal field and distance for normal type - // sampling - selfContainedMappedFixedValueFvPatchField - ( - const fvPatch&, - const DimensionedField&, - - // mappedPatchBase - 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 - // selfContainedMappedFixedValueFvPatchField - // onto a new patch - selfContainedMappedFixedValueFvPatchField - ( - const selfContainedMappedFixedValueFvPatchField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - selfContainedMappedFixedValueFvPatchField - ( - const selfContainedMappedFixedValueFvPatchField& - ); - - //- Construct and return a clone - virtual tmp > clone() const - { - return tmp > - ( - new selfContainedMappedFixedValueFvPatchField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - selfContainedMappedFixedValueFvPatchField - ( - const selfContainedMappedFixedValueFvPatchField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp > clone - ( - const DimensionedField& iF - ) const - { - return tmp > - ( - new selfContainedMappedFixedValueFvPatchField - ( - *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 "selfContainedMappedFixedValueFvPatchField.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.C deleted file mode 100644 index 5f4fdd7ad5..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ 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 . - -\*---------------------------------------------------------------------------*/ - -#include "selfContainedMappedFixedValueFvPatchFields.H" -#include "volMesh.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makePatchFields(selfContainedMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.H b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.H deleted file mode 100644 index 7efd9dbace..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFields.H +++ /dev/null @@ -1,49 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ 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 . - -\*---------------------------------------------------------------------------*/ - -#ifndef selfContainedMappedFixedValueFvPatchFields_H -#define selfContainedMappedFixedValueFvPatchFields_H - -#include "selfContainedMappedFixedValueFvPatchField.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeFieldTypedefs(selfContainedMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFieldsFwd.H b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFieldsFwd.H deleted file mode 100644 index 0a892391c9..0000000000 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchFieldsFwd.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ 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 . - -\*---------------------------------------------------------------------------*/ - -#ifndef selfContainedMappedFixedValueFvPatchFieldsFwd_H -#define selfContainedMappedFixedValueFvPatchFieldsFwd_H - -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template class selfContainedMappedFixedValueFvPatchField; - -makePatchTypeFieldTypedefs(selfContainedMappedFixedValue); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //