diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/Make/files b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/files similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/Make/files rename to applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/files diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/options similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/Make/options rename to applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/options diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C rename to applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H similarity index 98% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H rename to applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index 3ba68612dc..bf094d3826 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -42,6 +42,9 @@ Description KName none; } +Note: + Only the pair h, Ta or q can be specified in the dictionary. + SourceFiles externalWallHeatFluxTemperatureFvPatchScalarField.C diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C rename to applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatch/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H rename to applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C deleted file mode 100644 index 03d932975f..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ /dev/null @@ -1,271 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "externalWallHeatFluxTemperatureFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "directMappedPatchBase.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -template<> -const char* -NamedEnum -::names[]= -{ - "fixed_heat_flux", - "fixed_heat_transfer_coefficient", - "unknown" -}; - -const NamedEnum -< - externalWallHeatFluxTemperatureFvPatchScalarField::operationMode, 3 -> -externalWallHeatFluxTemperatureFvPatchScalarField::operationModeNames; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::externalWallHeatFluxTemperatureFvPatchScalarField:: -externalWallHeatFluxTemperatureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), "undefined", "undefined-K"), - oldMode_(unknown), - q_(p.size(), 0.0), - h_(p.size(), 0.0), - Ta_(p.size(), 0.0) -{ - this->refValue() = 0.0; - this->refGrad() = 0.0; - this->valueFraction() = 1.0; -} - - -Foam::externalWallHeatFluxTemperatureFvPatchScalarField:: -externalWallHeatFluxTemperatureFvPatchScalarField -( - const externalWallHeatFluxTemperatureFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - mixedFvPatchScalarField(ptf, p, iF, mapper), - temperatureCoupledBase(patch(), ptf.KMethod(), ptf.KName()), - oldMode_(unknown), - q_(ptf.q_, mapper), - h_(ptf.h_, mapper), - Ta_(ptf.Ta_, mapper) -{} - - -Foam::externalWallHeatFluxTemperatureFvPatchScalarField:: -externalWallHeatFluxTemperatureFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), dict), - oldMode_(unknown), - q_(p.size(), 0.0), - h_(p.size(), 0.0), - Ta_(p.size(), 0.0) -{ - if (dict.found("q") && !dict.found("h") && !dict.found("Ta")) - { - oldMode_ = fixedHeatFlux; - q_ = scalarField("q", dict, p.size()); - } - else if(dict.found("h") && dict.found("Ta") && !dict.found("q")) - { - oldMode_ = fixedHeatTransferCoeff; - h_ = scalarField("h", dict, p.size()); - Ta_ = scalarField("Ta", dict, p.size()); - } - else - { - FatalErrorIn - ( - "externalWallHeatFluxTemperatureFvPatchScalarField::" - "externalWallHeatFluxTemperatureFvPatchScalarField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField& iF,\n" - " const dictionary& dict\n" - ")\n" - ) << "\n patch type '" << p.type() - << "' either q or h and Ta were not found '" - << "\n for patch " << p.name() - << " of field " << dimensionedInternalField().name() - << " in file " << dimensionedInternalField().objectPath() - << exit(FatalError); - } - - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); - - if (dict.found("refValue")) - { - // Full restart - refValue() = scalarField("refValue", dict, p.size()); - refGrad() = scalarField("refGradient", dict, p.size()); - valueFraction() = scalarField("valueFraction", dict, p.size()); - } - else - { - // Start from user entered data. Assume fixedValue. - refValue() = *this; - refGrad() = 0.0; - valueFraction() = 1.0; - } -} - - -Foam::externalWallHeatFluxTemperatureFvPatchScalarField:: -externalWallHeatFluxTemperatureFvPatchScalarField -( - const externalWallHeatFluxTemperatureFvPatchScalarField& tppsf -) -: - mixedFvPatchScalarField(tppsf), - temperatureCoupledBase(tppsf), - oldMode_(unknown), - q_(tppsf.q_), - h_(tppsf.h_), - Ta_(tppsf.Ta_) -{} - - -Foam::externalWallHeatFluxTemperatureFvPatchScalarField:: -externalWallHeatFluxTemperatureFvPatchScalarField -( - const externalWallHeatFluxTemperatureFvPatchScalarField& tppsf, - const DimensionedField& iF -) -: - mixedFvPatchScalarField(tppsf, iF), - temperatureCoupledBase(patch(), tppsf.KMethod(), tppsf.KName()), - oldMode_(tppsf.oldMode_), - q_(tppsf.q_), - h_(tppsf.h_), - Ta_(tppsf.Ta_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - if(oldMode_ == fixedHeatFlux) - { - this->refGrad() = q_/K(*this); - this->refValue() = 0.0; - this->valueFraction() = 0.0; - } - else if(oldMode_ == fixedHeatTransferCoeff) - { - this->refGrad() = (Ta_ - *this)*h_/K(*this); - this->refValue() = 0.0; - this->valueFraction() = 0.0; - } - else - { - FatalErrorIn - ( - "externalWallHeatFluxTemperatureFvPatchScalarField" - "::updateCoeffs()" - ) << "Illegal mode " << operationModeNames[oldMode_] - << exit(FatalError); - } - - mixedFvPatchScalarField::updateCoeffs(); - - if (debug) - { - scalar Q = gSum(K(*this)*patch().magSf()*snGrad()); - - Info<< patch().boundaryMesh().mesh().name() << ':' - << patch().name() << ':' - << this->dimensionedInternalField().name() << " :" - << " heatFlux:" << Q - << " walltemperature " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) - << endl; - } -} - - -void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write -( - Ostream& os -) const -{ - mixedFvPatchScalarField::write(os); - temperatureCoupledBase::write(os); - q_.writeEntry("q", os); - h_.writeEntry("h", os); - Ta_.writeEntry("Ta", os); - this->writeEntry("value", os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - makePatchTypeField - ( - fvPatchScalarField, - externalWallHeatFluxTemperatureFvPatchScalarField - ); -} - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H deleted file mode 100644 index 3ba68612dc..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ /dev/null @@ -1,188 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2011 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 . - -Class - externalWallHeatFluxTemperatureFvPatchScalarField - -Description - Heat flux boundary condition for temperature on external wall. - - If h and Ta are specified then fixed_heat_transfer_coefficient mode is used - If q is specified then fixed_heat_flux is used. - - Example usage: - myWallPatch - { - type externalWallHeatFluxTemperature; - K solidThermo; // solidThermo or lookup - q uniform 1000; // Heat flux / [W/m2] - Ta uniform 300.0; // Tambient temperature /[K] - h uniform 10.0; // Heat transfer coeff /[W/Km2] - value uniform 300.0; // Initial temperature / [K] - KName none; - } - - -SourceFiles - externalWallHeatFluxTemperatureFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H -#define solidWallHeatFluxTemperatureFvPatchScalarField_H - -//#include "fixedGradientFvPatchFields.H" - -#include "mixedFvPatchFields.H" -#include "temperatureCoupledBase.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class externalWallHeatFluxTemperatureFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class externalWallHeatFluxTemperatureFvPatchScalarField -: - public mixedFvPatchScalarField, - public temperatureCoupledBase -{ - // Private data - - //- how to operate the BC - enum operationMode - { - fixedHeatFlux, - fixedHeatTransferCoeff, - unknown - }; - static const NamedEnum operationModeNames; - - //- Operation mode - operationMode oldMode_; - - //- Heat flux / [W/m2] - scalarField q_; - - //- Heat transfer coefficient / [W/m2K] - scalarField h_; - - //- Ambient temperature / [K] - scalarField Ta_; - - -public: - - //- Runtime type information - TypeName("externalWallHeatFluxTemperature"); - - - // Constructors - - //- Construct from patch and internal field - externalWallHeatFluxTemperatureFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - externalWallHeatFluxTemperatureFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // externalWallHeatFluxTemperatureFvPatchScalarField - // onto a new patch - externalWallHeatFluxTemperatureFvPatchScalarField - ( - const externalWallHeatFluxTemperatureFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct as copy - externalWallHeatFluxTemperatureFvPatchScalarField - ( - const externalWallHeatFluxTemperatureFvPatchScalarField& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new externalWallHeatFluxTemperatureFvPatchScalarField(*this) - ); - } - - //- Construct as copy setting internal field reference - externalWallHeatFluxTemperatureFvPatchScalarField - ( - const externalWallHeatFluxTemperatureFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new externalWallHeatFluxTemperatureFvPatchScalarField(*this, iF) - ); - } - - - // Member functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - // I-O - - //- Write - void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.C deleted file mode 100644 index 78db81c163..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.C +++ /dev/null @@ -1,257 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2011 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 2 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, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -\*---------------------------------------------------------------------------*/ - -#include "turbulentTemperatureCoupledMixedSTFvPatchScalarField.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "directMappedPatchBase.H" -/* -#include "mapDistribute.H" -#include "regionProperties.H" -#include "basicThermo.H" -#include "LESModel.H" -*/ -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -turbulentTemperatureCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureCoupledMixedSTFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), "undefined", "undefined-K"), - TnbrName_("undefined-Tnbr"), - QrNbrName_("undefined-QrNbr"), - QrName_("undefined-Qr") -{ - this->refValue() = 0.0; - this->refGrad() = 0.0; - this->valueFraction() = 1.0; -} - - -turbulentTemperatureCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureCoupledMixedSTFvPatchScalarField -( - const turbulentTemperatureCoupledMixedSTFvPatchScalarField& psf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - mixedFvPatchScalarField(psf, p, iF, mapper), - temperatureCoupledBase(patch(), psf.KMethod(), psf.KName()), - TnbrName_(psf.TnbrName_), - QrNbrName_(psf.QrNbrName_), - QrName_(psf.QrName_) -{} - - -turbulentTemperatureCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureCoupledMixedSTFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - mixedFvPatchScalarField(p, iF), - temperatureCoupledBase(patch(), dict), - TnbrName_(dict.lookup("Tnbr")), - QrNbrName_(dict.lookup("QrNbr")), - QrName_(dict.lookup("Qr")) -{ - if (!isA(this->patch().patch())) - { - FatalErrorIn - ( - "turbulentTemperatureCoupledMixedSTFvPatchScalarField::" - "turbulentTemperatureCoupledMixedSTFvPatchScalarField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField& iF,\n" - " const dictionary& dict\n" - ")\n" - ) << "\n patch type '" << p.type() - << "' not type '" << directMappedPatchBase::typeName << "'" - << "\n for patch " << p.name() - << " of field " << dimensionedInternalField().name() - << " in file " << dimensionedInternalField().objectPath() - << exit(FatalError); - } - - fvPatchScalarField::operator=(scalarField("value", dict, p.size())); - - if (dict.found("refValue")) - { - // Full restart - refValue() = scalarField("refValue", dict, p.size()); - refGrad() = scalarField("refGradient", dict, p.size()); - valueFraction() = scalarField("valueFraction", dict, p.size()); - } - else - { - // Start from user entered data. Assume fixedValue. - refValue() = *this; - refGrad() = 0.0; - valueFraction() = 1.0; - } -} - - -turbulentTemperatureCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureCoupledMixedSTFvPatchScalarField -( - const turbulentTemperatureCoupledMixedSTFvPatchScalarField& psf, - const DimensionedField& iF -) -: - mixedFvPatchScalarField(psf, iF), - temperatureCoupledBase(patch(), psf.KMethod(), psf.KName()), - TnbrName_(psf.TnbrName_), - QrNbrName_(psf.QrNbrName_), - QrName_(psf.QrName_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void turbulentTemperatureCoupledMixedSTFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - // Get the coupling information from the directMappedPatchBase - const directMappedPatchBase& mpp = - refCast(patch().patch()); - const polyMesh& nbrMesh = mpp.sampleMesh(); - const label samplePatchI = mpp.samplePolyPatch().index(); - const fvPatch& nbrPatch = - refCast(nbrMesh).boundary()[samplePatchI]; - - // Force recalculation of mapping and schedule - const mapDistribute& distMap = mpp.map(); - - scalarField Tc = patchInternalField(); - scalarField& Tp = *this; - - const turbulentTemperatureCoupledMixedSTFvPatchScalarField& - nbrField = refCast - - ( - nbrPatch.lookupPatchField(TnbrName_) - ); - - // Swap to obtain full local values of neighbour internal field - scalarField TcNbr = nbrField.patchInternalField(); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - TcNbr - ); - - // Swap to obtain full local values of neighbour K*delta - scalarField KDeltaNbr = nbrField.K(TcNbr)*nbrPatch.deltaCoeffs(); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - KDeltaNbr - ); - - scalarField KDelta = K(*this)*patch().deltaCoeffs(); - - scalarField Qr(Tp.size(), 0.0); - if (QrName_ != "none") - { - Qr = patch().lookupPatchField(QrName_); - } - - scalarField QrNbr(Tp.size(), 0.0); - if (QrNbrName_ != "none") - { - QrNbr = nbrPatch.lookupPatchField(QrNbrName_); - } - - scalarField alpha(KDeltaNbr - (Qr + QrNbr)/Tp); - - valueFraction() = alpha/(alpha + KDelta); - - refValue() = (KDeltaNbr*TcNbr)/alpha; - - mixedFvPatchScalarField::updateCoeffs(); -} - - -void turbulentTemperatureCoupledMixedSTFvPatchScalarField::write -( - Ostream& os -) const -{ - mixedFvPatchScalarField::write(os); - os.writeKeyword("Tnbr")<< TnbrName_ << token::END_STATEMENT << nl; - os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl; - os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; - temperatureCoupledBase::write(os); - //os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - turbulentTemperatureCoupledMixedSTFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.H deleted file mode 100644 index fbaac1a0f3..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/turbulentTemperatureCoupledMixedST/turbulentTemperatureCoupledMixedSTFvPatchScalarField.H +++ /dev/null @@ -1,187 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2010-2011 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 . - -Class - Foam:: - compressible:: - turbulentTemperatureCoupledMixedSTFvPatchScalarField - -Description - Mixed boundary condition for temperature, to be used for heat-transfer - on back-to-back baffles. - - Example usage: - myInterfacePatchName - { - type compressible::turbulentTemperatureCoupledMixedST; - TNbr T; // name of T field on neighbour region - K K; // or none. Name of thermal conductivity field. - Calculated from database if equal to 'none' - - QrNbr Qr; // or none. Name of Qr field on neighbour region - Qr Qr; // or none. Name of Qr field on local region - - value uniform 300; - } - - Needs to be on underlying directMapped(Wall)FvPatch. - - Note: runs in parallel with arbitrary decomposition. Uses directMapped - functionality to calculate exchange. - -SourceFiles - turbulentTemperatureCoupledMixedSTFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef turbulentTemperatureCoupledMixedSTFvPatchScalarField_H -#define turbulentTemperatureCoupledMixedSTFvPatchScalarField_H - -#include "mixedFvPatchFields.H" -#include "temperatureCoupledBase.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class turbulentTemperatureCoupledMixedSTFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class turbulentTemperatureCoupledMixedSTFvPatchScalarField -: - public mixedFvPatchScalarField, - public temperatureCoupledBase -{ - // Private data - - //- Name of field on the neighbour region - const word TnbrName_; - - //- Name of the radiative heat flux in the neighbout region - const word QrNbrName_; - - //- Name of the radiative heat flux in local region - const word QrName_; - - //- Name of thermal conductivity field - //const word KName_; - - -public: - - //- Runtime type information - TypeName("compressible::turbulentTemperatureCoupledMixedST"); - - - // Constructors - - //- Construct from patch and internal field - turbulentTemperatureCoupledMixedSTFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - turbulentTemperatureCoupledMixedSTFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a - // new patch - turbulentTemperatureCoupledMixedSTFvPatchScalarField - ( - const - turbulentTemperatureCoupledMixedSTFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Construct and return a clone - virtual tmp clone() const - { - return tmp - ( - new turbulentTemperatureCoupledMixedSTFvPatchScalarField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - turbulentTemperatureCoupledMixedSTFvPatchScalarField - ( - const turbulentTemperatureCoupledMixedSTFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new turbulentTemperatureCoupledMixedSTFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Get corresponding K field - //tmp K() const; - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/preProcessing/faceAgglomerate/Make/files b/applications/utilities/preProcessing/faceAgglomerate/Make/files new file mode 100644 index 0000000000..34bd95a842 --- /dev/null +++ b/applications/utilities/preProcessing/faceAgglomerate/Make/files @@ -0,0 +1,3 @@ +faceAgglomerate.C + +EXE = $(FOAM_APPBIN)/faceAgglomerate diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C new file mode 100644 index 0000000000..f71df8c6f3 --- /dev/null +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C @@ -0,0 +1,192 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 . + +Application + faceAgglomerate + +Description + + Agglomerate boundary faces using the pairPatchAgglomeration algorithm. + It writes a map from the fine to coarse grid. + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "fvMesh.H" +#include "Time.H" +#include "volFields.H" +#include "CompactListList.H" +#include "unitConversion.H" +#include "pairPatchAgglomeration.H" +#include "labelListIOList.H" +#include "syncTools.H" + +using namespace Foam; + +// Main program: + +int main(int argc, char *argv[]) +{ + + #include "addRegionOption.H" + #include "setRootCase.H" + #include "createTime.H" + #include "createNamedMesh.H" + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + labelListIOList finalAgglom + ( + IOobject + ( + "finalAgglom", + mesh.facesInstance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + patches.size() + ); + + + // Read view factor dictionary + IOdictionary viewFactorDict + ( + IOobject + ( + "viewFactorsDict", + runTime.constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + bool writeAgglo = + readBool(viewFactorDict.lookup("writeFacesAgglomeration")); + + const polyBoundaryMesh& boundary = mesh.boundaryMesh(); + + forAll(boundary, patchId) + { + const polyPatch& pp = boundary[patchId]; + + label patchI = pp.index(); + finalAgglom[patchI].setSize(pp.size(), 0); + + if (pp.size() > 0 && !pp.coupled()) + { + if (viewFactorDict.found(pp.name())) + { + Info << "\nAgglomerating name : " << pp.name() << endl; + pairPatchAgglomeration agglomObject + ( + pp, + viewFactorDict.subDict(pp.name()) + ); + agglomObject.agglomerate(); + finalAgglom[patchI] = + agglomObject.restrictTopBottomAddressing(); + } + else + { + FatalErrorIn + ( + "main(int argc, char *argv[])" + ) << pp.name() + << " not found in dictionary : " + << viewFactorDict.name() + << exit(FatalError); + } + } + } + + // Sync agglomeration across coupled patches + labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces(), -1); + + forAll(boundary, patchId) + { + const polyPatch& pp = boundary[patchId]; + if (pp.coupled()) + { + finalAgglom[patchId] = identity(pp.size()); + forAll(pp, i) + { + nbrAgglom[pp.start()-mesh.nInternalFaces()+i] = + finalAgglom[patchId][i]; + } + } + } + + syncTools::swapBoundaryFaceList(mesh, nbrAgglom); + forAll(boundary, patchId) + { + const polyPatch& pp = boundary[patchId]; + if (pp.coupled() && !refCast(pp).owner()) + { + forAll(pp, i) + { + finalAgglom[patchId][i] = + nbrAgglom[pp.start()-mesh.nInternalFaces()+i]; + } + } + } + + finalAgglom.write(); + + if (writeAgglo) + { + volScalarField facesAgglomeration + ( + IOobject + ( + "facesAgglomeration", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("facesAgglomeration", dimless, 0) + ); + + forAll(boundary, patchId) + { + + fvPatchScalarField& bFacesAgglomeration = + facesAgglomeration.boundaryField()[patchId]; + + forAll(bFacesAgglomeration, j) + { + bFacesAgglomeration[j] = finalAgglom[patchId][j]; + } + } + + Info << "\nWriting facesAgglomeration..." << endl; + facesAgglomeration.write(); + } + + Info<< "End\n" << endl; + return 0; +} diff --git a/applications/utilities/preProcessing/viewFactorGen/Make/files b/applications/utilities/preProcessing/viewFactorGen/Make/files new file mode 100644 index 0000000000..aa0bc4481e --- /dev/null +++ b/applications/utilities/preProcessing/viewFactorGen/Make/files @@ -0,0 +1,3 @@ +viewFactorsGen.C + +EXE = $(FOAM_APPBIN)/viewFactorsGen diff --git a/applications/utilities/preProcessing/viewFactorGen/Make/options b/applications/utilities/preProcessing/viewFactorGen/Make/options new file mode 100644 index 0000000000..f209077c79 --- /dev/null +++ b/applications/utilities/preProcessing/viewFactorGen/Make/options @@ -0,0 +1,16 @@ +EXE_INC = \ + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/parallel/distributed/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/OpenFOAM/lnInclude + +EXE_LIBS = \ + -lmeshTools \ + -lfiniteVolume \ + -lOpenFOAM \ + -lmeshTools \ + -ltriSurface \ + -ldistributed \ + -lradiationModels + diff --git a/applications/utilities/preProcessing/viewFactorGen/searchingEngine.H b/applications/utilities/preProcessing/viewFactorGen/searchingEngine.H new file mode 100644 index 0000000000..17de4fbf6c --- /dev/null +++ b/applications/utilities/preProcessing/viewFactorGen/searchingEngine.H @@ -0,0 +1,54 @@ +Random rndGen(653213); + +// Determine mesh bounding boxes: +List meshBb +( + 1, + treeBoundBox + ( + boundBox(coarseMesh.points(), false) + ).extend(rndGen, 1E-3) +); + +// Dummy bounds dictionary +dictionary dict; +dict.add("bounds", meshBb); +dict.add +( + "distributionType", + distributedTriSurfaceMesh::distributionTypeNames_ + [ + distributedTriSurfaceMesh::FROZEN + ] +); +dict.add("mergeDistance", SMALL); + +labelHashSet includePatches; +forAll(patches, patchI) // +{ + if (!isA(patches[patchI])) + { + includePatches.insert(patchI); + } +} + +distributedTriSurfaceMesh surfacesMesh +( + IOobject + ( + "wallSurface.stl", + runTime.constant(), // directory + "triSurface", // instance + runTime, // registry + IOobject::NO_READ, + IOobject::NO_WRITE + ), + triSurfaceTools::triangulate + ( + patches, + includePatches + ), + dict +); + +//surfacesMesh.searchableSurface::write(); diff --git a/applications/utilities/preProcessing/viewFactorGen/shootRays.H b/applications/utilities/preProcessing/viewFactorGen/shootRays.H new file mode 100644 index 0000000000..75eca8bc28 --- /dev/null +++ b/applications/utilities/preProcessing/viewFactorGen/shootRays.H @@ -0,0 +1,97 @@ +// All rays expressed as start face (local) index end end face (global) +// Pre-size by assuming a certain percentage is visible. + +// Maximum lenght for dynamicList +const label maxDynListLenght = 10000; +//label lenghtCount = 0; + +for (label procI = 0; procI < Pstream::nProcs(); procI++) +{ + // Shoot rays from me to procI. Note that even if processor has + // 0 faces we still need to call findLine to keep calls synced. + + DynamicField start(coarseMesh.nFaces()); + DynamicField end(start.size()); + DynamicList