From 46cdaf8e32fa11f1578712900166b32d0cf357c5 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 30 Nov 2010 16:10:48 +0000 Subject: [PATCH 01/26] ENH: Updated nBottomSweeps->nFinestSweeps in tutorials --- .../coalChemistryFoam/simplifiedSiwek/system/fvSolution | 2 +- .../compressibleInterFoam/les/depthCharge2D/system/fvSolution | 2 +- .../compressibleInterFoam/les/depthCharge3D/system/fvSolution | 2 +- .../interDyMFoam/ras/damBreakWithObstacle/system/fvSolution | 2 +- .../interDyMFoam/ras/floatingObject/system/fvSolution | 2 +- .../interDyMFoam/ras/sloshingTank2D/system/fvSolution | 2 +- .../interDyMFoam/ras/sloshingTank2D3DoF/system/fvSolution | 2 +- .../interDyMFoam/ras/sloshingTank3D/system/fvSolution | 2 +- .../interDyMFoam/ras/sloshingTank3D3DoF/system/fvSolution | 2 +- .../interDyMFoam/ras/sloshingTank3D6DoF/system/fvSolution | 2 +- .../multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution | 2 +- .../multiphase/interFoam/les/nozzleFlow2D/system/fvSolution | 2 +- .../laminar/damBreak4phase/system/fvSolution | 2 +- .../laminar/damBreak4phaseFine/system/fvSolution | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution index aa49989c5b..c40ce42cf8 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/fvSolution @@ -40,7 +40,7 @@ solvers smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution index 66a8e350d9..9d09fcfdb3 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge2D/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution index 66a8e350d9..9d09fcfdb3 100644 --- a/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution +++ b/tutorials/multiphase/compressibleInterFoam/les/depthCharge3D/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution index b8143ab07b..3f91dae6d4 100644 --- a/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/damBreakWithObstacle/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution index b6d29c6241..0cd58c354f 100644 --- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution @@ -40,7 +40,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/system/fvSolution index 11a72d517a..12812ad721 100644 --- a/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D3DoF/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D3DoF/system/fvSolution index 11a72d517a..12812ad721 100644 --- a/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D3DoF/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D3DoF/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D/system/fvSolution index 11a72d517a..12812ad721 100644 --- a/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D3DoF/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D3DoF/system/fvSolution index 11a72d517a..12812ad721 100644 --- a/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D3DoF/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D3DoF/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D6DoF/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D6DoF/system/fvSolution index 11a72d517a..12812ad721 100644 --- a/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D6DoF/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/sloshingTank3D6DoF/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution index b2f497532f..3764ff4c6e 100644 --- a/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/testTubeMixer/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSolution b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSolution index 06e675ebf8..38782da870 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSolution +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother DICGaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration false; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSolution b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSolution index 143bfa585a..c194ad7907 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSolution +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration off; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSolution b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSolution index c58dfc3740..cd28739cd7 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSolution +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSolution @@ -28,7 +28,7 @@ solvers smoother GaussSeidel; nPreSweeps 0; nPostSweeps 2; - nBottomSweeps 2; + nFinestSweeps 2; cacheAgglomeration off; nCellsInCoarsestLevel 10; agglomerator faceAreaPair; From ba5b08ddd26faf64a93580eed7792fd7d0e95f8b Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 1 Dec 2010 11:27:36 +0000 Subject: [PATCH 02/26] ENH: Added initialisation for variables in ODE solvers --- src/ODE/ODESolvers/KRR4/KRR4.C | 22 +++++++++++----------- src/ODE/ODESolvers/RK/RK.C | 16 ++++++++-------- src/ODE/ODESolvers/SIBS/SIBS.C | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/ODE/ODESolvers/KRR4/KRR4.C b/src/ODE/ODESolvers/KRR4/KRR4.C index 95927e01b6..09df33ad9d 100644 --- a/src/ODE/ODESolvers/KRR4/KRR4.C +++ b/src/ODE/ODESolvers/KRR4/KRR4.C @@ -58,17 +58,17 @@ const scalar Foam::KRR4::KRR4(const ODE& ode) : ODESolver(ode), - yTemp_(n_), - dydxTemp_(n_), - g1_(n_), - g2_(n_), - g3_(n_), - g4_(n_), - yErr_(n_), - dfdx_(n_), - dfdy_(n_, n_), - a_(n_, n_), - pivotIndices_(n_) + yTemp_(n_, 0.0), + dydxTemp_(n_, 0.0), + g1_(n_, 0.0), + g2_(n_, 0.0), + g3_(n_, 0.0), + g4_(n_, 0.0), + yErr_(n_, 0.0), + dfdx_(n_, 0.0), + dfdy_(n_, n_, 0.0), + a_(n_, n_, 0.0), + pivotIndices_(n_, 0.0) {} diff --git a/src/ODE/ODESolvers/RK/RK.C b/src/ODE/ODESolvers/RK/RK.C index dd17c4aee5..3b74eb8f45 100644 --- a/src/ODE/ODESolvers/RK/RK.C +++ b/src/ODE/ODESolvers/RK/RK.C @@ -57,14 +57,14 @@ const scalar Foam::RK::RK(const ODE& ode) : ODESolver(ode), - yTemp_(n_), - ak2_(n_), - ak3_(n_), - ak4_(n_), - ak5_(n_), - ak6_(n_), - yErr_(n_), - yTemp2_(n_) + yTemp_(n_, 0.0), + ak2_(n_, 0.0), + ak3_(n_, 0.0), + ak4_(n_, 0.0), + ak5_(n_, 0.0), + ak6_(n_, 0.0), + yErr_(n_, 0.0), + yTemp2_(n_, 0.0) {} diff --git a/src/ODE/ODESolvers/SIBS/SIBS.C b/src/ODE/ODESolvers/SIBS/SIBS.C index 41f73e78a1..acaa5c9e76 100644 --- a/src/ODE/ODESolvers/SIBS/SIBS.C +++ b/src/ODE/ODESolvers/SIBS/SIBS.C @@ -50,17 +50,17 @@ namespace Foam Foam::SIBS::SIBS(const ODE& ode) : ODESolver(ode), - a_(iMaxX_), - alpha_(kMaxX_, kMaxX_), - d_p_(n_, kMaxX_), - x_p_(kMaxX_), - err_(kMaxX_), + a_(iMaxX_, 0.0), + alpha_(kMaxX_, kMaxX_, 0.0), + d_p_(n_, kMaxX_, 0.0), + x_p_(kMaxX_, 0.0), + err_(kMaxX_, 0.0), - yTemp_(n_), - ySeq_(n_), - yErr_(n_), - dfdx_(n_), - dfdy_(n_, n_), + yTemp_(n_, 0.0), + ySeq_(n_, 0.0), + yErr_(n_, 0.0), + dfdx_(n_, 0.0), + dfdy_(n_, n_, 0.0), first_(1), epsOld_(-1.0) {} From d645c06da6837c3c1cffa68d9572fed2218d8128 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 1 Dec 2010 11:47:24 +0000 Subject: [PATCH 03/26] ENH: Added Corrected enthalpy field name lookup for alphaSgsJayatillekeWallFunction --- ...ayatillekeWallFunctionFvPatchScalarField.C | 20 +++++++++++++------ ...ayatillekeWallFunctionFvPatchScalarField.H | 3 +++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C index adc76f9f4f..d9dffce684 100644 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.C @@ -115,7 +115,9 @@ alphaSgsJayatillekeWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(p, iF), Prt_(0.85), kappa_(0.41), - E_(9.8) + E_(9.8), + hsName_("hs") + { checkType(); } @@ -133,7 +135,9 @@ alphaSgsJayatillekeWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(ptf, p, iF, mapper), Prt_(ptf.Prt_), kappa_(ptf.kappa_), - E_(ptf.E_) + E_(ptf.E_), + hsName_(ptf.hsName_) + {} @@ -148,7 +152,8 @@ alphaSgsJayatillekeWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(p, iF, dict), Prt_(dict.lookupOrDefault("Prt", 0.85)), kappa_(dict.lookupOrDefault("kappa", 0.41)), - E_(dict.lookupOrDefault("E", 9.8)) + E_(dict.lookupOrDefault("E", 9.8)), + hsName_(dict.lookupOrDefault("hs", "hs")) { checkType(); } @@ -163,7 +168,8 @@ alphaSgsJayatillekeWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(awfpsf), Prt_(awfpsf.Prt_), kappa_(awfpsf.kappa_), - E_(awfpsf.E_) + E_(awfpsf.E_), + hsName_(awfpsf.hsName_) { checkType(); } @@ -179,7 +185,8 @@ alphaSgsJayatillekeWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(awfpsf, iF), Prt_(awfpsf.Prt_), kappa_(awfpsf.kappa_), - E_(awfpsf.E_) + E_(awfpsf.E_), + hsName_(awfpsf.hsName_) { checkType(); } @@ -209,7 +216,7 @@ void alphaSgsJayatillekeWallFunctionFvPatchScalarField::evaluate const scalarField& rhow = lesModel.rho().boundaryField()[patchI]; const fvPatchScalarField& hw = - patch().lookupPatchField("h"); + patch().lookupPatchField(hsName_); const scalarField& ry = patch().deltaCoeffs(); @@ -312,6 +319,7 @@ void alphaSgsJayatillekeWallFunctionFvPatchScalarField::write(Ostream& os) const os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + os.writeKeyword("hs") << hsName_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H index b06ba8c1c2..940d5fa263 100644 --- a/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/LES/derivedFvPatchFields/wallFunctions/alphaSgsWallFunctions/alphaSgsJayatillekeWallFunction/alphaSgsJayatillekeWallFunctionFvPatchScalarField.H @@ -66,6 +66,9 @@ class alphaSgsJayatillekeWallFunctionFvPatchScalarField //- E coefficient scalar E_; + //- Name of (sensible/total) enthalpy field + word hsName_; + // Solution parameters From 0f8c3f0309a21448780db4143a37b1cee52a6a61 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 7 Dec 2010 15:43:12 +0000 Subject: [PATCH 04/26] BUG: mapDistribute : scheduled comms --- .../mapPolyMesh/mapDistribute/mapDistribute.C | 29 ++ .../mapPolyMesh/mapDistribute/mapDistribute.H | 9 + .../mapDistribute/mapDistributeTemplates.C | 254 ++++++------------ .../interpolationCellPoint.C | 5 +- 4 files changed, 122 insertions(+), 175 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 95813de6b6..af5b4393b8 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C @@ -165,6 +165,35 @@ const Foam::List& Foam::mapDistribute::schedule() const } +void Foam::mapDistribute::checkReceivedSize +( + const label procI, + const label expectedSize, + const label receivedSize +) +{ + if (receivedSize != expectedSize) + { + FatalErrorIn + ( + "template\n" + "void mapDistribute::distribute\n" + "(\n" + " const Pstream::commsTypes commsType,\n" + " const List& schedule,\n" + " const label constructSize,\n" + " const labelListList& subMap,\n" + " const labelListList& constructMap,\n" + " List& field\n" + ")\n" + ) << "Expected from processor " << procI + << " " << expectedSize << " but received " + << receivedSize << " elements." + << abort(FatalError); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // //- Construct from components diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H index 0df1ce8484..ddd0486707 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H @@ -93,6 +93,15 @@ class mapDistribute mutable autoPtr > schedulePtr_; + // Private Member Functions + + static void checkReceivedSize + ( + const label procI, + const label expectedSize, + const label receivedSize + ); + public: // Constructors diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C index ef6c78299e..1a028f7443 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistributeTemplates.C @@ -111,25 +111,7 @@ void Foam::mapDistribute::distribute IPstream fromNbr(Pstream::blocking, domain); List subField(fromNbr); - if (subField.size() != map.size()) - { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << domain - << " " << map.size() << " but received " - << subField.size() << " elements." - << abort(FatalError); - } + checkReceivedSize(domain, map.size(), subField.size()); forAll(map, i) { @@ -160,46 +142,52 @@ void Foam::mapDistribute::distribute forAll(schedule, i) { const labelPair& twoProcs = schedule[i]; + // twoProcs is a swap pair of processors. The first one is the + // one that needs to send first and then receive. + label sendProc = twoProcs[0]; label recvProc = twoProcs[1]; if (Pstream::myProcNo() == sendProc) { - // I am sender. Send to recvProc. - OPstream toNbr(Pstream::scheduled, recvProc); - toNbr << UIndirectList(field, subMap[recvProc]); + // I am send first, receive next + { + OPstream toNbr(Pstream::scheduled, recvProc); + toNbr << UIndirectList(field, subMap[recvProc]); + } + { + IPstream fromNbr(Pstream::scheduled, recvProc); + List subField(fromNbr); + + const labelList& map = constructMap[recvProc]; + + checkReceivedSize(recvProc, map.size(), subField.size()); + + forAll(map, i) + { + newField[map[i]] = subField[i]; + } + } } else { - // I am receiver. Receive from sendProc. - IPstream fromNbr(Pstream::scheduled, sendProc); - List subField(fromNbr); - - const labelList& map = constructMap[sendProc]; - - if (subField.size() != map.size()) + // I am receive first, send next { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << sendProc - << " " << map.size() << " but received " - << subField.size() << " elements." - << abort(FatalError); + IPstream fromNbr(Pstream::scheduled, sendProc); + List subField(fromNbr); + + const labelList& map = constructMap[sendProc]; + + checkReceivedSize(sendProc, map.size(), subField.size()); + + forAll(map, i) + { + newField[map[i]] = subField[i]; + } } - - forAll(map, i) { - newField[map[i]] = subField[i]; + OPstream toNbr(Pstream::scheduled, sendProc); + toNbr << UIndirectList(field, subMap[sendProc]); } } } @@ -258,25 +246,7 @@ void Foam::mapDistribute::distribute UIPstream str(domain, pBufs); List recvField(str); - if (recvField.size() != map.size()) - { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << domain - << " " << map.size() << " but received " - << recvField.size() << " elements." - << abort(FatalError); - } + checkReceivedSize(domain, map.size(), recvField.size()); forAll(map, i) { @@ -379,29 +349,13 @@ void Foam::mapDistribute::distribute if (domain != Pstream::myProcNo() && map.size()) { - if (recvFields[domain].size() != map.size()) - { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << domain - << " " << map.size() << " but received " - << recvFields[domain].size() << " elements." - << abort(FatalError); - } + const List& subField = recvFields[domain]; + + checkReceivedSize(domain, map.size(), subField.size()); forAll(map, i) { - field[map[i]] = recvFields[domain][i]; + field[map[i]] = subField[i]; } } } @@ -502,25 +456,7 @@ void Foam::mapDistribute::distribute IPstream fromNbr(Pstream::blocking, domain); List subField(fromNbr); - if (subField.size() != map.size()) - { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << domain - << " " << map.size() << " but received " - << subField.size() << " elements." - << abort(FatalError); - } + checkReceivedSize(domain, map.size(), subField.size()); forAll(map, i) { @@ -551,46 +487,50 @@ void Foam::mapDistribute::distribute forAll(schedule, i) { const labelPair& twoProcs = schedule[i]; + // twoProcs is a swap pair of processors. The first one is the + // one that needs to send first and then receive. + label sendProc = twoProcs[0]; label recvProc = twoProcs[1]; if (Pstream::myProcNo() == sendProc) { - // I am sender. Send to recvProc. - OPstream toNbr(Pstream::scheduled, recvProc); - toNbr << UIndirectList(field, subMap[recvProc]); + // I am send first, receive next + { + OPstream toNbr(Pstream::scheduled, recvProc); + toNbr << UIndirectList(field, subMap[recvProc]); + } + { + IPstream fromNbr(Pstream::scheduled, recvProc); + List subField(fromNbr); + const labelList& map = constructMap[recvProc]; + + checkReceivedSize(recvProc, map.size(), subField.size()); + + forAll(map, i) + { + cop(newField[map[i]], subField[i]); + } + } } else { - // I am receiver. Receive from sendProc. - IPstream fromNbr(Pstream::scheduled, sendProc); - List subField(fromNbr); - - const labelList& map = constructMap[sendProc]; - - if (subField.size() != map.size()) + // I am receive first, send next { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << sendProc - << " " << map.size() << " but received " - << subField.size() << " elements." - << abort(FatalError); + IPstream fromNbr(Pstream::scheduled, sendProc); + List subField(fromNbr); + const labelList& map = constructMap[sendProc]; + + checkReceivedSize(sendProc, map.size(), subField.size()); + + forAll(map, i) + { + cop(newField[map[i]], subField[i]); + } } - - forAll(map, i) { - cop(newField[map[i]], subField[i]); + OPstream toNbr(Pstream::scheduled, sendProc); + toNbr << UIndirectList(field, subMap[sendProc]); } } } @@ -649,25 +589,7 @@ void Foam::mapDistribute::distribute UIPstream str(domain, pBufs); List recvField(str); - if (recvField.size() != map.size()) - { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << domain - << " " << map.size() << " but received " - << recvField.size() << " elements." - << abort(FatalError); - } + checkReceivedSize(domain, map.size(), recvField.size()); forAll(map, i) { @@ -769,29 +691,13 @@ void Foam::mapDistribute::distribute if (domain != Pstream::myProcNo() && map.size()) { - if (recvFields[domain].size() != map.size()) - { - FatalErrorIn - ( - "template\n" - "void mapDistribute::distribute\n" - "(\n" - " const Pstream::commsTypes commsType,\n" - " const List& schedule,\n" - " const label constructSize,\n" - " const labelListList& subMap,\n" - " const labelListList& constructMap,\n" - " List& field\n" - ")\n" - ) << "Expected from processor " << domain - << " " << map.size() << " but received " - << recvFields[domain].size() << " elements." - << abort(FatalError); - } + const List& subField = recvFields[domain]; + + checkReceivedSize(domain, map.size(), subField.size()); forAll(map, i) { - cop(field[map[i]], recvFields[domain][i]); + cop(field[map[i]], subField[i]); } } } diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.C index 9b76c5bb21..b71fccb8f7 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/interpolationCellPoint.C @@ -36,7 +36,10 @@ Foam::interpolationCellPoint::interpolationCellPoint : interpolation(psi), psip_(volPointInterpolation::New(psi.mesh()).interpolate(psi)) -{} +{ + // Uses cellPointWeight to do interpolation which needs tet decomposition + (void)psi.mesh().tetBasePtIs(); +} // ************************************************************************* // From 650403c2dd8b214f215f8f14122c1696503b82d2 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 7 Dec 2010 16:45:58 +0000 Subject: [PATCH 05/26] ENH: directMapped : added patchInternalField sampledSurface --- .../sampledPatchInternalFieldTemplates.C | 2 +- .../pisoFoam/les/pitzDaily/system/controlDict | 34 +++++++++++++++ .../pitzDailyDirectMapped/system/controlDict | 42 +++++++++++++++++-- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C index 1da319db8a..135ade9059 100644 --- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C +++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalFieldTemplates.C @@ -76,7 +76,7 @@ Foam::sampledPatchInternalField::interpolateField // Send back sample points to processor that holds the cell. // Mark cells with point::max so we know which ones we need // to interpolate (since expensive). - vectorField samples(pp.faceCentres()); + vectorField samples(samplePoints()); distMap.reverseDistribute(mesh().nCells(), point::max, samples); Field patchVals(mesh().nCells()); diff --git a/tutorials/incompressible/pisoFoam/les/pitzDaily/system/controlDict b/tutorials/incompressible/pisoFoam/les/pitzDaily/system/controlDict index cc9c512165..c09d6b3c9b 100644 --- a/tutorials/incompressible/pisoFoam/les/pitzDaily/system/controlDict +++ b/tutorials/incompressible/pisoFoam/les/pitzDaily/system/controlDict @@ -97,6 +97,40 @@ functions } ); } + + surfaceSampling + { + // Sample near-wall velocity + + type surfaces; + + // Where to load it from (if not already in solver) + functionObjectLibs ("libsampling.so"); + enabled true; + outputControl outputTime; + + interpolationScheme cellPoint; + + surfaceFormat vtk; + + // Fields to be sampled + fields + ( + U + ); + + surfaces + ( + nearWall + { + type patchInternalField; + patchName lowerWall; + distance 1E-6; + interpolate true; + triangulate false; + } + ); + } } // ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/controlDict b/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/controlDict index 338bc54766..c09d6b3c9b 100644 --- a/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/controlDict +++ b/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/controlDict @@ -47,10 +47,10 @@ runTimeModifiable true; functions { - probes1 + probes { type probes; - functionObjectLibs ( "libsampling.so" ); + functionObjectLibs ("libsampling.so"); enabled true; outputControl timeStep; outputInterval 1; @@ -70,12 +70,13 @@ functions ( 0.1524 0.0253 0 ) ( 0.1778 0.0253 0 ) ); + } fieldAverage1 { type fieldAverage; - functionObjectLibs ( "libfieldFunctionObjects.so" ); + functionObjectLibs ("libfieldFunctionObjects.so"); enabled true; outputControl outputTime; @@ -96,7 +97,40 @@ functions } ); } + + surfaceSampling + { + // Sample near-wall velocity + + type surfaces; + + // Where to load it from (if not already in solver) + functionObjectLibs ("libsampling.so"); + enabled true; + outputControl outputTime; + + interpolationScheme cellPoint; + + surfaceFormat vtk; + + // Fields to be sampled + fields + ( + U + ); + + surfaces + ( + nearWall + { + type patchInternalField; + patchName lowerWall; + distance 1E-6; + interpolate true; + triangulate false; + } + ); + } } - // ************************************************************************* // From 4002bacc52c25edd7c215e1ab744b1958c9cb0b8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 7 Dec 2010 21:28:27 +0000 Subject: [PATCH 06/26] BUG: sampledSet : handling empty sets --- src/sampling/sampledSet/midPoint/midPointSet.C | 2 +- .../sampledSet/midPointAndFace/midPointAndFaceSet.C | 2 +- src/sampling/sampledSet/sampledSets/sampledSets.C | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sampling/sampledSet/midPoint/midPointSet.C b/src/sampling/sampledSet/midPoint/midPointSet.C index 778b8b1852..5cae7f1c4e 100644 --- a/src/sampling/sampledSet/midPoint/midPointSet.C +++ b/src/sampling/sampledSet/midPoint/midPointSet.C @@ -53,7 +53,7 @@ void Foam::midPointSet::genSamples() label sampleI = 0; - while(true) + while(true && size()>0) { // calculate midpoint between sampleI and sampleI+1 (if in same segment) while diff --git a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C index fa8d9b3d0e..2f985beab7 100644 --- a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C @@ -55,7 +55,7 @@ void Foam::midPointAndFaceSet::genSamples() label sampleI = 0; - while(true) + while(true && size()>0) { // sampleI is start of segment diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 3cd621bb76..cbe7654771 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -96,6 +96,14 @@ void Foam::sampledSets::combineSampledSets ) ); + + if (Pstream::master() && allCurveDist.size() == 0) + { + WarningIn("sampledSets::combineSampledSets(..)") + << "Sample set " << samplePts.name() + << " has zero points." << endl; + } + // Sort curveDist and use to fill masterSamplePts SortableList sortedDist(allCurveDist); indexSets[setI] = sortedDist.indices(); From 985870e754cc4e42fe2f3250667b378734d31fdb Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 11:43:54 +0000 Subject: [PATCH 07/26] STYLE: Remove orphaned files --- .../solvers/combustion/PDRFoam/Make/files | 1 + .../combustion/PDRFoam/PDRFoamAutoRefine.C | 9 +- .../miscellaneous/postChannel/sumData.C | 48 ---- .../miscellaneous/postChannel/sumData.H | 199 --------------- .../miscellaneous/postChannel/sumDataI.H | 226 ------------------ 5 files changed, 5 insertions(+), 478 deletions(-) delete mode 100644 applications/utilities/postProcessing/miscellaneous/postChannel/sumData.C delete mode 100644 applications/utilities/postProcessing/miscellaneous/postChannel/sumData.H delete mode 100644 applications/utilities/postProcessing/miscellaneous/postChannel/sumDataI.H diff --git a/applications/solvers/combustion/PDRFoam/Make/files b/applications/solvers/combustion/PDRFoam/Make/files index d1b1d5a8f8..1e5d200ccb 100644 --- a/applications/solvers/combustion/PDRFoam/Make/files +++ b/applications/solvers/combustion/PDRFoam/Make/files @@ -27,6 +27,7 @@ PDRModels/XiGModels/basicXiSubG/basicXiSubG.C laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +/* PDRFoamAutoRefine.C */ PDRFoam.C EXE = $(FOAM_APPBIN)/PDRFoam diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index 2946fa52a2..3152feec9b 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -25,8 +25,8 @@ Application PDRFoam Description - Compressible premixed/partially-premixed combustion solver with turbulence - modelling. + Solver for compressible premixed/partially-premixed combustion with + turbulence modelling. Combusting RANS code using the b-Xi two-equation model. Xi may be obtained by either the solution of the Xi transport @@ -35,7 +35,7 @@ Description to be appropriate by comparison with the results from the spectral model. - Strain effects are encorporated directly into the Xi equation + Strain effects are incorporated directly into the Xi equation but not in the algebraic approximation. Further work need to be done on this issue, particularly regarding the enhanced removal rate caused by flame compression. Analysis using results of the spectral @@ -78,9 +78,9 @@ int main(int argc, char *argv[]) #include "readCombustionProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" - #include "readPISOControls.H" #include "initContinuityErrs.H" #include "readTimeControls.H" + #include "CourantNo.H" #include "setInitialDeltaT.H" scalar StCoNum = 0.0; @@ -94,7 +94,6 @@ int main(int argc, char *argv[]) #include "readTimeControls.H" #include "readPISOControls.H" #include "CourantNo.H" - #include "setDeltaT.H" runTime++; diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/sumData.C b/applications/utilities/postProcessing/miscellaneous/postChannel/sumData.C deleted file mode 100644 index e969badccd..0000000000 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/sumData.C +++ /dev/null @@ -1,48 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 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 "sumData.H" - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - -Foam::Ostream& Foam::operator<< -( - Foam::Ostream& os, - const Foam::sumData& wDist -) -{ - return os - << wDist.oldFace_ << token::SPACE - << wDist.sum_ << token::SPACE << wDist.count_; -} - - -Foam::Istream& Foam::operator>>(Foam::Istream& is, Foam::sumData& wDist) -{ - return is >> wDist.oldFace_ >> wDist.sum_ >> wDist.count_; -} - - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/sumData.H b/applications/utilities/postProcessing/miscellaneous/postChannel/sumData.H deleted file mode 100644 index 86e80cda5b..0000000000 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/sumData.H +++ /dev/null @@ -1,199 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 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::sumData - -Description - Sums data while walking across cells. Used in collapsing fields. - -SourceFiles - sumDataI.H - sumData.C - -\*---------------------------------------------------------------------------*/ - -#ifndef sumData_H -#define sumData_H - -#include "point.H" -#include "tensor.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class polyPatch; -class polyMesh; - -/*---------------------------------------------------------------------------*\ - Class sumData Declaration -\*---------------------------------------------------------------------------*/ - -class sumData -{ - // Private data - - //- Previous face - label oldFace_; - - //- summed data - scalar sum_; - - //- number of items summed - label count_; - -public: - - // Constructors - - //- Construct null - inline sumData(); - - //- Construct from count - inline sumData - ( - const label oldFace, - const scalar sum, - const label count - ); - - - // Member Functions - - // Access - - inline label oldFace() const - { - return oldFace_; - } - - inline scalar sum() const - { - return sum_; - } - - inline label count() const - { - return count_; - } - - - // Needed by FaceCellWave - - //- Check whether origin has been changed at all or - // still contains original (invalid) value. - inline bool valid() const; - - //- Check for identical geometrical data. Used for cyclics checking. - inline bool sameGeometry - ( - const polyMesh&, - const sumData&, - const scalar - ) const; - - //- Convert any absolute coordinates into relative to (patch)face - // centre - inline void leaveDomain - ( - const polyMesh&, - const polyPatch&, - const label patchFaceI, - const point& faceCentre - ); - - //- Reverse of leaveDomain - inline void enterDomain - ( - const polyMesh&, - const polyPatch&, - const label patchFaceI, - const point& faceCentre - ); - - //- Apply rotation matrix to any coordinates - inline void transform - ( - const polyMesh&, - const tensor& - ); - - //- Influence of neighbouring face. - inline bool updateCell - ( - const polyMesh&, - const label thisCellI, - const label neighbourFaceI, - const sumData& neighbourInfo, - const scalar tol - ); - - //- Influence of neighbouring cell. - inline bool updateFace - ( - const polyMesh&, - const label thisFaceI, - const label neighbourCellI, - const sumData& neighbourInfo, - const scalar tol - ); - - //- Influence of different value on same face. - inline bool updateFace - ( - const polyMesh&, - const label thisFaceI, - const sumData& neighbourInfo, - const scalar tol - ); - - // Member Operators - - // Needed for List IO - inline bool operator==(const sumData&) const; - - inline bool operator!=(const sumData&) const; - - - // IOstream Operators - - friend Ostream& operator<<(Ostream&, const sumData&); - friend Istream& operator>>(Istream&, sumData&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "sumDataI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/sumDataI.H b/applications/utilities/postProcessing/miscellaneous/postChannel/sumDataI.H deleted file mode 100644 index b0882878e3..0000000000 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/sumDataI.H +++ /dev/null @@ -1,226 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 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 "polyMesh.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Null constructor -inline Foam::sumData::sumData() -: - oldFace_(-1), - sum_(0.0), - count_(0) -{} - - -// Construct from components -inline Foam::sumData::sumData -( - const label oldFace, - const scalar sum, - const label count -) -: - oldFace_(oldFace), - sum_(sum), - count_(count) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -inline bool Foam::sumData::valid() const -{ - return oldFace_ != -1; -} - - -// No geometric data so never any problem on cyclics -inline bool Foam::sumData::sameGeometry -( - const polyMesh&, - const sumData&, - const scalar -) const -{ - return true; -} - - -// No geometric data. -inline void Foam::sumData::leaveDomain -( - const polyMesh&, - const polyPatch& patch, - const label patchFaceI, - const point& faceCentre -) -{} - - -// No geometric data. -inline void Foam::sumData::transform -( - const polyMesh&, - const tensor& rotTensor -) -{} - - -// No geometric data. -inline void Foam::sumData::enterDomain -( - const polyMesh&, - const polyPatch& patch, - const label patchFaceI, - const point& faceCentre -) -{ - oldFace_ = -1; -} - - -// Update cell with neighbouring face information -inline bool Foam::sumData::updateCell -( - const polyMesh&, - const label thisCellI, - const label neighbourFaceI, - const sumData& neighbourInfo, - const scalar tol -) -{ - if (!valid()) - { - FatalErrorIn("sumData::updateCell") << "problem" - << abort(FatalError); - return false; - } - - - if (count_ == 0) - { - sum_ += neighbourInfo.sum(); - count_ = neighbourInfo.count() + 1; - oldFace_ = neighbourFaceI; - return true; - } - else - { - return false; - } -} - - -// Update face with neighbouring cell information -inline bool Foam::sumData::updateFace -( - const polyMesh& mesh, - const label thisFaceI, - const label neighbourCellI, - const sumData& neighbourInfo, - const scalar tol -) -{ - // From cell to its faces. - - // Check that face is opposite the previous one. - const cell& cFaces = mesh.cells()[neighbourCellI]; - - label wantedFaceI = cFaces.opposingFaceLabel - ( - neighbourInfo.oldFace(), - mesh.faces() - ); - - if (thisFaceI == wantedFaceI) - { - if (count_ != 0) - { - FatalErrorIn("sumData::updateFace") << "problem" - << abort(FatalError); - return false; - } - - sum_ += neighbourInfo.sum(); - count_ = neighbourInfo.count(); - oldFace_ = thisFaceI; - return true; - } - else - { - return false; - } -} - - -// Update face with coupled face information -inline bool Foam::sumData::updateFace -( - const polyMesh&, - const label thisFaceI, - const sumData& neighbourInfo, - const scalar tol -) -{ - // From face to face (e.g. coupled faces) - if (count_ == 0) - { - sum_ += neighbourInfo.sum(); - count_ = neighbourInfo.count(); - oldFace_ = thisFaceI; - return true; - } - else - { - return false; - } -} - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - -inline bool Foam::sumData::operator==(const Foam::sumData& rhs) - const -{ - return - oldFace() == rhs.oldFace() - && sum() == rhs.sum() - && count() == rhs.count(); -} - - -inline bool Foam::sumData::operator!=(const Foam::sumData& rhs) - const -{ - return !(*this == rhs); -} - - -// ************************************************************************* // From 65a1c94630ea9b8a7563e4298a5572ae06091c87 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 11:46:12 +0000 Subject: [PATCH 08/26] ENH: decomposeParDict : use scotch --- .../molecularDynamics/mdFoam/nanoNozzle/system/decomposeParDict | 2 +- .../pisoFoam/les/pitzDailyDirectMapped/system/decomposeParDict | 2 +- .../coalChemistryFoam/simplifiedSiwek/system/decomposeParDict | 2 +- .../filter/system/decomposeParDict | 2 +- .../evaporationTest/system/decomposeParDict | 2 +- .../evaporationTest/system/wallFilmRegion/decomposeParDict | 2 +- .../hotBoxes/system/wallFilmRegion.org/decomposeParDict | 2 +- .../multipleBoxes/system/decomposeParDict | 2 +- .../multipleBoxes/system/wallFilmRegion.org/decomposeParDict | 2 +- .../reactingParcelFilmFoam/panel/system/decomposeParDict | 2 +- .../reactingParcelFoam/evaporationTest/system/decomposeParDict | 2 +- .../simplifiedSiwek/system/decomposeParDict | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/system/decomposeParDict b/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/system/decomposeParDict index 94fced84b9..849ce844b9 100644 --- a/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/system/decomposeParDict +++ b/tutorials/discreteMethods/molecularDynamics/mdFoam/nanoNozzle/system/decomposeParDict @@ -18,7 +18,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/decomposeParDict b/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/decomposeParDict index dc11b89072..5d8115cd17 100644 --- a/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/decomposeParDict +++ b/tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 8; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/decomposeParDict b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/decomposeParDict index baf84e98bc..d2eb7c6972 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/decomposeParDict +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/decomposeParDict b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/decomposeParDict index ab93e4c47e..39c3316dea 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/decomposeParDict +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/filter/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; preserveFaceZones ( diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/decomposeParDict b/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/decomposeParDict index c9ff16db1b..9b200b05ed 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 8; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/wallFilmRegion/decomposeParDict b/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/wallFilmRegion/decomposeParDict index c9ff16db1b..9b200b05ed 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/wallFilmRegion/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFilmFoam/evaporationTest/system/wallFilmRegion/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 8; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/decomposeParDict b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/decomposeParDict index 176b1467df..07e539d558 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/decomposeParDict b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/decomposeParDict index baf84e98bc..d2eb7c6972 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/wallFilmRegion.org/decomposeParDict b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/wallFilmRegion.org/decomposeParDict index baf84e98bc..d2eb7c6972 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/wallFilmRegion.org/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFilmFoam/multipleBoxes/system/wallFilmRegion.org/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/panel/system/decomposeParDict b/tutorials/lagrangian/reactingParcelFilmFoam/panel/system/decomposeParDict index baf84e98bc..d2eb7c6972 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/panel/system/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFilmFoam/panel/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/decomposeParDict b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/decomposeParDict index baf84e98bc..d2eb7c6972 100644 --- a/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/decomposeParDict +++ b/tutorials/lagrangian/reactingParcelFoam/evaporationTest/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { diff --git a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict index 5558445165..c488f3ff6b 100644 --- a/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict +++ b/tutorials/lagrangian/rhoPisoTwinParcelFoam/simplifiedSiwek/system/decomposeParDict @@ -17,7 +17,7 @@ FoamFile numberOfSubdomains 4; -method metis; +method scotch; simpleCoeffs { From 71fd1058213568828c82276fce19b974a65fb42b Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 11:49:00 +0000 Subject: [PATCH 09/26] BUG: patchProbes : split off nearInfo --- .../directMappedPatchBase.C | 29 +---------------- .../directMappedPatchBase.H | 31 +++++++++++++++++-- src/sampling/probes/patchProbes.C | 12 +++---- src/sampling/probes/patchProbes.H | 5 --- 4 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C index 6418c8c8c5..0ad7c431b5 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C @@ -35,6 +35,7 @@ License #include "polyMesh.H" #include "polyPatch.H" #include "Time.H" +#include "mapDistribute.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,34 +65,6 @@ namespace Foam const NamedEnum directMappedPatchBase::offsetModeNames_; - - - //- Private class for finding nearest - // - point+local index - // - sqr(distance) - // - processor - typedef Tuple2 > nearInfo; - - class nearestEqOp - { - - public: - - void operator()(nearInfo& x, const nearInfo& y) const - { - if (y.first().hit()) - { - if (!x.first().hit()) - { - x = y; - } - else if (y.second().first() < x.second().first()) - { - x = y; - } - } - } - }; } diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H index 6b3513f374..0519836f07 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.H @@ -70,8 +70,6 @@ SourceFiles #include "pointField.H" #include "Tuple2.H" #include "pointIndexHit.H" -#include "mapDistribute.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -80,6 +78,7 @@ namespace Foam class polyPatch; class polyMesh; +class mapDistribute; /*---------------------------------------------------------------------------*\ Class directMappedPatchBase Declaration @@ -106,6 +105,34 @@ public: NORMAL // use face normal + distance }; + + //- Helper class for finding nearest + // - point+local index + // - sqr(distance) + // - processor + typedef Tuple2 > nearInfo; + + class nearestEqOp + { + + public: + + void operator()(nearInfo& x, const nearInfo& y) const + { + if (y.first().hit()) + { + if (!x.first().hit()) + { + x = y; + } + else if (y.second().first() < x.second().first()) + { + x = y; + } + } + } + }; + private: // Private data diff --git a/src/sampling/probes/patchProbes.C b/src/sampling/probes/patchProbes.C index 55ae5cd09d..7e545c9f96 100644 --- a/src/sampling/probes/patchProbes.C +++ b/src/sampling/probes/patchProbes.C @@ -25,10 +25,10 @@ License #include "patchProbes.H" #include "volFields.H" -#include "dictionary.H" -#include "Time.H" #include "IOmanip.H" -#include "directMappedPatchBase.C" +// For 'nearInfo' helper class only +#include "directMappedPatchBase.H" +#include "meshSearch.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -41,11 +41,10 @@ namespace Foam void Foam::patchProbes::findElements(const fvMesh& mesh) { - elementList_.clear(); elementList_.setSize(size()); // All the info for nearest. Construct to miss - List nearest(this->size()); + List nearest(this->size()); // Octree based search engine meshSearch meshSearchEngine(mesh, false); @@ -75,7 +74,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh) // Find nearest. - Pstream::listCombineGather(nearest, nearestEqOp()); + Pstream::listCombineGather(nearest, directMappedPatchBase::nearestEqOp()); Pstream::listCombineScatter(nearest); if (debug) @@ -118,7 +117,6 @@ void Foam::patchProbes::findElements(const fvMesh& mesh) } - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::patchProbes::patchProbes diff --git a/src/sampling/probes/patchProbes.H b/src/sampling/probes/patchProbes.H index 01a3559bad..8f5974adb7 100644 --- a/src/sampling/probes/patchProbes.H +++ b/src/sampling/probes/patchProbes.H @@ -37,11 +37,6 @@ SourceFiles #ifndef patchProbes_H #define patchProbes_H -#include "HashPtrTable.H" -#include "OFstream.H" -#include "polyMesh.H" -#include "pointField.H" -#include "volFieldsFwd.H" #include "probes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From da109eed3195f97dcf5abab68729143d2ed709a3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 11:51:45 +0000 Subject: [PATCH 10/26] ENH: sampledSet, sampledSurface : remove default value for interpolation scheme and writer --- .../postProcessing/sampling/sample/sampleDict | 15 +++------------ src/sampling/sampledSet/sampledSets/sampledSets.C | 13 ++----------- .../sampledSurfaces/sampledSurfaces.C | 13 ++----------- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 0dd02c0d58..2c7bbe35af 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | +| \\ / O peration | Version: 1.7.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -95,18 +95,9 @@ sets type face; axis x; - //- flangeHex - //start (0 20 -20); - //end (0 20 10); - - //- nablaCavity - //start (-1 0.05 0.005); - //end ( 1 0.05 0.005); - //- cavity - start (0.001 0.5101 0.00501); - end (2.01 0.5101 0.00501); - nPoints 10; + start (0.0001 0.0525 0.00501); + end (0.0999 0.0525 0.00501); } somePoints diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index cbe7654771..28e7a88288 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -234,17 +234,8 @@ void Foam::sampledSets::read(const dictionary& dict) dict_.lookup("fields") >> fieldSelection_; clearFieldGroups(); - interpolationScheme_ = dict.lookupOrDefault - ( - "interpolationScheme", - "cell" - ); - writeFormat_ = dict.lookupOrDefault - ( - "setFormat", - "null" - ); - + dict.lookup("interpolationScheme") >> interpolationScheme_; + dict.lookup("setFormat") >> writeFormat_; PtrList newList ( diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index cfb7cb4d96..c4fcc7663a 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -220,17 +220,8 @@ void Foam::sampledSurfaces::read(const dictionary& dict) dict.lookup("fields") >> fieldSelection_; clearFieldGroups(); - interpolationScheme_ = dict.lookupOrDefault - ( - "interpolationScheme", - "cell" - ); - writeFormat_ = dict.lookupOrDefault - ( - "surfaceFormat", - "null" - ); - + dict.lookup("interpolationScheme") >> interpolationScheme_; + dict.lookup("surfaceFormat") >> writeFormat_; // define the generic (geometry) writer genericFormatter_ = surfaceWriter::New(writeFormat_); From a96451570886a042fe3f1292e42ec851f0485b7b Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 12:04:38 +0000 Subject: [PATCH 11/26] BUG: sampledSet : force calculation of min-tet-decomposition before tracking --- src/sampling/sampledSet/face/faceOnlySet.C | 2 ++ src/sampling/sampledSet/polyLine/polyLineSet.C | 3 +++ src/sampling/sampledSet/uniform/uniformSet.C | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index 6e57ff528d..eaca4fb781 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -118,6 +118,8 @@ void Foam::faceOnlySet::calcSamples const vector smallVec = tol*offset; const scalar smallDist = mag(smallVec); + // Force calculation of minimum-tet decomposition. + (void) mesh().tetBasePtIs(); // Get all boundary intersections List bHits = searchEngine().intersections diff --git a/src/sampling/sampledSet/polyLine/polyLineSet.C b/src/sampling/sampledSet/polyLine/polyLineSet.C index a70e61e847..86c87d5a50 100644 --- a/src/sampling/sampledSet/polyLine/polyLineSet.C +++ b/src/sampling/sampledSet/polyLine/polyLineSet.C @@ -159,6 +159,9 @@ void Foam::polyLineSet::calcSamples oldPoint = sampleCoords_[sampleI]; } + // Force calculation of minimum-tet decomposition. + (void) mesh().tetBasePtIs(); + // current segment number label segmentI = 0; diff --git a/src/sampling/sampledSet/uniform/uniformSet.C b/src/sampling/sampledSet/uniform/uniformSet.C index 8487c9b886..fec3847b93 100644 --- a/src/sampling/sampledSet/uniform/uniformSet.C +++ b/src/sampling/sampledSet/uniform/uniformSet.C @@ -236,6 +236,9 @@ void Foam::uniformSet::calcSamples const vector smallVec = tol*offset; const scalar smallDist = mag(smallVec); + // Force calculation of minimum-tet decomposition. + (void) mesh().tetBasePtIs(); + // Get all boundary intersections List bHits = searchEngine().intersections ( From 6cd78ff36855d451512a55ffb0d66e5a5ea3aeed Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 16:00:59 +0000 Subject: [PATCH 12/26] ENH: tetrahedron : handle degenerate tets --- .../tetrahedron/tetrahedronI.H | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H index 0939c060e1..3a670f39a4 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/tetrahedron/tetrahedronI.H @@ -21,12 +21,11 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - \*---------------------------------------------------------------------------*/ #include "triangle.H" #include "IOstreams.H" +#include "triPointRef.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -152,7 +151,37 @@ inline Point tetrahedron::circumCentre() const vector ba = b ^ a; vector ca = c ^ a; - return a_ + 0.5*(a + (lambda*ba - mu*ca)/((c & ba) + ROOTVSMALL)); + vector num = lambda*ba - mu*ca; + scalar denom = (c & ba); + + if (Foam::mag(denom) < ROOTVSMALL) + { + // Degenerate tet. Use test of the individual triangles. + { + point triCentre = triPointRef(a_, b_, c_).circumCentre(); + if (magSqr(d_ - triCentre) < magSqr(a_ - triCentre)) + { + return triCentre; + } + } + { + point triCentre = triPointRef(a_, b_, d_).circumCentre(); + if (magSqr(c_ - triCentre) < magSqr(a_ - triCentre)) + { + return triCentre; + } + } + { + point triCentre = triPointRef(a_, c_, d_).circumCentre(); + if (magSqr(b_ - triCentre) < magSqr(a_ - triCentre)) + { + return triCentre; + } + } + return triPointRef(b_, c_, d_).circumCentre(); + } + + return a_ + 0.5*(a + num/denom); } From f7eed98dcb417584cb674b7e0ffec2a29c2c71b3 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 16:02:23 +0000 Subject: [PATCH 13/26] ENH: basicSourceIOList : set correct IOobject flag for re-reading --- .../fieldSources/basicSource/basicSource/IObasicSourceList.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C index 8ce372e8ff..864ed53770 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.C @@ -39,7 +39,7 @@ Foam::IObasicSourceList::IObasicSourceList "sourcesProperties", mesh.time().constant(), mesh, - IOobject::MUST_READ, + IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ), From bf9a9915ecc83ab9707ab8b97e0bfb06e8b18875 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 16:02:54 +0000 Subject: [PATCH 14/26] ENH: windTurbineFoam : roughtNutWallFunction needs scalarField for roughness --- tutorials/incompressible/simpleFoam/windTurbineTerrain/0/nut | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/0/nut b/tutorials/incompressible/simpleFoam/windTurbineTerrain/0/nut index dbff87ae2a..ae1244f70e 100644 --- a/tutorials/incompressible/simpleFoam/windTurbineTerrain/0/nut +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/0/nut @@ -37,8 +37,8 @@ boundaryField "terrain_.*" { type nutkRoughWallFunction; - Ks 0.2; //Ks = 20 Z0 - Cs 0.5; + Ks uniform 0.2; //Ks = 20 Z0 + Cs uniform 0.5; value uniform 0.0; } From cddfacb4cedd1cbffebd931457d8845e03dd7ada Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 8 Dec 2010 16:03:47 +0000 Subject: [PATCH 15/26] ENH: windTurbineTerrain: use cellZones, not cellSets so we can do parallel running --- .../windTurbineTerrain/constant/sourcesProperties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tutorials/incompressible/simpleFoam/windTurbineTerrain/constant/sourcesProperties b/tutorials/incompressible/simpleFoam/windTurbineTerrain/constant/sourcesProperties index 90b086769a..65578ad1e9 100644 --- a/tutorials/incompressible/simpleFoam/windTurbineTerrain/constant/sourcesProperties +++ b/tutorials/incompressible/simpleFoam/windTurbineTerrain/constant/sourcesProperties @@ -18,10 +18,10 @@ FoamFile disk1 { typeModel actuationDiskSource; - active on; // on/off switch - timeStart 0.0; // start time + active on; // on/off switch + timeStart 0.0; // start time duration 1000.0; // duration - selectionMode cellSet; // cellSet // points //cellZone + selectionMode cellZone; // cellSet // points //cellZone cellSet actuationDisk1; // cellSet name when selectionMode = cellSet cellZone actuationDisk1; // cellZone name when selectionMode = cellZone @@ -37,10 +37,10 @@ disk1 disk2 { typeModel actuationDiskSource; - active on; // on/off switch - timeStart 0.0; // start time + active on; // on/off switch + timeStart 0.0; // start time duration 1000.0; // duration - selectionMode cellSet; // cellSet // points //cellZone + selectionMode cellZone; // cellSet // points //cellZone cellSet actuationDisk2; // cellSet name when selectionMode = cellSet cellZone actuationDisk2; // cellZone name when selectionMode = cellZone From 262e6be2f84ade90e0b75e584faa9ce54cf217b8 Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 8 Dec 2010 16:20:43 +0000 Subject: [PATCH 16/26] ENH: new basicSolidThermo, solid -> pointSolid and solidMixture -> pointSolidMixture. chtMultiRegion tutorials and solvers --- .../chtMultiRegionFoam/Make/options | 1 + .../chtMultiRegionSimpleFoam/Make/options | 1 + .../solid/setRegionSolidFields.H | 2 +- .../solid/setRegionSolidFields.H | 3 +- .../solid/solidRegionDiffNo.C | 31 ++ .../solid/solidRegionDiffNo.H | 9 + .../chtMultiRegionFoam/solid/solveSolid.H | 2 + .../lagrangian/coalChemistryFoam/Make/options | 8 +- .../Make/options | 8 +- .../reactingParcelFilmFoam/Make/options | 8 +- .../reactingParcelFoam/Make/options | 8 +- .../steadyReactingParcelFoam/Make/options | 8 +- .../foamDebugSwitches/Make/options | 4 +- src/lagrangian/coalCombustion/Make/options | 8 +- src/lagrangian/intermediate/Make/options | 8 +- .../CompositionModel/CompositionModel.C | 2 +- .../CompositionModel/CompositionModel.H | 2 +- src/surfaceFilmModels/Make/options | 4 +- src/thermophysicalModels/Allwmake | 5 +- .../SLGThermo/Make/options | 4 +- .../SLGThermo/SLGThermo/SLGThermo.C | 6 +- .../SLGThermo/SLGThermo/SLGThermo.H | 6 +- .../basicSolidThermo/Make/files | 12 +- .../basicSolidThermo/Make/options | 7 +- .../basicSolidThermo/basicSolidThermo.C | 174 ++++++- .../basicSolidThermo/basicSolidThermo.H | 176 ++++--- .../basicSolidThermo/basicSolidThermoNew.C | 2 +- .../basicSolidThermo/newBasicSolidThermo.C | 77 +++ .../constSolidThermo/constSolidThermo.C | 203 +++----- .../constSolidThermo/constSolidThermo.H | 72 ++- .../directionalKSolidThermo.C | 493 ++++++++++++++++++ .../directionalKSolidThermo.H | 158 ++++++ .../interpolateSolid/interpolateSolid.C | 111 ++++ .../interpolateSolid/interpolateSolid.H | 104 ++++ .../interpolatedSolidThermo.C | 382 ++++---------- .../interpolatedSolidThermo.H | 78 ++- .../isotropicKSolidThermo.C | 129 +++++ .../isotropicKSolidThermo.H | 124 +++++ .../basicSolidMixture/basicSolidMixture.C | 105 ++++ .../basicSolidMixture/basicSolidMixture.H | 154 ++++++ .../basicSolidMixture/basicSolidMixtureI.H | 75 +++ .../multiComponentSolidMixture.C | 250 +++++++++ .../multiComponentSolidMixture.H | 141 +++++ .../reactingSolidMixture.C | 64 +++ .../reactingSolidMixture.H | 103 ++++ .../makeSolidMixtureThermo.H | 62 +++ .../solidMixtureThermo/solidMixtureThermo.C | 431 +++++++++++++++ .../solidMixtureThermo/solidMixtureThermo.H | 175 +++++++ .../solidMixtureThermo/solidMixtureThermos.C | 99 ++++ .../pointSolidMixture/Make/files | 3 + .../pointSolidMixture/Make/options | 3 + .../pointSolidMixture/pointSolidMixture.C | 128 +++++ .../pointSolidMixture/pointSolidMixture.H | 144 +++++ src/thermophysicalModels/pointSolids/C/C.C | 95 ++++ src/thermophysicalModels/pointSolids/C/C.H | 111 ++++ .../pointSolids/CaCO3/CaCO3.C | 95 ++++ .../pointSolids/CaCO3/CaCO3.H | 113 ++++ .../pointSolids/Make/files | 8 + .../pointSolids/Make/options | 3 + .../pointSolids/ash/ash.C | 95 ++++ .../pointSolids/ash/ash.H | 113 ++++ .../pointSolids/pointSolid/pointSolid.C | 108 ++++ .../pointSolids/pointSolid/pointSolid.H | 210 ++++++++ .../pointSolids/pointSolid/pointSolidI.H | 72 +++ .../pointSolids/pointSolid/pointSolidNew.C | 132 +++++ src/thermophysicalModels/solid/Make/files | 8 + src/thermophysicalModels/solid/Make/options | 2 + .../solid/include/solidThermoPhysicsTypes.H | 71 +++ .../solid/radiation/const/constSolidRad.C | 72 +++ .../solid/radiation/const/constSolidRad.H | 139 +++++ .../solid/radiation/const/constSolidRadI.H | 109 ++++ .../IrreversibleSolidReaction.C | 92 ++++ .../IrreversibleSolidReaction.H | 139 +++++ .../Reactions/solidReaction/solidReaction.C | 325 ++++++++++++ .../Reactions/solidReaction/solidReaction.H | 254 +++++++++ .../Reactions/solidReaction/solidReactionI.H | 76 +++ .../solidArrheniusReactionRate.H | 117 +++++ .../solidArrheniusReactionRateI.H | 90 ++++ .../reactions/makeSolidReactionThermo.H | 83 +++ .../makeSolidReactionThermoReactions.C | 42 ++ .../solid/rhoType/const/constRho.C | 47 ++ .../solid/rhoType/const/constRho.H | 104 ++++ .../solid/rhoType/const/constRhoI.H | 67 +++ .../solid/thermo/const/constSolidThermo.C | 61 +++ .../solid/thermo/const/constSolidThermo.H | 142 +++++ .../solid/thermo/const/constSolidThermoI.H | 119 +++++ .../exponential/exponentialSolidThermo.C | 73 +++ .../exponential/exponentialSolidThermo.H | 151 ++++++ .../exponential/exponentialSolidThermoI.H | 141 +++++ .../transport/const/constSolidTransport.C | 57 ++ .../transport/const/constSolidTransport.H | 128 +++++ .../transport/const/constSolidTransportI.H | 75 +++ .../exponential/exponentialSolidTransport.C | 69 +++ .../exponential/exponentialSolidTransport.H | 139 +++++ .../exponential/exponentialSolidTransportI.H | 84 +++ .../multiRegionHeater/0/Ychar | 30 ++ .../multiRegionHeater/0/Ypmma | 30 ++ .../multiRegionHeater/Allrun | 12 +- .../heater/solidThermophysicalProperties | 110 +++- .../multiRegionHeater/system/controlDict | 2 +- .../system/heater/changeDictionaryDict | 30 ++ .../system/leftSolid/changeDictionaryDict | 30 ++ .../system/rightSolid/changeDictionaryDict | 30 ++ .../multiRegionLiquidHeater/0/Ychar | 30 ++ .../multiRegionLiquidHeater/0/Ypmma | 30 ++ .../multiRegionLiquidHeater/Allrun | 10 +- .../heater/solidThermophysicalProperties | 108 +++- .../system/heater/changeDictionaryDict | 31 ++ .../system/leftSolid/changeDictionaryDict | 28 + .../system/rightSolid/changeDictionaryDict | 30 +- .../snappyMultiRegionHeater/0/Ychar | 30 ++ .../snappyMultiRegionHeater/0/Ypmma | 30 ++ .../snappyMultiRegionHeater/Allrun | 10 +- .../heater/solidThermophysicalProperties | 108 +++- .../leftSolid/solidThermophysicalProperties | 77 +-- .../rightSolid/solidThermophysicalProperties | 77 +-- .../system/heater/changeDictionaryDict | 30 ++ .../system/leftSolid/changeDictionaryDict | 30 ++ .../system/rightSolid/changeDictionaryDict | 30 ++ .../multiRegionHeater/0/Ychar | 30 ++ .../multiRegionHeater/0/Ypmma | 30 ++ .../multiRegionHeater/Allrun | 10 +- .../heater/solidThermophysicalProperties | 110 +++- .../leftSolid/solidThermophysicalProperties | 77 +-- .../rightSolid/solidThermophysicalProperties | 77 +-- .../system/heater/changeDictionaryDict | 30 ++ .../system/leftSolid/changeDictionaryDict | 30 ++ .../system/rightSolid/changeDictionaryDict | 30 ++ .../t-junction/constant/polyMesh/boundary | 46 ++ .../rhoPisoTwinParcelFoam/Make/options | 4 +- 130 files changed, 9045 insertions(+), 1000 deletions(-) create mode 100644 src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C create mode 100644 src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C create mode 100644 src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H create mode 100644 src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C create mode 100644 src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H create mode 100644 src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C create mode 100644 src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H create mode 100644 src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C create mode 100644 src/thermophysicalModels/pointSolidMixture/Make/files create mode 100644 src/thermophysicalModels/pointSolidMixture/Make/options create mode 100644 src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C create mode 100644 src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H create mode 100644 src/thermophysicalModels/pointSolids/C/C.C create mode 100644 src/thermophysicalModels/pointSolids/C/C.H create mode 100644 src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C create mode 100644 src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H create mode 100644 src/thermophysicalModels/pointSolids/Make/files create mode 100644 src/thermophysicalModels/pointSolids/Make/options create mode 100644 src/thermophysicalModels/pointSolids/ash/ash.C create mode 100644 src/thermophysicalModels/pointSolids/ash/ash.H create mode 100644 src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C create mode 100644 src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H create mode 100644 src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H create mode 100644 src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C create mode 100644 src/thermophysicalModels/solid/Make/files create mode 100644 src/thermophysicalModels/solid/Make/options create mode 100644 src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H create mode 100644 src/thermophysicalModels/solid/radiation/const/constSolidRad.C create mode 100644 src/thermophysicalModels/solid/radiation/const/constSolidRad.H create mode 100644 src/thermophysicalModels/solid/radiation/const/constSolidRadI.H create mode 100644 src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C create mode 100644 src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H create mode 100644 src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C create mode 100644 src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.H create mode 100644 src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReactionI.H create mode 100644 src/thermophysicalModels/solid/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRate.H create mode 100644 src/thermophysicalModels/solid/reaction/reactionRate/solidArrheniusReactionRate/solidArrheniusReactionRateI.H create mode 100644 src/thermophysicalModels/solid/reaction/reactions/makeSolidReactionThermo.H create mode 100644 src/thermophysicalModels/solid/reaction/reactions/makeSolidReactionThermoReactions.C create mode 100644 src/thermophysicalModels/solid/rhoType/const/constRho.C create mode 100644 src/thermophysicalModels/solid/rhoType/const/constRho.H create mode 100644 src/thermophysicalModels/solid/rhoType/const/constRhoI.H create mode 100644 src/thermophysicalModels/solid/thermo/const/constSolidThermo.C create mode 100644 src/thermophysicalModels/solid/thermo/const/constSolidThermo.H create mode 100644 src/thermophysicalModels/solid/thermo/const/constSolidThermoI.H create mode 100644 src/thermophysicalModels/solid/thermo/exponential/exponentialSolidThermo.C create mode 100644 src/thermophysicalModels/solid/thermo/exponential/exponentialSolidThermo.H create mode 100644 src/thermophysicalModels/solid/thermo/exponential/exponentialSolidThermoI.H create mode 100644 src/thermophysicalModels/solid/transport/const/constSolidTransport.C create mode 100644 src/thermophysicalModels/solid/transport/const/constSolidTransport.H create mode 100644 src/thermophysicalModels/solid/transport/const/constSolidTransportI.H create mode 100644 src/thermophysicalModels/solid/transport/exponential/exponentialSolidTransport.C create mode 100644 src/thermophysicalModels/solid/transport/exponential/exponentialSolidTransport.H create mode 100644 src/thermophysicalModels/solid/transport/exponential/exponentialSolidTransportI.H create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ychar create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/0/Ypmma create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/0/Ychar create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/0/Ypmma create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ychar create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/0/Ypmma mode change 100644 => 120000 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/leftSolid/solidThermophysicalProperties mode change 100644 => 120000 tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/constant/rightSolid/solidThermophysicalProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ychar create mode 100644 tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/0/Ypmma mode change 100644 => 120000 tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/leftSolid/solidThermophysicalProperties mode change 100644 => 120000 tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/constant/rightSolid/solidThermophysicalProperties create mode 100644 tutorials/incompressible/pimpleFoam/t-junction/constant/polyMesh/boundary diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options index 71580ca21d..636fc5d8bb 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options index a255d65f6c..599e1e7502 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H index 1e78cc297a..179480249d 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H @@ -4,7 +4,7 @@ tmp trho = thermo.rho(); const volScalarField& rho = trho(); - tmp tcp = thermo.cp(); + tmp tcp = thermo.Cp(); const volScalarField& cp = tcp(); tmp tK = thermo.K(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index 1e78cc297a..a843ed8bd7 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -4,11 +4,12 @@ tmp trho = thermo.rho(); const volScalarField& rho = trho(); - tmp tcp = thermo.cp(); + tmp tcp = thermo.Cp(); const volScalarField& cp = tcp(); tmp tK = thermo.K(); //tmp tK = thermo.directionalK(); const volScalarField& K = tK(); + //const volSymmTensorField& K = tK(); volScalarField& T = thermo.T(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C index c0a5277e88..322628b9ec 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C @@ -55,4 +55,35 @@ Foam::scalar Foam::solidRegionDiffNo } +Foam::scalar Foam::solidRegionDiffNo +( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& Cprho, + const volSymmTensorField& Kdirectional +) +{ + scalar DiNum = 0.0; + scalar meanDiNum = 0.0; + + volScalarField K = mag(Kdirectional); + + //- Take care: can have fluid domains with 0 cells so do not test for + // zero internal faces. + surfaceScalarField KrhoCpbyDelta = + mesh.surfaceInterpolation::deltaCoeffs() + * fvc::interpolate(K) + / fvc::interpolate(Cprho); + + DiNum = gMax(KrhoCpbyDelta.internalField())*runTime.deltaT().value(); + + meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value(); + + Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum + << " max: " << DiNum << endl; + + return DiNum; +} + + // ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H index 333ef7a3eb..afb21252ac 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H @@ -41,6 +41,15 @@ namespace Foam const volScalarField& Cprho, const volScalarField& K ); + + scalar solidRegionDiffNo + ( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& Cprho, + const volSymmTensorField& K + ); + } #endif diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index 05b26d1626..d8aa03283b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -18,6 +18,8 @@ if (finalIter) Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl; } +thermo.correct(); + if (finalIter) { mesh.data::remove("finalIteration"); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options index c6daa2b570..329dffc84d 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options +++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options @@ -10,8 +10,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -33,8 +33,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options index 6e117fc63b..7596b87bbd 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options @@ -10,8 +10,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -32,8 +32,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options index 230a08dfad..34867be0b4 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options @@ -5,8 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ @@ -26,8 +26,8 @@ EXE_LIBS = \ -lcompressibleLESModels \ -lspecie \ -lbasicThermophysicalModels \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index 3954a34ea3..2dbb2590f7 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -9,8 +9,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -31,8 +31,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options b/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options index 6e117fc63b..7596b87bbd 100644 --- a/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options @@ -10,8 +10,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -32,8 +32,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options index b43dc7a7d1..804d519386 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options +++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options @@ -47,9 +47,9 @@ EXE_LIBS = \ -lrandomProcesses \ -lreactionThermophysicalModels \ -lsampling \ - -lsolidMixture \ + -lpointSolidMixture \ -lsolidParticle \ - -lsolids \ + -lpointSolids \ -lspecie \ -lsurfMesh \ -lsystemCall \ diff --git a/src/lagrangian/coalCombustion/Make/options b/src/lagrangian/coalCombustion/Make/options index 2dabd03766..763b6cc248 100644 --- a/src/lagrangian/coalCombustion/Make/options +++ b/src/lagrangian/coalCombustion/Make/options @@ -8,8 +8,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ @@ -30,8 +30,8 @@ LIB_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lreactionThermophysicalModels \ -lSLGThermo \ -lcompressibleRASModels \ diff --git a/src/lagrangian/intermediate/Make/options b/src/lagrangian/intermediate/Make/options index 7a20845453..db20632300 100644 --- a/src/lagrangian/intermediate/Make/options +++ b/src/lagrangian/intermediate/Make/options @@ -7,8 +7,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ @@ -27,8 +27,8 @@ LIB_LIBS = \ -lpdf \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lspecie \ -lbasicThermophysicalModels \ -lreactionThermophysicalModels \ diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 6cf80b2c17..2e88774afa 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -100,7 +100,7 @@ const Foam::liquidMixture& Foam::CompositionModel::liquids() const template -const Foam::solidMixture& Foam::CompositionModel::solids() const +const Foam::pointSolidMixture& Foam::CompositionModel::solids() const { return thermo_.solids(); } diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index 7becea4551..74a4a87a20 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -143,7 +143,7 @@ public: const liquidMixture& liquids() const; //- Return the global (additional) solids - const solidMixture& solids() const; + const pointSolidMixture& solids() const; //- Return the list of phase properties const phasePropertiesList& phaseProps() const; diff --git a/src/surfaceFilmModels/Make/options b/src/surfaceFilmModels/Make/options index bd04197ec3..3b0199a09b 100644 --- a/src/surfaceFilmModels/Make/options +++ b/src/surfaceFilmModels/Make/options @@ -5,8 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \ diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 07ac10719b..7b1b586b56 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -3,11 +3,12 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake libso specie +wmake libso solid wmake libso thermophysicalFunctions wmake libso liquids wmake libso liquidMixture -wmake libso solids -wmake libso solidMixture +wmake libso pointSolids +wmake libso pointSolidMixture wmake libso basic wmake libso reactionThermo diff --git a/src/thermophysicalModels/SLGThermo/Make/options b/src/thermophysicalModels/SLGThermo/Make/options index 4a54dad0d4..6121f1c83e 100644 --- a/src/thermophysicalModels/SLGThermo/Make/options +++ b/src/thermophysicalModels/SLGThermo/Make/options @@ -4,8 +4,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude LIB_LIBS = \ diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C index 5eb9dffedc..ce9048a5ac 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C @@ -72,7 +72,7 @@ Foam::SLGThermo::SLGThermo(const fvMesh& mesh, basicThermo& thermo) if (thermo.found("solids")) { - solids_ = solidMixture::New(thermo.subDict("solids")); + solids_ = pointSolidMixture::New(thermo.subDict("solids")); Info<< " solids - " << solids_->components().size() << " components" << endl; } @@ -128,13 +128,13 @@ const Foam::liquidMixture& Foam::SLGThermo::liquids() const } -const Foam::solidMixture& Foam::SLGThermo::solids() const +const Foam::pointSolidMixture& Foam::SLGThermo::solids() const { if (!solids_.valid()) { FatalErrorIn ( - "const Foam::solidMixture& Foam::SLGThermo::solids() const" + "const Foam::pointSolidtMixture& Foam::SLGThermo::solids() const" ) << "solids requested, but object is not allocated" << abort(FatalError); } diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H index 36fb8f3bb3..f4ba8299a8 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H @@ -49,7 +49,7 @@ SourceFiles #include "basicThermo.H" #include "basicMultiComponentMixture.H" #include "liquidMixture.H" -#include "solidMixture.H" +#include "pointSolidMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -76,7 +76,7 @@ class SLGThermo autoPtr liquids_; //- Additional solid properties data - autoPtr solids_; + autoPtr solids_; public: @@ -108,7 +108,7 @@ public: const liquidMixture& liquids() const; //- Return reference to the global (additional) solids - const solidMixture& solids() const; + const pointSolidMixture& solids() const; // Index retrieval diff --git a/src/thermophysicalModels/basicSolidThermo/Make/files b/src/thermophysicalModels/basicSolidThermo/Make/files index e550ce2035..c5e9c11d42 100644 --- a/src/thermophysicalModels/basicSolidThermo/Make/files +++ b/src/thermophysicalModels/basicSolidThermo/Make/files @@ -1,7 +1,13 @@ -constSolidThermo/constSolidThermo.C -directionalSolidThermo/directionalSolidThermo.C basicSolidThermo/basicSolidThermo.C -basicSolidThermo/basicSolidThermoNew.C +basicSolidThermo/newBasicSolidThermo.C + +constSolidThermo/constSolidThermo.C +directionalKSolidThermo/directionalKSolidThermo.C interpolatedSolidThermo/interpolatedSolidThermo.C +interpolatedSolidThermo/interpolateSolid/interpolateSolid.C +isotropicKSolidThermo/isotropicKSolidThermo.C + +solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C +solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C LIB = $(FOAM_LIBBIN)/libbasicSolidThermo diff --git a/src/thermophysicalModels/basicSolidThermo/Make/options b/src/thermophysicalModels/basicSolidThermo/Make/options index f3070a731e..e2cff82d80 100644 --- a/src/thermophysicalModels/basicSolidThermo/Make/options +++ b/src/thermophysicalModels/basicSolidThermo/Make/options @@ -1,7 +1,10 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude LIB_LIBS = \ -lmeshTools \ - -lfiniteVolume + -lfiniteVolume \ + -lsolid diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C index e0c65a91d7..2888eeea17 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,10 +23,11 @@ License \*---------------------------------------------------------------------------*/ - #include "basicSolidThermo.H" +#include "fvMesh.H" +#include "HashTable.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ namespace Foam { @@ -34,6 +35,7 @@ namespace Foam defineRunTimeSelectionTable(basicSolidThermo, mesh); } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) @@ -45,7 +47,7 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) "solidThermophysicalProperties", mesh.time().constant(), mesh, - IOobject::MUST_READ_IF_MODIFIED, + IOobject::MUST_READ, IOobject::NO_WRITE ) ), @@ -61,7 +63,60 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) IOobject::AUTO_WRITE ), mesh + ), + rho_ + ( + IOobject + ( + "rho", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimMass/dimVolume + ), + kappa_ + ( + IOobject + ( + "kappa", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless/dimLength + ), + sigmaS_ + ( + IOobject + ( + "sigmaS", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless/dimLength + ), + emissivity_ + ( + IOobject + ( + "emissivity", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless ) + {} @@ -73,6 +128,117 @@ Foam::basicSolidThermo::~basicSolidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::volScalarField& Foam::basicSolidThermo::T() +{ + return T_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::T() const +{ + return T_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::rho() const +{ + return rho_; +} + + +Foam::volScalarField& Foam::basicSolidThermo::rho() +{ + return rho_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::kappa() const +{ + return kappa_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::sigmaS() const +{ + return sigmaS_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::emissivity() const +{ + return emissivity_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::K() const +{ + notImplemented("basicSolidThermo::K()"); + return volScalarField::null(); +} + + +const Foam::volSymmTensorField& Foam::basicSolidThermo::directionalK() const +{ + notImplemented("basicSolidThermo::directionalK()"); + return const_cast(volSymmTensorField::null()); +} + + +Foam::basicSolidMixture& Foam::basicSolidThermo::composition() +{ + notImplemented("basicSolidThermo::composition()"); + return *reinterpret_cast(0); +} + + +const Foam::basicSolidMixture& Foam::basicSolidThermo::composition() const +{ + notImplemented("basicSolidThermo::composition() const"); + return *reinterpret_cast(0); +} + + +Foam::tmp Foam::basicSolidThermo::hs() const +{ + notImplemented("basicSolidThermo::hs()"); + return volScalarField::null(); +} + + +Foam::tmp Foam::basicSolidThermo::hs(const label patchI) +const +{ + notImplemented("basicSolidThermo::hs(const label)"); + return scalarField::null(); +} + + +Foam::tmp Foam::basicSolidThermo::K +( + const label patchI +)const +{ + notImplemented("basicSolidThermo::K(const label)"); + return scalarField::null(); +} + + +Foam::tmp Foam::basicSolidThermo::directionalK +( + const label +)const +{ + notImplemented("basicSolidThermo::directionalK(const label)"); + return symmTensorField::null(); +} + + +bool Foam::basicSolidThermo::read() +{ + return regIOobject::read(); +} + + bool Foam::basicSolidThermo::writeData(Ostream& os) const { return true; diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H index ddd2750668..cc12c10e11 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,20 +25,24 @@ Class Foam::basicSolidThermo Description - The thermophysical properties of a basicSolidThermo + + Basic solid thermodynamic properties SourceFiles basicSolidThermo.C - newBasicSolidThermo.C + newBasicThermo.C \*---------------------------------------------------------------------------*/ #ifndef basicSolidThermo_H #define basicSolidThermo_H -#include "runTimeSelectionTables.H" #include "volFields.H" +#include "runTimeSelectionTables.H" #include "fvMesh.H" +#include "IOdictionary.H" +#include "autoPtr.H" +#include "basicSolidMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,21 +50,36 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class basicSolidThermo Declaration + Class basicSolidThermo Declaration \*---------------------------------------------------------------------------*/ class basicSolidThermo : public IOdictionary { + protected: // Protected data const fvMesh& mesh_; - //- Temperature [K] - volScalarField T_; + // Fields + + //- Temperature [K] + volScalarField T_; + + //- Density [kg/m3] + volScalarField rho_; + + //- Absorption coefficient [1/m] + volScalarField kappa_; + + //- Scatter coeffcient [1/m] + volScalarField sigmaS_; + + //- Emissivity coeffcient [] + volScalarField emissivity_; public: @@ -68,8 +87,7 @@ public: //- Runtime type information TypeName("basicSolidThermo"); - - //- Declare run-time constructor selection tables + // Declare run-time constructor selection tables declareRunTimeSelectionTable ( autoPtr, @@ -91,100 +109,106 @@ public: //- Destructor - virtual ~basicSolidThermo(); + + virtual ~basicSolidThermo(); - // Member Functions + // Member functions //- Update properties virtual void correct() = 0; + //- Return the composition of the solid mixture + virtual basicSolidMixture& composition(); - // Physical constants which define the basicSolidThermo + //- Return the composition of the solid mixture + virtual const basicSolidMixture& composition() const; + + + // Access to thermodynamic state variables + + //- Density [kg/m^3] + const volScalarField& rho() const; + + //- Thermal conductivity [W/m/K] + virtual const volScalarField& K() const; + + //- Thermal conductivity [W/m/K] + virtual const volSymmTensorField& directionalK() const; + + //- Absorption coefficient [1/m] + const volScalarField& kappa() const; + + //- Emissivity coefficient + const volScalarField& sigmaS() const; + + //- Emissivity coefficient [1/m] + const volScalarField& emissivity() const; //- Temperature [K] - inline const volScalarField& T() const; + const volScalarField& T() const; - //- Temperature [K] - inline volScalarField& T(); + //- non-const access for T + volScalarField& T(); - //- Density [kg/m3] - virtual tmp rho() const = 0; + //- non-const access for rho + volScalarField& rho(); - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp() const = 0; - //- Thermal conductivity [W/(m.K)] - virtual tmp K() const = 0; + // Derived thermal properties - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK() const = 0; + //- Specific heat capacity [J/kg/K] + virtual tmp Cp() const = 0; - //- Heat of formation [J/kg] + //- Sensible enthalpy [J/kg] + virtual tmp hs() const; + + //- Heat of formation [J/kg] virtual tmp Hf() const = 0; + + // Per patch calculation + + //- Density [kg/m3] + virtual tmp rho(const label patchI) const = 0; + + //- Specific heat capacity [J/kg/K)] + virtual tmp Cp(const label patchI) const = 0; + + //- Sensible enthalpy [J/kg] + virtual tmp hs(const label patchI) const; + + //- Thermal conductivity [W//m/K] + virtual tmp K(const label patchI) const; + + //- Thermal conductivity [W//m/K] + virtual tmp directionalK(const label) const; + + //- Heat of formation [J/kg] + virtual tmp Hf(const label patchI) const = 0; + + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label) const = 0; + + //- Absorption coefficient [1/m] + virtual tmp kappa(const label) const = 0; + //- Emissivity [] - virtual tmp emissivity() const = 0; + virtual tmp emissivity(const label) const = 0; + // I-O - // Per patch calculation - - //- Density [kg/m3] - virtual tmp rho(const label patchI) const = 0; - - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp(const label patchI) const = 0; - - //- Thermal conductivity [W/(m.K)] - virtual tmp K(const label patchI) const = 0; - - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK(const label) const =0; - - //- Heat of formation [J/kg] - virtual tmp Hf(const label patchI) const = 0; - - //- Emissivity [] - virtual tmp emissivity(const label) const = 0; - - -// // Point wise properties -// -// //- Density [kg/m3] -// virtual scalar rho(const scalar T) const = 0; -// -// //- Specific heat capacity [J/(kg.K)] -// virtual scalar cp(const scalar T) const = 0; -// -// //- Thermal conductivity [W/(m.K)] -// virtual scalar K(const scalar T) const = 0; -// -// //- Heat of formation [J/kg] -// virtual scalar Hf(const scalar T) const = 0; -// -// //- Emissivity [] -// virtual scalar emissivity(const scalar T) const = 0; - - - // I-O - - //- Write the basicSolidThermo properties - virtual bool writeData(Ostream& os) const = 0; - - //- Read solidThermophysicalProperties dictionary - virtual bool read() = 0; + //- Write the basicSolidThermo properties + virtual bool writeData(Ostream& os) const = 0; + //- Read thermophysicalProperties dictionary + virtual bool read() = 0; // Ostream Operator - friend Ostream& operator<<(Ostream& os, const basicSolidThermo& s); }; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "basicSolidThermoI.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C index 34d3400a03..a398516f2a 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C new file mode 100644 index 0000000000..b308cfea1e --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "basicSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::basicSolidThermo::New +( + const fvMesh& mesh +) +{ + if (debug) + { + Info<< "basicSolidThermo::New(const fvMesh&): " + << "constructing basicSolidThermo" + << endl; + } + + const word thermoType + ( + IOdictionary + ( + IOobject + ( + "solidThermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).lookup("thermoType") + ); + + meshConstructorTable::iterator cstrIter = + meshConstructorTablePtr_->find(thermoType); + + if (cstrIter == meshConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "basicSolidThermo::New(const fvMesh&, const word&)" + ) << "Unknown solidThermo type " << thermoType + << endl << endl + << "Valid solidThermo types are :" << endl + << meshConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(mesh)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C index 0f9f65d2b0..abe9b7c5d0 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,14 +40,39 @@ namespace Foam Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh) : basicSolidThermo(mesh), - constRho_("zero", dimDensity, 0.0), - constCp_("zero", dimEnergy/(dimMass*dimTemperature), 0.0), - constK_("zero", dimEnergy/dimTime/(dimLength*dimTemperature), 0.0), - constHf_("zero", dimEnergy/dimMass, 0.0), - constEmissivity_("zero", dimless, 0.0) + dict_(subDict(typeName + "Coeffs")), + constK_(dimensionedScalar(dict_.lookup("K"))), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + constK_ + ), + constRho_(dimensionedScalar(dict_.lookup("rho"))), + constCp_(dimensionedScalar(dict_.lookup("Cp"))), + constHf_(dimensionedScalar(dict_.lookup("Hf"))), + constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))), + constKappa_(dimensionedScalar(dict_.lookup("kappa"))), + constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS"))) { read(); - correct(); + + K_ = constK_; + + rho_ = constRho_; + + emissivity_ = constEmissivity_; + + kappa_ = constKappa_; + + sigmaS_ = constSigmaS_; } @@ -63,7 +88,7 @@ void Foam::constSolidThermo::correct() {} -Foam::tmp Foam::constSolidThermo::rho() const +Foam::tmp Foam::constSolidThermo::Cp() const { return tmp ( @@ -71,28 +96,7 @@ Foam::tmp Foam::constSolidThermo::rho() const ( IOobject ( - "rho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - constRho_ - ) - ); -} - - -Foam::tmp Foam::constSolidThermo::cp() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "cp", + "Cp", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -105,79 +109,13 @@ Foam::tmp Foam::constSolidThermo::cp() const } -//Foam::tmp Foam::constSolidThermo::K() const -//{ -// vector v(eigenValues(constK_.value())); -// -// if (mag(v.x() - v.z()) > SMALL) -// { -// FatalErrorIn("directionalSolidThermo::K() const") -// << "Supplied K " << constK_ -// << " are not isotropic. Eigenvalues are " -// << v << exit(FatalError); -// } -// -// return tmp -// ( -// new volScalarField -// ( -// IOobject -// ( -// "K", -// mesh_.time().timeName(), -// mesh_, -// IOobject::NO_READ, -// IOobject::NO_WRITE -// ), -// mesh_, -// v.x() -// ) -// ); -//} - - -Foam::tmp Foam::constSolidThermo::K() const +const Foam::volScalarField& Foam::constSolidThermo::K() const { - return tmp - ( - new volScalarField - ( - IOobject - ( - "K", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - constK_ - ) - ); + return K_; } -//Foam::tmp Foam::constSolidThermo::directionalK() -//const -//{ -// return tmp -// ( -// new volSymmTensorField -// ( -// IOobject -// ( -// "K", -// mesh_.time().timeName(), -// mesh_, -// IOobject::NO_READ, -// IOobject::NO_WRITE -// ), -// mesh_, -// constK_ -// ) -// ); -//} -Foam::tmp Foam::constSolidThermo::directionalK() const +const Foam::volSymmTensorField& Foam::constSolidThermo::directionalK() const { dimensionedSymmTensor t ( @@ -233,27 +171,6 @@ Foam::tmp Foam::constSolidThermo::Hf() const } -Foam::tmp Foam::constSolidThermo::emissivity() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "emissivity", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - constEmissivity_ - ) - ); -} - - Foam::tmp Foam::constSolidThermo::rho ( const label patchI @@ -270,7 +187,7 @@ Foam::tmp Foam::constSolidThermo::rho } -Foam::tmp Foam::constSolidThermo::cp +Foam::tmp Foam::constSolidThermo::Cp ( const label patchI ) const @@ -359,6 +276,38 @@ Foam::tmp Foam::constSolidThermo::emissivity } +Foam::tmp Foam::constSolidThermo::kappa +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + T_.boundaryField()[patchI].size(), + constKappa_.value() + ) + ); +} + + +Foam::tmp Foam::constSolidThermo::sigmaS +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + T_.boundaryField()[patchI].size(), + constSigmaS_.value() + ) + ); +} + + bool Foam::constSolidThermo::read() { return read(subDict(typeName + "Coeffs")); @@ -368,17 +317,21 @@ bool Foam::constSolidThermo::read() bool Foam::constSolidThermo::read(const dictionary& dict) { constRho_ = dimensionedScalar(dict.lookup("rho")); - constCp_ = dimensionedScalar(dict.lookup("cp")); + constCp_ = dimensionedScalar(dict.lookup("Cp")); constK_ = dimensionedScalar(dict.lookup("K")); constHf_ = dimensionedScalar(dict.lookup("Hf")); constEmissivity_ = dimensionedScalar(dict.lookup("emissivity")); + constKappa_ = dimensionedScalar(dict_.lookup("kappa")); + constSigmaS_ = dimensionedScalar(dict_.lookup("sigmaS")); Info<< "Constructed constSolidThermo with" << nl << " rho : " << constRho_ << nl - << " cp : " << constCp_ << nl + << " Cp : " << constCp_ << nl << " K : " << constK_ << nl << " Hf : " << constHf_ << nl << " emissivity : " << constEmissivity_ << nl + << " kappa : " << constKappa_ << nl + << " sigmaS : " << constSigmaS_ << nl << endl; return true; @@ -389,9 +342,11 @@ bool Foam::constSolidThermo::writeData(Ostream& os) const { bool ok = basicSolidThermo::writeData(os); os.writeKeyword("rho") << constRho_ << token::END_STATEMENT << nl; - os.writeKeyword("cp") << constCp_ << token::END_STATEMENT << nl; + os.writeKeyword("Cp") << constCp_ << token::END_STATEMENT << nl; os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl; os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << constKappa_ << token::END_STATEMENT << nl; + os.writeKeyword("sigmaS") << constSigmaS_ << token::END_STATEMENT << nl; os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT << nl; return ok && os.good(); diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H index 41b92bd18d..33966637db 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,22 +50,38 @@ class constSolidThermo : public basicSolidThermo { +private: + + // Private data + + //- Dictionary + dictionary dict_; + + //- Constant thermal conductivity [W/(m.K)] + dimensionedScalar constK_; + + //- Thermal conductivity field[W/(m.K)] + volScalarField K_; + //- Density [kg/m3] dimensionedScalar constRho_; //- Specific heat capacity [J/(kg.K)] dimensionedScalar constCp_; - //- Thermal conductivity [W/(m.K)] - //dimensionedSymmTensor constK_; - dimensionedScalar constK_; - //- Heat of formation [J/kg] dimensionedScalar constHf_; //- Emissivity dimensionedScalar constEmissivity_; + //- Absorptivity [1/m] + dimensionedScalar constKappa_; + + //- Scatter [1/m] + dimensionedScalar constSigmaS_; + + public: //- Runtime type information @@ -77,9 +93,8 @@ public: //- Construct from mesh constSolidThermo(const fvMesh& mesh); - // Destructor - - virtual ~constSolidThermo(); + //- Destructor + virtual ~constSolidThermo(); // Member Functions @@ -87,24 +102,23 @@ public: //- Update properties virtual void correct(); - //- Density [kg/m3] - virtual tmp rho() const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp() const; + // Acces functions + + //- Constant access to K + virtual const volScalarField& K() const; //- Thermal conductivity [W/(m.K)] - // Note: needs supplied K to be isotropic - virtual tmp K() const; + virtual const volSymmTensorField& directionalK() const; - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK() const; - //- Heat of formation [J/kg] - virtual tmp Hf() const; + // Derived properties - //- Emissivity [] - virtual tmp emissivity() const; + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp() const; + + //- Heat of formation [J/kg] + virtual tmp Hf() const; // Per patch calculation @@ -112,19 +126,25 @@ public: //- Density [kg/m3] virtual tmp rho(const label patchI) const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp(const label patchI) const; + //- Specific heat capacity [J/kg/K)] + virtual tmp Cp(const label patchI) const; - //- Thermal conductivity [W/(m.K)] + //- Thermal conductivity [W//m/K] virtual tmp K(const label patchI) const; - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK(const label patchI) const; + //- Thermal conductivity [W//m/K] + virtual tmpdirectionalK(const label) const; //- Heat of formation [J/kg] virtual tmp Hf(const label patchI) const; - //- Emissivity [] + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label) const; + + //- Absorption coefficient [1/m] + virtual tmp kappa(const label) const; + + //- Emissivity [] virtual tmp emissivity(const label) const; diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C new file mode 100644 index 0000000000..1e06ece31a --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C @@ -0,0 +1,493 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "directionalKSolidThermo.H" +#include "addToRunTimeSelectionTable.H" +#include "transform.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(directionalKSolidThermo, 0); + addToRunTimeSelectionTable + ( + basicSolidThermo, + directionalKSolidThermo, + mesh + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs"), + directionalK_ + ( + IOobject + ( + "K", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + ccTransforms_ + ( + IOobject + ( + "ccTransforms", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimLength + ) +{ + KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + + // Determine transforms for cell centres + forAll(mesh.C(), cellI) + { + vector dir = mesh.C()[cellI] - coordSys_.origin(); + dir /= mag(dir); + + // Define local coordinate system with + // - e1 : axis from cc to centre + // - e3 : rotation axis + coordinateSystem cs + ( + "cc", + coordSys_.origin(), + coordSys_.e3(), //z',e3 + dir //x',e1 + ); + + ccTransforms_[cellI] = cs.R(); + } + + forAll(mesh.C().boundaryField(), patchI) + { + const fvPatchVectorField& patchC = mesh.C().boundaryField()[patchI]; + fvPatchTensorField& patchT = ccTransforms_.boundaryField()[patchI]; + + tensorField tc(patchT.size()); + forAll(tc, i) + { + vector dir = patchC[i] - coordSys_.origin(); + dir /= mag(dir); + + coordinateSystem cs + ( + "cc", + coordSys_.origin(), + coordSys_.e3(), //z',e3 + dir //x',e1 + ); + + tc[i] = cs.R(); + } + patchT = tc; + } + + if (debug) + { + Info<< "directionalKSolidThermo : dumping converted Kxx, Kyy, Kzz" + << endl; + { + volVectorField Kxx + ( + IOobject + ( + "Kxx", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimless + ); + Kxx.internalField() = transform + ( + ccTransforms_.internalField(), + vectorField + ( + ccTransforms_.internalField().size(), + point(1, 0, 0) + ) + ); + forAll(Kxx.boundaryField(), patchI) + { + Kxx.boundaryField()[patchI] = transform + ( + ccTransforms_.boundaryField()[patchI], + vectorField + ( + ccTransforms_.boundaryField()[patchI].size(), + point(1, 0, 0) + ) + ); + } + Kxx.write(); + } + { + volVectorField Kyy + ( + IOobject + ( + "Kyy", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimless + ); + Kyy.internalField() = transform + ( + ccTransforms_.internalField(), + vectorField + ( + ccTransforms_.internalField().size(), + point(0, 1, 0) + ) + ); + forAll(Kyy.boundaryField(), patchI) + { + Kyy.boundaryField()[patchI] = transform + ( + ccTransforms_.boundaryField()[patchI], + vectorField + ( + ccTransforms_.boundaryField()[patchI].size(), + point(0, 1, 0) + ) + ); + } + Kyy.write(); + } + { + volVectorField Kzz + ( + IOobject + ( + "Kzz", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimless + ); + Kzz.internalField() = transform + ( + ccTransforms_.internalField(), + vectorField + ( + ccTransforms_.internalField().size(), + point(0, 0, 1) + ) + ); + forAll(Kzz.boundaryField(), patchI) + { + Kzz.boundaryField()[patchI] = transform + ( + ccTransforms_.boundaryField()[patchI], + vectorField + ( + ccTransforms_.boundaryField()[patchI].size(), + point(0, 0, 1) + ) + ); + } + Kzz.write(); + } + } + + correct(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::directionalKSolidThermo::~directionalKSolidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::symmTensor Foam::directionalKSolidThermo::transformPrincipal +( + const tensor& tt, + const vector& st +) const +{ + return symmTensor + ( + tt.xx()*st.x()*tt.xx() + + tt.xy()*st.y()*tt.xy() + + tt.xz()*st.z()*tt.xz(), + + tt.xx()*st.x()*tt.yx() + + tt.xy()*st.y()*tt.yy() + + tt.xz()*st.z()*tt.yz(), + + tt.xx()*st.x()*tt.zx() + + tt.xy()*st.y()*tt.zy() + + tt.xz()*st.z()*tt.zz(), + + tt.yx()*st.x()*tt.yx() + + tt.yy()*st.y()*tt.yy() + + tt.yz()*st.z()*tt.yz(), + + tt.yx()*st.x()*tt.zx() + + tt.yy()*st.y()*tt.zy() + + tt.yz()*st.z()*tt.zz(), + + tt.zx()*st.x()*tt.zx() + + tt.zy()*st.y()*tt.zy() + + tt.zz()*st.z()*tt.zz() + ); +} + + +void Foam::directionalKSolidThermo::transformField +( + symmTensorField& fld, + const tensorField& tt, + const vectorField& st +) const +{ + fld.setSize(tt.size()); + forAll(fld, i) + { + fld[i] = transformPrincipal(tt[i], st[i]); + } +} + + +void Foam::directionalKSolidThermo::correct() +{ + calculate(); + interpolatedSolidThermo::calculate(); +} + + +const Foam::volSymmTensorField& Foam::directionalKSolidThermo:: +directionalK() const +{ + return directionalK_; +} + + +void Foam::directionalKSolidThermo::calculate() +{ + // Correct directionalK + Field localK + ( + interpolateXY + ( + T_.internalField(), + TValues_, + KValues_ + ) + ); + + // Transform into global coordinate system + transformField + ( + directionalK_.internalField(), + ccTransforms_.internalField(), + localK + ); + + forAll(directionalK_.boundaryField(), patchI) + { + directionalK_.boundaryField()[patchI] == this->directionalK(patchI)(); + } +} + + +const Foam::volScalarField& Foam::directionalKSolidThermo::K() const +{ + forAll(KValues_, i) + { + const vector& v = KValues_[i]; + if + ( + v.x() != v.y() + || v.x() != v.z() + || v.y() != v.z() + ) + { + FatalErrorIn("directionalKSolidThermo::K() const") + << "Supplied K values " << KValues_ + << " are not isotropic." << exit(FatalError); + } + } + + // Get temperature interpolated properties (principal directions) + Field localK + ( + interpolateXY + ( + T_.internalField(), + TValues_, + KValues_ + ) + ); + + tmp tK + ( + new volScalarField + ( + IOobject + ( + "K", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/dimTime/(dimLength*dimTemperature) + ) + ); + volScalarField& K = tK(); + + K.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + KValues_.component(0)() + ); + + forAll(K.boundaryField(), patchI) + { + K.boundaryField()[patchI] == this->K(patchI)(); + } + + return tK; +} + + +Foam::tmp Foam::directionalKSolidThermo::K +( + const label patchI +) const +{ + forAll(KValues_, i) + { + const vector& v = KValues_[i]; + if + ( + v.x() != v.y() + || v.x() != v.z() + || v.y() != v.z() + ) + { + FatalErrorIn("directionalKSolidThermo::K() const") + << "Supplied K values " << KValues_ + << " are not isotropic." << exit(FatalError); + } + } + + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + KValues_.component(0)() + ) + ) + ); +} + + +Foam::tmp Foam::directionalKSolidThermo::directionalK +( + const label patchI +) const +{ + const fvPatchScalarField& patchT = T_.boundaryField()[patchI]; + + Field localK(interpolateXY(patchT, TValues_, KValues_)); + + tmp tglobalK(new symmTensorField(localK.size())); + transformField(tglobalK(), ccTransforms_.boundaryField()[patchI], localK); + + return tglobalK; +} + + +bool Foam::directionalKSolidThermo::read() +{ + return read(subDict(typeName + "Coeffs")); +} + + +bool Foam::directionalKSolidThermo::read(const dictionary& dict) +{ + coordSys_ = coordinateSystem(dict, mesh_); + KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + return true; +} + + +bool Foam::directionalKSolidThermo::writeData(Ostream& os) const +{ + bool ok = interpolatedSolidThermo::writeData(os); + os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl; + return ok && os.good(); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const directionalKSolidThermo& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H new file mode 100644 index 0000000000..b0fcfd5c8c --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::directionalKSolidThermo + +Description + Directional conductivity + table interpolation. + +SourceFiles + directionalKSolidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directionalKSolidThermo_H +#define directionalKSolidThermo_H + +#include "coordinateSystem.H" +#include "interpolatedSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directionalKSolidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class directionalKSolidThermo +: + public interpolatedSolidThermo +{ + // Private data + + //- Thermal conductivity [W/(m.K)] + volSymmTensorField directionalK_; + + //- Thermal conductivity vector + Field KValues_; + + //- Coordinate system used for the directional properties + coordinateSystem coordSys_; + + //- Transformation for cell centres + volTensorField ccTransforms_; + + + // Private Member Functions + + //- Transform principal values of symmTensor + symmTensor transformPrincipal + ( + const tensor& tt, + const vector& st + ) const; + + //- Transform principal values of symmTensor + void transformField + ( + symmTensorField& fld, + const tensorField& tt, + const vectorField& st + ) const; + + //- Calculate properties + void calculate(); + + +public: + + //- Runtime type information + TypeName("directionalKSolidThermo"); + + + // Constructors + + //- Construct from mesh + directionalKSolidThermo(const fvMesh& mesh); + + + // Destructor + virtual ~directionalKSolidThermo(); + + + // Member Functions + + //- Update properties + virtual void correct(); + + //- Access functions + + //- Thermal conductivity [W/(m.K)] + virtual const volSymmTensorField& directionalK() const; + + //- Iostropic thermal conductivity [W/(m.K)] + virtual const volScalarField& K() const; + + // Per patch calculation + + //- Thermal conductivity [W//m/K] + virtual tmp K(const label patchI) const; + + //- Thermal conductivity [W//m/K] + virtual tmp directionalK(const label) const; + + + // I-O + + //- Write the directionalKSolidThermo properties + virtual bool writeData(Ostream& os) const; + + //- Read the directionalKSolidThermo properties + virtual bool read(); + + //- Read the directionalKSolidThermo properties + bool read(const dictionary& dict); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream& os, + const directionalKSolidThermo& s + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C new file mode 100644 index 0000000000..03fad75d4a --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "interpolateSolid.H" +#include "interpolateXY.H" + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interpolateSolid::interpolateSolid(const dictionary& dict) +{ + + read(dict); + + Info<< "Constructed directionalKSolidThermo with samples" << nl + << " T : " << TValues_ << nl + << " rho : " << rhoValues_ << nl + << " cp : " << cpValues_ << nl + << " Hf : " << HfValues_ << nl + << " emissivity : " << emissivityValues_ << nl + << " kappa : " << kappaValues_ << nl + << " sigmaS : " << sigmaSValues_ << nl + << endl; + + + if + ( + (TValues_.size() != rhoValues_.size()) + && (TValues_.size() != cpValues_.size()) + && (TValues_.size() != rhoValues_.size()) + && (TValues_.size() != HfValues_.size()) + && (TValues_.size() != emissivityValues_.size()) + ) + { + FatalIOErrorIn("interpolateSolid::read()", dict) + << "Size of property tables should be equal to size of Temperature" + << " values " << TValues_.size() + << exit(FatalIOError); + } + + for (label i = 1; i < TValues_.size(); i++) + { + if (TValues_[i] <= TValues_[i-1]) + { + FatalIOErrorIn("interpolateSolid::read()", dict) + << "Temperature values are not in increasing order " + << TValues_ << exit(FatalIOError); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interpolateSolid::~interpolateSolid() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::interpolateSolid::writeData(Ostream& os) const +{ + + os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl; + os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl; + os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl; + os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl; + os.writeKeyword("emissivityValues") << emissivityValues_ << nl; + os.writeKeyword("kappaValues") << kappaValues_ << nl; + os.writeKeyword("sigmaSValues") << sigmaSValues_ + << token::END_STATEMENT << nl; + + return os.good(); +} + + +bool Foam::interpolateSolid::read(const dictionary& dict) +{ + TValues_ = Field(dict.lookup("TValues")); + rhoValues_ = Field(dict.lookup("rhoValues")); + cpValues_ = Field(dict.lookup("cpValues")); + kappaValues_ = Field(dict.lookup("kappaValues")); + sigmaSValues_ = Field(dict.lookup("sigmaSValues")); + HfValues_ = Field(dict.lookup("HfValues")); + emissivityValues_ = Field(dict.lookup("emissivityValues")); + sigmaSValues_ = Field(dict.lookup("sigmaSValues")); + return true; +} +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H new file mode 100644 index 0000000000..20d72d35db --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::interpolateSolid + +Description + Helping class for T-interpolated solid thermo. + +SourceFiles + interpolateSolid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interpolateSolid_H +#define interpolateSolid_H +#include "volFields.H" +#include "dictionary.H" +#include "interpolateXY.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class interpolateSolid Declaration +\*---------------------------------------------------------------------------*/ + +class interpolateSolid +{ +protected: + + // Protected data + + Field TValues_; + + Field rhoValues_; + + Field cpValues_; + + Field HfValues_; + + Field emissivityValues_; + + Field kappaValues_; + + Field sigmaSValues_; + + +public: + + // Constructors + + //- Construct from mesh + interpolateSolid(const dictionary&); + + + //- Destructor + + virtual ~interpolateSolid(); + + + // Member Functions + + // I-O + + //- Read the interpolateSolid properties + bool read(const dictionary& dict); + + //- Write the interpolateSolid properties + bool writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C index ca298f3373..431e6c98b4 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,28 +27,20 @@ License #include "addToRunTimeSelectionTable.H" #include "interpolateXY.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(interpolatedSolidThermo, 0); - addToRunTimeSelectionTable - ( - basicSolidThermo, - interpolatedSolidThermo, - mesh - ); -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::interpolatedSolidThermo::interpolatedSolidThermo(const fvMesh& mesh) +Foam::interpolatedSolidThermo::interpolatedSolidThermo +( + const fvMesh& mesh, + const word dictName + ) : - basicSolidThermo(mesh) + basicSolidThermo(mesh), + interpolateSolid(subDict(dictName)), + dict_(subDict(dictName)) { - read(); - correct(); + calculate(); } @@ -60,55 +52,73 @@ Foam::interpolatedSolidThermo::~interpolatedSolidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::interpolatedSolidThermo::correct() -{} - - -Foam::tmp Foam::interpolatedSolidThermo::rho() const +void Foam::interpolatedSolidThermo::calculate() { - tmp trho - ( - new volScalarField - ( - IOobject - ( - "rho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimDensity - ) - ); - volScalarField& rho = trho(); - - rho.internalField() = interpolateXY + // Correct rho + rho_.internalField() = interpolateXY ( T_.internalField(), TValues_, rhoValues_ ); - forAll(rho.boundaryField(), patchI) + forAll(rho_.boundaryField(), patchI) { - rho.boundaryField()[patchI] == this->rho(patchI)(); + rho_.boundaryField()[patchI] == this->rho(patchI)(); } - return trho; + // Correct emissivity + emissivity_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + emissivityValues_ + ); + + forAll(emissivity_.boundaryField(), patchI) + { + emissivity_.boundaryField()[patchI] == this->emissivity(patchI)(); + } + + + // Correct absorptivity + kappa_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + kappaValues_ + ); + + forAll(kappa_.boundaryField(), patchI) + { + kappa_.boundaryField()[patchI] == this->kappa(patchI)(); + } + + + // Correct scatter + sigmaS_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + sigmaSValues_ + ); + + forAll(sigmaS_.boundaryField(), patchI) + { + sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)(); + } } -Foam::tmp Foam::interpolatedSolidThermo::cp() const +Foam::tmp Foam::interpolatedSolidThermo::Cp() const { - tmp tcp + tmp tCp ( new volScalarField ( IOobject ( - "cp", + "Cp", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -118,107 +128,21 @@ Foam::tmp Foam::interpolatedSolidThermo::cp() const dimEnergy/(dimMass*dimTemperature) ) ); - volScalarField& cp = tcp(); + volScalarField& Cp = tCp(); - cp.internalField() = interpolateXY + Cp.internalField() = interpolateXY ( T_.internalField(), TValues_, cpValues_ ); - forAll(cp.boundaryField(), patchI) + forAll(Cp.boundaryField(), patchI) { - cp.boundaryField()[patchI] == this->cp(patchI)(); + Cp.boundaryField()[patchI] == this->Cp(patchI)(); } - return tcp; -} - - -Foam::tmp Foam::interpolatedSolidThermo::K() const -{ - tmp tK - ( - new volScalarField - ( - IOobject - ( - "K", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimEnergy/dimTime/(dimLength*dimTemperature) - ) - ); - volScalarField& K = tK(); - - K.internalField() = interpolateXY - ( - T_.internalField(), - TValues_, - KValues_ - ); - - forAll(K.boundaryField(), patchI) - { - K.boundaryField()[patchI] == this->K(patchI)(); - } - - return tK; -} - - -Foam::tmp -Foam::interpolatedSolidThermo::directionalK() -const -{ - tmp tK - ( - new volSymmTensorField - ( - IOobject - ( - "K", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedSymmTensor - ( - "zero", - dimEnergy/dimTime/(dimLength*dimTemperature), - symmTensor::zero - ) - ) - ); - volSymmTensorField& K = tK(); - - Field scalarK - ( - interpolateXY - ( - T_.internalField(), - TValues_, - KValues_ - ) - ); - - K.internalField().replace(symmTensor::XX, scalarK); - K.internalField().replace(symmTensor::YY, scalarK); - K.internalField().replace(symmTensor::ZZ, scalarK); - - forAll(K.boundaryField(), patchI) - { - K.boundaryField()[patchI] == this->directionalK(patchI)(); - } - - return tK; + return tCp; } @@ -258,43 +182,6 @@ Foam::tmp Foam::interpolatedSolidThermo::Hf() const } -Foam::tmp -Foam::interpolatedSolidThermo::emissivity() const -{ - tmp temissivity - ( - new volScalarField - ( - IOobject - ( - "emissivity", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimless - ) - ); - volScalarField& emissivity = temissivity(); - - emissivity.internalField() = interpolateXY - ( - T_.internalField(), - TValues_, - emissivityValues_ - ); - - forAll(emissivity.boundaryField(), patchI) - { - emissivity.boundaryField()[patchI] == this->emissivity(patchI)(); - } - - return temissivity; -} - - Foam::tmp Foam::interpolatedSolidThermo::rho ( const label patchI @@ -315,7 +202,7 @@ Foam::tmp Foam::interpolatedSolidThermo::rho } -Foam::tmp Foam::interpolatedSolidThermo::cp +Foam::tmp Foam::interpolatedSolidThermo::Cp ( const label patchI ) const @@ -335,53 +222,6 @@ Foam::tmp Foam::interpolatedSolidThermo::cp } -Foam::tmp Foam::interpolatedSolidThermo::K -( - const label patchI -) const -{ - return tmp - ( - new scalarField - ( - interpolateXY - ( - T_.boundaryField()[patchI], - TValues_, - KValues_ - ) - ) - ); -} - - -Foam::tmp Foam::interpolatedSolidThermo::directionalK -( - const label patchI -) const -{ - const fvPatchScalarField& patchT = T_.boundaryField()[patchI]; - - Field scalarK(interpolateXY(patchT, TValues_, KValues_)); - - tmp tfld - ( - new symmTensorField - ( - scalarK.size(), - symmTensor::zero - ) - ); - symmTensorField& fld = tfld(); - - fld.replace(symmTensor::XX, scalarK); - fld.replace(symmTensor::YY, scalarK); - fld.replace(symmTensor::ZZ, scalarK); - - return tfld; -} - - Foam::tmp Foam::interpolatedSolidThermo::Hf ( const label patchI @@ -422,69 +262,63 @@ Foam::tmp Foam::interpolatedSolidThermo::emissivity } +Foam::tmp Foam::interpolatedSolidThermo::kappa +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + kappaValues_ + ) + ) + ); +} + + +Foam::tmp Foam::interpolatedSolidThermo::sigmaS +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + sigmaSValues_ + ) + ) + ); +} + + bool Foam::interpolatedSolidThermo::read() { - return read(subDict(typeName + "Coeffs")); + return read(dict_); } bool Foam::interpolatedSolidThermo::read(const dictionary& dict) { - TValues_ = Field(dict.lookup("TValues")); - rhoValues_ = Field(dict.lookup("rhoValues")); - cpValues_ = Field(dict.lookup("cpValues")); - KValues_ = Field(dict.lookup("KValues")); - HfValues_ = Field(dict.lookup("HfValues")); - emissivityValues_ = Field(dict.lookup("emissivityValues")); - - Info<< "Constructed interpolatedSolidThermo with samples" << nl - << " T : " << TValues_ << nl - << " rho : " << rhoValues_ << nl - << " cp : " << cpValues_ << nl - << " K : " << KValues_ << nl - << " Hf : " << HfValues_ << nl - << " emissivity : " << emissivityValues_ << nl - << endl; - - if - ( - (TValues_.size() != rhoValues_.size()) - && (TValues_.size() != cpValues_.size()) - && (TValues_.size() != rhoValues_.size()) - && (TValues_.size() != KValues_.size()) - && (TValues_.size() != HfValues_.size()) - && (TValues_.size() != emissivityValues_.size()) - ) - { - FatalIOErrorIn("interpolatedSolidThermo::read()", dict) - << "Size of property tables should be equal to size of Temperature" - << " values " << TValues_.size() - << exit(FatalIOError); - } - - for (label i = 1; i < TValues_.size(); i++) - { - if (TValues_[i] <= TValues_[i-1]) - { - FatalIOErrorIn("interpolatedSolidThermo::read()", dict) - << "Temperature values are not in increasing order " - << TValues_ << exit(FatalIOError); - } - } - return true; + bool ok = interpolateSolid::read(dict); + return ok; } bool Foam::interpolatedSolidThermo::writeData(Ostream& os) const { bool ok = basicSolidThermo::writeData(os); - os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl; - os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl; - os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl; - os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl; - os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl; - os.writeKeyword("emissivityValues") << emissivityValues_ - << token::END_STATEMENT << nl; + ok = interpolateSolid::writeData(os); return ok && os.good(); } diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H index 571138e023..24bb8ac695 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::interpolatedSolidThermo Description - Table interpolated solid thermo. + Table interpolated solid thermo SourceFiles interpolatedSolidThermo.C @@ -36,6 +36,7 @@ SourceFiles #define interpolatedSolidThermo_H #include "basicSolidThermo.H" +#include "interpolateSolid.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,67 +44,47 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interpolatedSolidThermo Declaration + Class interpolatedSolidThermo Declaration \*---------------------------------------------------------------------------*/ class interpolatedSolidThermo : - public basicSolidThermo + public basicSolidThermo, + public interpolateSolid { +private: + // Private data - //- Temperature samples - Field TValues_; + //- Dictionary + const dictionary dict_; - //- Density at given temperatures - Field rhoValues_; - - Field cpValues_; - - Field KValues_; - - Field HfValues_; - - Field emissivityValues_; public: - //- Runtime type information - TypeName("interpolatedSolidThermo"); - - // Constructors //- Construct from mesh - interpolatedSolidThermo(const fvMesh& mesh); + interpolatedSolidThermo(const fvMesh& mesh, const word); - // Destructor - virtual ~interpolatedSolidThermo(); + //- Destructor + virtual ~interpolatedSolidThermo(); // Member Functions - //- Update properties - virtual void correct(); + //- Calculate properties + void calculate(); - //- Density [kg/m3] - virtual tmp rho() const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp() const; + // Derived properties - //- Thermal conductivity [W/(m.K)] - virtual tmp K() const; + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp() const; - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK() const; - - //- Heat of formation [J/kg] - virtual tmp Hf() const; - - //- Emissivity [] - virtual tmp emissivity() const; + //- Heat of formation [J/kg] + virtual tmp Hf() const; // Per patch calculation @@ -111,20 +92,19 @@ public: //- Density [kg/m3] virtual tmp rho(const label patchI) const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp(const label patchI) const; - - //- Thermal conductivity [W/(m.K)] - // Note: needs Kvalues to be isotropic - virtual tmp K(const label patchI) const; - - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK(const label patchI) const; + //- Specific heat capacity [J/kg/K)] + virtual tmp Cp(const label patchI) const; //- Heat of formation [J/kg] virtual tmp Hf(const label patchI) const; - //- Emissivity [] + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label) const; + + //- Absorption coefficient [1/m] + virtual tmp kappa(const label) const; + + //- Emissivity [] virtual tmp emissivity(const label) const; diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C new file mode 100644 index 0000000000..9b1a7d3858 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "isotropicKSolidThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(isotropicKSolidThermo, 0); + addToRunTimeSelectionTable + ( + basicSolidThermo, + isotropicKSolidThermo, + mesh + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs"), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + KValues_ (Field(subDict(typeName + "Coeffs").lookup("KValues"))) +{ + correct(); +} + + +void Foam::isotropicKSolidThermo::correct() +{ + + // Correct K + K_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + KValues_ + ); + + forAll(K_.boundaryField(), patchI) + { + K_.boundaryField()[patchI] == this->K(patchI)(); + } + + interpolatedSolidThermo::calculate(); +} + + +Foam::tmp Foam::isotropicKSolidThermo::K +( + const label patchI +) const +{ + + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + KValues_ + ) + ) + ); +} + + +bool Foam::isotropicKSolidThermo::read() +{ + KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + return true; +} + + +bool Foam::isotropicKSolidThermo::writeData(Ostream& os) const +{ + os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl; + bool ok = interpolatedSolidThermo::writeData(os); + + return ok && os.good(); +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::isotropicKSolidThermo::~isotropicKSolidThermo() +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H new file mode 100644 index 0000000000..6366d8e473 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::isotropicKSolidThermo + +Description + Directional conductivity + table interpolation. + +SourceFiles + isotropicKSolidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directionalSolidThermo_H +#define directionalSolidThermo_H + +#include "interpolatedSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class isotropicKSolidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class isotropicKSolidThermo +: + public interpolatedSolidThermo +{ + // Private data + + //- Thermal conductivity [W/(m.K)] + volScalarField K_; + + //- Thermal conductivity vector + Field KValues_; + + +public: + + //- Runtime type information + TypeName("isotropicKSolidThermo"); + + + // Constructors + + //- Construct from mesh + isotropicKSolidThermo(const fvMesh& mesh); + + + // Destructor + virtual ~isotropicKSolidThermo(); + + // Member functions + + //- Update properties + virtual void correct(); + + // Access functions + + //- Constant access to K + virtual const volScalarField& K() const + { + return K_; + } + + + // Per patch calculation + + //- Thermal conductivity [W//m/K] + virtual tmp K(const label patchI) const; + + + // I-O + + //- Read solidThermophysicalProperties dictionary + virtual bool read(); + + //- Write properties + virtual bool writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream& os, + const isotropicKSolidThermo& s + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C new file mode 100644 index 0000000000..bbf3e348a2 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "basicSolidMixture.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::basicSolidMixture::basicSolidMixture +( + const wordList& solidNames, + const fvMesh& mesh +) +: + components_(solidNames), + Y_(components_.size()) +{ + forAll(components_, i) + { + IOobject header + ( + "Y" + components_[i], + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ); + + // check if field exists and can be read + if (header.headerOk()) + { + Y_.set + ( + i, + new volScalarField + ( + IOobject + ( + "Y" + components_[i], + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + } + else + { + volScalarField Ydefault + ( + IOobject + ( + "Ydefault", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh + ); + + Y_.set + ( + i, + new volScalarField + ( + IOobject + ( + "Y" + components_[i], + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + Ydefault + ) + ); + } + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H new file mode 100644 index 0000000000..c862152526 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::basicSolidMixture + +Description + Foam::basicSolidMixture + +\*---------------------------------------------------------------------------*/ + +#ifndef basicSolidMixture_H +#define basicSolidMixture_H + +#include "volFields.H" +#include "speciesTable.H" +#include "PtrList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class basicSolidMixture Declaration +\*---------------------------------------------------------------------------*/ + +class basicSolidMixture +{ + +protected: + + // Protected data + + typedef speciesTable solidsTable; + + //- The names of the solids + solidsTable components_; + + //- Solid mass fractions + PtrList Y_; + + +public: + + // Constructors + + //- Construct from word list and mesh + basicSolidMixture + ( + const wordList& solidNames, + const fvMesh& + ); + + + //- Destructor + virtual ~basicSolidMixture() + {} + + + // Member Functions + + //- Return the solid table + const solidsTable& components() const + { + return components_; + } + + //- Return the mass-fraction fields + inline PtrList& Y(); + + //- Return the const mass-fraction fields + inline const PtrList& Y() const; + + //- Return the mass-fraction field for a specie given by index + inline volScalarField& Y(const label i); + + //- Return the const mass-fraction field for a specie given by index + inline const volScalarField& Y(const label i) const; + + //- Return the mass-fraction field for a specie given by name + inline volScalarField& Y(const word& specieName); + + //- Return the const mass-fraction field for a specie given by name + inline const volScalarField& Y(const word& specieName) const; + + //- Does the mixture include this specie? + inline bool contains(const word& specieName) const; + + + // Derived cell based properties. + + //- Density + virtual scalar rho(scalar T, label celli) const = 0; + + //- Absorption coefficient + virtual scalar kappa(scalar T, label celli) const = 0; + + //- Scatter coefficient + virtual scalar sigmaS(scalar T, label celli) const = 0; + + //- Thermal conductivity + virtual scalar K(scalar T, label celli) const = 0; + + //- Emissivity coefficient + virtual scalar emissivity(scalar T, label celli) const = 0; + + //- Formation enthalpy + virtual scalar hf(scalar T, label celli) const = 0; + + //- Sensible enthalpy + virtual scalar hs(scalar T, label celli) const = 0; + + //- Total enthalpy + virtual scalar h(scalar T, label celli) const = 0; + + //- Specific heat capacity + virtual scalar Cp(scalar T, label celli) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "basicSolidMixtureI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H new file mode 100644 index 0000000000..831ea6819d --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 . + +\*---------------------------------------------------------------------------*/ + + +inline Foam::PtrList& Foam::basicSolidMixture::Y() +{ + return Y_; +} + + +inline const Foam::PtrList& Foam::basicSolidMixture::Y() const +{ + return Y_; +} + + +inline Foam::volScalarField& Foam::basicSolidMixture::Y(const label i) +{ + return Y_[i]; +} + + +inline const Foam::volScalarField& Foam::basicSolidMixture::Y +( + const label i +) const +{ + return Y_[i]; +} + + +inline Foam::volScalarField& Foam::basicSolidMixture::Y(const word& specieName) +{ + return Y_[components_[specieName]]; +} + + +inline const Foam::volScalarField& Foam::basicSolidMixture::Y +( + const word& specieName +) const +{ + return Y_[components_[specieName]]; +} + + +inline bool Foam::basicSolidMixture::contains(const word& specieName) const +{ + return components_.contains(specieName); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C new file mode 100644 index 0000000000..f43f4866b9 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C @@ -0,0 +1,250 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "multiComponentSolidMixture.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::multiComponentSolidMixture::correctMassFractions() +{ + volScalarField Yt = Y_[0]; + + for (label n=1; n +Foam::scalar Foam::multiComponentSolidMixture::X +( + label iComp, label celli, scalar T +) const +{ + scalar rhoInv = 0.0; + forAll(solidData_, i) + { + rhoInv += Y_[i][celli]/solidData_[i].rho(T); + } + + scalar X = Y_[iComp][celli]/solidData_[iComp].rho(T); + + return (X/rhoInv); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::multiComponentSolidMixture::multiComponentSolidMixture +( + const dictionary& thermoSolidDict, + const fvMesh& mesh +) +: + basicSolidMixture + ( + thermoSolidDict.lookup("solidComponents"), + mesh + ), + solidData_(components_.size()) +{ + + forAll(components_, i) + { + solidData_.set + ( + i, + new ThermoSolidType + ( + thermoSolidDict.subDict(components_[i] + "Coeffs") + ) + ); + } + correctMassFractions(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::multiComponentSolidMixture::rho +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].rho(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::hf +( + scalar, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].hf()*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::hs +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].hs(T)*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::h +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].h(T)*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::kappa +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].kappa(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::sigmaS +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].sigmaS(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::K +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].K(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::emissivity +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].emissivity(T)*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::Cp +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].Cp(T)*Y_[i][celli]; + } + return tmp; +} + + +template +void Foam::multiComponentSolidMixture::read +( + const dictionary& thermoDict +) +{ + forAll(components_, i) + { + solidData_[i] = + ThermoSolidType(thermoDict.subDict(components_[i] + "Coeffs")); + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H new file mode 100644 index 0000000000..54519fe2f9 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::multiComponentSolidMixture + +Description + Foam::multiComponentSolidMixture + +\*---------------------------------------------------------------------------*/ + +#ifndef multiComponentSolidMixture_H +#define multiComponentSolidMixture_H + +#include "PtrList.H" +#include "autoPtr.H" +#include "basicSolidMixture.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class multiComponentSolidMixture Declaration +\*---------------------------------------------------------------------------*/ +template +class multiComponentSolidMixture +: + public basicSolidMixture +{ + + // Private data + + //- Solid data + PtrList solidData_; + + + // Private Member Functions + + //- Correct the mass fractions to sum to 1 + void correctMassFractions(); + + //- Return molar fraction for component i in celli and at T + scalar X(label i, label celli, scalar T) const; + +public: + + + // Constructors + + //- Construct from dictionary and mesh + multiComponentSolidMixture(const dictionary&, const fvMesh&); + + + //- Destructor + + virtual ~multiComponentSolidMixture() + {} + + + // Member Functions + + //- Return the raw solid data + const PtrList& solidData() const + { + return solidData_; + } + + //- Read dictionary + void read(const dictionary&); + + + // Cell based properties. + + //- Density + virtual scalar rho(scalar T, label celli) const; + + //- Absorption coefficient + virtual scalar kappa(scalar T, label celli) const; + + //- Scatter coefficient + virtual scalar sigmaS(scalar T, label celli) const; + + //- Thermal conductivity + virtual scalar K(scalar T, label celli) const; + + //- Emissivity coefficient + virtual scalar emissivity(scalar T, label celli) const; + + //- Formation enthalpy + virtual scalar hf(scalar T, label celli) const; + + //- Sensible enthalpy + virtual scalar hs(scalar T, label celli) const; + + //- Total enthalpy + virtual scalar h(scalar T, label celli) const; + + //- Cp + virtual scalar Cp(scalar T, label celli) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "multiComponentSolidMixture.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C new file mode 100644 index 0000000000..47fbbdd3dc --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "reactingSolidMixture.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::reactingSolidMixture::reactingSolidMixture +( + const dictionary& thermoDict, + const fvMesh& mesh +) +: + multiComponentSolidMixture + ( + thermoDict, + mesh + ), + PtrList + ( + mesh.lookupObject + ("chemistryProperties").lookup("reactions"), + solidReaction::iNew + ( + this->components_, + mesh.lookupObject + ("chemistryProperties").lookup("species") + ) + ) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::reactingSolidMixture::read(const dictionary& thermoDict) +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H new file mode 100644 index 0000000000..d13de54c2b --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::reactingSolidMixture + +Description + Foam::reactingSolidMixture + +SourceFiles + reactingSolidMixture.C + +\*---------------------------------------------------------------------------*/ + +#ifndef reactingSolidMixture_H +#define reactingSolidMixture_H + +#include "multiComponentSolidMixture.H" +#include "solidReaction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class reactingSolidMixture Declaration +\*---------------------------------------------------------------------------*/ + +template +class reactingSolidMixture +: + public multiComponentSolidMixture, + public PtrList +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + reactingSolidMixture(const reactingSolidMixture&); + + //- Disallow default bitwise assignment + void operator=(const reactingSolidMixture&); + + +public: + + //- The type of thermo package this mixture is instantiated for + typedef ThermoSolidType thermoType; + + + // Constructors + + //- Construct from dictionary and mesh + reactingSolidMixture(const dictionary&, const fvMesh&); + + + //- Destructor + virtual ~reactingSolidMixture() + {} + + + // Member functions + + //- Read dictionary + void read(const dictionary&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "reactingSolidMixture.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H new file mode 100644 index 0000000000..94c4880a1d --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 . + +InClass + Foam::solidMixtureThermo + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSolidMixtureThermo_H +#define makeSolidMixtureThermo_H + +#include "addToRunTimeSelectionTable.H" +#include "solidMixtureThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSolidMixtureThermo(CThermo,MixtureThermo,Mixture,Transport,Radiation,Thermo,Rho)\ + \ +typedef MixtureThermo > > > > \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho; \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \ + #MixtureThermo \ + "<"#Mixture"<"#Transport"<"#Radiation"<"#Thermo"<"#Rho">>>>>", \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \ + mesh \ +); \ + \ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C new file mode 100644 index 0000000000..9824445cfc --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C @@ -0,0 +1,431 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "solidMixtureThermo.H" +#include "fvMesh.H" + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::solidMixtureThermo::calculate() +{ + + scalarField& rhoCells = rho_.internalField(); + scalarField& KCells = K_.internalField(); + scalarField& kappaCells = kappa_.internalField(); + scalarField& sigmaSCells = sigmaS_.internalField(); + scalarField& emissivityCells = emissivity_.internalField(); + + forAll(T_.internalField(), celli) + { + rhoCells[celli] = MixtureType::rho(T_[celli], celli); + kappaCells[celli] = MixtureType::kappa(T_[celli], celli); + sigmaSCells[celli] = MixtureType::sigmaS(T_[celli], celli); + KCells[celli] = MixtureType::K(T_[celli], celli); + emissivityCells[celli] = MixtureType::emissivity(T_[celli], celli); + } + + forAll(T_.boundaryField(), patchI) + { + rho_.boundaryField()[patchI] == this->rho(patchI)(); + K_.boundaryField()[patchI] == this->K(patchI)(); + kappa_.boundaryField()[patchI] == this->kappa(patchI)(); + sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)(); + emissivity_.boundaryField()[patchI] == this->emissivity(patchI)(); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::solidMixtureThermo::solidMixtureThermo +( + const fvMesh& mesh +) +: + basicSolidThermo(mesh), + MixtureType(*this, mesh), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ) +{ + calculate(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::solidMixtureThermo::~solidMixtureThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::solidMixtureThermo::correct() +{ + calculate(); +} + + +template +const Foam::volScalarField& +Foam::solidMixtureThermo::K() const +{ + return K_; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Cp() const +{ + tmp tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/(dimMass*dimTemperature) + ) + ); + volScalarField& Cp = tCp(); + + forAll(T_.internalField(), celli) + { + Cp[celli] = MixtureType::Cp(T_[celli], celli); + } + + forAll(Cp.boundaryField(), patchI) + { + Cp.boundaryField()[patchI] == this->Cp(patchI)(); + } + + return tCp; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::hs() const +{ + tmp ths + ( + new volScalarField + ( + IOobject + ( + "Hs", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/(dimMass*dimTemperature) + ) + ); + volScalarField& hs = ths(); + + forAll(T_.internalField(), celli) + { + hs[celli] = MixtureType::hs(T_[celli], celli); + } + + forAll(hs.boundaryField(), patchI) + { + hs.boundaryField()[patchI] == this->hs(patchI)(); + } + + return ths; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Hf() const +{ + tmp thF + ( + new volScalarField + ( + IOobject + ( + "hF", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/(dimMass*dimTemperature) + ) + ); + volScalarField& hf = thF(); + + forAll(T_.internalField(), celli) + { + hf[celli] = MixtureType::hf(T_[celli], celli); + } + + forAll(hf.boundaryField(), patchI) + { + hf.boundaryField()[patchI] == this->Hf(patchI)(); + } + + return thF; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::rho +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tRho(new scalarField(patchT.size())); + scalarField& Rho = tRho(); + + forAll(patchT, celli) + { + Rho[celli] = MixtureType::rho(patchT[celli], cells[celli]); + } + + return tRho; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Cp +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tCp(new scalarField(patchT.size())); + scalarField& Cp = tCp(); + + forAll(patchT, celli) + { + Cp[celli] = MixtureType::Cp(patchT[celli], cells[celli]); + } + + return tCp; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::hs +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp ths(new scalarField(patchT.size())); + scalarField& hs = ths(); + + forAll(patchT, celli) + { + hs[celli] = MixtureType::hs(patchT[celli], cells[celli]); + } + + return ths; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::K +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tK(new scalarField(patchT.size())); + scalarField& K = tK(); + + forAll(patchT, celli) + { + K[celli] = MixtureType::K(patchT[celli], cells[celli]); + } + + return tK; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Hf +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tHf(new scalarField(patchT.size())); + scalarField& Hf = tHf(); + + forAll(patchT, celli) + { + Hf[celli] = MixtureType::hf(patchT[celli], cells[celli]); + } + + return tHf; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::sigmaS +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tsigmaS(new scalarField(patchT.size())); + scalarField& sigmaS = tsigmaS(); + + forAll(patchT, celli) + { + sigmaS[celli] = + MixtureType::sigmaS(patchT[celli], cells[celli]); + } + + return tsigmaS; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::kappa +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tKappa(new scalarField(patchT.size())); + scalarField& kappa = tKappa(); + + forAll(patchT, celli) + { + kappa[celli] = + MixtureType::kappa(patchT[celli], cells[celli]); + } + + return tKappa; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::emissivity +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp te(new scalarField(patchT.size())); + scalarField& e = te(); + + forAll(patchT, celli) + { + e[celli] = MixtureType::emissivity(patchT[celli], cells[celli]); + } + + return te; +} + + +template +bool Foam::solidMixtureThermo::read() +{ + if (basicSolidThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +template +bool Foam::solidMixtureThermo::writeData(Ostream& os) const +{ + bool ok = basicSolidThermo::writeData(os); + return ok && os.good(); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H new file mode 100644 index 0000000000..d9b2fdf157 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::solidMixtureThermo + +Description + Foam::solidMixtureThermo + +SourceFiles + solidMixtureThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solidMixtureThermo_H +#define solidMixtureThermo_H + +#include "basicSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class solidMixtureThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class solidMixtureThermo +: + public basicSolidThermo, + public MixtureType +{ +protected: + + // Protected data + + //- Thermal conductivity [W/m/K] + volScalarField K_; + + +private: + + // Private Member Functions + + //- Calculate K + void calculate(); + + +public: + + //- Runtime type information + TypeName("solidMixtureThermo"); + + + // Constructors + + //- Construct from mesh + solidMixtureThermo(const fvMesh&); + + + //- Destructor + + virtual ~solidMixtureThermo(); + + + // Member functions + + //- Return the compostion of the solid mixture + virtual MixtureType& composition() + { + return *this; + } + + //- Return the compostion of the solid mixture + virtual const MixtureType& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + // Access functions + + //- Thermal conductivity [W/m/K] + virtual const volScalarField& K() const; + + + // Derived properties + + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp() const; + + //- Heat of formation [J/kg] + virtual tmp Hf() const; + + //- Sensible enthalpy [J/(kg.K)] + virtual tmp hs() const; + + + // Patches variables + + + //- Density [kg/m3] + virtual tmp rho(const label patchI) const; + + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp(const label patchI) const; + + //- Sensible enthalpy [J/(kg.K)] + virtual tmp hs(const label patchI) const; + + //- Thermal conductivity [W/(m.K)] + virtual tmp K(const label patchI) const; + + //- Heat of formation [J/kg] + virtual tmp Hf(const label patchI) const; + + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label patchI) const; + + //- Absorptivity [1/m] + virtual tmp kappa(const label patchI) const; + + //- Emissivity [] + virtual tmp emissivity(const label patchI) const; + + + + //- Read thermophysicalProperties dictionary + virtual bool read(); + + //- Write the basicSolidThermo properties + virtual bool writeData(Ostream& os) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "solidMixtureThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C new file mode 100644 index 0000000000..66f42b9b96 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "makeSolidMixtureThermo.H" + +#include "constRho.H" + +#include "constSolidThermo.H" +#include "exponentialSolidThermo.H" + +#include "constSolidTransport.H" +#include "exponentialSolidTransport.H" + +#include "constSolidRad.H" + +#include "basicSolidThermo.H" + +#include "multiComponentSolidMixture.H" +#include "reactingSolidMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + multiComponentSolidMixture, + constSolidTransport, + constSolidRad, + constSolidThermo, + constRho +); + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + multiComponentSolidMixture, + exponentialSolidTransport, + constSolidRad, + exponentialSolidThermo, + constRho +); + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + reactingSolidMixture, + exponentialSolidTransport, + constSolidRad, + exponentialSolidThermo, + constRho +); + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + reactingSolidMixture, + constSolidTransport, + constSolidRad, + constSolidThermo, + constRho +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolidMixture/Make/files b/src/thermophysicalModels/pointSolidMixture/Make/files new file mode 100644 index 0000000000..17cad4937b --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/Make/files @@ -0,0 +1,3 @@ +pointSolidMixture/pointSolidMixture.C + +LIB = $(FOAM_LIBBIN)/libpointSolidMixture diff --git a/src/thermophysicalModels/pointSolidMixture/Make/options b/src/thermophysicalModels/pointSolidMixture/Make/options new file mode 100644 index 0000000000..db6f1fe921 --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/Make/options @@ -0,0 +1,3 @@ +EXE_INC = \ + -I${LIB_SRC}/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude diff --git a/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C new file mode 100644 index 0000000000..cb6440c604 --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "pointSolidMixture.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::pointSolidMixture::pointSolidMixture +( + const dictionary& thermophysicalProperties +) +: + components_(thermophysicalProperties.lookup("solidComponents")), + properties_(components_.size()) +{ + // can use sub-dictionary "solidProperties" to avoid + // collisions with identically named gas-phase entries + const dictionary* subDictPtr = thermophysicalProperties.subDictPtr + ( + "solidProperties" + ); + + const dictionary& props = + ( + subDictPtr ? *subDictPtr : thermophysicalProperties + ); + + forAll(components_, i) + { + properties_.set(i, pointSolid::New(props.subDict(components_[i]))); + } +} + + +Foam::pointSolidMixture::pointSolidMixture(const pointSolidMixture& s) +: + components_(s.components_), + properties_(s.properties_.size()) +{ + forAll(properties_, i) + { + properties_.set(i, s.properties_(i)->clone()); + } +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::pointSolidMixture::New +( + const dictionary& thermophysicalProperties +) +{ + return autoPtr(new +pointSolidMixture(thermophysicalProperties)); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::scalarField Foam::pointSolidMixture::X +( + const scalarField& Y +) const +{ + scalarField X(Y.size()); + scalar rhoInv = 0.0; + forAll(X, i) + { + rhoInv += Y[i]/properties_[i].rho(); + X[i] = Y[i]/properties_[i].rho(); + } + + return X/rhoInv; +} + + +Foam::scalar Foam::pointSolidMixture::rho +( + const scalarField& X +) const +{ + scalar val = 0.0; + forAll(properties_, i) + { + val += properties_[i].rho()*X[i]; + } + return val; +} + + +Foam::scalar Foam::pointSolidMixture::Cp +( + const scalarField& Y +) const +{ + scalar val = 0.0; + forAll(properties_, i) + { + val += properties_[i].Cp()*Y[i]; + } + return val; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H new file mode 100644 index 0000000000..7c8967b707 --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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::pointSolidMixture + +Description + A mixture of solids. + +Note + The dictionary constructor searches for the entry @c solidComponents, + which is a wordList. The pointSolid properties of each component can either + be contained within a @c solidProperties sub-dictionary or (for legacy + purposes) can be found directly in the dictionary. + The @c solidProperties sub-dictionary entry should be used when possible + to avoid conflicts with identically named gas-phase entries. + +SeeAlso + Foam::pointSolidMixture + +\*---------------------------------------------------------------------------*/ + +#ifndef pointSolidMixture_H +#define pointSolidMixture_H + +#include "scalarField.H" +#include "PtrList.H" +#include "pointSolid.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class pointSolidMixture Declaration +\*---------------------------------------------------------------------------*/ + +class pointSolidMixture +{ + // Private data + + //- The names of the solids + List components_; + + //- The pointSolid properties + PtrList properties_; + + +public: + + // Constructors + + //- Construct from dictionary + pointSolidMixture(const dictionary&); + + //- Construct copy + pointSolidMixture(const pointSolidMixture& lm); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new pointSolidMixture(*this)); + } + + + //- Destructor + virtual ~pointSolidMixture() + {} + + + // Selectors + + //- Select construct from dictionary + static autoPtr New(const dictionary&); + + + // Member Functions + + //- Return the pointSolid names + inline const List& components() const + { + return components_; + } + + //- Return the pointSolid properties + inline const PtrList& properties() const + { + return properties_; + } + + //- Return the number of solids in the mixture + inline label size() const + { + return components_.size(); + } + + + //- Returns the mass fractions, given mole fractions + scalarField Y(const scalarField& X) const; + + //- Returns the mole fractions, given mass fractions + scalarField X(const scalarField& Y) const; + + //- Calculate the mixture density [kg/m^3] as a function of + // volume fractions + scalar rho(const scalarField& X) const; + + //- Calculate the mixture heat capacity [J/(kg K)] as a function + // of mass fractions + scalar Cp(const scalarField& Y) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/C/C.C b/src/thermophysicalModels/pointSolids/C/C.C new file mode 100644 index 0000000000..e8d4d52a97 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/C/C.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "C.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(C, 0); + addToRunTimeSelectionTable(pointSolid, C,); + addToRunTimeSelectionTable(pointSolid, C, Istream); + addToRunTimeSelectionTable(pointSolid, C, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::C::C() +: + pointSolid(2010, 710, 0.04, 0.0, 1.0) +{ + if (debug) + { + WarningIn("C::C()") + << "Properties of graphite need to be checked!!!" + << endl; + } +} + + +Foam::C::C(const pointSolid& s) +: + pointSolid(s) +{} + + +Foam::C::C(Istream& is) +: + pointSolid(is) +{} + + +Foam::C::C(const dictionary& dict) +: + pointSolid(dict) +{} + + +Foam::C::C(const C& s) +: + pointSolid(s) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::C::writeData(Ostream& os) const +{ + pointSolid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const C& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/C/C.H b/src/thermophysicalModels/pointSolids/C/C.H new file mode 100644 index 0000000000..260e19bf04 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/C/C.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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::C + +Description + Graphite + +SourceFiles + C.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_C_H +#define solid_C_H + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class C; + +Ostream& operator<< +( + Ostream&, + const C& +); + + +/*---------------------------------------------------------------------------*\ + Class C Declaration +\*---------------------------------------------------------------------------*/ + +class C +: + public pointSolid +{ +public: + + //- Runtime type information + TypeName("C"); + + + // Constructors + + //- Construct null + C(); + + //- Construct from pointSolid + C(const pointSolid& s); + + //- Construct from Istream + C(Istream& is); + + //- Construct from dictionary + C(const dictionary& dict); + + //- Construct copy + C(const C& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new C(*this)); + } + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + //- Ostream Operator + friend Ostream& operator<<(Ostream& os, const C& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C new file mode 100644 index 0000000000..909724793c --- /dev/null +++ b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "CaCO3.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(CaCO3, 0); + addToRunTimeSelectionTable(pointSolid, CaCO3,); + addToRunTimeSelectionTable(pointSolid, CaCO3, Istream); + addToRunTimeSelectionTable(pointSolid, CaCO3, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CaCO3::CaCO3() +: + pointSolid(2710, 850, 1.3, 0.0, 1.0) +{ + if (debug) + { + WarningIn("CaCO3::CaCO3()") + << "Properties of CaCO3 need to be checked!!!" + << endl; + } +} + + +Foam::CaCO3::CaCO3(const pointSolid& s) +: + pointSolid(s) +{} + + +Foam::CaCO3::CaCO3(Istream& is) +: + pointSolid(is) +{} + + +Foam::CaCO3::CaCO3(const dictionary& dict) +: + pointSolid(dict) +{} + + +Foam::CaCO3::CaCO3(const CaCO3& s) +: + pointSolid(s) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::CaCO3::writeData(Ostream& os) const +{ + pointSolid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const CaCO3& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H new file mode 100644 index 0000000000..ff3bd29a92 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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::CaCO3 + +Description + Calcium carbonate (limestone) + +SourceFiles + CaCO3.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_CaCO3_H +#define solid_CaCO3_H + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class CaCO3; + +Ostream& operator<< +( + Ostream&, + const CaCO3& +); + + +/*---------------------------------------------------------------------------*\ + Class CaCO3 Declaration +\*---------------------------------------------------------------------------*/ + +class CaCO3 +: + public pointSolid +{ + +public: + + //- Runtime type information + TypeName("CaCO3"); + + + // Constructors + + //- Construct null + CaCO3(); + + //- Construct from pointSolid + CaCO3(const pointSolid& s); + + //- Construct from Istream + CaCO3(Istream& is); + + //- Construct from dictionary + CaCO3(const dictionary& dict); + + //- Construct copy + CaCO3(const CaCO3& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new CaCO3(*this)); + } + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream& os, const CaCO3& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/Make/files b/src/thermophysicalModels/pointSolids/Make/files new file mode 100644 index 0000000000..526d251970 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/Make/files @@ -0,0 +1,8 @@ +pointSolid/pointSolid.C +pointSolid/pointSolidNew.C + +ash/ash.C +C/C.C +CaCO3/CaCO3.C + +LIB = $(FOAM_LIBBIN)/libpointSolids diff --git a/src/thermophysicalModels/pointSolids/Make/options b/src/thermophysicalModels/pointSolids/Make/options new file mode 100644 index 0000000000..d10d7744b5 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/Make/options @@ -0,0 +1,3 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + diff --git a/src/thermophysicalModels/pointSolids/ash/ash.C b/src/thermophysicalModels/pointSolids/ash/ash.C new file mode 100644 index 0000000000..e8457ad401 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/ash/ash.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "ash.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(ash, 0); + addToRunTimeSelectionTable(pointSolid, ash,); + addToRunTimeSelectionTable(pointSolid, ash, Istream); + addToRunTimeSelectionTable(pointSolid, ash, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::ash::ash() +: + pointSolid(2010, 710, 0.04, 0.0, 1.0) +{ + if (debug) + { + WarningIn("ash::ash()") + << "Properties of ash need to be checked!!!" + << endl; + } +} + + +Foam::ash::ash(const pointSolid& s) +: + pointSolid(s) +{} + + +Foam::ash::ash(Istream& is) +: + pointSolid(is) +{} + + +Foam::ash::ash(const dictionary& dict) +: + pointSolid(dict) +{} + + +Foam::ash::ash(const ash& s) +: + pointSolid(s) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::ash::writeData(Ostream& os) const +{ + pointSolid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const ash& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/ash/ash.H b/src/thermophysicalModels/pointSolids/ash/ash.H new file mode 100644 index 0000000000..4d0f249576 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/ash/ash.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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::ash + +Description + Coal ash + +SourceFiles + ash.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_ash_H +#define solid_ash_H + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class ash; + +Ostream& operator<< +( + Ostream&, + const ash& +); + + +/*---------------------------------------------------------------------------*\ + Class ash Declaration +\*---------------------------------------------------------------------------*/ + +class ash +: + public pointSolid +{ + +public: + + //- Runtime type information + TypeName("ash"); + + + // Constructors + + //- Construct null + ash(); + + //- Construct from pointSolid + ash(const pointSolid& s); + + //- Construct from Istream + ash(Istream& is); + + //- Construct from dictionary + ash(const dictionary& dict); + + //- Construct copy + ash(const ash& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new ash(*this)); + } + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream& os, const ash& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C new file mode 100644 index 0000000000..e4e74da8d4 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "pointSolid.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(pointSolid, 0); + defineRunTimeSelectionTable(pointSolid,); + defineRunTimeSelectionTable(pointSolid, Istream); + defineRunTimeSelectionTable(pointSolid, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::pointSolid::pointSolid +( + scalar rho, + scalar Cp, + scalar K, + scalar Hf, + scalar emissivity +) +: + rho_(rho), + Cp_(Cp), + K_(K), + Hf_(Hf), + emissivity_(emissivity) +{} + + +Foam::pointSolid::pointSolid(Istream& is) +: + rho_(readScalar(is)), + Cp_(readScalar(is)), + K_(readScalar(is)), + Hf_(readScalar(is)), + emissivity_(readScalar(is)) +{} + + +Foam::pointSolid::pointSolid(const dictionary& dict) +: + rho_(readScalar(dict.lookup("rho"))), + Cp_(readScalar(dict.lookup("Cp"))), + K_(readScalar(dict.lookup("K"))), + Hf_(readScalar(dict.lookup("Hf"))), + emissivity_(readScalar(dict.lookup("emissivity"))) +{} + + +Foam::pointSolid::pointSolid(const pointSolid& s) +: + rho_(s.rho_), + Cp_(s.Cp_), + K_(s.K_), + Hf_(s.Hf_), + emissivity_(s.emissivity_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::pointSolid::writeData(Ostream& os) const +{ + os << rho_ << token::SPACE + << Cp_ << token::SPACE + << K_ << token::SPACE + << Hf_ << token::SPACE + << emissivity_; +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const pointSolid& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H new file mode 100644 index 0000000000..fba0d739ae --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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::pointSolid + +Description + The thermophysical properties of a pointSolid + +SourceFiles + pointSolid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef pointSolid_H +#define pointSolid_H + +#include "typeInfo.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class pointSolid; + +Ostream& operator<< +( + Ostream&, + const pointSolid& +); + + +/*---------------------------------------------------------------------------*\ + Class pointSolid Declaration +\*---------------------------------------------------------------------------*/ + +class pointSolid +{ + + // Private data + + //- Density [kg/m3] + scalar rho_; + + //- Specific heat capacity [J/(kg.K)] + scalar Cp_; + + //- Thermal conductivity [W/(m.K)] + scalar K_; + + //- Heat of formation [J/kg] + scalar Hf_; + + //- Emissivity + scalar emissivity_; + + +public: + + //- Runtime type information + TypeName("pointSolid"); + + + // Declare run-time constructor selection tables + + declareRunTimeSelectionTable + ( + autoPtr, + pointSolid, + , + (), + () + ); + + declareRunTimeSelectionTable + ( + autoPtr, + pointSolid, + Istream, + (Istream& is), + (is) + ); + + declareRunTimeSelectionTable + ( + autoPtr, + pointSolid, + dictionary, + (const dictionary& dict), + (dict) + ); + + + // Constructors + + //- Construct from components + pointSolid + ( + scalar rho, + scalar Cp, + scalar K, + scalar Hf, + scalar emissivity + ); + + //- Construct from Istream + pointSolid(Istream& is); + + //- Construct from dictionary + pointSolid(const dictionary& dict); + + //- Construct copy + pointSolid(const pointSolid& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new pointSolid(*this)); + } + + + // Selectors + + //- Return a pointer to a new pointSolid created from input + static autoPtr New(Istream& is); + + //- Return a pointer to a new pointSolid created from dictionary + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~pointSolid() + {} + + + // Member Functions + + // Physical constants which define the pointSolid + + //- Density [kg/m3] + inline scalar rho() const; + + //- Specific heat capacity [J/(kg.K)] + inline scalar Cp() const; + + //- Thermal conductivity [W/(m.K)] + inline scalar K() const; + + //- Heat of formation [J/kg] + inline scalar Hf() const; + + //- Total enthalpy - reference to Tstd [J/kg] + inline scalar H(const scalar T) const; + + //- Sensible enthalpy - reference to Tstd [J/kg] + inline scalar Hs(const scalar T) const; + + //- Emissivity [] + inline scalar emissivity() const; + + + // I-O + + //- Write the pointSolid properties + virtual void writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream& os, const pointSolid& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "pointSolidI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H new file mode 100644 index 0000000000..f4c6773454 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "specie.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Foam::scalar Foam::pointSolid::rho() const +{ + return rho_; +} + + +inline Foam::scalar Foam::pointSolid::Cp() const +{ + return Cp_; +} + + +inline Foam::scalar Foam::pointSolid::K() const +{ + return K_; +} + + +inline Foam::scalar Foam::pointSolid::Hf() const +{ + return Hf_; +} + + +inline Foam::scalar Foam::pointSolid::H(const scalar T) const +{ + return Hs(T) + Hf_; +} + + +inline Foam::scalar Foam::pointSolid::Hs(const scalar T) const +{ + return Cp_*(T - specie::Tstd); +} + + +inline Foam::scalar Foam::pointSolid::emissivity() const +{ + return emissivity_; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C new file mode 100644 index 0000000000..74096983e2 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2010 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 "pointSolid.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::pointSolid::New(Istream& is) +{ + if (debug) + { + Info<< "pointSolid::New(Istream&): constructing pointSolid" << endl; + } + + const word solidType(is); + const word coeffs(is); + + if (coeffs == "defaultCoeffs") + { + ConstructorTable::iterator cstrIter = + ConstructorTablePtr_->find(solidType); + + if (cstrIter == ConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(Istream&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << ConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()()); + } + else if (coeffs == "coeffs") + { + IstreamConstructorTable::iterator cstrIter = + IstreamConstructorTablePtr_->find(solidType); + + if (cstrIter == IstreamConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(Istream&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << IstreamConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(is)); + } + else + { + FatalErrorIn("pointSolid::New(Istream&)") + << "pointSolid type " << solidType + << ", option " << coeffs << " given" + << ", should be coeffs or defaultCoeffs" + << exit(FatalError); + + return autoPtr(NULL); + } +} + + +Foam::autoPtr Foam::pointSolid::New(const dictionary& dict) +{ + if (debug) + { + Info<< "pointSolid::New(const dictionary&): constructing pointSolid" + << endl; + } + + const word solidType(dict.dictName()); + const Switch defaultCoeffs(dict.lookup("defaultCoeffs")); + + if (defaultCoeffs) + { + ConstructorTable::iterator cstrIter = + ConstructorTablePtr_->find(solidType); + + if (cstrIter == ConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(const dictionary&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << ConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()()); + } + else + { + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(solidType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(const dictionary&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict)); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solid/Make/files b/src/thermophysicalModels/solid/Make/files new file mode 100644 index 0000000000..b9ccaf886f --- /dev/null +++ b/src/thermophysicalModels/solid/Make/files @@ -0,0 +1,8 @@ +rhoType/const/constRho.C + +reaction/Reactions/solidReaction/solidReaction.C + +reaction/reactions/makeSolidReactionThermoReactions.C + + +LIB = $(FOAM_LIBBIN)/libsolid diff --git a/src/thermophysicalModels/solid/Make/options b/src/thermophysicalModels/solid/Make/options new file mode 100644 index 0000000000..848cce789f --- /dev/null +++ b/src/thermophysicalModels/solid/Make/options @@ -0,0 +1,2 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude diff --git a/src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H b/src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H new file mode 100644 index 0000000000..1eb9b34740 --- /dev/null +++ b/src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 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 . + +Typedefs + Foam::solidThermoPhysicsTypes + +Description + Type definitions for solid-thermo-physics models + +\*---------------------------------------------------------------------------*/ + +#ifndef solidThermoPhysicsTypes_H +#define solidThermoPhysicsTypes_H + +#include "constRho.H" + +#include "constSolidThermo.H" +#include "exponentialSolidThermo.H" + +#include "constSolidTransport.H" +#include "exponentialSolidTransport.H" + +#include "constSolidRad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef constSolidTransport > > + constSolidThermoPhysics; + + typedef constSolidTransport + < + constSolidRad + < + exponentialSolidThermo + < + constRho + > + > + > + expoSolidThermoPhysics; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/src/thermophysicalModels/solid/radiation/const/constSolidRad.C b/src/thermophysicalModels/solid/radiation/const/constSolidRad.C new file mode 100644 index 0000000000..b4ec108951 --- /dev/null +++ b/src/thermophysicalModels/solid/radiation/const/constSolidRad.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "constSolidRad.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +constSolidRad::constSolidRad(const dictionary& dict) +: + thermo(dict), + kappa_(readScalar(dict.subDict("radiativeProperties").lookup("kappa"))), + sigmaS_ + ( + readScalar + ( + dict.subDict("radiativeProperties").lookup("sigmaS") + ) + ), + emissivity_ + ( + readScalar(dict.subDict("radiativeProperties").lookup("emissivity")) + ) +{} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Ostream& operator<<(Ostream& os, const constSolidRad& pg) +{ + os << static_cast(pg); + os << tab << pg.kappa_ << tab << pg.sigmaS_ << tab << pg.emissivity_; + + os.check("Ostream& operator<<(Ostream& os, const constSolidRad& st)"); + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/radiation/const/constSolidRad.H b/src/thermophysicalModels/solid/radiation/const/constSolidRad.H new file mode 100644 index 0000000000..28d537cf39 --- /dev/null +++ b/src/thermophysicalModels/solid/radiation/const/constSolidRad.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::constSolidRad + +Description + Constant radiative properties + +SourceFiles + constSolidRadI.H + constSolidRad.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constSolidRad_H +#define constSolidRad_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template class constSolidRad; + +template +Ostream& operator<< +( + Ostream&, + const constSolidRad& +); + +/*---------------------------------------------------------------------------*\ + Class constSolidRad Declaration +\*---------------------------------------------------------------------------*/ + +template +class constSolidRad +: + public thermo +{ + // Private data + + //- Absorption coefficient + scalar kappa_; + + //- Scattering coefficient + scalar sigmaS_; + + //- Emissivity coefficient + scalar emissivity_; + + + //- Construct from components + inline constSolidRad + ( + const thermo& t, + const scalar kappa, + const scalar sigmaS, + const scalar emissivity + ); + + +public: + + // Constructors + + //- Construct from Istream + constSolidRad(const dictionary&); + + //- Construct as named copy + inline constSolidRad(const word& name, const constSolidRad&); + + //- Construct and return a clone + inline autoPtr clone() const; + + // Selector from Istream + inline static autoPtr New(Istream& is); + + + // Member functions + + //- Return absorption coefficient [1/m] + inline scalar kappa(scalar T) const; + + //- Return scattering [1/m] + inline scalar sigmaS(scalar T) const; + + //- Return emissivity[] + inline scalar emissivity(scalar T) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const constSolidRad& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "constSolidRadI.H" + +#ifdef NoRepository +# include "constSolidRad.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/radiation/const/constSolidRadI.H b/src/thermophysicalModels/solid/radiation/const/constSolidRadI.H new file mode 100644 index 0000000000..82a99474e9 --- /dev/null +++ b/src/thermophysicalModels/solid/radiation/const/constSolidRadI.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "constSolidRad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline constSolidRad::constSolidRad +( + const thermo& t, + const scalar kappa, + const scalar sigmaS, + const scalar emissivity +) +: + thermo(t), + kappa_(kappa), + sigmaS_(sigmaS), + emissivity_(emissivity) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +template +inline constSolidRad::constSolidRad +( + const word& name, + const constSolidRad& pg +) +: + thermo(name, pg), + kappa_(pg.kappa_), + sigmaS_(pg.sigmaS_), + emissivity_(pg.emissivity_) +{} + + +template +inline autoPtr > constSolidRad::clone() const +{ + return autoPtr >(new constSolidRad(*this)); +} + + +template +inline autoPtr > constSolidRad::New(Istream& is) +{ + return autoPtr >(new constSolidRad(is)); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline scalar constSolidRad::kappa(scalar) const +{ + return kappa_; +} + + +template +inline scalar constSolidRad::sigmaS(scalar) const +{ + return sigmaS_; +} + + +template +inline scalar constSolidRad::emissivity(scalar) const +{ + return emissivity_; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C new file mode 100644 index 0000000000..c181cd9847 --- /dev/null +++ b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "IrreversibleSolidReaction.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::IrreversibleSolidReaction::IrreversibleSolidReaction +( + const solidReaction& reaction, + const ReactionRate& k, + const scalar nReact +) +: + solidReaction(reaction), + k_(k), + nReact_(nReact) +{} + + +template +Foam::IrreversibleSolidReaction::IrreversibleSolidReaction +( + const speciesTable& components, + Istream& is, + const speciesTable& pyrolysisGases +) +: + solidReaction(components, is, pyrolysisGases), + k_(components, is), + nReact_(readScalar(is)) +{ + is.readEnd("solidArrheniusReactionRate(Istream&)"); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::IrreversibleSolidReaction::kf +( + const scalar T, + const scalar p, + const scalarField& c +) const +{ + return k_(T, p, c); +} + + +template +Foam::scalar Foam::IrreversibleSolidReaction::nReact() const +{ + return nReact_; +} + + +template +void Foam::IrreversibleSolidReaction::write +( + Ostream& os +) const +{ + solidReaction::write(os); + os << token::SPACE << "Reaction order: " << nReact_ << nl << k_; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H new file mode 100644 index 0000000000..b134416506 --- /dev/null +++ b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::IrreversibleSolidReaction + +Description + Simple extension of Reaction to handle reversible reactions + +SourceFiles + IrreversibleSolidReaction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IrreversibleSolidReaction_H +#define IrreversibleSolidReaction_H + +#include "solidReaction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IrreversibleSolidReaction Declaration +\*---------------------------------------------------------------------------*/ + +template +class IrreversibleSolidReaction +: + public solidReaction +{ + // Private data + + // Reaction rate + ReactionRate k_; + + // Reaction order + scalar nReact_; + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator= + ( + const IrreversibleSolidReaction& + ); + + +public: + + //- Runtime type information + TypeName("irreversible"); + + + // Constructors + + //- Construct from components + IrreversibleSolidReaction + ( + const solidReaction& reaction, + const ReactionRate& reactionRate, + const scalar nReact + ); + + + //- Construct from Istream + IrreversibleSolidReaction + ( + const speciesTable& components, + Istream& is, + const speciesTable& pyrolysisGases + ); + + + //- Destructor + virtual ~IrreversibleSolidReaction() + {} + + + // Member Functions + + // IrreversibleSolidReaction rate coefficients + + //- Forward rate constant + virtual scalar kf + ( + const scalar T, + const scalar p, + const scalarField& c + ) const; + + + //- Reaction order + virtual scalar nReact() const; + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "IrreversibleSolidReaction.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C b/src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C new file mode 100644 index 0000000000..feb993e6aa --- /dev/null +++ b/src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C @@ -0,0 +1,325 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "solidReaction.H" +#include "DynamicList.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(solidReaction, 0); + defineRunTimeSelectionTable(solidReaction, Istream); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidReaction::solidReaction +( + const speciesTable& componets, + const speciesTable& pyrolisisGases, + const List