From 1e32d23da1b26cca34f93345bef53e56ec0c0302 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Wed, 10 Jul 2013 00:58:16 +0200 Subject: [PATCH 01/14] Revised fvMatrix::setReference --- .../fvMatrices/fvMatrix/fvMatrix.C | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C index ec135b3ff..8c44fb1cd 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrix.C @@ -519,35 +519,38 @@ void Foam::fvMatrix::setReference const bool forceReference ) { - if (celli >= 0 && (psi_.needReference() || forceReference)) + if ((forceReference || psi_.needReference()) && celli >= 0) { - // Bug fix: force reference only on master for parallel runs - // HJ, 12/Feb/2010 - if (Pstream::parRun()) - { - // Parallel run: - // - only set reference on master processor: one place is enough - // - make sure that cellI is not out of range - if (Pstream::master()) - { - label parCelli = celli; + // HR, 9/Jul/2013 + // Very early versions could produce memory violations if celli is read + // from dictionary, however, the proposed fix produced unpredictable + // results in parallel. Keeping in mind that topologically changing + // meshes will complicate the matter to level that cannot possibly be + // dealt with at this point, we will simply raise an error if celli + // is out of bound. - while (parCelli >= diag().size()) - { - // Out of range, pick a local cell - parCelli /= Pstream::nProcs(); - } + // In essence: The user of this function needs to make sure that celli + // is set only on one processor and that it is updated if the mesh + // changes. We should be doing better than this! Consider mesh object + // to hold reference cell and associated data. - source()[parCelli] += diag()[parCelli]*value; - diag()[parCelli] += diag()[parCelli]; - } - } - else + if (celli >= diag().size()) { - // Serial run, standard practice - source()[celli] += diag()[celli]*value; - diag()[celli] += diag()[celli]; + FatalErrorIn + ( + "fvMatrix::setReference" + "(" + "const label celli, " + "const Type& value, " + "const bool forceReference" + ")" + ) + << "celli out of bound" + << abort(FatalError); } + + source()[celli] += diag()[celli]*value; + diag()[celli] += diag()[celli]; } } From d5326a7d271913f4d14386ed5deb64bd3728c578 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Wed, 10 Jul 2013 23:24:29 +0200 Subject: [PATCH 02/14] Revert changes to regionCouplePolyPatch.C --- .../regionCouple/regionCouplePolyPatch.C | 43 +++++-------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C index 42485878e..e4b7904ae 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C @@ -800,10 +800,7 @@ void Foam::regionCouplePolyPatch::attach() const // Patch-to-patch interpolation does not need to be cleared, // only face/cell centres and interpolation factors // HJ, 6/Jun/2011 - - // Breaks simple parallel CHT cases - // HR, 8/Jun/2012 - //clearGeom(); + clearGeom(); } } @@ -818,10 +815,7 @@ void Foam::regionCouplePolyPatch::detach() const // Patch-to-patch interpolation does not need to be cleared, // only face/cell centres and interpolation factors // HJ, 6/Jun/2011 - - // Breaks simple parallel CHT cases - // HR, 8/Jun/2012 - //clearGeom(); + clearGeom(); } } @@ -889,17 +883,15 @@ Foam::regionCouplePolyPatch::patchToPatch() const const Foam::vectorField& Foam::regionCouplePolyPatch::reconFaceCellCentres() const { -// Breaks simple parallel CHT cases -// HR, 8/Jun/2012 -// if (!attached_) -// { -// FatalErrorIn -// ( -// "const vectorField& " -// "regionCouplePolyPatch::reconFaceCellCentres() const" -// ) << "Requesting reconFaceCellCentres in detached state" -// << abort(FatalError); -// } + if (!attached_) + { + FatalErrorIn + ( + "const vectorField& " + "regionCouplePolyPatch::reconFaceCellCentres() const" + ) << "Requesting reconFaceCellCentres in detached state" + << abort(FatalError); + } if (!reconFaceCellCentresPtr_) { @@ -927,10 +919,6 @@ void Foam::regionCouplePolyPatch::initAddressing() { // Calculate send addressing sendAddr(); - - // Deferred execution on startup - // HR, 8/Jun/2012 - shadow().sendAddr(); } } @@ -955,12 +943,6 @@ void Foam::regionCouplePolyPatch::initGeometry() { reconFaceCellCentres(); } - else - { - // Deferred execution on startup - // HR, 8/Jun/2012 - shadow().reconFaceCellCentres(); - } } polyPatch::initGeometry(); @@ -1005,9 +987,6 @@ void Foam::regionCouplePolyPatch::initMovePoints(const pointField& p) } } - // Reconsider: Two communication in one function call may not work in parallel - // HR, 8/Jun/2012 - if (active() && master()) { reconFaceCellCentres(); From fee3998d24ab688e289414c8a976d7590987f687 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Wed, 10 Jul 2013 00:58:53 +0200 Subject: [PATCH 03/14] BUG: send-receive addressing could be recalculated asymmetrically in parallel ENH: Avoid recalculation off addressing on plain attach/detach --- .../constraint/ggi/ggiPolyPatchTemplates.C | 9 +++++ .../regionCouple/regionCouplePolyPatch.C | 33 ++++++++++++++----- .../regionCouple/regionCouplePolyPatch.H | 7 ++-- .../regionCouplePolyPatchTemplates.C | 11 ++++++- .../regionCouplingFvPatchField.C | 2 -- 5 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C index 563549be8..10a116a76 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C @@ -82,6 +82,15 @@ Foam::tmp > Foam::ggiPolyPatch::fastExpand << abort(FatalError); } + // HR, 10/Jul/2013 + // This function requires send-receive-addressing, but usage is not + // symmetric across processors. Hence trigger re-calculate at this point + if (Pstream::parRun() && !localParallel()) + { + receiveAddr(); + shadow().receiveAddr(); + } + // Expand the field to zone size tmp > texpandField ( diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C index e4b7904ae..76943f88f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C @@ -318,13 +318,13 @@ void Foam::regionCouplePolyPatch::calcLocalParallel() const localParallelPtr_ = new bool(false); bool& emptyOrComplete = *localParallelPtr_; - // If running in serial, all GGIs are expanded to zone size. + // If running in parallel, all GGIs are expanded to zone size. // This happens on decomposition and reconstruction where // size and shadow size may be zero, but zone size may not // HJ, 1/Jun/2011 if (!Pstream::parRun()) { - emptyOrComplete = false; + emptyOrComplete = true; } else { @@ -346,7 +346,7 @@ void Foam::regionCouplePolyPatch::calcLocalParallel() const if (emptyOrComplete) { - Info<< "local parallel" << endl; + Info<< "local parallel" << endl; } else { @@ -468,9 +468,15 @@ Foam::regionCouplePolyPatch& Foam::regionCouplePolyPatch::shadow() } -void Foam::regionCouplePolyPatch::clearGeom() const +void Foam::regionCouplePolyPatch::clearDeltas() const { deleteDemandDrivenData(reconFaceCellCentresPtr_); +} + + +void Foam::regionCouplePolyPatch::clearGeom() const +{ + clearDeltas(); // Remote addressing and send-receive maps depend on the local // position. Therefore, it needs to be recalculated at mesh motion. @@ -480,16 +486,19 @@ void Foam::regionCouplePolyPatch::clearGeom() const deleteDemandDrivenData(receiveAddrPtr_); deleteDemandDrivenData(sendAddrPtr_); + + // localParallel depends on geometry - must be cleared! + // HR, 11/Jul/2013 + deleteDemandDrivenData(localParallelPtr_); } -void Foam::regionCouplePolyPatch::clearOut() +void Foam::regionCouplePolyPatch::clearOut() const { clearGeom(); deleteDemandDrivenData(zoneAddressingPtr_); deleteDemandDrivenData(patchToPatchPtr_); - deleteDemandDrivenData(localParallelPtr_); } @@ -800,7 +809,11 @@ void Foam::regionCouplePolyPatch::attach() const // Patch-to-patch interpolation does not need to be cleared, // only face/cell centres and interpolation factors // HJ, 6/Jun/2011 - clearGeom(); + //clearGeom() + + // Clear delta coefficients, but keep the rest. + // HR, 10/Jul/2013 + clearDeltas(); } } @@ -815,7 +828,11 @@ void Foam::regionCouplePolyPatch::detach() const // Patch-to-patch interpolation does not need to be cleared, // only face/cell centres and interpolation factors // HJ, 6/Jun/2011 - clearGeom(); + //clearGeom() + + // Clear delta coefficients, but keep the rest. + // HR, 10/Jul/2013 + clearDeltas(); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H index 970295cd9..4379613c0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H @@ -155,11 +155,14 @@ class regionCouplePolyPatch // Memory management + //- Clear delta coefficients + void clearDeltas() const; + //- Clear geometry - void clearGeom() const; + void clearGeom() const; //- Clear out - void clearOut(); + void clearOut() const; protected: diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C index 617af8cf0..0106df1e1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C @@ -51,7 +51,7 @@ Foam::tmp > Foam::regionCouplePolyPatch::fastExpand // Notes: // A) If the size of zone addressing is zero, data is not sent // B) Communicated data on each processor has the size of live faces - // C) Expanded data will be equal to actual data fronm other processors + // C) Expanded data will be equal to actual data from other processors // only for the faces marked in remote; for other faces, it will be // equal to zero // D) On processor zero, complete data is available @@ -81,6 +81,15 @@ Foam::tmp > Foam::regionCouplePolyPatch::fastExpand << abort(FatalError); } + // This function requires send-receive-addressing, but usage is not + // symmetric across processors. Hence trigger re-calculate at this point + // HR, 10/Jul/2013 + if (Pstream::parRun() && !localParallel()) + { + receiveAddr(); + shadow().receiveAddr(); + } + // Expand the field to zone size tmp > texpandField ( diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C index 1ee72e8bc..af0cfc2b2 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C @@ -410,7 +410,6 @@ void regionCouplingFvPatchField::initInterfaceMatrixUpdate "regionCouplingFvPatchField::initInterfaceMatrixUpdate" ) << "init matrix update called in detached state" << abort(FatalError); - } } @@ -461,7 +460,6 @@ void regionCouplingFvPatchField::updateInterfaceMatrix "regionCouplingFvPatchField::updateInterfaceMatrix" ) << "Matrix update called in detached state" << abort(FatalError); - } } From 6487d7e462ef2fda40d37be79fbf3aa354085b76 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Wed, 10 Jul 2013 00:57:08 +0200 Subject: [PATCH 04/14] updated code and tutorials conjugateHeat{Simple}Foam --- .../coupled/conjugateHeatFoam/Allwmake | 8 + .../coupled/conjugateHeatFoam/Make/options | 19 +- .../solvers/coupled/conjugateHeatFoam/UEqn.H | 26 + .../coupled/conjugateHeatFoam/attachPatches.H | 2 +- .../conjugateHeatFoam/conjugateHeatFoam.C | 73 ++- .../conjugateHeatTransfer/Make/files | 49 ++ .../conjugateHeatTransfer/Make/options | 13 + .../fieldAverageItem/fieldAverageItem.C | 97 ++++ .../fieldAverageItem/fieldAverageItem.H | 208 ++++++++ .../fieldAverageItem/fieldAverageItemIO.C | 95 ++++ .../heatFlux/heatFlux/IOFieldAverage.H | 49 ++ .../heatFlux/heatFlux/detachPatches.H | 18 + .../heatFlux/heatFlux/heatFlux.C | 241 +++++++++ .../heatFlux/heatFlux/heatFlux.H | 154 ++++++ .../heatFlux/heatFlux/heatFluxTemplates.C | 286 +++++++++++ .../heatFluxFunctionObject.C | 42 ++ .../heatFluxFunctionObject.H | 54 ++ .../adiabatic/adiabaticFvPatchScalarField.C | 161 ++++++ .../adiabatic/adiabaticFvPatchScalarField.H | 164 ++++++ .../chtRcTemperatureFvPatchScalarField.C | 215 ++++++++ .../chtRcTemperatureFvPatchScalarField.H | 174 +++++++ ...htRcThermalDiffusivityFvPatchScalarField.C | 364 +++++++++++++ ...htRcThermalDiffusivityFvPatchScalarField.H | 164 ++++++ ...lDiffusivityResistanceFvPatchScalarField.C | 479 ++++++++++++++++++ ...lDiffusivityResistanceFvPatchScalarField.H | 181 +++++++ ...hermalDiffusivitySlaveFvPatchScalarField.C | 127 +++++ ...hermalDiffusivitySlaveFvPatchScalarField.H | 149 ++++++ .../chtRegionCoupleBase/chtRegionCoupleBase.C | 178 +++++++ .../chtRegionCoupleBase/chtRegionCoupleBase.H | 197 +++++++ ...olledParabolicVelocityFvPatchVectorField.C | 214 ++++++++ ...olledParabolicVelocityFvPatchVectorField.H | 170 +++++++ ...tendedWallHeatTransferFvPatchScalarField.C | 235 +++++++++ ...tendedWallHeatTransferFvPatchScalarField.H | 187 +++++++ .../viewFactorRadiation.C | 66 +++ .../viewFactorRadiation.H | 155 ++++++ .../constantFlux/constantFlux.C | 72 +++ .../constantFlux/constantFlux.H | 136 +++++ .../externalRadiationSource.C | 65 +++ .../externalRadiationSource.H | 158 ++++++ .../newExternalRadiationSource.C | 74 +++ .../planeToCylinder/planeToCylinder.C | 65 +++ .../planeToCylinder/planeToCylinder.H | 114 +++++ .../pointSource/pointSource.C | 69 +++ .../pointSource/pointSource.H | 119 +++++ .../externalRadiation/viewFactor/viewFactor.C | 89 ++++ .../externalRadiation/viewFactor/viewFactor.H | 152 ++++++ .../fvPatchFields/fieldStorage/fieldStorage.C | 96 ++++ .../fvPatchFields/fieldStorage/fieldStorage.H | 116 +++++ ...allHeatFluxTemperatureFvPatchScalarField.C | 168 ++++++ ...allHeatFluxTemperatureFvPatchScalarField.H | 181 +++++++ .../constantResistanceThermalGap.C | 94 ++++ .../constantResistanceThermalGap.H | 114 +++++ .../constantThermalGap/constantThermalGap.C | 100 ++++ .../constantThermalGap/constantThermalGap.H | 114 +++++ .../thermalGaps/thermalGap/newThermalGap.C | 80 +++ .../thermalGaps/thermalGap/thermalGap.C | 63 +++ .../thermalGaps/thermalGap/thermalGap.H | 164 ++++++ .../constantThermal/constantThermal.C | 142 ++++++ .../constantThermal/constantThermal.H | 126 +++++ .../multiMaterialThermal.C | 325 ++++++++++++ .../multiMaterialThermal.H | 146 ++++++ .../multiMaterialZonesThermal.C | 96 ++++ .../multiMaterialZonesThermal.H | 98 ++++ .../thermalLaws/thermalLaw/newThermalLaw.C | 80 +++ .../thermalLaws/thermalLaw/thermalLaw.C | 62 +++ .../thermalLaws/thermalLaw/thermalLaw.H | 173 +++++++ .../thermalModel/thermalModel.C | 187 +++++++ .../thermalModel/thermalModel.H | 160 ++++++ .../constantThermalSource.C | 90 ++++ .../constantThermalSource.H | 113 +++++ .../thermalSource/newThermalSource.C | 80 +++ .../thermalSource/thermalSource.C | 61 +++ .../thermalSource/thermalSource.H | 157 ++++++ .../coupled/conjugateHeatFoam/createFields.H | 57 ++- .../conjugateHeatFoam/createFluidMesh.H | 5 - .../conjugateHeatFoam/createSolidFields.H | 25 +- .../conjugateHeatFoam/createSolidMesh.H | 21 +- .../coupled/conjugateHeatFoam/detachPatches.H | 2 +- .../conjugateHeatFoam/initConvergenceCheck.H | 7 + .../solvers/coupled/conjugateHeatFoam/pEqn.H | 47 ++ .../readTransportProperties.H | 19 + .../coupled/conjugateHeatFoam/solveEnergy.H | 39 +- .../coupled/conjugateHeatFoam/solveFluid.H | 47 -- .../conjugateHeatSimpleFoam/Make/files | 3 + .../conjugateHeatSimpleFoam/Make/options | 22 + .../coupled/conjugateHeatSimpleFoam/UEqn.H | 27 + .../conjugateHeatSimpleFoam/attachPatches.H | 18 + .../conjugateHeatSimpleFoam.C | 115 +++++ .../conjugateHeatSimpleFoam/createFields.H | 112 ++++ .../conjugateHeatSimpleFoam/createFluidMesh.H | 13 + .../createSolidFields.H | 30 ++ .../conjugateHeatSimpleFoam/createSolidMesh.H | 30 ++ .../conjugateHeatSimpleFoam/detachPatches.H | 38 ++ .../initConvergenceCheck.H | 7 + .../coupled/conjugateHeatSimpleFoam/pEqn.H | 50 ++ .../readSolidControls.H | 7 + .../readTransportProperties.H | 19 + .../conjugateHeatSimpleFoam/solveEnergy.H | 46 ++ .../conjugateHeatFoam/conjugateCavity/0/G | 61 +++ .../conjugateHeatFoam/conjugateCavity/0/T | 15 +- .../conjugateCavity/0/epsilon | 62 +++ .../conjugateHeatFoam/conjugateCavity/0/k | 50 ++ .../conjugateCavity/0/{DT => kappaEff} | 8 +- .../conjugateCavity/0/{p => materials} | 9 +- .../conjugateHeatFoam/conjugateCavity/0/nut | 167 ++++++ .../conjugateHeatFoam/conjugateCavity/0/p_rgh | 53 ++ .../conjugateHeatFoam/conjugateCavity/0/solid | 1 - .../0 => conjugateCavity/0/solid}/T | 7 +- .../0/DT => conjugateCavity/0/solid/k} | 8 +- .../conjugateCavity/0/solid/materials | 43 ++ .../conjugateCavity/Allclean | 8 +- .../conjugateHeatFoam/conjugateCavity/Allrun | 22 +- .../conjugateCavity/boundary | 61 --- .../constant/RASProperties} | 42 +- .../conjugateCavity/constant/g | 21 + .../constant/polyMesh/blockMeshDict | 2 +- .../constant/polyMesh/boundaryCoupled} | 39 +- .../constant/radiationProperties | 48 ++ .../conjugateCavity/constant/solid | 1 - .../constant/solid}/polyMesh/blockMeshDict | 0 .../constant/solid/polyMesh/boundaryCoupled | 55 ++ .../constant/solid/thermalProperties | 49 ++ .../constant/transportProperties | 16 +- .../constant/turbulenceProperties | 19 + .../conjugateCavity/fluid.setSet | 2 + .../conjugateCavity/setBatch | 2 - .../conjugateCavity/solid.setSet | 4 + .../conjugateCavity/system/controlDict | 36 +- .../conjugateCavity/system/decomposeParDict | 52 ++ .../conjugateCavity/system/fvSchemes | 31 +- .../conjugateCavity/system/fvSolution | 78 ++- .../conjugateCavity/system/solid | 1 - .../system/solid/decomposeParDict | 52 ++ .../system/solid}/fvSchemes | 9 +- .../system/solid}/fvSolution | 9 +- .../conjugateHeatFoam/heatedBlock/Allrun | 8 - .../conjugateHeatFoam/heatedBlock/setBatch | 2 - tutorials/coupled/conjugateHeatFoam/makeLinks | 42 -- .../conjugateCavity/.gitignore | 52 ++ .../conjugateCavity/0/G | 61 +++ .../conjugateCavity/0/T | 58 +++ .../conjugateCavity/0/U | 53 ++ .../conjugateCavity/0/epsilon | 62 +++ .../conjugateCavity/0/k | 50 ++ .../conjugateCavity/0/kappaEff | 51 ++ .../conjugateCavity/0/materials | 46 ++ .../conjugateCavity/0/nut | 167 ++++++ .../conjugateCavity/0/p_rgh | 53 ++ .../conjugateCavity/0/solid/T | 49 ++ .../conjugateCavity/0/solid/k | 46 ++ .../conjugateCavity/0/solid/materials | 43 ++ .../conjugateCavity/Allclean | 10 + .../conjugateCavity/Allrun | 22 + .../conjugateCavity/constant/RASProperties | 41 ++ .../conjugateCavity/constant/g | 21 + .../constant/polyMesh/blockMeshDict | 69 +++ .../constant/radiationProperties | 48 ++ .../constant/solid/polyMesh/blockMeshDict | 66 +++ .../constant/solid/polyMesh/boundaryCoupled | 55 ++ .../constant/solid/thermalProperties | 49 ++ .../constant/transportProperties | 33 ++ .../constant/turbulenceProperties | 19 + .../conjugateCavity/fluid.setSet | 2 + .../conjugateCavity/solid.setSet | 4 + .../conjugateCavity/system/controlDict | 71 +++ .../conjugateCavity/system/decomposeParDict | 52 ++ .../conjugateCavity/system/fvSchemes | 71 +++ .../conjugateCavity/system/fvSolution | 102 ++++ .../system/solid/decomposeParDict | 52 ++ .../conjugateCavity/system/solid/fvSchemes | 54 ++ .../conjugateCavity/system/solid/fvSolution} | 34 +- 171 files changed, 12818 insertions(+), 362 deletions(-) create mode 100755 applications/solvers/coupled/conjugateHeatFoam/Allwmake create mode 100644 applications/solvers/coupled/conjugateHeatFoam/UEqn.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/files create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/options create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItemIO.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/IOFieldAverage.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/detachPatches.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFluxTemplates.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/newExternalRadiationSource.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/newThermalGap.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/newThermalLaw.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/newThermalSource.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.C create mode 100644 applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/initConvergenceCheck.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/pEqn.H create mode 100644 applications/solvers/coupled/conjugateHeatFoam/readTransportProperties.H delete mode 100644 applications/solvers/coupled/conjugateHeatFoam/solveFluid.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/Make/files create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/Make/options create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/attachPatches.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/createFluidMesh.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidFields.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidMesh.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/detachPatches.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/readSolidControls.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/readTransportProperties.H create mode 100644 applications/solvers/coupled/conjugateHeatSimpleFoam/solveEnergy.H create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/G create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/epsilon create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/k rename tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/{DT => kappaEff} (89%) rename tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/{p => materials} (93%) create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/nut create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p_rgh delete mode 120000 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/0 => conjugateCavity/0/solid}/T (92%) rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/0/DT => conjugateCavity/0/solid/k} (88%) create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials delete mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/boundary rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/system/controlDict => conjugateCavity/constant/RASProperties} (69%) create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/g rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/boundary => conjugateCavity/constant/polyMesh/boundaryCoupled} (77%) create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/radiationProperties delete mode 120000 tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/constant => conjugateCavity/constant/solid}/polyMesh/blockMeshDict (100%) create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/thermalProperties create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/turbulenceProperties create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/fluid.setSet delete mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/setBatch create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/solid.setSet create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/decomposeParDict delete mode 120000 tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid create mode 100644 tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/decomposeParDict rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/system => conjugateCavity/system/solid}/fvSchemes (89%) rename tutorials/coupled/conjugateHeatFoam/{heatedBlock/system => conjugateCavity/system/solid}/fvSolution (94%) delete mode 100755 tutorials/coupled/conjugateHeatFoam/heatedBlock/Allrun delete mode 100644 tutorials/coupled/conjugateHeatFoam/heatedBlock/setBatch delete mode 100644 tutorials/coupled/conjugateHeatFoam/makeLinks create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/.gitignore create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/G create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/T create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/U create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/epsilon create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/k create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/kappaEff create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/materials create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/nut create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/p_rgh create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/T create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/k create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials create mode 100755 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allclean create mode 100755 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allrun create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/RASProperties create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/g create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/polyMesh/blockMeshDict create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/radiationProperties create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/blockMeshDict create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/thermalProperties create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/transportProperties create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/turbulenceProperties create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/fluid.setSet create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/solid.setSet create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/controlDict create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/decomposeParDict create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSolution create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/decomposeParDict create mode 100644 tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes rename tutorials/coupled/{conjugateHeatFoam/conjugateCavity/system/sampleDict => conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSolution} (71%) diff --git a/applications/solvers/coupled/conjugateHeatFoam/Allwmake b/applications/solvers/coupled/conjugateHeatFoam/Allwmake new file mode 100755 index 000000000..c416ec239 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake libso conjugateHeatTransfer +wmake + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/coupled/conjugateHeatFoam/Make/options b/applications/solvers/coupled/conjugateHeatFoam/Make/options index fa25c2dca..75fefc0ed 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/Make/options +++ b/applications/solvers/coupled/conjugateHeatFoam/Make/options @@ -1,9 +1,22 @@ EXE_INC = \ + -IconjugateHeatTransfer/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ + -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/coupledMatrix/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude - + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude EXE_LIBS = \ + -lincompressibleTurbulenceModel \ + -lincompressibleRASModels \ + -lincompressibleTransportModels \ -lcoupledLduMatrix \ -lfiniteVolume \ - -llduSolvers + -lradiation \ + -lbasicThermophysicalModels \ + -lspecie \ + -lconjugateHeatTransfer diff --git a/applications/solvers/coupled/conjugateHeatFoam/UEqn.H b/applications/solvers/coupled/conjugateHeatFoam/UEqn.H new file mode 100644 index 000000000..df6f90ac0 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/UEqn.H @@ -0,0 +1,26 @@ + // Solve the momentum equation + + fvVectorMatrix UEqn + ( + fvm::ddt(U) + + fvm::div(phi, U) + + turbulence->divDevReff(U) + ); + + UEqn.relax(); + + if (momentumPredictor) + { + solve + ( + UEqn + == + fvc::reconstruct + ( + ( + - ghf*fvc::snGrad(rhok) + - fvc::snGrad(p_rgh) + )*mesh.magSf() + ) + ); + } diff --git a/applications/solvers/coupled/conjugateHeatFoam/attachPatches.H b/applications/solvers/coupled/conjugateHeatFoam/attachPatches.H index 225f570e0..3a2f62f06 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/attachPatches.H +++ b/applications/solvers/coupled/conjugateHeatFoam/attachPatches.H @@ -14,5 +14,5 @@ } // Force recalculation of weights - mesh.surfaceInterpolation::movePoints(); + mesh.surfaceInterpolation::movePoints(); } diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C index 29f0c9fa3..19e1ad642 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatFoam.C @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright held by original author - \\/ M anipulation | + \\ / A nd | Copyright (C) 2008-2011 H. Jasak & H. Rusche + \\/ M anipulation | All rights reserved ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,47 +23,94 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Application - conjugateHeatFoam - -Author - Hrvoje Jasak, Wikki Ltd. All rights reserved. + chipAirCoolingFoam Description - Transient solver for incompressible, laminar flow of Newtonian fluids - with conjugate heat transfer + Transient solver for buoyancy-driven turbulent flow of incompressible + Newtonian fluids with conjugate heat transfer, complex heat conduction + and radiation \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "coupledFvMatrices.H" #include "regionCouplePolyPatch.H" +#include "radiationModel.H" +#include "thermalModel.H" +#include "singlePhaseTransportModel.H" +#include "RASModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) { # include "setRootCase.H" - # include "createTime.H" # include "createFluidMesh.H" -# include "attachPatches.H" # include "createSolidMesh.H" +# include "readGravitationalAcceleration.H" # include "createFields.H" # include "createSolidFields.H" - # include "initContinuityErrs.H" +# include "readTimeControls.H" +# include "CourantNo.H" +# include "setInitialDeltaT.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info<< "\nStarting time loop\n" << endl; - for (runTime++; !runTime.end(); runTime++) + while (runTime.loop()) { Info<< "Time = " << runTime.timeName() << nl << endl; -# include "solveFluid.H" +# include "readTimeControls.H" +# include "readPISOControls.H" +# include "CourantNo.H" +# include "setDeltaT.H" + + // Detach patches +# include "detachPatches.H" + +# include "UEqn.H" + + p_rgh.storePrevIter(); + + for (int corr = 0; corr < nCorr; corr++) + { +# include "pEqn.H" + } + + // Update turbulent quantities + turbulence->correct(); + + radiation->correct(); + + // Update thermal conductivity in the fluid + kappaEff = rho*Cp*(turbulence->nu()/Pr + turbulence->nut()/Prt); + + // Update thermal conductivity in the solid + solidThermo.correct(); + ksolid = solidThermo.k(); + + rhoCpsolid.oldTime(); + rhoCpsolid = solidThermo.rho()*solidThermo.C(); + + // Coupled patches +# include "attachPatches.H" + + kappaEff.correctBoundaryConditions(); + ksolid.correctBoundaryConditions(); + + // Interpolate to the faces and add thermal resistance + surfaceScalarField ksolidf = fvc::interpolate(ksolid); + solidThermo.modifyResistance(ksolidf); + # include "solveEnergy.H" + // Update density according to Boussinesq approximation + rhok = 1.0 - beta*(T - TRef); + runTime.write(); Info<< "ExecutionTime = " diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/files b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/files new file mode 100644 index 000000000..6c86e9a9c --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/files @@ -0,0 +1,49 @@ +thermalModel/thermalModel.C +thermalLaws = thermalModel/thermalLaws + +$(thermalLaws)/thermalLaw/thermalLaw.C +$(thermalLaws)/thermalLaw/newThermalLaw.C +$(thermalLaws)/constantThermal/constantThermal.C +$(thermalLaws)/multiMaterialThermal/multiMaterialThermal.C +$(thermalLaws)/multiMaterialZonesThermal/multiMaterialZonesThermal.C + +thermalGaps = thermalModel/thermalGaps + +$(thermalGaps)/thermalGap/thermalGap.C +$(thermalGaps)/thermalGap/newThermalGap.C +$(thermalGaps)/constantThermalGap/constantThermalGap.C +$(thermalGaps)/constantResistanceThermalGap/constantResistanceThermalGap.C + +thermalSource = thermalModel/thermalSource + +$(thermalSource)/thermalSource/thermalSource.C +$(thermalSource)/thermalSource/newThermalSource.C +$(thermalSource)/constantThermalSource/constantThermalSource.C + +BCs = fvPatchFields + +$(BCs)/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.C + +$(BCs)/chtRegionCoupleBase/chtRegionCoupleBase.C +$(BCs)/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C +$(BCs)/chtRcTemperature/chtRcTemperatureFvPatchScalarField.C +$(BCs)/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.C +$(BCs)/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.C + +$(BCs)/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.C + +$(BCs)/externalRadiation/externalRadiationSource/externalRadiationSource.C +$(BCs)/externalRadiation/externalRadiationSource/newExternalRadiationSource.C +$(BCs)/externalRadiation/constantFlux/constantFlux.C +$(BCs)/externalRadiation/viewFactor/viewFactor.C +$(BCs)/externalRadiation/planeToCylinder/planeToCylinder.C +$(BCs)/externalRadiation/pointSource/pointSource.C +$(BCs)/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C +$(BCs)/adiabatic/adiabaticFvPatchScalarField.C + +FOs = functionObjects + +$(FOs)/heatFlux/heatFlux/heatFlux.C +$(FOs)/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.C + +LIB = $(FOAM_LIBBIN)/libconjugateHeatTransfer diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/options b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/options new file mode 100644 index 000000000..721166578 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/Make/options @@ -0,0 +1,13 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/VectorN/lnInclude + +LIB_LIBS = \ + -lfiniteVolume \ + -lspecie \ + -lbasicThermophysicalModels \ + -lradiation \ + -lVectorN + diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.C new file mode 100644 index 000000000..61c0e7595 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.C @@ -0,0 +1,97 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fieldAverageItem.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* Foam::NamedEnum + < + Foam::fieldAverageItem::baseType, + 2 + >::names[] = + { + "iteration", + "time" + }; +} + + +const Foam::NamedEnum + Foam::fieldAverageItem::baseTypeNames_; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fieldAverageItem::fieldAverageItem() +: + fieldName_("unknown"), + mean_(0), + prime2Mean_(0), + base_(ITER) +{} + + +Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem) +: + fieldName_(faItem.fieldName_), + mean_(faItem.mean_), + prime2Mean_(faItem.prime2Mean_), + base_(faItem.base_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fieldAverageItem::~fieldAverageItem() +{} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn + ( + "Foam::fieldAverageItem::operator=(const Foam::fieldAverageItem&)" + ) << "Attempted assignment to self" << nl + << abort(FatalError); + } + + // Set updated values + fieldName_ = rhs.fieldName_; + mean_ = rhs.mean_; + prime2Mean_ = rhs.prime2Mean_; + base_ = rhs.base_; +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.H new file mode 100644 index 000000000..0c4aee6cf --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItem.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fieldAverageItem + +Description + Helper class to describe what form of averaging to apply. A set will be + applied to each base field in Foam::fieldAverage, of the form: + + \verbatim + { + mean on; + prime2Mean on; + base time; // iteration + } + \endverbatim + +SourceFiles + fieldAverageItem.C + fieldAverageItemIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldAverageItem_H +#define fieldAverageItem_H + +#include "NamedEnum.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class fieldAverageItem; +Istream& operator>>(Istream&, fieldAverageItem&); +Ostream& operator<<(Ostream&, const fieldAverageItem&); + + +/*---------------------------------------------------------------------------*\ + Class fieldAverageItem Declaration +\*---------------------------------------------------------------------------*/ + +class fieldAverageItem +{ +public: + + // Public data + + //- Enumeration defining the averaging base type + enum baseType + { + ITER, + TIME + }; + + +private: + + // Private data + + //- Field name + word fieldName_; + + //- Compute mean flag + Switch mean_; + + //- Compute prime-squared mean flag + Switch prime2Mean_; + + //- Averaging base type names + static const NamedEnum baseTypeNames_; + + //- Averaging base type + baseType base_; + + +public: + + // Constructors + + //- Construct null + fieldAverageItem(); + + //- Construct from Istream + fieldAverageItem(Istream&); + + //- Construct as copy + fieldAverageItem(const fieldAverageItem&); + + + //- Destructor + ~fieldAverageItem(); + + + // Member Functions + + // Access + + //- Return const access to the field name + const word& fieldName() const + { + return fieldName_; + } + + //- Return const access to the mean flag + const Switch& mean() const + { + return mean_; + } + + //- Return const access to the prime-squared mean flag + const Switch& prime2Mean() const + { + return prime2Mean_; + } + + //- Return averaging base type name + const word base() const + { + return baseTypeNames_[base_]; + } + + //- Return true if base is ITER + Switch ITERBase() const + { + return base_ == ITER; + } + + //- Return true if base is time + Switch timeBase() const + { + return base_ == TIME; + } + + + // Member Operators + + void operator=(const fieldAverageItem&); + + + // Friend Operators + + friend bool operator== + ( + const fieldAverageItem& a, + const fieldAverageItem& b + ) + { + return + a.fieldName_ == b.fieldName_ + && a.mean_ == b.mean_ + && a.prime2Mean_ == b.prime2Mean_ + && a.base_ == b.base_; + } + + friend bool operator!= + ( + const fieldAverageItem& a, + const fieldAverageItem& b + ) + { + return !(a == b); + } + + + // IOstream Operators + + friend Istream& operator>>(Istream&, fieldAverageItem&); + friend Ostream& operator<<(Ostream&, const fieldAverageItem&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItemIO.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItemIO.C new file mode 100644 index 000000000..30f4d8702 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/fieldAverageItem/fieldAverageItemIO.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fieldAverageItem.H" +#include "IOstreams.H" +#include "dictionaryEntry.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fieldAverageItem::fieldAverageItem(Istream& is) +: + fieldName_("unknown"), + mean_(0), + prime2Mean_(0) +{ + is.check("Foam::fieldAverageItem::fieldAverageItem(Foam::Istream&)"); + + const dictionaryEntry entry(dictionary::null, is); + + fieldName_ = entry.keyword(); + entry.lookup("mean") >> mean_; + entry.lookup("prime2Mean") >> prime2Mean_; + base_ = baseTypeNames_[entry.lookup("base")]; +} + + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem) +{ + is.check + ( + "Foam::Istream& Foam::operator>>" + "(Foam::Istream&, Foam::fieldAverageItem&)" + ); + + const dictionaryEntry entry(dictionary::null, is); + + faItem.fieldName_ = entry.keyword(); + entry.lookup("mean") >> faItem.mean_; + entry.lookup("prime2Mean") >> faItem.prime2Mean_; + faItem.base_ = faItem.baseTypeNames_[entry.lookup("base")]; + + return is; +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const fieldAverageItem& faItem) +{ + os.check + ( + "Foam::Ostream& Foam::operator<<" + "(Foam::Ostream&, const Foam::fieldAverageItem&)" + ); + + os << faItem.fieldName_ << nl << token::BEGIN_BLOCK << nl; + os.writeKeyword("mean") << faItem.mean_ << token::END_STATEMENT << nl; + os.writeKeyword("prime2Mean") << faItem.mean_ + << token::END_STATEMENT << nl; + os.writeKeyword("base") << faItem.baseTypeNames_[faItem.base_] + << token::END_STATEMENT << nl << token::END_BLOCK << nl; + + os.check + ( + "Foam::Ostream& Foam::operator<<" + "(Foam::Ostream&, const Foam::fieldAverageItem&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/IOFieldAverage.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/IOFieldAverage.H new file mode 100644 index 000000000..e252ce589 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/IOFieldAverage.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Typedef + Foam::IOfieldAverage + +Description + Instance of the generic IOOutputFilter for fieldAverage. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOfieldAverage_H +#define IOfieldAverage_H + +#include "fieldAverage.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter IOFieldAverage; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/detachPatches.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/detachPatches.H new file mode 100644 index 000000000..30e3ebe30 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/detachPatches.H @@ -0,0 +1,18 @@ +{ + const polyPatchList& patches = mesh.boundaryMesh(); + + forAll (patches, patchI) + { + if (isType(patches[patchI])) + { + const regionCouplePolyPatch& rcp = + refCast(patches[patchI]); + + // Detach it here + rcp.detach(); + } + } + + // Force recalculation of weights + mesh.surfaceInterpolation::movePoints(); +} diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.C new file mode 100644 index 000000000..a48fcfbf6 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.C @@ -0,0 +1,241 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "heatFlux.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvc.H" +#include "chtRcTemperatureFvPatchScalarField.H" +#include "processorFvPatchFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::heatFlux, 0); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::heatFlux::heatFlux +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + Kfluid_(dict.lookup("K")), + obr_(obr), + active_(true) +{ + // Only active if a fvMesh is available + if (isA(obr_)) + { + read(dict); + } + else + { + active_ = false; + WarningIn + ( + "heatFlux::heatFlux\n" + "(\n" + "const word&,\n" + "const objectRegistry&,\n" + "const dictionary&,\n" + "const bool\n" + ")" + ) << "No fvMesh available, deactivating." + << nl << endl; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::heatFlux::~heatFlux() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::heatFlux::calcAndPrint() +{ + const volScalarField& T = + obr_.lookupObject("T"); + const volScalarField& kappaEff = + obr_.lookupObject(Kfluid_); + //const surfaceScalarField& kappaEff = + // obr_.lookupObject(Kfluid_); + + scalar rho = 1.2; + scalar Cp = 1000; + + const fvMesh& mesh = T.mesh(); + + surfaceScalarField heatFluxD = + -fvc::interpolate(kappaEff)*fvc::snGrad(T); + // -kappaEff*fvc::snGrad(T); + + const surfaceScalarField::GeometricBoundaryField& patchHeatFluxD = + heatFluxD.boundaryField(); + //const surfaceScalarField::GeometricBoundaryField& patchHeatFluxD = + // heatFluxC.boundaryField(); + + //surfaceScalarField::GeometricBoundaryField patchHeatFluxC = + + scalar sumConduction = 0.0; + scalar sumConvection = 0.0; + scalar sumRadiation = 0.0; + + Info<< "\nWall heat fluxes [W]" << endl; + forAll(patchHeatFluxD, patchi) + { + if(isA(T.boundaryField()[patchi])) + { + continue; + } + + scalar conduction = gSum + ( + mesh.magSf().boundaryField()[patchi] + *heatFluxD.boundaryField()[patchi] + ); + + // Account for heat sources at region couple BCs + if(isA(T.boundaryField()[patchi])) + { + const chtRcTemperatureFvPatchScalarField& pT = + dynamic_cast + ( + T.boundaryField()[patchi] + ); + + conduction -= gSum + ( + pT.source()*mesh.magSf().boundaryField()[patchi] + ); + } + + scalar convection = 0.0; + scalar radiation = 0.0; + + if(obr_.foundObject("phi")) + { + const surfaceScalarField& phi = + obr_.lookupObject("phi"); + + convection = gSum + ( + rho*Cp*T.boundaryField()[patchi] + *phi.boundaryField()[patchi] + ); + } + + if(obr_.foundObject("Qr")) + { + const volScalarField& Qr = + obr_.lookupObject("Qr"); + + radiation = gSum + ( + Qr.boundaryField()[patchi] + *mesh.magSf().boundaryField()[patchi] + ); + } + + Info<< mesh.boundary()[patchi].name() + << " " + << conduction + << " " + << convection + << " " + << radiation + << " " + << conduction + convection + radiation + << endl; + + sumConduction += conduction; + sumConvection += convection; + sumRadiation += radiation; + } + + Info<< "sum " + << sumConduction + << " " + << sumConvection + << " " + << sumRadiation + << " " + << sumConduction + sumConvection + sumRadiation + << nl << endl; +} + +void Foam::heatFlux::read(const dictionary& dict) +{ + if (active_) + { + } +} + + +void Foam::heatFlux::execute() +{ + if (active_) + { + calcAndPrint(); + } +} + + +void Foam::heatFlux::end() +{ + if (active_) + { + calcAndPrint(); + } +} + + +void Foam::heatFlux::write() +{ + if (active_) + { + } +} + + +void Foam::heatFlux::updateMesh(const mapPolyMesh&) +{ + // Do nothing +} + + +void Foam::heatFlux::movePoints(const pointField&) +{ + // Do nothing +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.H new file mode 100644 index 000000000..81f7e128d --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFlux.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::heatFlux + +Description + +SourceFiles + heatFlux.C + heatFluxTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef heatFlux_H +#define heatFlux_H + +#include "volFieldsFwd.H" +#include "pointFieldFwd.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class heatFluxItem; +class OFstream; +template +class List; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class heatFlux Declaration +\*---------------------------------------------------------------------------*/ + +class heatFlux +{ +protected: + + // Private data + + //- Name of this set of heat flux check + word name_; + + //- name of fluid thermal diffusivity + word Kfluid_; + + //- Database this class is registered to + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + // Private Member Functions + + // Calculation functions + + //- Write + virtual void calcAndPrint(); + + // Functions to be over-ridden from IOoutputFilter class + + //- Update mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Move points + virtual void movePoints(const Field&); + + + //- Disallow default bitwise copy construct + heatFlux(const heatFlux&); + + //- Disallow default bitwise assignment + void operator=(const heatFlux&); + + +public: + + //- Runtime type information + TypeName("heatFlux"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + heatFlux + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~heatFlux(); + + + // Member Functions + + //- Return name of the set of field averages + virtual const word& name() const + { + return name_; + } + + //- Read the field average data + virtual void read(const dictionary&); + + //- Execute the averaging + virtual void execute(); + + //- Execute the averaging at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the field average data and write + virtual void write(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFluxTemplates.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFluxTemplates.C new file mode 100644 index 000000000..29fb05666 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFlux/heatFluxTemplates.C @@ -0,0 +1,286 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "heatFluxItem.H" +#include "volFields.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::heatFlux::addMeanField +( + const label fieldI, + wordList& meanFieldList +) const +{ + if (faItems_[fieldI].mean()) + { + typedef GeometricField fieldType; + + const word& fieldName = faItems_[fieldI].fieldName(); + + const word meanFieldName = fieldName + EXT_MEAN; + + Info<< "Reading/calculating field " << meanFieldName << nl << endl; + + if (obr_.foundObject(meanFieldName)) + { + meanFieldList[fieldI] = meanFieldName; + } + else if (obr_.found(meanFieldName)) + { + Info<< "Cannot allocate average field " << meanFieldName + << " since an object with that name already exists." + << " Disabling averaging." << nl << endl; + meanFieldList[fieldI] = word::null; + } + else + { + const fieldType& baseField = + obr_.lookupObject(fieldName); + + // Store on registry + obr_.store + ( + new fieldType + ( + IOobject + ( + meanFieldName, + obr_.time().timeName(), + obr_, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + 1*baseField + ) + ); + + meanFieldList[fieldI] = meanFieldName; + } + } +} + + +template +void Foam::heatFlux::addPrime2MeanField +( + const label fieldI, + const wordList& meanFieldList, + wordList& prime2MeanFieldList +) const +{ + if (faItems_[fieldI].mean() && meanFieldList[fieldI].size()) + { + typedef GeometricField fieldType1; + typedef GeometricField fieldType2; + + const word& fieldName = faItems_[fieldI].fieldName(); + + const word meanFieldName = fieldName + EXT_PRIME2MEAN; + Info<< "Reading/calculating field " << meanFieldName << nl << endl; + + if (obr_.foundObject(meanFieldName)) + { + prime2MeanFieldList[fieldI] = meanFieldName; + } + else if (obr_.found(meanFieldName)) + { + Info<< "Cannot allocate average field " << meanFieldName + << " since an object with that name already exists." + << " Disabling averaging." << nl << endl; + prime2MeanFieldList[fieldI] = word::null; + } + else + { + const fieldType1& baseField = + obr_.lookupObject(fieldName); + const fieldType1& meanField = + obr_.lookupObject(meanFieldList[fieldI]); + + obr_.store + ( + new fieldType2 + ( + IOobject + ( + meanFieldName, + obr_.time().timeName(), + obr_, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE + ), + sqr(baseField) - sqr(meanField) + ) + ); + + prime2MeanFieldList[fieldI] = meanFieldName; + } + } +} + + +template +void Foam::heatFlux::calculateMeanFields(const wordList& meanFieldList) +const +{ + typedef GeometricField fieldType; + + const scalar dt = obr_.time().deltaTValue(); + + forAll(faItems_, i) + { + if (faItems_[i].mean() && meanFieldList[i].size()) + { + const word& fieldName = faItems_[i].fieldName(); + const fieldType& baseField = + obr_.lookupObject(fieldName); + fieldType& meanField = const_cast + ( + obr_.lookupObject(meanFieldList[i]) + ); + + scalar alpha = 0.0; + scalar beta = 0.0; + if (faItems_[i].timeBase()) + { + alpha = (totalTime_[i] - dt)/totalTime_[i]; + beta = dt/totalTime_[i]; + } + else + { + alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]); + beta = 1.0/scalar(totalIter_[i]); + } + + meanField = alpha*meanField + beta*baseField; + } + } +} + + +template +void Foam::heatFlux::calculatePrime2MeanFields +( + const wordList& meanFieldList, + const wordList& prime2MeanFieldList +) const +{ + typedef GeometricField fieldType1; + typedef GeometricField fieldType2; + + const scalar dt = obr_.time().deltaTValue(); + + forAll(faItems_, i) + { + if + ( + faItems_[i].prime2Mean() + && meanFieldList[i].size() + && prime2MeanFieldList[i].size() + ) + { + const word& fieldName = faItems_[i].fieldName(); + const fieldType1& baseField = + obr_.lookupObject(fieldName); + const fieldType1& meanField = + obr_.lookupObject(meanFieldList[i]); + fieldType2& prime2MeanField = const_cast + ( + obr_.lookupObject(prime2MeanFieldList[i]) + ); + + scalar alpha = 0.0; + scalar beta = 0.0; + if (faItems_[i].timeBase()) + { + alpha = (totalTime_[i] - dt)/totalTime_[i]; + beta = dt/totalTime_[i]; + } + else + { + alpha = scalar(totalIter_[i] - 1)/scalar(totalIter_[i]); + beta = 1.0/scalar(totalIter_[i]); + } + + prime2MeanField = + alpha*prime2MeanField + + beta*sqr(baseField) + - sqr(meanField); + } + } +} + + +template +void Foam::heatFlux::addMeanSqrToPrime2Mean +( + const wordList& meanFieldList, + const wordList& prime2MeanFieldList +) const +{ + typedef GeometricField fieldType1; + typedef GeometricField fieldType2; + + forAll(faItems_, i) + { + if + ( + faItems_[i].prime2Mean() + && meanFieldList[i].size() + && prime2MeanFieldList[i].size() + ) + { + const fieldType1& meanField = + obr_.lookupObject(meanFieldList[i]); + fieldType2& prime2MeanField = const_cast + ( + obr_.lookupObject(prime2MeanFieldList[i]) + ); + + prime2MeanField += sqr(meanField); + } + } +} + + +template +void Foam::heatFlux::writeFieldList(const wordList& fieldList) const +{ + typedef GeometricField fieldType; + + forAll(fieldList, i) + { + if (fieldList[i].size()) + { + const fieldType& f = obr_.lookupObject(fieldList[i]); + f.write(); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.C new file mode 100644 index 000000000..9a14decf3 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "heatFluxFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(heatFluxFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + heatFluxFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.H new file mode 100644 index 000000000..d445bbdd2 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/functionObjects/heatFlux/heatFluxFunctionObject/heatFluxFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-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 . + +Typedef + Foam::heatFluxFunctionObject + +Description + FunctionObject wrapper around fieldAverage to allow them to be created + via the functions entry within controlDict. + +SourceFiles + heatFluxFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef heatFluxFunctionObject_H +#define heatFluxFunctionObject_H + +#include "heatFlux.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject + heatFluxFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.C new file mode 100644 index 000000000..5503a4c9b --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.C @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "adiabaticFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "radiationConstants.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::adiabaticFvPatchScalarField:: +adiabaticFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(p, iF), + KName_("undefined-K") +{ + refValue() = 0.0; + refGrad() = 0.0; + valueFraction() = 0.0; +} + + +Foam::adiabaticFvPatchScalarField:: +adiabaticFvPatchScalarField +( + const adiabaticFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(ptf, p, iF, mapper), + KName_(ptf.KName_) +{} + + +Foam::adiabaticFvPatchScalarField:: +adiabaticFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF), + KName_(dict.lookup("K")) +{ + refValue() = 0.0; + refGrad() = 0.0; + valueFraction() = 0.0; + + if (dict.found("value")) + { + fvPatchField::operator= + ( + scalarField("value", dict, p.size()) + ); + } +} + + +Foam::adiabaticFvPatchScalarField:: +adiabaticFvPatchScalarField +( + const adiabaticFvPatchScalarField& tppsf +) +: + mixedFvPatchScalarField(tppsf), + KName_(tppsf.KName_) +{} + + +Foam::adiabaticFvPatchScalarField:: +adiabaticFvPatchScalarField +( + const adiabaticFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(tppsf, iF), + KName_(tppsf.KName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::adiabaticFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalarField& Tp = *this; + + const scalarField& Kw = + patch().lookupPatchField(KName_); + + const scalarField& Qr = + patch().lookupPatchField("Qr"); + + scalarField fourQro = 4.0*radiation::sigmaSB.value()*pow4(Tp); + + refGrad() = (Qr + fourQro)/Kw; + valueFraction() = fourQro/(fourQro + Kw*patch().deltaCoeffs()*Tp); + + mixedFvPatchScalarField::updateCoeffs(); +} + + +void Foam::adiabaticFvPatchScalarField::write +( + Ostream& os +) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + adiabaticFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.H new file mode 100644 index 000000000..237278a46 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/adiabatic/adiabaticFvPatchScalarField.H @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + adiabaticFvPatchScalarField + +Description + adiabatic boundary (with radiation) + + Example usage: + myWallPatch + { + type adiabatic; + K K; // Name of K field + value 300.0; // Initial temperature / [K] + } + + +SourceFiles + adiabaticFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef adiabaticFvPatchScalarField_H +#define adiabaticFvPatchScalarField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class adiabaticFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class adiabaticFvPatchScalarField +: + public mixedFvPatchScalarField +{ + // Private data + + //- Name of thermal conductivity field + word KName_; + + +public: + + //- Runtime type information + TypeName("adiabatic"); + + + // Constructors + + //- Construct from patch and internal field + adiabaticFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + adiabaticFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // adiabaticFvPatchScalarField + // onto a new patch + adiabaticFvPatchScalarField + ( + const adiabaticFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + adiabaticFvPatchScalarField + ( + const adiabaticFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new adiabaticFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + adiabaticFvPatchScalarField + ( + const adiabaticFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new adiabaticFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // Mapping functions + + + // I-O + + //- Write + void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.C new file mode 100644 index 000000000..29dd67953 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.C @@ -0,0 +1,215 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "chtRcTemperatureFvPatchScalarField.H" +#include "chtRegionCoupleBase.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "fvMatrices.H" +#include "magLongDelta.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + regionCouplingFvPatchScalarField(p, iF), + kName_("none"), + radiation_(false) +{} + + +chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + regionCouplingFvPatchScalarField(p, iF, dict), + kName_(dict.lookup("K")), + radiation_(readBool(dict.lookup("radiation"))) +{} + + +chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField +( + const chtRcTemperatureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + regionCouplingFvPatchScalarField(ptf, p, iF, mapper), + kName_(ptf.kName_), + radiation_(ptf.radiation_) +{} + + +chtRcTemperatureFvPatchScalarField::chtRcTemperatureFvPatchScalarField +( + const chtRcTemperatureFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + regionCouplingFvPatchScalarField(ptf, iF), + kName_(ptf.kName_), + radiation_(ptf.radiation_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// Return a named shadow patch field +const chtRcTemperatureFvPatchScalarField& +chtRcTemperatureFvPatchScalarField::shadowPatchField() const +{ + return dynamic_cast + < + const chtRcTemperatureFvPatchScalarField& + > + ( + regionCouplingFvPatchScalarField::shadowPatchField() + ); +} + + +void chtRcTemperatureFvPatchScalarField::initEvaluate +( + const Pstream::commsTypes commsType +) +{ + const chtRegionCoupleBase& K = + dynamic_cast + ( + patch().lookupPatchField(kName_) + ); + + K.calcTemperature(*this, shadowPatchField(), K); +} + + +void chtRcTemperatureFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + fvPatchScalarField::evaluate(); +} + + +void chtRcTemperatureFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + fvPatchScalarField::updateCoeffs(); +} + + +tmp chtRcTemperatureFvPatchScalarField::source() const +{ + const fvPatch& p = patch(); + const magLongDelta& mld = magLongDelta::New(p.boundaryMesh().mesh()); + + const scalarField TcOwn = patchInternalField(); + const scalarField TcNei = patchNeighbourField(); + const scalarField& Tw = *this; + + const chtRegionCoupleBase& K = + dynamic_cast + ( + p.lookupPatchField(kName_) + ); + + const scalarField k = K*p.deltaCoeffs(); + + const scalarField kOwn = + K.originalPatchField()/(1 - p.weights())/mld.magDelta(p.index()); + + return kOwn*(Tw - TcOwn) - k*(TcNei - TcOwn); +} + + +void chtRcTemperatureFvPatchScalarField::manipulateMatrix +( + fvScalarMatrix& matrix +) +{ + const fvPatch& p = patch(); + const scalarField& magSf = p.magSf(); + const labelList& cellLabels = p.faceCells(); + scalarField& source = matrix.source(); + + scalarField s = this->source(); + + //Info << "s = " << s << " Sum s = " << sum(s*p.magSf()) << endl; + //Info << "Sum s = " << sum(s*p.magSf()) << endl; + + forAll(cellLabels, i) + { + source[cellLabels[i]] += s[i]*magSf[i]; + } +} + + +void chtRcTemperatureFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("K") << kName_ << token::END_STATEMENT << nl; + os.writeKeyword("radiation") << radiation_ << token::END_STATEMENT << nl; + os.writeKeyword("remoteField") + << remoteFieldName() << token::END_STATEMENT << nl; + this->writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + chtRcTemperatureFvPatchScalarField +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.H new file mode 100644 index 000000000..a6249ea5b --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcTemperature/chtRcTemperatureFvPatchScalarField.H @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + chtRcTemperatureFvPatchScalarField + +Description + Region couple patch field taking radiation into account + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +SourceFiles + chtRcTemperatureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef chtRcTemperatureFvPatchScalarField_H +#define chtRcTemperatureFvPatchScalarField_H + +#include "regionCouplingFvPatchFields.H" +#include "fvMatricesFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class chtRcTemperatureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class chtRcTemperatureFvPatchScalarField +: + public regionCouplingFvPatchScalarField +{ + // Private data + + //- Name of thermal diffusivity field + word kName_; + + //- Take radiation into account for this patch + bool radiation_; + + +public: + + //- Runtime type information + TypeName("chtRcTemperature"); + + + // Constructors + + //- Construct from patch and internal field + chtRcTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + chtRcTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given chtRcTemperatureFvPatchScalarField onto a new patch + chtRcTemperatureFvPatchScalarField + ( + const chtRcTemperatureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy setting internal field reference + chtRcTemperatureFvPatchScalarField + ( + const chtRcTemperatureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new chtRcTemperatureFvPatchScalarField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new chtRcTemperatureFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access functions + + //- Return radiation + bool radiation() const + { + return radiation_; + } + + //- Return shadow patch field + virtual const chtRcTemperatureFvPatchScalarField& + shadowPatchField() const; + + + // Evaluation functions + + //- Initialise the evaluation of the patch field + virtual void initEvaluate(const Pstream::commsTypes commsType); + + //- Evaluate the patch field + virtual void evaluate(const Pstream::commsTypes commsType); + + //- Evaluate the patch field + virtual void updateCoeffs(); + + //- Calculate source term + virtual tmp source() const; + + //- Manipulate matrix + virtual void manipulateMatrix(fvScalarMatrix& matrix); + + //- Write + virtual void write(Ostream&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C new file mode 100644 index 000000000..8280f2ec4 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.C @@ -0,0 +1,364 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "chtRcThermalDiffusivityFvPatchScalarField.H" +#include "chtRcThermalDiffusivitySlaveFvPatchScalarField.H" +#include "chtRcTemperatureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "harmonic.H" +#include "radiationConstants.H" +#include "VectorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + chtRegionCoupleBase(p, iF) +{} + + +chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + chtRegionCoupleBase(p, iF, dict) +{} + + +chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField +( + const chtRcThermalDiffusivityFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + chtRegionCoupleBase(ptf, p, iF, mapper) +{} + + +chtRcThermalDiffusivityFvPatchScalarField::chtRcThermalDiffusivityFvPatchScalarField +( + const chtRcThermalDiffusivityFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + chtRegionCoupleBase(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void chtRcThermalDiffusivityFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + fvPatchScalarField::evaluate(); +} + + +void chtRcThermalDiffusivityFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + calcThermalDiffusivity(*this, shadowPatchField()); +} + + +void +chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity +( + chtRegionCoupleBase& owner, + const chtRegionCoupleBase& neighbour +) const +{ + if(debug) + { + Info << "In chtRcThermalDiffusivityFvPatchScalarField::calcThermalDiffusivity on " + << this->dimensionedInternalField().name() + << " in " << this->patch().boundaryMesh().mesh().name() + << endl; + } + + const fvPatch& p = owner.patch(); + const fvMesh& mesh = p.boundaryMesh().mesh(); + const magLongDelta& mld = magLongDelta::New(mesh); + + const chtRcTemperatureFvPatchScalarField& TwOwn = + dynamic_cast + ( + p.lookupPatchField("T") + ); + scalarField& k = owner; + const scalarField& fOwn = owner.originalPatchField(); + const scalarField TcOwn = TwOwn.patchInternalField(); + + scalarField fNei(p.size()); + scalarField TcNei(p.size()); + + scalarField Qr(p.size(), 0.0); + scalarField fourQro(p.size(), 0.0); + + if (TwOwn.radiation()) + { + Qr += p.lookupPatchField("Qr"); + fourQro += 4.0*radiation::sigmaSB.value()*pow4(TwOwn); + } + + { + Field > lData(neighbour.size()); + + const scalarField& lfNei = neighbour.originalPatchField(); + scalarField lTcNei = TwOwn.shadowPatchField().patchInternalField(); + + forAll(lData, facei) + { + lData[facei][0] = lTcNei[facei]; + lData[facei][1] = lfNei[facei]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + const scalarField& lQrNei = + owner.lookupShadowPatchField("Qr"); + const scalarField& lTwNei = TwOwn.shadowPatchField(); + + forAll(lData, facei) + { + lData[facei][2] = lTwNei[facei]; + lData[facei][3] = lQrNei[facei]; + } + } + + const Field > iData = + owner.regionCouplePatch().interpolate(lData); + + forAll(iData, facei) + { + TcNei[facei] = iData[facei][0]; + fNei[facei] = iData[facei][1]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + forAll(iData, facei) + { + Qr[facei] += iData[facei][3]; + fourQro[facei] += + 4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]); + } + } + } + + // Do interpolation + harmonic interp(mesh); + const scalarField weights = interp.weights(fOwn, fNei, p); + const scalarField kHarm = weights*fOwn + (1.0 - weights)*fNei; + + const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); + const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); + + //Info << "kOwn = " << kOwn << endl; + //Info << "kNei = " << kNei << endl; + //Info << "TcOwn = " << TcOwn << endl; + //Info << "TcNei = " << TcNei << endl; + //Info << "DeltaT = " << TcNei - TcOwn << endl; + + //Info << "Qr = " << Qr << endl; + //Info << "kOwn + kNei = " << (kOwn + kNei) << endl; + + //Info << "k = " << k << endl; + + k = kOwn*(TwOwn*(kNei*(TcNei - TcOwn) + Qr + fourQro) - TcOwn*fourQro); + k /= stabilise((fourQro + TwOwn*(kOwn + kNei))*(TcNei - TcOwn), SMALL); + k /= p.deltaCoeffs(); + + //Info << "k = " << k << endl; + + forAll(k, facei) + { + k[facei] = max(min(k[facei], 100*kHarm[facei]), 0.01*kHarm[facei]); + } + + //Info << "k = " << k << endl; + + owner.fvPatchScalarField::updateCoeffs(); +} + + +void +chtRcThermalDiffusivityFvPatchScalarField::calcTemperature +( + chtRcTemperatureFvPatchScalarField& TwOwn, + const chtRcTemperatureFvPatchScalarField& neighbour, + const chtRegionCoupleBase& ownerK +) const +{ + if(debug) + { + Info << "In chtRcThermalDiffusivityFvPatchScalarField::calcTemperature on " + << this->dimensionedInternalField().name() + << " in " << this->patch().boundaryMesh().mesh().name() + << endl; + } + + const fvPatch& p = TwOwn.patch(); + const fvMesh& mesh = p.boundaryMesh().mesh(); + const magLongDelta& mld = magLongDelta::New(mesh); + + const scalarField& fOwn = ownerK.originalPatchField(); + const scalarField TcOwn = TwOwn.patchInternalField(); + + scalarField fNei(p.size()); + scalarField TcNei(p.size()); + + scalarField Qr(p.size(), 0.0); + scalarField fourQro(p.size(), 0.0); + + if (TwOwn.radiation()) + { + Qr += p.lookupPatchField("Qr"); + fourQro += 4.0*radiation::sigmaSB.value()*pow4(TwOwn); + } + + { + Field > lData(neighbour.size()); + + const scalarField& lfNei = + ownerK.shadowPatchField().originalPatchField(); + scalarField lTcNei = + TwOwn.shadowPatchField().patchInternalField(); + + forAll(lData, facei) + { + lData[facei][0] = lTcNei[facei]; + lData[facei][1] = lfNei[facei]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + const scalarField& lTwNei = TwOwn.shadowPatchField(); + const scalarField& lQrNei = + TwOwn.lookupShadowPatchField("Qr"); + + forAll(lData, facei) + { + lData[facei][2] = lTwNei[facei]; + lData[facei][3] = lQrNei[facei]; + } + } + + const Field > iData = + TwOwn.regionCouplePatch().interpolate(lData); + + forAll(iData, facei) + { + TcNei[facei] = iData[facei][0]; + fNei[facei] = iData[facei][1]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + forAll(iData, facei) + { + fourQro[facei] += + 4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]); + Qr[facei] += iData[facei][3]; + } + } + } + + const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); + const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); + + //Info << "kOwn = " << kOwn << endl; + //Info << "kNei = " << kNei << endl; + //Info << "TcOwn = " << TcOwn << endl; + //Info << "TcNei = " << TcNei << endl; + //Info << "Qr = " << Qr << " Sum = " << sum(Qr*p.magSf()) << endl; + + TwOwn *= + (fourQro + Qr + kOwn*TcOwn + kNei*TcNei) + /(TwOwn*(kOwn + kNei) + fourQro); + + //Info << "TwOwn = " << TwOwn << endl; + + //scalarField q1 = (TwOwn - TcOwn)*kOwn; + //Info << "q1 = " << q1 << " Sum = " << sum(q1*p.magSf()) << endl; + + //scalarField q2 = (TcNei - TcOwn)*ownerK*p.deltaCoeffs(); + //Info << "q2 = " << q2 << " Sum = " << sum(q2*p.magSf()) << endl; + + TwOwn.fvPatchScalarField::updateCoeffs(); +} + + +void chtRcThermalDiffusivityFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("remoteField") + << remoteFieldName() << token::END_STATEMENT << nl; + this->writeEntry("value", os); +} + + +//- Specify data associated with VectorN type is contiguous +template<> +inline bool contiguous >() {return true;} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + chtRcThermalDiffusivityFvPatchScalarField +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.H new file mode 100644 index 000000000..eba968a8c --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivity/chtRcThermalDiffusivityFvPatchScalarField.H @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + chtRcThermalDiffusivityFvPatchScalarField + +Description + Region couple patch field taking radiation into account + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +SourceFiles + chtRcThermalDiffusivityFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef chtRcThermalDiffusivityFvPatchScalarField_H +#define chtRcThermalDiffusivityFvPatchScalarField_H + +#include "chtRegionCoupleBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class chtRcThermalDiffusivityFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class chtRcThermalDiffusivityFvPatchScalarField +: + public chtRegionCoupleBase +{ + // Private data + + +public: + + //- Runtime type information + TypeName("chtRcThermalDiffusivity"); + + + // Constructors + + //- Construct from patch and internal field + chtRcThermalDiffusivityFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + chtRcThermalDiffusivityFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given chtRcThermalDiffusivityFvPatchScalarField onto a new patch + chtRcThermalDiffusivityFvPatchScalarField + ( + const chtRcThermalDiffusivityFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy setting internal field reference + chtRcThermalDiffusivityFvPatchScalarField + ( + const chtRcThermalDiffusivityFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new chtRcThermalDiffusivityFvPatchScalarField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new chtRcThermalDiffusivityFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + + // Evaluation functions + + //- Evaluate the patch field + virtual void updateCoeffs(); + + //- Evaluate the patch field + virtual void evaluate(const Pstream::commsTypes commsType); + + //- Calculate the thermal diffusivity + virtual void calcThermalDiffusivity + ( + chtRegionCoupleBase& owner, + const chtRegionCoupleBase& neighbour + ) const; + + //- Calculate the temperature + virtual void calcTemperature + ( + chtRcTemperatureFvPatchScalarField& owner, + const chtRcTemperatureFvPatchScalarField& neighbour, + const chtRegionCoupleBase& ownerK + ) const; + + + //- Write + virtual void write(Ostream&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.C new file mode 100644 index 000000000..6d985f88c --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.C @@ -0,0 +1,479 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "chtRcThermalDiffusivityResistanceFvPatchScalarField.H" +#include "chtRcThermalDiffusivitySlaveFvPatchScalarField.H" +#include "chtRcTemperatureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "harmonic.H" +#include "radiationConstants.H" +#include "VectorN.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +chtRcThermalDiffusivityResistanceFvPatchScalarField:: +chtRcThermalDiffusivityResistanceFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + chtRegionCoupleBase(p, iF), + conductivity_(p.size(), 0) +{} + + +chtRcThermalDiffusivityResistanceFvPatchScalarField:: +chtRcThermalDiffusivityResistanceFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + chtRegionCoupleBase(p, iF, dict), + conductivity_("conductivity", dict, p.size()) +{} + + +chtRcThermalDiffusivityResistanceFvPatchScalarField:: +chtRcThermalDiffusivityResistanceFvPatchScalarField +( + const chtRcThermalDiffusivityResistanceFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + chtRegionCoupleBase(ptf, p, iF, mapper), + conductivity_(ptf.conductivity_) +{} + + +chtRcThermalDiffusivityResistanceFvPatchScalarField:: +chtRcThermalDiffusivityResistanceFvPatchScalarField +( + const chtRcThermalDiffusivityResistanceFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + chtRegionCoupleBase(ptf, iF), + conductivity_(ptf.conductivity_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void chtRcThermalDiffusivityResistanceFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + fvPatchScalarField::evaluate(); +} + + +void chtRcThermalDiffusivityResistanceFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + calcThermalDiffusivity(*this, shadowPatchField()); +} + + +void +chtRcThermalDiffusivityResistanceFvPatchScalarField::calcThermalDiffusivity +( + chtRegionCoupleBase& owner, + const chtRegionCoupleBase& neighbour +) const +{ + const fvPatch& p = owner.patch(); + const fvMesh& mesh = p.boundaryMesh().mesh(); + const magLongDelta& mld = magLongDelta::New(mesh); + + const chtRcTemperatureFvPatchScalarField& TwOwn = + dynamic_cast + ( + p.lookupPatchField("T") + ); + scalarField& k = owner; + const scalarField& fOwn = owner.originalPatchField(); + const scalarField TcOwn = TwOwn.patchInternalField(); + + scalarField fNei(p.size()); + scalarField TcNei(p.size()); + scalarField TwNei(p.size()); + + scalarField QrOwn(p.size(), 0.0); + scalarField fourQroOwn(p.size(), 0.0); + scalarField fourQroNei(p.size(), 0.0); + + if (TwOwn.radiation()) + { + QrOwn += p.lookupPatchField("Qr"); + fourQroOwn += 4.0*radiation::sigmaSB.value()*pow4(TwOwn); + } + + scalarField Qr = QrOwn; + scalarField cond(p.size()); + + { + Field > lData(neighbour.size()); + + const scalarField& lfNei = neighbour.originalPatchField(); + scalarField lTcNei = TwOwn.shadowPatchField().patchInternalField(); + const scalarField& lTwNei = TwOwn.shadowPatchField(); + + forAll(lData, facei) + { + lData[facei][0] = lTcNei[facei]; + lData[facei][1] = lfNei[facei]; + lData[facei][2] = lTwNei[facei]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + const scalarField& lQrNei = + owner.lookupShadowPatchField("Qr"); + + forAll(lData, facei) + { + lData[facei][3] = lQrNei[facei]; + } + } + + if(isA(owner)) + { + forAll(lData, facei) + { + lData[facei][4] = conductivity_[facei]; + } + } + + const Field > iData = + owner.regionCouplePatch().interpolate(lData); + + forAll(iData, facei) + { + TcNei[facei] = iData[facei][0]; + fNei[facei] = iData[facei][1]; + TwNei[facei] = iData[facei][2]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + forAll(iData, facei) + { + fourQroNei[facei] += + 4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]); + Qr[facei] += iData[facei][3]; + } + } + + if(isA(owner)) + { + forAll(lData, facei) + { + cond[facei] = iData[facei][4]; + } + } + else + { + cond = conductivity_; + } + } + + // Do interpolation + harmonic interp(mesh); + const scalarField weights = interp.weights(fOwn, fNei, p); + scalarField kHarm = weights*fOwn + (1.0 - weights)*fNei; + kHarm *= cond/(kHarm*p.deltaCoeffs() + cond); + + const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); + const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); + + //Info << "kOwn = " << kOwn << endl; + //Info << "kNei = " << kNei << endl; + //Info << "TcOwn = " << TcOwn << endl; + //Info << "TcNei = " << TcNei << endl; + //Info << "DeltaT = " << TcNei - TcOwn << endl; + //Info << "TwOwn = " << TwOwn << endl; + //Info << "TwNei = " << TwNei << endl; + + //Info << "QrOwn = " << QrOwn << endl; + //Info << "Qr = " << Qr << endl; + //Info << "kOwn + kNei = " << (kOwn + kNei) << endl; + //Info << "f1 = " << fourQroOwn << endl; + //Info << "f2 = " << fourQroNei << endl; + + scalarField temp = TwNei*(cond + kNei) + fourQroNei; + +/* + k = -TwOwn* + ( + kOwn* + ( + TwNei*(cond*(kNei*TcNei + fourQroOwn + fourQroNei + Qr) + kNei*(fourQroOwn + QrOwn)) + + fourQroNei*(fourQroOwn + QrOwn) + ) + + kOwn*kOwn*TcOwn*temp + ); + + k /= stabilise(TwOwn*(kOwn*temp + cond*(TwNei*kNei + fourQroNei)) + fourQroOwn*temp, SMALL); + k += kOwn*TcOwn; + k /= stabilise(TcOwn - TcNei, SMALL)*p.deltaCoeffs(); +*/ + + // Expression is equivalent to the one above + k = kOwn* + ( + TwOwn* + ( + TwNei* + ( + cond*(kNei*(TcOwn - TcNei) - fourQroOwn - fourQroNei - Qr) + - kNei*(fourQroOwn + QrOwn) + ) + + fourQroNei*(TcOwn*cond - fourQroOwn - QrOwn) + ) + + (TcOwn*fourQroOwn*temp) + ); + + k /= stabilise + ( + (TcOwn - TcNei)* + ( + TwOwn* + ( + kOwn*temp + cond*(TwNei*kNei + fourQroNei) + ) + + fourQroOwn*temp + ), + SMALL + ); + + k /= p.deltaCoeffs(); + + //Info << "k = " << k << endl; + + forAll(k, facei) + { + k[facei] = max(min(k[facei], 100*kHarm[facei]), 0.01*kHarm[facei]); + } + + //Info << "k = " << k << endl; + + owner.fvPatchScalarField::updateCoeffs(); +} + + +void +chtRcThermalDiffusivityResistanceFvPatchScalarField::calcTemperature +( + chtRcTemperatureFvPatchScalarField& TwOwn, + const chtRcTemperatureFvPatchScalarField& neighbour, + const chtRegionCoupleBase& ownerK +) const +{ + const fvPatch& p = TwOwn.patch(); + const fvMesh& mesh = p.boundaryMesh().mesh(); + const magLongDelta& mld = magLongDelta::New(mesh); + + const scalarField& fOwn = ownerK.originalPatchField(); + const scalarField TcOwn = TwOwn.patchInternalField(); + + scalarField fNei(p.size()); + scalarField TcNei(p.size()); + scalarField TwNei(p.size()); + + scalarField QrOwn(p.size(), 0.0); + scalarField fourQroOwn(p.size(), 0.0); + scalarField fourQroNei(p.size(), 0.0); + + if (TwOwn.radiation()) + { + QrOwn += p.lookupPatchField("Qr"); + fourQroOwn += 4.0*radiation::sigmaSB.value()*pow4(TwOwn); + } + + scalarField Qr = QrOwn; + scalarField cond(p.size()); + + { + Field > lData(neighbour.size()); + + const scalarField& lfNei = + ownerK.shadowPatchField().originalPatchField(); + scalarField lTcNei = + TwOwn.shadowPatchField().patchInternalField(); + const scalarField& lTwNei = + TwOwn.shadowPatchField(); + + forAll(lData, facei) + { + lData[facei][0] = lTcNei[facei]; + lData[facei][1] = lfNei[facei]; + lData[facei][2] = lTwNei[facei]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + const scalarField& lQrNei = + TwOwn.lookupShadowPatchField("Qr"); + + forAll(lData, facei) + { + lData[facei][3] = lQrNei[facei]; + } + } + + if(isA(ownerK)) + { + forAll(lData, facei) + { + lData[facei][4] = conductivity_[facei]; + } + } + + const Field > iData = + TwOwn.regionCouplePatch().interpolate(lData); + + forAll(iData, facei) + { + TcNei[facei] = iData[facei][0]; + fNei[facei] = iData[facei][1]; + TwNei[facei] = iData[facei][2]; + } + + if(TwOwn.shadowPatchField().radiation()) + { + forAll(iData, facei) + { + Qr[facei] += iData[facei][3]; + fourQroNei[facei] += + 4.0*radiation::sigmaSB.value()*pow4(iData[facei][2]); + } + } + + if(isA(ownerK)) + { + forAll(lData, facei) + { + cond[facei] = iData[facei][4]; + } + } + else + { + cond = conductivity_; + } + } + + const scalarField kOwn = fOwn/(1.0 - p.weights())/mld.magDelta(p.index()); + const scalarField kNei = fNei/p.weights()/mld.magDelta(p.index()); + + //Info << "kOwn = " << kOwn << endl; + //Info << "kNei = " << kNei << endl; + //Info << "TcOwn = " << TcOwn << endl; + //Info << "TcNei = " << TcNei << endl; + //Info << "QrOwn = " << QrOwn << " Sum = " << sum(QrOwn*p.magSf()) << endl; + //Info << "Qr = " << Qr << " Sum = " << sum(Qr*p.magSf()) << endl; + + scalarField temp = fourQroOwn + QrOwn + kOwn*TcOwn; + + TwOwn *= + ( + TwNei* + ( + cond* + ( + kNei*TcNei + fourQroOwn + fourQroNei + Qr + kOwn*TcOwn + ) + + kNei*temp + ) + + fourQroNei*temp + ) + / + ( + TwOwn* + ( + TwNei*(cond*(kOwn + kNei) + kOwn*kNei) + + fourQroNei*(kOwn + cond) + ) + + fourQroOwn*(TwNei*(cond + kNei) + fourQroNei) + ); + + //Info << "TwOwn = " << TwOwn << endl; + + //scalarField q1 = (TwOwn - TcOwn)*kOwn; + //Info << "q1 = " << q1 << " Sum = " << sum(q1*p.magSf()) << endl; + + //scalarField q2 = (TcNei - TcOwn)*ownerK*p.deltaCoeffs(); + //Info << "q2 = " << q2 << " Sum = " << sum(q2*p.magSf()) << endl; + + TwOwn.fvPatchScalarField::updateCoeffs(); +} + + +void chtRcThermalDiffusivityResistanceFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + conductivity_.writeEntry("conductivity", os); + os.writeKeyword("remoteField") + << remoteFieldName() << token::END_STATEMENT << nl; + this->writeEntry("value", os); +} + + +//- Specify data associated with VectorN type is contiguous +template<> +inline bool contiguous >() {return true;} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + chtRcThermalDiffusivityResistanceFvPatchScalarField +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.H new file mode 100644 index 000000000..b814acb50 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivityResistance/chtRcThermalDiffusivityResistanceFvPatchScalarField.H @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + regionCouplingResistanceFvPatchField + +Description + Region couple patch field jump resistance on the surface taking + radiation into account + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +SourceFiles + regionCouplingResistanceFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionCouplingResistanceFvPatchField_H +#define regionCouplingResistanceFvPatchField_H + +#include "chtRegionCoupleBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class regionCouplingResistanceFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +class chtRcThermalDiffusivityResistanceFvPatchScalarField +: + public chtRegionCoupleBase +{ + // Private data + + //- Conductivity + scalarField conductivity_; + + +public: + + //- Runtime type information + TypeName("chtRcThermalDiffusivityResistance"); + + + // Constructors + + //- Construct from patch and internal field + chtRcThermalDiffusivityResistanceFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + chtRcThermalDiffusivityResistanceFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given regionCouplingResistanceFvPatchField + // onto a new patch + chtRcThermalDiffusivityResistanceFvPatchScalarField + ( + const chtRcThermalDiffusivityResistanceFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy setting internal field reference + chtRcThermalDiffusivityResistanceFvPatchScalarField + ( + const chtRcThermalDiffusivityResistanceFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new chtRcThermalDiffusivityResistanceFvPatchScalarField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new chtRcThermalDiffusivityResistanceFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return conductivity + const scalarField& conductivity() const + { + return conductivity_; + } + + //- Return Access to conductivity + scalarField& conductivity() + { + return conductivity_; + } + + + // Evaluation functions + + //- Evaluate the patch field + virtual void updateCoeffs(); + + //- Evaluate the patch field + virtual void evaluate(const Pstream::commsTypes commsType); + + //- Calculate the thermal diffusivity + virtual void calcThermalDiffusivity + ( + chtRegionCoupleBase& owner, + const chtRegionCoupleBase& neighbour + ) const; + + //- Calculate the temperature + virtual void calcTemperature + ( + chtRcTemperatureFvPatchScalarField& owner, + const chtRcTemperatureFvPatchScalarField& neighbour, + const chtRegionCoupleBase& ownerK + ) const; + + + //- Write + virtual void write(Ostream&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.C new file mode 100644 index 000000000..8243859d9 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.C @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "chtRcThermalDiffusivitySlaveFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + chtRegionCoupleBase(p, iF) +{} + + +chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + chtRegionCoupleBase(p, iF, dict) +{} + + +chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField +( + const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + chtRegionCoupleBase(ptf, p, iF, mapper) +{} + + +chtRcThermalDiffusivitySlaveFvPatchScalarField::chtRcThermalDiffusivitySlaveFvPatchScalarField +( + const chtRcThermalDiffusivitySlaveFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + chtRegionCoupleBase(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const chtRegionCoupleBase& +chtRcThermalDiffusivitySlaveFvPatchScalarField::shadowPatchField() const +{ + return dynamic_cast + ( + regionCouplingFvPatchScalarField::shadowPatchField() + ); +} + + +void chtRcThermalDiffusivitySlaveFvPatchScalarField::evaluate +( + const Pstream::commsTypes +) +{ + fvPatchScalarField::evaluate(); +} + + +void chtRcThermalDiffusivitySlaveFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + shadowPatchField().calcThermalDiffusivity(*this, shadowPatchField()); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + chtRcThermalDiffusivitySlaveFvPatchScalarField +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.H new file mode 100644 index 000000000..42fda45e2 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRcThermalDiffusivitySlave/chtRcThermalDiffusivitySlaveFvPatchScalarField.H @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + chtRcThermalDiffusivitySlaveFvPatchScalarField + +Description + Region couple patch field taking radiation into account + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +SourceFiles + chtRcThermalDiffusivitySlaveFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef chtRcThermalDiffusivitySlaveFvPatchScalarField_H +#define chtRcThermalDiffusivitySlaveFvPatchScalarField_H + +#include "chtRegionCoupleBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class chtThermalDiffusivityRegionCoupleFvPatchScalarField; +class chtTemperatureRegionCoupleFvPatchScalarField; + +/*---------------------------------------------------------------------------*\ + Class chtRcThermalDiffusivitySlaveFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class chtRcThermalDiffusivitySlaveFvPatchScalarField +: + public chtRegionCoupleBase +{ + // Private data + +public: + + //- Runtime type information + TypeName("chtRcThermalDiffusivitySlave"); + + + // Constructors + + //- Construct from patch and internal field + chtRcThermalDiffusivitySlaveFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + chtRcThermalDiffusivitySlaveFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given chtRcThermalDiffusivitySlaveFvPatchScalarField onto a new patch + chtRcThermalDiffusivitySlaveFvPatchScalarField + ( + const chtRcThermalDiffusivitySlaveFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy setting internal field reference + chtRcThermalDiffusivitySlaveFvPatchScalarField + ( + const chtRcThermalDiffusivitySlaveFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new chtRcThermalDiffusivitySlaveFvPatchScalarField(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new chtRcThermalDiffusivitySlaveFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return shadow patch field + virtual const chtRegionCoupleBase& shadowPatchField() const; + + + // Evaluation functions + + //- Evaluate the patch field + virtual void updateCoeffs(); + + //- Evaluate the patch field + virtual void evaluate(const Pstream::commsTypes commsType); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.C new file mode 100644 index 000000000..eb7a3d84f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.C @@ -0,0 +1,178 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "chtRcTemperatureFvPatchScalarField.H" +#include "chtRegionCoupleBase.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +chtRegionCoupleBase::chtRegionCoupleBase +( + const fvPatch& p, + const DimensionedField& iF +) +: + regionCouplingFvPatchScalarField(p, iF) +{} + + +chtRegionCoupleBase::chtRegionCoupleBase +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + regionCouplingFvPatchScalarField(p, iF, dict) +{} + + +chtRegionCoupleBase::chtRegionCoupleBase +( + const chtRegionCoupleBase& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + regionCouplingFvPatchScalarField(ptf, p, iF, mapper) +{} + + +chtRegionCoupleBase::chtRegionCoupleBase +( + const chtRegionCoupleBase& ptf, + const DimensionedField& iF +) +: + regionCouplingFvPatchScalarField(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +// Return a named shadow patch field +const chtRegionCoupleBase& +chtRegionCoupleBase::shadowPatchField() const +{ + return dynamic_cast + ( + regionCouplingFvPatchScalarField::shadowPatchField() + ); +} + + +void chtRegionCoupleBase::initEvaluate +( + const Pstream::commsTypes commsType +) +{ + updateCoeffs(); +} + + +void +Foam::chtRegionCoupleBase::calcThermalDiffusivity +( + chtRegionCoupleBase& owner, + const chtRegionCoupleBase& neighbour +) const +{ + shadowPatchField().calcThermalDiffusivity(owner, neighbour); +} + + +void +Foam::chtRegionCoupleBase::calcTemperature +( + chtRcTemperatureFvPatchScalarField& owner, + const chtRcTemperatureFvPatchScalarField& neighbour, + const chtRegionCoupleBase& ownerK +) const +{ + shadowPatchField().calcTemperature(owner, neighbour, ownerK); +} + + +void +Foam::chtRegionCoupleBase::initInterfaceMatrixUpdate +( + const scalarField&, + scalarField&, + const lduMatrix&, + const scalarField&, + const direction, + const Pstream::commsTypes +) const +{ + FatalErrorIn + ( + "chtRegionCoupleBase::initInterfaceMatrixUpdate" + ) << abort(FatalError); +} + + +void +Foam::chtRegionCoupleBase::updateInterfaceMatrix +( + const scalarField&, + scalarField&, + const lduMatrix&, + const scalarField&, + const direction, + const Pstream::commsTypes +) const +{ + FatalErrorIn + ( + "chtRegionCoupleBase::updateInterfaceMatrix" + ) << abort(FatalError); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + chtRegionCoupleBase +); + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.H new file mode 100644 index 000000000..d95c40e53 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/chtRegionCoupleBase/chtRegionCoupleBase.H @@ -0,0 +1,197 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + chtRegionCoupleBase + +Description + Region couple patch field taking radiation into account + +Author + Henrik Rusche, Wikki GmbH. All rights reserved + +SourceFiles + chtRegionCoupleBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef chtRegionCoupleBase_H +#define chtRegionCoupleBase_H + +#include "regionCouplingFvPatchFields.H" +#include "fvMatricesFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class chtRcTemperatureFvPatchScalarField; + +/*---------------------------------------------------------------------------*\ + Class chtRegionCoupleBase Declaration +\*---------------------------------------------------------------------------*/ + +class chtRegionCoupleBase +: + public regionCouplingFvPatchScalarField +{ + // Private data + + +public: + + //- Runtime type information + TypeName("chtRegionCoupleBase"); + + + // Constructors + + //- Construct from patch and internal field + chtRegionCoupleBase + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + chtRegionCoupleBase + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given chtRegionCoupleBase onto a new patch + chtRegionCoupleBase + ( + const chtRegionCoupleBase&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy setting internal field reference + chtRegionCoupleBase + ( + const chtRegionCoupleBase&, + const DimensionedField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new chtRegionCoupleBase(*this) + ); + } + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new chtRegionCoupleBase(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return false to disable interpolation on this patch + virtual bool coupled() const + { + return false; + } + + //- Return shadow patch field + const chtRegionCoupleBase& shadowPatchField() const; + + //- Return original patch field + const scalarField& originalPatchField() const + { + return regionCouplingFvPatchScalarField::originalPatchField(); + } + + + // Evaluation functions + + //- Initialise the evaluation of the patch field + virtual void initEvaluate(const Pstream::commsTypes commsType); + + //- Calculate the thermal diffusivity + virtual void calcThermalDiffusivity + ( + chtRegionCoupleBase& owner, + const chtRegionCoupleBase& neighbour + ) const; + + //- Calculate the temperature + virtual void calcTemperature + ( + chtRcTemperatureFvPatchScalarField& owner, + const chtRcTemperatureFvPatchScalarField& neighbour, + const chtRegionCoupleBase& ownerK + ) const; + + //- Initialise neighbour matrix update + virtual void initInterfaceMatrixUpdate + ( + const scalarField& psiInternal, + scalarField& result, + const lduMatrix& m, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; + + //- Update result field based on interface functionality + virtual void updateInterfaceMatrix + ( + const scalarField& psiInternal, + scalarField& result, + const lduMatrix&, + const scalarField& coeffs, + const direction cmpt, + const Pstream::commsTypes commsType + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.C new file mode 100644 index 000000000..4912cf6b7 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.C @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "controlledParabolicVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(p, iF), + Umean_(0), + n_(0, 1, 0), + y_(1, 0, 0), + target_(0), + obsFieldName_("undef"), + obsPatchName_("undef"), + obsPatchID_(-1), + gain_(0), + curTimeIndex_(-1) +{} + + +controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField +( + const controlledParabolicVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + Umean_(ptf.Umean_), + n_(ptf.n_), + y_(ptf.y_), + target_(ptf.target_), + obsFieldName_(ptf.obsFieldName_), + obsPatchName_(ptf.obsPatchName_), + obsPatchID_(ptf.obsPatchID_), + gain_(ptf.gain_), + curTimeIndex_(-1) +{} + + +controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + Umean_(readScalar(dict.lookup("Umean"))), + n_(dict.lookup("n")), + y_(dict.lookup("y")), + target_(readScalar(dict.lookup("target"))), + obsFieldName_(dict.lookup("obsFieldName")), + obsPatchName_(dict.lookup("obsPatchName")), + obsPatchID_(patch().patch().boundaryMesh().findPatchID(obsPatchName_)), + gain_(readScalar(dict.lookup("gain"))), + curTimeIndex_(-1) +{ + if (obsPatchID_ < 0) + { + FatalErrorIn + ( + "controlledParabolicVelocityFvPatchVectorField" + ) << "patch " << dict.lookup("obsPatchName") + << "not found" + << nl << exit(FatalError); + } + + n_ /= mag(n_); + y_ /= mag(y_); + + fvPatchField::operator= + ( + vectorField("value", dict, p.size()) + ); +} + + +controlledParabolicVelocityFvPatchVectorField::controlledParabolicVelocityFvPatchVectorField +( + const controlledParabolicVelocityFvPatchVectorField& fcvpvf, + const DimensionedField& iF +) +: + fixedValueFvPatchVectorField(fcvpvf, iF), + Umean_(fcvpvf.Umean_), + n_(fcvpvf.n_), + y_(fcvpvf.y_), + target_(fcvpvf.target_), + obsFieldName_(fcvpvf.obsFieldName_), + obsPatchName_(fcvpvf.obsPatchName_), + obsPatchID_(fcvpvf.obsPatchID_), + gain_(fcvpvf.gain_), + curTimeIndex_(-1) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void controlledParabolicVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + if (curTimeIndex_ != this->db().time().timeIndex()) + { + const volScalarField& field = + db().lookupObject(obsFieldName_); + + scalar obsPatchAverage = gAverage(field.boundaryField()[obsPatchID_]); + + + Info<< "Average of " << obsFieldName_ + << " on patch " << patch().name() + << " = " << obsPatchAverage + << " Difference to target = " + << obsPatchAverage - target_ + << " Umean = " << Umean_ + << endl; + + Umean_ += gain_*(obsPatchAverage - target_); + + // Get range and orientation + boundBox bb(patch().patch().localPoints(), true); + + vector ctr = 0.5*(bb.max() + bb.min()); + + const vectorField& c = patch().Cf(); + + // Calculate local 1-D coordinate for the parabolic profile + scalarField coord = + 0.5 - ((c - ctr) & y_)/((bb.max() - bb.min()) & y_); + + operator==(n_*3/2*Umean_*(1.0 - sqr(coord))); + + curTimeIndex_ = this->db().time().timeIndex(); + } + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +// Write +void controlledParabolicVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + os.writeKeyword("Umean") + << Umean_ << token::END_STATEMENT << nl; + os.writeKeyword("n") + << n_ << token::END_STATEMENT << nl; + os.writeKeyword("y") + << y_ << token::END_STATEMENT << nl; + os.writeKeyword("target") + << target_ << token::END_STATEMENT << nl; + os.writeKeyword("obsPatchName") + << obsPatchName_ << token::END_STATEMENT << nl; + os.writeKeyword("obsFieldName") + << obsFieldName_ << token::END_STATEMENT << nl; + os.writeKeyword("gain") + << gain_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField(fvPatchVectorField, controlledParabolicVelocityFvPatchVectorField); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.H new file mode 100644 index 000000000..c9c422d97 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/controlledParabolicVelocity/controlledParabolicVelocityFvPatchVectorField.H @@ -0,0 +1,170 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + controlledParabolicVelocityFvPatchVectorField + +Description + Boundary condition specifies a velocity inlet profile + (fixed value), given the volumetric flow rate + flow direction n and direction of the parabolic coordinate y + +SourceFiles + controlledParabolicVelocityFvPatchVectorField.C + +Author + Wikki Ltd. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#ifndef controlledParabolicVelocityFvPatchVectorField_H +#define controlledParabolicVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class parabolicVelocityFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +class controlledParabolicVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Volumetric flow rate + scalar Umean_; + + //- Flow direction + vector n_; + + //- 1D coordinate direction + vector y_; + + //- target value + scalar target_; + + //- field to observe + word obsFieldName_; + + //- patch ID to observe + word obsPatchName_; + + //- patch ID to observe + label obsPatchID_; + + //- proportionality factor + scalar gain_; + + //- Current time index + label curTimeIndex_; + + +public: + + //- Runtime type information + TypeName("controlledParabolicVelocity"); + + + // Constructors + + //- Construct from patch and internal field + controlledParabolicVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + controlledParabolicVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given controlledParabolicVelocityFvPatchVectorField + // onto a new patch + controlledParabolicVelocityFvPatchVectorField + ( + const controlledParabolicVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new controlledParabolicVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + controlledParabolicVelocityFvPatchVectorField + ( + const controlledParabolicVelocityFvPatchVectorField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new controlledParabolicVelocityFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + //- Update coefficients + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.C new file mode 100644 index 000000000..ee2cfa692 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.C @@ -0,0 +1,235 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "extendedWallHeatTransferFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "radiationConstants.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(p, iF), + Tinf_(0.0), + hc_(0.0), + alpha_(0.0), + KName_("undefined-K"), + radiation_(false) +{} + + +Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField +( + const extendedWallHeatTransferFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(p, iF), + Tinf_(ptf.Tinf_), + hc_(ptf.hc_), + alpha_(ptf.alpha_), + radSources_(ptf.radSources_), + KName_(ptf.KName_), + radiation_(ptf.radiation_) +{} + + +Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF), + Tinf_(readScalar(dict.lookup("Tinf"))), + hc_(readScalar(dict.lookup("hc"))), + alpha_(readScalar(dict.lookup("alpha"))), + KName_(dict.lookup("K")), + radiation_(readBool(dict.lookup("radiation"))) +{ + refValue() = Tinf_; + refGrad() = 0.0; + valueFraction() = 0.0; + + // Construct radiation sources + PtrList entries(dict.lookup("radiationSources")); + radSources_.setSize(entries.size()); + + forAll(entries, entryI) + { + radSources_.set + ( + entryI, + externalRadiationSource::New + ( + entries[entryI].keyword(), + entries[entryI].dict(), + p + ) + ); + } + + fvPatchField::operator= + ( + scalarField("value", dict, p.size()) + ); +} + + +Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField +( + const extendedWallHeatTransferFvPatchScalarField& tppsf +) +: + mixedFvPatchScalarField(tppsf), + Tinf_(tppsf.Tinf_), + hc_(tppsf.hc_), + alpha_(tppsf.alpha_), + radSources_(tppsf.radSources_), + KName_(tppsf.KName_), + radiation_(tppsf.radiation_) +{} + + +Foam::extendedWallHeatTransferFvPatchScalarField::extendedWallHeatTransferFvPatchScalarField +( + const extendedWallHeatTransferFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(tppsf, iF), + Tinf_(tppsf.Tinf_), + hc_(tppsf.hc_), + alpha_(tppsf.alpha_), + radSources_(tppsf.radSources_), + KName_(tppsf.KName_), + radiation_(tppsf.radiation_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::extendedWallHeatTransferFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const fvPatch& p = patch(); + + scalarField Tc = patchInternalField(); + const scalarField& Tb = *this; + + const scalarField& kappaEff = + p.lookupPatchField(KName_); + + scalarField term = kappaEff*patch().deltaCoeffs(); + + scalarField Qri(p.size(), 0); + if (radiation()) + { + Qri = p.lookupPatchField("Qr"); + } + + scalarField Qrio = 4.0*radiation::sigmaSB.value()*pow4(Tb); + + scalarField Two = Tb - (term*(patchInternalField() - Tb) + Qri)/hc_; + + scalarField Qro(p.size(), 0.0); + forAll(radSources_, rsI) + { + Qro += radSources_[rsI].q(Two); + } + + scalarField term2 = Tb*hc_*alpha_ + hc_*Qrio + alpha_*Qrio; + + //Info << "Tc = " << Tc << endl; + //Info << "Tb = "<< (scalarField) *this << endl; + //Info << "Two = "<< Two << endl; + //Info << "Qri = "<< Qri << endl; + //Info << "q = "<< q << endl; + + //Info << "q1 = " << hc_*(*this - Two) << endl; + //Info << "q2 = " << Qro + alpha_*(Two - Tinf_) << endl; + //Info << "q3 = "<< term*(Tc - *this) + Qri << endl; + + valueFraction() = 1.0 / (1.0 + Tb*term*(hc_ + alpha_)/term2); + refValue() = + Tb*(hc_*alpha_*Tinf_ - hc_*Qro + (hc_ + alpha_)*(Qri + Qrio))/term2; + + mixedFvPatchScalarField::updateCoeffs(); +} + + +void Foam::extendedWallHeatTransferFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; + os.writeKeyword("radiation") << radiation_ << token::END_STATEMENT << nl; + os.writeKeyword("Tinf") << Tinf_ << token::END_STATEMENT << nl; + os.writeKeyword("hc") << hc_ << token::END_STATEMENT << nl; + os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl; + + os << nl << indent << "radiationSources" << nl + << indent << token::BEGIN_LIST << incrIndent << nl; + + forAll(radSources_, rsI) + { + os << indent << radSources_[rsI].name() << nl + << indent << token::BEGIN_BLOCK << nl << incrIndent; + radSources_[rsI].write(os); + os << decrIndent << indent << token::END_BLOCK << endl; + } + + os << decrIndent << indent + << token::END_LIST << token::END_STATEMENT << nl << nl; + + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + extendedWallHeatTransferFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.H new file mode 100644 index 000000000..fdb828447 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/extendedWallHeatTransferFvPatchScalarField.H @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::extendedWallHeatTransferFvPatchScalarField + +Description + wall heat transfer boundary condition taking into account + + - heat resistance through a solid planar wall + + q = hc*(Tb - Two) + + - heat convection + + q = alpha*(Two - Tinf) + + - grey body radiation to infinite medium + + q = epsilon*sigma*(Two^4 - Tinf^4) + +SourceFiles + extendedWallHeatTransferFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef extendedWallHeatTransferFvPatchScalarField_H +#define extendedWallHeatTransferFvPatchScalarField_H + +#include "mixedFvPatchFields.H" +#include "externalRadiationSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class extendedWallHeatTransferFvPatchScalarField +: + public mixedFvPatchScalarField +{ + // Private data + + //- Tinf [K] + scalar Tinf_; + + //- thermal conductance [W/m^2/K] + scalar hc_; + + //- heat transfer coefficient [W/m^2/K] + scalar alpha_; + + //- list of radiative sources + PtrList radSources_; + + //- Name of thermal conductivity field + word KName_; + + //- Take radiation into account for this patch + bool radiation_; + + +public: + + //- Runtime type information + TypeName("extendedWallHeatTransfer"); + + + // Constructors + + //- Construct from patch and internal field + extendedWallHeatTransferFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + extendedWallHeatTransferFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given extendedWallHeatTransferFvPatchScalarField + // onto a new patch + extendedWallHeatTransferFvPatchScalarField + ( + const extendedWallHeatTransferFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + extendedWallHeatTransferFvPatchScalarField + ( + const extendedWallHeatTransferFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new extendedWallHeatTransferFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + extendedWallHeatTransferFvPatchScalarField + ( + const extendedWallHeatTransferFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new extendedWallHeatTransferFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return radiation + bool radiation() const + { + return radiation_; + } + + // Mapping functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.C new file mode 100644 index 000000000..fc76e3554 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "viewFactorRadiation.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::viewFactorRadiation::viewFactorRadiation +( + const word& name, + const dictionary& dict, + const label size +) +: + name_(name), + Tinf_(readScalar(dict.lookup("Tinf"))), + F_("F", dict, size), + epsilon_(readScalar(dict.lookup("epsilon"))) +{} + + +void Foam::viewFactorRadiation::write(Ostream& os) const +{ + os << indent << name_ << nl + << indent << token::BEGIN_BLOCK << incrIndent << nl; + + os.writeKeyword("Tinf") << Tinf_ << token::END_STATEMENT << nl; + F_.writeEntry("F", os); + os.writeKeyword("epsilon") << epsilon_ << token::END_STATEMENT << nl; + + os << decrIndent << indent << token::END_BLOCK << endl; +} + + +Foam::Ostream& Foam::operator<<(Ostream& os, const viewFactorRadiation& r) +{ + r.write(os); + os.check("Ostream& operator<<(Ostream&, const viewFactorRadiation&)"); + return os; +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.H new file mode 100644 index 000000000..11d32b42e --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/extendedWallHeatTransfer/viewFactorRadiation.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::viewFactorRadiation + +Description + helper class to sum up external radiation sources + + +SourceFiles + viewFactorRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef viewFactorRadiation_H +#define viewFactorRadiation_H + +#include "scalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators +class viewFactorRadiation; +Ostream& operator<<(Ostream&, const viewFactorRadiation&); + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class viewFactorRadiation +{ + // Private data + + //- name + word name_; + + //- Tinf [K] + scalar Tinf_; + + //- view factor [-] + scalarField F_; + + //- emissivity [-] + scalar epsilon_; + + +public: + + // Selectors + + //- Return a reference to the selected thermal model + static autoPtr New + ( + const word& name, + const dictionary& dict, + const label size + ) + { + return autoPtr + ( + new viewFactorRadiation(name, dict, size) + ); + }; + + // Constructors + + //- Construct from components + explicit viewFactorRadiation + ( + const word& name, + const dictionary& dict, + const label size + ); + + + //- Construct and return a clone + Foam::autoPtr clone() const + { + return autoPtr + ( + new viewFactorRadiation(*this) + ); + } + + + // Member functions + + // Access + + // Mapping functions + + // Evaluation functions + + //- Return Tinf + scalar Tinf() const + { + return Tinf_; + }; + + //- Return F + const scalarField& F() const + { + return F_; + }; + + //- Return epsilon + scalar epsilon() const + { + return epsilon_; + }; + + + //- Write + void write(Ostream&) const; + + // IOstream operators + + friend Ostream& operator<<(Ostream&, const viewFactorRadiation&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.C new file mode 100644 index 000000000..a92487022 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "constantFlux.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + +defineTypeNameAndDebug(constantFlux, 0); +addToRunTimeSelectionTable(externalRadiationSource, constantFlux, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +constantFlux::constantFlux +( + const word& name, + const dictionary& dict, + const fvPatch& p +) +: + externalRadiationSource(name), + q_("q", dict, p.size()) +{} + +constantFlux::constantFlux +( + const word& name +) +: + externalRadiationSource(name) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void constantFlux::write(Ostream& os) const +{ + externalRadiationSource::write(os); + + q_.writeEntry("q", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.H new file mode 100644 index 000000000..7c7ad3edb --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/constantFlux/constantFlux.H @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::constantFlux + +Description + helper class to sum up external radiation sources + + +SourceFiles + constantFlux.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantFlux_H +#define constantFlux_H + +#include "externalRadiationSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class constantFlux +: + public externalRadiationSource +{ + // Private data + + //- heat flux + scalarField q_; + + +public: + + //- Runtime type information + TypeName("constantFlux"); + + + // Constructors + + //- Construct from components + explicit constantFlux + ( + const word& name, + const dictionary& dict, + const fvPatch& p + ); + + explicit constantFlux + ( + const word& name + ); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new constantFlux(*this) + ); + } + + // Destructor + + virtual ~constantFlux() + {}; + + + // Member functions + + // Access + + const scalarField& q() const + { + return q_; + }; + + scalarField& q() + { + return q_; + }; + + + // Mapping functions + + // Evaluation functions + + //- Return heat flux + virtual tmp q(const scalarField&) const + { + return q_; + } + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.C new file mode 100644 index 000000000..7684aa2c7 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "externalRadiationSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(externalRadiationSource, 0); +defineRunTimeSelectionTable(externalRadiationSource, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +externalRadiationSource::externalRadiationSource +( + const word& name +) +: + name_(name) +{ + Info << "externalRadiationSource::externalRadiationSource" << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void externalRadiationSource::write(Ostream& os) const +{ + os.writeKeyword("type") << type() << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.H new file mode 100644 index 000000000..7537b0a62 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/externalRadiationSource.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::externalRadiationSource + +Description + Virtual base class for external radiation sources + + +SourceFiles + externalRadiationSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef externalRadiationSource_H +#define externalRadiationSource_H + +#include "scalarField.H" +#include "tmp.H" +#include "fvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class externalRadiationSource +{ + // Private data + + //- name + word name_; + + +public: + + //- Runtime type information + TypeName("externalRadiationSource"); + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + externalRadiationSource, + dictionary, + ( + const word& name, + const dictionary& dict, + const fvPatch& p + ), + (name, dict, p) + ); + + + // Destructor + + virtual ~externalRadiationSource() + {}; + + // Selectors + + //- Return a reference to the selected thermal model + static autoPtr New + ( + const word& name, + const dictionary& dict, + const fvPatch& p + ); + + + //- Construct and return a clone + virtual autoPtr clone() const + { + notImplemented("autoPt clone() const"); + return autoPtr(NULL); + + return autoPtr + ( + new externalRadiationSource(*this) + ); + }; + + // Constructors + + //- Construct from components + explicit externalRadiationSource + ( + const word& name + ); + + + // Member functions + + // Access + + const word& name() const + { + return name_; + } + + // Mapping functions + + // Evaluation functions + + //- Return heat flux + virtual tmp q(const scalarField& Tw) const + { + notImplemented + ( + type() +"::q(const scalarField& Tw) const" + ); + + return tmp(NULL); + }; + + + //- Write + + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/newExternalRadiationSource.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/newExternalRadiationSource.C new file mode 100644 index 000000000..58f1adb2f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/externalRadiationSource/newExternalRadiationSource.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "externalRadiationSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +autoPtr externalRadiationSource::New +( + const word& name, + const dictionary& dict, + const fvPatch& p +) +{ + word ersTypeName = dict.lookup("type"); + + Info<< "Selecting external radiation source " << ersTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(ersTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalIOErrorIn + ( + "externalRadiationSource::New(\n" + " const word& name,\n" + " const dictionary& dict,\n" + " const fvPatch& p\n" + ")", + dict + ) << "Unknown externalRadiationSource type " + << ersTypeName << endl << endl + << "Valid externalRadiationSource are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalIOError); + } + + Info << "Here 2" << endl; + + return cstrIter()(name, dict, p); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.C new file mode 100644 index 000000000..cc6cd021a --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "planeToCylinder.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + +defineTypeNameAndDebug(planeToCylinder, 0); +addToRunTimeSelectionTable(externalRadiationSource, planeToCylinder, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +planeToCylinder::planeToCylinder +( + const word& name, + const dictionary& dict, + const fvPatch& p +) +: + viewFactor(name, dict), + direction_(dict.lookup("direction")) +{ + scalarField cosBeta = (direction_ & p.Sf()/p.magSf()); + + F() = 0.5 - 0.5*cosBeta; +} + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void planeToCylinder::write(Ostream& os) const +{ + viewFactor::write(os); + os.writeKeyword("direction") << direction_ << token::END_STATEMENT << nl; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.H new file mode 100644 index 000000000..56c6f932e --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/planeToCylinder/planeToCylinder.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::planeToCylinder + +Description + helper class to sum up external radiation sources + + +SourceFiles + planeToCylinder.C + +\*---------------------------------------------------------------------------*/ + +#ifndef planeToCylinder_H +#define planeToCylinder_H + +#include "viewFactor.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class planeToCylinder +: + public viewFactor +{ + // Private data + + //- Direction of infinite plane + vector direction_; + + +public: + + //- Runtime type information + TypeName("planeToCylinder"); + + + // Constructors + + //- Construct from components + explicit planeToCylinder + ( + const word& name, + const dictionary& dict, + const fvPatch& p + ); + + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new planeToCylinder(*this) + ); + } + + // Destructor + + virtual ~planeToCylinder() + {}; + + + // Member functions + + // Access + + // Mapping functions + + // Evaluation functions + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.C new file mode 100644 index 000000000..de8b9e447 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "pointSource.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + +defineTypeNameAndDebug(pointSource, 0); +addToRunTimeSelectionTable(externalRadiationSource, pointSource, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +pointSource::pointSource +( + const word& name, + const dictionary& dict, + const fvPatch& p +) +: + constantFlux(name), + qmax_(readScalar(dict.lookup("qmax"))), + alpha_(readScalar(dict.lookup("alpha"))), + direction_(dict.lookup("direction")) +{ + q() = -alpha_*qmax_*min(direction_ & p.Sf()/p.magSf(), 0.0); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void pointSource::write(Ostream& os) const +{ + constantFlux::write(os); + os.writeKeyword("qmax") << qmax_ << token::END_STATEMENT << nl; + os.writeKeyword("alpha") << alpha_ << token::END_STATEMENT << nl; + os.writeKeyword("direction") << direction_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.H new file mode 100644 index 000000000..17462887d --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/pointSource/pointSource.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::pointSource + +Description + helper class to sum up external radiation sources + + +SourceFiles + pointSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef pointSource_H +#define pointSource_H + +#include "constantFlux.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class pointSource +: + public constantFlux +{ + // Private data + + //- Strenght of the point source + scalar qmax_; + + //- radiation absorptivity + scalar alpha_; + + //- Direction of the pointSource + vector direction_; + +public: + + //- Runtime type information + TypeName("pointSource"); + + + // Constructors + + //- Construct from components + explicit pointSource + ( + const word& name, + const dictionary& dict, + const fvPatch& p + ); + + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new pointSource(*this) + ); + } + + // Destructor + + virtual ~pointSource() + {}; + + + // Member functions + + // Access + + // Mapping functions + + // Evaluation functions + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.C new file mode 100644 index 000000000..9c37ba57e --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.C @@ -0,0 +1,89 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "viewFactor.H" +#include "addToRunTimeSelectionTable.H" +#include "radiationConstants.H" + +namespace Foam +{ + +defineTypeNameAndDebug(viewFactor, 0); +addToRunTimeSelectionTable(externalRadiationSource, viewFactor, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +viewFactor::viewFactor +( + const word& name, + const dictionary& dict, + const fvPatch& p +) +: + externalRadiationSource(name), + Tinf_(readScalar(dict.lookup("Tinf"))), + F_("F", dict, p.size()), + epsilon_(readScalar(dict.lookup("epsilon"))) +{} + +viewFactor::viewFactor +( + const word& name, + const dictionary& dict +) +: + externalRadiationSource(name), + Tinf_(readScalar(dict.lookup("Tinf"))), + epsilon_(readScalar(dict.lookup("epsilon"))) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp viewFactor::q +( + const scalarField& Tw +) const +{ + return epsilon_*F_*radiation::sigmaSB.value()*(pow4(Tw) - pow4(Tinf_)); +} + + +void viewFactor::write(Ostream& os) const +{ + externalRadiationSource::write(os); + + os.writeKeyword("Tinf") << Tinf_ << token::END_STATEMENT << nl; + F_.writeEntry("F", os); + os.writeKeyword("epsilon") << epsilon_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.H new file mode 100644 index 000000000..35a687a6b --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/externalRadiation/viewFactor/viewFactor.H @@ -0,0 +1,152 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::viewFactor + +Description + helper class to sum up external radiation sources + + +SourceFiles + viewFactor.C + +\*---------------------------------------------------------------------------*/ + +#ifndef viewFactor_H +#define viewFactor_H + +#include "externalRadiationSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class wallHeatTransferFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class viewFactor +: + public externalRadiationSource +{ + // Private data + + //- temperature at infinity + scalar Tinf_; + + //- view factor + scalarField F_; + + //- espison + scalar epsilon_; + +public: + + //- Runtime type information + TypeName("viewFactor"); + + + // Constructors + + //- Construct from components + explicit viewFactor + ( + const word& name, + const dictionary& dict, + const fvPatch& p + ); + + + //- Construct from components + explicit viewFactor + ( + const word& name, + const dictionary& dict + ); + + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr + ( + new viewFactor(*this) + ); + } + + // Destructor + + virtual ~viewFactor() + {}; + + + // Member functions + + // Access + + const scalarField& F() const + { + return F_; + }; + + scalarField& F() + { + return F_; + }; + + const scalar& epsilon() const + { + return epsilon_; + }; + + scalar& epsilson() + { + return epsilon_; + }; + + + // Mapping functions + + // Evaluation functions + + //- Return heat flux + virtual tmp q(const scalarField& Tw) const; + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.C new file mode 100644 index 000000000..787a58641 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +\*---------------------------------------------------------------------------*/ + +#include "fieldStorage.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +fieldStorage::fieldStorage() +: + storedField_(), + curTimeIndex_(-1) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +template +void fieldStorage::store() +{ + if (curTimeIndex_ != time_.timeIndex()) + { + storedField_ = *this; + curTimeIndex_ = time_.timeIndex(); + } +} + + +template +const Field& originalPatchField::store() const +{ + if (curTimeIndex_ == time_.timeIndex()) + { + return storedField_; + } + else + { + return *this; + } +}; + + +template +void originalPatchField::autoMap +( + const fvPatchFieldMapper& m +) +{ + storedField_::autoMap(m); +} + + +template +void clear() const +{ + originalPatchField_.setSize(0); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.H new file mode 100644 index 000000000..4843ee41f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/fieldStorage/fieldStorage.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + fieldStorage + +Description + Region couple patch field + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved + +SourceFiles + fieldStorage.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldStorage_H +#define fieldStorage_H + +#include "coupledFvPatchField.H" +#include "fvPatchFieldMapper.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fieldStorage Declaration +\*---------------------------------------------------------------------------*/ + +template +class fieldStorage +{ + // Private data + + // Reference to time + const runTime& time_; + + //- original patch field + Field storedField_; + + //- Current time index used to store originalPatchField_ + label curTimeIndex_; + + +public: + + // Constructors + + //- Construct from patch and internal field + fieldStorage(); + + // Member functions + + //- Store field + void store(const Field&) const; + + //- Return stored field + const Field& originalPatchField() const; + + //- Map (and resize as needed) from self given a mapping object + void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + void rmap + ( + const fvPatchField&, + const labelList& + ); + + //- Clear storage + void clear() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fieldStorage.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C new file mode 100644 index 000000000..610a1b9eb --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.C @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "solidWallHeatFluxTemperatureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + q_(p.size(), 0.0), + KName_("undefined-K") +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const solidWallHeatFluxTemperatureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + q_(ptf.q_, mapper), + KName_(ptf.KName_) +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + q_("q", dict, p.size()), + KName_(dict.lookup("K")) +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf +) +: + fixedValueFvPatchScalarField(tppsf), + q_(tppsf.q_), + KName_(tppsf.KName_) +{} + + +Foam::solidWallHeatFluxTemperatureFvPatchScalarField:: +solidWallHeatFluxTemperatureFvPatchScalarField +( + const solidWallHeatFluxTemperatureFvPatchScalarField& tppsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(tppsf, iF), + q_(tppsf.q_), + KName_(tppsf.KName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + q_.autoMap(m); +} + + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const solidWallHeatFluxTemperatureFvPatchScalarField& hfptf = + refCast(ptf); + + q_.rmap(hfptf.q_, addr); +} + + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalarField& Kw = + patch().lookupPatchField(KName_); + + const fvPatchScalarField& Tw = *this; + + operator==(q_/(patch().deltaCoeffs()*Kw) + Tw.patchInternalField()); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::solidWallHeatFluxTemperatureFvPatchScalarField::write +( + Ostream& os +) const +{ + fixedValueFvPatchScalarField::write(os); + q_.writeEntry("q", os); + os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + solidWallHeatFluxTemperatureFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H new file mode 100644 index 000000000..31a27c4f1 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/fvPatchFields/solidWallHeatFluxTemperature/solidWallHeatFluxTemperatureFvPatchScalarField.H @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright held by original author + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + solidWallHeatFluxTemperatureFvPatchScalarField + +Description + Heat flux boundary condition for temperature on solid region + + Example usage: + myWallPatch + { + type solidWallHeatFluxTemperature; + K K; // Name of K field + q uniform 1000; // Heat flux / [W/m2] + value 300.0; // Initial temperature / [K] + } + + +SourceFiles + solidWallHeatFluxTemperatureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solidWallHeatFluxTemperatureFvPatchScalarField_H +#define solidWallHeatFluxTemperatureFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class solidWallHeatFluxTemperatureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class solidWallHeatFluxTemperatureFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Heat flux / [W/m2] + scalarField q_; + + //- Name of thermal conductivity field + word KName_; + + +public: + + //- Runtime type information + TypeName("solidWallHeatFluxTemperature"); + + + // Constructors + + //- Construct from patch and internal field + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // solidWallHeatFluxTemperatureFvPatchScalarField + // onto a new patch + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const solidWallHeatFluxTemperatureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const solidWallHeatFluxTemperatureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new solidWallHeatFluxTemperatureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + solidWallHeatFluxTemperatureFvPatchScalarField + ( + const solidWallHeatFluxTemperatureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new solidWallHeatFluxTemperatureFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // I-O + + //- Write + void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.C new file mode 100644 index 000000000..984923577 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "constantResistanceThermalGap.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(constantResistanceThermalGap, 0); + addToRunTimeSelectionTable(thermalGap, constantResistanceThermalGap, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::constantResistanceThermalGap::constantResistanceThermalGap +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + thermalGap(name, T, dict), + R_(dict.lookup("R")), + zones_(dict.lookup("zones")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::constantResistanceThermalGap::~constantResistanceThermalGap() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::constantResistanceThermalGap::modifyResistance +( + surfaceScalarField& DT +) const +{ + forAll(zones_, zoneI) + { + const label zoneID = mesh().faceZones().findZoneID(zones_[zoneI]); + + if ( zoneID < 0 ) + { + FatalErrorIn + ( + "constantResistanceThermalGap::modifyResistance()\n" + ) << "Zone " << zones_[zoneI] + << " specified in gap " << name() + << " does not exist" + << abort(FatalError); + } + + const labelList& faces = mesh().faceZones()[zoneID]; + const surfaceScalarField& deltaCoeffs = mesh().deltaCoeffs(); + + forAll(faces, faceI) + { + DT[faces[faceI]] = 1.0/deltaCoeffs[faceI]/R_.value(); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.H new file mode 100644 index 000000000..9bc667df6 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantResistanceThermalGap/constantResistanceThermalGap.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + constantResistanceThermalGap + +Description + Constant thermal properties + +Author + Henrik Rusche, Wikki GmbH, All rights reserved. + +SourceFiles + constantResistanceThermalGap.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantResistanceThermalGap_H +#define constantResistanceThermalGap_H + +#include "thermalGap.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class constantResistanceThermalGap Declaration +\*---------------------------------------------------------------------------*/ + +class constantResistanceThermalGap +: + public thermalGap +{ + // Private data + + //- thermal resistance of the gap + dimensionedScalar R_; + + //- list of face zones + const wordList zones_; + + // Private Member Functions + + //- Disallow default bitwise copy construct + constantResistanceThermalGap(const constantResistanceThermalGap&); + + //- Disallow default bitwise assignment + void operator=(const constantResistanceThermalGap&); + + +public: + + //- Runtime type information + TypeName("constantResistance"); + + // Static data members + + + // Constructors + + //- Construct from dictionary + constantResistanceThermalGap + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~constantResistanceThermalGap(); + + + // Member Functions + + //- Return density + virtual void modifyResistance(surfaceScalarField&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.C new file mode 100644 index 000000000..9d3a8dc3f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "constantThermalGap.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(constantThermalGap, 0); + addToRunTimeSelectionTable(thermalGap, constantThermalGap, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::constantThermalGap::constantThermalGap +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + thermalGap(name, T, dict), + beta_(dict.lookup("beta")), + zones_(dict.lookup("zones")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::constantThermalGap::~constantThermalGap() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::constantThermalGap::modifyResistance(surfaceScalarField& DT) const +{ + forAll(zones_, zoneI) + { + const label zoneID = mesh().faceZones().findZoneID(zones_[zoneI]); + + if ( zoneID < 0 ) + { + FatalErrorIn + ( + "constantThermalGap::modifyResistance()\n" + ) << "Zone " << zones_[zoneI] + << " specified in gap " << name() + << " does not exist" + << abort(FatalError); + } + + const labelList& faces = mesh().faceZones()[zoneID]; + + forAll(faces, faceI) + { + label fI = faces[faceI]; + if(fI < mesh().nInternalFaces()) + { + DT[fI] = beta_.value(); + } + else + { + const label patchI = mesh().boundaryMesh().whichPatch(fI); + fI -= mesh().boundaryMesh()[patchI].start(); + DT.boundaryField()[patchI][fI] = beta_.value(); + } + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.H new file mode 100644 index 000000000..0ca45aa80 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/constantThermalGap/constantThermalGap.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + constantThermalGap + +Description + Constant thermal properties + +Author + Henrik Rusche, Wikki GmbH, All rights reserved. + +SourceFiles + constantThermalGap.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantThermalGap_H +#define constantThermalGap_H + +#include "thermalGap.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class constantThermalGap Declaration +\*---------------------------------------------------------------------------*/ + +class constantThermalGap +: + public thermalGap +{ + // Private data + + //- thermal resistance of the gap + dimensionedScalar beta_; + + //- list of face zones + const wordList zones_; + + // Private Member Functions + + //- Disallow default bitwise copy construct + constantThermalGap(const constantThermalGap&); + + //- Disallow default bitwise assignment + void operator=(const constantThermalGap&); + + +public: + + //- Runtime type information + TypeName("constant"); + + // Static data members + + + // Constructors + + //- Construct from dictionary + constantThermalGap + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~constantThermalGap(); + + + // Member Functions + + //- Return density + virtual void modifyResistance(surfaceScalarField&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/newThermalGap.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/newThermalGap.C new file mode 100644 index 000000000..a0d7a0bbe --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/newThermalGap.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalGap + +\*---------------------------------------------------------------------------*/ + +#include "thermalGap.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +autoPtr thermalGap::New +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +{ + word tgTypeName = dict.lookup("type"); + + Info<< "Selecting thermal gap model " << tgTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(tgTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalIOErrorIn + ( + "thermalGap::New(\n" + " const word& name,\n" + " const volScalarField& T,\n" + " const dictionary& dict\n" + ")", + dict + ) << "Unknown thermalGap type " + << tgTypeName << endl << endl + << "Valid thermalGaps are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalIOError); + } + + return autoPtr(cstrIter()(name, T, dict)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.C new file mode 100644 index 000000000..975e7c73f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.C @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalGap + +\*---------------------------------------------------------------------------*/ + +#include "thermalGap.H" +#include "volFields.H" +#include "fvc.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(thermalGap, 0); +defineRunTimeSelectionTable(thermalGap, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermalGap::thermalGap +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + name_(name), + T_(T) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.H new file mode 100644 index 000000000..efb69af77 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalGaps/thermalGap/thermalGap.H @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalGap + +Description + Thermal properties of a gap. + +Author + Henrik Rusche, Wikki GmbH, All rights reserved. + +SourceFiles + thermalGap.C + newThermalLaw.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermalGap_H +#define thermalGap_H + +#include "IOdictionary.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "volFields.H" +#include "tmp.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class thermalGap Declaration +\*---------------------------------------------------------------------------*/ + +class thermalGap +{ + // Private data + + //- Name + const word name_; + + //- Reference to temperature field + const volScalarField& T_; + + + // Private Member Functions + + //- Disallow copy construct + thermalGap(const thermalGap&); + + //- Disallow default bitwise assignment + void operator=(const thermalGap&); + + +protected: + + //- Return reference to mesh + const fvMesh& mesh() const + { + return T_.mesh(); + } + +public: + + //- Runtime type information + TypeName("thermalGap"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + thermalGap, + dictionary, + ( + const word name, + const volScalarField& T, + const dictionary& dict + ), + (name, T, dict) + ); + + + // Selectors + + //- Return a reference to the selected thermal model + static autoPtr New + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Constructors + + //- Construct from dictionary + thermalGap + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~thermalGap() + {} + + + // Member Functions + + //- Return name + const word& name() const + { + return name_; + } + + //- Return temperture + const volScalarField& T() const + { + return T_; + }; + + //- Modify the resistance + virtual void modifyResistance(surfaceScalarField&) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.C new file mode 100644 index 000000000..5349b94c5 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.C @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "constantThermal.H" +#include "addToRunTimeSelectionTable.H" +#include "zeroGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(constantThermal, 0); + addToRunTimeSelectionTable(thermalLaw, constantThermal, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::constantThermal::constantThermal +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + thermalLaw(name, T, dict), + rho_(dict.lookup("rho")), + C_(dict.lookup("C")), + k_(dict.lookup("k")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::constantThermal::~constantThermal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::constantThermal::rho() const +{ + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "rho", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + rho_, + zeroGradientFvPatchScalarField::typeName + ) + ); + + tresult().correctBoundaryConditions(); + + return tresult; +} + +Foam::tmp Foam::constantThermal::C() const +{ + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "C", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + C_, + zeroGradientFvPatchScalarField::typeName + ) + ); + + tresult().correctBoundaryConditions(); + + return tresult; +} + + +Foam::tmp Foam::constantThermal::k() const +{ + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "kTmp", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + k_, + zeroGradientFvPatchScalarField::typeName + ) + ); + + tresult().correctBoundaryConditions(); + + return tresult; +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.H new file mode 100644 index 000000000..c2a7ec8d5 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/constantThermal/constantThermal.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + constantThermal + +Description + Constant thermal properties + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + constantThermal.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantThermal_H +#define constantThermal_H + +#include "thermalLaw.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class constantThermal Declaration +\*---------------------------------------------------------------------------*/ + +class constantThermal +: + public thermalLaw +{ + // Private data + + //- Specific heat capacity + dimensionedScalar rho_; + + //- Specific heat capacity + dimensionedScalar C_; + + //- Thermal conductivity + dimensionedScalar k_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + constantThermal(const constantThermal&); + + //- Disallow default bitwise assignment + void operator=(const constantThermal&); + + +public: + + //- Runtime type information + TypeName("constant"); + + // Static data members + + + // Constructors + + //- Construct from dictionary + constantThermal + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~constantThermal(); + + + // Member Functions + + //- Return density + virtual tmp rho() const; + + //- Return specific heat capacity + virtual tmp C() const; + + //- Return thermal conductivity + virtual tmp k() const; + + virtual void correct() + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.C new file mode 100644 index 000000000..3822a8801 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.C @@ -0,0 +1,325 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "multiMaterialThermal.H" +#include "addToRunTimeSelectionTable.H" +#include "zeroGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(multiMaterialThermal, 0); + addToRunTimeSelectionTable(thermalLaw, multiMaterialThermal, dictionary); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::tmp Foam::multiMaterialThermal::indicator +( + const label i +) const +{ + const scalarField& mat = materials_.internalField(); + + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "indicator", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimless, + zeroGradientFvPatchScalarField::typeName + ) + ); + + volScalarField& result = tresult(); + + forAll (mat, matI) + { + if (mat[matI] > i - SMALL && mat[matI] < i + SMALL) + { + result[matI] = 1.0; + } + else + { + result[matI] = 0.0; + } + } + + result.correctBoundaryConditions(); + + return tresult; +} + + +void Foam::multiMaterialThermal::readLaws +( + const volScalarField& T, + const dictionary& dict +) +{ + PtrList& laws = *this; + + PtrList lawEntries(dict.lookup("laws")); + laws.setSize(lawEntries.size()); + + forAll (laws, lawI) + { + laws.set + ( + lawI, + thermalLaw::New + ( + lawEntries[lawI].keyword(), + T, + lawEntries[lawI].dict() + ) + ); + } +} + +void Foam::multiMaterialThermal::checkLaws() const +{ + const PtrList& laws = *this; + + if + ( + max(materials_).value() > laws.size() + SMALL + ) + { + FatalErrorIn + ( + "multiMaterialThermal::checkLaws()\n" + ) << "Invalid definition of material indicator field. " + << "Number of materials: " << laws.size() + << " max index: " << max(materials_) + << ". Should be " << laws.size() - 1 + << abort(FatalError); + } + + if + ( + min(materials_).value() < 0 + ) + { + FatalErrorIn + ( + "multiMaterialThermal::checkLaws()\n" + ) << "Invalid definition of material indicator field. " + << "Number of materials: " << laws.size() + << " min index: " << min(materials_) + << ". Should be 0" + << abort(FatalError); + } +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::multiMaterialThermal::multiMaterialThermal +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + thermalLaw(name, T, dict), + PtrList(), + materials_ + ( + IOobject + ( + "materials", + mesh().time().timeName(), + mesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh() + ) +{ + readLaws(T, dict); + checkLaws(); +} + +// Construct from dictionary and create default material field +Foam::multiMaterialThermal::multiMaterialThermal +( + const word& name, + const volScalarField& T, + const dictionary& dict, + const scalar defaultMaterial +) +: + thermalLaw(name, T, dict), + PtrList(), + materials_ + ( + IOobject + ( + "materials", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh(), + defaultMaterial, + zeroGradientFvPatchScalarField::typeName + ) +{ + readLaws(T, dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + + +Foam::multiMaterialThermal::~multiMaterialThermal() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::multiMaterialThermal::rho() const +{ + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "rhoTmp", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar("zeroRho", dimDensity, 0), + calculatedFvPatchScalarField::typeName + ) + ); + volScalarField& result = tresult(); + + // Accumulate data for all fields + const PtrList& laws = *this; + + forAll (laws, lawI) + { + result += indicator(lawI)*laws[lawI].rho()(); + } + + return tresult; +} + +Foam::tmp Foam::multiMaterialThermal::C() const +{ + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "CTmp", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar("zeroC", dimSpecificHeatCapacity, 0), + calculatedFvPatchScalarField::typeName + ) + ); + volScalarField& result = tresult(); + + // Accumulate data for all fields + const PtrList& laws = *this; + + forAll (laws, lawI) + { + result += indicator(lawI)*laws[lawI].C()(); + } + + return tresult; +} + + +Foam::tmp Foam::multiMaterialThermal::k() const +{ + tmp tresult + ( + new volScalarField + ( + IOobject + ( + "kTmp", + mesh().time().timeName(), + mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh(), + dimensionedScalar("zerok", dimensionSet(1, 1, -3, -1, 0), 0), + calculatedFvPatchScalarField::typeName + ) + ); + volScalarField& result = tresult(); + + // Accumulate data for all fields + const PtrList& laws = *this; + + forAll (laws, lawI) + { + result += indicator(lawI)*laws[lawI].k(); + } + + return tresult; +} + + +void Foam::multiMaterialThermal::correct() +{ + PtrList& laws = *this; + + forAll (laws, lawI) + { + laws[lawI].correct(); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.H new file mode 100644 index 000000000..7e565552c --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialThermal/multiMaterialThermal.H @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + multiMaterialThermal + +Description + Zoned multi-material thermal model controlled by an indicator field. + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + multiMaterialThermal.C + +\*---------------------------------------------------------------------------*/ + +#ifndef multiMaterialThermal_H +#define multiMaterialThermal_H + +#include "thermalLaw.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class multiMaterialThermal Declaration +\*---------------------------------------------------------------------------*/ + +class multiMaterialThermal +: + public thermalLaw, + public PtrList +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + multiMaterialThermal(const multiMaterialThermal&); + + //- Disallow default bitwise assignment + void operator=(const multiMaterialThermal&); + + + //- Calculate indicator field given index + tmp indicator(const label index) const; + +protected: + + // Protected data + + //- Material indicator field + volScalarField materials_; + + // Protected member functions + + //- Check that the laws and the material field are okay + void readLaws + ( + const volScalarField& T, + const dictionary& dict + ); + + //- Check that the laws and the material field are okay + void checkLaws() const; + + +public: + + //- Runtime type information + TypeName("multiMaterial"); + + // Static data members + + + // Constructors + + //- Construct from dictionary + multiMaterialThermal + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + //- Construct from dictionary and create default material field + multiMaterialThermal + ( + const word& name, + const volScalarField& T, + const dictionary& dict, + const scalar defaultMaterial + ); + + // Destructor + + virtual ~multiMaterialThermal(); + + + // Member Functions + + //- Return density + virtual tmp rho() const; + + //- Return specific heat capacity + virtual tmp C() const; + + //- Return thermal conductivity + virtual tmp k() const; + + //- Correct the rheological model + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.C new file mode 100644 index 000000000..c31255690 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.C @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "multiMaterialZonesThermal.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(multiMaterialZonesThermal, 0); + addToRunTimeSelectionTable(thermalLaw, multiMaterialZonesThermal, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::multiMaterialZonesThermal::multiMaterialZonesThermal +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + multiMaterialThermal(name, T, dict, -1) +{ + readLaws(T, dict); + + PtrList lawEntries(dict.lookup("laws")); + + PtrList& laws = *this; + forAll (laws, lawI) + { + wordList zones (lawEntries[lawI].dict().lookup("zones")); + + forAll(zones, zoneI) + { + const label zoneID = mesh().cellZones().findZoneID(zones[zoneI]); + + if ( zoneID < 0 ) + { + FatalErrorIn + ( + "multiMaterialZonesThermal::multiMaterialZonesThermal()\n" + ) << "Zone " << zones[zoneI] + << " specified in material " << lawEntries[lawI].keyword() + << " does not exist" + << abort(FatalError); + } + + const labelList& cells = mesh().cellZones()[zoneID]; + + forAll(cells, cellI) + { + materials_[cells[cellI]] = lawI; + } + } + } + + materials_.correctBoundaryConditions(); + materials_.write(); + + checkLaws(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::multiMaterialZonesThermal::~multiMaterialZonesThermal() +{} + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.H new file mode 100644 index 000000000..2ba403d6f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/multiMaterialZonesThermal/multiMaterialZonesThermal.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + multiMaterialZonesThermal + +Description + Zoned multi-material thermal model constructed from zones + +Author + Henrik Rusche, Wikki GmbH, All rights reserved. + +SourceFiles + multiMaterialZonesThermal.C + +\*---------------------------------------------------------------------------*/ + +#ifndef multiMaterialZonesThermal_H +#define multiMaterialZonesThermal_H + +#include "multiMaterialThermal.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class multiMaterialZonesThermal Declaration +\*---------------------------------------------------------------------------*/ + +class multiMaterialZonesThermal +: + public multiMaterialThermal +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + multiMaterialZonesThermal(const multiMaterialZonesThermal&); + + //- Disallow default bitwise assignment + void operator=(const multiMaterialZonesThermal&); + +public: + + //- Runtime type information + TypeName("multiMaterialZones"); + + // Static data members + + + // Constructors + + //- Construct from dictionary + multiMaterialZonesThermal + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~multiMaterialZonesThermal(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/newThermalLaw.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/newThermalLaw.C new file mode 100644 index 000000000..3ed0c2fbb --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/newThermalLaw.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalLaw + +\*---------------------------------------------------------------------------*/ + +#include "thermalLaw.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +autoPtr thermalLaw::New +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +{ + word rheoTypeName = dict.lookup("type"); + + Info<< "Selecting thermal model " << rheoTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(rheoTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalIOErrorIn + ( + "thermalLaw::New(\n" + " const word& name,\n" + " const volScalarField& T,\n" + " const dictionary& dict\n" + ")", + dict + ) << "Unknown thermalLaw type " + << rheoTypeName << endl << endl + << "Valid thermalLaws are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalIOError); + } + + return autoPtr(cstrIter()(name, T, dict)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.C new file mode 100644 index 000000000..ac9e5f28c --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.C @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalLaw + +\*---------------------------------------------------------------------------*/ + +#include "thermalLaw.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(thermalLaw, 0); +defineRunTimeSelectionTable(thermalLaw, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermalLaw::thermalLaw +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + name_(name), + T_(T) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.H new file mode 100644 index 000000000..b952111a9 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalLaws/thermalLaw/thermalLaw.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalLaw + +Description + Thermal material properties for solids. + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + thermalLaw.C + newThermalLaw.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermalLaw_H +#define thermalLaw_H + +#include "IOdictionary.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "volFields.H" +#include "tmp.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class thermalLaw Declaration +\*---------------------------------------------------------------------------*/ + +class thermalLaw +{ + // Private data + + //- Name + const word name_; + + //- Reference to temperature field + const volScalarField& T_; + + + // Private Member Functions + + //- Disallow copy construct + thermalLaw(const thermalLaw&); + + //- Disallow default bitwise assignment + void operator=(const thermalLaw&); + + +protected: + + //- Return reference to mesh + const fvMesh& mesh() const + { + return T_.mesh(); + } + +public: + + //- Runtime type information + TypeName("thermalLaw"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + thermalLaw, + dictionary, + ( + const word name, + const volScalarField& T, + const dictionary& dict + ), + (name, T, dict) + ); + + + // Selectors + + //- Return a reference to the selected thermal model + static autoPtr New + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Constructors + + //- Construct from dictionary + thermalLaw + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~thermalLaw() + {} + + + // Member Functions + + //- Return name + const word& name() const + { + return name_; + } + + //- Return temperture + const volScalarField& T() const + { + return T_; + }; + + //- Return specific density + virtual tmp rho() const = 0; + + //- Return specific heat capacity + virtual tmp C() const = 0; + + //- Return thermal conductivity + virtual tmp k() const = 0; + + //- Correct the thermal model + virtual void correct() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.C new file mode 100644 index 000000000..38f85b7fa --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.C @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalModel + +Description + Thermal material properties for solids. + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +\*---------------------------------------------------------------------------*/ + +#include "thermalModel.H" +#include "volFields.H" +#include "fvc.H" +#include "fvm.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(thermalModel, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermalModel::thermalModel(const volScalarField& T) +: + IOdictionary + ( + IOobject + ( + "thermalProperties", + T.time().constant(), + T.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + T_(T), + lawPtr_(thermalLaw::New("law", T_, subDict("thermal"))) +{ + { + PtrList entries(subDict("thermal").lookup("gaps")); + gapPtr_.setSize(entries.size()); + + forAll (gapPtr_, gapI) + { + gapPtr_.set + ( + gapI, + thermalGap::New + ( + entries[gapI].keyword(), + T, + entries[gapI].dict() + ) + ); + } + } + + { + PtrList entries(subDict("thermal").lookup("sources")); + sourcePtr_.setSize(entries.size()); + + forAll (sourcePtr_, sourceI) + { + sourcePtr_.set + ( + sourceI, + thermalSource::New + ( + entries[sourceI].keyword(), + T, + entries[sourceI].dict() + ) + ); + } + } +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void thermalModel::modifyResistance +( + surfaceScalarField& kf +) const +{ + forAll(gapPtr_, gapI) + { + gapPtr_[gapI].modifyResistance(kf); + } +} + +tmp thermalModel::laplacian(volScalarField& T) +{ + word kScheme ("laplacian(k,T)"); + + surfaceScalarField kf = fvc::interpolate(lawPtr_->k()); + + modifyResistance(kf); + + return tmp + ( + new fvScalarMatrix( fvm::laplacian(kf, T, kScheme) ) + ); +} + +tmp thermalModel::S() const +{ + tmp tsource + ( + new volScalarField + ( + IOobject + ( + "heatSource", + T_.time().timeName(), + T_.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + T_.mesh(), + dimensionedScalar + ( + "zero", + dimEnergy/dimTime/dimVolume, + scalar(0.0) + ) + ) + ); + + forAll(sourcePtr_, sourceI) + { + sourcePtr_[sourceI].addSource(tsource()); + } + + return tsource; +} + +bool thermalModel::read() +{ + if (regIOobject::read()) + { + lawPtr_ = thermalLaw::New("law", T_, subDict("thermal")); + + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.H new file mode 100644 index 000000000..422b2d86c --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalModel.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2004-2011 Hrvoje Jasak + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalModel + +Description + Thermal material properties for solids. + +Author + Hrvoje Jasak, Wikki Ltd. All rights reserved. + +SourceFiles + thermalModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermalModel_H +#define thermalModel_H + +#include "IOdictionary.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "volFields.H" +#include "fvMatrices.H" +#include "tmp.H" +#include "thermalLaw.H" +#include "thermalGap.H" +#include "thermalSource.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class thermalModel Declaration +\*---------------------------------------------------------------------------*/ + +class thermalModel +: + public IOdictionary +{ + // Private data + + //- Reference to temperature field + const volScalarField& T_; + + //- Thermal law + autoPtr lawPtr_; + + //- Contact resistance + PtrList gapPtr_; + + //- Thermal Source + PtrList sourcePtr_; + + // Private Member Functions + + //- Disallow copy construct + thermalModel(const thermalModel&); + + //- Disallow default bitwise assignment + void operator=(const thermalModel&); + + +public: + + //- Runtime type information + TypeName("thermalModel"); + + // Constructors + + //- Construct from dictionary + thermalModel(const volScalarField& T); + + + // Destructor + + virtual ~thermalModel() + {} + + + // Member Functions + + //- Return thermal law + const thermalLaw& law() const + { + return lawPtr_(); + } + + //- Return density + tmp rho() const + { + return lawPtr_->rho(); + } + + //- Return specific heat capacity + tmp C() const + { + return lawPtr_->C(); + } + + //- Return thermal conductivity + tmp k() const + { + return lawPtr_->k(); + } + + //- Add resistance for gaps + void modifyResistance(surfaceScalarField&) const; + + //- Return the laplacian and incorporate resistance for gaps + tmp laplacian(volScalarField&); + + //- Return the aggregated source + tmp S() const; + + //- Correct the thermal model + void correct() + { + lawPtr_->correct(); + } + + //- Read thermalProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.C new file mode 100644 index 000000000..a2e6addc2 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +\*---------------------------------------------------------------------------*/ + +#include "constantThermalSource.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(constantThermalSource, 0); + addToRunTimeSelectionTable(thermalSource, constantThermalSource, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::constantThermalSource::constantThermalSource +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + thermalSource(name, T, dict), + S_(dict.lookup("S")), + zones_(dict.lookup("zones")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::constantThermalSource::~constantThermalSource() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::constantThermalSource::addSource(volScalarField& source) const +{ + forAll(zones_, zoneI) + { + const label zoneID = mesh().cellZones().findZoneID(zones_[zoneI]); + + if ( zoneID < 0 ) + { + FatalErrorIn + ( + "constantThermalSource::addSourcex()\n" + ) << "Zone " << zones_[zoneI] + << " specified in source " << name() + << " does not exist" + << abort(FatalError); + } + + const labelList& cells = mesh().cellZones()[zoneID]; + + forAll(cells, cellI) + { + source[cells[cellI]] = S_.value(); + } + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.H new file mode 100644 index 000000000..202343182 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/constantThermalSource/constantThermalSource.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + constantThermalSource + +Description + Constant thermal properties + +Author + Henrik Rusche, Wikki GmbH. All rights reserved. + +SourceFiles + constantThermalSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantThermalSource_H +#define constantThermalSource_H + +#include "thermalSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class constantThermalSource Declaration +\*---------------------------------------------------------------------------*/ + +class constantThermalSource +: + public thermalSource +{ + // Private data + + //- Strengh of the source + dimensionedScalar S_; + + //- list of cell zones + const wordList zones_; + + // Private Member Functions + + //- Disallow default bitwise copy construct + constantThermalSource(const constantThermalSource&); + + //- Disallow default bitwise assignment + void operator=(const constantThermalSource&); + + +public: + + //- Runtime type information + TypeName("constant"); + + // Static data members + + + // Constructors + + //- Construct from dictionary + constantThermalSource + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~constantThermalSource(); + + + // Member Functions + + //- Add source term + virtual void addSource(volScalarField& source) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/newThermalSource.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/newThermalSource.C new file mode 100644 index 000000000..94aa2b855 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/newThermalSource.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalSource + +\*---------------------------------------------------------------------------*/ + +#include "thermalSource.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +autoPtr thermalSource::New +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +{ + word rheoTypeName = dict.lookup("type"); + + Info<< "Selecting thermal model " << rheoTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(rheoTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalIOErrorIn + ( + "thermalSource::New(\n" + " const word& name,\n" + " const volScalarField& T,\n" + " const dictionary& dict\n" + ")", + dict + ) << "Unknown thermalSource type " + << rheoTypeName << endl << endl + << "Valid thermalSources are : " << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalIOError); + } + + return autoPtr(cstrIter()(name, T, dict)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.C b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.C new file mode 100644 index 000000000..47d0c8c41 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.C @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalSource + +\*---------------------------------------------------------------------------*/ + +#include "thermalSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(thermalSource, 0); +defineRunTimeSelectionTable(thermalSource, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +thermalSource::thermalSource +( + const word& name, + const volScalarField& T, + const dictionary& dict +) +: + name_(name), + T_(T) +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.H b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.H new file mode 100644 index 000000000..1abe9db91 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/conjugateHeatTransfer/thermalModel/thermalSource/thermalSource/thermalSource.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Rusche + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Class + thermalSource + +Description + A thermal source. + +Author + Henrik Rusche, Wikki GmbH. All rights reserved. + +SourceFiles + thermalSource.C + newThermalSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermalSource_H +#define thermalSource_H + +#include "IOdictionary.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "volFields.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class thermalSource Declaration +\*---------------------------------------------------------------------------*/ + +class thermalSource +{ + // Private data + + //- Name + const word name_; + + //- Reference to temperature field + const volScalarField& T_; + + + // Private Member Functions + + //- Disallow copy construct + thermalSource(const thermalSource&); + + //- Disallow default bitwise assignment + void operator=(const thermalSource&); + + +protected: + + //- Return reference to mesh + const fvMesh& mesh() const + { + return T_.mesh(); + } + +public: + + //- Runtime type information + TypeName("thermalSource"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + thermalSource, + dictionary, + ( + const word name, + const volScalarField& T, + const dictionary& dict + ), + (name, T, dict) + ); + + + // Selectors + + //- Return a reference to the selected thermal model + static autoPtr New + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Constructors + + //- Construct from dictionary + thermalSource + ( + const word& name, + const volScalarField& T, + const dictionary& dict + ); + + + // Destructor + + virtual ~thermalSource() + {} + + + // Member Functions + + //- Return name + const word& name() const + { + return name_; + } + + //- Add source term + virtual void addSource(volScalarField& source) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatFoam/createFields.H b/applications/solvers/coupled/conjugateHeatFoam/createFields.H index 83b8544b9..720ef6deb 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/createFields.H +++ b/applications/solvers/coupled/conjugateHeatFoam/createFields.H @@ -12,19 +12,16 @@ ) ); + Info<< "Calculating field g.h\n" << endl; + volScalarField gh("gh", g & mesh.C()); + surfaceScalarField ghf("ghf", g & mesh.Cf()); - dimensionedScalar nu - ( - transportProperties.lookup("nu") - ); - - - Info<< "Reading field p\n" << endl; - volScalarField p + Info<< "Reading field p_rgh\n" << endl; + volScalarField p_rgh ( IOobject ( - "p", + "p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, @@ -48,7 +45,6 @@ ); Info<< "Reading field T\n" << endl; - volScalarField T ( IOobject @@ -64,16 +60,31 @@ # include "createPhi.H" +# include "readTransportProperties.H" + label pRefCell = 0; scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + setRefCell + ( + p_rgh, + mesh.solutionDict().subDict("PISO"), + pRefCell, + pRefValue + ); - Info<< "Reading field DT\n" << endl; - volScalarField DT + autoPtr turbulence + ( + incompressible::RASModel::New(U, phi, laminarTransport) + ); + +# include "attachPatches.H" + + Info<< "Reading field kappaEff\n" << endl; + volScalarField kappaEff ( IOobject ( - "DT", + "kappaEff", runTime.timeName(), mesh, IOobject::MUST_READ, @@ -81,3 +92,21 @@ ), mesh ); + + // Kinematic density for buoyancy force + volScalarField rhok + ( + IOobject + ( + "rhok", + runTime.timeName(), + mesh + ), + 1.0 - beta*(T - TRef) + ); + + Info<< "Creating radiation model\n" << endl; + autoPtr radiation + ( + radiation::radiationModel::New(T) + ); diff --git a/applications/solvers/coupled/conjugateHeatFoam/createFluidMesh.H b/applications/solvers/coupled/conjugateHeatFoam/createFluidMesh.H index f0321c9c7..32edb8f54 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/createFluidMesh.H +++ b/applications/solvers/coupled/conjugateHeatFoam/createFluidMesh.H @@ -1,8 +1,6 @@ Info<< "Create mesh for time = " << runTime.timeName() << nl << endl; -Info << "f1" << endl; - fvMesh mesh ( IOobject @@ -13,6 +11,3 @@ Info << "f1" << endl; IOobject::MUST_READ ) ); - -Info << "f2" << endl; - diff --git a/applications/solvers/coupled/conjugateHeatFoam/createSolidFields.H b/applications/solvers/coupled/conjugateHeatFoam/createSolidFields.H index 84f06b5c2..aaa829c37 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/createSolidFields.H +++ b/applications/solvers/coupled/conjugateHeatFoam/createSolidFields.H @@ -12,13 +12,15 @@ solidMesh ); - Info<< "Reading solid diffusivity DT\n" << endl; + Info<< "Reading solid thermal properties" << endl; + thermalModel solidThermo(Tsolid); - volScalarField DTsolid + Info<< "Reading solid diffusivity k\n" << endl; + volScalarField ksolid ( IOobject ( - "DT", + "k", runTime.timeName(), solidMesh, IOobject::MUST_READ, @@ -27,6 +29,17 @@ solidMesh ); - // On creation of both diffusivities, couple the sides - DT.correctBoundaryConditions(); - DTsolid.correctBoundaryConditions(); + Info<< "Constructing rhoCp\n" << endl; + volScalarField rhoCpsolid + ( + IOobject + ( + "rhoCpsolid", + runTime.timeName(), + solidMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + solidThermo.rho()*solidThermo.C() + ); + rhoCpsolid.oldTime(); diff --git a/applications/solvers/coupled/conjugateHeatFoam/createSolidMesh.H b/applications/solvers/coupled/conjugateHeatFoam/createSolidMesh.H index 2d23d07b5..94e9a4eea 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/createSolidMesh.H +++ b/applications/solvers/coupled/conjugateHeatFoam/createSolidMesh.H @@ -1,5 +1,3 @@ -Info << "s1" << endl; - fvMesh solidMesh ( IOobject @@ -11,5 +9,22 @@ Info << "s1" << endl; ) ); -Info << "s2" << endl; +{ + const polyPatchList& patches = solidMesh.boundaryMesh(); + + forAll (patches, patchI) + { + if (isType(patches[patchI])) + { + const regionCouplePolyPatch& rcp = + refCast(patches[patchI]); + + // Attach it here + rcp.attach(); + } + } + + // Force recalculation of weights + solidMesh.surfaceInterpolation::movePoints(); +} diff --git a/applications/solvers/coupled/conjugateHeatFoam/detachPatches.H b/applications/solvers/coupled/conjugateHeatFoam/detachPatches.H index 3171a5173..30e3ebe30 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/detachPatches.H +++ b/applications/solvers/coupled/conjugateHeatFoam/detachPatches.H @@ -14,5 +14,5 @@ } // Force recalculation of weights - mesh.surfaceInterpolation::movePoints(); + mesh.surfaceInterpolation::movePoints(); } diff --git a/applications/solvers/coupled/conjugateHeatFoam/initConvergenceCheck.H b/applications/solvers/coupled/conjugateHeatFoam/initConvergenceCheck.H new file mode 100644 index 000000000..b56197f22 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/initConvergenceCheck.H @@ -0,0 +1,7 @@ +// initialize values for convergence checks + + scalar eqnResidual = 1, maxResidual = 0; + scalar convergenceCriterion = 0; + + simple.readIfPresent("convergence", convergenceCriterion); + diff --git a/applications/solvers/coupled/conjugateHeatFoam/pEqn.H b/applications/solvers/coupled/conjugateHeatFoam/pEqn.H new file mode 100644 index 000000000..57e9a156d --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/pEqn.H @@ -0,0 +1,47 @@ +{ + volScalarField rUA("rUA", 1.0/UEqn.A()); + surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); + + U = rUA*UEqn.H(); + + phi = (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, U, phi); + + surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf()); + phi -= buoyancyPhi; + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix p_rghEqn + ( + fvm::laplacian(rUAf, p_rgh) == fvc::div(phi) + ); + + p_rghEqn.setReference(pRefCell, pRefValue); + + if (corr == nCorr-1 && nonOrth == nNonOrthCorr) + { + p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name() + "Final")); + } + else + { + p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name())); + } + + if (nonOrth == nNonOrthCorr) + { + // Calculate the conservative fluxes + phi -= p_rghEqn.flux(); + + // Explicitly relax pressure for momentum corrector + p_rgh.relax(); + + // Correct the momentum source with the pressure gradient flux + // calculated from the relaxed pressure + U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf); + U.correctBoundaryConditions(); + } + } + + #include "continuityErrs.H" +} diff --git a/applications/solvers/coupled/conjugateHeatFoam/readTransportProperties.H b/applications/solvers/coupled/conjugateHeatFoam/readTransportProperties.H new file mode 100644 index 000000000..297641a43 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatFoam/readTransportProperties.H @@ -0,0 +1,19 @@ + singlePhaseTransportModel laminarTransport(U, phi); + + // Density [kg/m^3] + dimensionedScalar rho(laminarTransport.lookup("rho")); + + // Heat capacity [J/kgK] + dimensionedScalar Cp(laminarTransport.lookup("Cp")); + + // Thermal expansion coefficient [1/K] + dimensionedScalar beta(laminarTransport.lookup("beta")); + + // Reference temperature [K] + dimensionedScalar TRef(laminarTransport.lookup("TRef")); + + // Laminar Prandtl number + dimensionedScalar Pr(laminarTransport.lookup("Pr")); + + // Turbulent Prandtl number + dimensionedScalar Prt(laminarTransport.lookup("Prt")); diff --git a/applications/solvers/coupled/conjugateHeatFoam/solveEnergy.H b/applications/solvers/coupled/conjugateHeatFoam/solveEnergy.H index 7e83801a4..e7f3c809c 100644 --- a/applications/solvers/coupled/conjugateHeatFoam/solveEnergy.H +++ b/applications/solvers/coupled/conjugateHeatFoam/solveEnergy.H @@ -1,7 +1,4 @@ { - // Decoupled patches -# include "attachPatches.H" - // Solid side # include "readSolidControls.H" @@ -9,28 +6,40 @@ { coupledFvScalarMatrix TEqns(2); - // Add fluid equation - TEqns.set + fvScalarMatrix* TFluidEqn = new fvScalarMatrix ( - 0, - new fvScalarMatrix + rho*Cp* ( fvm::ddt(T) + fvm::div(phi, T) - - fvm::laplacian(DT, T) ) + - fvm::laplacian(kappaEff, T) + == + radiation->Ru() + - fvm::Sp(4.0*radiation->Rp()*pow3(T), T) + + 3.0*radiation->Rp()*pow4(T) ); - // Add solid equation - TEqns.set + //Done automatically in 1.6.1-ext + //TFluidEqn->boundaryManipulate(T.boundaryField()); + + fvScalarMatrix* TSolidEqn = new fvScalarMatrix ( - 1, - new fvScalarMatrix - ( - fvm::ddt(Tsolid) - fvm::laplacian(DTsolid, Tsolid) - ) + fvm::ddt(rhoCpsolid, Tsolid) + - fvm::laplacian(ksolidf, Tsolid, "laplacian(k,T)") + + fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid) ); + //Done automatically in 1.6.1-ext + //TSolidEqn->boundaryManipulate(Tsolid.boundaryField()); + + + // Add fluid equation + TEqns.set(0, TFluidEqn); + + // Add solid equation + TEqns.set(1, TSolidEqn); + TEqns.solve(); } } diff --git a/applications/solvers/coupled/conjugateHeatFoam/solveFluid.H b/applications/solvers/coupled/conjugateHeatFoam/solveFluid.H deleted file mode 100644 index 5a8ffa1e1..000000000 --- a/applications/solvers/coupled/conjugateHeatFoam/solveFluid.H +++ /dev/null @@ -1,47 +0,0 @@ -{ - // Detach patches -# include "detachPatches.H" - -# include "readPISOControls.H" -# include "CourantNo.H" - - fvVectorMatrix UEqn - ( - fvm::ddt(U) - + fvm::div(phi, U) - - fvm::laplacian(nu, U) - ); - - solve(UEqn == -fvc::grad(p)); - - // --- PISO loop - - for (int corr = 0; corr < nCorr; corr++) - { - U = UEqn.H()/UEqn.A(); - U.correctBoundaryConditions(); - - phi = fvc::interpolate(U) & mesh.Sf(); - - for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(1.0/UEqn.A(), p) == fvc::div(phi) - ); - - pEqn.setReference(pRefCell, pRefValue); - pEqn.solve(); - - if (nonOrth == nNonOrthCorr) - { - phi -= pEqn.flux(); - } - } - -# include "continuityErrs.H" - - U -= fvc::grad(p)/UEqn.A(); - U.correctBoundaryConditions(); - } -} diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/Make/files b/applications/solvers/coupled/conjugateHeatSimpleFoam/Make/files new file mode 100644 index 000000000..aabca7fed --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/Make/files @@ -0,0 +1,3 @@ +conjugateHeatSimpleFoam.C + +EXE = $(FOAM_APPBIN)/conjugateHeatSimpleFoam diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/Make/options b/applications/solvers/coupled/conjugateHeatSimpleFoam/Make/options new file mode 100644 index 000000000..9c1fa7a2f --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/Make/options @@ -0,0 +1,22 @@ +EXE_INC = \ + -I../conjugateHeatFoam/conjugateHeatTransfer/lnInclude \ + -I$(LIB_SRC)/turbulenceModels \ + -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ + -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/coupledMatrix/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude + +EXE_LIBS = \ + -lincompressibleTurbulenceModel \ + -lincompressibleRASModels \ + -lincompressibleTransportModels \ + -lcoupledLduMatrix \ + -lfiniteVolume \ + -lradiation \ + -lbasicThermophysicalModels \ + -lspecie \ + -lconjugateHeatTransfer diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H new file mode 100644 index 000000000..59633497a --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/UEqn.H @@ -0,0 +1,27 @@ + // Solve the momentum equation + + tmp UEqn + ( + fvm::div(phi, U) + + turbulence->divDevReff(U) + + fvm::SuSp(-fvc::div(phi), U) + ); + + UEqn().relax(); + + eqnResidual = solve + ( + UEqn() + == + fvc::reconstruct + ( + ( + ( + - ghf*fvc::snGrad(rhok) + - fvc::snGrad(p_rgh) + )*mesh.magSf() + ) + ) + ).initialResidual(); + + maxResidual = max(eqnResidual, maxResidual); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/attachPatches.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/attachPatches.H new file mode 100644 index 000000000..3a2f62f06 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/attachPatches.H @@ -0,0 +1,18 @@ +{ + const polyPatchList& patches = mesh.boundaryMesh(); + + forAll (patches, patchI) + { + if (isType(patches[patchI])) + { + const regionCouplePolyPatch& rcp = + refCast(patches[patchI]); + + // Attach it here + rcp.attach(); + } + } + + // Force recalculation of weights + mesh.surfaceInterpolation::movePoints(); +} diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C b/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C new file mode 100644 index 000000000..45d82b0de --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/conjugateHeatSimpleFoam.C @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 H. Jasak & H. Rusche + \\/ M anipulation | All rights reserved +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + chipAirCoolingSimpleFoam + +Description + Steady-State solver for buoyancy-driven turbulent flow of incompressible + Newtonian fluids with conjugate heat transfer, complex heat conduction + and radiation + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "coupledFvMatrices.H" +#include "regionCouplePolyPatch.H" +#include "radiationModel.H" +#include "thermalModel.H" +#include "singlePhaseTransportModel.H" +#include "RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ +# include "setRootCase.H" +# include "createTime.H" +# include "createFluidMesh.H" +# include "createSolidMesh.H" +# include "readGravitationalAcceleration.H" +# include "createFields.H" +# include "createSolidFields.H" +# include "initContinuityErrs.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.loop()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + +# include "readSIMPLEControls.H" +# include "initConvergenceCheck.H" + + // Detach patches +# include "detachPatches.H" + + p_rgh.storePrevIter(); + +# include "UEqn.H" +# include "pEqn.H" + + // Update turbulent quantities + turbulence->correct(); + + radiation->correct(); + + // Update thermal conductivity in the fluid + kappaEff = rho*Cp*(turbulence->nu()/Pr + turbulence->nut()/Prt); + + // Update thermal conductivity in the solid + solidThermo.correct(); + ksolid = solidThermo.k(); + + // Coupled patches +# include "attachPatches.H" + + kappaEff.correctBoundaryConditions(); + ksolid.correctBoundaryConditions(); + + // Interpolate to the faces and add thermal resistance + surfaceScalarField ksolidf = fvc::interpolate(ksolid); + solidThermo.modifyResistance(ksolidf); + +# include "solveEnergy.H" + + // Update density according to Boussinesq approximation + rhok = 1.0 - beta*(T - TRef); + + runTime.write(); + + Info<< "ExecutionTime = " + << runTime.elapsedCpuTime() + << " s\n\n" << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* // diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H new file mode 100644 index 000000000..159d180cc --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFields.H @@ -0,0 +1,112 @@ + Info<< "Reading transportProperties\n" << endl; + + IOdictionary transportProperties + ( + IOobject + ( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + Info<< "Calculating field g.h\n" << endl; + volScalarField gh("gh", g & mesh.C()); + surfaceScalarField ghf("ghf", g & mesh.Cf()); + + Info<< "Reading field p_rgh\n" << endl; + volScalarField p_rgh + ( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< "Reading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< "Reading field T\n" << endl; + volScalarField T + ( + IOobject + ( + "T", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + +# include "createPhi.H" + +# include "readTransportProperties.H" + + label pRefCell = 0; + scalar pRefValue = 0.0; + setRefCell + ( + p_rgh, + mesh.solutionDict().subDict("SIMPLE"), + pRefCell, + pRefValue + ); + + autoPtr turbulence + ( + incompressible::RASModel::New(U, phi, laminarTransport) + ); + +# include "attachPatches.H" + + Info<< "Reading field kappaEff\n" << endl; + volScalarField kappaEff + ( + IOobject + ( + "kappaEff", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + // Kinematic density for buoyancy force + volScalarField rhok + ( + IOobject + ( + "rhok", + runTime.timeName(), + mesh + ), + 1.0 - beta*(T - TRef) + ); + + Info<< "Creating radiation model\n" << endl; + autoPtr radiation + ( + radiation::radiationModel::New(T) + ); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/createFluidMesh.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFluidMesh.H new file mode 100644 index 000000000..32edb8f54 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/createFluidMesh.H @@ -0,0 +1,13 @@ + Info<< "Create mesh for time = " + << runTime.timeName() << nl << endl; + + fvMesh mesh + ( + IOobject + ( + fvMesh::defaultRegion, + runTime.timeName(), + runTime, + IOobject::MUST_READ + ) + ); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidFields.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidFields.H new file mode 100644 index 000000000..26e1cd843 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidFields.H @@ -0,0 +1,30 @@ + Info<< "Reading field Tsolid\n" << endl; + volScalarField Tsolid + ( + IOobject + ( + "T", + runTime.timeName(), + solidMesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + solidMesh + ); + + Info<< "Reading solid thermal properties" << endl; + thermalModel solidThermo(Tsolid); + + Info<< "Reading solid diffusivity k\n" << endl; + volScalarField ksolid + ( + IOobject + ( + "k", + runTime.timeName(), + solidMesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + solidMesh + ); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidMesh.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidMesh.H new file mode 100644 index 000000000..94e9a4eea --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/createSolidMesh.H @@ -0,0 +1,30 @@ + fvMesh solidMesh + ( + IOobject + ( + "solid", + runTime.timeName(), + runTime, + IOobject::MUST_READ + ) + ); + +{ + const polyPatchList& patches = solidMesh.boundaryMesh(); + + forAll (patches, patchI) + { + if (isType(patches[patchI])) + { + const regionCouplePolyPatch& rcp = + refCast(patches[patchI]); + + // Attach it here + rcp.attach(); + } + } + + // Force recalculation of weights + solidMesh.surfaceInterpolation::movePoints(); +} + diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/detachPatches.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/detachPatches.H new file mode 100644 index 000000000..99ddc8e35 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/detachPatches.H @@ -0,0 +1,38 @@ +{ + const polyPatchList& patches = mesh.boundaryMesh(); + + forAll (patches, patchI) + { + if (isType(patches[patchI])) + { + const regionCouplePolyPatch& rcp = + refCast(patches[patchI]); + + // Detach it here + rcp.detach(); + } + } + + // Force recalculation of weights + mesh.surfaceInterpolation::movePoints(); +} +/* +{ + const polyPatchList& patches = solidMesh.boundaryMesh(); + + forAll (patches, patchI) + { + if (isType(patches[patchI])) + { + const regionCouplePolyPatch& rcp = + refCast(patches[patchI]); + + // Detach it here + rcp.detach(); + } + } + + // Force recalculation of weights + solidMesh.surfaceInterpolation::movePoints(); +} +*/ diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H new file mode 100644 index 000000000..b56197f22 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/initConvergenceCheck.H @@ -0,0 +1,7 @@ +// initialize values for convergence checks + + scalar eqnResidual = 1, maxResidual = 0; + scalar convergenceCriterion = 0; + + simple.readIfPresent("convergence", convergenceCriterion); + diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H new file mode 100644 index 000000000..559b052c6 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/pEqn.H @@ -0,0 +1,50 @@ +{ + volScalarField rUA("rUA", 1.0/UEqn().A()); + surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA)); + + U = rUA*UEqn().H(); + UEqn.clear(); + + phi = fvc::interpolate(U) & mesh.Sf(); + adjustPhi(phi, U, p_rgh); + + surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf()); + phi -= buoyancyPhi; + + for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix p_rghEqn + ( + fvm::laplacian(rUAf, p_rgh) == fvc::div(phi) + ); + + p_rghEqn.setReference(pRefCell, pRefValue); + + // retain the residual from the first iteration + if (nonOrth == 0) + { + eqnResidual = p_rghEqn.solve().initialResidual(); + maxResidual = max(eqnResidual, maxResidual); + } + else + { + p_rghEqn.solve(); + } + + if (nonOrth == nNonOrthCorr) + { + // Calculate the conservative fluxes + phi -= p_rghEqn.flux(); + + // Explicitly relax pressure for momentum corrector + p_rgh.relax(); + + // Correct the momentum source with the pressure gradient flux + // calculated from the relaxed pressure + U -= rUA*fvc::reconstruct((buoyancyPhi + p_rghEqn.flux())/rUAf); + U.correctBoundaryConditions(); + } + } + + #include "continuityErrs.H" +} diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/readSolidControls.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/readSolidControls.H new file mode 100644 index 000000000..c2b6f17f5 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/readSolidControls.H @@ -0,0 +1,7 @@ + const dictionary& simple = solidMesh.solutionDict().subDict("SIMPLE"); + + int nNonOrthCorr = 0; + if (simple.found("nNonOrthogonalCorrectors")) + { + nNonOrthCorr = readInt(simple.lookup("nNonOrthogonalCorrectors")); + } diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/readTransportProperties.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/readTransportProperties.H new file mode 100644 index 000000000..297641a43 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/readTransportProperties.H @@ -0,0 +1,19 @@ + singlePhaseTransportModel laminarTransport(U, phi); + + // Density [kg/m^3] + dimensionedScalar rho(laminarTransport.lookup("rho")); + + // Heat capacity [J/kgK] + dimensionedScalar Cp(laminarTransport.lookup("Cp")); + + // Thermal expansion coefficient [1/K] + dimensionedScalar beta(laminarTransport.lookup("beta")); + + // Reference temperature [K] + dimensionedScalar TRef(laminarTransport.lookup("TRef")); + + // Laminar Prandtl number + dimensionedScalar Pr(laminarTransport.lookup("Pr")); + + // Turbulent Prandtl number + dimensionedScalar Prt(laminarTransport.lookup("Prt")); diff --git a/applications/solvers/coupled/conjugateHeatSimpleFoam/solveEnergy.H b/applications/solvers/coupled/conjugateHeatSimpleFoam/solveEnergy.H new file mode 100644 index 000000000..a6549e8b5 --- /dev/null +++ b/applications/solvers/coupled/conjugateHeatSimpleFoam/solveEnergy.H @@ -0,0 +1,46 @@ +{ + // Solid side +# include "readSolidControls.H" + + for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++) + { + coupledFvScalarMatrix TEqns(2); + + fvScalarMatrix* TFluidEqn = new fvScalarMatrix + ( + rho*Cp* + ( + fvm::div(phi, T) + + fvm::SuSp(-fvc::div(phi), T) + ) + - fvm::laplacian(kappaEff, T) + == + radiation->Ru() + - fvm::Sp(4.0*radiation->Rp()*pow3(T), T) + + 3.0*radiation->Rp()*pow4(T) + ); + + //Called automatically in 1.6.1-ext + //TFluidEqn->boundaryManipulate(T.boundaryField()); + TFluidEqn->relax(); + + fvScalarMatrix* TSolidEqn = new fvScalarMatrix + ( + - fvm::laplacian(ksolidf, Tsolid, "laplacian(k,T)") + + fvm::SuSp(-solidThermo.S()/Tsolid, Tsolid) + ); + + //Called automatically in 1.6.1-ext + //TSolidEqn->boundaryManipulate(Tsolid.boundaryField()); + TSolidEqn->relax(); + + + // Add fluid equation + TEqns.set(0, TFluidEqn); + + // Add solid equation + TEqns.set(1, TSolidEqn); + + TEqns.solve(); + } +} diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/G b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/G new file mode 100644 index 000000000..9a8e160df --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/G @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object G; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 0 -3 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + left + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + right + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + bottom + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/T b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/T index b3887983b..080a46186 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/T +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/T @@ -22,7 +22,9 @@ boundaryField { movingWall { - type zeroGradient; + type adiabatic; + K kappaEff; + value uniform 273; } left @@ -33,15 +35,18 @@ boundaryField right { - type regionCoupling; - value uniform 273; - + type chtRcTemperature; + radiation on; + K kappaEff; remoteField T; + value uniform 273; } bottom { - type zeroGradient; + type adiabatic; + K kappaEff; + value uniform 273; } frontAndBack diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/epsilon b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/epsilon new file mode 100644 index 000000000..f013b5d09 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/epsilon @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 0.000765; + +boundaryField +{ + movingWall + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + left + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + right + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + bottom + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/k b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/k new file mode 100644 index 000000000..575abf3e8 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/k @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.00325; + +boundaryField +{ + movingWall + { + type kqRWallFunction; + value uniform 0.00325; + } + left + { + type kqRWallFunction; + value uniform 0.00325; + } + right + { + type kqRWallFunction; + value uniform 0.00325; + } + bottom + { + type kqRWallFunction; + value uniform 0.00325; + } + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/DT b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/kappaEff similarity index 89% rename from tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/DT rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/kappaEff index 03861d101..a4323e0c7 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/DT +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/kappaEff @@ -10,11 +10,11 @@ FoamFile version 2.0; format ascii; class volScalarField; - object T; + object kappaEff; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -1 0 0 0 0]; +dimensions [1 1 -3 -1 0 0 0]; internalField uniform 1e-3; @@ -32,9 +32,9 @@ boundaryField right { - type regionCoupling; + type chtRcThermalDiffusivity; + remoteField k; value uniform 1e-3; - remoteField DT; } bottom diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/materials similarity index 93% rename from tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/materials index a0ac9bed8..8f95d5517 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/materials @@ -10,11 +10,12 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "0"; + object materials; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -2 0 0 0 0]; +dimensions [0 0 0 0 0 0 0]; internalField uniform 0; @@ -24,22 +25,18 @@ boundaryField { type zeroGradient; } - left { type zeroGradient; } - right { type zeroGradient; } - bottom { type zeroGradient; } - frontAndBack { type empty; diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/nut b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/nut new file mode 100644 index 000000000..98a8b2139 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/nut @@ -0,0 +1,167 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "1000"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField nonuniform List +100 +( +1.21785e-05 +1.22034e-05 +1.18131e-05 +1.13441e-05 +1.09569e-05 +1.06084e-05 +1.02572e-05 +9.85849e-06 +9.36793e-06 +8.69525e-06 +1.32378e-05 +2.22807e-05 +2.46882e-05 +2.67024e-05 +2.79187e-05 +2.8085e-05 +2.69455e-05 +2.42296e-05 +1.96054e-05 +9.54756e-06 +1.40374e-05 +3.15682e-05 +3.54686e-05 +4.04963e-05 +4.26252e-05 +4.22113e-05 +3.89888e-05 +3.24706e-05 +2.33811e-05 +9.57482e-06 +1.4776e-05 +3.97026e-05 +4.35993e-05 +4.90069e-05 +5.08533e-05 +4.88669e-05 +4.25389e-05 +3.19679e-05 +2.00092e-05 +9.21191e-06 +1.54597e-05 +4.10906e-05 +4.41726e-05 +4.60428e-05 +4.46243e-05 +3.9502e-05 +3.13767e-05 +2.2414e-05 +1.51558e-05 +8.99938e-06 +1.59747e-05 +4.00836e-05 +3.68754e-05 +3.29631e-05 +2.91368e-05 +2.46219e-05 +2.03744e-05 +1.75337e-05 +1.60525e-05 +1.22764e-05 +1.62063e-05 +3.71691e-05 +3.22094e-05 +2.80829e-05 +2.53951e-05 +2.35569e-05 +2.29651e-05 +2.37218e-05 +2.39525e-05 +1.56771e-05 +1.63308e-05 +3.56931e-05 +3.3752e-05 +3.25922e-05 +3.24741e-05 +3.26572e-05 +3.28466e-05 +3.26352e-05 +2.73235e-05 +1.68265e-05 +1.86457e-05 +3.97737e-05 +4.37572e-05 +4.75445e-05 +5.11848e-05 +5.40794e-05 +5.61295e-05 +4.74417e-05 +2.97506e-05 +1.77855e-05 +1.62095e-05 +1.77045e-05 +1.88081e-05 +1.99724e-05 +2.10995e-05 +2.19329e-05 +2.19084e-05 +2.10578e-05 +1.99396e-05 +1.84885e-05 +) +; + +boundaryField +{ + movingWall + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + left + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + right + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + bottom + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p_rgh b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p_rgh new file mode 100644 index 000000000..f933eba9d --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/p_rgh @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type buoyantPressure; + rho rhok; + } + + left + { + type buoyantPressure; + rho rhok; + } + + right + { + type buoyantPressure; + rho rhok; + } + + bottom + { + type buoyantPressure; + rho rhok; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid deleted file mode 120000 index 6ad1c2bf5..000000000 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid +++ /dev/null @@ -1 +0,0 @@ -../../heatedBlock/0 \ No newline at end of file diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/0/T b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/T similarity index 92% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/0/T rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/T index 3863582fe..66723bf3a 100644 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/0/T +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/T @@ -27,10 +27,11 @@ boundaryField left { - type regionCoupling; - value uniform 373; - + type chtRcTemperature; + radiation off; + K k; remoteField T; + value uniform 373; } right diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/0/DT b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/k similarity index 88% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/0/DT rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/k index 291270150..9fc83c177 100644 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/0/DT +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/k @@ -10,11 +10,11 @@ FoamFile version 2.0; format ascii; class volScalarField; - object T; + object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -1 0 0 0 0]; +dimensions [1 1 -3 -1 0 0 0]; internalField uniform 1e-3; @@ -27,9 +27,9 @@ boundaryField left { - type regionCoupling; + type chtRcThermalDiffusivitySlave; + remoteField kappaEff; value uniform 1e-3; - remoteField DT; } right diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials new file mode 100644 index 000000000..979987e87 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/0/solid/materials @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object materials; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + topAndBottom + { + type zeroGradient; + } + left + { + type zeroGradient; + } + right + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allclean b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allclean index f748cbc7e..2ac2bcfca 100755 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allclean +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allclean @@ -4,9 +4,7 @@ . $WM_PROJECT_DIR/bin/tools/CleanFunctions cleanCase -rm -f constant/polyMesh/boundary - -cd ../heatedBlock -rm -f constant/polyMesh/boundary -cleanCase +rm constant/polyMesh/boundary +rm constant/solid/polyMesh/boundary +rm -r constant/solid/polyMesh/[c-z]* diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allrun b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allrun index 4a60921f7..0e2b95757 100755 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allrun +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/Allrun @@ -1,20 +1,22 @@ #!/bin/sh + # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -application="conjugateHeatFoam" +# Get application name +application=`getApplication` + +runApplication -l log.blockMesh.solid blockMesh -region solid +cp constant/solid/polyMesh/boundaryCoupled constant/solid/polyMesh/boundary +runApplication -l log.setSet.solid setSet -region solid -batch solid.setSet +runApplication -l log.setsToZones.solid setsToZones -region solid -noFlipMap runApplication blockMesh -cp boundary constant/polyMesh -runApplication setSet -batch setBatch +cp constant/polyMesh/boundaryCoupled constant/polyMesh/boundary +runApplication setSet -batch fluid.setSet runApplication setsToZones -noFlipMap -cd ../heatedBlock -runApplication blockMesh -cp boundary constant/polyMesh -runApplication setSet -batch setBatch -runApplication setsToZones -noFlipMap - -cd ../conjugateCavity runApplication $application +# ----------------------------------------------------------------- end-of-file + diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/boundary b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/boundary deleted file mode 100644 index 25e298c77..000000000 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/boundary +++ /dev/null @@ -1,61 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM Extend Project: Open source CFD | -| \\ / O peration | Version: 1.6-ext | -| \\ / A nd | Web: www.extend-project.de | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class polyBoundaryMesh; - location "constant/polyMesh"; - object boundary; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -5 -( - movingWall - { - type wall; - nFaces 15; - startFace 420; - } - left - { - type wall; - nFaces 15; - startFace 435; - } - right - { - type regionCouple; - nFaces 15; - startFace 450; - - zone rightZone; - shadowRegion solid; - shadowPatch left; - - master yes; - attached on; - isWall yes; - bridgeOverlap no; - } - bottom - { - type wall; - nFaces 15; - startFace 465; - } - frontAndBack - { - type empty; - nFaces 450; - startFace 480; - } -) - -// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/system/controlDict b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/RASProperties similarity index 69% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/system/controlDict rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/RASProperties index 379c7f29c..01ab55e4a 100644 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/system/controlDict +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/RASProperties @@ -10,36 +10,32 @@ FoamFile version 2.0; format ascii; class dictionary; - object controlDict; + object RASProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -startFrom latestTime; +RASModel kEpsilon; -startTime 0; +turbulence on; -stopAt endTime; +printCoeffs on; -endTime 3; +laminarCoeffs +{ +} -deltaT 0.005; +kEpsilonCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphaEps 0.76923; +} -writeControl runTime; - -writeInterval 0.5; - -purgeWrite 0; - -writeFormat ascii; - -writePrecision 6; - -writeCompression uncompressed; - -timeFormat general; - -timePrecision 6; - -runTimeModifiable yes; +wallFunctionCoeffs +{ + kappa 0.4187; + E 9; +} // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/g b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/g new file mode 100644 index 000000000..10e6e8198 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 -9.81 0); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/blockMeshDict b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/blockMeshDict index 2301db2e4..514a8ea28 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/blockMeshDict +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/blockMeshDict @@ -30,7 +30,7 @@ vertices blocks ( - hex (0 1 2 3 4 5 6 7) (15 15 1) simpleGrading (1 1 1) + hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1) ); edges diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/boundary b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/boundaryCoupled similarity index 77% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/boundary rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/boundaryCoupled index e47c97111..6cd82df77 100644 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/boundary +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/polyMesh/boundaryCoupled @@ -14,34 +14,41 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -4 +5 ( -topAndBottom +movingWall { - type patch; - nFaces 20; + type wall; + nFaces 10; startFace 180; } left { - type regionCouple; + type wall; nFaces 10; - startFace 200; - - zone leftZone; - shadowRegion region0; - shadowPatch right; - - master no; - attached on; - isWall yes; // Not relevant - bridgeOverlap no; + startFace 190; } right { - type patch; + type regionCouple; + nFaces 10; + startFace 200; + + shadowRegion solid; + shadowPatch left; + attached off; + isWall on; + + zone rightZone; + master on; + bridgeOverlap off; +} + +bottom +{ + type wall; nFaces 10; startFace 210; } diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/radiationProperties b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/radiationProperties new file mode 100644 index 000000000..17f9c2408 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/radiationProperties @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object environmentalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation on; + +radiationModel P1; + +noRadiation +{ +} + +P1Coeffs +{ +} + +absorptionEmissionModel constantAbsorptionEmission; + +constantAbsorptionEmissionCoeffs +{ + a a [ 0 -1 0 0 0 0 0] 0.0; + e e [ 0 -1 0 0 0 0 0] 0.0; + E E [ 1 -1 -3 0 0 0 0] 0.0; +} + +scatterModel constantScatter; + +constantScatterCoeffs +{ + sigma sigma [ 0 -1 0 0 0 0 0] 0.1; + C C [ 0 0 0 0 0 0 0] 0.0; +} + +solverFreq 1; + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid deleted file mode 120000 index b78a320fd..000000000 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid +++ /dev/null @@ -1 +0,0 @@ -../../heatedBlock/constant \ No newline at end of file diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/constant/polyMesh/blockMeshDict b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/polyMesh/blockMeshDict similarity index 100% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/constant/polyMesh/blockMeshDict rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/polyMesh/blockMeshDict diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled new file mode 100644 index 000000000..706e20bfd --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +4 +( + topAndBottom + { + type patch; + nFaces 20; + startFace 180; + } + left + { + type regionCouple; + nFaces 10; + startFace 200; + + shadowRegion region0; + shadowPatch right; + attached off; + isWall on; + + zone leftZone; + master off; + bridgeOverlap off; + } + right + { + type patch; + nFaces 10; + startFace 210; + } + frontAndBack + { + type empty; + nFaces 200; + startFace 220; + } +) + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/thermalProperties b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/thermalProperties new file mode 100644 index 000000000..2c1b59eb0 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/solid/thermalProperties @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermal +{ + type multiMaterialZones; + + laws + ( + material0 + { + type constant; + rho rho [1 -3 0 0 0] 10; + C C [0 2 -2 -1 0] 100; + k k [1 1 -3 -1 0] 10; + + zones ( solidBlock ); + } + ); + + gaps + ( + air // gap 0 + { + type constant; + beta beta [1 1 -3 -1 0] 1; + zones ( contactSurface ); + } + ); + + sources + ( + ); +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/transportProperties b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/transportProperties index 0db783388..19c1075f0 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/transportProperties +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/transportProperties @@ -14,8 +14,20 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -nu nu [0 2 -1 0 0 0 0] 0.01; +transportModel Newtonian; -DT DT [0 2 -1 0 0 0 0] 1e-03; +TRef TRef [0 0 0 1 0 0 0] 273.0; + +nu nu [0 2 -1 0 0 0 0] 1.78e-5; + +rho rho [1 -3 0 0 0 0 0] 1.2; + +Cp Cp [0 2 -2 -1 0 0 0] 1000; + +beta beta [0 0 0 -1 0 0 0] 1e-3; + +Prt Prt [0 0 0 0 0 0 0] 0.85; + +Pr Pr [0 0 0 0 0 0 0] 0.71; // nu/a = 1.78e-5/0.03*1000*1.2 // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/turbulenceProperties b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/turbulenceProperties new file mode 100644 index 000000000..0527e7f07 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/constant/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/fluid.setSet b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/fluid.setSet new file mode 100644 index 000000000..31a22d934 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/fluid.setSet @@ -0,0 +1,2 @@ +faceSet rightZone new patchToFace right; +quit; diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/setBatch b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/setBatch deleted file mode 100644 index add1b53fe..000000000 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/setBatch +++ /dev/null @@ -1,2 +0,0 @@ -faceSet rightZone new patchToFace right -quit diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/solid.setSet b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/solid.setSet new file mode 100644 index 000000000..981c7d22e --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/solid.setSet @@ -0,0 +1,4 @@ +cellSet solidBlock new boxToCell (0.1 0 0) (0.2 0.1 0.01); +faceSet contactSurface new boxToFace (0.1499 0 0) (0.1501 0.1 0.01); +faceSet leftZone new patchToFace left; +quit; diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/controlDict b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/controlDict index 31de2d59d..0113e15c8 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/controlDict +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/controlDict @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application icoFoam; +application conjugateHeatFoam; startFrom startTime; @@ -22,13 +22,13 @@ startTime 0; stopAt endTime; -endTime 2; +endTime 10; -deltaT 0.01; +deltaT 0.1; writeControl timeStep; -writeInterval 5; +writeInterval 1; purgeWrite 0; @@ -44,4 +44,32 @@ timePrecision 6; runTimeModifiable yes; +adjustTimeStep off; + +maxCo 0.5; + +functions +( + heatFlux + { + // Type of functionObject + type heatFlux; + outputControl timeStep; + outputInterval 1; + + K kappaEff; + } + + heatFlux + { + // Type of functionObject + type heatFlux; + outputControl timeStep; + outputInterval 1; + region solid; + + K k; + } +); + // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/decomposeParDict b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/decomposeParDict new file mode 100644 index 000000000..75e694458 --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/decomposeParDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method simple; + +globalFaceZones ( rightZone ); + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 1 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights 4{1}; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes index 393192573..2b12ff491 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSchemes @@ -16,36 +16,45 @@ FoamFile ddtSchemes { - default Euler; + default Euler; } gradSchemes { default Gauss linear; - grad(p) Gauss linear; + grad(p_rgh) Gauss linear; + grad(U) Gauss linear; } divSchemes { default none; - div(phi,U) Gauss linear; - + div(phi,U) Gauss upwind; div(phi,T) Gauss upwind; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + // div(phi,R) Gauss upwind; + // div(R) Gauss linear; + // div(phi,nuTilda) Gauss upwind; + div((nuEff*dev(grad(U).T()))) Gauss linear; } laplacianSchemes { default none; - laplacian(nu,U) Gauss linear corrected; - laplacian((1|A(U)),p) Gauss linear corrected; - - laplacian(DT,T) Gauss linear corrected; + laplacian((1|A(U)),p_rgh) Gauss linear uncorrected; + laplacian(kappaEff,T) Gauss linear uncorrected; + laplacian(gammaRad,G) Gauss linear uncorrected; + laplacian(DkEff,k) Gauss linear uncorrected; + laplacian(DepsilonEff,epsilon) Gauss linear uncorrected; + laplacian(nuEff,U) Gauss linear uncorrected; } interpolationSchemes { - default linear; - interpolate(HbyA) linear; + default linear; + + interpolate(kappaEff) linear; } snGradSchemes @@ -56,7 +65,7 @@ snGradSchemes fluxRequired { default no; - p; + p_rgh; } // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSolution b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSolution index 379da69cf..d2cdf20de 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSolution +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/fvSolution @@ -16,21 +16,38 @@ FoamFile solvers { - p + p_rgh { solver PCG; preconditioner DIC; - tolerance 1e-06; + + minIter 0; + maxIter 1000; + tolerance 1e-25; + relTol 0.01; + }; + + p_rghFinal + { + solver PCG; + preconditioner DIC; + + minIter 0; + maxIter 1000; + tolerance 1e-25; relTol 0; - } + }; U { solver PBiCG; preconditioner DILU; - tolerance 1e-05; - relTol 0; - } + + minIter 1; + maxIter 1000; + tolerance 1e-25; + relTol 0.01; + }; T+T { @@ -39,17 +56,54 @@ solvers minIter 0; maxIter 1000; - tolerance 1e-6; - relTol 0.0; - } + tolerance 1e-25; + relTol 0.1; + }; + + G + { + solver PCG; + preconditioner DIC; + + minIter 1; + maxIter 1000; + tolerance 1e-25; + relTol 0.1; + }; + + epsilon + { + solver PBiCG; + preconditioner DILU; + + minIter 1; + maxIter 100; + tolerance 1e-25; + relTol 0.01; + }; + + k + { + solver PBiCG; + preconditioner DILU; + + minIter 1; + maxIter 100; + tolerance 1e-25; + relTol 0.01; + }; } PISO { - nCorrectors 2; + nCorrectors 2; nNonOrthogonalCorrectors 0; - pRefCell 0; - pRefValue 0; + p_rghRefCell 0; + p_rghRefValue 0; +} + +relaxationFactors +{ } // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid deleted file mode 120000 index 7ff4985ee..000000000 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid +++ /dev/null @@ -1 +0,0 @@ -../../heatedBlock/system \ No newline at end of file diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/decomposeParDict b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/decomposeParDict new file mode 100644 index 000000000..736e366bd --- /dev/null +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/decomposeParDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method simple; + +globalFaceZones ( leftZone ); + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 1 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights 4{1}; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/system/fvSchemes b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes similarity index 89% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/system/fvSchemes rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes index 22d4727f9..0d76e5530 100644 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/system/fvSchemes +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSchemes @@ -16,13 +16,12 @@ FoamFile ddtSchemes { - default Euler; + default steadyState; } gradSchemes { default Gauss linear; - grad(T) Gauss linear; } divSchemes @@ -33,23 +32,23 @@ divSchemes laplacianSchemes { default none; - laplacian(DT,T) Gauss linear corrected; + laplacian(k,T) Gauss harmonic uncorrected; } interpolationSchemes { default linear; + interpolate(k) harmonic; } snGradSchemes { - default corrected; + default uncorrected; } fluxRequired { default no; - T; } // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/system/fvSolution b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSolution similarity index 94% rename from tutorials/coupled/conjugateHeatFoam/heatedBlock/system/fvSolution rename to tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSolution index 204128d05..0b398fe46 100644 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/system/fvSolution +++ b/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/solid/fvSolution @@ -15,11 +15,16 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers -{} +{ +} SIMPLE { - nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + T 0.99; } // ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/Allrun b/tutorials/coupled/conjugateHeatFoam/heatedBlock/Allrun deleted file mode 100755 index 9cc10ba44..000000000 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/Allrun +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Source tutorial run functions -. $WM_PROJECT_DIR/bin/tools/RunFunctions - -# Disabling the tutorial. -# Using an exit code != 0 will still flag the tutorial as failed -echo "Warning: This tutorial is disabled, as it is a part of another tutorial." -exit 0 diff --git a/tutorials/coupled/conjugateHeatFoam/heatedBlock/setBatch b/tutorials/coupled/conjugateHeatFoam/heatedBlock/setBatch deleted file mode 100644 index c9911f12e..000000000 --- a/tutorials/coupled/conjugateHeatFoam/heatedBlock/setBatch +++ /dev/null @@ -1,2 +0,0 @@ -faceSet leftZone new patchToFace left -quit diff --git a/tutorials/coupled/conjugateHeatFoam/makeLinks b/tutorials/coupled/conjugateHeatFoam/makeLinks deleted file mode 100644 index f2557bab5..000000000 --- a/tutorials/coupled/conjugateHeatFoam/makeLinks +++ /dev/null @@ -1,42 +0,0 @@ -ln -s ../conjugateCavity/0.1/solid/ 0.1 -ln -s ../conjugateCavity/0.2/solid/ 0.2 -ln -s ../conjugateCavity/0.3/solid/ 0.3 -ln -s ../conjugateCavity/0.4/solid/ 0.4 -ln -s ../conjugateCavity/0.5/solid/ 0.5 -ln -s ../conjugateCavity/0.6/solid/ 0.6 -ln -s ../conjugateCavity/0.7/solid/ 0.7 -ln -s ../conjugateCavity/0.8/solid/ 0.8 -ln -s ../conjugateCavity/0.9/solid/ 0.9 - - -ln -s ../conjugateCavity/0.15/solid/ 0.15 -ln -s ../conjugateCavity/0.25/solid/ 0.25 -ln -s ../conjugateCavity/0.35/solid/ 0.35 -ln -s ../conjugateCavity/0.45/solid/ 0.45 -ln -s ../conjugateCavity/0.55/solid/ 0.55 -ln -s ../conjugateCavity/0.65/solid/ 0.65 -ln -s ../conjugateCavity/0.75/solid/ 0.75 -ln -s ../conjugateCavity/0.85/solid/ 0.85 -ln -s ../conjugateCavity/0.95/solid/ 0.95 - - -ln -s ../conjugateCavity/1.1/solid/ 1.1 -ln -s ../conjugateCavity/1.2/solid/ 1.2 -ln -s ../conjugateCavity/1.3/solid/ 1.3 -ln -s ../conjugateCavity/1.4/solid/ 1.4 -ln -s ../conjugateCavity/1.5/solid/ 1.5 -ln -s ../conjugateCavity/1.6/solid/ 1.6 -ln -s ../conjugateCavity/1.7/solid/ 1.7 -ln -s ../conjugateCavity/1.8/solid/ 1.8 -ln -s ../conjugateCavity/1.9/solid/ 1.9 - - -ln -s ../conjugateCavity/1.15/solid/ 1.15 -ln -s ../conjugateCavity/1.25/solid/ 1.25 -ln -s ../conjugateCavity/1.35/solid/ 1.35 -ln -s ../conjugateCavity/1.45/solid/ 1.45 -ln -s ../conjugateCavity/1.55/solid/ 1.55 -ln -s ../conjugateCavity/1.65/solid/ 1.65 -ln -s ../conjugateCavity/1.75/solid/ 1.75 -ln -s ../conjugateCavity/1.85/solid/ 1.85 -ln -s ../conjugateCavity/1.95/solid/ 1.95 diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/.gitignore b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/.gitignore new file mode 100644 index 000000000..44fa1a7e0 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/.gitignore @@ -0,0 +1,52 @@ +# git-ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. + +# editor and misc backup files - anywhere +*~ +.*~ +*.bak +*.bak[0-9][0-9] +*.orig +*.orig[0-9][0-9] +\#*\# + +# file-browser settings - anywhere +.directory + +# CVS recovered versions - anywhere +.#* + +# SVN directories - anywhere + +.svn/ + +# OpenFOAM results + +[0-9]*/ +!/0/ +processor* +*/polyMesh/* +!*/polyMesh/blockMeshDict +cellToRegion* +log* + +# packages - anywhere + +*.tar.bz2 +*.tar.gz +*.tar +*.tgz +*.gtgz + +# Pictures and movies + +*.png +*.jpg +*.jpeg +*.bmp +*.png +*.avi +*.mp4 +*.mpg + +#end-of-file diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/G b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/G new file mode 100644 index 000000000..9a8e160df --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/G @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object G; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 0 -3 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + left + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + right + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + bottom + { + type MarshakRadiation; + T T; + emissivity 1; + value uniform 0; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/T b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/T new file mode 100644 index 000000000..080a46186 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/T @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 273; + +boundaryField +{ + movingWall + { + type adiabatic; + K kappaEff; + value uniform 273; + } + + left + { + type fixedValue; + value uniform 273; + } + + right + { + type chtRcTemperature; + radiation on; + K kappaEff; + remoteField T; + value uniform 273; + } + + bottom + { + type adiabatic; + K kappaEff; + value uniform 273; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/U b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/U new file mode 100644 index 000000000..bf4f5f49a --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/U @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + movingWall + { + type fixedValue; + value uniform (1 0 0); + } + + left + { + type fixedValue; + value uniform (0 0 0); + } + + right + { + type fixedValue; + value uniform (0 0 0); + } + + bottom + { + type fixedValue; + value uniform (0 0 0); + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/epsilon b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/epsilon new file mode 100644 index 000000000..f013b5d09 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/epsilon @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 0.000765; + +boundaryField +{ + movingWall + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + left + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + right + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + bottom + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0.000765; + } + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/k b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/k new file mode 100644 index 000000000..575abf3e8 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/k @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.00325; + +boundaryField +{ + movingWall + { + type kqRWallFunction; + value uniform 0.00325; + } + left + { + type kqRWallFunction; + value uniform 0.00325; + } + right + { + type kqRWallFunction; + value uniform 0.00325; + } + bottom + { + type kqRWallFunction; + value uniform 0.00325; + } + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/kappaEff b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/kappaEff new file mode 100644 index 000000000..a4323e0c7 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/kappaEff @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object kappaEff; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 1 -3 -1 0 0 0]; + +internalField uniform 1e-3; + +boundaryField +{ + movingWall + { + type zeroGradient; + } + + left + { + type zeroGradient; + } + + right + { + type chtRcThermalDiffusivity; + remoteField k; + value uniform 1e-3; + } + + bottom + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/materials b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/materials new file mode 100644 index 000000000..8f95d5517 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/materials @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object materials; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type zeroGradient; + } + left + { + type zeroGradient; + } + right + { + type zeroGradient; + } + bottom + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/nut b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/nut new file mode 100644 index 000000000..98a8b2139 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/nut @@ -0,0 +1,167 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "1000"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField nonuniform List +100 +( +1.21785e-05 +1.22034e-05 +1.18131e-05 +1.13441e-05 +1.09569e-05 +1.06084e-05 +1.02572e-05 +9.85849e-06 +9.36793e-06 +8.69525e-06 +1.32378e-05 +2.22807e-05 +2.46882e-05 +2.67024e-05 +2.79187e-05 +2.8085e-05 +2.69455e-05 +2.42296e-05 +1.96054e-05 +9.54756e-06 +1.40374e-05 +3.15682e-05 +3.54686e-05 +4.04963e-05 +4.26252e-05 +4.22113e-05 +3.89888e-05 +3.24706e-05 +2.33811e-05 +9.57482e-06 +1.4776e-05 +3.97026e-05 +4.35993e-05 +4.90069e-05 +5.08533e-05 +4.88669e-05 +4.25389e-05 +3.19679e-05 +2.00092e-05 +9.21191e-06 +1.54597e-05 +4.10906e-05 +4.41726e-05 +4.60428e-05 +4.46243e-05 +3.9502e-05 +3.13767e-05 +2.2414e-05 +1.51558e-05 +8.99938e-06 +1.59747e-05 +4.00836e-05 +3.68754e-05 +3.29631e-05 +2.91368e-05 +2.46219e-05 +2.03744e-05 +1.75337e-05 +1.60525e-05 +1.22764e-05 +1.62063e-05 +3.71691e-05 +3.22094e-05 +2.80829e-05 +2.53951e-05 +2.35569e-05 +2.29651e-05 +2.37218e-05 +2.39525e-05 +1.56771e-05 +1.63308e-05 +3.56931e-05 +3.3752e-05 +3.25922e-05 +3.24741e-05 +3.26572e-05 +3.28466e-05 +3.26352e-05 +2.73235e-05 +1.68265e-05 +1.86457e-05 +3.97737e-05 +4.37572e-05 +4.75445e-05 +5.11848e-05 +5.40794e-05 +5.61295e-05 +4.74417e-05 +2.97506e-05 +1.77855e-05 +1.62095e-05 +1.77045e-05 +1.88081e-05 +1.99724e-05 +2.10995e-05 +2.19329e-05 +2.19084e-05 +2.10578e-05 +1.99396e-05 +1.84885e-05 +) +; + +boundaryField +{ + movingWall + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + left + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + right + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + bottom + { + type nutWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/p_rgh b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/p_rgh new file mode 100644 index 000000000..f933eba9d --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/p_rgh @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + movingWall + { + type buoyantPressure; + rho rhok; + } + + left + { + type buoyantPressure; + rho rhok; + } + + right + { + type buoyantPressure; + rho rhok; + } + + bottom + { + type buoyantPressure; + rho rhok; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/T b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/T new file mode 100644 index 000000000..66723bf3a --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/T @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 373; + +boundaryField +{ + topAndBottom + { + type zeroGradient; + } + + left + { + type chtRcTemperature; + radiation off; + K k; + remoteField T; + value uniform 373; + } + + right + { + type fixedValue; + value uniform 473; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/k b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/k new file mode 100644 index 000000000..9fc83c177 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/k @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 1 -3 -1 0 0 0]; + +internalField uniform 1e-3; + +boundaryField +{ + topAndBottom + { + type zeroGradient; + } + + left + { + type chtRcThermalDiffusivitySlave; + remoteField kappaEff; + value uniform 1e-3; + } + + right + { + type zeroGradient; + } + + frontAndBack + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials new file mode 100644 index 000000000..979987e87 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/0/solid/materials @@ -0,0 +1,43 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object materials; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + topAndBottom + { + type zeroGradient; + } + left + { + type zeroGradient; + } + right + { + type zeroGradient; + } + frontAndBack + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allclean b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allclean new file mode 100755 index 000000000..2ac2bcfca --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase +rm constant/polyMesh/boundary + +rm constant/solid/polyMesh/boundary +rm -r constant/solid/polyMesh/[c-z]* diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allrun b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allrun new file mode 100755 index 000000000..0e2b95757 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/Allrun @@ -0,0 +1,22 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Get application name +application=`getApplication` + +runApplication -l log.blockMesh.solid blockMesh -region solid +cp constant/solid/polyMesh/boundaryCoupled constant/solid/polyMesh/boundary +runApplication -l log.setSet.solid setSet -region solid -batch solid.setSet +runApplication -l log.setsToZones.solid setsToZones -region solid -noFlipMap + +runApplication blockMesh +cp constant/polyMesh/boundaryCoupled constant/polyMesh/boundary +runApplication setSet -batch fluid.setSet +runApplication setsToZones -noFlipMap + +runApplication $application + +# ----------------------------------------------------------------- end-of-file + diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/RASProperties b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/RASProperties new file mode 100644 index 000000000..01ab55e4a --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/RASProperties @@ -0,0 +1,41 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kEpsilon; + +turbulence on; + +printCoeffs on; + +laminarCoeffs +{ +} + +kEpsilonCoeffs +{ + Cmu 0.09; + C1 1.44; + C2 1.92; + alphaEps 0.76923; +} + +wallFunctionCoeffs +{ + kappa 0.4187; + E 9; +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/g b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/g new file mode 100644 index 000000000..10e6e8198 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/g @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 -9.81 0); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/polyMesh/blockMeshDict b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/polyMesh/blockMeshDict new file mode 100644 index 000000000..514a8ea28 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/polyMesh/blockMeshDict @@ -0,0 +1,69 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 0.1) + (1 0 0.1) + (1 1 0.1) + (0 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + wall movingWall + ( + (3 7 6 2) + ) + wall left + ( + (0 4 7 3) + ) + wall right + ( + (2 6 5 1) + ) + wall bottom + ( + (1 5 4 0) + ) + empty frontAndBack + ( + (0 3 2 1) + (4 5 6 7) + ) +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/radiationProperties b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/radiationProperties new file mode 100644 index 000000000..17f9c2408 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/radiationProperties @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object environmentalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation on; + +radiationModel P1; + +noRadiation +{ +} + +P1Coeffs +{ +} + +absorptionEmissionModel constantAbsorptionEmission; + +constantAbsorptionEmissionCoeffs +{ + a a [ 0 -1 0 0 0 0 0] 0.0; + e e [ 0 -1 0 0 0 0 0] 0.0; + E E [ 1 -1 -3 0 0 0 0] 0.0; +} + +scatterModel constantScatter; + +constantScatterCoeffs +{ + sigma sigma [ 0 -1 0 0 0 0 0] 0.1; + C C [ 0 0 0 0 0 0 0] 0.0; +} + +solverFreq 1; + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/blockMeshDict b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/blockMeshDict new file mode 100644 index 000000000..355287c9d --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/blockMeshDict @@ -0,0 +1,66 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.1; + +vertices +( + (1 0 0) + (2 0 0) + (2 1 0) + (1 1 0) + (1 0 0.1) + (2 0 0.1) + (2 1 0.1) + (1 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (10 10 1) simpleGrading (1 1 1) +); + +edges +( +); + +patches +( + patch topAndBottom + ( + (3 7 6 2) + (1 5 4 0) + ) + patch left + ( + (0 4 7 3) + ) + patch right + ( + (2 6 5 1) + ) + empty frontAndBack + ( + (0 3 2 1) + (4 5 6 7) + ) +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled new file mode 100644 index 000000000..706e20bfd --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/polyMesh/boundaryCoupled @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +4 +( + topAndBottom + { + type patch; + nFaces 20; + startFace 180; + } + left + { + type regionCouple; + nFaces 10; + startFace 200; + + shadowRegion region0; + shadowPatch right; + attached off; + isWall on; + + zone leftZone; + master off; + bridgeOverlap off; + } + right + { + type patch; + nFaces 10; + startFace 210; + } + frontAndBack + { + type empty; + nFaces 200; + startFace 220; + } +) + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/thermalProperties b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/thermalProperties new file mode 100644 index 000000000..2c1b59eb0 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/solid/thermalProperties @@ -0,0 +1,49 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermal +{ + type multiMaterialZones; + + laws + ( + material0 + { + type constant; + rho rho [1 -3 0 0 0] 10; + C C [0 2 -2 -1 0] 100; + k k [1 1 -3 -1 0] 10; + + zones ( solidBlock ); + } + ); + + gaps + ( + air // gap 0 + { + type constant; + beta beta [1 1 -3 -1 0] 1; + zones ( contactSurface ); + } + ); + + sources + ( + ); +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/transportProperties b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/transportProperties new file mode 100644 index 000000000..19c1075f0 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/transportProperties @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +TRef TRef [0 0 0 1 0 0 0] 273.0; + +nu nu [0 2 -1 0 0 0 0] 1.78e-5; + +rho rho [1 -3 0 0 0 0 0] 1.2; + +Cp Cp [0 2 -2 -1 0 0 0] 1000; + +beta beta [0 0 0 -1 0 0 0] 1e-3; + +Prt Prt [0 0 0 0 0 0 0] 0.85; + +Pr Pr [0 0 0 0 0 0 0] 0.71; // nu/a = 1.78e-5/0.03*1000*1.2 + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/turbulenceProperties b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/turbulenceProperties new file mode 100644 index 000000000..0527e7f07 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/constant/turbulenceProperties @@ -0,0 +1,19 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/fluid.setSet b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/fluid.setSet new file mode 100644 index 000000000..31a22d934 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/fluid.setSet @@ -0,0 +1,2 @@ +faceSet rightZone new patchToFace right; +quit; diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/solid.setSet b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/solid.setSet new file mode 100644 index 000000000..981c7d22e --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/solid.setSet @@ -0,0 +1,4 @@ +cellSet solidBlock new boxToCell (0.1 0 0) (0.2 0.1 0.01); +faceSet contactSurface new boxToFace (0.1499 0 0) (0.1501 0.1 0.01); +faceSet leftZone new patchToFace left; +quit; diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/controlDict b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/controlDict new file mode 100644 index 000000000..00735a1e5 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/controlDict @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application conjugateHeatSimpleFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 1000; + +deltaT 1; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +functions +( + heatFlux + { + // Type of functionObject + type heatFlux; + outputControl timeStep; + outputInterval 1; + + K kappaEff; + } + + heatFlux + { + // Type of functionObject + type heatFlux; + outputControl timeStep; + outputInterval 1; + region solid; + + K k; + } +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/decomposeParDict b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/decomposeParDict new file mode 100644 index 000000000..75e694458 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/decomposeParDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method simple; + +globalFaceZones ( rightZone ); + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 1 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights 4{1}; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes new file mode 100644 index 000000000..1c652d98d --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSchemes @@ -0,0 +1,71 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; + grad(p_rgh) Gauss linear; + grad(U) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss upwind; + div(phi,T) Gauss upwind; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + // div(phi,R) Gauss upwind; + // div(R) Gauss linear; + // div(phi,nuTilda) Gauss upwind; + div((nuEff*dev(grad(U).T()))) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian((1|A(U)),p_rgh) Gauss linear uncorrected; + laplacian(kappaEff,T) Gauss linear uncorrected; + laplacian(gammaRad,G) Gauss linear uncorrected; + laplacian(DkEff,k) Gauss linear uncorrected; + laplacian(DepsilonEff,epsilon) Gauss linear uncorrected; + laplacian(nuEff,U) Gauss linear uncorrected; +} + +interpolationSchemes +{ + default linear; + + interpolate(kappaEff) linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_rgh; +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSolution b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSolution new file mode 100644 index 000000000..34294f9f4 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/fvSolution @@ -0,0 +1,102 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p_rgh + { + solver PCG; + preconditioner DIC; + + minIter 0; + maxIter 1000; + tolerance 1e-25; + relTol 0.01; + }; + + U + { + solver PBiCG; + preconditioner DILU; + + minIter 1; + maxIter 1000; + tolerance 1e-25; + relTol 0.01; + }; + + T+T + { + solver BiCG; + preconditioner Cholesky; + + minIter 0; + maxIter 1000; + tolerance 1e-25; + relTol 0.1; + }; + + G + { + solver PCG; + preconditioner DIC; + + minIter 1; + maxIter 1000; + tolerance 1e-25; + relTol 0.1; + }; + + epsilon + { + solver PBiCG; + preconditioner DILU; + + minIter 1; + maxIter 100; + tolerance 1e-25; + relTol 0.01; + }; + + k + { + solver PBiCG; + preconditioner DILU; + + minIter 1; + maxIter 100; + tolerance 1e-25; + relTol 0.01; + }; +} + +SIMPLE +{ + nNonOrthogonalCorrectors 0; + p_rghRefCell 0; + p_rghRefValue 0; +} + +relaxationFactors +{ + p_rgh 0.7; + U 0.3; + T 0.5; + k 0.6; + epsilon 0.6; +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/decomposeParDict b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/decomposeParDict new file mode 100644 index 000000000..736e366bd --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/decomposeParDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method simple; + +globalFaceZones ( leftZone ); + +simpleCoeffs +{ + n (1 4 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 1 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + processorWeights 4{1}; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots +( +); + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes new file mode 100644 index 000000000..0d76e5530 --- /dev/null +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSchemes @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM Extend Project: Open Source CFD | +| \\ / O peration | Version: 1.6-ext | +| \\ / A nd | Web: www.extend-project.de | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default steadyState; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(k,T) Gauss harmonic uncorrected; +} + +interpolationSchemes +{ + default linear; + interpolate(k) harmonic; +} + +snGradSchemes +{ + default uncorrected; +} + +fluxRequired +{ + default no; +} + +// ************************************************************************* // diff --git a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/sampleDict b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSolution similarity index 71% rename from tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/sampleDict rename to tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSolution index 23aada53d..0b398fe46 100644 --- a/tutorials/coupled/conjugateHeatFoam/conjugateCavity/system/sampleDict +++ b/tutorials/coupled/conjugateHeatSimpleFoam/conjugateCavity/system/solid/fvSolution @@ -10,33 +10,21 @@ FoamFile version 2.0; format ascii; class dictionary; - object sampleDict; + object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -interpolationScheme cellPoint; +solvers +{ +} -setFormat raw; +SIMPLE +{ +} -sets -( - line - { - type uniform; - axis distance; - start (0.0 0.0 0.005); - end (0.05 0.05 0.005); - nPoints 100; - } -); - -fields -( - p -); - -surfaces -( -); +relaxationFactors +{ + T 0.99; +} // ************************************************************************* // From 2c626263100bf2d87826eb4f94a1425011023120 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Thu, 17 Jan 2013 14:01:39 +0100 Subject: [PATCH 05/14] R/W access to matrixUpdateBuffer & remoteFieldName --- .../regionCouplingFvPatchField.H | 28 ++++++++--- .../regionCouplingFvsPatchField.C | 48 +++++++++++++++--- .../regionCouplingFvsPatchField.H | 49 +++++++++++++++++-- 3 files changed, 106 insertions(+), 19 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.H index fb129265e..00bfd538d 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.H @@ -79,15 +79,21 @@ class regionCouplingFvPatchField protected: + //- Set remote field name + void setRemoteFieldName(const word& name) + { + remoteFieldName_ = name; + } + + //- Return non-const access to matrixUpdateBuffer + void setMatrixUpdateBuffer(const scalarField& field) const + { + matrixUpdateBuffer_ = field; + } + //- Return original patch field const Field& originalPatchField() const; - //- Return contents of a matrix update buffer - const scalarField& matrixUpdateBuffer() const - { - return matrixUpdateBuffer_; - } - public: @@ -161,6 +167,12 @@ public: return remoteFieldName_; } + //- Return contents of a matrix update buffer + const scalarField& matrixUpdateBuffer() const + { + return matrixUpdateBuffer_; + } + //- Return a named shadow patch field template const typename LookupField::PatchFieldType& @@ -171,7 +183,7 @@ public: const LookupType* = NULL ) const; - + //- Return a shadow patch const regionCoupleFvPatch& regionCouplePatch() const { return regionCouplePatch_; @@ -186,7 +198,7 @@ public: //- Return neighbour field given internal cell data virtual tmp > patchNeighbourField() const; - //- Return neighbour field given internal cell data + //- Return named neighbour field given internal cell data virtual tmp > patchNeighbourField ( const word& name diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.C index ebb73d11b..7ca345904 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.C @@ -34,6 +34,24 @@ Author namespace Foam { +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +const Foam::Field& regionCouplingFvsPatchField::originalPatchField() const +{ + if (curTimeIndex_ != this->db().time().timeIndex()) + { + // Store original field for symmetric evaluation + // Henrik Rusche, Aug/2011 + + originalPatchField_ = *this; + curTimeIndex_ = this->db().time().timeIndex(); + } + + return originalPatchField_; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -131,21 +149,37 @@ regionCouplingFvsPatchField::regionCouplingFvsPatchField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// Return neighbour field +// Return a named shadow patch field +template +template +const typename LookupField::PatchFieldType& +regionCouplingFvsPatchField::lookupShadowPatchField +( + const word& name, + const LookupField*, + const LookupType* +) const +{ + // Lookup neighbour field + const LookupField& shadowField = + regionCouplePatch_.shadowRegion(). + objectRegistry::lookupObject(name); + + return shadowField.boundaryField()[regionCouplePatch_.shadowIndex()]; +} + + +// Return shadow patch field template const regionCouplingFvsPatchField& regionCouplingFvsPatchField::shadowPatchField() const { // Lookup neighbour field - typedef GeometricField GeoField; - - const GeoField& coupleField = - regionCouplePatch_.shadowRegion(). - objectRegistry::lookupObject(remoteFieldName_); + typedef GeometricField GeoField; return refCast > ( - coupleField.boundaryField()[regionCouplePatch_.shadowIndex()] + lookupShadowPatchField(remoteFieldName_) ); } diff --git a/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.H index ea329ae72..9c211d2cb 100644 --- a/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/constraint/regionCoupling/regionCouplingFvsPatchField.H @@ -72,15 +72,31 @@ class regionCouplingFvsPatchField //- Matrix update buffer mutable scalarField matrixUpdateBuffer_; + //- Original patch field. Required for correct evaluation + // in harmonic averaging + mutable Field originalPatchField_; + + //- Current time index used to store originalPatchField_ + mutable label curTimeIndex_; + protected: - //- Return contents of a matrix update buffer - const scalarField& matrixUpdateBuffer() const + //- Set remote field name + void setRemoteFieldName(const word& name) { - return matrixUpdateBuffer_; + remoteFieldName_ = name; } + //- Return non-const access to matrixUpdateBuffer + void setMatrixUpdateBuffer(const scalarField& field) const + { + matrixUpdateBuffer_ = field; + } + + //- Return original patch field + const Field& originalPatchField() const; + public: @@ -146,7 +162,7 @@ public: // Member functions - // Evaluation functions + // Access functions //- Return remote field name const word& remoteFieldName() const @@ -154,10 +170,35 @@ public: return remoteFieldName_; } + //- Return contents of a matrix update buffer + const scalarField& matrixUpdateBuffer() const + { + return matrixUpdateBuffer_; + } + + //- Return a named shadow patch field + template + const typename LookupField::PatchFieldType& + lookupShadowPatchField + ( + const word& name, + const LookupField* = NULL, + const LookupType* = NULL + ) const; + + //- Return a shadow patch + const regionCoupleFvPatch& regionCouplePatch() const + { + return regionCouplePatch_; + } + //- Return shadow patch field const regionCouplingFvsPatchField& shadowPatchField() const; + // Evaluation functions + + //- Write virtual void write(Ostream&) const; From 43b9f45f20cc3e4079db52aef15ae49fb2d0c1b9 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Tue, 19 Feb 2013 23:24:54 +0100 Subject: [PATCH 06/14] Enable access to cell-based Cp from basicThermo --- .../basic/basicThermo/basicThermo.C | 15 ++++++++++++++ .../basic/basicThermo/basicThermo.H | 7 +++++++ .../basic/psiThermo/ePsiThermo/ePsiThermo.C | 19 ++++++++++++++++++ .../basic/psiThermo/ePsiThermo/ePsiThermo.H | 7 +++++++ .../basic/psiThermo/hPsiThermo/hPsiThermo.C | 19 ++++++++++++++++++ .../basic/psiThermo/hPsiThermo/hPsiThermo.H | 7 +++++++ .../basic/psiThermo/hsPsiThermo/hsPsiThermo.C | 19 ++++++++++++++++++ .../basic/psiThermo/hsPsiThermo/hsPsiThermo.H | 7 +++++++ .../basic/rhoThermo/hRhoThermo/hRhoThermo.C | 19 ++++++++++++++++++ .../basic/rhoThermo/hRhoThermo/hRhoThermo.H | 7 +++++++ .../basic/rhoThermo/hsRhoThermo/hsRhoThermo.C | 19 ++++++++++++++++++ .../basic/rhoThermo/hsRhoThermo/hsRhoThermo.H | 7 +++++++ .../hPsiMixtureThermo/hPsiMixtureThermo.C | 20 +++++++++++++++++++ .../hPsiMixtureThermo/hPsiMixtureThermo.H | 7 +++++++ .../hhuMixtureThermo/hhuMixtureThermo.C | 20 +++++++++++++++++++ .../hhuMixtureThermo/hhuMixtureThermo.H | 7 +++++++ .../hsPsiMixtureThermo/hsPsiMixtureThermo.C | 20 +++++++++++++++++++ .../hsPsiMixtureThermo/hsPsiMixtureThermo.H | 7 +++++++ .../hRhoMixtureThermo/hRhoMixtureThermo.C | 20 +++++++++++++++++++ .../hRhoMixtureThermo/hRhoMixtureThermo.H | 7 +++++++ .../hsRhoMixtureThermo/hsRhoMixtureThermo.C | 20 +++++++++++++++++++ .../hsRhoMixtureThermo/hsRhoMixtureThermo.H | 7 +++++++ 22 files changed, 287 insertions(+) diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index 571e1a5f6..8ef6b4711 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -415,6 +415,21 @@ Foam::tmp Foam::basicThermo::Cp } +Foam::tmp Foam::basicThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + notImplemented + ( + "basicThermo::Cp" + "(const scalarField& T, const labelList& cells) const" + ); + return tmp(NULL); +} + + Foam::tmp Foam::basicThermo::Cp() const { notImplemented("basicThermo::Cp() const"); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index ccb42d1d8..e01553b19 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -220,6 +220,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C b/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C index 6a6e45577..2a7f096ff 100644 --- a/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.C @@ -228,6 +228,25 @@ Foam::tmp Foam::ePsiThermo::Cp } +template +Foam::tmp Foam::ePsiThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::ePsiThermo::Cp() const { diff --git a/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.H b/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.H index 327aecf6d..bfd91630d 100644 --- a/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/ePsiThermo/ePsiThermo.H @@ -142,6 +142,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C index db2cbad7c..a76dc32a5 100644 --- a/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.C @@ -226,6 +226,25 @@ Foam::tmp Foam::hPsiThermo::Cp } +template +Foam::tmp Foam::hPsiThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hPsiThermo::Cp() const { diff --git a/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.H b/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.H index 0d9ec3a34..11936dbfb 100644 --- a/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/hPsiThermo/hPsiThermo.H @@ -142,6 +142,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C index 8095f07bc..f19986b1d 100644 --- a/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.C @@ -230,6 +230,25 @@ Foam::tmp Foam::hsPsiThermo::Cp } +template +Foam::tmp Foam::hsPsiThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hsPsiThermo::Cp() const { diff --git a/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H index 56c3d4f0b..b7005f003 100644 --- a/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/hsPsiThermo/hsPsiThermo.H @@ -142,6 +142,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C index 8979ea50f..cb6cf78e3 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.C @@ -229,6 +229,25 @@ Foam::tmp Foam::hRhoThermo::Cp } +template +Foam::tmp Foam::hRhoThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hRhoThermo::Cp() const { diff --git a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H index e40a32ef2..b5e850d30 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/hRhoThermo/hRhoThermo.H @@ -142,6 +142,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C index a3b33a9e5..b5c86bdec 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.C @@ -225,6 +225,25 @@ Foam::tmp Foam::hsRhoThermo::Cp } +template +Foam::tmp Foam::hsRhoThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hsRhoThermo::Cp() const { diff --git a/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H index cb3c141ec..a45c43ee0 100644 --- a/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/hsRhoThermo/hsRhoThermo.H @@ -142,6 +142,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C index f36ca9d9a..012ce01ad 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.C @@ -265,6 +265,26 @@ Foam::hPsiMixtureThermo::Cp } +template +Foam::tmp +Foam::hPsiMixtureThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hPsiMixtureThermo::Cp() const diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H index 606303aaf..2ba88d14a 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hPsiMixtureThermo/hPsiMixtureThermo.H @@ -121,6 +121,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C index f46e3908a..156bbdac1 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.C @@ -281,6 +281,26 @@ Foam::tmp Foam::hhuMixtureThermo::Cp } +template +Foam::tmp +Foam::hhuMixtureThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hhuMixtureThermo::Cp() const diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H index 23b27bb1f..ac586e26f 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hhuMixtureThermo/hhuMixtureThermo.H @@ -119,6 +119,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C index 7be68783e..8e0777cc7 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.C @@ -262,6 +262,26 @@ Foam::hsPsiMixtureThermo::Cp } +template +Foam::tmp +Foam::hsPsiMixtureThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hsPsiMixtureThermo::Cp() const diff --git a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H index 28281a0b7..2afb5fb3a 100644 --- a/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/combustionThermo/mixtureThermos/hsPsiMixtureThermo/hsPsiMixtureThermo.H @@ -121,6 +121,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C index caf8da5b2..01e974eba 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.C @@ -264,6 +264,26 @@ Foam::hRhoMixtureThermo::Cp } +template +Foam::tmp +Foam::hRhoMixtureThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hRhoMixtureThermo::Cp() const diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H index 400e468ac..5b215a309 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hRhoMixtureThermo/hRhoMixtureThermo.H @@ -121,6 +121,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C index 573e2dd8b..cd98230a6 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.C @@ -264,6 +264,26 @@ Foam::hsRhoMixtureThermo::Cp } +template +Foam::tmp +Foam::hsRhoMixtureThermo::Cp +( + const scalarField& T, + const labelList& cells +) const +{ + tmp tCp(new scalarField(T.size())); + scalarField& cp = tCp(); + + forAll(T, celli) + { + cp[celli] = this->cellMixture(cells[celli]).Cp(T[celli]); + } + + return tCp; +} + + template Foam::tmp Foam::hsRhoMixtureThermo::Cp() const diff --git a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H index a1e7e5de4..a483857fb 100644 --- a/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H +++ b/src/thermophysicalModels/reactionThermo/reactionThermo/mixtureThermos/hsRhoMixtureThermo/hsRhoMixtureThermo.H @@ -122,6 +122,13 @@ public: const label patchi ) const; + //- Heat capacity at constant pressure for cell-set [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const labelList& cells + ) const; + //- Heat capacity at constant pressure [J/kg/K] virtual tmp Cp() const; From debfe4a1a251f661f634979fe75570d4366c5aee Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Tue, 19 Feb 2013 23:26:14 +0100 Subject: [PATCH 07/14] BUGFIX: Enable reference/delta detection in initInterfaceMatrixUpdate/updateInterfaceMatrix --- .../coupledFvMatrix/coupledFvMatrix.C | 2 +- .../coupledFvScalarMatrix.C | 29 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/coupledMatrix/coupledFvMatrices/coupledFvMatrix/coupledFvMatrix.C b/src/coupledMatrix/coupledFvMatrices/coupledFvMatrix/coupledFvMatrix.C index fbcbbcb8d..af2e349e8 100644 --- a/src/coupledMatrix/coupledFvMatrices/coupledFvMatrix/coupledFvMatrix.C +++ b/src/coupledMatrix/coupledFvMatrices/coupledFvMatrix/coupledFvMatrix.C @@ -204,7 +204,7 @@ Foam::coupledFvMatrix::solve(const dictionary& solverControls) } } - // Correct boundart conditions + // Correct boundary conditions forAll (matrices, rowI) { fvMatrix& curMatrix = diff --git a/src/coupledMatrix/coupledFvMatrices/coupledFvScalarMatrix/coupledFvScalarMatrix.C b/src/coupledMatrix/coupledFvMatrices/coupledFvScalarMatrix/coupledFvScalarMatrix.C index 01796187a..28422cac4 100644 --- a/src/coupledMatrix/coupledFvMatrices/coupledFvScalarMatrix/coupledFvScalarMatrix.C +++ b/src/coupledMatrix/coupledFvMatrices/coupledFvScalarMatrix/coupledFvScalarMatrix.C @@ -70,7 +70,10 @@ coupledSolverPerformance coupledFvMatrix::solve static_cast(matrices[rowI]); saveDiag.set(rowI, new scalarField(curMatrix.diag())); - psi.set(rowI, new scalarField(curMatrix.psi())); + // HR 17/Feb/2013 + // Need to be able to compare references to support hacks such as in jumpCyclic + // psi.set(rowI, new scalarField(curMatrix.psi())); + psi.set(rowI, &curMatrix.psi()); source.set(rowI, new scalarField(curMatrix.source())); curMatrix.addBoundarySource(source[rowI], 0); @@ -111,16 +114,18 @@ coupledSolverPerformance coupledFvMatrix::solve solverPerf.print(); + // HR 17/Feb/2013 + // Not needed since reference is used // Update solution - forAll (matrices, rowI) - { - fvScalarMatrix& curMatrix = - static_cast(matrices[rowI]); + //forAll (matrices, rowI) + //{ + // fvScalarMatrix& curMatrix = + // static_cast(matrices[rowI]); + // + // curMatrix.psi().internalField() = psi[rowI]; + //} - curMatrix.psi().internalField() = psi[rowI]; - } - - // Correct boundart conditions + // Correct boundary conditions forAll (matrices, rowI) { fvScalarMatrix& curMatrix = @@ -129,6 +134,12 @@ coupledSolverPerformance coupledFvMatrix::solve curMatrix.psi().correctBoundaryConditions(); } + //HR 17.2.2013: Clear references to internal field without deleting the objects + forAll (matrices, rowI) + { + psi.set(rowI, NULL).ptr(); + } + return solverPerf; } From 306f7e22ce3cd6e39de5b44599e8c66a45c69e98 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Thu, 11 Jul 2013 20:59:07 +0200 Subject: [PATCH 08/14] BACKPORT: view factor radiation model --- src/OpenFOAM/Make/files | 4 +- .../primitivePatch}/uindirectPrimitivePatch.H | 0 src/finiteVolume/Make/files | 1 + .../singleCellFvMesh/singleCellFvMesh.C | 646 ++++++++++++++++ .../singleCellFvMesh/singleCellFvMesh.H | 245 ++++++ .../singleCellFvMeshInterpolate.C | 131 ++++ src/thermophysicalModels/radiation/Make/files | 2 + ...veViewFactorFixedValueFvPatchScalarField.C | 167 ++++ ...veViewFactorFixedValueFvPatchScalarField.H | 202 +++++ .../radiationModel/viewFactor/viewFactor.C | 711 ++++++++++++++++++ .../radiationModel/viewFactor/viewFactor.H | 188 +++++ .../radiationModel/viewFactor/viewFactorI.H | 33 + 12 files changed, 2328 insertions(+), 2 deletions(-) rename {applications/utilities/surface/surfaceToPatch => src/OpenFOAM/meshes/primitiveMesh/primitivePatch}/uindirectPrimitivePatch.H (100%) create mode 100644 src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C create mode 100644 src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.H create mode 100644 src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMeshInterpolate.C create mode 100644 src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.C create mode 100644 src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveViewFactor/greyDiffusiveViewFactorFixedValueFvPatchScalarField.H create mode 100644 src/thermophysicalModels/radiation/radiationModel/viewFactor/viewFactor.C create mode 100644 src/thermophysicalModels/radiation/radiationModel/viewFactor/viewFactor.H create mode 100644 src/thermophysicalModels/radiation/radiationModel/viewFactor/viewFactorI.H diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 408eeecd1..812199f5b 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -670,6 +670,8 @@ matrices/blockLduMatrix/BlockLduSmoothers/BlockLduSmoother/blockLduSmoothers.C matrices/blockLduMatrix/BlockLduSmoothers/BlockGaussSeidelSmoother/blockGaussSeidelSmoothers.C matrices/blockLduMatrix/BlockLduSmoothers/BlockILUSmoother/blockILUSmoothers.C +/* compile blockVectorNSolvers earlier to exploit parallelismn */ +matrices/blockLduMatrix/BlockLduSolvers/blockVectorNSolvers.C matrices/blockLduMatrix/BlockLduSolvers/BlockLduSolver/blockLduSolvers.C matrices/blockLduMatrix/BlockLduSolvers/BlockDiagonal/blockDiagonalSolvers.C matrices/blockLduMatrix/BlockLduSolvers/BlockGaussSeidel/blockGaussSeidelSolvers.C @@ -679,6 +681,4 @@ matrices/blockLduMatrix/BlockLduSolvers/BlockGMRES/blockGMRESSolvers.C matrices/blockLduMatrix/BlockLduSolvers/BlockAmgSolver/blockAmgSolvers.C matrices/blockLduMatrix/BlockLduSolvers/Segregated/segregatedSolvers.C -matrices/blockLduMatrix/BlockLduSolvers/blockVectorNSolvers.C - LIB = $(FOAM_LIBBIN)/libOpenFOAM diff --git a/applications/utilities/surface/surfaceToPatch/uindirectPrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H similarity index 100% rename from applications/utilities/surface/surfaceToPatch/uindirectPrimitivePatch.H rename to src/OpenFOAM/meshes/primitiveMesh/primitivePatch/uindirectPrimitivePatch.H diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index c25566720..98d5caa68 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -1,6 +1,7 @@ fvMesh/fvMeshGeometry.C fvMesh/fvMesh.C +fvMesh/singleCellFvMesh/singleCellFvMesh.C fvMesh/fvMeshSubset/fvMeshSubset.C fvBoundaryMesh = fvMesh/fvBoundaryMesh diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C new file mode 100644 index 000000000..474ad9f00 --- /dev/null +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C @@ -0,0 +1,646 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "singleCellFvMesh.H" +#include "syncTools.H" +#include "uindirectPrimitivePatch.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +// Conversion is a two step process: +// - from original (fine) patch faces to agglomerations (aggloms might not +// be in correct patch order) +// - from agglomerations to coarse patch faces +void Foam::singleCellFvMesh::agglomerateMesh +( + const fvMesh& mesh, + const labelListList& agglom +) +{ + const polyBoundaryMesh& oldPatches = mesh.boundaryMesh(); + + // Check agglomeration within patch face range and continuous + labelList nAgglom(oldPatches.size(), 0); + + forAll(oldPatches, patchI) + { + const polyPatch& pp = oldPatches[patchI]; + if (pp.size() > 0) + { + nAgglom[patchI] = max(agglom[patchI])+1; + + forAll(pp, i) + { + if (agglom[patchI][i] < 0 || agglom[patchI][i] >= pp.size()) + { + FatalErrorIn + ( + "singleCellFvMesh::agglomerateMesh(..)" + ) << "agglomeration on patch " << patchI + << " is out of range 0.." << pp.size()-1 + << exit(FatalError); + } + } + } + } + + // Check agglomeration is sync + { + // Get neighbouring agglomeration + labelList nbrAgglom(mesh.nFaces()-mesh.nInternalFaces()); + forAll(oldPatches, patchI) + { + const polyPatch& pp = oldPatches[patchI]; + + if (pp.coupled()) + { + label offset = pp.start()-mesh.nInternalFaces(); + forAll(pp, i) + { + nbrAgglom[offset+i] = agglom[patchI][i]; + } + } + } + syncTools::swapBoundaryFaceList(mesh, nbrAgglom, false); + + + // Get correspondence between this agglomeration and remote one + Map