diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C deleted file mode 100644 index 7b3923139b4584f1044e6c60f9a54bf873b93615..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C +++ /dev/null @@ -1,68 +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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "regionProperties.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::regionProperties::regionProperties(const Time& runTime) -: - IOdictionary - ( - IOobject - ( - "regionProperties", - runTime.time().constant(), - runTime.db(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ), - fluidRegionNames_(lookup("fluidRegionNames")), - solidRegionNames_(lookup("solidRegionNames")) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::regionProperties::~regionProperties() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -const Foam::List<Foam::word>& Foam::regionProperties::fluidRegionNames() const -{ - return fluidRegionNames_; -} - - -const Foam::List<Foam::word>& Foam::regionProperties::solidRegionNames() const -{ - return solidRegionNames_; -} - - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.H deleted file mode 100644 index 1c0f73a01563e469e458289be19ffa2037994872..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.H +++ /dev/null @@ -1,104 +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 <http://www.gnu.org/licenses/>. - -Class - regionProperties - -Description - Simple class to hold region information for coupled region simulations - -SourceFiles - regionProperties.C - -\*---------------------------------------------------------------------------*/ - -#ifndef regionProperties_H -#define regionProperties_H - -#include "IOdictionary.H" -#include "Time.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class regionProperties Declaration -\*---------------------------------------------------------------------------*/ - -class regionProperties -: - public IOdictionary -{ - // Private data - - //- List of the fluid region names - List<word> fluidRegionNames_; - - //- List of the solid region names - List<word> solidRegionNames_; - - - // Private Member Functions - - //- Disallow default bitwise copy construct - regionProperties(const regionProperties&); - - //- Disallow default bitwise assignment - void operator=(const regionProperties&); - - -public: - - // Constructors - - //- Construct from components - regionProperties(const Time& runTime); - - - //- Destructor - ~regionProperties(); - - - // Member Functions - - // Access - - //- Return const reference to the list of fluid region names - const List<word>& fluidRegionNames() const; - - //- Return const reference to the list of solid region names - const List<word>& solidRegionNames() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C deleted file mode 100644 index 20c05456095b41c336264d380fac68061c5807bb..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.C +++ /dev/null @@ -1,308 +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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "turbulentTemperatureCoupledBaffleFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "mappedPatchBase.H" -#include "regionProperties.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::interfaceOwner -( - const polyMesh& nbrRegion, - const polyPatch& nbrPatch -) const -{ - const fvMesh& myRegion = patch().boundaryMesh().mesh(); - - if (nbrRegion.name() == myRegion.name()) - { - return patch().index() < nbrPatch.index(); - } - else - { - const regionProperties& props = - myRegion.objectRegistry::parent().lookupObject<regionProperties> - ( - "regionProperties" - ); - - label myIndex = findIndex(props.fluidRegionNames(), myRegion.name()); - if (myIndex == -1) - { - label i = findIndex(props.solidRegionNames(), myRegion.name()); - - if (i == -1) - { - FatalErrorIn - ( - "turbulentTemperatureCoupledBaffleFvPatchScalarField" - "::interfaceOwner(const polyMesh&" - ", const polyPatch&)const" - ) << "Cannot find region " << myRegion.name() - << " neither in fluids " << props.fluidRegionNames() - << " nor in solids " << props.solidRegionNames() - << exit(FatalError); - } - myIndex = props.fluidRegionNames().size() + i; - } - label nbrIndex = findIndex - ( - props.fluidRegionNames(), - nbrRegion.name() - ); - if (nbrIndex == -1) - { - label i = findIndex(props.solidRegionNames(), nbrRegion.name()); - - if (i == -1) - { - FatalErrorIn - ( - "coupleManager::interfaceOwner" - "(const polyMesh&, const polyPatch&) const" - ) << "Cannot find region " << nbrRegion.name() - << " neither in fluids " << props.fluidRegionNames() - << " nor in solids " << props.solidRegionNames() - << exit(FatalError); - } - nbrIndex = props.fluidRegionNames().size() + i; - } - - return myIndex < nbrIndex; - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField:: -turbulentTemperatureCoupledBaffleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), "undefined", "undefined-K"), - neighbourFieldName_("undefined-neighbourFieldName") -{} - - -Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField:: -turbulentTemperatureCoupledBaffleFvPatchScalarField -( - const turbulentTemperatureCoupledBaffleFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()), - neighbourFieldName_(ptf.neighbourFieldName_) -{} - - -Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField:: -turbulentTemperatureCoupledBaffleFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict), - temperatureCoupledBase(patch(), dict), - neighbourFieldName_(dict.lookup("neighbourFieldName")) -{ - if (!isA<mappedPatchBase>(this->patch().patch())) - { - FatalErrorIn - ( - "turbulentTemperatureCoupledBaffleFvPatchScalarField::" - "turbulentTemperatureCoupledBaffleFvPatchScalarField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField<scalar, volMesh>& iF,\n" - " const dictionary& dict\n" - ")\n" - ) << "\n patch type '" << p.type() - << "' not type '" << mappedPatchBase::typeName << "'" - << "\n for patch " << p.name() - << " of field " << dimensionedInternalField().name() - << " in file " << dimensionedInternalField().objectPath() - << exit(FatalError); - } -} - - -Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField:: -turbulentTemperatureCoupledBaffleFvPatchScalarField -( - const turbulentTemperatureCoupledBaffleFvPatchScalarField& wtcsf, - const DimensionedField<scalar, volMesh>& iF -) -: - fixedValueFvPatchScalarField(wtcsf, iF), - temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.KName()), - neighbourFieldName_(wtcsf.neighbourFieldName_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - // 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; - - // Get the coupling information from the mappedPatchBase - const mappedPatchBase& mpp = refCast<const mappedPatchBase> - ( - this->patch().patch() - ); - const polyMesh& nbrMesh = mpp.sampleMesh(); - const fvPatch& nbrPatch = refCast<const fvMesh> - ( - nbrMesh - ).boundary()[mpp.samplePolyPatch().index()]; - - // Force recalculation of mapping and schedule - const mapDistribute& distMap = mpp.map(); - (void)distMap.schedule(); - - tmp<scalarField> intFld = patchInternalField(); - - if (interfaceOwner(nbrMesh, nbrPatch.patch())) - { - // Note: other side information could be cached - it only needs - // to be updated the first time round the iteration (i.e. when - // switching regions) but unfortunately we don't have this information. - - - // Calculate the temperature by harmonic averaging - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - const turbulentTemperatureCoupledBaffleFvPatchScalarField& nbrField = - refCast<const turbulentTemperatureCoupledBaffleFvPatchScalarField> - ( - nbrPatch.lookupPatchField<volScalarField, scalar> - ( - neighbourFieldName_ - ) - ); - - // Swap to obtain full local values of neighbour internal field - scalarField nbrIntFld(nbrField.patchInternalField()); - distMap.distribute(nbrIntFld); - - // Swap to obtain full local values of neighbour K*delta - scalarField nbrKDelta(nbrField.K(nbrField)*nbrPatch.deltaCoeffs()); - distMap.distribute(nbrKDelta); - - tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs(); - - // Calculate common wall temperature. Reuse *this to store common value. - scalarField Twall - ( - (myKDelta()*intFld() + nbrKDelta*nbrIntFld) - / (myKDelta() + nbrKDelta) - ); - // Assign to me - fvPatchScalarField::operator=(Twall); - // Distribute back and assign to neighbour - distMap.reverseDistribute(nbrField.size(), Twall); - const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&> - ( - nbrField - ).fvPatchScalarField::operator=(Twall); - } - - if (debug) - { - //tmp<scalarField> normalGradient = - // (*this-intFld()) - // * patch().deltaCoeffs(); - - scalar Q = gSum(K(*this)*patch().magSf()*snGrad()); - - Info<< patch().boundaryMesh().mesh().name() << ':' - << patch().name() << ':' - << this->dimensionedInternalField().name() << " <- " - << nbrMesh.name() << ':' - << nbrPatch.name() << ':' - << this->dimensionedInternalField().name() << " :" - << " heat[W]:" << Q - << " walltemperature " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) - << endl; - } - - // Restore tag - UPstream::msgType() = oldTag; - - fixedValueFvPatchScalarField::updateCoeffs(); -} - - -void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::write -( - Ostream& os -) const -{ - fixedValueFvPatchScalarField::write(os); - os.writeKeyword("neighbourFieldName")<< neighbourFieldName_ - << token::END_STATEMENT << nl; - temperatureCoupledBase::write(os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -makePatchTypeField -( - fvPatchScalarField, - turbulentTemperatureCoupledBaffleFvPatchScalarField -); - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H deleted file mode 100644 index 0854f136393e87afaf2d1e92ac2bbe074840aa44..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupledBaffleFvPatchScalarField.H +++ /dev/null @@ -1,179 +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 <http://www.gnu.org/licenses/>. - -Class - turbulentTemperatureCoupledBaffleFvPatchScalarField - -Description - Harmonic fixed value boundary condition for temperature, to be used - for heat-transfer on back-to-back baffles. - - If my temperature is T1, heat conductivity K1 and neighbour is T2,K2 - - both sides get fixedValue (K1/dx1*T1 + K2/dx2*T2)/(K1/dx1+K2/dx2) - - Example usage: - myInterfacePatchName - { - type compressible::turbulentTemperatureCoupledBaffle; - neighbourFieldName T; - K lookup; - KName K; // or none - value uniform 300; - } - - Needs to be on underlying mapped(Wall)FvPatch. - - Note: see temperatureCoupledBase on ways to specify K. - - Note: runs in parallel with arbitrary decomposition. Uses mapped - functionality to calculate exchange. - - Note: lags interface data so both sides use same data. - - problem: schedule to calculate average would interfere - with standard processor swaps. - - so: updateCoeffs sets both to same Twall. Only need to do - this for last outer iteration but don't have access to this. - -SourceFiles - turbulentTemperatureCoupledBaffleFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef turbulentTemperatureCoupledBaffleFvPatchScalarField_H -#define turbulentTemperatureCoupledBaffleFvPatchScalarField_H - -#include "fixedValueFvPatchFields.H" -#include "temperatureCoupledBase.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class turbulentTemperatureCoupledBaffleFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class turbulentTemperatureCoupledBaffleFvPatchScalarField -: - public fixedValueFvPatchScalarField, - public temperatureCoupledBase -{ - // Private data - - //- Name of field on the neighbour region - const word neighbourFieldName_; - - - // Private Member Functions - - //- Am I or neighbour owner of interface - bool interfaceOwner(const polyMesh&, const polyPatch&) const; - - -public: - - //- Runtime type information - TypeName("compressible::turbulentTemperatureCoupledBaffle"); - - - // Constructors - - //- Construct from patch and internal field - turbulentTemperatureCoupledBaffleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - turbulentTemperatureCoupledBaffleFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given - // turbulentTemperatureCoupledBaffleFvPatchScalarField onto a new patch - turbulentTemperatureCoupledBaffleFvPatchScalarField - ( - const turbulentTemperatureCoupledBaffleFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new turbulentTemperatureCoupledBaffleFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - turbulentTemperatureCoupledBaffleFvPatchScalarField - ( - const turbulentTemperatureCoupledBaffleFvPatchScalarField&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp<fvPatchScalarField> clone - ( - const DimensionedField<scalar, volMesh>& iF - ) const - { - return tmp<fvPatchScalarField> - ( - new turbulentTemperatureCoupledBaffleFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //