From ca6961f9ab9af06c3780f5be5f49feb203923a36 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Oct 2010 14:37:21 +0100 Subject: [PATCH 1/2] ENH: chtMultiregionFoam tutorial update --- .../multiRegionHeater/makeCellSets.setSet | 10 +++++----- .../multiRegionHeater/system/bottomAir/fvSolution | 9 ++++++++- .../multiRegionHeater/system/topAir/fvSolution | 9 ++++++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/makeCellSets.setSet b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/makeCellSets.setSet index 7e0c2bd522..8f85c9ef23 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/makeCellSets.setSet +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/makeCellSets.setSet @@ -1,11 +1,11 @@ -cellSet heater new boxToCell (-0.01 0 -100 )(0.01 0.01 100) -cellSet heater add boxToCell (-0.01 -100 -0.01)(0.01 0.01 0.01) +cellSet heater new boxToCell (-0.01001 0 -100 )(0.01001 0.00999 100) +cellSet heater add boxToCell (-0.01001 -100 -0.01001)(0.01001 0.00999 0.01001) cellZoneSet heater new setToCellZone heater -cellSet leftSolid new boxToCell (-100 0 -100 )(-0.01 0.01 100) +cellSet leftSolid new boxToCell (-100 0 -100 )(-0.01001 0.00999 100) cellZoneSet leftSolid new setToCellZone leftSolid -cellSet rightSolid new boxToCell (0.01 0 -100 )(100 0.01 100) +cellSet rightSolid new boxToCell (0.01001 0 -100 )(100 0.00999 100) cellZoneSet rightSolid new setToCellZone rightSolid -cellSet topAir new boxToCell (-100 0.01 -100 )(100 100 100) +cellSet topAir new boxToCell (-100 0.00999 -100 )(100 100 100) cellZoneSet topAir new setToCellZone topAir cellSet bottomAir clear cellSet bottomAir add cellToCell heater diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution index 1e968f0aea..036a4b0cb0 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSolution @@ -18,9 +18,16 @@ solvers { rho { - solver PCG + solver PCG; preconditioner DIC; tolerance 1e-8; + relTol 0.1; + } + + rhoFinal + { + $rho; + tolerance 1e-8; relTol 0; } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSolution index d2d44df4fc..3217c345e8 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSolution @@ -18,9 +18,16 @@ solvers { rho { - solver PCG + solver PCG; preconditioner DIC; tolerance 1e-7; + relTol 0.1; + } + + rhoFinal + { + $rho; + tolerance 1e-7; relTol 0; } From 88f0f2e4a3d3981855ffa2924af00141f9ca8ec9 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Oct 2010 14:38:03 +0100 Subject: [PATCH 2/2] ENH: simpleFoam, rhoSimpleFoam and porousSimpleFoam updates --- .../solvers/compressible/rhoSimpleFoam/pEqn.H | 20 ++---------- .../porousSimpleFoam/createFields.H | 32 +++++++++++++------ .../solvers/incompressible/simpleFoam/pEqn.H | 11 ++----- 3 files changed, 26 insertions(+), 37 deletions(-) diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index f43ec6cf62..96d8280559 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -30,15 +30,7 @@ if (transonic) pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + pEqn.solve(); if (nonOrth == nNonOrthCorr) { @@ -60,15 +52,7 @@ else pEqn.setReference(pRefCell, pRefValue); - // Retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + pEqn.solve(); if (nonOrth == nNonOrthCorr) { diff --git a/applications/solvers/incompressible/porousSimpleFoam/createFields.H b/applications/solvers/incompressible/porousSimpleFoam/createFields.H index d9bd0b5bac..2de8fbf737 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/createFields.H +++ b/applications/solvers/incompressible/porousSimpleFoam/createFields.H @@ -43,16 +43,28 @@ porousZones pZones(mesh); + Switch pressureImplicitPorosity(false); // nUCorrectors used for pressureImplicitPorosity int nUCorr = 0; - const bool pressureImplicitPorosity = - ( - pZones.size() - && mesh.solutionDict().subDict("SIMPLE").readIfPresent - ( - "nUCorrectors", - nUCorr - ) - && (nUCorr > 0) - ); + if (pZones.size()) + { + // nUCorrectors for pressureImplicitPorosity + if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors")) + { + nUCorr = readInt + ( + mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors") + ); + } + + if (nUCorr > 0) + { + pressureImplicitPorosity = true; + Info<< "Using pressure implicit porosity" << endl; + } + else + { + Info<< "Using pressure explicit porosity" << endl; + } + } diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 91f4e1a140..313f20cbb4 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -15,15 +15,8 @@ ); pEqn.setReference(pRefCell, pRefValue); - // retain the residual from the first iteration - if (nonOrth == 0) - { - pEqn.solve(); - } - else - { - pEqn.solve(); - } + + pEqn.solve(); if (nonOrth == nNonOrthCorr) {