diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H index 35881bb544c8013cd3b2f314221a0ee602d20426..602a04a6e5711512f26630fc2527ea394dc6a750 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H @@ -4,7 +4,8 @@ fvm::ddt(rho, U) + fvm::div(phi, U) + turb.divDevRhoReff(U) - + fvOptions(rho, U) + == + fvOptions(rho, U) ); UEqn().relax(); diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index e9aa9fb9b9efa54295d25c629fa901ca72bc9073..494acaf05fd83d7cc934cb0dd737d1d90af1b4af 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C @@ -77,8 +77,6 @@ int main(int argc, char *argv[]) #include "setrDeltaT.H" - tmp<surfaceScalarField> tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { @@ -91,8 +89,6 @@ int main(int argc, char *argv[]) #define LTSSOLVE #include "alphaEqnSubCycle.H" #undef LTSSOLVE - - interface.correct(); } turbulence->correct(); diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index 56527781a25b4f3b5093f04ccd5c370438e48635..ccf89e5467dc309e2162679dd8d1445a7fa46329 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C @@ -81,8 +81,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp<surfaceScalarField> tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H index f0e9dab4036dd0cde2e72f377e37290158bd008f..d7dddd4fa7c33289141718fc31cbe9e0aed7cbb0 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/alphaEqn.H @@ -2,11 +2,30 @@ word alphaScheme("div(phi,alpha)"); word alpharScheme("div(phirb,alpha)"); - surfaceScalarField phic(mag(phi/mesh.magSf())); - phic = min(interface.cAlpha()*phic, max(phic)); - surfaceScalarField phir(phic*interface.nHatf()); + // Standard face-flux compression coefficient + surfaceScalarField phic(interface.cAlpha()*mag(phi/mesh.magSf())); + + // Add the optional isotropic compression contribution + if (icAlpha > 0) + { + phic *= (1.0 - icAlpha); + phic += (interface.cAlpha()*icAlpha)*fvc::interpolate(mag(U)); + } + + // Do not compress interface at non-coupled boundary faces + // (inlets, outlets etc.) + forAll(phic.boundaryField(), patchi) + { + fvsPatchScalarField& phicp = phic.boundaryField()[patchi]; + + if (!phicp.coupled()) + { + phicp == 0; + } + } + + tmp<surfaceScalarField> tphiAlpha; - //***HGW if (pimple.firstIter() && MULESCorr) if (MULESCorr) { fvScalarMatrix alpha1Eqn @@ -32,12 +51,37 @@ << " Max(alpha1) = " << max(alpha1).value() << endl; - tphiAlpha = alpha1Eqn.flux(); + tmp<surfaceScalarField> tphiAlphaUD(alpha1Eqn.flux()); + tphiAlpha = tmp<surfaceScalarField> + ( + new surfaceScalarField(tphiAlphaUD()) + ); + + if (alphaApplyPrevCorr && tphiAlphaCorr0.valid()) + { + Info<< "Applying the previous iteration compression flux" << endl; + #ifdef LTSSOLVE + MULES::LTScorrect(alpha1, tphiAlpha(), tphiAlphaCorr0(), 1, 0); + #else + MULES::correct(alpha1, tphiAlpha(), tphiAlphaCorr0(), 1, 0); + #endif + + tphiAlpha() += tphiAlphaCorr0(); + } + + // Cache the upwind-flux + tphiAlphaCorr0 = tphiAlphaUD; + + alpha2 = 1.0 - alpha1; + + interface.correct(); } for (int aCorr=0; aCorr<nAlphaCorr; aCorr++) { - tmp<surfaceScalarField> tphiAlpha0 + surfaceScalarField phir(phic*interface.nHatf()); + + tmp<surfaceScalarField> tphiAlphaUn ( fvc::flux ( @@ -47,7 +91,7 @@ ) + fvc::flux ( - -fvc::flux(-phir, alpha2, alpharScheme), + -fvc::flux(-phir, alpha2, alpharScheme), alpha1, alpharScheme ) @@ -55,17 +99,29 @@ if (MULESCorr) { - tphiAlpha0() -= tphiAlpha(); + tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - tphiAlpha()); + volScalarField alpha10(alpha1); + #ifdef LTSSOLVE - MULES::LTScorrect(alpha1, tphiAlpha0(), 1, 0); + MULES::LTScorrect(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); #else - MULES::correct(alpha1, tphiAlpha0(), 1, 0); + MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0); #endif - tphiAlpha() += tphiAlpha0(); + + // Under-relax the correction for more than 3 correctors + if (aCorr < 3) + { + tphiAlpha() += tphiAlphaCorr(); + } + else + { + alpha1 = 0.5*alpha1 + 0.5*alpha10; + tphiAlpha() += 0.5*tphiAlphaCorr(); + } } else { - tphiAlpha = tphiAlpha0; + tphiAlpha = tphiAlphaUn; #ifdef LTSSOLVE MULES::explicitLTSSolve(alpha1, phi, tphiAlpha(), 1, 0); @@ -75,10 +131,17 @@ } alpha2 = 1.0 - alpha1; + + interface.correct(); } rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2; + if (alphaApplyPrevCorr && MULESCorr) + { + tphiAlphaCorr0 = tphiAlpha() - tphiAlphaCorr0; + } + Info<< "Phase-1 volume fraction = " << alpha1.weightedAverage(mesh.Vsc()).value() << " Min(alpha1) = " << min(alpha1).value() diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index 3039171f77a74c38d46bb5770ed85d8357f3d597..00a7d12db6ea3167de00e508756cce472626ffe6 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -135,3 +135,6 @@ } fv::IOoptionList fvOptions(mesh); + + + tmp<surfaceScalarField> tphiAlphaCorr0; diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index d56e300581d9d9e4cbd46dc79270392f4d51f887..0a3d7ed11e97ed60f03d44a5b8e61705d303c4f5 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -77,8 +77,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp<surfaceScalarField> tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 0ddfed50396eefbe37953f16d608fa60b69d83f1..f221ff9ad392adecef1637c88d4cf96a2acb75b4 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -80,8 +80,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp<surfaceScalarField> tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index 3321da57f9dffa699ab0a136187f94c34810f49f..fad22244619414c05db570ecc9ebc26b5d81c500 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -74,8 +74,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp<surfaceScalarField> tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 15b4439220846d0079623443d49ef38b0530ac86..d81f5c93d383300994b3827f11559d6d55935a79 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C @@ -83,8 +83,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - tmp<surfaceScalarField> tphiAlpha; - // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H index 45cba01d5b62d950cb6b7d795aa1819b3d7502c2..fb38fed37e994530d366eaf0070bf78e901261e2 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H @@ -71,6 +71,7 @@ ( geometricOneField(), alpha1, + tphiAlpha(), tphiAlphaCorr(), vDotvmcAlphal, ( diff --git a/doc/Doxygen/css/doxygen.css b/doc/Doxygen/css/doxygen.css index aeed6d325c636c2c8c37babbdcf2199a8f84b97a..f7c4231befc36fc9aeebbd24d1ada5af741cbf09 100644 --- a/doc/Doxygen/css/doxygen.css +++ b/doc/Doxygen/css/doxygen.css @@ -11,49 +11,49 @@ body, table, div, p, dl { /* @group Heading Levels */ h1 { - text-align: center; - font-size: 150%; + text-align: center; + font-size: 150%; } h2 { - font-size: 120%; + font-size: 120%; } h3 { - font-size: 100%; + font-size: 100%; } dt { - font-weight: bold; + font-weight: bold; } div.multicol { - -moz-column-gap: 1em; - -webkit-column-gap: 1em; - -moz-column-count: 3; - -webkit-column-count: 3; + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { - margin-top: 2px; + margin-top: 2px; } p.endli { - margin-bottom: 0px; + margin-bottom: 0px; } p.enddd { - margin-bottom: 4px; + margin-bottom: 4px; } p.endtd { - margin-bottom: 2px; + margin-bottom: 2px; } /* @end */ caption { - font-weight: bold; + font-weight: bold; } span.legend { @@ -67,47 +67,47 @@ h3.version { } div.qindex, div.navtab{ - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; } div.qindex, div.navpath { - width: 100%; - line-height: 140%; + width: 100%; + line-height: 140%; } div.navtab { - margin-right: 15px; + margin-right: 15px; } /* @group Link Styling */ a { - color: #153788; - font-weight: normal; - text-decoration: none; + color: #153788; + font-weight: normal; + text-decoration: none; } .contents a:visited { - color: #1b77c5; + color: #1b77c5; } a:hover { - text-decoration: underline; + text-decoration: underline; } a.qindex { - font-weight: bold; + font-weight: bold; } a.qindexHL { - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; } .contents a.qindexHL:visited { @@ -115,7 +115,7 @@ a.qindexHL { } a.el { - font-weight: bold; + font-weight: bold; } a.elRef { @@ -134,7 +134,7 @@ a.codeRef { /* @end */ dl.el { - margin-left: -1cm; + margin-left: -1cm; } .fragment { @@ -143,64 +143,64 @@ dl.el { } pre.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; } div.ah { - background-color: black; - font-weight: bold; - color: #ffffff; - margin-bottom: 3px; - margin-top: 3px + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px } div.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; } div.groupText { - margin-left: 16px; - font-style: italic; + margin-left: 16px; + font-style: italic; } body { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; } td.indexkey { - background-color: #e8eef2; - font-weight: bold; - border: 1px solid #CCCCCC; - margin: 2px 0px 2px 0; - padding: 2px 10px; + background-color: #e8eef2; + font-weight: bold; + border: 1px solid #CCCCCC; + margin: 2px 0px 2px 0; + padding: 2px 10px; } td.indexvalue { - background-color: #e8eef2; - border: 1px solid #CCCCCC; - padding: 2px 10px; - margin: 2px 0px; + background-color: #e8eef2; + border: 1px solid #CCCCCC; + padding: 2px 10px; + margin: 2px 0px; } tr.memlist { - background-color: #f0f0f0; + background-color: #f0f0f0; } p.formulaDsp { - text-align: center; + text-align: center; } img.formulaDsp { @@ -208,23 +208,23 @@ img.formulaDsp { } img.formulaInl { - vertical-align: middle; + vertical-align: middle; } div.center { - text-align: center; + text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { - border: 0px; + border: 0px; } img.footer { - border: 0px; - vertical-align: middle; + border: 0px; + vertical-align: middle; } /* @group Code Colorization */ @@ -287,45 +287,45 @@ span.vhdllogic { /* @end */ .search { - color: #003399; - font-weight: bold; + color: #003399; + font-weight: bold; } form.search { - margin-bottom: 0px; - margin-top: 0px; + margin-bottom: 0px; + margin-top: 0px; } input.search { - font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; } td.tiny { - font-size: 75%; + font-size: 75%; } .dirtab { - padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; + padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; } th.dirtab { - background: #e8eef2; - font-weight: bold; + background: #e8eef2; + font-weight: bold; } hr { - height: 0px; - border: none; - border-top: 1px solid #666; + height: 0px; + border: none; + border-top: 1px solid #666; } hr.footer { - height: 1px; + height: 1px; } /* @group Member Descriptions */ @@ -333,19 +333,19 @@ hr.footer { .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { - background-color: #FAFAFA; - border: none; - margin: 4px; - padding: 1px 0 0 8px; + background-color: #FAFAFA; + border: none; + margin: 4px; + padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { - padding: 0px 8px 4px 8px; - color: #555; + padding: 0px 8px 4px 8px; + color: #555; } .memItemLeft, .memItemRight, .memTemplParams { - border-top: 1px solid #ccc; + border-top: 1px solid #ccc; } .memItemLeft, .memTemplItemLeft { @@ -353,7 +353,7 @@ hr.footer { } .memTemplParams { - color: #606060; + color: #606060; white-space: nowrap; } @@ -364,24 +364,24 @@ hr.footer { /* Styles for detailed member documentation */ .memtemplate { - font-size: 80%; - color: #606060; - font-weight: normal; - margin-left: 3px; + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; } .memnav { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; } .memitem { - padding: 0; - margin-bottom: 10px; + padding: 0; + margin-bottom: 10px; } .memname { @@ -428,19 +428,19 @@ hr.footer { } .paramkey { - text-align: right; + text-align: right; } .paramtype { - white-space: nowrap; + white-space: nowrap; } .paramname { - color: #602020; - white-space: nowrap; + color: #602020; + white-space: nowrap; } .paramname em { - font-style: normal; + font-style: normal; } /* @end */ @@ -450,21 +450,21 @@ hr.footer { /* for the tree view */ .ftvtree { - font-family: sans-serif; - margin: 0.5em; + font-family: sans-serif; + margin: 0.5em; } /* these are for tree view when used as main index */ .directory { - font-size: 9pt; - font-weight: bold; + font-size: 9pt; + font-weight: bold; } .directory h3 { - margin: 0px; - margin-top: 1em; - font-size: 11pt; + margin: 0px; + margin-top: 1em; + font-size: 11pt; } /* @@ -476,86 +476,86 @@ proper pixel height of your image. /* .directory h3.swap { - height: 61px; - background-repeat: no-repeat; - background-image: url("yourimage.gif"); + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); } .directory h3.swap span { - display: none; + display: none; } */ .directory > h3 { - margin-top: 0; + margin-top: 0; } .directory p { - margin: 0px; - white-space: nowrap; + margin: 0px; + white-space: nowrap; } .directory div { - display: none; - margin: 0px; + display: none; + margin: 0px; } .directory img { - vertical-align: -30%; + vertical-align: -30%; } /* these are for tree view when not used as main index */ .directory-alt { - font-size: 100%; - font-weight: bold; + font-size: 100%; + font-weight: bold; } .directory-alt h3 { - margin: 0px; - margin-top: 1em; - font-size: 11pt; + margin: 0px; + margin-top: 1em; + font-size: 11pt; } .directory-alt > h3 { - margin-top: 0; + margin-top: 0; } .directory-alt p { - margin: 0px; - white-space: nowrap; + margin: 0px; + white-space: nowrap; } .directory-alt div { - display: none; - margin: 0px; + display: none; + margin: 0px; } .directory-alt img { - vertical-align: -30%; + vertical-align: -30%; } /* @end */ address { - font-style: normal; - color: #333; + font-style: normal; + color: #333; } table.doxtable { - border-collapse:collapse; + border-collapse:collapse; } table.doxtable td, table.doxtable th { - border: 1px solid #153788; - padding: 3px 7px 2px; + border: 1px solid #153788; + padding: 3px 7px 2px; } table.doxtable th { - background-color: #254798; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; - text-align:left; + background-color: #254798; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; } diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index a9049b07bc687923548c3483273df9b2c4872ffd..056c55c6069c84ee2dd3cefbc7d8a8e3c7bf4d77 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -110,7 +110,8 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject storeFilter_(true), timeStart_(-VGREAT), timeEnd_(VGREAT), - outputControl_(t, dict) + outputControl_(t, dict, "output"), + evaluateControl_(t, dict, "evaluate") { readDict(); } @@ -159,7 +160,10 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute allocateFilter(); } - ptr_->execute(); + if (evaluateControl_.output()) + { + ptr_->execute(); + } if (forceWrite || outputControl_.output()) { @@ -241,14 +245,14 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::adjustTimeStep() // function objects modify deltaT inside nStepsToStartTimeChange range // NOTE: Potential problem if two function objects dump inside the same - //interval + // interval if (nSteps < nStepsToStartTimeChange_) { label nStepsToNextWrite = label(nSteps) + 1; scalar newDeltaT = timeToNextWrite/nStepsToNextWrite; - //Adjust time step + // Adjust time step if (newDeltaT < deltaT) { deltaT = max(newDeltaT, 0.2*deltaT); diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index c9cc34c8cefc6edb5a9944b5b3fe20e5f42fe490..6e874dc52af90f17465a2d3adba896b0fa409ebe 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -98,6 +98,9 @@ class OutputFilterFunctionObject //- Output controls outputFilterOutputControl outputControl_; + //- Evaluate controls + outputFilterOutputControl evaluateControl_; + //- Pointer to the output filter autoPtr<OutputFilter> ptr_; diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index b711b2d17f01be5409002cd83c2892828a670a6d..f2bab5983a59aa08178027c26758581f3f6be2c0 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -31,9 +31,18 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // const Foam::word Foam::functionObjectFile::outputPrefix = "postProcessing"; +Foam::label Foam::functionObjectFile::addChars = 7; // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +void Foam::functionObjectFile::initStream(Ostream& os) const +{ + os.setf(ios_base::scientific, ios_base::floatfield); +// os.precision(IOstream::defaultPrecision()); + os.width(charWidth()); +} + + Foam::fileName Foam::functionObjectFile::baseFileDir() const { fileName baseDir = obr_.time().path(); @@ -96,6 +105,8 @@ void Foam::functionObjectFile::createFiles() filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat"))); + initStream(filePtrs_[i]); + writeFileHeader(i); i++; @@ -147,6 +158,12 @@ void Foam::functionObjectFile::resetName(const word& name) } +Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const +{ + return setw(IOstream::defaultPrecision() + addChars + offset); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::functionObjectFile::functionObjectFile @@ -289,4 +306,42 @@ Foam::OFstream& Foam::functionObjectFile::file(const label i) } +Foam::label Foam::functionObjectFile::charWidth() const +{ + return IOstream::defaultPrecision() + addChars; +} + + +void Foam::functionObjectFile::writeCommented +( + Ostream& os, + const string& str +) const +{ + os << setw(1) << "#" << setw(1) << ' ' + << setw(charWidth() - 2) << str.c_str(); +} + + +void Foam::functionObjectFile::writeTabbed +( + Ostream& os, + const string& str +) const +{ + os << tab << setw(charWidth()) << str.c_str(); +} + + +void Foam::functionObjectFile::writeHeader +( + Ostream& os, + const string& str +) const +{ + os << setw(1) << "#" << setw(1) << ' ' + << setf(ios_base::left) << setw(charWidth() - 2) << str.c_str() << nl; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H index f4c0ab11782e45dad3424bac6f13e14d77db7efa..5488da6e58635a496cb89ffefa4d5c84633eb79d 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ SourceFiles #include "OFstream.H" #include "PtrList.H" #include "HashSet.H" +#include "IOmanip.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,6 +78,9 @@ protected: // Protected Member Functions + //- Initialise the output stream for writing + virtual void initStream(Ostream& os) const; + //- Return the base directory for output virtual fileName baseFileDir() const; @@ -98,6 +102,9 @@ protected: //- Reset the list of names to a single name entry virtual void resetName(const word& name); + //- Return the value width when writing to stream with optional offset + virtual Omanip<int> valueWidth(const label offset = 0) const; + //- Disallow default bitwise copy construct functionObjectFile(const functionObjectFile&); @@ -110,6 +117,9 @@ public: //- Folder prefix static const word outputPrefix; + //- Additional characters for writing + static label addChars; + // Constructors //- Construct null @@ -149,6 +159,39 @@ public: //- Return file 'i' OFstream& file(const label i); + + //- Write a commented string to stream + void writeCommented + ( + Ostream& os, + const string& str + ) const; + + //- Write a tabbed string to stream + void writeTabbed + ( + Ostream& os, + const string& str + ) const; + + //- Write a commented header to stream + void writeHeader + ( + Ostream& os, + const string& str + ) const; + + //- Write a (commented) header property and value pair + template<class Type> + void writeHeaderValue + ( + Ostream& os, + const string& property, + const Type& value + ) const; + + //- Return width of character stream output + label charWidth() const; }; @@ -158,6 +201,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository + #include "functionObjectFileTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFileTemplates.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFileTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..a9180e1fee6afa69bdc0b556949be6ded7208090 --- /dev/null +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFileTemplates.C @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "OStringStream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> +void Foam::functionObjectFile::writeHeaderValue +( + Ostream& os, + const string& property, + const Type& value +) const +{ + os << setw(1) << '#' << setw(1) << ' ' + << setw(charWidth() - 2) << setf(ios_base::left) << property.c_str() + << setw(1) << ':' << setw(1) << ' ' << value << nl; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C index 6865b31fb9e1aada45639df45072efe01a7fdade..5ddb9d564baf86a642f69c9975ce5860a6d1a5e1 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C @@ -31,7 +31,7 @@ License namespace Foam { template<> - const char* NamedEnum<outputFilterOutputControl::outputControls, 6>:: + const char* NamedEnum<outputFilterOutputControl::outputControls, 7>:: names[] = { "timeStep", @@ -39,11 +39,12 @@ namespace Foam "adjustableTime", "runTime", "clockTime", - "cpuTime" + "cpuTime", + "none" }; } -const Foam::NamedEnum<Foam::outputFilterOutputControl::outputControls, 6> +const Foam::NamedEnum<Foam::outputFilterOutputControl::outputControls, 7> Foam::outputFilterOutputControl::outputControlNames_; @@ -52,10 +53,12 @@ const Foam::NamedEnum<Foam::outputFilterOutputControl::outputControls, 6> Foam::outputFilterOutputControl::outputFilterOutputControl ( const Time& t, - const dictionary& dict + const dictionary& dict, + const word& prefix ) : time_(t), + prefix_(prefix), outputControl_(ocTimeStep), outputInterval_(0), outputTimeLastDump_(0), @@ -75,9 +78,12 @@ Foam::outputFilterOutputControl::~outputFilterOutputControl() void Foam::outputFilterOutputControl::read(const dictionary& dict) { - if (dict.found("outputControl")) + const word controlName(prefix_ + "Control"); + const word intervalName(prefix_ + "Interval"); + + if (dict.found(controlName)) { - outputControl_ = outputControlNames_.read(dict.lookup("outputControl")); + outputControl_ = outputControlNames_.read(dict.lookup(controlName)); } else { @@ -88,13 +94,13 @@ void Foam::outputFilterOutputControl::read(const dictionary& dict) { case ocTimeStep: { - outputInterval_ = dict.lookupOrDefault<label>("outputInterval", 0); + outputInterval_ = dict.lookupOrDefault<label>(intervalName, 0); break; } case ocOutputTime: { - outputInterval_ = dict.lookupOrDefault<label>("outputInterval", 1); + outputInterval_ = dict.lookupOrDefault<label>(intervalName, 1); break; } @@ -190,6 +196,11 @@ bool Foam::outputFilterOutputControl::output() break; } + case ocNone: + { + return false; + } + default: { // this error should not actually be possible diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.H b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.H index 240ec43645dea803b3b2b1c092b899687a5a6579..1818fe17009da1beab37ff6ed12c650b57364f58 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.H +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.H @@ -61,7 +61,8 @@ public: ocAdjustableTime, /*!< Adjust time step for dumping */ ocRunTime, /*!< run time for dumping */ ocClockTime, /*!< clock time for dumping */ - ocCpuTime /*!< cpu time for dumping */ + ocCpuTime, /*!< cpu time for dumping */ + ocNone /*!< no output */ }; @@ -72,8 +73,11 @@ private: //- Time object const Time& time_; + //- Prefix + const word prefix_; + //- String representation of outputControls enums - static const NamedEnum<outputControls, 6> outputControlNames_; + static const NamedEnum<outputControls, 7> outputControlNames_; //- Type of output outputControls outputControl_; @@ -101,7 +105,12 @@ public: // Constructors //- Construct from Time object and dictionary - outputFilterOutputControl(const Time&, const dictionary&); + outputFilterOutputControl + ( + const Time&, + const dictionary&, + const word& prefix + ); //- Destructor diff --git a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H index e6fb30a20f391e473176355098750086e182c4a8..8adbc4b2042dd3cbd42f2363a3cf0498d4d542ec 100644 --- a/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H +++ b/src/OpenFOAM/primitives/functions/DataEntry/CSV/CSV.H @@ -32,7 +32,7 @@ Description <entryName> csvFile; csvFileCoeffs { - nHeaderLines 4; + nHeaderLine 4; refColumn 0; // reference column index componentColumns (1 2 3); // component column indices separator ","; // optional (defaults to ",") diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C index 9cc5ed3d6d7c828f457d14f19afe6048a20c4dfa..efed7f22f7bbbbe9db677fc0628b47a526c329d4 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C @@ -3185,7 +3185,8 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2 forAll(refineCell, cellI) { - if (refineCell.get(cellI)) +// if (refineCell.get(cellI)) + if (refineCell[cellI]) { nRefined++; } @@ -3196,7 +3197,8 @@ Foam::labelList Foam::hexRef8::consistentSlowRefinement2 forAll(refineCell, cellI) { - if (refineCell.get(cellI)) +// if (refineCell.get(cellI)) + if (refineCell[cellI]) { newCellsToRefine[nRefined++] = cellI; } diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 96d096f036945b62d25918853255077f4c4d38cb..67deac58109ac4285d0e2b029048916a76e7de02 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -189,9 +189,11 @@ $(derivedFvPatchFields)/uniformJumpAMI/uniformJumpAMIFvPatchFields.C $(derivedFvPatchFields)/uniformTotalPressure/uniformTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/variableHeightFlowRate/variableHeightFlowRateFvPatchField.C $(derivedFvPatchFields)/variableHeightFlowRateInletVelocity/variableHeightFlowRateInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C $(derivedFvPatchFields)/interstitialInletVelocity/interstitialInletVelocityFvPatchVectorField.C +$(derivedFvPatchFields)/prghPressure/prghPressureFvPatchScalarField.C fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C @@ -376,6 +378,7 @@ $(laplacianSchemes)/gaussLaplacianScheme/gaussLaplacianSchemes.C finiteVolume/fvc/fvcMeshPhi.C finiteVolume/fvc/fvcSmooth/fvcSmooth.C +finiteVolume/fvc/fvcReconstructMag.C general = cfdTools/general $(general)/findRefCell/findRefCell.C diff --git a/src/finiteVolume/cfdTools/general/include/alphaControls.H b/src/finiteVolume/cfdTools/general/include/alphaControls.H index e57869309aa3da416416158d413863ac6919b016..636e13d8484cbf5d7ddb22a47b33442580cad54b 100644 --- a/src/finiteVolume/cfdTools/general/include/alphaControls.H +++ b/src/finiteVolume/cfdTools/general/include/alphaControls.H @@ -10,3 +10,17 @@ bool alphaOuterCorrectors ( alphaControls.lookupOrDefault<Switch>("alphaOuterCorrectors", false) ); + +// Apply the compression correction from the previous iteration +// Improves efficiency for steady-simulations but can only be applied +// once the alpha field is reasonably steady, i.e. fully developed +bool alphaApplyPrevCorr +( + alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false) +); + +// Isotropic compression coefficient +scalar icAlpha +( + alphaControls.lookupOrDefault<scalar>("icAlpha", 0) +); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..abf782bc901c814f8801d89baa1cdff8e97294b0 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.C @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "outletPhaseMeanVelocityFvPatchVectorField.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + mixedFvPatchField<vector>(p, iF), + Umean_(0), + alphaName_("none") +{ + refValue() = vector::zero; + refGrad() = vector::zero; + valueFraction() = 0.0; +} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const outletPhaseMeanVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchField<vector>(ptf, p, iF, mapper), + Umean_(ptf.Umean_), + alphaName_(ptf.alphaName_) +{} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + mixedFvPatchField<vector>(p, iF), + Umean_(readScalar(dict.lookup("Umean"))), + alphaName_(dict.lookup("alpha")) +{ + refValue() = vector::zero; + refGrad() = vector::zero; + valueFraction() = 0.0; + + if (dict.found("value")) + { + fvPatchVectorField::operator= + ( + vectorField("value", dict, p.size()) + ); + } + else + { + fvPatchVectorField::operator=(patchInternalField()); + } +} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const outletPhaseMeanVelocityFvPatchVectorField& ptf +) +: + mixedFvPatchField<vector>(ptf), + Umean_(ptf.Umean_), + alphaName_(ptf.alphaName_) +{} + + +Foam::outletPhaseMeanVelocityFvPatchVectorField +::outletPhaseMeanVelocityFvPatchVectorField +( + const outletPhaseMeanVelocityFvPatchVectorField& ptf, + const DimensionedField<vector, volMesh>& iF +) +: + mixedFvPatchField<vector>(ptf, iF), + Umean_(ptf.Umean_), + alphaName_(ptf.alphaName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::outletPhaseMeanVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + scalarField alphap = + patch().lookupPatchField<volScalarField, scalar>(alphaName_); + + alphap = max(alphap, scalar(0)); + alphap = min(alphap, scalar(1)); + + // Get the patchInternalField (zero-gradient field) + vectorField Uzg(patchInternalField()); + + // Calculate the phase mean zero-gradient velocity + scalar Uzgmean = + gSum(alphap*(patch().Sf() & Uzg)) + /gSum(alphap*patch().magSf()); + + // Set the refValue and valueFraction to adjust the boundary field + // such that the phase mean is Umean_ + if (Uzgmean >= Umean_) + { + refValue() = vector::zero; + valueFraction() = 1.0 - Umean_/Uzgmean; + } + else + { + refValue() = (Umean_ + Uzgmean)*patch().nf(); + valueFraction() = 1.0 - Uzgmean/Umean_; + } + + mixedFvPatchField<vector>::updateCoeffs(); +} + + +void Foam::outletPhaseMeanVelocityFvPatchVectorField::write +( + Ostream& os +) const +{ + fvPatchField<vector>::write(os); + + os.writeKeyword("Umean") << Umean_ + << token::END_STATEMENT << nl; + os.writeKeyword("alpha") << alphaName_ + << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + outletPhaseMeanVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..5e5dec0213edac5b81013eb9209c76047a87ff24 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/outletPhaseMeanVelocity/outletPhaseMeanVelocityFvPatchVectorField.H @@ -0,0 +1,197 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::outletPhaseMeanVelocityFvPatchVectorField + +Group + grpOutletBoundaryConditions + +Description + This boundary condition adjusts the velocity for the given phase to achieve + the specified mean thus causing the phase-fraction to adjust according to + the mass flow rate. + + Typical usage is as the outlet condition for a towing-tank ship simulation + to maintain the outlet water level at the level as the inlet. + + \heading Patch usage + \table + Property | Description | Required | Default value + Umean | mean velocity normal to the boundary [m/s] | yes | + alpha | phase-fraction field | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type outletPhaseMeanVelocity; + Umean 1.2; + alpha alpha.water; + value uniform (1.2 0 0); + } + \endverbatim + +SeeAlso + Foam::mixedFvPatchField + Foam::variableHeightFlowRateInletVelocityFvPatchVectorField + +SourceFiles + outletPhaseMeanVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef outletPhaseMeanVelocityFvPatchVectorField_H +#define outletPhaseMeanVelocityFvPatchVectorField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class outletPhaseMeanVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class outletPhaseMeanVelocityFvPatchVectorField +: + public mixedFvPatchVectorField +{ + // Private data + + //- Inlet integral flow rate + scalar Umean_; + + //- Name of the phase-fraction field + word alphaName_; + + +public: + + //- Runtime type information + TypeName("outletPhaseMeanVelocity"); + + + // Constructors + + //- Construct from patch and internal field + outletPhaseMeanVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + outletPhaseMeanVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // outletPhaseMeanVelocityFvPatchVectorField + // onto a new patch + outletPhaseMeanVelocityFvPatchVectorField + ( + const outletPhaseMeanVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + outletPhaseMeanVelocityFvPatchVectorField + ( + const outletPhaseMeanVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new outletPhaseMeanVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + outletPhaseMeanVelocityFvPatchVectorField + ( + const outletPhaseMeanVelocityFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + new outletPhaseMeanVelocityFvPatchVectorField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Access + + //- Return the flux + scalar Umean() const + { + return Umean_; + } + + //- Return reference to the flux to allow adjustment + scalar& Umean() + { + return Umean_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C index 9ce17a2025eb251598ac6600470859b15625bb54..0eb6a5203485ab26ccd78b5a82478e38f6b12f3d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,8 +41,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho"), - UName_("U") + rhoName_("rho") { refValue() = *this; refGrad() = vector::zero; @@ -61,8 +60,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - UName_(ptf.UName_) + rhoName_(ptf.rhoName_) {} @@ -76,8 +74,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - UName_(dict.lookupOrDefault<word>("U", "U")) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); refValue() = *this; @@ -94,8 +91,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_), - UName_(pivpvf.UName_) + rhoName_(pivpvf.rhoName_) {} @@ -108,8 +104,7 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_), - UName_(pivpvf.UName_) + rhoName_(pivpvf.rhoName_) {} @@ -122,8 +117,6 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() return; } - const label patchI = patch().index(); - const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>(phiName_); @@ -131,23 +124,22 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() patch().patchField<surfaceScalarField, scalar>(phi); tmp<vectorField> n = patch().nf(); - const Field<scalar>& magS = patch().magSf(); - - const volVectorField& U = db().lookupObject<volVectorField>(UName_); + const Field<scalar>& magSf = patch().magSf(); - vectorField Uc(U.boundaryField()[patchI].patchInternalField()); - Uc -= n()*(Uc & n()); + // Get the tangential component from the internalField (zero-gradient) + vectorField Ut(patchInternalField()); + Ut -= n()*(Ut & n()); if (phi.dimensions() == dimVelocity*dimArea) { - refValue() = Uc + n*phip/magS; + refValue() = Ut + n*phip/magSf; } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField<scalar>& rhop = patch().lookupPatchField<volScalarField, scalar>(rhoName_); - refValue() = Uc + n*phip/(rhop*magS); + refValue() = Ut + n*phip/(rhop*magSf); } else { @@ -176,7 +168,6 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::write fvPatchVectorField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - writeEntryIfDifferent<word>(os, "U", "U", UName_); writeEntry("value", os); } @@ -188,11 +179,7 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::operator= const fvPatchField<vector>& pvf ) { - fvPatchField<vector>::operator= - ( - valueFraction()*(patch().nf()*(patch().nf() & pvf)) - + (1 - valueFraction())*pvf - ); + fvPatchField<vector>::operator=(pvf); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H index 5a485362d59ccef07936cb892b5fa6199c1fc10d..f73730907d3fed98de48120ba103450562ced54b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,6 @@ Description Property | Description | Required | Default value phi | flux field name | no | phi rho | density field name | no | rho - U | velocity field name | no | U \endtable Example of the boundary condition specification: @@ -95,9 +94,6 @@ class pressureInletOutletParSlipVelocityFvPatchVectorField //- Density field name word rhoName_; - //- Velocity field name - word UName_; - public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C index 8503b83ef70ebcf607b05eef9540fa764e559e52..fda087d8b5bacfc17381f8a02b62242e470d44f1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,10 +25,10 @@ License #include "pressureInletOutletVelocityFvPatchVectorField.H" #include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" #include "volFields.H" #include "surfaceFields.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::pressureInletOutletVelocityFvPatchVectorField:: @@ -38,12 +38,14 @@ pressureInletOutletVelocityFvPatchVectorField const DimensionedField<vector, volMesh>& iF ) : - directionMixedFvPatchVectorField(p, iF), - phiName_("phi") + mixedFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho"), + applyTangentialVelocity_(false) { - refValue() = vector::zero; + refValue() = *this; refGrad() = vector::zero; - valueFraction() = symmTensor::zero; + valueFraction() = 0.0; } @@ -56,10 +58,12 @@ pressureInletOutletVelocityFvPatchVectorField const fvPatchFieldMapper& mapper ) : - directionMixedFvPatchVectorField(ptf, p, iF, mapper), - phiName_(ptf.phiName_) + mixedFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_), + applyTangentialVelocity_(ptf.applyTangentialVelocity_) { - if (ptf.tangentialVelocity_.size()) + if (applyTangentialVelocity_) { tangentialVelocity_ = mapper(ptf.tangentialVelocity_); } @@ -74,25 +78,26 @@ pressureInletOutletVelocityFvPatchVectorField const dictionary& dict ) : - directionMixedFvPatchVectorField(p, iF), - phiName_(dict.lookupOrDefault<word>("phi", "phi")) + mixedFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault<word>("phi", "phi")), + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + applyTangentialVelocity_(false) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); if (dict.found("tangentialVelocity")) { + applyTangentialVelocity_ = true; + setTangentialVelocity ( vectorField("tangentialVelocity", dict, p.size()) ); } - else - { - refValue() = vector::zero; - } + refValue() = *this; refGrad() = vector::zero; - valueFraction() = symmTensor::zero; + valueFraction() = 0.0; } @@ -102,9 +107,11 @@ pressureInletOutletVelocityFvPatchVectorField const pressureInletOutletVelocityFvPatchVectorField& pivpvf ) : - directionMixedFvPatchVectorField(pivpvf), + mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), - tangentialVelocity_(pivpvf.tangentialVelocity_) + rhoName_(pivpvf.rhoName_), + tangentialVelocity_(pivpvf.tangentialVelocity_), + applyTangentialVelocity_(pivpvf.applyTangentialVelocity_) {} @@ -115,9 +122,11 @@ pressureInletOutletVelocityFvPatchVectorField const DimensionedField<vector, volMesh>& iF ) : - directionMixedFvPatchVectorField(pivpvf, iF), + mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), - tangentialVelocity_(pivpvf.tangentialVelocity_) + rhoName_(pivpvf.rhoName_), + tangentialVelocity_(pivpvf.tangentialVelocity_), + applyTangentialVelocity_(pivpvf.applyTangentialVelocity_) {} @@ -126,9 +135,10 @@ pressureInletOutletVelocityFvPatchVectorField void Foam::pressureInletOutletVelocityFvPatchVectorField:: setTangentialVelocity(const vectorField& tangentialVelocity) { + applyTangentialVelocity_ = true; tangentialVelocity_ = tangentialVelocity; - const vectorField n(patch().nf()); - refValue() = tangentialVelocity_ - n*(n & tangentialVelocity_); + vectorField n(patch().nf()); + tangentialVelocity_ -= n*(n & tangentialVelocity_); } @@ -137,8 +147,8 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::autoMap const fvPatchFieldMapper& m ) { - directionMixedFvPatchVectorField::autoMap(m); - if (tangentialVelocity_.size()) + mixedFvPatchVectorField::autoMap(m); + if (applyTangentialVelocity_) { tangentialVelocity_.autoMap(m); } @@ -151,9 +161,9 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::rmap const labelList& addr ) { - directionMixedFvPatchVectorField::rmap(ptf, addr); + mixedFvPatchVectorField::rmap(ptf, addr); - if (tangentialVelocity_.size()) + if (applyTangentialVelocity_) { const pressureInletOutletVelocityFvPatchVectorField& tiptf = refCast<const pressureInletOutletVelocityFvPatchVectorField>(ptf); @@ -170,25 +180,67 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::updateCoeffs() return; } + const surfaceScalarField& phi = + db().lookupObject<surfaceScalarField>(phiName_); + const fvsPatchField<scalar>& phip = - patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); + patch().patchField<surfaceScalarField, scalar>(phi); - valueFraction() = neg(phip)*(I - sqr(patch().nf())); + vectorField n(patch().nf()); + const Field<scalar>& magSf = patch().magSf(); - directionMixedFvPatchVectorField::updateCoeffs(); - directionMixedFvPatchVectorField::evaluate(); + if (phi.dimensions() == dimVelocity*dimArea) + { + refValue() = n*phip/magSf; + } + else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) + { + const fvPatchField<scalar>& rhop = + patch().lookupPatchField<volScalarField, scalar>(rhoName_); + + refValue() = n*phip/(rhop*magSf); + } + else + { + FatalErrorIn + ( + "pressureInletOutletVelocityFvPatchVectorField::" + "updateCoeffs()" + ) << "dimensions of phi are not correct" << nl + << " on patch " << this->patch().name() + << " of field " << this->dimensionedInternalField().name() + << " in file " << this->dimensionedInternalField().objectPath() + << exit(FatalError); + } + + if (applyTangentialVelocity_) + { + // Adjust the tangential velocity to conserve kinetic energy + // of the entrained fluid + // scalarField magSqrUt(magSqr(tangentialVelocity_)); + // scalarField scale + // ( + // sqrt(max(magSqrUt - magSqr(refValue()), scalar(0))/magSqrUt) + // ); + // refValue() += scale*tangentialVelocity_; + refValue() += tangentialVelocity_; + } + + valueFraction() = 1.0 - pos(phip); + + mixedFvPatchVectorField::updateCoeffs(); } void Foam::pressureInletOutletVelocityFvPatchVectorField::write ( Ostream& os -) -const +) const { fvPatchVectorField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); - if (tangentialVelocity_.size()) + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + if (applyTangentialVelocity_) { tangentialVelocity_.writeEntry("tangentialVelocity", os); } @@ -203,9 +255,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::operator= const fvPatchField<vector>& pvf ) { - tmp<vectorField> normalValue = transform(valueFraction(), refValue()); - tmp<vectorField> transformGradValue = transform(I - valueFraction(), pvf); - fvPatchField<vector>::operator=(normalValue + transformGradValue); + fvPatchField<vector>::operator=(pvf); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H index 49ebb5d77e8ca16dfd2ba119b0b49cd3cf3fb367..4f8c546452e1396b2e7ede330358f75acd7a1f6b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletVelocity/pressureInletOutletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,21 +25,21 @@ Class Foam::pressureInletOutletVelocityFvPatchVectorField Group - grpInletletBoundaryConditions grpOutletBoundaryConditions + grpInletBoundaryConditions grpOutletBoundaryConditions Description This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is - obtained from the patch-face normal component of the internal-cell value. - - The tangential patch velocity can be optionally specified. + obtained from the patch-face normal component of the internal-cell value and + the tangential patch velocity can be optionally specified. \heading Patch usage \table Property | Description | Required | Default value phi | flux field name | no | phi + rho | density field name | no | rho tangentialVelocity | tangential velocity field | no | \endtable @@ -49,6 +49,7 @@ Description { type pressureInletOutletVelocity; phi phi; + rho rho; tangentialVelocity uniform (0 0 0); value uniform 0; } @@ -69,7 +70,7 @@ SourceFiles #define pressureInletOutletVelocityFvPatchVectorField_H #include "fvPatchFields.H" -#include "directionMixedFvPatchFields.H" +#include "mixedFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -77,21 +78,29 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class pressureInletOutletVelocityFvPatchVectorField Declaration + Class pressureInletOutletVelocityFvPatchVectorField Declaration \*---------------------------------------------------------------------------*/ class pressureInletOutletVelocityFvPatchVectorField : - public directionMixedFvPatchVectorField + public mixedFvPatchVectorField { // Private data //- Flux field name word phiName_; + //- Density field name + word rhoName_; + + +protected: + //- Optional tangential velocity component vectorField tangentialVelocity_; + bool applyTangentialVelocity_; + public: @@ -108,22 +117,23 @@ public: const DimensionedField<vector, volMesh>& ); - //- Construct from patch, internal field and dictionary + //- Construct by mapping given + // pressureInletOutletVelocityFvPatchVectorField + // onto a new patch pressureInletOutletVelocityFvPatchVectorField ( + const pressureInletOutletVelocityFvPatchVectorField&, const fvPatch&, const DimensionedField<vector, volMesh>&, - const dictionary& + const fvPatchFieldMapper& ); - //- Construct by mapping given - // pressureInletOutletVelocityFvPatchVectorField onto a new patch + //- Construct from patch, internal field and dictionary pressureInletOutletVelocityFvPatchVectorField ( - const pressureInletOutletVelocityFvPatchVectorField&, const fvPatch&, const DimensionedField<vector, volMesh>&, - const fvPatchFieldMapper& + const dictionary& ); //- Construct as copy @@ -137,7 +147,10 @@ public: { return tmp<fvPatchVectorField> ( - new pressureInletOutletVelocityFvPatchVectorField(*this) + new pressureInletOutletVelocityFvPatchVectorField + ( + *this + ) ); } @@ -156,7 +169,11 @@ public: { return tmp<fvPatchVectorField> ( - new pressureInletOutletVelocityFvPatchVectorField(*this, iF) + new pressureInletOutletVelocityFvPatchVectorField + ( + *this, + iF + ) ); } @@ -177,6 +194,18 @@ public: return phiName_; } + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + //- Return the tangential velocity const vectorField& tangentialVelocity() const { diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..2338247e7883896265b82c85b5f768e7c666b18c --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.C @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "prghPressureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(p, iF), + rhoName_("rho"), + p_(p.size(), 0.0) +{} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF), + rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")), + p_("p", dict, p.size()) +{ + if (dict.found("value")) + { + fvPatchScalarField::operator= + ( + scalarField("value", dict, p.size()) + ); + } + else + { + fvPatchField<scalar>::operator=(p_); + } +} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const prghPressureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + rhoName_(ptf.rhoName_), + p_(ptf.p_, mapper) +{} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const prghPressureFvPatchScalarField& ptf +) +: + fixedValueFvPatchScalarField(ptf), + rhoName_(ptf.rhoName_), + p_(ptf.p_) +{} + + +Foam::prghPressureFvPatchScalarField:: +prghPressureFvPatchScalarField +( + const prghPressureFvPatchScalarField& ptf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(ptf, iF), + rhoName_(ptf.rhoName_), + p_(ptf.p_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::prghPressureFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + fixedValueFvPatchScalarField::autoMap(m); + p_.autoMap(m); +} + + +void Foam::prghPressureFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + fixedValueFvPatchScalarField::rmap(ptf, addr); + + const prghPressureFvPatchScalarField& tiptf = + refCast<const prghPressureFvPatchScalarField>(ptf); + + p_.rmap(tiptf.p_, addr); +} + + +void Foam::prghPressureFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const scalarField& rhop = patch().lookupPatchField<volScalarField, scalar> + ( + rhoName_ + ); + + const uniformDimensionedVectorField& g = + db().lookupObject<uniformDimensionedVectorField>("g"); + + operator==(p_ - rhop*((g.value() & patch().Cf()))); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::prghPressureFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + if (rhoName_ != "rho") + { + os.writeKeyword("rhoName") + << rhoName_ << token::END_STATEMENT << nl; + } + p_.writeEntry("p", os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + prghPressureFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..9431ae325e26e1cd2f9bc3fd211cf35b345a79c5 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/prghPressure/prghPressureFvPatchScalarField.H @@ -0,0 +1,236 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::prghPressureFvPatchScalarField + +Group + grpGenericBoundaryConditions + +Description + This boundary condition provides static pressure condition for p_rgh, + calculated as: + + \f[ + p_rgh = p - \rho g h + \f] + + where + \vartable + p_rgh | Pseudo hydrostatic pressure [Pa] + p | Static pressure [Pa] + h | Height in the opposite direction to gravity + \rho | density + g | acceleration due to gravity [m/s2] + \endtable + + \heading Patch usage + + \table + Property | Description | Required | Default value + rhoName | rho field name | no | rho + p | static pressure | yes | + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type prghPressure; + rhoName rho; + p uniform 0; + value uniform 0; // optional initial value + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchScalarField + +SourceFiles + prghPressureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef prghPressureFvPatchScalarField_H +#define prghPressureFvPatchScalarField_H + +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class prghPressureFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class prghPressureFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + +protected: + + // Protected data + + //- Name of phase-fraction field + word rhoName_; + + //- Static pressure + scalarField p_; + + +public: + + //- Runtime type information + TypeName("prghPressure"); + + + // Constructors + + //- Construct from patch and internal field + prghPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + prghPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // prghPressureFvPatchScalarField onto a new patch + prghPressureFvPatchScalarField + ( + const prghPressureFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + prghPressureFvPatchScalarField + ( + const prghPressureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField > + ( + new prghPressureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + prghPressureFvPatchScalarField + ( + const prghPressureFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new prghPressureFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the rhoName + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the rhoName to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the static pressure + const scalarField& p() const + { + return p_; + } + + //- Return reference to the static pressure to allow adjustment + scalarField& p() + { + return p_; + } + + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C index 830a4b128854dbd5ae61db052e1940fcef2412fa..e9f2bbeef6db8a4993ff674b96907d10b012dd37 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,17 +33,17 @@ License void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: calcTangentialVelocity() { + applyTangentialVelocity_ = true; + const scalar t = this->db().time().timeOutputValue(); vector om = omega_->value(t); vector axisHat = om/mag(om); - const vectorField tangentialVelocity - ( - (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())) - ); + tangentialVelocity_ = + (-om) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())); const vectorField n(patch().nf()); - refValue() = tangentialVelocity - n*(n & tangentialVelocity); + tangentialVelocity_ -= n*(n & tangentialVelocity_); } @@ -72,9 +72,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(ptf, p, iF, mapper), omega_(ptf.omega_().clone().ptr()) -{ - calcTangentialVelocity(); -} +{} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -87,9 +85,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(p, iF, dict), omega_(DataEntry<vector>::New("omega", dict)) -{ - calcTangentialVelocity(); -} +{} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -100,9 +96,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(rppvf), omega_(rppvf.omega_().clone().ptr()) -{ - calcTangentialVelocity(); -} +{} Foam::rotatingPressureInletOutletVelocityFvPatchVectorField:: @@ -114,12 +108,23 @@ rotatingPressureInletOutletVelocityFvPatchVectorField : pressureInletOutletVelocityFvPatchVectorField(rppvf, iF), omega_(rppvf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::updateCoeffs() { + if (updated()) + { + return; + } + calcTangentialVelocity(); -} + pressureInletOutletVelocityFvPatchVectorField::updateCoeffs(); +} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::rotatingPressureInletOutletVelocityFvPatchVectorField::write ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H index cc114d7c6b8110adc0eed599ae2abc17bc646b65..b4b7297692b508825728204c1d600a368769d614 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ Description Property | Description | Required | Default value phi | flux field name | no | phi tangentialVelocity | tangential velocity field | no | - omega | angular velocty of the frame [rad/s] | yes | + omega | angular velocty of the frame [rad/s] | yes | \endtable Example of the boundary condition specification: @@ -49,7 +49,7 @@ Description type rotatingPressureInletOutletVelocity; phi phi; tangentialVelocity uniform (0 0 0); - omega 100; + omega 100; } \endverbatim @@ -177,6 +177,9 @@ public: // Member functions + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + //- Write virtual void write(Ostream&) const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H index 5c4070733451070f677ad982e4126b0489d537a8..5887bbc3fa9e92e6752aefcfac7e9f6e1b4a4040 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalPressure/totalPressureFvPatchScalarField.H @@ -33,47 +33,47 @@ Description 1. incompressible subsonic: \f[ - p_T = p_0 + 0.5 |U|^2 + p_p = p_0 - 0.5 |U|^2 \f] where \vartable - p_T | incompressible total pressure [m2/s2] - p_0 | incompressible reference pressure [m2/s2] + p_p | incompressible pressure at patch [m2/s2] + p_0 | incompressible total pressure [m2/s2] U | velocity \endvartable 2. compressible subsonic: \f[ - p_T = p_0 + 0.5 \rho |U|^2 + p_p = p_0 - 0.5 \rho |U|^2 \f] where \vartable - p_T | total pressure [Pa] - p_0 | reference pressure [Pa] + p_p | pressure at patch [Pa] + p_0 | total pressure [Pa] \rho | density [kg/m3] U | velocity \endvartable 3. compressible transonic (\gamma <= 1): \f[ - p_T = \frac{p_0}{1 + 0.5 \psi |U|^2} + p_p = \frac{p_0}{1 + 0.5 \psi |U|^2} \f] where \vartable - p_T | total pressure [Pa] - p_0 | reference pressure [Pa] + p_p | pressure at patch [Pa] + p_0 | total pressure [Pa] G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$ \endvartable 4. compressible supersonic (\gamma > 1): \f[ - p_T = \frac{p_0}{(1 + 0.5 \psi G |U|^2)^{\frac{1}{G}}} + p_p = \frac{p_0}{(1 + 0.5 \psi G |U|^2)^{\frac{1}{G}}} \f] where \vartable + p_p | pressure at patch [Pa] + p_0 | total pressure [Pa] \gamma | ratio of specific heats (Cp/Cv) - p_T | total pressure [Pa] - p_0 | reference pressure [Pa] \psi | compressibility [m2/s2] G | coefficient given by \f$\frac{\gamma}{1-\gamma}\f$ \endvartable @@ -98,7 +98,7 @@ Description rho | density field name | no | none psi | compressibility field name | no | none gamma | ratio of specific heats (Cp/Cv) | yes | - p0 | static pressure reference | yes | + p0 | total pressure | yes | \endtable Example of the boundary condition specification: diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C index 5c886900e82f6e172f7a4329d32c1e50e92eb674..880bd7f72eeb87b4d29e6f44434c4d512f4753ae 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.C @@ -25,6 +25,9 @@ License #include "fvcReconstruct.H" #include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvcSurfaceIntegrate.H" #include "zeroGradientFvPatchFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H index fa85c36abd463b9b74141fcd97c7457ed00c3767..305e7ad8200dbe079d4ef2853fa19ce9b38483a9 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstruct.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,6 +69,9 @@ namespace fvc ( const tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >& ); + + tmp<volScalarField> reconstructMag(const surfaceScalarField&); + tmp<volScalarField> reconstructMag(const tmp<surfaceScalarField>&); } diff --git a/src/finiteVolume/finiteVolume/fvc/fvcReconstructMag.C b/src/finiteVolume/finiteVolume/fvc/fvcReconstructMag.C new file mode 100644 index 0000000000000000000000000000000000000000..63c03590ca9ae13b9a1e09500bc0be06569bd9cf --- /dev/null +++ b/src/finiteVolume/finiteVolume/fvc/fvcReconstructMag.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvcReconstruct.H" +#include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "zeroGradientFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fvc +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +tmp<volScalarField> reconstructMag(const surfaceScalarField& ssf) +{ + const fvMesh& mesh = ssf.mesh(); + + const labelUList& owner = mesh.owner(); + const labelUList& neighbour = mesh.neighbour(); + + const volVectorField& C = mesh.C(); + const surfaceVectorField& Cf = mesh.Cf(); + const surfaceVectorField& Sf = mesh.Sf(); + const surfaceScalarField& magSf = mesh.magSf(); + + tmp<volScalarField> treconField + ( + new volScalarField + ( + IOobject + ( + "reconstruct("+ssf.name()+')', + ssf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar + ( + "0", + ssf.dimensions()/dimArea, + scalar(0) + ), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& rf = treconField(); + + forAll(owner, facei) + { + label own = owner[facei]; + label nei = neighbour[facei]; + + rf[own] += (Sf[facei] & (Cf[facei] - C[own]))*ssf[facei]/magSf[facei]; + rf[nei] -= (Sf[facei] & (Cf[facei] - C[nei]))*ssf[facei]/magSf[facei]; + } + + const surfaceScalarField::GeometricBoundaryField& bsf = ssf.boundaryField(); + + forAll(bsf, patchi) + { + const fvsPatchScalarField& psf = bsf[patchi]; + + const labelUList& pOwner = mesh.boundary()[patchi].faceCells(); + const vectorField& pCf = Cf.boundaryField()[patchi]; + const vectorField& pSf = Sf.boundaryField()[patchi]; + const scalarField& pMagSf = magSf.boundaryField()[patchi]; + + forAll(pOwner, pFacei) + { + label own = pOwner[pFacei]; + rf[own] += + (pSf[pFacei] & (pCf[pFacei] - C[own])) + *psf[pFacei]/pMagSf[pFacei]; + } + } + + rf /= mesh.V(); + + treconField().correctBoundaryConditions(); + + return treconField; +} + + +tmp<volScalarField> reconstructMag(const tmp<surfaceScalarField>& tssf) +{ + tmp<volScalarField> tvf + ( + fvc::reconstructMag(tssf()) + ); + tssf.clear(); + return tvf; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fvc + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C index a954dccf561db59269c0abf86ff8973167ffdc9b..5c3f71487db1f9b274f09657ff886877ba6e595d 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.C @@ -30,6 +30,7 @@ License void Foam::MULES::correct ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiPsiCorr, const scalar psiMax, const scalar psiMin @@ -39,6 +40,7 @@ void Foam::MULES::correct ( geometricOneField(), psi, + phi, phiPsiCorr, zeroField(), zeroField(), psiMax, psiMin @@ -49,6 +51,7 @@ void Foam::MULES::correct void Foam::MULES::LTScorrect ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiPsiCorr, const scalar psiMax, const scalar psiMin @@ -58,6 +61,7 @@ void Foam::MULES::LTScorrect ( geometricOneField(), psi, + phi, phiPsiCorr, zeroField(), zeroField(), psiMax, psiMin diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H index 2786a86aaebe63b0f3a8cf99ff4d8503cd0edaa7..78a1d9f9de8fc18fe435f28253665b3560072e39 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULES.H @@ -66,6 +66,7 @@ void correct const RdeltaTType& rDeltaT, const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su @@ -76,6 +77,7 @@ void correct ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -86,6 +88,7 @@ void correct void correct ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const scalar psiMax, const scalar psiMin @@ -96,6 +99,7 @@ void LTScorrect ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -106,6 +110,7 @@ void LTScorrect void LTScorrect ( volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const scalar psiMax, const scalar psiMin @@ -119,6 +124,7 @@ void limiterCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -133,6 +139,7 @@ void limitCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C index 2ff99745da71a2f463d13b281269de7ce8fef172..e41c9bec11fc25e62ab8cedd63c77bc1e1c70c1e 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C @@ -37,6 +37,7 @@ void Foam::MULES::correct const RdeltaTType& rDeltaT, const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su @@ -77,6 +78,7 @@ void Foam::MULES::correct ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -94,8 +96,18 @@ void Foam::MULES::correct readLabel(MULEScontrols.lookup("nLimiterIter")) ); - limitCorr(rDeltaT, rho, psi, phiCorr, Sp, Su, psiMax, psiMin, nLimiterIter); - correct(rDeltaT, rho, psi, phiCorr, Sp, Su); + limitCorr + ( + rDeltaT, + rho, + psi, + phi, + phiCorr, + Sp, Su, + psiMax, psiMin, + nLimiterIter + ); + correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su); } @@ -104,6 +116,7 @@ void Foam::MULES::LTScorrect ( const RhoType& rho, volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -123,8 +136,18 @@ void Foam::MULES::LTScorrect readLabel(MULEScontrols.lookup("nLimiterIter")) ); - limitCorr(rDeltaT, rho, psi, phiCorr, Sp, Su, psiMax, psiMin, nLimiterIter); - correct(rDeltaT, rho, psi, phiCorr, Sp, Su); + limitCorr + ( + rDeltaT, + rho, + psi, + phi, + phiCorr, + Sp, Su, + psiMax, psiMin, + nLimiterIter + ); + correct(rDeltaT, rho, psi, phi, phiCorr, Sp, Su); } @@ -135,6 +158,7 @@ void Foam::MULES::limiterCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, const surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -153,6 +177,9 @@ void Foam::MULES::limiterCorr tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc(); const scalarField& V = tVsc(); + const surfaceScalarField::GeometricBoundaryField& phiBf = + phi.boundaryField(); + const scalarField& phiCorrIf = phiCorr; const surfaceScalarField::GeometricBoundaryField& phiCorrBf = phiCorr.boundaryField(); @@ -408,12 +435,12 @@ void Foam::MULES::limiterCorr { const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); - const scalarField& phiCorrPf = phiCorrBf[patchi]; + const scalarField& phiPf = phiBf[patchi]; forAll(lambdaPf, pFacei) { // Limit outlet faces only - if (phiCorrPf[pFacei] > SMALL*SMALL) + if (phiPf[pFacei] > SMALL*SMALL) { label pfCelli = pFaceCells[pFacei]; @@ -443,6 +470,7 @@ void Foam::MULES::limitCorr const RdeltaTType& rDeltaT, const RhoType& rho, const volScalarField& psi, + const surfaceScalarField& phi, surfaceScalarField& phiCorr, const SpType& Sp, const SuType& Su, @@ -478,6 +506,7 @@ void Foam::MULES::limitCorr rDeltaT, rho, psi, + phi, phiCorr, Sp, Su, diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C index 799a901bae9ecebd023dd21ee5f37fe2891b9bab..29d72dd1125ce68c14284482cd510e4356a08c03 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.C @@ -173,10 +173,55 @@ void Foam::fv::interRegionExplicitPorositySource::addSup if (eqn.dimensions() == dimForce) { - const volScalarField& rhoNbr = - nbrMesh.lookupObject<volScalarField>(rhoName_); - const volScalarField& muNbr = - nbrMesh.lookupObject<volScalarField>(muName_); + volScalarField rhoNbr + ( + IOobject + ( + "rho:UNbr", + nbrMesh.time().timeName(), + nbrMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + nbrMesh, + dimensionedScalar("zero", dimDensity, 0.0) + ); + + volScalarField muNbr + ( + IOobject + ( + "mu:UNbr", + nbrMesh.time().timeName(), + nbrMesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + nbrMesh, + dimensionedScalar("zero", dimViscosity, 0.0) + ); + + const volScalarField& rho = + mesh_.lookupObject<volScalarField>(rhoName_); + + const volScalarField& mu = + mesh_.lookupObject<volScalarField>(muName_); + + // map local rho onto neighbour region + meshInterp().mapSrcToTgt + ( + rho.internalField(), + plusEqOp<scalar>(), + rhoNbr.internalField() + ); + + // map local mu onto neighbour region + meshInterp().mapSrcToTgt + ( + mu.internalField(), + plusEqOp<scalar>(), + muNbr.internalField() + ); porosityPtr_->addResistance(nbrEqn, rhoNbr, muNbr); } diff --git a/src/lagrangian/basic/particle/particleTemplates.C b/src/lagrangian/basic/particle/particleTemplates.C index cdc12634bd319de0807c5e9a597e61dfe94573bd..ad50f7ddd8261ee575e4ca0f7420a6bcdf484811 100644 --- a/src/lagrangian/basic/particle/particleTemplates.C +++ b/src/lagrangian/basic/particle/particleTemplates.C @@ -424,7 +424,7 @@ Foam::scalar Foam::particle::trackToFace ( position_, endPosition, - triI, + tI, tetAreas[tI], tetPlaneBasePtIs[tI], cellI_, diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C index 30ae0adf376a83d34ca4b33c18a6090bcbf40981..4c36dc0be4e55f9f142a66860c71dd762cfb3f9c 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.C @@ -90,16 +90,16 @@ void Foam::cyclicACMIPolyPatch::resetAMI AMIPatchToPatchInterpolation::imPartialFaceAreaWeight ); - const scalarField& srcWeightSum = AMI().srcWeightsSum(); + srcMask_ = + min(1.0 - tolerance_, max(tolerance_, AMI().srcWeightsSum())); + + tgtMask_ = + min(1.0 - tolerance_, max(tolerance_, AMI().tgtWeightsSum())); - // set patch face areas based on sum of AMI weights per face forAll(Sf, faceI) { - scalar w = srcWeightSum[faceI]; - w = min(1.0 - tolerance_, max(tolerance_, w)); - - Sf[faceI] *= w; - noSf[faceI] *= 1.0 - w; + Sf[faceI] *= srcMask_[faceI]; + noSf[faceI] *= 1.0 - srcMask_[faceI]; } setNeighbourFaceAreas(); @@ -116,8 +116,6 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const refCast<const cyclicACMIPolyPatch>(this->neighbPatch()); const polyPatch& pp = cp.nonOverlapPatch(); - const scalarField& tgtWeightSum = AMI().tgtWeightsSum(); - const vectorField& faceAreas0 = cp.faceAreas0(); vectorField::subField Sf = cp.faceAreas(); @@ -125,11 +123,8 @@ void Foam::cyclicACMIPolyPatch::setNeighbourFaceAreas() const forAll(Sf, faceI) { - scalar w = tgtWeightSum[faceI]; - w = min(1.0 - tolerance_, max(tolerance_, w)); - - Sf[faceI] = w*faceAreas0[faceI]; - noSf[faceI] = (1.0 - w)*faceAreas0[faceI]; + Sf[faceI] = tgtMask_[faceI]*faceAreas0[faceI]; + noSf[faceI] = (1.0 - tgtMask_[faceI])*faceAreas0[faceI]; } } @@ -184,6 +179,18 @@ void Foam::cyclicACMIPolyPatch::clearGeom() } +const Foam::scalarField& Foam::cyclicACMIPolyPatch::srcMask() const +{ + return srcMask_; +} + + +const Foam::scalarField& Foam::cyclicACMIPolyPatch::tgtMask() const +{ + return tgtMask_; +} + + // * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * // Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch @@ -201,6 +208,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(word::null), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { // Non-overlapping patch might not be valid yet so cannot determine @@ -221,6 +230,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(dict.lookup("nonOverlapPatch")), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { if (nonOverlapPatchName_ == name) @@ -256,6 +267,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(pp.nonOverlapPatchName_), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { // Non-overlapping patch might not be valid yet so cannot determine @@ -278,6 +291,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(nonOverlapPatchName), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) { if (nonOverlapPatchName_ == name()) @@ -314,6 +329,8 @@ Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch faceAreas0_(), nonOverlapPatchName_(pp.nonOverlapPatchName_), nonOverlapPatchID_(-1), + srcMask_(), + tgtMask_(), updated_(false) {} @@ -326,6 +343,13 @@ Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::cyclicACMIPolyPatch& Foam::cyclicACMIPolyPatch::neighbPatch() const +{ + const polyPatch& pp = this->boundaryMesh()[neighbPatchID()]; + return refCast<const cyclicACMIPolyPatch>(pp); +} + + Foam::label Foam::cyclicACMIPolyPatch::nonOverlapPatchID() const { if (nonOverlapPatchID_ == -1) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H index b092c14f0430caaab58d3f39e99bc8a1e51561a7..b153034d876aac44cb4953172ecc6ed875dca36a 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatch.H @@ -66,6 +66,12 @@ private: //- Index of non-overlapping patch mutable label nonOverlapPatchID_; + //- Mask/weighting for source patch + mutable scalarField srcMask_; + + //- Mask/weighting for target patch + mutable scalarField tgtMask_; + //- Flag to indicate that AMI has been updated mutable bool updated_; @@ -111,6 +117,12 @@ protected: //- Clear geometry virtual void clearGeom(); + //- Return the mask/weighting for the source patch + virtual const scalarField& srcMask() const; + + //- Return the mask/weighting for the target patch + virtual const scalarField& tgtMask() const; + public: @@ -245,6 +257,9 @@ public: //- Return access to the original patch face areas inline const vectorField& faceAreas0() const; + //- Return a reference to the neighbour patch + virtual const cyclicACMIPolyPatch& neighbPatch() const; + //- Non-overlapping patch name inline const word& nonOverlapPatchName() const; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H index a245f779c03a0c2391f8e4ed93841b00f9ec0f4c..07f6b07bcbec76273ef74f055d896cdd07e81c8c 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchI.H @@ -71,11 +71,11 @@ inline const Foam::scalarField& Foam::cyclicACMIPolyPatch::mask() const { if (owner()) { - return AMI().srcWeightsSum(); + return srcMask_; } else { - return neighbPatch().AMI().tgtWeightsSum(); + return neighbPatch().tgtMask(); } } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C index 127085ac44e58a75cc612d7f7a7ca40a29665592..b64842bf12220cf895f00dda4ab09d2a6658a058 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicACMI/cyclicACMIPolyPatch/cyclicACMIPolyPatchTemplates.C @@ -34,7 +34,7 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate { if (owner()) { - const scalarField& w = AMI().srcWeightsSum(); + const scalarField& w = srcMask_; return w*AMI().interpolateToSource(fldCouple) @@ -42,7 +42,7 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIPolyPatch::interpolate } else { - const scalarField& w = neighbPatch().AMI().tgtWeightsSum(); + const scalarField& w = neighbPatch().tgtMask(); return w*neighbPatch().AMI().interpolateToTarget(fldCouple) @@ -73,14 +73,14 @@ void Foam::cyclicACMIPolyPatch::interpolate { if (owner()) { - const scalarField& w = AMI().srcWeightsSum(); + const scalarField& w = srcMask_; AMI().interpolateToSource(fldCouple, cop, result); result = w*result + (1.0 - w)*fldNonOverlap; } else { - const scalarField& w = neighbPatch().AMI().tgtWeightsSum(); + const scalarField& w = neighbPatch().tgtMask(); neighbPatch().AMI().interpolateToTarget(fldCouple, cop, result); result = w*result + (1.0 - w)*fldNonOverlap; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index e906689415121d6de4a74250597006d7aabfd852..52373c438d088eddad12e3ee8e504b98d9152fcf 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -642,6 +642,13 @@ bool Foam::cyclicAMIPolyPatch::owner() const } +const Foam::cyclicAMIPolyPatch& Foam::cyclicAMIPolyPatch::neighbPatch() const +{ + const polyPatch& pp = this->boundaryMesh()[neighbPatchID()]; + return refCast<const cyclicAMIPolyPatch>(pp); +} + + const Foam::autoPtr<Foam::searchableSurface>& Foam::cyclicAMIPolyPatch::surfPtr() const { diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index 9c0f5fc3162baa9e34f977d0f9b6a277b624c987..e3bb1d35d97d11254d02fe2b7362a532def61023 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -284,7 +284,7 @@ public: virtual bool owner() const; //- Return a reference to the neighbour patch - inline const cyclicAMIPolyPatch& neighbPatch() const; + virtual const cyclicAMIPolyPatch& neighbPatch() const; //- Return a reference to the projection surface const autoPtr<searchableSurface>& surfPtr() const; diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H index 217d189ae32275d94d532446bfd02e44ae3be8bc..b136f90ad0a6488ff48493a48781d32f545a2beb 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H @@ -38,14 +38,6 @@ inline const Foam::word& Foam::cyclicAMIPolyPatch::neighbPatchName() const } -inline const Foam::cyclicAMIPolyPatch& -Foam::cyclicAMIPolyPatch::neighbPatch() const -{ - const polyPatch& pp = this->boundaryMesh()[neighbPatchID()]; - return refCast<const cyclicAMIPolyPatch>(pp); -} - - inline const Foam::vector& Foam::cyclicAMIPolyPatch::rotationAxis() const { return rotationAxis_; diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C index 93c05785bbf705e4d382c246314414e4e78f62e6..4c6858a79bfe614e919313118465d57be8ecddbc 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C @@ -203,7 +203,7 @@ void Foam::mappedPatchBase::findSamples { case NEARESTCELL: { - if (samplePatch().size() && samplePatch() != "none") + if (samplePatch_.size() && samplePatch_ != "none") { FatalErrorIn ( @@ -495,7 +495,6 @@ void Foam::mappedPatchBase::findSamples void Foam::mappedPatchBase::calcMapping() const { static bool hasWarned = false; - if (mapPtr_.valid()) { FatalErrorIn("mappedPatchBase::calcMapping() const") @@ -509,10 +508,8 @@ void Foam::mappedPatchBase::calcMapping() const // Get offsetted points const pointField offsettedPoints(samplePoints(patchPoints())); - - // Do a sanity check - // Am I sampling my own patch? This only makes sense for a non-zero - // offset. + // Do a sanity check - am I sampling my own patch? + // This only makes sense for a non-zero offset. bool sampleMyself = ( mode_ == NEARESTPATCHFACE @@ -550,7 +547,6 @@ void Foam::mappedPatchBase::calcMapping() const << "offsetMode_:" << offsetModeNames_[offsetMode_] << endl; } - // Get global list of all samples and the processor and face they come from. pointField samples; labelList patchFaceProcs; @@ -565,7 +561,6 @@ void Foam::mappedPatchBase::calcMapping() const patchFc ); - // Find processor and cell/face samples are in and actual location. labelList sampleProcs; labelList sampleIndices; @@ -641,7 +636,6 @@ void Foam::mappedPatchBase::calcMapping() const } } - // Now we have all the data we need: // - where sample originates from (so destination when mapping): // patchFaces, patchFaceProcs. @@ -688,7 +682,6 @@ void Foam::mappedPatchBase::calcMapping() const } } - // Determine schedule. mapPtr_.reset(new mapDistribute(sampleProcs, patchFaceProcs)); @@ -806,38 +799,34 @@ void Foam::mappedPatchBase::calcAMI() const } AMIPtr_.clear(); -/* - const polyPatch& nbr = samplePolyPatch(); - -// pointField nbrPoints(offsettedPoints()); - pointField nbrPoints(nbr.localPoints()); if (debug) { + const polyPatch& nbr = samplePolyPatch(); + + pointField nbrPoints(nbr.localPoints()); + OFstream os(patch_.name() + "_neighbourPatch-org.obj"); meshTools::writeOBJ(os, samplePolyPatch().localFaces(), nbrPoints); - } - // transform neighbour patch to local system - primitivePatch nbrPatch0 - ( - SubList<face> + // transform neighbour patch to local system + primitivePatch nbrPatch0 ( - nbr.localFaces(), - nbr.size() - ), - nbrPoints - ); + SubList<face> + ( + nbr.localFaces(), + nbr.size() + ), + nbrPoints + ); - if (debug) - { OFstream osN(patch_.name() + "_neighbourPatch-trans.obj"); meshTools::writeOBJ(osN, nbrPatch0, nbrPoints); OFstream osO(patch_.name() + "_ownerPatch.obj"); meshTools::writeOBJ(osO, patch_.localFaces(), patch_.localPoints()); } -*/ + // Construct/apply AMI interpolation to determine addressing and weights AMIPtr_.reset ( diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H index 928a1d5b85fea42c6574ae9c5235986226d46337..7dd98c1806ec7f6ab6cb72d8a5679fccd524bb35 100644 --- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H +++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.H @@ -392,6 +392,7 @@ public: //- Get the patch on the region const polyPatch& samplePolyPatch() const; + // Helpers //- Get the sample points diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C index 6d338d96bcfd89a6a74f2fabcbc2ec2fba11ae6c..f497c6188c0d70c958b965d63de0a464b5ae2013 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C @@ -39,7 +39,10 @@ defineTypeNameAndDebug(cloudInfo, 0); void Foam::cloudInfo::writeFileHeader(const label i) { - file(i) << "# Time" << tab << "nParcels" << tab << "mass" << endl; + writeHeader(file(), "Cloud information"); + writeCommented(file(), "Time"); + writeTabbed(file(), "nParcels"); + writeTabbed(file(), "mass"); } diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C index e4074f51a58ae89f34df63b3c4bf49191c40ca52..5469335d4a924e996d34d4a1704caa758b375caf 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C @@ -335,7 +335,6 @@ void Foam::fieldAverage::write() { if (active_) { - calcAverages(); writeAverages(); writeAveragingProperties(); diff --git a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C index 57cff306373208ef28888cff0e2381f00e1ec5d4..7fdb74f8128b06624f479a920484b8930d69ec4b 100644 --- a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C +++ b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C @@ -96,7 +96,20 @@ void Foam::fieldCoordinateSystemTransform::read(const dictionary& dict) void Foam::fieldCoordinateSystemTransform::execute() { - // Do nothing + if (active_) + { + Info<< type() << " " << name_ << " output:" << nl; + + forAll(fieldSet_, fieldI) + { + // If necessary load field + transform<scalar>(fieldSet_[fieldI]); + transform<vector>(fieldSet_[fieldI]); + transform<sphericalTensor>(fieldSet_[fieldI]); + transform<symmTensor>(fieldSet_[fieldI]); + transform<tensor>(fieldSet_[fieldI]); + } + } } @@ -114,16 +127,23 @@ void Foam::fieldCoordinateSystemTransform::timeSet() void Foam::fieldCoordinateSystemTransform::write() { - Info<< type() << " " << name_ << " output:" << nl; - - forAll(fieldSet_, fieldI) + if (active_) { - // If necessary load field - transform<scalar>(fieldSet_[fieldI]); - transform<vector>(fieldSet_[fieldI]); - transform<sphericalTensor>(fieldSet_[fieldI]); - transform<symmTensor>(fieldSet_[fieldI]); - transform<tensor>(fieldSet_[fieldI]); + Info<< type() << " " << name_ << " output:" << nl; + + forAll(fieldSet_, fieldI) + { + const word fieldName = fieldSet_[fieldI] + ":Transformed"; + + const regIOobject& field = + obr_.lookupObject<regIOobject>(fieldName); + + Info<< " writing field " << field.name() << nl; + + field.write(); + } + + Info<< endl; } } diff --git a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C index 945b15532e40582184fc751f473c5c16e78d5191..872c9b189c8153bc4f3b428e9088d84e67f2510b 100644 --- a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C @@ -37,7 +37,7 @@ void Foam::fieldCoordinateSystemTransform::transformField const Type& field ) const { - const word& fieldName = field.name() + "Transformed"; + const word& fieldName = field.name() + ":Transformed"; if (!obr_.foundObject<Type>(fieldName)) { diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index 5c612fe8a3c63045ceb08ed74805ca505b954607..0c61259012ddffbf8dddd9077347ba9e9b31b405 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -112,20 +112,23 @@ void Foam::fieldMinMax::read(const dictionary& dict) void Foam::fieldMinMax::writeFileHeader(const label i) { - file() - << "# Time" << token::TAB << "field" << token::TAB - << "min" << token::TAB << "position(min)"; + writeHeader(file(), "Field minima and maxima"); + writeCommented(file(), "Time"); + writeTabbed(file(), "field"); + writeTabbed(file(), "min"); + writeTabbed(file(), "position(min)"); if (Pstream::parRun()) { - file() << token::TAB << "proc"; + writeTabbed(file(), "processor"); } - file() << token::TAB << "max" << token::TAB << "position(max)"; + writeTabbed(file(), "max"); + writeTabbed(file(), "position(max)"); if (Pstream::parRun()) { - file() << token::TAB << "proc"; + writeTabbed(file(), "processor"); } file() << endl; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 6bd6102b2e124a3aa64a60f6de2f0bcdf2967566..4aa2a2b6cd9f44c4865e97eb954507ddb800dec8 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,21 +111,25 @@ void Foam::fieldMinMax::calcMinMaxFields scalar maxValue = maxVs[maxI]; const vector& maxC = maxCs[maxI]; + file()<< obr_.time().value(); + writeTabbed(file(), fieldName); + file() - << obr_.time().value() << token::TAB - << fieldName << token::TAB - << minValue << token::TAB << minC; + << token::TAB << minValue + << token::TAB << minC; if (Pstream::parRun()) { - file() << token::TAB << minI; + file()<< token::TAB << minI; } - file() << token::TAB << maxValue << token::TAB << maxC; + file() + << token::TAB << maxValue + << token::TAB << maxC; if (Pstream::parRun()) { - file() << token::TAB << maxI; + file()<< token::TAB << maxI; } file() << endl; @@ -212,21 +216,25 @@ void Foam::fieldMinMax::calcMinMaxFields Type maxValue = maxVs[maxI]; const vector& maxC = maxCs[maxI]; + file()<< obr_.time().value(); + writeTabbed(file(), fieldName); + file() - << obr_.time().value() << token::TAB - << fieldName << token::TAB - << minValue << token::TAB << minC; + << token::TAB << minValue + << token::TAB << minC; if (Pstream::parRun()) { - file() << token::TAB << minI; + file()<< token::TAB << minI; } - file() << token::TAB << maxValue << token::TAB << maxC; + file() + << token::TAB << maxValue + << token::TAB << maxC; if (Pstream::parRun()) { - file() << token::TAB << maxI; + file()<< token::TAB << maxI; } file() << endl; diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C index 681ea7a02ab15074ce77fe04fda9da4aa0858e9c..b251a362ea8b94673685a16349e9b7268a8e4ed9 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -94,11 +94,10 @@ void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i) Ostream& os = file(); - os << "# Source1 : " << source1Ptr_->name() << nl - << "# Source2 : " << source2Ptr_->name() << nl - << "# Operation : " << operationTypeNames_[operation_] << nl; - - os << "# Time"; + writeHeaderValue(os, "Source1", source1Ptr_->name()); + writeHeaderValue(os, "Source2", source2Ptr_->name()); + writeHeaderValue(os, "Operation", operationTypeNames_[operation_]); + writeCommented(os, "Time"); forAll(commonFields, i) { @@ -156,7 +155,7 @@ void Foam::fieldValues::fieldValueDelta::write() if (Pstream::master()) { - file()<< obr_.time().timeName(); + file()<< obr_.time().value(); } if (log_) diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C index 83ede96387df08faacf31575b09ca91ff1c20fbd..40211ae7a2b236c08e2780ecafb919535e3b5156 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C @@ -328,32 +328,8 @@ void Foam::nearWallFields::execute() { Info<< "nearWallFields:execute()" << endl; } -} - - -void Foam::nearWallFields::end() -{ - if (debug) - { - Info<< "nearWallFields:end()" << endl; - } -} - - -void Foam::nearWallFields::timeSet() -{ - // Do nothing -} -void Foam::nearWallFields::write() -{ - if (debug) - { - Info<< "nearWallFields:write()" << endl; - } - - // Do nothing if (active_) { if @@ -380,7 +356,7 @@ void Foam::nearWallFields::write() Info<< type() << " " << name_ << " output:" << nl; - Info<< " Writing sampled fields to " << obr_.time().timeName() + Info<< " Sampling fields fields to " << obr_.time().timeName() << endl; sampleFields(vsf_); @@ -388,8 +364,37 @@ void Foam::nearWallFields::write() sampleFields(vSpheretf_); sampleFields(vSymmtf_); sampleFields(vtf_); + } +} + + +void Foam::nearWallFields::end() +{ + if (debug) + { + Info<< "nearWallFields:end()" << endl; + } +} + + +void Foam::nearWallFields::timeSet() +{ + // Do nothing +} + + +void Foam::nearWallFields::write() +{ + if (debug) + { + Info<< "nearWallFields:write()" << endl; + } + + if (active_) + { + Info<< " Writing sampled fields to " << obr_.time().timeName() + << endl; - // Write fields forAll(vsf_, i) { vsf_[i].write(); diff --git a/src/postProcessing/functionObjects/field/processorField/processorField.C b/src/postProcessing/functionObjects/field/processorField/processorField.C index 18603fbed2fb7ec9b6a2f9c8a94ce91d87dd9639..37c61b5db2c5d5f75f00de0680df41c5af43b890 100644 --- a/src/postProcessing/functionObjects/field/processorField/processorField.C +++ b/src/postProcessing/functionObjects/field/processorField/processorField.C @@ -53,6 +53,27 @@ Foam::processorField::processorField if (isA<fvMesh>(obr_)) { read(dict); + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField* procFieldPtr + ( + new volScalarField + ( + IOobject + ( + "processorID", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ) + ); + + mesh.objectRegistry::store(procFieldPtr); } else { @@ -88,7 +109,14 @@ void Foam::processorField::read(const dictionary& dict) void Foam::processorField::execute() { - // Do nothing + if (active_) + { + const volScalarField& procField = + obr_.lookupObject<volScalarField>("processorID"); + + const_cast<volScalarField&>(procField) == + dimensionedScalar("procI", dimless, Pstream::myProcNo()); + } } @@ -108,20 +136,8 @@ void Foam::processorField::write() { if (active_) { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - volScalarField procField - ( - IOobject - ( - "processorID", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedScalar("procI", dimless, Pstream::myProcNo()) - ); + const volScalarField& procField = + obr_.lookupObject<volScalarField>("processorID"); procField.write(); } diff --git a/src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C b/src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C deleted file mode 100644 index ac190e298b8414552dc91c3cf33cfa9e9f573eeb..0000000000000000000000000000000000000000 --- a/src/postProcessing/functionObjects/field/processorField/processorFieldTemplates.C +++ /dev/null @@ -1,158 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "processorField.H" -#include "volFields.H" -#include "surfaceFields.H" -#include "Time.H" -#include "transformGeometricField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template<class Type> -void Foam::processorField::transformField -( - const Type& field -) const -{ - const word& fieldName = field.name() + "Transformed"; - - dimensionedTensor R("R", field.dimensions(), coordSys_.R()); - - if (obr_.foundObject<Type>(fieldName)) - { - Type& transField = - const_cast<Type&>(obr_.lookupObject<Type>(fieldName)); - - transField == field; - - forAll(field, i) - { - Foam::transform(transField, R, transField); - } - - transField.write(); - } - else - { - Type& transField = obr_.store - ( - new Type - ( - IOobject - ( - fieldName, - obr_.time().timeName(), - obr_, - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE - ), - field - ) - ); - - forAll(field, i) - { - Foam::transform(transField, R, transField); - } - - transField.write(); - } -} - - -template<class Type> -void Foam::processorField::transform -( - const word& fieldName -) const -{ - typedef GeometricField<Type, fvPatchField, volMesh> vfType; - typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType; - - if (obr_.foundObject<vfType>(fieldName)) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " already in database" - << endl; - } - - transformField<vfType>(obr_.lookupObject<vfType>(fieldName)); - } - else if (obr_.foundObject<sfType>(fieldName)) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " already in database" - << endl; - } - - transformField<sfType>(obr_.lookupObject<sfType>(fieldName)); - } - else - { - IOobject fieldHeader - ( - fieldName, - obr_.time().timeName(), - obr_, - IOobject::MUST_READ, - IOobject::NO_WRITE - ); - - if - ( - fieldHeader.headerOk() - && fieldHeader.headerClassName() == vfType::typeName - ) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " read from file" - << endl; - } - - transformField<vfType>(obr_.lookupObject<vfType>(fieldName)); - } - else if - ( - fieldHeader.headerOk() - && fieldHeader.headerClassName() == sfType::typeName - ) - { - if (debug) - { - Info<< type() << ": Field " << fieldName << " read from file" - << endl; - } - - transformField<sfType>(obr_.lookupObject<sfType>(fieldName)); - } - } -} - - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H index abbdf6bac037ee4f0dfbd34ccd62b2cb1315587c..b639d8e251c9c9e3fe0b42fcabe6eaa64d49a9eb 100644 --- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H +++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H @@ -47,7 +47,7 @@ Description - alpha_liquidCore : alpha with outside liquid core set to 0 - alpha_background : alpha with outside background set to 0. - Histogram: + %Histogram: - determine histogram of diameter (given minDiameter, maxDiameter, nBins) - write graph of number of droplets per bin - write graph of sum, average and deviation of droplet volume per bin diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 91943e1191b491a0422c8990ba938522b1e89c1f..42ae77e264aa392b38e1b8c04659aa7e1db66c67 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -45,34 +45,65 @@ void Foam::forceCoeffs::writeFileHeader(const label i) { // force coeff data + writeHeader(file(i), "Force coefficients"); + writeHeaderValue(file(i), "liftDir", liftDir_); + writeHeaderValue(file(i), "dragDir", dragDir_); + writeHeaderValue(file(i), "pitchAxis", pitchAxis_); + writeHeaderValue(file(i), "magUInf", magUInf_); + writeHeaderValue(file(i), "lRef", lRef_); + writeHeaderValue(file(i), "Aref", Aref_); + writeHeaderValue(file(i), "CofR", coordSys_.origin()); + writeCommented(file(i), "Time"); + writeTabbed(file(i), "Cm"); + writeTabbed(file(i), "Cd"); + writeTabbed(file(i), "Cl"); + writeTabbed(file(i), "Cl(f)"); + writeTabbed(file(i), "Cl(r)"); file(i) - << "# liftDir : " << liftDir_ << nl - << "# dragDir : " << dragDir_ << nl - << "# pitchAxis : " << pitchAxis_ << nl - << "# magUInf : " << magUInf_ << nl - << "# lRef : " << lRef_ << nl - << "# Aref : " << Aref_ << nl - << "# CofR : " << coordSys_.origin() << nl - << "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab - << "Cl(f)" << tab << "Cl(r)"; + << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab << "Cl(f)" + << tab << "Cl(r)"; } else if (i == 1) { // bin coeff data - file(i) - << "# bins : " << nBin_ << nl - << "# start : " << binMin_ << nl - << "# delta : " << binDx_ << nl - << "# direction : " << binDir_ << nl - << "# Time"; + writeHeader(file(i), "Force coefficient bins"); + writeHeaderValue(file(i), "bins", nBin_); + writeHeaderValue(file(i), "start", binMin_); + writeHeaderValue(file(i), "delta", binDx_); + writeHeaderValue(file(i), "direction", binDir_); + + vectorField binPoints(nBin_); + writeCommented(file(i), "x co-ords :"); + forAll(binPoints, pointI) + { + binPoints[pointI] = (binMin_ + (pointI + 1)*binDx_)*binDir_; + file(i) << tab << binPoints[pointI].x(); + } + file(i) << nl; + + writeCommented(file(i), "y co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].y(); + } + file(i) << nl; + + writeCommented(file(i), "z co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].z(); + } + file(i) << nl; + + writeCommented(file(i), "Time"); for (label j = 0; j < nBin_; j++) { const word jn('[' + Foam::name(j) + ']'); - - file(i) - << tab << "Cm" << jn << tab << "Cd" << jn << tab << "Cl" << jn; + writeTabbed(file(i), "Cm" + jn); + writeTabbed(file(i), "Cd" + jn); + writeTabbed(file(i), "Cl" + jn); } } else @@ -193,9 +224,8 @@ void Foam::forceCoeffs::write() scalar Clr = Cl/2.0 - Cm; file(0) - << obr_.time().value() << tab - << Cm << tab << Cd << tab << Cl << tab << Clf << tab << Clr - << endl; + << obr_.time().value() << tab << Cm << tab << Cd + << tab << Cl << tab << Clf << tab << Clr << endl; if (log_) { diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 74b892aa1e9627b5c744bf48977176d162251f12..c096ad5d4b0ac3832db70a4b0aa1cec15f4bb43f 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -73,11 +73,13 @@ void Foam::forces::writeFileHeader(const label i) { // force data + writeHeader(file(i), "Forces"); + writeHeaderValue(file(i), "CofR", coordSys_.origin()); + writeCommented(file(i), "Time"); + file(i) - << "# CofR : " << coordSys_.origin() << nl - << "# Time" << tab - << "forces(pressure,viscous,porous) " - << "moment(pressure,viscous,porous)"; + << "forces[pressure,viscous,porous] " + << "moment[pressure,viscous,porous]"; if (localSystem_) { @@ -91,32 +93,54 @@ void Foam::forces::writeFileHeader(const label i) { // bin data - file(i) - << "# bins : " << nBin_ << nl - << "# start : " << binMin_ << nl - << "# delta : " << binDx_ << nl - << "# direction : " << binDir_ << nl - << "# Time"; + writeHeader(file(i), "Force bins"); + writeHeaderValue(file(i), "bins", nBin_); + writeHeaderValue(file(i), "start", binMin_); + writeHeaderValue(file(i), "delta", binDx_); + writeHeaderValue(file(i), "direction", binDir_); + + vectorField binPoints(nBin_); + writeCommented(file(i), "x co-ords :"); + forAll(binPoints, pointI) + { + binPoints[pointI] = (binMin_ + (pointI + 1)*binDx_)*binDir_; + file(i) << tab << binPoints[pointI].x(); + } + file(i) << nl; + + writeCommented(file(i), "y co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].y(); + } + file(i) << nl; + + writeCommented(file(i), "z co-ords :"); + forAll(binPoints, pointI) + { + file(i) << tab << binPoints[pointI].z(); + } + file(i) << nl; + + writeCommented(file(i), "Time"); for (label j = 0; j < nBin_; j++) { const word jn('[' + Foam::name(j) + ']'); + const word f("forces" + jn + "[pressure,viscous,porous]"); + const word m("moments" + jn + "[pressure,viscous,porous]"); - file(i) - << tab - << "forces" << jn << "(pressure,viscous,porous) " - << "moment" << jn << "(pressure,viscous,porous)"; + file(i)<< tab << f << tab << m; } if (localSystem_) { for (label j = 0; j < nBin_; j++) { const word jn('[' + Foam::name(j) + ']'); + const word f("localForces" + jn + "[pressure,viscous,porous]"); + const word m("localMoments" + jn + "[pressure,viscous,porous]"); - file(i) - << tab - << "localForces" << jn << "(pressure,viscous,porous) " - << "localMoments" << jn << "(pressure,viscous,porous)"; + file(i)<< tab << f << tab << m; } } } @@ -370,28 +394,24 @@ void Foam::forces::writeForces() if (log_) { Info<< type() << " " << name_ << " output:" << nl - << " forces(pressure,viscous,porous) = (" - << sum(force_[0]) << "," - << sum(force_[1]) << "," - << sum(force_[2]) << ")" << nl - << " moment(pressure,viscous,porous) = (" - << sum(moment_[0]) << "," - << sum(moment_[1]) << "," - << sum(moment_[2]) << ")" - << nl; - } - - file(0) << obr_.time().value() << tab - << "(" - << sum(force_[0]) << "," - << sum(force_[1]) << "," - << sum(force_[2]) - << ") " - << "(" - << sum(moment_[0]) << "," - << sum(moment_[1]) << "," - << sum(moment_[2]) - << ")" + << " sum of forces:" << nl + << " pressure : " << sum(force_[0]) << nl + << " viscous : " << sum(force_[1]) << nl + << " porous : " << sum(force_[2]) << nl + << " sum of moments:" << nl + << " pressure : " << sum(moment_[0]) << nl + << " viscous : " << sum(moment_[1]) << nl + << " porous : " << sum(moment_[2]) + << endl; + } + + file(0) << obr_.time().value() << tab << setw(1) << '[' + << sum(force_[0]) << setw(1) << ',' + << sum(force_[1]) << setw(1) << "," + << sum(force_[2]) << setw(3) << "] [" + << sum(moment_[0]) << setw(1) << "," + << sum(moment_[1]) << setw(1) << "," + << sum(moment_[2]) << setw(1) << "]" << endl; if (localSystem_) @@ -403,17 +423,13 @@ void Foam::forces::writeForces() vectorField localMomentT(coordSys_.localVector(moment_[1])); vectorField localMomentP(coordSys_.localVector(moment_[2])); - file(0) << obr_.time().value() << tab - << "(" - << sum(localForceN) << "," - << sum(localForceT) << "," - << sum(localForceP) - << ") " - << "(" - << sum(localMomentN) << "," - << sum(localMomentT) << "," - << sum(localMomentP) - << ")" + file(0) << obr_.time().value() << tab << setw(1) << "[" + << sum(localForceN) << setw(1) << "," + << sum(localForceT) << setw(1) << "," + << sum(localForceP) << setw(3) << "] [" + << sum(localMomentN) << setw(1) << "," + << sum(localMomentT) << setw(1) << "," + << sum(localMomentP) << setw(1) << "]" << endl; } } @@ -448,9 +464,13 @@ void Foam::forces::writeBins() forAll(f[0], i) { file(1) - << tab - << "(" << f[0][i] << "," << f[1][i] << "," << f[2][i] << ") " - << "(" << m[0][i] << "," << m[1][i] << "," << m[2][i] << ")"; + << tab << setw(1) << "[" + << f[0][i] << setw(1) << "," + << f[1][i] << setw(1) << "," + << f[2][i] << setw(3) << "] [" + << m[0][i] << setw(1) << "," + << m[1][i] << setw(1) << "," + << m[2][i] << setw(1) << "]"; } if (localSystem_) @@ -480,9 +500,13 @@ void Foam::forces::writeBins() forAll(lf[0], i) { file(1) - << tab - << "(" << lf[0][i] << "," << lf[1][i] << "," << lf[2][i] << ") " - << "(" << lm[0][i] << "," << lm[1][i] << "," << lm[2][i] << ")"; + << tab << setw(1) << "[" + << lf[0][i] << setw(1) << "," + << lf[1][i] << setw(1) << "," + << lf[2][i] << setw(3) << "] [" + << lm[0][i] << setw(1) << "," + << lm[1][i] << setw(1) << "," + << lm[2][i] << setw(1) << "]"; } } diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C index 185e83b0a45169fe496c37d32f83fcb90e2a7bb2..9620fe3222adcf0f6a0b6f7d85dbd2ffdb6f0dac 100644 --- a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C @@ -125,25 +125,42 @@ void Foam::calcFvcDiv::read(const dictionary& dict) { dict.lookup("fieldName") >> fieldName_; dict.lookup("resultName") >> resultName_; + + if (resultName_ == "none") + { + resultName_ = "fvc::div(" + fieldName_ + ")"; + } } } void Foam::calcFvcDiv::execute() { - // Do nothing - only valid on write + if (active_) + { + bool processed = false; + + calcDiv<surfaceScalarField>(fieldName_, resultName_, processed); + calcDiv<volVectorField>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcFvcDiv::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } } void Foam::calcFvcDiv::end() { - // Do nothing - only valid on write + // Do nothing } void Foam::calcFvcDiv::timeSet() { - // Do nothing - only valid on write + // Do nothing } @@ -151,15 +168,15 @@ void Foam::calcFvcDiv::write() { if (active_) { - bool processed = false; + if (obr_.foundObject<regIOobject>(resultName_)) + { + const regIOobject& field = + obr_.lookupObject<regIOobject>(resultName_); - calcDiv<surfaceScalarField>(fieldName_, resultName_, processed); - calcDiv<volVectorField>(fieldName_, resultName_, processed); + Info<< type() << " " << name_ << " output:" << nl + << " writing field " << field.name() << nl << endl; - if (!processed) - { - WarningIn("void Foam::calcFvcDiv::write()") - << "Unprocessed field " << fieldName_ << endl; + field.write(); } } } diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C index d7db1e40816ad1920a3d35941b531d549e9b11ef..d7561744dc939851b266249b87fa18c53d22596e 100644 --- a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C @@ -38,25 +38,14 @@ void Foam::calcFvcDiv::calcDiv { const fvMesh& mesh = refCast<const fvMesh>(obr_); - word divName = resultName; - if (divName == "none") - { - divName = "fvc::div(" + fieldName + ")"; - } - if (mesh.foundObject<FieldType>(fieldName)) { const FieldType& vf = mesh.lookupObject<FieldType>(fieldName); - volScalarField& field = divField(divName, vf.dimensions()); + volScalarField& field = divField(resultName, vf.dimensions()); field = fvc::div(vf); - Info<< type() << " " << name_ << " output:" << nl - << " writing field " << field.name() << nl << endl; - - field.write(); - processed = true; } } diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C index 6b8efee0c883180101903e46693cbca42f5502c9..31d24da4e9c0130c28da6b2c59495d6c0b72ec4f 100644 --- a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C @@ -87,25 +87,42 @@ void Foam::calcFvcGrad::read(const dictionary& dict) { dict.lookup("fieldName") >> fieldName_; dict.lookup("resultName") >> resultName_; + + if (resultName_ == "none") + { + resultName_ = "fvc::grad(" + fieldName_ + ")"; + } } } void Foam::calcFvcGrad::execute() { - // Do nothing - only valid on write + if (active_) + { + bool processed = false; + + calcGrad<scalar>(fieldName_, resultName_, processed); + calcGrad<vector>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcFvcGrad::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } } void Foam::calcFvcGrad::end() { - // Do nothing - only valid on write + // Do nothing } void Foam::calcFvcGrad::timeSet() { - // Do nothing - only valid on write + // Do nothing } @@ -113,15 +130,15 @@ void Foam::calcFvcGrad::write() { if (active_) { - bool processed = false; + if (obr_.foundObject<regIOobject>(resultName_)) + { + const regIOobject& field = + obr_.lookupObject<regIOobject>(resultName_); - calcGrad<scalar>(fieldName_, resultName_, processed); - calcGrad<vector>(fieldName_, resultName_, processed); + Info<< type() << " " << name_ << " output:" << nl + << " writing field " << field.name() << nl << endl; - if (!processed) - { - WarningIn("void Foam::calcFvcGrad::write()") - << "Unprocessed field " << fieldName_ << endl; + field.write(); } } } diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C index d8180c1e30f0be776df9135602a1603db2f22908..c028628e37091ddfa98a036c937a3980f2c7c7e9 100644 --- a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C @@ -91,40 +91,25 @@ void Foam::calcFvcGrad::calcGrad const fvMesh& mesh = refCast<const fvMesh>(obr_); - word gradName = resultName; - if (gradName == "none") - { - gradName = "fvc::grad(" + fieldName + ")"; - } if (mesh.foundObject<vfType>(fieldName)) { const vfType& vf = mesh.lookupObject<vfType>(fieldName); - vfGradType& field = gradField<Type>(gradName, vf.dimensions()); + vfGradType& field = gradField<Type>(resultName, vf.dimensions()); field = fvc::grad(vf); - Info<< type() << " output:" << nl - << " writing " << field.name() << " field" << nl << endl; - - field.write(); - processed = true; } else if (mesh.foundObject<sfType>(fieldName)) { const sfType& sf = mesh.lookupObject<sfType>(fieldName); - vfGradType& field = gradField<Type>(gradName, sf.dimensions()); + vfGradType& field = gradField<Type>(resultName, sf.dimensions()); field = fvc::grad(sf); - Info<< type() << " " << name_ << " output:" << nl - << " writing field " << field.name() << nl << endl; - - field.write(); - processed = true; } } diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C index 93229e7f5d4581ea4f2f0b56aaabf7a42072b1ea..3b400f4889d47ca279118f1fe81ba5d464634af0 100644 --- a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C @@ -87,25 +87,45 @@ void Foam::calcMag::read(const dictionary& dict) { dict.lookup("fieldName") >> fieldName_; dict.lookup("resultName") >> resultName_; + + if (resultName_ == "none") + { + resultName_ = "mag(" + fieldName_ + ")"; + } } } void Foam::calcMag::execute() { - // Do nothing - only valid on write + if (active_) + { + bool processed = false; + + calc<scalar>(fieldName_, resultName_, processed); + calc<vector>(fieldName_, resultName_, processed); + calc<sphericalTensor>(fieldName_, resultName_, processed); + calc<symmTensor>(fieldName_, resultName_, processed); + calc<tensor>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcMag::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } } void Foam::calcMag::end() { - // Do nothing - only valid on write + // Do nothing } void Foam::calcMag::timeSet() { - // Do nothing - only valid on write + // Do nothing } @@ -113,18 +133,15 @@ void Foam::calcMag::write() { if (active_) { - bool processed = false; + if (obr_.foundObject<regIOobject>(resultName_)) + { + const regIOobject& field = + obr_.lookupObject<regIOobject>(resultName_); - calc<scalar>(fieldName_, resultName_, processed); - calc<vector>(fieldName_, resultName_, processed); - calc<sphericalTensor>(fieldName_, resultName_, processed); - calc<symmTensor>(fieldName_, resultName_, processed); - calc<tensor>(fieldName_, resultName_, processed); + Info<< type() << " " << name_ << " output:" << nl + << " writing field " << field.name() << nl << endl; - if (!processed) - { - WarningIn("void Foam::calcMag::write()") - << "Unprocessed field " << fieldName_ << endl; + field.write(); } } } diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C index 4435b64f1bec51001bc109e69384b1e6b2083363..f9db9368f7d4ae78084845a2a0fcf1d03b3d8ad7 100644 --- a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -80,26 +80,15 @@ void Foam::calcMag::calc const fvMesh& mesh = refCast<const fvMesh>(obr_); - word magName = resultName; - if (magName == "none") - { - magName = "mag(" + fieldName + ")"; - } - if (mesh.foundObject<vfType>(fieldName)) { const vfType& vf = mesh.lookupObject<vfType>(fieldName); volScalarField& field = - magField<volScalarField>(magName, vf.dimensions()); + magField<volScalarField>(resultName_, vf.dimensions()); field = mag(vf); - Info<< type() << " output:" << nl - << " writing " << field.name() << " field" << nl << endl; - - field.write(); - processed = true; } else if (mesh.foundObject<sfType>(fieldName)) @@ -107,15 +96,10 @@ void Foam::calcMag::calc const sfType& sf = mesh.lookupObject<sfType>(fieldName); surfaceScalarField& field = - magField<surfaceScalarField>(magName, sf.dimensions()); + magField<surfaceScalarField>(resultName_, sf.dimensions()); field = mag(sf); - Info<< type() << " output:" << nl - << " writing " << field.name() << " field" << nl << endl; - - field.write(); - processed = true; } } diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C index 8afeaa188d89fe4c41ee7afbd40f25dad33f3cb8..2a662c6513660c96d71ba68d334baa94df5eb4d5 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C @@ -154,24 +154,6 @@ void Foam::CourantNo::read(const dictionary& dict) void Foam::CourantNo::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::CourantNo::end() -{ - // Do nothing - only valid on write -} - - -void Foam::CourantNo::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::CourantNo::write() { if (active_) { @@ -197,6 +179,28 @@ void Foam::CourantNo::write() iField = 0.5*sumPhi/mesh.V().field()*mesh.time().deltaTValue(); CourantNo.correctBoundaryConditions(); + } +} + + +void Foam::CourantNo::end() +{ + // Do nothing +} + + +void Foam::CourantNo::timeSet() +{ + // Do nothing +} + + +void Foam::CourantNo::write() +{ + if (active_) + { + const volScalarField& CourantNo = + obr_.lookupObject<volScalarField>(type()); Info<< type() << " " << name_ << " output:" << nl << " writing field " << CourantNo.name() << nl diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C index 5deb9e884d2e5a84fe866ad381582126ef19f06d..0edfdb727d66dbb7251da0446c98215fa4d7478a 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C @@ -42,9 +42,11 @@ defineTypeNameAndDebug(DESModelRegions, 0); void Foam::DESModelRegions::writeFileHeader(const label i) { - file() << "# DES model region coverage (% volume)" << nl - << "# time " << token::TAB << "LES" << token::TAB << "RAS" - << endl; + writeHeader(file(), "DES model region coverage (% volume)"); + + writeCommented(file(), "Time"); + writeTabbed(file(), "LES"); + writeTabbed(file(), "RAS"); } @@ -127,24 +129,6 @@ void Foam::DESModelRegions::read(const dictionary& dict) void Foam::DESModelRegions::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::DESModelRegions::end() -{ - // Do nothing - only valid on write -} - - -void Foam::DESModelRegions::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::DESModelRegions::write() { typedef incompressible::turbulenceModel icoModel; typedef incompressible::DESModel icoDESModel; @@ -206,19 +190,17 @@ void Foam::DESModelRegions::write() if (Pstream::master() && log_) { - file() << obr_.time().timeName() << token::TAB - << prc << token::TAB << 100.0 - prc << endl; + file() << obr_.time().value() + << token::TAB << prc + << token::TAB << 100.0 - prc + << endl; } if (log_) { Info<< " LES = " << prc << " % (volume)" << nl - << " RAS = " << 100.0 - prc << " % (volume)" << nl - << " writing field " << DESModelRegions.name() << nl - << endl; + << " RAS = " << 100.0 - prc << " % (volume)" << endl; } - - DESModelRegions.write(); } else { @@ -232,4 +214,33 @@ void Foam::DESModelRegions::write() } +void Foam::DESModelRegions::end() +{ + // Do nothing +} + + +void Foam::DESModelRegions::timeSet() +{ + // Do nothing +} + + +void Foam::DESModelRegions::write() +{ + if (log_) + { + const volScalarField& DESModelRegions = + obr_.lookupObject<volScalarField>(type()); + + + Info<< type() << " " << name_ << " output:" << nl + << " writing field " << DESModelRegions.name() << nl + << endl; + + DESModelRegions.write(); + } +} + + // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C index 32a9c2c594980d44bb218b76b3821a4323242fba..b008b7b4fa54123e6134bcedf4157e5aecf2a57b 100644 --- a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C @@ -33,7 +33,7 @@ License namespace Foam { -defineTypeNameAndDebug(Lambda2, 0); + defineTypeNameAndDebug(Lambda2, 0); } @@ -115,24 +115,6 @@ void Foam::Lambda2::read(const dictionary& dict) void Foam::Lambda2::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::Lambda2::end() -{ - // Do nothing - only valid on write -} - - -void Foam::Lambda2::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::Lambda2::write() { if (active_) { @@ -156,6 +138,28 @@ void Foam::Lambda2::write() ); Lambda2 = -eigenValues(SSplusWW)().component(vector::Y); + } +} + + +void Foam::Lambda2::end() +{ + // Do nothing +} + + +void Foam::Lambda2::timeSet() +{ + // Do nothing +} + + +void Foam::Lambda2::write() +{ + if (active_) + { + const volScalarField& Lambda2 = + obr_.lookupObject<volScalarField>(type()); Info<< type() << " " << name_ << " output:" << nl << " writing field " << Lambda2.name() << nl diff --git a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C index 38edafd0fa5507903c336c6e3ceb3756c9748d8c..07c7e436b55a4f32b2347162076342c8b0cd25c8 100644 --- a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C +++ b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C @@ -35,7 +35,7 @@ License namespace Foam { -defineTypeNameAndDebug(Peclet, 0); + defineTypeNameAndDebug(Peclet, 0); } @@ -119,23 +119,6 @@ void Foam::Peclet::read(const dictionary& dict) void Foam::Peclet::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::Peclet::end() -{ - // Do nothing - only valid on write -} - -void Foam::Peclet::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::Peclet::write() { typedef compressible::turbulenceModel cmpTurbModel; typedef incompressible::turbulenceModel icoTurbModel; @@ -208,6 +191,27 @@ void Foam::Peclet::write() *mesh.surfaceInterpolation::deltaCoeffs() *fvc::interpolate(nuEff) ); + } +} + + +void Foam::Peclet::end() +{ + // Do nothing - only valid on write +} + +void Foam::Peclet::timeSet() +{ + // Do nothing - only valid on write +} + + +void Foam::Peclet::write() +{ + if (active_) + { + const surfaceScalarField& Peclet = + obr_.lookupObject<surfaceScalarField>(type()); Info<< type() << " " << name_ << " output:" << nl << " writing field " << Peclet.name() << nl diff --git a/src/postProcessing/functionObjects/utilities/Q/Q.C b/src/postProcessing/functionObjects/utilities/Q/Q.C index d2fdbd7b2aaaf68a7a76236304131bcdc3c3d6dd..a17561217e6373722d8c10c000e186b2497fba19 100644 --- a/src/postProcessing/functionObjects/utilities/Q/Q.C +++ b/src/postProcessing/functionObjects/utilities/Q/Q.C @@ -115,19 +115,35 @@ void Foam::Q::read(const dictionary& dict) void Foam::Q::execute() { - // Do nothing - only valid on write + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + const volVectorField& U = + mesh.lookupObject<volVectorField>(UName_); + + const volTensorField gradU(fvc::grad(U)); + + volScalarField& Q = + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(type()) + ); + + Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU)))); + } } void Foam::Q::end() { - // Do nothing - only valid on write + // Do nothing } void Foam::Q::timeSet() { - // Do nothing - only valid on write + // Do nothing } @@ -135,20 +151,8 @@ void Foam::Q::write() { if (active_) { - const fvMesh& mesh = refCast<const fvMesh>(obr_); - - const volVectorField& U = - mesh.lookupObject<volVectorField>(UName_); - - const volTensorField gradU(fvc::grad(U)); - - volScalarField& Q = - const_cast<volScalarField&> - ( - mesh.lookupObject<volScalarField>(type()) - ); - - Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU)))); + const volScalarField& Q = + obr_.lookupObject<volScalarField>(type()); Info<< type() << " " << name_ << " output:" << nl << " writing field " << Q.name() << nl diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C index e3f681f64b6537a841a93b960e549115d4cf1d57..3417dfec39071f035a722b7fd8c11eddddb4b0b0 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C @@ -31,7 +31,7 @@ License namespace Foam { -defineTypeNameAndDebug(pressureTools, 0); + defineTypeNameAndDebug(pressureTools, 0); } @@ -292,19 +292,30 @@ void Foam::pressureTools::read(const dictionary& dict) void Foam::pressureTools::execute() { - // Do nothing - only valid on write + if (active_) + { + const volScalarField& p = obr_.lookupObject<volScalarField>(pName_); + + volScalarField& pResult = + const_cast<volScalarField&> + ( + obr_.lookupObject<volScalarField>(pName()) + ); + + pResult == convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef()); + } } void Foam::pressureTools::end() { - // Do nothing - only valid on write + // Do nothing } void Foam::pressureTools::timeSet() { - // Do nothing - only valid on write + // Do nothing } @@ -312,15 +323,8 @@ void Foam::pressureTools::write() { if (active_) { - const volScalarField& p = obr_.lookupObject<volScalarField>(pName_); - - volScalarField& pResult = - const_cast<volScalarField&> - ( - obr_.lookupObject<volScalarField>(pName()) - ); - - pResult == convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef()); + const volScalarField& pResult = + obr_.lookupObject<volScalarField>(pName()); Info<< type() << " " << name_ << " output:" << nl << " writing field " << pResult.name() << nl diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index 88b48d2e1368880a26c4235a9f60b511c6f73ac5..a507428c6f442846845deabe6504b646b8725795 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -43,9 +43,11 @@ defineTypeNameAndDebug(wallShearStress, 0); void Foam::wallShearStress::writeFileHeader(const label i) { // Add headers to output data - file() << "# Wall shear stress" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << endl; + writeHeader(file(), "Wall shear stress"); + writeCommented(file(), "Time"); + writeTabbed(file(), "patch"); + writeTabbed(file(), "min"); + writeTabbed(file(), "max"); } @@ -73,9 +75,11 @@ void Foam::wallShearStress::calcShearStress if (Pstream::master()) { - file() << mesh.time().timeName() << token::TAB - << pp.name() << token::TAB << minSsp - << token::TAB << maxSsp << endl; + file() << mesh.time().value() + << token::TAB << pp.name() + << token::TAB << minSsp + << token::TAB << maxSsp + << endl; } if (log_) @@ -220,24 +224,6 @@ void Foam::wallShearStress::read(const dictionary& dict) void Foam::wallShearStress::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::wallShearStress::end() -{ - // Do nothing - only valid on write -} - - -void Foam::wallShearStress::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::wallShearStress::write() { typedef compressible::turbulenceModel cmpModel; typedef incompressible::turbulenceModel icoModel; @@ -282,8 +268,31 @@ void Foam::wallShearStress::write() << "database" << exit(FatalError); } - calcShearStress(mesh, Reff(), wallShearStress); + } +} + + +void Foam::wallShearStress::end() +{ + // Do nothing +} + + +void Foam::wallShearStress::timeSet() +{ + // Do nothing +} + + +void Foam::wallShearStress::write() +{ + if (active_) + { + functionObjectFile::write(); + + const volVectorField& wallShearStress = + obr_.lookupObject<volVectorField>(type()); if (log_) { diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C index 32c9043058254eb31d11491bdfe3c00e00dd08ed..57951c6bae940e1a334f5277a9498878236afaed 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C @@ -36,7 +36,7 @@ License namespace Foam { -defineTypeNameAndDebug(yPlusLES, 0); + defineTypeNameAndDebug(yPlusLES, 0); } @@ -44,10 +44,13 @@ defineTypeNameAndDebug(yPlusLES, 0); void Foam::yPlusLES::writeFileHeader(const label i) { - file() << "# y+ (LES)" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << token::TAB << "average" - << endl; + writeHeader(file(), "y+ (LES)"); + + writeCommented(file(), "Time"); + writeTabbed(file(), "patch"); + writeTabbed(file(), "min"); + writeTabbed(file(), "max"); + writeTabbed(file(), "average"); } @@ -100,10 +103,12 @@ void Foam::yPlusLES::calcIncompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << currPatch.name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << currPatch.name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } @@ -166,10 +171,12 @@ void Foam::yPlusLES::calcCompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << currPatch.name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << currPatch.name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } @@ -261,24 +268,6 @@ void Foam::yPlusLES::read(const dictionary& dict) void Foam::yPlusLES::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::yPlusLES::end() -{ - // Do nothing - only valid on write -} - - -void Foam::yPlusLES::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::yPlusLES::write() { if (active_) { @@ -310,6 +299,30 @@ void Foam::yPlusLES::write() { calcIncompressibleYPlus(mesh, U, yPlusLES); } + } +} + + +void Foam::yPlusLES::end() +{ + // Do nothing +} + + +void Foam::yPlusLES::timeSet() +{ + // Do nothing +} + + +void Foam::yPlusLES::write() +{ + if (active_) + { + functionObjectFile::write(); + + const volScalarField& yPlusLES = + obr_.lookupObject<volScalarField>(type()); if (log_) { diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C index 9b5d2eca6c030f9ae439d178a8300376bfb9fb14..8d84bda486075be307ae8b01dde2f991fa9cf58d 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -46,10 +46,13 @@ defineTypeNameAndDebug(yPlusRAS, 0); void Foam::yPlusRAS::writeFileHeader(const label i) { - file() << "# y+ (RAS)" << nl - << "# time " << token::TAB << "patch" << token::TAB - << "min" << token::TAB << "max" << token::TAB << "average" - << endl; + writeHeader(file(), "y+ (RAS)"); + + writeCommented(file(), "Time"); + writeTabbed(file(), "patch"); + writeTabbed(file(), "min"); + writeTabbed(file(), "max"); + writeTabbed(file(), "average"); } @@ -95,10 +98,12 @@ void Foam::yPlusRAS::calcIncompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << nutPw.patch().name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << nutPw.patch().name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } @@ -153,10 +158,12 @@ void Foam::yPlusRAS::calcCompressibleYPlus if (Pstream::master()) { - file() << obr_.time().value() << token::TAB - << mutPw.patch().name() << token::TAB - << minYp << token::TAB << maxYp << token::TAB - << avgYp << endl; + file() << obr_.time().value() + << token::TAB << mutPw.patch().name() + << token::TAB << minYp + << token::TAB << maxYp + << token::TAB << avgYp + << endl; } } } @@ -248,24 +255,6 @@ void Foam::yPlusRAS::read(const dictionary& dict) void Foam::yPlusRAS::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::yPlusRAS::end() -{ - // Do nothing - only valid on write -} - - -void Foam::yPlusRAS::timeSet() -{ - // Do nothing - only valid on write -} - - -void Foam::yPlusRAS::write() { if (active_) { @@ -295,6 +284,30 @@ void Foam::yPlusRAS::write() { calcIncompressibleYPlus(mesh, yPlusRAS); } + } +} + + +void Foam::yPlusRAS::end() +{ + // Do nothing +} + + +void Foam::yPlusRAS::timeSet() +{ + // Do nothing +} + + +void Foam::yPlusRAS::write() +{ + if (active_) + { + functionObjectFile::write(); + + const volScalarField& yPlusRAS = + obr_.lookupObject<volScalarField>(type()); if (log_) { diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 26e2936f316e36a9880c162d33d06e314b23b3e8..347e3ddb898f1570b7bed5521bd5224416c036cf 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -440,6 +440,7 @@ kinematicSingleLayer::kinematicSingleLayer cumulativeContErr_(0.0), deltaSmall_("deltaSmall", dimLength, SMALL), + deltaCoLimit_(solution().lookupOrDefault("deltaCoLimit", 1e-4)), rho_ ( @@ -898,15 +899,17 @@ scalar kinematicSingleLayer::CourantNumber() const if (regionMesh().nInternalFaces() > 0) { - const scalarField sumPhi(fvc::surfaceSum(mag(phi_))); - - const scalarField& V = regionMesh().V(); + const scalarField sumPhi + ( + fvc::surfaceSum(mag(phi_))().internalField() + / (deltaRho_.internalField() + ROOTVSMALL) + ); - forAll(deltaRho_, i) + forAll(delta_, i) { - if (deltaRho_[i] > SMALL) + if (delta_[i] > deltaCoLimit_) { - CoNum = max(CoNum, sumPhi[i]/deltaRho_[i]/V[i]); + CoNum = max(CoNum, sumPhi[i]/(delta_[i]*magSf()[i])); } } diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 197895c8449a8960928b835070c0cc5c3c6c884b..181a58b68be09fa0af385799bcf49b9644c63e04 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -100,6 +100,9 @@ protected: //- Small delta const dimensionedScalar deltaSmall_; + //- Film thickness above which Courant number calculation in valid + scalar deltaCoLimit_; + // Thermo properties diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C index a19eee6d1b909795a3f6ec1407c0e74b7e27e6ee..8cd45f60af2d6db2087b49a80da0142a7df02bbc 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,11 +45,35 @@ addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary); removeInjection::removeInjection ( const surfaceFilmModel& owner, - const dictionary& + const dictionary& dict ) : - injectionModel(owner) -{} + injectionModel(type(), owner, dict), + deltaStable_(coeffs_.lookupOrDefault<scalar>("deltaStable", 0.0)), + mask_(owner.regionMesh().nCells(), -1) +{ + wordReList patches; + if (coeffs_.readIfPresent("patches", patches)) + { + Info<< " applying to patches:" << nl; + const polyBoundaryMesh& pbm = owner.regionMesh().boundaryMesh(); + const labelHashSet patchSet = pbm.patchSet(patches); + + forAllConstIter(labelHashSet, patchSet, iter) + { + label patchI = iter.key(); + const polyPatch& pp = pbm[patchI]; + UIndirectList<scalar>(mask_, pp.faceCells()) = 1.0; + + Info<< " " << pp.name() << endl; + } + } + else + { + Info<< " applying to all patches" << endl; + mask_ = 1.0; + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -64,11 +88,23 @@ void removeInjection::correct ( scalarField& availableMass, scalarField& massToInject, - scalarField& + scalarField& diameterToInject ) { - massToInject = availableMass; - availableMass = 0.0; + const scalarField& delta = owner().delta(); + const scalarField& rho = owner().rho(); + const scalarField& magSf = owner().magSf(); + + forAll(delta, cellI) + { + if (mask_[cellI] > 0) + { + scalar ddelta = max(0.0, delta[cellI] - deltaStable_); + scalar dMass = ddelta*rho[cellI]*magSf[cellI]; + massToInject[cellI] += dMass; + availableMass[cellI] -= dMass; + } + } } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H index 35c1f5809d0d22bd44902fd1c91864d4b6452a53..fd8c6353446155dc4da8b13644b2207b06fd6676 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,16 @@ private: void operator=(const removeInjection&); +protected: + + //- Stable film thickness - mass only removed if thickness execeeds + // this threhold value + scalar deltaStable_; + + //- Mask per cell to indicate whether mass can be removed + scalarField mask_; + + public: //- Runtime type information diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C index da2d90c9faebd7acee8f6d0f6e4a2c975c809706..b100f7ed74ab7eb5f2ff287437d45acf695fe340 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.C +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -248,6 +248,7 @@ Foam::tmp<Foam::vectorField> Foam::sampledPatch::sample return sampleField(vField); } + Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatch::sample ( const volSphericalTensorField& vField @@ -292,6 +293,7 @@ Foam::tmp<Foam::vectorField> Foam::sampledPatch::sample return sampleField(sField); } + Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatch::sample ( const surfaceSphericalTensorField& sField @@ -318,6 +320,7 @@ Foam::tmp<Foam::tensorField> Foam::sampledPatch::sample return sampleField(sField); } + Foam::tmp<Foam::scalarField> Foam::sampledPatch::interpolate ( const interpolation<scalar>& interpolator @@ -335,6 +338,7 @@ Foam::tmp<Foam::vectorField> Foam::sampledPatch::interpolate return interpolateField(interpolator); } + Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatch::interpolate ( const interpolation<sphericalTensor>& interpolator diff --git a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H index 0385f96a633a1345f5ea25b402be875b811adf0f..f0b810a5baee60624f0c5fe06b5a5dc2f27186ae 100644 --- a/src/sampling/sampledSurface/sampledPatch/sampledPatch.H +++ b/src/sampling/sampledSurface/sampledPatch/sampledPatch.H @@ -53,7 +53,8 @@ class sampledPatch public sampledSurface { //- Private typedefs for convenience - typedef MeshedSurface<face> MeshStorage; + typedef MeshedSurface<face> MeshStorage; + // Private data @@ -78,16 +79,17 @@ class sampledPatch //- Start indices (in patchFaceLabels_) of patches labelList patchStart_; + // Private Member Functions - //- sample field on faces + //- Sample field on faces template<class Type> tmp<Field<Type> > sampleField ( const GeometricField<Type, fvPatchField, volMesh>& vField ) const; - //- sample surface field on faces + //- Sample surface field on faces template<class Type> tmp<Field<Type> > sampleField ( @@ -95,10 +97,9 @@ class sampledPatch ) const; template<class Type> - tmp<Field<Type> > - interpolateField(const interpolation<Type>&) const; + tmp<Field<Type> > interpolateField(const interpolation<Type>&) const; - //- remap action on triangulation or cleanup + //- Re-map action on triangulation or cleanup virtual void remapFaces(const labelUList& faceMap); @@ -180,96 +181,99 @@ public: } - //- sample field on surface - virtual tmp<scalarField> sample - ( - const volScalarField& - ) const; - - //- sample field on surface - virtual tmp<vectorField> sample - ( - const volVectorField& - ) const; - - //- sample field on surface - virtual tmp<sphericalTensorField> sample - ( - const volSphericalTensorField& - ) const; - - //- sample field on surface - virtual tmp<symmTensorField> sample - ( - const volSymmTensorField& - ) const; - - //- sample field on surface - virtual tmp<tensorField> sample - ( - const volTensorField& - ) const; - - //- Surface sample field on surface - virtual tmp<scalarField> sample - ( - const surfaceScalarField& - ) const; - - //- Surface Sample field on surface - virtual tmp<vectorField> sample - ( - const surfaceVectorField& - ) const; - - //- Surface sample field on surface - virtual tmp<sphericalTensorField> sample - ( - const surfaceSphericalTensorField& - ) const; - - //- Surface sample field on surface - virtual tmp<symmTensorField> sample - ( - const surfaceSymmTensorField& - ) const; - - //- Surface sample field on surface - virtual tmp<tensorField> sample - ( - const surfaceTensorField& - ) const; - - //- interpolate field on surface - virtual tmp<scalarField> interpolate - ( - const interpolation<scalar>& - ) const; - - - //- interpolate field on surface - virtual tmp<vectorField> interpolate - ( - const interpolation<vector>& - ) const; - - //- interpolate field on surface - virtual tmp<sphericalTensorField> interpolate - ( - const interpolation<sphericalTensor>& - ) const; - - //- interpolate field on surface - virtual tmp<symmTensorField> interpolate - ( - const interpolation<symmTensor>& - ) const; - - //- interpolate field on surface - virtual tmp<tensorField> interpolate - ( - const interpolation<tensor>& - ) const; + // Sample + //- Sample field on surface + virtual tmp<scalarField> sample + ( + const volScalarField& + ) const; + + //- Sample field on surface + virtual tmp<vectorField> sample + ( + const volVectorField& + ) const; + + //- Sample field on surface + virtual tmp<sphericalTensorField> sample + ( + const volSphericalTensorField& + ) const; + + //- Sample field on surface + virtual tmp<symmTensorField> sample + ( + const volSymmTensorField& + ) const; + + //- Sample field on surface + virtual tmp<tensorField> sample + ( + const volTensorField& + ) const; + + //- Surface sample field on surface + virtual tmp<scalarField> sample + ( + const surfaceScalarField& + ) const; + + //- Surface Sample field on surface + virtual tmp<vectorField> sample + ( + const surfaceVectorField& + ) const; + + //- Surface sample field on surface + virtual tmp<sphericalTensorField> sample + ( + const surfaceSphericalTensorField& + ) const; + + //- Surface sample field on surface + virtual tmp<symmTensorField> sample + ( + const surfaceSymmTensorField& + ) const; + + //- Surface sample field on surface + virtual tmp<tensorField> sample + ( + const surfaceTensorField& + ) const; + + + // Interpolate + + //- Interpolate field on surface + virtual tmp<scalarField> interpolate + ( + const interpolation<scalar>& + ) const; + + //- Interpolate field on surface + virtual tmp<vectorField> interpolate + ( + const interpolation<vector>& + ) const; + + //- Interpolate field on surface + virtual tmp<sphericalTensorField> interpolate + ( + const interpolation<sphericalTensor>& + ) const; + + //- Interpolate field on surface + virtual tmp<symmTensorField> interpolate + ( + const interpolation<symmTensor>& + ) const; + + //- Interpolate field on surface + virtual tmp<tensorField> interpolate + ( + const interpolation<tensor>& + ) const; //- Write virtual void print(Ostream&) const; diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C index 4f16bbed599c089df6ba2f46789ed59f5d8e7888..a133fdd8ceef778a9a294e674ed93e9ff0720abf 100644 --- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C +++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -204,6 +204,7 @@ Foam::tmp<Foam::vectorField> Foam::sampledPatchInternalField::interpolate return interpolateField(interpolator); } + Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatchInternalField::interpolate ( diff --git a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H index f2b3b7c4dc31e493968873b73674b04509641653..05a7ea61a9cdfe7356fc1a69bc7af3a73be61f3e 100644 --- a/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H +++ b/src/sampling/sampledSurface/sampledPatchInternalField/sampledPatchInternalField.H @@ -49,7 +49,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class sampledPatchInternalField Declaration + Class sampledPatchInternalField Declaration \*---------------------------------------------------------------------------*/ class sampledPatchInternalField @@ -74,6 +74,7 @@ class sampledPatchInternalField template<class Type> tmp<Field<Type> > interpolateField(const interpolation<Type>&) const; + public: //- Runtime type information @@ -97,67 +98,71 @@ public: // Member Functions - //- sample field on surface - virtual tmp<scalarField> sample - ( - const volScalarField& - ) const; - - //- sample field on surface - virtual tmp<vectorField> sample - ( - const volVectorField& - ) const; - - //- sample field on surface - virtual tmp<sphericalTensorField> sample - ( - const volSphericalTensorField& - ) const; - - //- sample field on surface - virtual tmp<symmTensorField> sample - ( - const volSymmTensorField& - ) const; - - //- sample field on surface - virtual tmp<tensorField> sample - ( - const volTensorField& - ) const; - + // Sample + + //- Sample field on surface + virtual tmp<scalarField> sample + ( + const volScalarField& + ) const; + + //- Sample field on surface + virtual tmp<vectorField> sample + ( + const volVectorField& + ) const; + + //- Sample field on surface + virtual tmp<sphericalTensorField> sample + ( + const volSphericalTensorField& + ) const; + + //- Sample field on surface + virtual tmp<symmTensorField> sample + ( + const volSymmTensorField& + ) const; + + //- Sample field on surface + virtual tmp<tensorField> sample + ( + const volTensorField& + ) const; + + + // Interpolate + + //- Interpolate field on surface + virtual tmp<scalarField> interpolate + ( + const interpolation<scalar>& + ) const; + + //- Interpolate field on surface + virtual tmp<vectorField> interpolate + ( + const interpolation<vector>& + ) const; + + //- Interpolate field on surface + virtual tmp<sphericalTensorField> interpolate + ( + const interpolation<sphericalTensor>& + ) const; + + //- Interpolate field on surface + virtual tmp<symmTensorField> interpolate + ( + const interpolation<symmTensor>& + ) const; + + //- Interpolate field on surface + virtual tmp<tensorField> interpolate + ( + const interpolation<tensor>& + ) const; - //- interpolate field on surface - virtual tmp<scalarField> interpolate - ( - const interpolation<scalar>& - ) const; - - - //- interpolate field on surface - virtual tmp<vectorField> interpolate - ( - const interpolation<vector>& - ) const; - - //- interpolate field on surface - virtual tmp<sphericalTensorField> interpolate - ( - const interpolation<sphericalTensor>& - ) const; - - //- interpolate field on surface - virtual tmp<symmTensorField> interpolate - ( - const interpolation<symmTensor>& - ) const; - - //- interpolate field on surface - virtual tmp<tensorField> interpolate - ( - const interpolation<tensor>& - ) const; //- Write virtual void print(Ostream&) const; diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 35880afafa1bdb1cb2d64c3d447dd594844f5fcb..8683e320dc6581f9caa8b4f0a9f2f4906ca26d1f 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -113,9 +113,9 @@ void Foam::sampledSurfaces::sampleAndWrite ) { // interpolator for this field - autoPtr< interpolation<Type> > interpolator; + autoPtr<interpolation<Type> > interpolatorPtr; - const word& fieldName = vField.name(); + const word& fieldName = vField.name(); const fileName outputDir = outputPath_/vField.time().timeName(); forAll(*this, surfI) @@ -126,16 +126,16 @@ void Foam::sampledSurfaces::sampleAndWrite if (s.interpolate()) { - if (interpolator.empty()) + if (interpolatorPtr.empty()) { - interpolator = interpolation<Type>::New + interpolatorPtr = interpolation<Type>::New ( interpolationScheme_, vField ); } - values = s.interpolate(interpolator()); + values = s.interpolate(interpolatorPtr()); } else { diff --git a/src/thermophysicalModels/radiationModels/Make/files b/src/thermophysicalModels/radiationModels/Make/files index 27d90bdd5e51698873a3cec8a7de5d708cae20a7..7b17f4ad51c3e070979a2aaabd9bd9c36b47aac0 100644 --- a/src/thermophysicalModels/radiationModels/Make/files +++ b/src/thermophysicalModels/radiationModels/Make/files @@ -27,6 +27,11 @@ submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionE submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C submodels/absorptionEmissionModel/greyMeanSolidAbsorptionEmission/greyMeanSolidAbsorptionEmission.C +/* Soot model */ +submodels/sootModel/sootModel/sootModel.C +submodels/sootModel/sootModel/sootModelNew.C +submodels/sootModel/mixtureFractionSoot/mixtureFractionSoots.C +submodels/sootModel/noSoot/noSoot.C /* Boundary conditions */ derivedFvPatchFields/MarshakRadiation/MarshakRadiationFvPatchScalarField.C diff --git a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C index 08dd1e3764ec870d6b275cc47ba2965006e421db..bf33d8af88066952cddb0e638f4d11c42300984c 100644 --- a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C +++ b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/greyMeanAbsorptionEmission/greyMeanAbsorptionEmission.C @@ -337,6 +337,17 @@ Foam::radiation::greyMeanAbsorptionEmission::ECont(const label bandI) const } } } + else + { + WarningIn + ( + "tmp<volScalarField>" + "radiation::greyMeanAbsorptionEmission::ECont" + "(" + "const label" + ") const" + ) << "dQ field not found in mesh" << endl; + } return E; } diff --git a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C index a3a37549090a8ea7c24149fdfabfa05b0cb4a139..230fb0330709a8309e518d62b2ac54d9cf99cb5d 100644 --- a/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C +++ b/src/thermophysicalModels/radiationModels/submodels/absorptionEmissionModel/wideBandAbsorptionEmission/wideBandAbsorptionEmission.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -255,14 +255,39 @@ Foam::radiation::wideBandAbsorptionEmission::ECont(const label bandI) const ) ); - if (mesh().foundObject<volScalarField>("hrr")) + if (mesh().foundObject<volScalarField>("dQ")) { - const volScalarField& hrr = mesh().lookupObject<volScalarField>("hrr"); - E().internalField() = - iEhrrCoeffs_[bandI] - *hrr.internalField() - *(iBands_[bandI][1] - iBands_[bandI][0]) - /totalWaveLength_; + const volScalarField& dQ = mesh().lookupObject<volScalarField>("dQ"); + + if (dQ.dimensions() == dimEnergy/dimTime) + { + E().internalField() = + iEhrrCoeffs_[bandI] + *dQ.internalField() + *(iBands_[bandI][1] - iBands_[bandI][0]) + /totalWaveLength_ + /mesh_.V(); + } + else if (dQ.dimensions() == dimEnergy/dimTime/dimVolume) + { + E().internalField() = + iEhrrCoeffs_[bandI] + *dQ.internalField() + *(iBands_[bandI][1] - iBands_[bandI][0]) + /totalWaveLength_; + } + else + { + WarningIn + ( + "tmp<volScalarField>" + "radiation::wideBandAbsorptionEmission::ECont" + "(" + "const label" + ") const" + ) + << "Incompatible dimensions for dQ field" << endl; + } } return E; @@ -289,9 +314,8 @@ void Foam::radiation::wideBandAbsorptionEmission::correct for (label j=0; j<nBands_; j++) { - Info<< "Calculating absorption in band: " << j << endl; aLambda[j].internalField() = this->a(j); - Info<< "Calculated absorption in band: " << j << endl; + a.internalField() += aLambda[j].internalField() *(iBands_[j][1] - iBands_[j][0]) diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoot.C b/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoot.C new file mode 100644 index 0000000000000000000000000000000000000000..f891f9ad2124c42e107a4f74df2fdd5a99eb9788 --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoot.C @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "mixtureFractionSoot.H" +#include "singleStepReactingMixture.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + + +template<class ThermoType> +const Foam::singleStepReactingMixture<ThermoType>& +Foam::radiation::mixtureFractionSoot<ThermoType>::checkThermo +( + const fluidThermo& thermo +) +{ + if (isA<singleStepReactingMixture<ThermoType> >(thermo)) + { + return dynamic_cast<const singleStepReactingMixture<ThermoType>& > + ( + thermo + ); + } + else + { + FatalErrorIn + ( + "template<class ThermoType> " + "Foam::radiation::mixtureFractionSoot " + "(" + "const dictionary&, " + "const fvMesh&" + ")" + ) + << "Inconsistent thermo package for " << thermo.type() + << "Please select a thermo package based on " + << "singleStepReactingMixture" << exit(FatalError); + + return dynamic_cast<const singleStepReactingMixture<ThermoType>& > + ( + thermo + ); + } + +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class ThermoType> +Foam::radiation::mixtureFractionSoot<ThermoType>::mixtureFractionSoot +( + const dictionary& dict, + const fvMesh& mesh, + const word& modelType +) +: + sootModel(dict, mesh, modelType), + soot_ + ( + IOobject + ( + "soot", + mesh_.time().timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + coeffsDict_(dict.subOrEmptyDict(modelType + "Coeffs")), + nuSoot_(readScalar(coeffsDict_.lookup("nuSoot"))), + Wsoot_(readScalar(coeffsDict_.lookup("Wsoot"))), + sootMax_(-1), + mappingFieldName_ + ( + coeffsDict_.lookupOrDefault<word>("mappingFieldName", "none") + ), + mapFieldMax_(1), + thermo_(mesh.lookupObject<fluidThermo>("thermophysicalProperties")), + mixture_(checkThermo(thermo_)) +{ + const Reaction<ThermoType>& reaction = mixture_.operator[](0); + + const scalarList& specieStoichCoeffs(mixture_.specieStoichCoeffs()); + + scalar totalMol = 0.0; + forAll(reaction.rhs(), i) + { + label specieI = reaction.rhs()[i].index; + totalMol += mag(specieStoichCoeffs[specieI]); + } + + totalMol += nuSoot_; + + scalarList Xi(reaction.rhs().size()); + + scalar Wm = 0.0; + forAll(reaction.rhs(), i) + { + const label specieI = reaction.rhs()[i].index; + Xi[i] = mag(specieStoichCoeffs[specieI])/totalMol; + Wm += Xi[i]*mixture_.speciesData()[specieI].W(); + } + + const scalar XSoot = nuSoot_/totalMol; + Wm += XSoot*Wsoot_; + + sootMax_ = XSoot*Wsoot_/Wm; + + Info << "Maximum soot mass concentrations: " << sootMax_ << nl; + + if (mappingFieldName_ == "none") + { + const label index = reaction.rhs()[0].index; + mappingFieldName_ = mixture_.Y(index).name(); + } + + const label mapFieldIndex = mixture_.species()[mappingFieldName_]; + + mapFieldMax_ = mixture_.Yprod0()[mapFieldIndex]; + +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class ThermoType> +Foam::radiation::mixtureFractionSoot<ThermoType>::~mixtureFractionSoot() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class ThermoType> +void Foam::radiation::mixtureFractionSoot<ThermoType>::correct() +{ + const volScalarField& mapField = + mesh_.lookupObject<volScalarField>(mappingFieldName_); + + soot_ = sootMax_*(mapField/mapFieldMax_); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoot.H b/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoot.H new file mode 100644 index 0000000000000000000000000000000000000000..1b1eed82d257ce89cf78bdddee8c10a0397458e6 --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoot.H @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::radiation::mixtureFractionSoot + +Description + This soot model is purely an state model. The ammount of soot produced is + determined by a single step chemistry as : + + nuf Fuel + nuOx Ox = nuP P + nuSoot soot + + nuSoot is prescribed by the user. + + The single step chemistry used is read from the combustion. + The soot is not considered into the thermodynamics of the system and it + is not considered as an extra specie in the solver. + + The spacial distribution is given by the normalization of the first product + on the rhs of the reaction by default or it can be added as input. + + The input dictionary reads like in the radiationProperties dictionary: + + sootModel mixtureFractionSoot<gasHThermoPhysics>; + + mixtureFractionSootCoeffs + { + nuSoot 0.015; + Wsoot 12; + mappingFieldName P; + } + +SourceFiles + mixtureFractionSoot.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mixtureFractionSoot_H +#define mixtureFractionSoot_H + +#include "interpolationLookUpTable.H" +#include "sootModel.H" +#include "HashTable.H" + +#include "fluidThermo.H" +#include "singleStepReactingMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace radiation +{ + +/*---------------------------------------------------------------------------*\ + Class mixtureFractionSoot Declaration +\*---------------------------------------------------------------------------*/ +template<class ThermoType> +class mixtureFractionSoot +: + public sootModel +{ + + // Static functions + + //- Check mixture in thermo + static const singleStepReactingMixture<ThermoType>& checkThermo + ( + const fluidThermo& + ); + + + // Private data + + //- Soot mass fraction + volScalarField soot_; + + //- Soot model dictionary + dictionary coeffsDict_; + + //- Soot yield + scalar nuSoot_; + + //- Soot molecular weight + scalar Wsoot_; + + //- Maximum soot mass concentration at stoichiometric + scalar sootMax_; + + //- Name of the field mapping the soot + word mappingFieldName_; + + //- Maximum value of the map field + scalar mapFieldMax_; + + //- Thermo package + const fluidThermo& thermo_; + + //- Auto Ptr to singleStepReactingMixture + const singleStepReactingMixture<ThermoType>& mixture_; + + +public: + + //- Runtime type information + TypeName("mixtureFractionSoot"); + + + // Constructors + + //- Construct from components + mixtureFractionSoot + ( + const dictionary& dict, + const fvMesh& mesh, + const word& modelType + ); + + + //- Destructor + virtual ~mixtureFractionSoot(); + + + // Member Functions + + // Edit + + //- Main update/correction routine + virtual void correct(); + + + // Access + + //- Return Ysoot + const volScalarField& soot() const + { + return soot_; + } + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace radiation + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "mixtureFractionSoot.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoots.C b/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoots.C new file mode 100644 index 0000000000000000000000000000000000000000..9c4131b6798225716e5d2018013f6ea8a15fc01f --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/mixtureFractionSoot/mixtureFractionSoots.C @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + + +#include "mixtureFractionSoot.H" +#include "makeSootTypes.H" +#include "thermoPhysicsTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace radiation +{ +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makeSootTypesThermo(mixtureFractionSoot, gasHThermoPhysics); +makeSootTypesThermo(mixtureFractionSoot, gasEThermoPhysics); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace radiation + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/noSoot/noSoot.C b/src/thermophysicalModels/radiationModels/submodels/sootModel/noSoot/noSoot.C new file mode 100644 index 0000000000000000000000000000000000000000..73b057c81022583e5255568029de94d025d0880f --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/noSoot/noSoot.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "noSoot.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace radiation + { + defineTypeNameAndDebug(noSoot, 0); + + addToRunTimeSelectionTable + ( + sootModel, + noSoot, + dictionary + ); + } +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::radiation::noSoot::noSoot +( + const dictionary& dict, + const fvMesh& mesh, + const word& modelType +) +: + sootModel(dict, mesh, modelType) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // +Foam::radiation::noSoot::~noSoot() +{} + + +void Foam::radiation::noSoot::correct() +{ + //Do nothing +} + +const Foam::volScalarField& Foam::radiation::noSoot::soot() const +{ + notImplemented + ( + "Foam::volScalarField& Foam::radiation::noSoot::soot() const" + ); + return tmp<volScalarField>(NULL); +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/noSoot/noSoot.H b/src/thermophysicalModels/radiationModels/submodels/sootModel/noSoot/noSoot.H new file mode 100644 index 0000000000000000000000000000000000000000..cec605410559234b2093e8c15bcc18e883e31f69 --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/noSoot/noSoot.H @@ -0,0 +1,98 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::radiation::noSoot + +Description + noSoot + + +SourceFiles + noSoot.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noSoot_H +#define noSoot_H + + +#include "sootModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace radiation +{ + +/*---------------------------------------------------------------------------*\ + Class noSoot Declaration +\*---------------------------------------------------------------------------*/ +class noSoot +: + public sootModel +{ + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from components + noSoot(const dictionary& dict, const fvMesh& mesh, const word&); + + + //- Destructor + virtual ~noSoot(); + + + // Member Functions + + // Edit + + //- Main update/correction routine + void correct(); + + // Access + + //- Return Ysoot + const volScalarField& soot() const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace radiation + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/makeSootTypes.H b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/makeSootTypes.H new file mode 100644 index 0000000000000000000000000000000000000000..f8799926f41642bbcfd533da834036f4d54ce895 --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/makeSootTypes.H @@ -0,0 +1,57 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSootTypes_H +#define makeSootTypes_H + +#include "addToRunTimeSelectionTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSootTypesThermo(sootModelType, Thermo) \ + \ + typedef sootModelType<Thermo> sootModelType##Thermo; \ + \ + defineTemplateTypeNameAndDebugWithName \ + ( \ + sootModelType##Thermo, \ + #sootModelType"<"#Thermo">", \ + 0 \ + ); \ + \ + addToRunTimeSelectionTable \ + ( \ + sootModel, \ + sootModelType##Thermo, \ + dictionary \ + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModel.C b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModel.C new file mode 100644 index 0000000000000000000000000000000000000000..b0432e1d33da59a31d08ef674e705cfa34bb1898 --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModel.C @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "sootModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace radiation +{ + defineTypeNameAndDebug(sootModel, 0); + defineRunTimeSelectionTable(sootModel, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::radiation::sootModel::sootModel +( + const dictionary& dict, + const fvMesh& mesh, + const word& modelType +) +: + dict_(dict), + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +Foam::radiation::sootModel::~sootModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModel.H b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModel.H new file mode 100644 index 0000000000000000000000000000000000000000..5562d630fa66738b9928abb0b23d10a8f92305cc --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModel.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::radiation::sootModel + +Description + Base class for soor models + +\*---------------------------------------------------------------------------*/ + +#ifndef radiationsootModel_H +#define radiationsootModel_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "volFields.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace radiation +{ + + +/*---------------------------------------------------------------------------*\ + Class sootModel Declaration +\*---------------------------------------------------------------------------*/ + +class sootModel +{ + +protected: + + // Protected data + + //- Radiation model dictionary + const dictionary dict_; + + //- Reference to the fvMesh + const fvMesh& mesh_; + + +public: + + //- Runtime type information + TypeName("sootModel"); + + //- Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + sootModel, + dictionary, + ( + const dictionary& dict, + const fvMesh& mesh, + const word& modelType + ), + (dict, mesh, modelType) + ); + + + // Constructors + + //- Construct from components + sootModel + ( + const dictionary& dict, + const fvMesh& mesh, + const word& modelType + ); + + + //- Selector + static autoPtr<sootModel> New + ( + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~sootModel(); + + + // Member Functions + + // Access + + //- Reference to the mesh + inline const fvMesh& mesh() const + { + return mesh_; + } + + //- Reference to the dictionary + inline const dictionary& dict() const + { + return dict_; + } + + + // Member Functions + + // Edit + + //- Main update/correction routine + virtual void correct() = 0; + + + // Access + + //- Return const reference to soot + virtual const volScalarField& soot() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam +} // End namespace radiation + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModelNew.C b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModelNew.C new file mode 100644 index 0000000000000000000000000000000000000000..bdb8181d41d4a5f8dd0546ea892a9a4cf1fad9b0 --- /dev/null +++ b/src/thermophysicalModels/radiationModels/submodels/sootModel/sootModel/sootModelNew.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "error.H" +#include "sootModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::radiation::sootModel> +Foam::radiation::sootModel::New +( + const dictionary& dict, + const fvMesh& mesh +) +{ + word modelType("none"); + + if (dict.found("sootModel")) + { + dict.lookup("sootModel") >> modelType; + + Info<< "Selecting sootModel " << modelType << endl; + } + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "sootModel::New(const dictionary&, const fvMesh&)" + ) << "Unknown sootModel type " + << modelType << nl << nl + << "Valid sootModel types are :" << nl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); + } + + const label tempOpen = modelType.find('<'); + + const word className = modelType(0, tempOpen); + + return autoPtr<sootModel>(cstrIter()(dict, mesh, className)); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C index 63dd057f3d9f5ea52d3f85b016563e866fec64aa..701ce73c8d1419d06507ea76751a99c906866b03 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C @@ -281,9 +281,8 @@ void Foam::chemkinReader::addPressureDependentReaction thirdBodyEfficiencies(speciesTable_, efficiencies) ) ); + break; } - break; - case Troe: { scalarList TroeCoeffs @@ -337,9 +336,8 @@ void Foam::chemkinReader::addPressureDependentReaction thirdBodyEfficiencies(speciesTable_, efficiencies) ) ); + break; } - break; - case SRI: { scalarList SRICoeffs @@ -395,27 +393,16 @@ void Foam::chemkinReader::addPressureDependentReaction thirdBodyEfficiencies(speciesTable_, efficiencies) ) ); + break; } - break; - default: { - if (fofType < 4) - { - FatalErrorIn("chemkinReader::addPressureDependentReaction") - << "Fall-off function type " - << fallOffFunctionNames[fofType] - << " on line " << lineNo_-1 - << " not implemented" - << exit(FatalError); - } - else - { - FatalErrorIn("chemkinReader::addPressureDependentReaction") - << "Unknown fall-off function type " << fofType - << " on line " << lineNo_-1 - << exit(FatalError); - } + FatalErrorIn("chemkinReader::addPressureDependentReaction") + << "Fall-off function type " + << fallOffFunctionNames[fofType] + << " on line " << lineNo_-1 + << " not implemented" + << exit(FatalError); } } } @@ -537,9 +524,8 @@ void Foam::chemkinReader::addReaction ) ); } + break; } - break; - case thirdBodyArrhenius: { if (rType == nonEquilibriumReversible) @@ -597,9 +583,8 @@ void Foam::chemkinReader::addReaction ) ); } + break; } - break; - case unimolecularFallOff: { addPressureDependentReaction<FallOffReactionRate> @@ -616,9 +601,8 @@ void Foam::chemkinReader::addReaction Afactor, RR ); + break; } - break; - case chemicallyActivatedBimolecular: { addPressureDependentReaction<ChemicallyActivatedReactionRate> @@ -635,9 +619,8 @@ void Foam::chemkinReader::addReaction Afactor/concFactor, RR ); + break; } - break; - case LandauTeller: { const scalarList& LandauTellerCoeffs = @@ -705,9 +688,8 @@ void Foam::chemkinReader::addReaction ) ); } + break; } - break; - case Janev: { const scalarList& JanevCoeffs = @@ -727,9 +709,8 @@ void Foam::chemkinReader::addReaction FixedList<scalar, 9>(JanevCoeffs) ) ); + break; } - break; - case powerSeries: { const scalarList& powerSeriesCoeffs = @@ -749,35 +730,23 @@ void Foam::chemkinReader::addReaction FixedList<scalar, 4>(powerSeriesCoeffs) ) ); + break; } - break; - case unknownReactionRateType: { FatalErrorIn("chemkinReader::addReaction") << "Internal error on line " << lineNo_-1 << ": reaction rate type has not been set" << exit(FatalError); + break; } - break; - default: { - if (rrType < 9) - { - FatalErrorIn("chemkinReader::addReaction") - << "Reaction rate type " << reactionRateTypeNames[rrType] - << " on line " << lineNo_-1 - << " not implemented" - << exit(FatalError); - } - else - { - FatalErrorIn("chemkinReader::addReaction") - << "Unknown reaction rate type " << rrType - << " on line " << lineNo_-1 - << exit(FatalError); - } + FatalErrorIn("chemkinReader::addReaction") + << "Reaction rate type " << reactionRateTypeNames[rrType] + << " on line " << lineNo_-1 + << " not implemented" + << exit(FatalError); } } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H index b29c0758ad6589663e4c3feab8a631a9b64128d0..210b9771b7b3959b4751998cd32ee8c0a09e0cfa 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/reactingMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -96,6 +96,11 @@ public: { return PtrList<Reaction<ThermoType> >::operator[](i); } + + const Reaction<ThermoType>& operator [] (const label i) const + { + return PtrList<Reaction<ThermoType> >::operator[](i); + } }; diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index cfa20630aed40bb294fb050a4e4091bb61b41b39..9387769caeebe0e8ffa9023d0ca95041a886368a 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -112,7 +112,7 @@ void Foam::interfaceProperties::calculateK() const surfaceVectorField& Sf = mesh.Sf(); // Cell gradient of alpha - const volVectorField gradAlpha(fvc::grad(alpha1_)); + const volVectorField gradAlpha(fvc::grad(alpha1_, "nHat")); // Interpolated face-gradient of alpha surfaceVectorField gradAlphaf(fvc::interpolate(gradAlpha)); @@ -123,6 +123,11 @@ void Foam::interfaceProperties::calculateK() // Face unit interface normal surfaceVectorField nHatfv(gradAlphaf/(mag(gradAlphaf) + deltaN_)); + // surfaceVectorField nHatfv + // ( + // (gradAlphaf + deltaN_*vector(0, 0, 1) + // *sign(gradAlphaf.component(vector::Z)))/(mag(gradAlphaf) + deltaN_) + // ); correctContactAngle(nHatfv.boundaryField(), gradAlphaf.boundaryField()); // Face unit interface normal flux diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H index 48fad5af6d9c4a3491d6648a32b81b336fc69bd9..c07344e8b64f85299b1b6b5d8d03532dac6ea9a8 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - externalWallHeatFluxTemperatureFvPatchScalarField + Foam::externalWallHeatFluxTemperatureFvPatchScalarField Group grpThermoBoundaryConditions grpWallBoundaryConditions @@ -34,38 +34,53 @@ Description fixed heat transfer coefficient mode. The condition can operate in two modes: - \li fixed heat transfer coefficient: supply h and Ta - \li fixed heat flux: supply q + - fixed heat transfer coefficient: supply h and Ta + - fixed heat flux: supply q - where - \var h = heat transfer coefficient [W/m2/K] - \var Ta = ambient temperature [K] - \var q = heat flux [W/m2] + where: + \vartable + h | heat transfer coefficient [W/m2/K] + Ta | ambient temperature [K] + q | heat flux [W/m2] + \endvartable The thermal conductivity, \c kappa, can either be retrieved from the mesh database using the \c lookup option, or from a \c solidThermo thermophysical package. + + \heading Patch usage + + \table + Property | Description | Required | Default value + kappa | thermal conductivity option | yes | + q | heat flux [W/m2] | yes* | + Ta | ambient temperature [K] | yes* | + h | heat transfer coefficient [W/m/K] | yes*| + thicknessLayers | list of thicknesses per layer [m] | yes | + kappaLayers | list of thermal conductivites per layer [W/m/K] | yes | + kappaName | name of thermal conductivity field | yes | + \endtable + Example of the boundary condition specification: \verbatim - myPatch - { - type externalWallHeatFluxTemperature; - kappa fluidThermo; // fluidThermo, solidThermo or - // lookup - q uniform 1000; // heat flux / [W/m2] - Ta uniform 300.0; // ambient temperature /[K] - h uniform 10.0; // heat transfer coeff /[W/Km2] - thicknessLayers (0.1 0.2 0.3 0.4); // thickness of layer [m] - kappaLayers (1 2 3 4) // thermal conductivity of - // layer [W/m/K] - value uniform 300.0; // initial temperature / [K] - kappaName none; - } + myPatch + { + type externalWallHeatFluxTemperature; + kappa fluidThermo; + q uniform 1000; + Ta uniform 300.0; + h uniform 10.0; + thicknessLayers (0.1 0.2 0.3 0.4); + kappaLayers (1 2 3 4) + value uniform 300.0; + kappaName none; + } \endverbatim Note - Only supply \c h and \c Ta, or \c q in the dictionary (see above) + - Only supply \c h and \c Ta, or \c q in the dictionary (see above) + - kappa entries can be: fluidThermo, solidThermo or lookup SourceFiles externalWallHeatFluxTemperatureFvPatchScalarField.C diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C index ec67161758f8b045b88ed00c894e48d355656e9d..ea5fb187280e61baf9b1af2f887ca7e79f7725fb 100644 --- a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C @@ -366,10 +366,10 @@ void v2f::correct() const volScalarField G(GName(), nut_*S2); const volScalarField T(Ts()); - const volScalarField L2(type() + ".L2", sqr(Ls())); + const volScalarField L2(type() + ":L2", sqr(Ls())); const volScalarField alpha ( - "v2f::alpha", + "v2f:alpha", 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) ); diff --git a/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/constant/radiationProperties b/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/constant/radiationProperties index 392c1acad2ccf0ebd05304d8cdbbd522f2390ba3..6ce48dc3fe1bb4248bccf9f4c539737053d731c6 100755 --- a/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/constant/radiationProperties +++ b/tutorials/combustion/fireFoam/les/flameSpreadWaterSuppressionPanel/constant/radiationProperties @@ -48,13 +48,10 @@ greyMeanAbsorptionEmissionSootCoeffs EhrrCoeff 0.4; } -scatterModel constantScatter; +scatterModel none; -constantScatterCoeffs -{ - sigma sigma [ 0 -1 0 0 0 0 0 ] 0; - C C [ 0 0 0 0 0 0 0 ] 0; -} + +sootModel none; // ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties index ae6091de4dcfec007b306990ac6d633ec38b5e58..b779d05d3823618e895df488bc504be971ee4d3a 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties @@ -191,5 +191,6 @@ greyMeanAbsorptionEmissionCoeffs scatterModel none; +sootModel none; // ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties index 62b677bd775af3f7a73f4d4a4ab1676cdb3fe089..a25c81382a4d3837f18c4a1051eee255fa7aa4a5 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/radiationProperties @@ -15,6 +15,8 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +radiation on; + radiationModel fvDOM; fvDOMCoeffs @@ -187,5 +189,12 @@ greyMeanAbsorptionEmissionCoeffs scatterModel none; +sootModel mixtureFractionSoot<gasHThermoPhysics>; +mixtureFractionSootCoeffs +{ + //CH4 + 2O2 + 7.5N2 = CO2 + 2H2O + 7.5N2 + nuSoot soot + nuSoot 0.055; + Wsoot 12; +} // ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/radiationProperties b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/radiationProperties index 63e3de884c06d497ea1cfffd4d1bb240b77b8675..621656b060f4e7a1f530035407cc2352241fad41 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/radiationProperties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/radiationProperties @@ -16,6 +16,8 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +radiation on; + radiationModel fvDOM; fvDOMCoeffs @@ -188,5 +190,6 @@ greyMeanAbsorptionEmissionCoeffs scatterModel none; +sootModel none; // ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/U similarity index 100% rename from tutorials/incompressible/pimpleFoam/TJunctionFan/0/U rename to tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/U diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/epsilon similarity index 100% rename from tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon rename to tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/epsilon diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/k similarity index 100% rename from tutorials/incompressible/pimpleFoam/TJunctionFan/0/k rename to tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/k diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nuTilda similarity index 100% rename from tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda rename to tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nuTilda diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nut similarity index 100% rename from tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut rename to tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/nut diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p b/tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/p similarity index 100% rename from tutorials/incompressible/pimpleFoam/TJunctionFan/0/p rename to tutorials/incompressible/pimpleFoam/TJunctionFan/0.org/p diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index 553c603b445da3b5b018fb13da13561d256fb82c..3bde7dac61d5b3752317aff2ffda4aab2148de96 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -23,7 +23,7 @@ libs application simpleFoam; -startFrom latestTime; +startFrom startTime; // latestTime; startTime 0; diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs index 1d62bff73acde8efe3df7bf8ef5b448bfd7aa775..e308215f26466bed8e3535cb1a03012332e8ea09 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs +++ b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs @@ -8,7 +8,8 @@ forceCoeffs1 { - type forceCoeffs; +// type forceCoeffs; + type forces; functionObjectLibs ( "libforces.so" ); diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T index d5d567628e4dca3872118a365434ec53b2040838..fcf963a775b0fe6baa6f1e1be87fa9f52ba82eda 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/T @@ -36,7 +36,6 @@ boundaryField type inletOutlet; inletValue uniform 293; value uniform 293; - } frontAndBack { diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U index 27773aea2ba6ac27ecb85fe3073258a65ab2d641..c235ba3d6599d2ee0addf202f46971a86b27b928 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/U @@ -33,7 +33,8 @@ boundaryField } outlet { - type zeroGradient; + type pressureInletOutletVelocity; + value $internalField; } frontAndBack { diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon deleted file mode 100644 index ad65f7ea0f6c17466d257766119788312e8f6a5f..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/epsilon +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object epsilon; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -3 0 0 0 0]; - -internalField uniform 50; - -boundaryField -{ - fuel - { - type fixedValue; - value uniform 1e-05; - } - air - { - type fixedValue; - value uniform 1e-05; - } - outlet - { - type zeroGradient; - } - frontAndBack - { - type empty; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k deleted file mode 100644 index 3dcedaa2da47fbd55ebfcc30f215485dddfb92e8..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/k +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - location "0"; - object k; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 2 -2 0 0 0 0]; - -internalField uniform 3.75e-05; - -boundaryField -{ - fuel - { - type fixedValue; - value uniform 3.75e-05; - } - air - { - type fixedValue; - value uniform 3.75e-05; - } - outlet - { - type zeroGradient; - } - frontAndBack - { - type empty; - } -} - - -// ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p index 79f071ce3199a02c4b0b5f870d332ada0a20d176..deca9ba60da613c61097d7624095469169b50c65 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/p @@ -29,14 +29,16 @@ boundaryField { type zeroGradient; } - inlet2 - { - type zeroGradient; - } outlet { - type fixedValue; - value uniform 1e5; + type totalPressure; + p0 $internalField; + U U; + phi phi; + rho none; + psi none; + gamma 1; + value $internalField; } frontAndBack { diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties index 254f5c4633feb01db174a541335e5abd8c2081d6..ebdde7591fc531e3f5cf5ba5c6e17ddb9d8e0222 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/chemistryProperties @@ -17,14 +17,25 @@ FoamFile chemistryType { - chemistrySolver noChemistrySolver; + chemistrySolver EulerImplicit; chemistryThermo rho; } -chemistry on; // off; +chemistry on; -chemCalcFreq 1; +initialChemicalTimeStep 1e-07; -initialChemicalTimeStep 1e-8; // NOT USED +EulerImplicitCoeffs +{ + cTauChem 1; + equilibriumRateLimiter off; +} + +odeCoeffs +{ + solver Rosenbrock43; + absTol 1e-12; + relTol 0.01; +} // ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties index 06715e90f130e731177456d752518e478a2bba3f..bad68a398bcfadb26848b2b472007fe75282b05f 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/combustionProperties @@ -15,15 +15,12 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -combustionModel PaSR<rhoChemistryCombustion>; +combustionModel laminar<rhoChemistryCombustion>; active true; -PaSRCoeffs +laminarCoeffs { - Cmix 0.1; - turbulentReaction off; - useReactionRate true; } diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/alphat b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/polyMesh/boundary similarity index 66% rename from tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/alphat rename to tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/polyMesh/boundary index c74018bbdb33b027d8c9098fc95a61eae2024749..4ba324347484fa7620b2ac2ca118f030cf3166de 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/0/alphat +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/polyMesh/boundary @@ -9,37 +9,39 @@ FoamFile { version 2.0; format ascii; - class volScalarField; - location "0"; - object alphat; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [1 -1 -1 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ +4 +( fuel { - type fixedValue; - value uniform 0; + type patch; + nFaces 40; + startFace 7860; } air { - type fixedValue; - value uniform 0; + type patch; + nFaces 40; + startFace 7900; } outlet { - type zeroGradient; + type patch; + nFaces 200; + startFace 7940; } frontAndBack { type empty; + inGroups 1(empty); + nFaces 8000; + startFace 8140; } -} - +) // ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties index 3721a46a2ead37eb2bf10434bcde59afa9fe9bf6..c2c3b28a1b4e8f4a2cae55f58bd61f9b1a67b488 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/constant/turbulenceProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -simulationType RASModel; +simulationType laminar; // ************************************************************************* // diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict index bb20dffbf262c02f9c2374b28b124518d11febf4..e27ca2653940c29e788fa8d0c3b2e2fee3937ed7 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/controlDict @@ -23,7 +23,7 @@ startTime 0; stopAt endTime; -endTime 10000; +endTime 2000; deltaT 1; diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution index 552f948a844205db393491f2cf331815fc4966c0..cf6feec2474c1a241bdbd918edaa1421dc75462e 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution +++ b/tutorials/lagrangian/LTSReactingParcelFoam/counterFlowFlame2D/system/fvSolution @@ -17,79 +17,69 @@ FoamFile solvers { - rho + "rho.*" { - solver PCG; - preconditioner DIC; - tolerance 0; - relTol 0.1; - } - - rhoFinal - { - solver PCG; - preconditioner DIC; - tolerance 1e-4; - relTol 0; + solver diagonal; } p { - solver GAMG; - - tolerance 0; - relTol 0.05; - - smoother DICGaussSeidel; - nPreSweeps 0; - nPostSweeps 2; - - cacheAgglomeration true; - - nCellsInCoarsestLevel 10; - agglomerator faceAreaPair; - mergeLevels 1; - - maxIter 50; - }; + solver PCG; + preconditioner DIC; + tolerance 1e-6; + relTol 0.1; + } pFinal { $p; - - tolerance 1e-4; relTol 0; - }; + } - "(U|Yi|h|k|epsilon)" + "(U|h|k|epsilon)" { - solver smoothSolver; - smoother GaussSeidel; - tolerance 0; + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; relTol 0.1; } - "(U|Yi|h|k|epsilon)Final" + "(U|h|k|epsilon)Final" { - solver smoothSolver; - smoother GaussSeidel; - tolerance 1e-4; - relTol 0; + $U; + relTol 0.1; + } + + Yi + { + $U; + relTol 0.1; } } PIMPLE { - nCorrectors 2; + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 1; nNonOrthogonalCorrectors 0; - momentumPredictor yes; - rhoMin 0.1; - rhoMax 1.5; - maxCo 0.1; - rDeltaTSmoothingCoeff 0.1; - maxDeltaT 2e-4; - alphaTemp 0.005; + maxDeltaT 1e-2; + maxCo 1; + alphaTemp 0.05; + rDeltaTSmoothingCoeff 1; + rDeltaTDampingCoeff 1; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } } diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties index ff1c96ea9660b955dffc025eda37ee04bd8ef0ba..9dcb7f347ee5df48da365cbc056049c5a47f77e0 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/chemistryProperties @@ -17,25 +17,12 @@ FoamFile chemistryType { - chemistrySolver ode; + chemistrySolver noChemistrySolver; chemistryThermo rho; } chemistry off; -initialChemicalTimeStep 1e-07; - -EulerImplicitCoeffs -{ - cTauChem 0.05; - equilibriumRateLimiter off; -} - -odeCoeffs -{ - solver RK; - eps 0.05; -} - +initialChemicalTimeStep 1e-7; // ************************************************************************* // diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/U b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/U index 26f3881965f10cb8294ac6dc22c5eaf114ac420e..92d3cfd744cc45ea733384c41fdc96497f965257 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/U +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/U @@ -15,21 +15,26 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Umean 1; + dimensions [0 1 -1 0 0 0 0]; -internalField uniform (1 0 0); +internalField uniform ($Umean 0 0); boundaryField { inlet { type fixedValue; - value uniform (1 0 0); + value $internalField; } outlet { - type zeroGradient; + type outletPhaseMeanVelocity; + alpha alpha.water; + Umean $Umean; + value $internalField; } sides @@ -40,6 +45,7 @@ boundaryField atmosphere { type pressureInletOutletVelocity; + tangentialVelocity $internalField; value uniform (0 0 0); } diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/alpha.water.org b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/alpha.water.org index 7fdeb46dc3b1afc98eec478ea9b304cdf61ed2c0..dbef449a2f88da06ed726668d4636417ca2131cc 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/alpha.water.org +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/alpha.water.org @@ -23,8 +23,8 @@ boundaryField { inlet { - type calculated; - value uniform 0; + type fixedValue; + value $internalField; } outlet @@ -41,7 +41,7 @@ boundaryField { type inletOutlet; inletValue uniform 0; - value uniform 0; + value $internalField; } hull_wall diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/k b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/k index abf36b9773ee26dd199d123ca7698bd65a200f6d..9f4d8df1c01a973102a7e5c645e39c382962deaa 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/k +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/k @@ -24,7 +24,7 @@ boundaryField inlet { type fixedValue; - value uniform 0.00015; + value $internalField; } outlet @@ -40,14 +40,14 @@ boundaryField atmosphere { type inletOutlet; - inletValue uniform 0.00015; - value uniform 0.00015; + inletValue $internalField; + value $internalField; } hull_wall { type kqRWallFunction; - value uniform 0.00015; + value $internalField; } } diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/nut b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/nut index 3d1b5371d4c1a8e3a262510d39ab5a05e2d77b40..5106e2b1029e657da831443c0dc3ee9d5e52fa96 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/nut +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/nut @@ -24,7 +24,7 @@ boundaryField inlet { type fixedValue; - value uniform 5e-07; + value $internalField; } outlet @@ -45,7 +45,7 @@ boundaryField hull_wall { type nutkWallFunction; - value uniform 0; + value $internalField; } } diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/omega b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/omega index 1cbf751ba7c54940e49a438586c21bac623f1be6..885912311ac33b4f148d9a7f7031996b734b38ba 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/omega +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/omega @@ -23,14 +23,14 @@ boundaryField inlet { type fixedValue; - value uniform 2; + value $internalField; } outlet { type inletOutlet; - inletValue uniform 2; - value uniform 2; + inletValue $internalField; + value $internalField; } outlet @@ -46,14 +46,14 @@ boundaryField atmosphere { type inletOutlet; - inletValue uniform 2; - value uniform 2; + inletValue $internalField; + value $internalField; } hull_wall { type omegaWallFunction; - value uniform 2; + value $internalField; } } diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/p_rgh b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/p_rgh index 2b4915fe5c6ec12273419990fe4a76274d4eeb1f..835531655703ace8fb4f92cbec548c0a569f1ad9 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/0/p_rgh +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/0/p_rgh @@ -23,7 +23,7 @@ boundaryField inlet { type fixedFluxPressure; - value uniform 0; + value $internalField; } outlet @@ -45,13 +45,13 @@ boundaryField rho rho; psi none; gamma 1; - value uniform 0; + value $internalField; } hull_wall { type fixedFluxPressure; - value uniform 0; + value $internalField; } } diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/controlDict b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/controlDict index 397c2f248eb84ee112e9fd0880fe917005eb7f35..d2aa8b3c7185c5b1c9ff6245523b3ba71635ab58 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/controlDict +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/controlDict @@ -23,7 +23,7 @@ startTime 0; stopAt endTime; -endTime 2000; +endTime 1000; deltaT 1; diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes index de873558162e1e1cea020af091244cba613e96e7..da652a662afb3be9d9b670368a7ec5dcc1028f90 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linearUpwind grad(U); + div(rhoPhi,U) Gauss linearUpwind grad(U); div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss upwind; diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSolution b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSolution index e59fb400df2ad2fc686c3780ad05551c936ae55c..df8102dc068ca4e4c3cfed864b0bae0b1a21062a 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSolution +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/fvSolution @@ -17,11 +17,21 @@ FoamFile solvers { - alpha.water + "alpha.water.*" { nAlphaCorr 1; nAlphaSubCycles 1; cAlpha 1; + icAlpha 0.25; + + MULESCorr yes; + nLimiterIter 8; + alphaApplyPrevCorr true; + + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-8; + relTol 0; } pcorr @@ -56,14 +66,14 @@ solvers nCellsInCoarsestLevel 10; cacheAgglomeration true; - tolerance 1e-6; + tolerance 1e-7; relTol 0.01; }; p_rghFinal { $p_rgh; - tolerance 1e-6; + tolerance 1e-7; relTol 0; } @@ -81,17 +91,18 @@ solvers PIMPLE { - momentumPredictor yes; + momentumPredictor no; nCorrectors 1; nNonOrthogonalCorrectors 0; - maxCo 0.9; - maxAlphaCo 0.2; - nAlphaSweepIter 1; + maxCo 5; + maxAlphaCo 5; - rDeltaTSmoothingCoeff 0.1; - rDeltaTDampingCoeff 1; + rDeltaTSmoothingCoeff 0.05; + rDeltaTDampingCoeff 0.5; + nAlphaSweepIter 0; + nAlphaSpreadIter 0; maxDeltaT 1; } @@ -102,6 +113,7 @@ relaxationFactors } equations { + ".*" 1; } } diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/setFieldsDict b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/setFieldsDict index 75a2dfccb82c5a9d720f80695f612f9a36f57515..18f4b921a8bfde4ac4e513f888304ef7c3679c64 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/setFieldsDict +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/setFieldsDict @@ -30,6 +30,17 @@ regions volScalarFieldValue alpha.water 1 ); } + + // Set patch values (using ==) + boxToFace + { + box (-100 -100 -100) (100 100 0); + + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } ); diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes index 26e06a656bd68191f6c494cdb2f9a44f7b785205..21e124394847328b4f362b046f54f30f72f3aef0 100644 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linear; + div(rhoPhi,U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss limitedLinear 1; diff --git a/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes b/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes index 8ed8e03cc081883369e850bae8f758e5823c4b5b..ca2cd3a2b805265796fce820c23d6767c492a1cf 100644 --- a/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes +++ b/tutorials/multiphase/interFoam/ras/damBreak/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linear; + div(rhoPhi,U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss upwind; diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes index 8ed8e03cc081883369e850bae8f758e5823c4b5b..ca2cd3a2b805265796fce820c23d6767c492a1cf 100644 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/fvSchemes @@ -27,7 +27,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss linear; + div(rhoPhi,U) Gauss linear; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div(phi,k) Gauss upwind; diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes index e1436932da80a557362978007f606cf262f31dd5..48eb9c4f9810f2fa95d1badcb54693f2e534710f 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phase/system/fvSchemes @@ -29,7 +29,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss upwind; + div(rhoPhi,U) Gauss upwind; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div((muEff*dev(T(grad(U))))) Gauss linear; diff --git a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes index e1436932da80a557362978007f606cf262f31dd5..48eb9c4f9810f2fa95d1badcb54693f2e534710f 100644 --- a/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes +++ b/tutorials/multiphase/multiphaseInterFoam/laminar/damBreak4phaseFine/system/fvSchemes @@ -29,7 +29,7 @@ gradSchemes divSchemes { - div(rho*phi,U) Gauss upwind; + div(rhoPhi,U) Gauss upwind; div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; div((muEff*dev(T(grad(U))))) Gauss linear; diff --git a/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties index 591ebc005ac39ad60b1c023764ac7d66914caaf1..a3bec3a5778874f03b2b236e3064f8e8dd1156e9 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/LES/bubbleColumn/constant/phaseProperties @@ -56,7 +56,7 @@ dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0.5; // Lift coefficient diff --git a/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties index 591ebc005ac39ad60b1c023764ac7d66914caaf1..a3bec3a5778874f03b2b236e3064f8e8dd1156e9 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/RAS/bubbleColumn/constant/phaseProperties @@ -56,7 +56,7 @@ dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0.5; // Lift coefficient diff --git a/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties index cb95638812c8df4060622783826d56924dcc110f..b5eb1e24eee49e4b66cb673a6065fd15d6ee3ae0 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/RAS/fluidisedBed/constant/phaseProperties @@ -55,7 +55,7 @@ dispersedPhase particles; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0; // Lift coefficient diff --git a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties index f867970c9afab3871b6b24bf0450c43f712df6d7..c31927d84d98018694a365bfe22eac8e5c4e75ca 100644 --- a/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties +++ b/tutorials/multiphase/twoPhaseEulerFoam/laminar/mixerVessel2D/constant/phaseProperties @@ -56,7 +56,7 @@ dispersedPhase both; residualPhaseFraction 1e-3; residualSlip 1e-2; -// Virtual-mass ceofficient +// Virtual-mass coefficient Cvm 0.5; // Lift coefficient