diff --git a/applications/solvers/combustion/fireFoam/UEqn.H b/applications/solvers/combustion/fireFoam/UEqn.H index a77c262831843ec2d596e171fb0170d532680513..c4a865300d2b26df03a76af95d0710d60a9f5818 100644 --- a/applications/solvers/combustion/fireFoam/UEqn.H +++ b/applications/solvers/combustion/fireFoam/UEqn.H @@ -7,15 +7,18 @@ fvVectorMatrix UEqn UEqn.relax(); -solve -( - UEqn - == - fvc::reconstruct +if (pimple.momentumPredictor()) +{ + solve ( + UEqn + == + fvc::reconstruct ( - - ghf*fvc::snGrad(rho) - - fvc::snGrad(p_rgh) - )*mesh.magSf() - ) -); + ( + - ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) + )*mesh.magSf() + ) + ); +} diff --git a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options index 08bd50dbe804c1d80242e1a6fed5c199c100035b..d3a5f0beb2e62c8074256b164e87fc051336ef16 100644 --- a/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantBaffleSimpleFoam/Make/options @@ -16,4 +16,5 @@ EXE_LIBS = \ -lcompressibleRASModels \ -lfiniteVolume \ -lmeshTools \ - -lthermoBaffleModels + -lthermoBaffleModels \ + -lregionModels diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/files b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/files index 7e253a8b32fcced91764a31c83fd8c2d832b4642..8e2cf71dcc04053d99a43ddddc5d18be72a277c9 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/files +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/Make/files @@ -1,4 +1,3 @@ -turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libcoupledDerivedFvPatchFields diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index 03d932975f3b21a6082ad9c293fc3d0da3b0538c..66788946a4c5731008db52001a319c715cbaf3c0 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -202,7 +202,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() return; } - if(oldMode_ == fixedHeatFlux) + if (oldMode_ == fixedHeatFlux) { this->refGrad() = q_/K(*this); this->refValue() = 0.0; diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index 4156f784d6b2603f77f930a6c0e76035221be3fa..2df7613542a0c0e23201d9823f8fc70a3ea29e84 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -54,8 +54,6 @@ SourceFiles #ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H #define solidWallHeatFluxTemperatureFvPatchScalarField_H -//#include "fixedGradientFvPatchFields.H" - #include "mixedFvPatchFields.H" #include "temperatureCoupledBase.H" diff --git a/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/YhsEqn.H b/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/YhsEqn.H index ae70f37d8cd3293765fd439594e0c3bee7697f09..7606d9ce727e04c4e69d949ea2f425fa99c8384f 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/YhsEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/YhsEqn.H @@ -21,7 +21,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection volScalarField& Yi = Y[i]; fvScalarMatrix R = combustion->R(Yi); - solve + fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) @@ -29,10 +29,12 @@ tmp<fv::convectionScheme<scalar> > mvConvection == parcels.SYi(i, Yi) + surfaceFilm.Srho(i) - + R, - mesh.solver("Yi") + + R ); + YiEqn.relax(); + YiEqn.solve(mesh.solver("Yi")); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/reactingParcelFilmPyrolysisFoam.C b/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/reactingParcelFilmPyrolysisFoam.C index 6a46b2fbfb157574c01fabda9f7a8c406c0c8304..ac029bea8642464f79f80b037ee791504bc34a92 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/reactingParcelFilmPyrolysisFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmPyrolysisFoam/reactingParcelFilmPyrolysisFoam.C @@ -25,7 +25,7 @@ Application reactingParcelFilmPyrolysisFoam Description - Transient PISO solver for compressible, laminar or turbulent flow with + Transient PIMPLE solver for Fires and turbulent diffusion flames with reacting Lagrangian parcels, surface film and pyrolysis modelling. \*---------------------------------------------------------------------------*/ diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 817381be6194ccea96d53281d062c83777b8b642..0409816fa5452b9d69aec8b169ffe109d102e96b 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -120,6 +120,7 @@ $(derivedFvPatchFields)/directMappedFixedInternalValue/directMappedFixedInternal $(derivedFvPatchFields)/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C $(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C +$(derivedFvPatchFields)/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C $(derivedFvPatchFields)/fan/fanFvPatchFields.C $(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C similarity index 75% rename from src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C rename to src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C index cdfb8d7739afdffd89e45d0ece2b80c226d4fa36..3bc74d3e05d1d18fb3281b928e13265db6a0ab42 100644 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C @@ -23,20 +23,18 @@ License \*---------------------------------------------------------------------------*/ -#include "flowRateInletVelocityCoupledFvPatchVectorField.H" +#include "directMappedFlowRateFvPatchVectorField.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "directMappedPatchBase.H" #include "mapDistribute.H" -#include "regionProperties.H" -#include "basicThermo.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::flowRateInletVelocityCoupledFvPatchVectorField:: -flowRateInletVelocityCoupledFvPatchVectorField +Foam::directMappedFlowRateFvPatchVectorField:: +directMappedFlowRateFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF @@ -49,10 +47,10 @@ flowRateInletVelocityCoupledFvPatchVectorField {} -Foam::flowRateInletVelocityCoupledFvPatchVectorField:: -flowRateInletVelocityCoupledFvPatchVectorField +Foam::directMappedFlowRateFvPatchVectorField:: +directMappedFlowRateFvPatchVectorField ( - const flowRateInletVelocityCoupledFvPatchVectorField& ptf, + const directMappedFlowRateFvPatchVectorField& ptf, const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const fvPatchFieldMapper& mapper @@ -65,8 +63,8 @@ flowRateInletVelocityCoupledFvPatchVectorField {} -Foam::flowRateInletVelocityCoupledFvPatchVectorField:: -flowRateInletVelocityCoupledFvPatchVectorField +Foam::directMappedFlowRateFvPatchVectorField:: +directMappedFlowRateFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, @@ -80,10 +78,10 @@ flowRateInletVelocityCoupledFvPatchVectorField {} -Foam::flowRateInletVelocityCoupledFvPatchVectorField:: -flowRateInletVelocityCoupledFvPatchVectorField +Foam::directMappedFlowRateFvPatchVectorField:: +directMappedFlowRateFvPatchVectorField ( - const flowRateInletVelocityCoupledFvPatchVectorField& ptf + const directMappedFlowRateFvPatchVectorField& ptf ) : fixedValueFvPatchField<vector>(ptf), @@ -93,10 +91,10 @@ flowRateInletVelocityCoupledFvPatchVectorField {} -Foam::flowRateInletVelocityCoupledFvPatchVectorField:: -flowRateInletVelocityCoupledFvPatchVectorField +Foam::directMappedFlowRateFvPatchVectorField:: +directMappedFlowRateFvPatchVectorField ( - const flowRateInletVelocityCoupledFvPatchVectorField& ptf, + const directMappedFlowRateFvPatchVectorField& ptf, const DimensionedField<vector, volMesh>& iF ) : @@ -109,7 +107,7 @@ flowRateInletVelocityCoupledFvPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs() +void Foam::directMappedFlowRateFvPatchVectorField::updateCoeffs() { if (updated()) { @@ -127,35 +125,19 @@ void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs() nbrMesh ).boundary()[mpp.samplePolyPatch().index()]; - // Force recalculation of mapping and schedule - const mapDistribute& distMap = mpp.map(); - scalarList phi = nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - phi - ); + mpp.map().distribute(phi); + const surfaceScalarField& phiName = db().lookupObject<surfaceScalarField>(phiName_); - - // a simpler way of doing this would be nice - //scalar avgU = -flowRate_/gSum(patch().magSf()); scalarField U = -phi/patch().magSf(); vectorField n = patch().nf(); -// const surfaceScalarField& phi = -// db().lookupObject<surfaceScalarField>(phiName_); - if (phiName.dimensions() == dimVelocity*dimArea) { // volumetric flow-rate @@ -186,7 +168,7 @@ void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs() { FatalErrorIn ( - "flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()" + "directMappedFlowRateFvPatchVectorField::updateCoeffs()" ) << "dimensions of " << phiName_ << " are incorrect" << nl << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() @@ -198,7 +180,7 @@ void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs() } -void Foam::flowRateInletVelocityCoupledFvPatchVectorField::write +void Foam::directMappedFlowRateFvPatchVectorField::write ( Ostream& os ) const @@ -218,7 +200,7 @@ namespace Foam makePatchTypeField ( fvPatchVectorField, - flowRateInletVelocityCoupledFvPatchVectorField + directMappedFlowRateFvPatchVectorField ); } diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.H similarity index 77% rename from src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.H rename to src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.H index fcc252da1cb73599f098f63995b9d9604af60571..6ec8cac5fdedac5d636314d21f4aceb1b4dd1548 100644 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2006-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::flowRateInletVelocityCoupledFvPatchVectorField + Foam::directMappedFlowRateFvPatchVectorField Description Describes a volumetric/mass flow normal vector boundary condition by its @@ -41,7 +41,7 @@ Description @verbatim inlet { - type flowRateInletVelocityCoupled; + type directMappedFlowRate; phi phi; rho rho; neigPhi neigPhiName_; // Volumetric/mass flow rate @@ -50,18 +50,13 @@ Description } @endverbatim -Note - - The value is positive inwards - - May not work correctly for transonic inlets - - Strange behaviour with potentialFoam since the U equation is not solved - SourceFiles - flowRateInletVelocityCoupledFvPatchVectorField.C + directMappedFlowRateFvPatchVectorField.C \*---------------------------------------------------------------------------*/ -#ifndef flowRateInletVelocityCoupledFvPatchVectorField_H -#define flowRateInletVelocityCoupledFvPatchVectorField_H +#ifndef directMappedFlowRateFvPatchVectorField_H +#define directMappedFlowRateFvPatchVectorField_H #include "fixedValueFvPatchFields.H" @@ -73,7 +68,7 @@ namespace Foam Class flowRateInletVelocityFvPatch Declaration \*---------------------------------------------------------------------------*/ -class flowRateInletVelocityCoupledFvPatchVectorField +class directMappedFlowRateFvPatchVectorField : public fixedValueFvPatchVectorField { @@ -92,20 +87,20 @@ class flowRateInletVelocityCoupledFvPatchVectorField public: //- Runtime type information - TypeName("flowRateInletVelocityCoupled"); + TypeName("directMappedFlowRate"); // Constructors //- Construct from patch and internal field - flowRateInletVelocityCoupledFvPatchVectorField + directMappedFlowRateFvPatchVectorField ( const fvPatch&, const DimensionedField<vector, volMesh>& ); //- Construct from patch, internal field and dictionary - flowRateInletVelocityCoupledFvPatchVectorField + directMappedFlowRateFvPatchVectorField ( const fvPatch&, const DimensionedField<vector, volMesh>&, @@ -113,20 +108,20 @@ public: ); //- Construct by mapping given - // flowRateInletVelocityCoupledFvPatchVectorField + // directMappedFlowRateFvPatchVectorField // onto a new patch - flowRateInletVelocityCoupledFvPatchVectorField + directMappedFlowRateFvPatchVectorField ( - const flowRateInletVelocityCoupledFvPatchVectorField&, + const directMappedFlowRateFvPatchVectorField&, const fvPatch&, const DimensionedField<vector, volMesh>&, const fvPatchFieldMapper& ); //- Construct as copy - flowRateInletVelocityCoupledFvPatchVectorField + directMappedFlowRateFvPatchVectorField ( - const flowRateInletVelocityCoupledFvPatchVectorField& + const directMappedFlowRateFvPatchVectorField& ); //- Construct and return a clone @@ -134,14 +129,14 @@ public: { return tmp<fvPatchVectorField> ( - new flowRateInletVelocityCoupledFvPatchVectorField(*this) + new directMappedFlowRateFvPatchVectorField(*this) ); } //- Construct as copy setting internal field reference - flowRateInletVelocityCoupledFvPatchVectorField + directMappedFlowRateFvPatchVectorField ( - const flowRateInletVelocityCoupledFvPatchVectorField&, + const directMappedFlowRateFvPatchVectorField&, const DimensionedField<vector, volMesh>& ); @@ -153,7 +148,7 @@ public: { return tmp<fvPatchVectorField> ( - new flowRateInletVelocityCoupledFvPatchVectorField(*this, iF) + new directMappedFlowRateFvPatchVectorField(*this, iF) ); } diff --git a/src/regionModels/pyrolysisModels/Make/files b/src/regionModels/pyrolysisModels/Make/files index cc875c46ca7a15763cbdeeb44b98685ac83290be..6badede5bc3d8a69e112bed7139160d7ab01f0c9 100644 --- a/src/regionModels/pyrolysisModels/Make/files +++ b/src/regionModels/pyrolysisModels/Make/files @@ -1,11 +1,3 @@ -/* derived patches */ - -derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C -derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C -derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C -derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C - - /* Pyrolysis models */ pyrolysisModel/pyrolysisModel.C pyrolysisModel/pyrolysisModelNew.C diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C deleted file mode 100644 index b1c813fa09288cd5bc76c76992c84e87a5996dad..0000000000000000000000000000000000000000 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C +++ /dev/null @@ -1,327 +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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H" -#include "addToRunTimeSelectionTable.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "directMappedPatchBase.H" -#include "mapDistribute.H" -#include "basicThermo.H" -#include "LESModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2:: -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - mixedFvPatchScalarField(p, iF), - nbrFieldName_("undefined-nbrFieldName"), - KName_("undefined-K") -{ - this->refValue() = 0.0; - this->refGrad() = 0.0; - this->valueFraction() = 1.0; -} - - -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2:: -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 -( - const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - mixedFvPatchScalarField(ptf, p, iF, mapper), - nbrFieldName_(ptf.nbrFieldName_), - KName_(ptf.KName_) -{} - - -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2:: -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - mixedFvPatchScalarField(p, iF), - nbrFieldName_(dict.lookup("nbrFieldName")), - KName_(dict.lookup("K")) -{ - if (!isA<directMappedPatchBase>(this->patch().patch())) - { - FatalErrorIn - ( - "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::" - "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField<scalar, volMesh>& 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; - } -} - - -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2:: -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 -( - const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& wtcsf, - const DimensionedField<scalar, volMesh>& iF -) -: - mixedFvPatchScalarField(wtcsf, iF), - nbrFieldName_(wtcsf.nbrFieldName_), - KName_(wtcsf.KName_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp<scalarField> -turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K() const -{ - const fvMesh& mesh = patch().boundaryMesh().mesh(); - - if (KName_ == "none") - { - const LESModel& model = db().lookupObject<LESModel>("LESProperties"); - - const basicThermo& thermo = - db().lookupObject<basicThermo>("thermophysicalProperties"); - - return - model.alphaEff()().boundaryField()[patch().index()] - *thermo.Cp()().boundaryField()[patch().index()]; - } - else if (mesh.objectRegistry::foundObject<volScalarField>(KName_)) - { - return patch().lookupPatchField<volScalarField, scalar>(KName_); - } - else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_)) - { - const symmTensorField& KWall = - patch().lookupPatchField<volSymmTensorField, scalar>(KName_); - - vectorField n = patch().nf(); - - return n & KWall & n; - } - else - { - FatalErrorIn - ( - "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K()" - " const" - ) << "Did not find field " << KName_ - << " on mesh " << mesh.name() << " patch " << patch().name() - << endl - << "Please set 'K' to 'none', a valid volScalarField" - << " or a valid volSymmTensorField." << exit(FatalError); - - return scalarField(0); - } -} - - -void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::updateCoeffs() -{ - if (updated()) - { - return; - } - - // Get the coupling information from the directMappedPatchBase - const directMappedPatchBase& mpp = refCast<const directMappedPatchBase> - ( - 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(); - - tmp<scalarField> intFld = patchInternalField(); - - - // Calculate the temperature by harmonic averaging - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& nbrField = - refCast - < - const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - > - ( - nbrPatch.lookupPatchField<volScalarField, scalar> - ( - nbrFieldName_ - ) - ); - - // Swap to obtain full local values of neighbour internal field - scalarField nbrIntFld = nbrField.patchInternalField(); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - nbrIntFld - ); - - // Swap to obtain full local values of neighbour K*delta - scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs(); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - nbrKDelta - ); - - tmp<scalarField> myKDelta = K()*patch().deltaCoeffs(); - - - // Both sides agree on - // - temperature : (myKDelta*fld + nbrKDelta*nbrFld)/(myKDelta+nbrKDelta) - // - gradient : (temperature-fld)*delta - // We've got a degree of freedom in how to implement this in a mixed bc. - // (what gradient, what fixedValue and mixing coefficient) - // Two reasonable choices: - // 1. specify above temperature on one side (preferentially the high side) - // and above gradient on the other. So this will switch between pure - // fixedvalue and pure fixedgradient - // 2. specify gradient and temperature such that the equations are the - // same on both sides. This leads to the choice of - // - refGradient = zero gradient - // - refValue = neighbour value - // - mixFraction = nbrKDelta / (nbrKDelta + myKDelta()) - - - this->refValue() = nbrIntFld; - - this->refGrad() = 0.0; - - this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta()); - - mixedFvPatchScalarField::updateCoeffs(); - - - if (debug) - { - scalar Q = gSum(K()*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; - } -} - - -void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::write -( - Ostream& os -) const -{ - mixedFvPatchScalarField::write(os); - os.writeKeyword("nbrFieldName")<< nbrFieldName_ - << token::END_STATEMENT << nl; - os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam -} // End namespace LESModels - -// ************************************************************************* // diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H deleted file mode 100644 index 0545d5ab91bf53e476ba572e1af871a713c03c00..0000000000000000000000000000000000000000 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H +++ /dev/null @@ -1,190 +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 <http://www.gnu.org/licenses/>. - -Class - Foam::compressible::LESModels - - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - -Description - Mixed boundary condition for temperature, to be used for heat-transfer - on back-to-back baffles. - - If my temperature is T1, neighbour is T2: - - T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient. - - - Example usage: - myInterfacePatchName - { - type compressible::turbulentTemperatureCoupledBaffleMixed; - nbrFieldName T; - K K; // or none - value uniform 300; - } - - Needs to be on underlying directMapped(Wall)FvPatch. - - Note: if K is "none" looks up RASModel and basicThermo, otherwise expects - the solver to calculate a 'K' field. - - Note: runs in parallel with arbitrary decomposition. Uses directMapped - 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 - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C - -\*---------------------------------------------------------------------------*/ - -#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H -#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H - -#include "mixedFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ -namespace LESModels -{ - -/*---------------------------------------------------------------------------*\ - Class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 Declaration -\*---------------------------------------------------------------------------*/ - -class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 -: - public mixedFvPatchScalarField -{ - // Private data - - //- Name of field on the neighbour region - const word nbrFieldName_; - - //- Name of thermal conductivity field - const word KName_; - - -public: - - //- Runtime type information - TypeName("compressible::turbulentTemperatureCoupledBaffleMixed2"); - - - // Constructors - - //- Construct from patch and internal field - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given - // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 onto a - // new patch - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - ( - const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - ( - const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&, - 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 turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Get corresponding K field - tmp<scalarField> K() const; - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace LESModels -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C deleted file mode 100644 index 3f46e158b5436ec209c4c1a903e0837bd7b0b7ec..0000000000000000000000000000000000000000 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C +++ /dev/null @@ -1,539 +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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.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 -{ - -template<> -const char* -NamedEnum -< - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: - operationMode, - 4 ->::names[] = -{ - "radiative_flux_from_neighbouring_region", - "radiative_flux_from_this_region", - "no_radiation_contribution", - "unknown" -}; - -const NamedEnum -< - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: - operationMode, - 4 -> -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: -operationModeNames; - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF -) -: - mixedFvPatchScalarField(p, iF), - neighbourFieldName_("undefined-neighbourFieldName"), - neighbourFieldRadiativeName_("undefined-neigbourFieldRadiativeName"), - fieldRadiativeName_("undefined-fieldRadiativeName"), - KName_("undefined-K"), - oldMode_(unknown) -{ - this->refValue() = 0.0; - this->refGrad() = 0.0; - this->valueFraction() = 1.0; -} - - -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField -( - const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const fvPatchFieldMapper& mapper -) -: - mixedFvPatchScalarField(ptf, p, iF, mapper), - neighbourFieldName_(ptf.neighbourFieldName_), - neighbourFieldRadiativeName_(ptf.neighbourFieldRadiativeName_), - fieldRadiativeName_(ptf.fieldRadiativeName_), - KName_(ptf.KName_), - oldMode_(ptf.oldMode_) -{} - - -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField -( - const fvPatch& p, - const DimensionedField<scalar, volMesh>& iF, - const dictionary& dict -) -: - mixedFvPatchScalarField(p, iF), - neighbourFieldName_(dict.lookup("neighbourFieldName")), - neighbourFieldRadiativeName_(dict.lookup("neighbourFieldRadiativeName")), - fieldRadiativeName_(dict.lookup("fieldRadiativeName")), - KName_(dict.lookup("K")), - oldMode_(unknown) -{ - if (!isA<directMappedPatchBase>(this->patch().patch())) - { - FatalErrorIn - ( - "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::" - "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField\n" - "(\n" - " const fvPatch& p,\n" - " const DimensionedField<scalar, volMesh>& 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; - } -} - - -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField -( - const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField& - wtcsf, - const DimensionedField<scalar, volMesh>& iF -) -: - mixedFvPatchScalarField(wtcsf, iF), - neighbourFieldName_(wtcsf.neighbourFieldName_), - neighbourFieldRadiativeName_(wtcsf.neighbourFieldRadiativeName_), - fieldRadiativeName_(wtcsf.fieldRadiativeName_), - KName_(wtcsf.KName_), - oldMode_(wtcsf.oldMode_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp<scalarField> -turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::K() const -{ - const fvMesh& mesh = patch().boundaryMesh().mesh(); - - if (KName_ == "none") - { - const compressible::LESModel& model = - db().lookupObject<compressible::LESModel>("LESProperties"); - - const basicThermo& thermo = - db().lookupObject<basicThermo>("thermophysicalProperties"); - - return - model.alphaEff()().boundaryField()[patch().index()] - *thermo.Cp()().boundaryField()[patch().index()]; - } - else if (mesh.objectRegistry::foundObject<volScalarField>(KName_)) - { - return patch().lookupPatchField<volScalarField, scalar>(KName_); - } - else if (mesh.objectRegistry::foundObject<volSymmTensorField>(KName_)) - { - const symmTensorField& KWall = - patch().lookupPatchField<volSymmTensorField, scalar>(KName_); - - vectorField n = patch().nf(); - - return n & KWall & n; - } - else - { - FatalErrorIn - ( - "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K()" - " const" - ) << "Did not find field " << KName_ - << " on mesh " << mesh.name() << " patch " << patch().name() - << endl - << "Please set 'K' to 'none', a valid volScalarField" - << " or a valid volSymmTensorField." << exit(FatalError); - - return scalarField(0); - } -} - - -void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField:: -updateCoeffs() -{ - if (updated()) - { - return; - } - - // Get the coupling information from the directMappedPatchBase - const directMappedPatchBase& mpp = refCast<const directMappedPatchBase> - ( - 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(); - - scalarField intFld = patchInternalField(); - - const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField& - nbrField = - refCast - < - const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - > - ( - nbrPatch.lookupPatchField<volScalarField, scalar> - ( - neighbourFieldName_ - ) - ); - - // Swap to obtain full local values of neighbour internal field - scalarField nbrIntFld = nbrField.patchInternalField(); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - nbrIntFld - ); - - if (debug) - { - Info<< patch().boundaryMesh().mesh().name() << ':' - << patch().name() << ':' - << this->dimensionedInternalField().name() << " :" - << " internalT " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) - << endl; - - Info<< nbrMesh.name() << ':' - << nbrPatch.name() << ':' - << this->dimensionedInternalField().name() << " :" - << " internalT " - << " min:" << gMin(nbrIntFld) - << " max:" << gMax(nbrIntFld) - << " avg:" << gAverage(nbrIntFld) - << endl; - } - - - - // Check how to operate - operationMode mode = unknown; - { - if (neighbourFieldRadiativeName_ != "none") - { - if - ( - nbrMesh.foundObject<volScalarField> - ( - neighbourFieldRadiativeName_ - ) - ) - { - mode = radFromNeighbour; - } - else - { - mode = noRad; - } - } - else - { - if - ( - patch().boundaryMesh().mesh().foundObject<volScalarField> - ( - fieldRadiativeName_ - ) - ) - { - mode = radFromMe; - } - else - { - mode = noRad; - } - } - - // Do some warnings if change of mode. - if (mode != oldMode_) - { - WarningIn - ( - "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField" - "::updateCoeffs()" - ) << "Switched from mode " << operationModeNames[oldMode_] - << " to mode " << operationModeNames[mode] - << endl; - } - oldMode_ = mode; - } - - - - // Swap to obtain full local values of neighbour K*delta - scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs(); - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - nbrKDelta - ); - - scalarField myKDelta = K()*patch().deltaCoeffs(); - - scalarField nbrConvFlux = nbrKDelta*(*this - nbrIntFld); - - scalarField nbrTotalFlux = nbrConvFlux; - scalarList nbrRadField(nbrPatch.size(), 0.0); - scalarList myRadField(patch().size(), 0.0); - - // solid - if (mode == radFromNeighbour) - { - nbrRadField = - nbrPatch.lookupPatchField<volScalarField, scalar> - ( - neighbourFieldRadiativeName_ - ); - - // Note: the Qr radiative flux is positive outgoing. - // For a hot solid radiating into a cold fluid Qr will be negative. - - - // Swap to obtain full local values of neighbour radiative heat flux - // field - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - nbrRadField - ); - - nbrTotalFlux -= nbrRadField; - - const scalarField Twall = - (nbrRadField + myKDelta*intFld + nbrKDelta*nbrIntFld) - /(myKDelta + nbrKDelta); - - - if (debug) - { - scalar Qr = gSum(nbrRadField*patch().magSf()); - - Info<< patch().boundaryMesh().mesh().name() << ':' - << patch().name() << ':' - << this->dimensionedInternalField().name() << " :" << nl - << " radiative heat [W] : " << Qr << nl - << " predicted wallT [K] : " << gAverage(Twall) << nl - << endl; - } - - label nFixed = 0; - - forAll(*this, i) - { - - this->refValue()[i] = Twall[i]; - this->refGrad()[i] = 0.0; // not used - this->valueFraction()[i] = 1.0; - nFixed++; - } - - if (debug) - { - Pout<< "Using " << nFixed << " fixedValue out of " << this->size() - << endl; - } - } - else if (mode == radFromMe) //fluid - { - const scalarField& myRadField = - patch().lookupPatchField<volScalarField, scalar> - ( - fieldRadiativeName_ - ); - - const scalarField Twall = - (myRadField + myKDelta*intFld + nbrKDelta*nbrIntFld) - /(myKDelta + nbrKDelta); - - if (debug) - { - scalar Qr = gSum(myRadField*patch().magSf()); - - Info<< patch().boundaryMesh().mesh().name() << ':' - << patch().name() << ':' - << this->dimensionedInternalField().name() << " :" << nl - << " radiative heat [W] : " << Qr << nl - << " predicted wallT [K] : " << gAverage(Twall) << nl - << endl; - } - - this->refValue() = Twall; - this->refGrad() = 0.0; // not used - this->valueFraction() = 1.0; - } - else if (mode == noRad) - { - this->refValue() = nbrIntFld; - this->refGrad() = 0.0; - this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta); - } - else - { - FatalErrorIn - ( - "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField" - "::updateCoeffs()" - ) << "Illegal mode " << operationModeNames[mode] - << exit(FatalError); - } - - mixedFvPatchScalarField::updateCoeffs(); - - if (debug) - { - scalar Qc = gSum(nbrConvFlux*patch().magSf()); - scalar Qr = gSum(nbrRadField*patch().magSf()); - scalar Qt = gSum(nbrTotalFlux*patch().magSf()); - - Info<< patch().boundaryMesh().mesh().name() << ':' - << patch().name() << ':' - << this->dimensionedInternalField().name() << " <- " - << nbrMesh.name() << ':' - << nbrPatch.name() << ':' - << this->dimensionedInternalField().name() << " :" << nl - << " convective heat[W] : " << Qc << nl - << " radiative heat [W] : " << Qr << nl - << " total heat [W] : " << Qt << nl - << " walltemperature " - << " min:" << gMin(*this) - << " max:" << gMax(*this) - << " avg:" << gAverage(*this) - << endl; - } -} - - -void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::write -( - Ostream& os -) const -{ - mixedFvPatchScalarField::write(os); - os.writeKeyword("neighbourFieldName")<< neighbourFieldName_ - << token::END_STATEMENT << nl; - os.writeKeyword("neighbourFieldRadiativeName")<< - neighbourFieldRadiativeName_ << token::END_STATEMENT << nl; - os.writeKeyword("fieldRadiativeName")<< fieldRadiativeName_ - << token::END_STATEMENT << nl; - os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; -// temperatureCoupledBase::write(os); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - - -// ************************************************************************* // diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H deleted file mode 100644 index 2d101bbf00c49ca9d1cfcb2df27c072187625bac..0000000000000000000000000000000000000000 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H +++ /dev/null @@ -1,221 +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 <http://www.gnu.org/licenses/>. - -Class - Foam:: - compressible:: - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - -Description - Mixed boundary condition for temperature, to be used for heat-transfer - on back-to-back baffles. - - If my temperature is T1, neighbour is T2: - - T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient. - - - Example usage: - myInterfacePatchName - { - type compressible::turbulentTemperatureRadiationCoupledMixedST; - neighbourFieldName T; - K lookup; - KName K; - - neighbourFieldRadiativeName Qr; // or none. Use on solid side - fieldRadiativeName Qr; // fluid. Use on fluid side - - value uniform 300; - } - - Needs to be on underlying directMapped(Wall)FvPatch. - - Note: K : heat conduction at patch. Gets supplied how to lookup/calculate K: - - 'lookup' : lookup volScalarField (or volSymmTensorField) with name - - 'basicThermo' : use basicThermo and compressible::RASmodel to calculate K - - 'solidThermo' : use basicSolidThermo K() - - 'directionalSolidThermo' directionalK() - - Note: runs in parallel with arbitrary decomposition. Uses directMapped - 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 - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H -#define turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H - -#include "mixedFvPatchFields.H" -//#include "temperatureCoupledBase.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - Declaration -\*---------------------------------------------------------------------------*/ - -class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField -: - public mixedFvPatchScalarField -// public temperatureCoupledBase -{ - // Private data - - //- Name of field on the neighbour region - const word neighbourFieldName_; - - //- Name of the radiative heat flux in the neighbout region - const word neighbourFieldRadiativeName_; - - //- Name of the radiative heat flux in the my region - const word fieldRadiativeName_; - - //- Name of thermal conductivity field - const word KName_; - - //- how to obtain radiative flux - enum operationMode - { - radFromNeighbour, - radFromMe, - noRad, - unknown - }; - static const NamedEnum<operationMode, 4> operationModeNames; - - //- Previous iteration mode - operationMode oldMode_; - - -public: - - //- Runtime type information - TypeName("compressible::turbulentTemperatureRadiationCoupledMixedST"); - - - // Constructors - - //- Construct from patch and internal field - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>& - ); - - //- Construct from patch, internal field and dictionary - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - ( - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const dictionary& - ); - - //- Construct by mapping given - // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a - // new patch - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - ( - const - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&, - const fvPatch&, - const DimensionedField<scalar, volMesh>&, - const fvPatchFieldMapper& - ); - - //- Construct and return a clone - virtual tmp<fvPatchScalarField> clone() const - { - return tmp<fvPatchScalarField> - ( - new - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - ( - *this - ) - ); - } - - //- Construct as copy setting internal field reference - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - ( - const - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&, - 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 - turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member functions - - //- Get corresponding K field - tmp<scalarField> 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/src/regionModels/regionCoupling/Make/files b/src/regionModels/regionCoupling/Make/files index d9d961e3a563a541a26d538921d94d07cc8b963c..846df33e9ea97447a753b0f8f9503b17e3806ce3 100644 --- a/src/regionModels/regionCoupling/Make/files +++ b/src/regionModels/regionCoupling/Make/files @@ -1,5 +1,4 @@ derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C - LIB = $(FOAM_LIBBIN)/libregionCoupling diff --git a/src/regionModels/regionCoupling/Make/options b/src/regionModels/regionCoupling/Make/options index 40d7a67126608416c50f95a6d6db81a104981349..2eaffb3b4bc8d2e49b7c8c6fe518268514ec9e65 100644 --- a/src/regionModels/regionCoupling/Make/options +++ b/src/regionModels/regionCoupling/Make/options @@ -8,6 +8,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/files b/src/turbulenceModels/compressible/turbulenceModel/Make/files index 4a2f2106c3b18a54e78bdaff2dc25bf158b7aed5..dd14188e4d8f3b0bdf9695e43a2dfd98e9cb7e7c 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/Make/files +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/files @@ -7,5 +7,7 @@ derivedFvPatchFields/turbulentTemperatureCoupledBaffle/turbulentTemperatureCoupl derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C derivedFvPatchFields/turbulentTemperatureCoupledBaffle/regionProperties.C derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarFields.C +derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C +derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C LIB = $(FOAM_LIBBIN)/libcompressibleTurbulenceModel diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/options b/src/turbulenceModels/compressible/turbulenceModel/Make/options index c9e7b7b0eea0c57469dae6d062cab9edbee7b746..c3d7e278f098e7074a2f46878d8737f2091d3029 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/Make/options +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/options @@ -13,5 +13,6 @@ LIB_LIBS = \ -lspecie \ -lfiniteVolume \ -lmeshTools \ - -lsolid + -lsolid \ + -lradiationModels diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C similarity index 96% rename from src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C index 23e11fe5c0c43588b309936dca31c2627c931ad2..f4c24778d51e4e67e0ff8e1e952c4307e0334a30 100644 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C @@ -29,7 +29,7 @@ License #include "volFields.H" #include "surfaceFields.H" #include "IOobjectList.H" -#include "LESModel.H" +#include "turbulenceModel.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -149,10 +149,10 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const compressible::LESModel& turbulence = - db().lookupObject<compressible::LESModel> + const compressible::turbulenceModel& turbulence = + db().lookupObject<compressible::turbulenceModel> ( - "LESProperties" + "turbulenceModel" ); const fvsPatchField<scalar>& phip = @@ -175,7 +175,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs() if (debug) { - scalar phi = gSum(-phip*(*this));// + alphap*snGrad()); + scalar phi = gSum(-phip*(*this)); Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H similarity index 98% rename from src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H index e0120ea8e0cafdffded7647d1417c718cae27803..6b4080abb086fa03284ff12b9e3694910eec2653 100644 --- a/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/totalFlowRateAdvectiveDiffusive/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -179,8 +179,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // - diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H similarity index 100% rename from applications/solvers/heatTransfer/chtMultiRegionFoam/coupledDerivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H rename to src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.H