View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001856 | OpenFOAM | Bug | public | 2015-09-28 14:04 | 2015-12-02 13:35 |
Reporter | DanielJ | Assigned To | henry | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Platform | GNU/Linux | OS | Ubuntu | OS Version | 14.04 |
Summary | 0001856: wallHeatFlux - add radiative heat flux | ||||
Description | wallHeatFlux utility would benefit from being able to calculate radiative and total heat flux. Additional proposal: Similar utility for "Boussinesq" solvers would be very useful since these solvers are often sufficient for simple problems. Additional proposal 2: buoyantBoussinesqPimpleFoam supports radiation and the "Simple" version does not. It probably should be unified. | ||||
Tags | No tags attached. | ||||
|
0001-buoyantBoussinesqSimpleFoam-added-radiation.patch (3,124 bytes)
From 22a5cee8a4a9ab7a93550c27305650ada7e1d3cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 10:23:47 +0100 Subject: [PATCH] buoyantBoussinesqSimpleFoam added radiation --- .../solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options | 2 ++ applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H | 5 ++++- .../buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options index 48d8383..5f9e323 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ @@ -12,6 +13,7 @@ EXE_LIBS = \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lincompressibleTransportModels \ + -lradiationModels \ -lfiniteVolume \ -lsampling \ -lmeshTools \ diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H index c495e58..fec770c 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H @@ -9,7 +9,8 @@ fvm::div(phi, T) - fvm::laplacian(alphaEff, T) == - fvOptions(T) + radiation->ST(rhoCpRef, T) + + fvOptions(T) ); TEqn.relax(); @@ -18,6 +19,8 @@ TEqn.solve(); + radiation->correct(); + fvOptions.correct(T); rhok = 1.0 - beta*(T - TRef); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index 6dff329..75f0c23 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -48,6 +48,7 @@ Description #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "turbulentTransportModel.H" +#include "radiationModel.H" #include "fvIOoptionList.H" #include "simpleControl.H" #include "fixedFluxPressureFvPatchScalarField.H" @@ -63,6 +64,7 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); #include "createFields.H" + #include "createIncompressibleRadiationModel.H" #include "createMRF.H" #include "createFvOptions.H" #include "initContinuityErrs.H" -- 1.9.1 |
|
0002-Reading-incompressible-radiation-model-properties-co.patch (1,217 bytes)
From bc22199c03d6c08511e2963c110ea0dc5abfab11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 18:16:11 +0100 Subject: [PATCH] Reading incompressible radiation model properties consistent with Boussinesq readTransportProperties --- .../radiation/include/createIncompressibleRadiationModel.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/radiation/include/createIncompressibleRadiationModel.H b/src/thermophysicalModels/radiation/include/createIncompressibleRadiationModel.H index ab7466d..13a8dc1 100644 --- a/src/thermophysicalModels/radiation/include/createIncompressibleRadiationModel.H +++ b/src/thermophysicalModels/radiation/include/createIncompressibleRadiationModel.H @@ -25,8 +25,8 @@ ) ); - dimensionedScalar rhoRef(transportProperties.lookup("rhoRef")); - dimensionedScalar CpRef(transportProperties.lookup("CpRef")); + dimensionedScalar rhoRef("rhoRef",dimDensity,transportProperties); + dimensionedScalar CpRef("CpRef",dimSpecificHeatCapacity,transportProperties); rhoCpRef = rhoRef*CpRef; } -- 1.9.1 |
|
0003-Added-radiative-heat-flux-to-wallHeatFlux-utility.patch (2,894 bytes)
From 48c96a955a9391adcc238f6084346e1fdf6eab9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 13:45:41 +0100 Subject: [PATCH] Added radiative heat flux to wallHeatFlux utility --- .../wall/wallHeatFlux/createFields.H | 16 ++++++++++++++++ .../wall/wallHeatFlux/wallHeatFlux.C | 22 ++++++++++++++-------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H index da7585b..02043ef 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H @@ -54,3 +54,19 @@ if (isA<fluidThermo>(thermo())) refCast<const fluidThermo>(thermo()) ); } + +//Read radiative heat flux if available +volScalarField Qr +( + IOobject + ( + "Qr", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("Qr", dimMass/pow3(dimTime), 0.0) +); + diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C index 8c80f0c..876affa 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C @@ -70,19 +70,25 @@ int main(int argc, char *argv[]) const surfaceScalarField::GeometricBoundaryField& patchHeatFlux = heatFlux.boundaryField(); + const volScalarField::GeometricBoundaryField& patchRadHeatFlux = + Qr.boundaryField(); + + const surfaceScalarField::GeometricBoundaryField& magSf = + mesh.magSf().boundaryField(); + Info<< "\nWall heat fluxes [W]" << endl; forAll(patchHeatFlux, patchi) { if (isA<wallFvPatch>(mesh.boundary()[patchi])) { - Info<< mesh.boundary()[patchi].name() - << " " - << gSum - ( - mesh.magSf().boundaryField()[patchi] - *patchHeatFlux[patchi] - ) - << endl; + scalar convFlux = gSum(magSf[patchi]*patchHeatFlux[patchi]); + + scalar radFlux = gSum(magSf[patchi]*patchRadHeatFlux[patchi]); + + Info<< mesh.boundary()[patchi].name() << endl + << " convective: " << convFlux << endl + << " radiative: " << radFlux << endl + << " total: " << convFlux + radFlux << endl; } } Info<< endl; -- 1.9.1 |
|
0004-basicThermo-API-for-optional-read.patch (4,304 bytes)
From a54aefff4f5b80347d07e39668cdb6ebfd857ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 15:08:43 +0100 Subject: [PATCH] basicThermo API for optional read --- .../basic/basicThermo/basicThermo.C | 38 ++++++++++++++++++++++ .../basic/basicThermo/basicThermo.H | 12 ++++++- .../basic/basicThermo/basicThermoTemplates.C | 9 +++-- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index e7264b0..e780379 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -276,6 +276,44 @@ Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New return New<basicThermo>(mesh, phaseName); } +Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::NewIfPresent +( + const fvMesh& mesh, + const word& phaseName, + bool printInfo +) +{ + IOobject thermoIO + ( + phasePropertyName(dictName, phaseName), + mesh.time().constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ); + + if(!thermoIO.headerOk()) + { + return autoPtr<basicThermo>(); + } + + IOdictionary thermoDict + ( + thermoIO + ); + + basicThermo::fvMeshConstructorTable::iterator cstrIter = + lookupThermo<basicThermo, basicThermo::fvMeshConstructorTable> + ( + thermoDict, + basicThermo::fvMeshConstructorTablePtr_, + printInfo + ); + + return autoPtr<basicThermo>(cstrIter()(mesh, phaseName)); +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 9d4fc58..600e295 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -140,7 +140,8 @@ public: static typename Table::iterator lookupThermo ( const dictionary& thermoDict, - Table* tablePtr + Table* tablePtr, + bool printInfo=true ); //- Generic New for each of the related thermodynamics packages @@ -167,6 +168,15 @@ public: const word& phaseName=word::null ); + //- Specialisation of the Generic New for basicThermo + //- Returns empty pointer if dictionary not available + static autoPtr<basicThermo> NewIfPresent + ( + const fvMesh&, + const word& phaseName=word::null, + bool printInfo=true + ); + //- Destructor virtual ~basicThermo(); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C index 4521750..334ee89 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C @@ -31,7 +31,8 @@ template<class Thermo, class Table> typename Table::iterator Foam::basicThermo::lookupThermo ( const dictionary& thermoDict, - Table* tablePtr + Table* tablePtr, + bool printInfo ) { word thermoTypeName; @@ -40,7 +41,8 @@ typename Table::iterator Foam::basicThermo::lookupThermo { const dictionary& thermoTypeDict(thermoDict.subDict("thermoType")); - Info<< "Selecting thermodynamics package " << thermoTypeDict << endl; + if(printInfo) + Info<< "Selecting thermodynamics package " << thermoTypeDict << endl; const int nCmpt = 7; const char* cmptNames[nCmpt] = @@ -114,7 +116,8 @@ typename Table::iterator Foam::basicThermo::lookupThermo { thermoTypeName = word(thermoDict.lookup("thermoType")); - Info<< "Selecting thermodynamics package " << thermoTypeName << endl; + if(printInfo) + Info<< "Selecting thermodynamics package " << thermoTypeName << endl; typename Table::iterator cstrIter = tablePtr->find(thermoTypeName); -- 1.9.1 |
|
0005-wallHeatFlux-switches-to-Boussinesq-when-thermo-pack.patch (8,694 bytes)
From 9e61f4095f51b7856ad7c68d2e4babdc42b76077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 18:50:24 +0100 Subject: [PATCH] wallHeatFlux switches to Boussinesq when thermo package not found --- .../postProcessing/wall/wallHeatFlux/Make/options | 5 + .../wall/wallHeatFlux/createFields.H | 141 +++++++++++++++++---- .../wall/wallHeatFlux/wallHeatFlux.C | 44 +++++-- 3 files changed, 157 insertions(+), 33 deletions(-) diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options b/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options index fdcd3d7..b134db7 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/Make/options @@ -1,6 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ @@ -11,6 +14,8 @@ EXE_INC = \ EXE_LIBS = \ -lturbulenceModels \ + -lincompressibleTransportModels \ + -lincompressibleTurbulenceModels \ -lcompressibleTurbulenceModels \ -lreactionThermophysicalModels \ -lgenericPatchFields \ diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H index 02043ef..7d8ee10 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H @@ -1,28 +1,14 @@ -autoPtr<basicThermo> thermo -( - basicThermo::New(mesh) -); +autoPtr<surfaceScalarField> heatFlux; -const volScalarField& h = thermo->he(); - -// Register copy of thermo density -volScalarField rho +autoPtr<basicThermo> thermo ( - IOobject - ( - "rho", - runTime.timeName(), - mesh - ), - thermo->rho() + basicThermo::NewIfPresent(mesh,word::null,false) ); -// Construct turbulence model (if fluid) autoPtr<volVectorField> UPtr; autoPtr<surfaceScalarField> phiPtr; -autoPtr<compressible::turbulenceModel> turbulence; -if (isA<fluidThermo>(thermo())) +if( (!thermo.valid()) || isA<fluidThermo>(thermo()) ) { UPtr.reset ( @@ -39,22 +25,133 @@ if (isA<fluidThermo>(thermo())) mesh ) ); - const volVectorField& U = UPtr(); +} + +// Construct turbulence model (if fluid) +autoPtr<volScalarField> rhoPtr; +autoPtr<compressible::turbulenceModel> compressibleTurbulence; + +if (thermo.valid() && isA<fluidThermo>(thermo())) +{ + // Register copy of thermo density + rhoPtr.reset + ( + new volScalarField + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh + ), + thermo->rho() + ) + ); + + const volScalarField rho = rhoPtr(); + const volVectorField U = UPtr(); #include "compressibleCreatePhi.H" // Copy phi to autoPtr. Rename to make sure copy is now registered as 'phi'. phi.rename("phiFluid"); phiPtr.reset(new surfaceScalarField("phi", phi)); - turbulence = compressible::turbulenceModel::New + compressibleTurbulence = compressible::turbulenceModel::New ( - rho, - U, + rhoPtr(), + UPtr(), phiPtr(), refCast<const fluidThermo>(thermo()) ); } +//If thermo package not found try Boussinesq +autoPtr<volScalarField> T; +autoPtr<volScalarField> alphat; +autoPtr<volScalarField> rhok; + +autoPtr<incompressible::turbulenceModel> incompressibleTurbulence; +autoPtr<singlePhaseTransportModel> laminarTransport; + +dimensionedScalar Pr("Pr", dimless, 1); +dimensionedScalar rhoRef("rhoRef", dimDensity, 0); +dimensionedScalar CpRef("CpRef", dimSpecificHeatCapacity, 0); + +if(!thermo.valid()) +{ + T.reset + ( + new volScalarField + ( + IOobject + ( + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh + ) + ); + + alphat.reset + ( + new volScalarField + ( + IOobject + ( + "alphat", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh + ) + ); + + rhok.reset + ( + new volScalarField + ( + IOobject + ( + "rhok", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("rhok",dimless,1.0) + ) + ); + + const volVectorField U = UPtr(); + + #include "createPhi.H" + + phi.rename("phiFluid"); + phiPtr.reset(new surfaceScalarField("phi", phi)); + + laminarTransport.reset + ( + new singlePhaseTransportModel(UPtr(), phiPtr()) + ); + + incompressibleTurbulence = incompressible::turbulenceModel::New + ( + UPtr(), + phiPtr(), + laminarTransport() + ); + + laminarTransport().lookup("Pr") >> Pr; + laminarTransport().lookup("rhoRef") >> rhoRef; + laminarTransport().lookup("CpRef") >> CpRef; +} + //Read radiative heat flux if available volScalarField Qr ( diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C index b087331..096b5bf 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C @@ -33,6 +33,8 @@ Description #include "fvCFD.H" #include "turbulentFluidThermoModel.H" +#include "turbulentTransportModel.H" +#include "singlePhaseTransportModel.H" #include "solidThermo.H" #include "wallFvPatch.H" @@ -55,20 +57,40 @@ int main(int argc, char *argv[]) #include "createFields.H" - surfaceScalarField heatFlux - ( - fvc::interpolate + if(thermo.valid()) + { + heatFlux.reset ( + new surfaceScalarField ( - turbulence.valid() - ? turbulence->alphaEff()() - : thermo->alpha() + fvc::interpolate + ( + ( + compressibleTurbulence.valid() + ? compressibleTurbulence->alphaEff()() + : thermo->alpha() + ) + )*fvc::snGrad(thermo->he()) ) - )*fvc::snGrad(h) - ); + ); + } + else + { + heatFlux.reset + ( + new surfaceScalarField + ( + CpRef*rhoRef* + fvc::interpolate + ( + rhok()*(incompressibleTurbulence->nu()/Pr + alphat()) + )*fvc::snGrad(T()) + ) + ); + } const surfaceScalarField::GeometricBoundaryField& patchHeatFlux = - heatFlux.boundaryField(); + heatFlux().boundaryField(); const volScalarField::GeometricBoundaryField& patchRadHeatFlux = Qr.boundaryField(); @@ -102,7 +124,7 @@ int main(int argc, char *argv[]) mesh ), mesh, - dimensionedScalar("wallHeatFlux", heatFlux.dimensions(), 0.0) + dimensionedScalar("wallHeatFlux", heatFlux().dimensions(), 0.0) ); forAll(wallHeatFlux.boundaryField(), patchi) @@ -123,7 +145,7 @@ int main(int argc, char *argv[]) mesh ), mesh, - dimensionedScalar("totalWallHeatFlux", heatFlux.dimensions(), 0.0) + dimensionedScalar("totalWallHeatFlux", heatFlux().dimensions(), 0.0) ); forAll(totalWallHeatFlux.boundaryField(), patchi) -- 1.9.1 |
|
0006-Writing-total-heat-flux.patch (1,504 bytes)
From 1fbd03c8fb2aa11b164f4fb498f35bf1388019a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 14:00:12 +0100 Subject: [PATCH] Writing total heat flux --- .../wall/wallHeatFlux/wallHeatFlux.C | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C index 876affa..b087331 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/wallHeatFlux.C @@ -111,6 +111,29 @@ int main(int argc, char *argv[]) } wallHeatFlux.write(); + + if(Qr.headerOk()) + { + volScalarField totalWallHeatFlux + ( + IOobject + ( + "totalWallHeatFlux", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("totalWallHeatFlux", heatFlux.dimensions(), 0.0) + ); + + forAll(totalWallHeatFlux.boundaryField(), patchi) + { + totalWallHeatFlux.boundaryField()[patchi] = + patchHeatFlux[patchi] + patchRadHeatFlux[patchi]; + } + + totalWallHeatFlux.write(); + } } Info<< "End" << endl; -- 1.9.1 |
|
|
|
I implemented the proposed modifications. Patch 0001 Adds radiation to buoyantBoussinesqSimpleFoam to be consistent with the Pimple version. (Additional proposal 2) Patch 0002 Creating radiation model for incompressible solver required full definition of dimensionedScalar parameters while readTransportProperties allowed for partial definition. Patch 0003 Adds radiative heat flux based on scalar field Qr that is written by all non dummy radiation models. I found this approach to be the most efficient since it requires no changes to the radiatioModel API. Also creating fvDOM is expensive and produces a lot of annoying information. Patch 0004 Added to basicThermo new selector that returns empty pointer to basicThermo when thermophysicalProperties is not available. Patch 0005 wallHeatFlux modified so that if thermodynamicProperties was not found it tries to read Boussinesq properties. (Additional proposal 1) Patch 0006 (Optional) Write total heat flux I additionally suppressed thermodynamic package information since it printed a lot of uninteresting information to the output and made the main information less readable. Maybe something like this could also be done with turbulence selection to clean the output from the utility. |
|
Patch 0001: looks fine will merge. Patch 0002: looks fine will merge. Patch 0003: looks OK but need to check. Patch 0004: I thinks this is a bad idea and not clear why it is necessary. Patch 0005: will check. Patch 0006: Will check. It is not clear why the thermodynamic package information should be suppressed, or do you surpress it only for this utility? If there is general interest in controlling the output from model construction we need a standard approach either a debug switch and/or command-line option. |
|
Patch 0004: I created additional selector NewIfPresent. Other selectors were not changed and therefore code everywhere behaves like before. This was required to automatically switch to Boussinesq mode when thermo is not available. The output from thermo is only suppressed for this utility. Behavior of other applications will not change. |
|
0007-Final-check-based-on-pressure-dimensions.patch (1,367 bytes)
From c4d42fbff748127b3166de4723e8a2c3f2a4a191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jasi=C5=84ski?= <daniel.jasinski@gmail.com> Date: Thu, 29 Oct 2015 20:35:42 +0100 Subject: [PATCH] Final check based on pressure dimensions --- .../wall/wallHeatFlux/createFields.H | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H index 7d8ee10..07370f1 100644 --- a/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H +++ b/applications/utilities/postProcessing/wall/wallHeatFlux/createFields.H @@ -25,6 +25,28 @@ if( (!thermo.valid()) || isA<fluidThermo>(thermo()) ) mesh ) ); + + //Final check if it is really compressible + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh + ); + + if(p.dimensions() != dimPressure) + { + //- It is not a compressible pressure + //- probably an old thermodynamiProperties file + //- was found in the directory + thermo.clear(); + } } // Construct turbulence model (if fluid) -- 1.9.1 |
|
Patch 0007 Final check if the pressure field is really compressible |
|
Patch 0004: I think this is a bad idea, we need a better approach to handle the case where the thermodynamics package is not available e.g. by creating a special thermo package for the Boussinesq formulation. > The output from thermo is only suppressed for this utility. Won't this be confusing? Why should this utility behave differently to other similar utilities? I think we should apply the principle of least astonishment hence my suggestion: If there is general interest in controlling the output from model construction we need a standard approach either a debug switch and/or command-line option. |
|
This was a problem because in the original implementation the thermo package was created for every time step and i clutter the output. I now think that the easiest solution is to move thermo and turbulence creation outside the timeDirs loop and have this information printed only once. |
|
If the thermo and turbulence creation are moved outside the timeDirs loop they would not get updated so the evaluated wall heat flux would be the same for all time steps. |
|
So either way user will be shocked with no output or to much output :) Can turbulence and thermo be forced to update somehow? |
|
> So either way user will be shocked with no output or to much output :) While the current approach is not ideal at least all the utilities behave in the same way so it will only be surprising once. > Can turbulence and thermo be forced to update somehow? How? |
|
What about doing a little cheat. Reading thermo and turbulence at the beginning just to produce standard output, then clearing both, and in the loop suppressing the output. |
|
If there is general interest in controlling the output from model construction we need a standard approach either a debug switch and/or command-line option; I don't think adding complexity directly to the utilities to handle this as a good idea. |
|
IMHO, I think that using debug switch is not an elegant solution since by definition debug switches should be used for debugging the source code and not changing the behavior under normal conditions, but I might be wrong. I do not think there will be any benefit from creating BoussinesqThermo: 1. It would be used only in this particular utility. 2. It would still require a new selector that allows for missing thermProps file. 3. In this utility we would still need to check if isA<BoussinesqThermo>(thermo()) compared to current thermo.valid(), to make a decision which turbulence model to create. No benefit here. Also if we need to know explicitly about the type of an object to make a decision it is not a particularly good abstraction. 4. It might be beneficial only if we created a version of incompressible turbulence model with alphaEff function and unify compressible and incompressible APIs(now that I am writing this I think it might not be a bad idea), otherwise it will be a lot of code without an explicit benefit. PS In src/TurbulenceModels/compressible/SpecificCompressibleTurbulenceModel/SpecificCompressibleTurbulenceModel.H and src/TurbulenceModels/incompressible/SpecificIncompressibleTurbulenceModel/SpecificIncompressibleTurbulenceModel.H in the selector comment the word 'RAS' should probably be changed to 'turbulence'. |
|
OK then it could be added in InfoSwitches. Note that debug switches are used for various output which might be considered as information or help with debugging e.g. solver residuals and iterations. One option we are considering is to remove the Boussinesq solvers altogether and instead use special incompressible thermo which is more or less equivalent, actually slightly more accurate as the effect of density variation (due to temperature only) is then included in the transport terms. My feeling is that this approach will be only very slightly more expensive than the simple Boussinesq approach but completely consistent with the thermodynamics and compressible transport modeling in OpenFOAM and hence with all the pre/post utilities. |
|
How serious are the considerations for this Boussinesq thermo? Is there a deadline or something? It would require adding a new thermo and a new equation of state? |
|
If you use the incompressiblePerfectGas equation of state with buoyantSimpleFoam or buoyantPimpleFoam you will already get approximately Boussinesq behavior. To make the setup even closer we could create a "Boussinesq" equation of state which evaluates rho = 1.0 - beta*(T - TRef) consistent with the current Boussinesq solvers, this would only take a few minutes to write. More time would be required to test it and make sure it is at least as good as the current Boussinesq solvers and the overhead is acceptable. |
|
OpenFOAM-dev commit dfecb23b08c04c92401bc0bdf904ed0793c3be66 Author: Henry Weller <http://cfd.direct> Date: Sat Oct 31 18:27:38 2015 +0000 equationOfState/Boussinesq: New equation of state for the Boussinesq approximation for buoyant flows Description Incompressible gas equation of state using the Boussinesq approximation for the density as a function of temperature only: \verbatim rho = rho0*(1 - beta*(T - T0)) \endverbatim To be used with the buoyantPimpleFoam and buoyantSimpleFoam solvers as an alternative to using buoyantBoussinesqPimpleFoam or buoyantBoussinesqSimpleFoam, providing consistency with all other solvers and utilities using the thermodynamics package in OpenFOAM. |
|
That was fast :) |
|
In the present implementation the sign in the radiative heat transfer appears to be wrong. Steps to reproduce: 1. Run the chtMultiRegionSimpleFoam multiRegionHeaterRadiation tutorial to convergence 2. Check the heat balance between the regions with the wallHeatFlux utility I've attached a modified wallHeatFlux.C with reversed signs. |
|
|
|
@Juho: Thanks for the patch I have applied it to OpenFOAM-dev: commit 5749c95ed68e40c11ea586549fb667553d218f1f If all agree on this change I will close this report again. |
|
Yes, my patch had incorrect sign. Now it is OK. |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-09-28 14:04 | DanielJ | New Issue | |
2015-10-29 18:01 | DanielJ | File Added: 0001-buoyantBoussinesqSimpleFoam-added-radiation.patch | |
2015-10-29 18:01 | DanielJ | File Added: 0002-Reading-incompressible-radiation-model-properties-co.patch | |
2015-10-29 18:02 | DanielJ | File Added: 0003-Added-radiative-heat-flux-to-wallHeatFlux-utility.patch | |
2015-10-29 18:02 | DanielJ | File Added: 0004-basicThermo-API-for-optional-read.patch | |
2015-10-29 18:02 | DanielJ | File Added: 0005-wallHeatFlux-switches-to-Boussinesq-when-thermo-pack.patch | |
2015-10-29 18:03 | DanielJ | File Added: 0006-Writing-total-heat-flux.patch | |
2015-10-29 18:03 | DanielJ | File Added: wallHeatFlux.zip | |
2015-10-29 18:40 | DanielJ | Note Added: 0005516 | |
2015-10-29 19:01 | henry | Note Added: 0005517 | |
2015-10-29 19:16 | DanielJ | Note Added: 0005518 | |
2015-10-29 19:37 | DanielJ | File Added: 0007-Final-check-based-on-pressure-dimensions.patch | |
2015-10-29 19:38 | DanielJ | Note Added: 0005519 | |
2015-10-29 19:49 | henry | Note Added: 0005520 | |
2015-10-29 19:58 | DanielJ | Note Added: 0005521 | |
2015-10-29 20:04 | henry | Note Added: 0005522 | |
2015-10-29 20:09 | DanielJ | Note Added: 0005523 | |
2015-10-29 20:22 | henry | Note Added: 0005524 | |
2015-10-29 20:37 | DanielJ | Note Added: 0005526 | |
2015-10-29 21:00 | henry | Note Added: 0005527 | |
2015-10-30 07:58 | DanielJ | Note Added: 0005528 | |
2015-10-30 09:28 | henry | Note Added: 0005529 | |
2015-10-31 16:47 | DanielJ | Note Added: 0005531 | |
2015-10-31 17:15 | henry | Note Added: 0005532 | |
2015-10-31 18:33 | henry | Note Added: 0005534 | |
2015-10-31 18:53 | DanielJ | Note Added: 0005535 | |
2015-11-01 15:56 | henry | Status | new => resolved |
2015-11-01 15:56 | henry | Resolution | open => fixed |
2015-11-01 15:56 | henry | Assigned To | => henry |
2015-12-02 10:17 | henry | Status | resolved => feedback |
2015-12-02 10:17 | henry | Resolution | fixed => reopened |
2015-12-02 10:41 | Juho | Note Added: 0005713 | |
2015-12-02 10:42 | Juho | File Added: wallHeatFlux.C | |
2015-12-02 12:28 | henry | Note Added: 0005715 | |
2015-12-02 13:03 | DanielJ | Note Added: 0005716 | |
2015-12-02 13:03 | DanielJ | Status | feedback => assigned |
2015-12-02 13:35 | henry | Status | assigned => resolved |
2015-12-02 13:35 | henry | Resolution | reopened => fixed |