diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H index 5460944288..fd79c8400e 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H @@ -34,12 +34,7 @@ { pZones.addResistance(UEqn()); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ). initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn() == -fvc::grad(p)); trAU = 1.0/UEqn().A(); trAU().rename("rAU"); diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/convergenceCheck.H b/applications/solvers/compressible/rhoPorousSimpleFoam/convergenceCheck.H deleted file mode 100644 index 8958063193..0000000000 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H index f33843b48f..9e5138de8a 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/hEqn.H @@ -13,8 +13,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); } diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/initConvergenceCheck.H b/applications/solvers/compressible/rhoPorousSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22a..0000000000 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H index 4d8e010f7e..40b7cb3969 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/pEqn.H @@ -29,8 +29,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) // retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = tpEqn().solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + tpEqn().solve(); } else { diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index a575509b57..bab9d323bb 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); rho.storePrevIter(); @@ -72,8 +71,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H index 401e1203d2..21ec2646be 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H @@ -8,9 +8,4 @@ UEqn().relax(); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn() == -fvc::grad(p)); diff --git a/applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H b/applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H deleted file mode 100644 index 8958063193..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/compressible/rhoSimpleFoam/hEqn.H b/applications/solvers/compressible/rhoSimpleFoam/hEqn.H index 57395e977e..e6c74938ee 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/hEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/hEqn.H @@ -11,8 +11,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H b/applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22a..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 329ebbd27f..f43ec6cf62 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -33,8 +33,7 @@ if (transonic) // Retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { @@ -64,8 +63,7 @@ else // Retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index 63c59fd1aa..96eef63121 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -53,7 +53,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); rho.storePrevIter(); @@ -72,8 +71,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/compressible/rhoSimplecFoam/UEqn.H b/applications/solvers/compressible/rhoSimplecFoam/UEqn.H index 401e1203d2..21ec2646be 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimplecFoam/UEqn.H @@ -8,9 +8,4 @@ UEqn().relax(); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn() == -fvc::grad(p)); diff --git a/applications/solvers/compressible/rhoSimplecFoam/hEqn.H b/applications/solvers/compressible/rhoSimplecFoam/hEqn.H index 8ac1c9f510..bec9ed3ae0 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/hEqn.H +++ b/applications/solvers/compressible/rhoSimplecFoam/hEqn.H @@ -11,8 +11,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); diff --git a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H index cd3ae5ff1f..a0f17e78bc 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimplecFoam/pEqn.H @@ -41,8 +41,7 @@ if (transonic) // Retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { @@ -75,8 +74,7 @@ else // Retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { diff --git a/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C b/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C index e87091db81..dd05bf88aa 100644 --- a/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C +++ b/applications/solvers/compressible/rhoSimplecFoam/rhoSimplecFoam.C @@ -55,7 +55,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); @@ -78,8 +77,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H index 7452a0495a..3bdeea0452 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/TEqn.H @@ -14,8 +14,7 @@ TEqn.relax(); - eqnResidual = TEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + TEqn.solve(); rhok = 1.0 - beta*(T - TRef); } diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H index bcf99e1668..292f44b4bd 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/UEqn.H @@ -8,7 +8,7 @@ UEqn().relax(); - eqnResidual = solve + solve ( UEqn() == @@ -19,6 +19,4 @@ - fvc::snGrad(p)*mesh.magSf() ) ) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + ); diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C index 5ed588edde..f10d18c512 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/buoyantBoussinesqSimpleFoam.C @@ -69,7 +69,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); @@ -87,8 +86,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H deleted file mode 100644 index 8958063193..0000000000 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22a..0000000000 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H index 6408c7ccc8..9b23330944 100644 --- a/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantBoussinesqSimpleFoam/pEqn.H @@ -24,8 +24,7 @@ // retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H index 0170d6e384..5609883607 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H @@ -8,7 +8,7 @@ UEqn().relax(); - eqnResidual = solve + solve ( UEqn() == @@ -17,6 +17,4 @@ fvc::interpolate(rho)*(g & mesh.Sf()) - fvc::snGrad(p)*mesh.magSf() ) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + ); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index c3a27c13c2..dd33d3ec07 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); rho.storePrevIter(); @@ -73,8 +72,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H deleted file mode 100644 index 8958063193..0000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H index 0c507ce3d1..b91a17ee7c 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H @@ -11,8 +11,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H deleted file mode 100644 index c920b6708d..0000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ - // initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index 11768ea2f6..b0aa0852b2 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -26,8 +26,7 @@ // retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C index f3cd688add..7e6d74b98d 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C @@ -57,7 +57,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); rho.storePrevIter(); @@ -76,8 +75,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H index 24b17645d2..57de44e4a0 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H @@ -12,8 +12,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 7474f7d1c7..927bd8124d 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -64,9 +64,7 @@ int main(int argc, char *argv[]) << fluidRegions[i].name() << endl; #include "setRegionFluidFields.H" #include "readFluidMultiRegionSIMPLEControls.H" - #include "initConvergenceCheck.H" #include "solveFluid.H" - #include "convergenceCheck.H" } forAll(solidRegions, i) @@ -75,9 +73,7 @@ int main(int argc, char *argv[]) << solidRegions[i].name() << endl; #include "setRegionSolidFields.H" #include "readSolidMultiRegionSIMPLEControls.H" - #include "initConvergenceCheck.H" #include "solveSolid.H" - #include "convergenceCheck.H" } runTime.write(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H index 7f317cc2e6..d5ae07ff9b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/UEqn.H @@ -7,7 +7,7 @@ UEqn().relax(); - eqnResidual = solve + solve ( UEqn() == @@ -16,6 +16,4 @@ fvc::interpolate(rho)*(g & mesh.Sf()) - fvc::snGrad(p)*mesh.magSf() ) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/convergenceCheck.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/convergenceCheck.H deleted file mode 100644 index 53c00386ff..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/convergenceCheck.H +++ /dev/null @@ -1,12 +0,0 @@ -// check convergence -Info<< "maxResidual: " << maxResidual - << " convergence criterion: " << convergenceCriterion - << endl; - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/hEqn.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/hEqn.H index ccd6615990..cef0122928 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/hEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/hEqn.H @@ -11,8 +11,7 @@ hEqn.relax(); - eqnResidual = hEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + hEqn.solve(); thermo.correct(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/initConvergenceCheck.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/initConvergenceCheck.H deleted file mode 100644 index c920b6708d..0000000000 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ - // initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/pEqn.H index 6b6fe6ef5d..9462dc2c39 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/fluid/pEqn.H @@ -29,8 +29,7 @@ // retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { diff --git a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/solid/solveSolid.H index 7cf2cc1409..4e2a2c7b19 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam/solid/solveSolid.H @@ -6,9 +6,7 @@ -fvm::laplacian(K, T) ); tEqn.relax(); - eqnResidual = tEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); - + tEqn.solve(); } Info<< "Min/max T:" << min(T).value() << ' ' diff --git a/applications/solvers/incompressible/porousSimpleFoam/UEqn.H b/applications/solvers/incompressible/porousSimpleFoam/UEqn.H index 688120809a..9cbcd61291 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/porousSimpleFoam/UEqn.H @@ -34,12 +34,7 @@ { pZones.addResistance(UEqn()); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ). initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn() == -fvc::grad(p)); trAU = 1.0/UEqn().A(); trAU().rename("rAU"); diff --git a/applications/solvers/incompressible/porousSimpleFoam/pEqn.H b/applications/solvers/incompressible/porousSimpleFoam/pEqn.H index e6797cd860..a97ff3983c 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/porousSimpleFoam/pEqn.H @@ -28,8 +28,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) // retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = tpEqn().solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + tpEqn().solve(); } else { diff --git a/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C index 7316b98d2a..0c4701d01b 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/porousSimpleFoam/porousSimpleFoam.C @@ -54,7 +54,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); @@ -71,8 +70,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/solvers/incompressible/simpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/UEqn.H index eb40b7665b..e6fb6bf89e 100644 --- a/applications/solvers/incompressible/simpleFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/UEqn.H @@ -8,9 +8,4 @@ UEqn().relax(); - eqnResidual = solve - ( - UEqn() == -fvc::grad(p) - ).initialResidual(); - - maxResidual = max(eqnResidual, maxResidual); + solve(UEqn() == -fvc::grad(p)); diff --git a/applications/solvers/incompressible/simpleFoam/convergenceCheck.H b/applications/solvers/incompressible/simpleFoam/convergenceCheck.H deleted file mode 100644 index 8958063193..0000000000 --- a/applications/solvers/incompressible/simpleFoam/convergenceCheck.H +++ /dev/null @@ -1,9 +0,0 @@ -// check convergence - -if (maxResidual < convergenceCriterion) -{ - Info<< "reached convergence criterion: " << convergenceCriterion << endl; - runTime.writeAndEnd(); - Info<< "latestTime = " << runTime.timeName() << endl; -} - diff --git a/applications/solvers/incompressible/simpleFoam/initConvergenceCheck.H b/applications/solvers/incompressible/simpleFoam/initConvergenceCheck.H deleted file mode 100644 index b56197f22a..0000000000 --- a/applications/solvers/incompressible/simpleFoam/initConvergenceCheck.H +++ /dev/null @@ -1,7 +0,0 @@ -// initialize values for convergence checks - - scalar eqnResidual = 1, maxResidual = 0; - scalar convergenceCriterion = 0; - - simple.readIfPresent("convergence", convergenceCriterion); - diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 207c514d44..91f4e1a140 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -18,8 +18,7 @@ // retain the residual from the first iteration if (nonOrth == 0) { - eqnResidual = pEqn.solve().initialResidual(); - maxResidual = max(eqnResidual, maxResidual); + pEqn.solve(); } else { diff --git a/applications/solvers/incompressible/simpleFoam/simpleFoam.C b/applications/solvers/incompressible/simpleFoam/simpleFoam.C index 4cc93af9c3..2c3abb4622 100644 --- a/applications/solvers/incompressible/simpleFoam/simpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/simpleFoam.C @@ -52,7 +52,6 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; #include "readSIMPLEControls.H" - #include "initConvergenceCheck.H" p.storePrevIter(); @@ -69,8 +68,6 @@ int main(int argc, char *argv[]) Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; - - #include "convergenceCheck.H" } Info<< "End\n" << endl; diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C index 3fede4ab66..8985861582 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C @@ -27,6 +27,7 @@ Global Description Execute the set of functionObjects specified in the selected dictionary (which defaults to system/controlDict) for the selected set of times. + Alternative dictionaries should be placed in the system/ folder. The flow (p-U) and optionally turbulence fields are available for the function objects to operate on allowing forces and other related properties @@ -144,12 +145,12 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) false ); - singlePhaseTransportModel laminarTransport(U, phi); - if (RASPropertiesHeader.headerOk()) { IOdictionary RASProperties(RASPropertiesHeader); + singlePhaseTransportModel laminarTransport(U, phi); + autoPtr RASModel ( incompressible::RASModel::New @@ -165,6 +166,8 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { IOdictionary LESProperties(LESPropertiesHeader); + singlePhaseTransportModel laminarTransport(U, phi); + autoPtr sgsModel ( incompressible::LESModel::New(U, phi, laminarTransport) diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index c69f609c39..e892508a92 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -60,7 +60,7 @@ fields // midPoint one point per cell, inbetween two face intersections // midPointAndFace combination of face and midPoint // -// curve specified points, not nessecary on line, uses +// polyLine specified points, not nessecary on line, uses // tracking // cloud specified points, uses findCell // triSurfaceMeshPointSet points of triSurface @@ -75,7 +75,7 @@ fields // type specific: // uniform, face, midPoint, midPointAndFace : start and end coordinate // uniform: extra number of sampling points -// curve, cloud: list of coordinates +// polyLine, cloud: list of coordinates sets ( lineX1 diff --git a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H index d0eb49303e..b4e35c43a0 100644 --- a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H +++ b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H @@ -107,7 +107,7 @@ public: return IOdictionary::name(); } - //- Read the probes + //- Read output filter properties virtual bool read(); //- Sample and write diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 4fa7404da5..8f4baa22b8 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -51,7 +51,7 @@ namespace Foam class Time; /*---------------------------------------------------------------------------*\ - Class functionObject Declaration + Class functionObject Declaration \*---------------------------------------------------------------------------*/ class functionObject diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 0dee351858..b96925a91b 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -102,6 +102,7 @@ public: // Constructors + //- Construct null solverPerformance() : initialResidual_(0), @@ -111,7 +112,7 @@ public: singular_(false) {} - + //- Construct from components solverPerformance ( const word& solverName, @@ -132,6 +133,9 @@ public: singular_(singular) {} + //- Construct from Istream + solverPerformance(Istream&); + // Member functions @@ -204,6 +208,11 @@ public: //- Print summary of solver performance void print() const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream&, const solverPerformance&); }; diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C index f625970e7c..c1fafc95ec 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixTests.C @@ -30,6 +30,20 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::lduMatrix::solverPerformance::solverPerformance(Istream& is) +{ + is.readBeginList("lduMatrix::solverPerformance"); + is >> solverName_ + >> fieldName_ + >> initialResidual_ + >> finalResidual_ + >> noIterations_ + >> converged_ + >> singular_; + is.readEndList("lduMatrix::solverPerformance"); +} + + bool Foam::lduMatrix::solverPerformance::checkConvergence ( const scalar Tolerance, @@ -104,4 +118,23 @@ void Foam::lduMatrix::solverPerformance::print() const } +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const Foam::lduMatrix::solverPerformance& sp +) +{ + os << token::BEGIN_LIST + << sp.solverName_ << token::SPACE + << sp.fieldName_ << token::SPACE + << sp.initialResidual_ << token::SPACE + << sp.finalResidual_ << token::SPACE + << sp.noIterations_ << token::SPACE + << sp.converged_ << token::SPACE + << sp.singular_ << token::SPACE + << token::END_LIST; + + return os; +} + // ************************************************************************* // diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 9101558af3..fecd16bd4e 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -262,6 +262,7 @@ $(multivariateSchemes)/limitedCubic/multivariateLimitedCubic.C finiteVolume/fv/fv.C finiteVolume/fvSchemes/fvSchemes.C +finiteVolume/fvData/fvData.C ddtSchemes = finiteVolume/ddtSchemes $(ddtSchemes)/ddtScheme/ddtSchemes.C diff --git a/src/finiteVolume/finiteVolume/fvData/fvData.C b/src/finiteVolume/finiteVolume/fvData/fvData.C new file mode 100644 index 0000000000..e662c3d394 --- /dev/null +++ b/src/finiteVolume/finiteVolume/fvData/fvData.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fvData.H" +#include "Time.H" +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +int Foam::fvData::debug(Foam::debug::debugSwitch("fvData", false)); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fvData::fvData(const objectRegistry& obr) +: + IOdictionary + ( + IOobject + ( + "fvData", + obr.time().system(), + obr, + IOobject::NO_READ, + IOobject::NO_WRITE + ) + ) +{ + set("solverPerformance", dictionary()); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::dictionary& Foam::fvData::solverPerformanceDict() const +{ + return subDict("solverPerformance"); +} + + +void Foam::fvData::setSolverPerformance +( + const word& name, + const lduMatrix::solverPerformance& sp +) const +{ + const_cast(solverPerformanceDict()).set(name, sp); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/fvData/fvData.H b/src/finiteVolume/finiteVolume/fvData/fvData.H new file mode 100644 index 0000000000..ab6c27e33b --- /dev/null +++ b/src/finiteVolume/finiteVolume/fvData/fvData.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fvData + +Description + Database for finite volume solution data, solver performance and + other reduced data. fvMesh is derived from fvData so that all fields have + access to the fvData from the mesh reference they hold. + +SourceFiles + fvData.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvData_H +#define fvData_H + +#include "IOdictionary.H" +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fvData Declaration +\*---------------------------------------------------------------------------*/ + +class fvData +: + public IOdictionary +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + fvData(const fvData&); + + //- Disallow default bitwise assignment + void operator=(const fvData&); + + +public: + + //- Debug switch + static int debug; + + + // Constructors + + //- Construct for objectRegistry + fvData(const objectRegistry& obr); + + + // Member Functions + + // Access + + //- Return the dictionary of solver performance data + // which includes initial and final residuals for convergence + // checking + const dictionary& solverPerformanceDict() const; + + //- Add/set the solverPerformance entry for the named field + void setSolverPerformance + ( + const word& name, + const lduMatrix::solverPerformance& + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C index d5112e6461..aa3fe8dd3f 100644 --- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C +++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C @@ -164,6 +164,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve psi.correctBoundaryConditions(); + psi.mesh().setSolverPerformance(psi.name(), solverPerfVec); + return solverPerfVec; } @@ -175,6 +177,7 @@ Foam::fvMatrix::solver() return solver(psi_.mesh().solverDict(psi_.name())); } + template Foam::lduMatrix::solverPerformance Foam::fvMatrix::fvSolver::solve() { diff --git a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C index fc40b11bca..e1a7ba578b 100644 --- a/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C +++ b/src/finiteVolume/fvMatrices/fvScalarMatrix/fvScalarMatrix.C @@ -123,6 +123,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::fvSolver::solve psi.correctBoundaryConditions(); + psi.mesh().setSolverPerformance(psi.name(), solverPerf); + return solverPerf; } @@ -166,6 +168,8 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix::solve psi.correctBoundaryConditions(); + psi.mesh().setSolverPerformance(psi.name(), solverPerf); + return solverPerf; } diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index b346e6f3dc..f821234b64 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -151,6 +151,9 @@ Foam::fvMesh::fvMesh(const IOobject& io) : polyMesh(io), surfaceInterpolation(*this), + fvSchemes(static_cast(*this)), + fvSolution(static_cast(*this)), + fvData(static_cast(*this)), boundary_(*this, boundaryMesh()), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), @@ -243,6 +246,9 @@ Foam::fvMesh::fvMesh : polyMesh(io, points, faces, allOwner, allNeighbour, syncPar), surfaceInterpolation(*this), + fvSchemes(static_cast(*this)), + fvSolution(static_cast(*this)), + fvData(static_cast(*this)), boundary_(*this), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), @@ -273,6 +279,9 @@ Foam::fvMesh::fvMesh : polyMesh(io, points, faces, cells, syncPar), surfaceInterpolation(*this), + fvSchemes(static_cast(*this)), + fvSolution(static_cast(*this)), + fvData(static_cast(*this)), boundary_(*this), lduPtr_(NULL), curTimeIndex_(time().timeIndex()), diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index db5ec3396d..772c30cf9a 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -52,6 +52,9 @@ SourceFiles #include "primitiveMesh.H" #include "fvBoundaryMesh.H" #include "surfaceInterpolation.H" +#include "fvSchemes.H" +#include "fvSolution.H" +#include "fvData.H" #include "DimensionedField.H" #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" @@ -77,7 +80,10 @@ class fvMesh : public polyMesh, public lduMesh, - public surfaceInterpolation + public surfaceInterpolation, + public fvSchemes, + public fvSolution, + public fvData { // Private data diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index 55721c99b7..b434dd752d 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -57,8 +57,6 @@ void surfaceInterpolation::clearOut() surfaceInterpolation::surfaceInterpolation(const fvMesh& fvm) : - fvSchemes(static_cast(fvm)), - fvSolution(static_cast(fvm)), mesh_(fvm), weightingFactors_(NULL), differenceFactors_(NULL), diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H index 778e6d4169..d3380c1c1c 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.H @@ -37,8 +37,6 @@ SourceFiles #include "tmp.H" #include "scalar.H" -#include "fvSchemes.H" -#include "fvSolution.H" #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "className.H" @@ -53,9 +51,6 @@ namespace Foam \*---------------------------------------------------------------------------*/ class surfaceInterpolation -: - public fvSchemes, - public fvSolution { // Private data diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index 94f974bbb9..cb665641cc 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -58,7 +58,7 @@ Foam::scalar Foam::ConeInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return volumeFlowRate_().integrate(time0, time1); + return flowRateProfile_().integrate(time0, time1); } else { @@ -85,11 +85,11 @@ Foam::ConeInjection::ConeInjection ( readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -147,7 +147,7 @@ Foam::ConeInjection::ConeInjection tanVec2_ = direction_^tanVec1_; // Set total volume to inject - this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); // Set/cache the injector cell this->findCellAtPosition(injectorCell_, position_); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H index 51d06468b3..6246f4cdc9 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H @@ -83,8 +83,8 @@ class ConeInjection //- Number of parcels to introduce per second [] const label parcelsPerSecond_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Parcel velocity magnitude relative to SOI [m/s] const autoPtr > Umag_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C index 9fcba4f671..1d3f49aaa5 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C @@ -40,7 +40,7 @@ Foam::label Foam::ConeInjectionMP::parcelsToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - const scalar targetVolume = volumeFlowRate_().integrate(0, time1); + const scalar targetVolume = flowRateProfile_().integrate(0, time1); const label targetParcels = parcelsPerInjector_*targetVolume/this->volumeTotal_; @@ -67,7 +67,7 @@ Foam::scalar Foam::ConeInjectionMP::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return volumeFlowRate_().integrate(time0, time1); + return flowRateProfile_().integrate(time0, time1); } else { @@ -116,11 +116,11 @@ Foam::ConeInjectionMP::ConeInjectionMP ( readScalar(this->coeffDict().lookup("parcelsPerInjector")) ), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -182,7 +182,7 @@ Foam::ConeInjectionMP::ConeInjectionMP } // Set total volume to inject - this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_().integrate(0.0, duration_); // Set/cache the injector cells forAll(positions_, i) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H index 10df71b090..5401deebee 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.H @@ -90,8 +90,8 @@ class ConeInjectionMP //- Number of parcels to introduce per injector const label parcelsPerInjector_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Parcel velocity magnitude relative to SOI [m/s] const autoPtr > Umag_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C index 0e8c548011..6c49b07fc8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.C @@ -56,7 +56,7 @@ Foam::scalar Foam::PatchInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return fraction_*volumeFlowRate_().integrate(time0, time1); + return fraction_*flowRateProfile_().integrate(time0, time1); } else { @@ -82,11 +82,11 @@ Foam::PatchInjection::PatchInjection readScalar(this->coeffDict().lookup("parcelsPerSecond")) ), U0_(this->coeffDict().lookup("U0")), - volumeFlowRate_ + flowRateProfile_ ( DataEntry::New ( - "volumeFlowRate", + "flowRateProfile", this->coeffDict() ) ), @@ -127,7 +127,7 @@ Foam::PatchInjection::PatchInjection fraction_ = scalar(patchSize)/totalPatchSize; // Set total volume/mass to inject - this->volumeTotal_ = fraction_*volumeFlowRate_().integrate(0.0, duration_); + this->volumeTotal_ = fraction_*flowRateProfile_().integrate(0.0, duration_); this->massTotal_ *= fraction_; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H index 4f11be7ce2..f8d5840ffe 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/PatchInjection.H @@ -79,8 +79,8 @@ class PatchInjection //- Initial parcel velocity [m/s] const vector U0_; - //- Volume flow rate of parcels to introduce relative to SOI [m^3/s] - const autoPtr > volumeFlowRate_; + //- Flow rate profile relative to SOI [] + const autoPtr > flowRateProfile_; //- Parcel size PDF model const autoPtr parcelPDF_; diff --git a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C index 166d74ae2a..91c24ecf28 100644 --- a/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C +++ b/src/meshTools/directMapped/directMappedPolyPatch/directMappedPatchBase.C @@ -637,7 +637,7 @@ Foam::directMappedPatchBase::directMappedPatchBase samplePatch_(samplePatch), uniformOffset_(true), offset_(offset), - offsets_(0), + offsets_(pp.size(), offset_), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), mapPtr_(NULL) {} @@ -670,7 +670,7 @@ Foam::directMappedPatchBase::directMappedPatchBase offsets_ ( uniformOffset_ - ? pointField(patch_.size(), offset_) + ? pointField(pp.size(), offset_) : dict.lookup("offsets") ), sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()), diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 6195b98a41..bfed281015 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C fieldValues/cellSource/cellSource.C fieldValues/cellSource/cellSourceFunctionObject.C +readFields/readFields.C +readFields/readFieldsFunctionObject.C + streamLine/streamLine.C streamLine/streamLineParticle.C streamLine/streamLineParticleCloud.C diff --git a/src/postProcessing/functionObjects/field/readFields/IOreadFields.H b/src/postProcessing/functionObjects/field/readFields/IOreadFields.H new file mode 100644 index 0000000000..b3bdfa521e --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/IOreadFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::IOreadFields + +Description + Instance of the generic IOOutputFilter for readFields. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOreadFields_H +#define IOreadFields_H + +#include "readFields.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter IOreadFields; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/postProcessingDict b/src/postProcessing/functionObjects/field/readFields/postProcessingDict new file mode 100644 index 0000000000..aa304a259f --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/postProcessingDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object postProcessingDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +functions +( + readFields1 + { + type readFields; + functionObjectLibs ("libfieldFunctionObjects.so"); + enabled true; + outputControl timeStep; + outputInterval 1; + fields + ( + interpolateU + ); + } + faceObj2 + { + type faceSource; + functionObjectLibs ("libfieldFunctionObjects.so"); + enabled true; + outputControl timeStep; + outputInterval 1; + log true; + valueOutput true; + source faceZone; + sourceName f0; + operation areaAverage; + fields + ( + interpolateU + ); + } +); + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.C b/src/postProcessing/functionObjects/field/readFields/readFields.C new file mode 100644 index 0000000000..17b46f1a52 --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFields.C @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "readFields.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(readFields, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::readFields::readFields +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldSet_() +{ + // Check if the available mesh is an fvMesh otherise deactivate + if (!isA(obr_)) + { + active_ = false; + WarningIn + ( + "readFields::readFields" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::readFields::~readFields() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::readFields::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fields") >> fieldSet_; + } +} + + +void Foam::readFields::execute() +{ + Info<< type() << " " << name_ << ":" << nl; + forAll(fieldSet_, fieldI) + { + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + setField(fieldSet_[fieldI]); + } +} + + +void Foam::readFields::end() +{ + // Do nothing +} + + +void Foam::readFields::write() +{ + // Do nothing +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.H b/src/postProcessing/functionObjects/field/readFields/readFields.H new file mode 100644 index 0000000000..52ee6a47ae --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFields.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::readFields + +Description + Reads fields from the time folders and adds them to the mesh database + for further post-processing. + +SourceFiles + readFields.C + IOreadFields.H + +\*---------------------------------------------------------------------------*/ + +#ifndef readFields_H +#define readFields_H + +#include "OFstream.H" +#include "pointFieldFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class readFields Declaration +\*---------------------------------------------------------------------------*/ + +class readFields +{ +protected: + + // Protected data + + //- Name of this set of readFields object + word name_; + + const objectRegistry& obr_; + + //- on/off switch + bool active_; + + //- Fields to assess min/max + wordList fieldSet_; + + + // Protected Member Functions + + //- Disallow default bitwise copy construct + readFields(const readFields&); + + //- Disallow default bitwise assignment + void operator=(const readFields&); + + template + void setField(const word& fieldName); + + +public: + + //- Runtime type information + TypeName("readFields"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + readFields + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~readFields(); + + + // Member Functions + + //- Return name of the readFields object + virtual const word& name() const + { + return name_; + } + + //- Read the field min/max data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const pointField&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "readFieldsTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.C b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.C new file mode 100644 index 0000000000..970dfe24c2 --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "readFieldsFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(readFieldsFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + readFieldsFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.H b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.H new file mode 100644 index 0000000000..9ddca2a65d --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFieldsFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Typedef + Foam::readFieldsFunctionObject + +Description + FunctionObject wrapper around readFields to allow them to be created via + the functions entry within controlDict. + +SourceFiles + readFieldsFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef readFieldsFunctionObject_H +#define readFieldsFunctionObject_H + +#include "readFields.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject + readFieldsFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C b/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C new file mode 100644 index 0000000000..f78859d769 --- /dev/null +++ b/src/postProcessing/functionObjects/field/readFields/readFieldsTemplates.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "readFields.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void Foam::readFields::setField(const word& fieldName) +{ + typedef GeometricField vfType; + typedef GeometricField sfType; + + if (obr_.foundObject(fieldName)) + { + if (debug) + { + Info<< "Field " << fieldName << " already in database" << endl; + } + + vfType& vf = const_cast(obr_.lookupObject(fieldName)); + vf.checkOut(); + } + if (obr_.foundObject(fieldName)) + { + if (debug) + { + Info<< "Field " << fieldName << " already in database" << endl; + } + + sfType& sf = const_cast(obr_.lookupObject(fieldName)); + sf.checkOut(); + } + + const fvMesh& mesh = refCast(obr_); + + IOobject fieldHeader + ( + fieldName, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if + ( + fieldHeader.headerOk() + && fieldHeader.headerClassName() == vfType::typeName + ) + { + // store field on the mesh database + Info<< " Reading " << fieldName << endl; + obr_.store(new vfType(fieldHeader, mesh)); + } + else if + ( + fieldHeader.headerOk() + && fieldHeader.headerClassName() == sfType::typeName + ) + { + // store field on the mesh database + Info<< " Reading " << fieldName << endl; + obr_.store(new sfType(fieldHeader, mesh)); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/postCalc/postCalc.C b/src/postProcessing/postCalc/postCalc.C index 5612287353..32fe0f2269 100644 --- a/src/postProcessing/postCalc/postCalc.C +++ b/src/postProcessing/postCalc/postCalc.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,10 +68,10 @@ int main(int argc, char *argv[]) "dictionary name" ); -# include "setRootCase.H" -# include "createTime.H" + #include "setRootCase.H" + #include "createTime.H" Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); -# include "createMesh.H" + #include "createMesh.H" forAll(timeDirs, timeI) { diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 2c7920d29e..c385e9aa93 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -4,7 +4,7 @@ probes/probesFunctionObject/probesFunctionObject.C sampledSet/cloud/cloudSet.C sampledSet/coordSet/coordSet.C -sampledSet/curve/curveSet.C +sampledSet/polyLine/polyLineSet.C sampledSet/face/faceOnlySet.C sampledSet/midPoint/midPointSet.C sampledSet/midPointAndFace/midPointAndFaceSet.C diff --git a/src/sampling/sampledSet/cloud/cloudSet.C b/src/sampling/sampledSet/cloud/cloudSet.C index 0600ad98dc..dddf730fab 100644 --- a/src/sampling/sampledSet/cloud/cloudSet.C +++ b/src/sampling/sampledSet/cloud/cloudSet.C @@ -151,20 +151,4 @@ Foam::cloudSet::~cloudSet() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::point Foam::cloudSet::getRefPoint(const List& pts) const -{ - if (pts.size()) - { - // Use first samplePt as starting point - return pts[0]; - } - else - { - return vector::zero; - } -} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/cloud/cloudSet.H b/src/sampling/sampledSet/cloud/cloudSet.H index c5a3ea21fa..dfe2732f98 100644 --- a/src/sampling/sampledSet/cloud/cloudSet.H +++ b/src/sampling/sampledSet/cloud/cloudSet.H @@ -75,6 +75,7 @@ class cloudSet //- Uses calcSamples to obtain samples. Copies them into *this. void genSamples(); + public: //- Runtime type information @@ -104,14 +105,7 @@ public: // Destructor - - virtual ~cloudSet(); - - - // Member Functions - - //- Get reference point - virtual point getRefPoint(const List&) const; + virtual ~cloudSet(); }; diff --git a/src/sampling/sampledSet/coordSet/coordSet.C b/src/sampling/sampledSet/coordSet/coordSet.C index 7960bf768c..7df0286c70 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.C +++ b/src/sampling/sampledSet/coordSet/coordSet.C @@ -25,6 +25,22 @@ License #include "coordSet.H" +// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // + +template<> +const char* Foam::NamedEnum::names[] = +{ + "xyz", + "x", + "y", + "z", + "distance" +}; + +const Foam::NamedEnum + Foam::coordSet::coordFormatNames_; + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // //- Construct from components @@ -36,8 +52,8 @@ Foam::coordSet::coordSet : pointField(0), name_(name), - axis_(axis), - refPoint_(vector::zero) + axis_(coordFormatNames_[axis]), + curveDist_(0) {} @@ -47,62 +63,21 @@ Foam::coordSet::coordSet const word& name, const word& axis, const List& points, - const point& refPoint + const scalarList& curveDist ) : pointField(points), name_(name), - axis_(axis), - refPoint_(refPoint) + axis_(coordFormatNames_[axis]), + curveDist_(curveDist) {} -//- Construct from components -Foam::coordSet::coordSet -( - const word& name, - const word& axis, - const scalarField& points, - const scalar refPoint -) -: - pointField(points.size(), point::zero), - name_(name), - axis_(axis), - refPoint_(point::zero) -{ - if (axis_ == "x" || axis_ == "distance") - { - refPoint_.x() = refPoint; - replace(point::X, points); - } - else if (axis_ == "y") - { - replace(point::Y, points); - } - else if (axis_ == "z") - { - replace(point::Z, points); - } - else - { - FatalErrorIn - ( - "coordSet::coordSet(const word& name," - "const word& axis, const List& points," - "const scalar refPoint)" - ) << "Illegal axis specification " << axis_ - << " for sampling line " << name_ - << exit(FatalError); - } -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::coordSet::hasVectorAxis() const { - return axis_ == "xyz"; + return axis_ == XYZ; } @@ -113,22 +88,22 @@ Foam::scalar Foam::coordSet::scalarCoord { const point& p = operator[](index); - if (axis_ == "x") + if (axis_ == X) { return p.x(); } - else if (axis_ == "y") + else if (axis_ == Y) { return p.y(); } - else if (axis_ == "z") + else if (axis_ == Z) { return p.z(); } - else if (axis_ == "distance") + else if (axis_ == DISTANCE) { // Use distance to reference point - return mag(p - refPoint_); + return curveDist_[index]; } else { @@ -154,7 +129,7 @@ Foam::point Foam::coordSet::vectorCoord(const label index) const Foam::Ostream& Foam::coordSet::write(Ostream& os) const { - os << "name:" << name_ << " axis:" << axis_ << " reference:" << refPoint_ + os << "name:" << name_ << " axis:" << axis_ << endl << endl << "\t(coord)" << endl; diff --git a/src/sampling/sampledSet/coordSet/coordSet.H b/src/sampling/sampledSet/coordSet/coordSet.H index 2c67793a30..c8fd066ec7 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.H +++ b/src/sampling/sampledSet/coordSet/coordSet.H @@ -52,16 +52,38 @@ class coordSet public pointField { +public: + + // Public data types + + //- Enumeration defining the output format for coordinates + enum coordFormat + { + XYZ, + X, + Y, + Z, + DISTANCE + }; + + +private: + + //- String representation of coordFormat enums + static const NamedEnum coordFormatNames_; + + protected: //- Name const word name_; //- Axis write type - const word axis_; + const coordFormat axis_; + + //- Cumulative distance "distance" write specifier. + scalarList curveDist_; - //- Reference point for "distance" write specifier. - point refPoint_; public: @@ -81,16 +103,7 @@ public: const word& name, const word& axis, const List& points, - const point& refPoint = point::zero - ); - - //- Construct from components - coordSet - ( - const word& name, - const word& axis, - const scalarField& points, - const scalar refPoint = 0.0 + const scalarList& curveDist ); @@ -101,33 +114,26 @@ public: return name_; } - const word& axis() const + word axis() const { - return axis_; + return coordFormatNames_[axis_]; } - const point& refPoint() const + //- Cumulative distance + const scalarList& curveDist() const { - return refPoint_; + return curveDist_; } //- Is axis specification a vector bool hasVectorAxis() const; //- Get coordinate of point according to axis specification. - // If axis="distance" can be: -distance to starting point (e.g. - // uniformSet) or -distance to first sampling point - // (e.g. cloudSet) - scalar scalarCoord - ( - const label index - ) const; + // If axis="distance" is the curveDist[index] + scalar scalarCoord(const label index) const; - //- Get point according to axis="full" specification - vector vectorCoord - ( - const label index - ) const; + //- Get point according to axis="xyz" specification + vector vectorCoord(const label index) const; Ostream& write(Ostream& os) const; }; diff --git a/src/sampling/sampledSet/face/faceOnlySet.C b/src/sampling/sampledSet/face/faceOnlySet.C index b6f8b30ace..bcc30e3ec1 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.C +++ b/src/sampling/sampledSet/face/faceOnlySet.C @@ -64,7 +64,7 @@ bool Foam::faceOnlySet::trackToBoundary // Alias const point& trackPt = singleParticle.position(); - while (true) + while(true) { point oldPoint = trackPt; @@ -198,7 +198,7 @@ void Foam::faceOnlySet::calcSamples // index in bHits; current boundary intersection label bHitI = 1; - while (true) + while(true) { if (trackFaceI != -1) { @@ -229,7 +229,7 @@ void Foam::faceOnlySet::calcSamples ); // fill sampleSegments - for (label i = samplingPts.size() - 1; i >= startSegmentI; --i) + for(label i = samplingPts.size() - 1; i >= startSegmentI; --i) { samplingSegments.append(segmentI); } @@ -380,12 +380,4 @@ Foam::faceOnlySet::~faceOnlySet() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::point Foam::faceOnlySet::getRefPoint(const List& pts) const -{ - return start_; -} - - // ************************************************************************* // diff --git a/src/sampling/sampledSet/face/faceOnlySet.H b/src/sampling/sampledSet/face/faceOnlySet.H index 56667e2054..bdb1e240dc 100644 --- a/src/sampling/sampledSet/face/faceOnlySet.H +++ b/src/sampling/sampledSet/face/faceOnlySet.H @@ -47,7 +47,7 @@ class passiveParticle; template class Particle; /*---------------------------------------------------------------------------*\ - Class faceOnlySet Declaration + Class faceOnlySet Declaration \*---------------------------------------------------------------------------*/ class faceOnlySet @@ -92,6 +92,7 @@ class faceOnlySet //- Uses calcSamples to obtain samples. Copies them into *this. void genSamples(); + public: //- Runtime type information @@ -121,8 +122,7 @@ public: // Destructor - - virtual ~faceOnlySet(); + virtual ~faceOnlySet(); // Member Functions @@ -136,9 +136,6 @@ public: { return end_; } - - //- Get reference point - virtual point getRefPoint(const List&) const; }; diff --git a/src/sampling/sampledSet/midPoint/midPointSet.C b/src/sampling/sampledSet/midPoint/midPointSet.C index 919d7c4021..4b25485afa 100644 --- a/src/sampling/sampledSet/midPoint/midPointSet.C +++ b/src/sampling/sampledSet/midPoint/midPointSet.C @@ -53,7 +53,7 @@ void Foam::midPointSet::genSamples() label sampleI = 0; - while (true) + while(true) { // calculate midpoint between sampleI and sampleI+1 (if in same segment) while diff --git a/src/sampling/sampledSet/midPoint/midPointSet.H b/src/sampling/sampledSet/midPoint/midPointSet.H index 47d3d33a11..2fff452e12 100644 --- a/src/sampling/sampledSet/midPoint/midPointSet.H +++ b/src/sampling/sampledSet/midPoint/midPointSet.H @@ -58,6 +58,7 @@ class midPointSet void genSamples(); + public: //- Runtime type information @@ -88,8 +89,7 @@ public: // Destructor - - virtual ~midPointSet(); + virtual ~midPointSet(); }; diff --git a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C index 5a182c4dd8..59dde9db30 100644 --- a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C @@ -55,7 +55,7 @@ void Foam::midPointAndFaceSet::genSamples() label sampleI = 0; - while (true) + while(true) { // sampleI is start of segment diff --git a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H index 2a928e1ce4..ddf84a58dc 100644 --- a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H @@ -59,6 +59,7 @@ class midPointAndFaceSet void genSamples(); + public: //- Runtime type information @@ -89,8 +90,7 @@ public: // Destructor - - virtual ~midPointAndFaceSet(); + virtual ~midPointAndFaceSet(); }; diff --git a/src/sampling/sampledSet/curve/curveSet.C b/src/sampling/sampledSet/polyLine/polyLineSet.C similarity index 93% rename from src/sampling/sampledSet/curve/curveSet.C rename to src/sampling/sampledSet/polyLine/polyLineSet.C index d5be7c09a7..a70e61e847 100644 --- a/src/sampling/sampledSet/curve/curveSet.C +++ b/src/sampling/sampledSet/polyLine/polyLineSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "curveSet.H" +#include "polyLineSet.H" #include "meshSearch.H" #include "DynamicList.H" #include "polyMesh.H" @@ -38,15 +38,15 @@ License namespace Foam { - defineTypeNameAndDebug(curveSet, 0); - addToRunTimeSelectionTable(sampledSet, curveSet, word); + defineTypeNameAndDebug(polyLineSet, 0); + addToRunTimeSelectionTable(sampledSet, polyLineSet, word); } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Sample till hits boundary. -bool Foam::curveSet::trackToBoundary +bool Foam::polyLineSet::trackToBoundary ( Particle& singleParticle, label& sampleI, @@ -127,7 +127,7 @@ bool Foam::curveSet::trackToBoundary } -void Foam::curveSet::calcSamples +void Foam::polyLineSet::calcSamples ( DynamicList& samplingPts, DynamicList