diff --git a/applications/solvers/incompressible/channelFoam/Make/files b/applications/solvers/incompressible/channelFoam/Make/files deleted file mode 100644 index 35d5b4e617..0000000000 --- a/applications/solvers/incompressible/channelFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -channelFoam.C - -EXE = $(FOAM_APPBIN)/channelFoam diff --git a/applications/solvers/incompressible/channelFoam/Make/options b/applications/solvers/incompressible/channelFoam/Make/options deleted file mode 100644 index 76a1a299dd..0000000000 --- a/applications/solvers/incompressible/channelFoam/Make/options +++ /dev/null @@ -1,14 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/turbulenceModels \ - -I$(LIB_SRC)/turbulenceModels/incompressible/LES/LESModel \ - -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ - -I$(LIB_SRC)/transportModels \ - -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -EXE_LIBS = \ - -lincompressibleLESModels \ - -lincompressibleTransportModels \ - -lfiniteVolume \ - -lmeshTools diff --git a/applications/solvers/incompressible/channelFoam/channelFoam.C b/applications/solvers/incompressible/channelFoam/channelFoam.C deleted file mode 100644 index 8c719c5f29..0000000000 --- a/applications/solvers/incompressible/channelFoam/channelFoam.C +++ /dev/null @@ -1,154 +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 . - -Application - channelFoam - -Description - Incompressible LES solver for flow in a channel. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "singlePhaseTransportModel.H" -#include "LESModel.H" -#include "IFstream.H" -#include "OFstream.H" -#include "Random.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "setRootCase.H" - #include "createTime.H" - #include "createMesh.H" - #include "readTransportProperties.H" - #include "createFields.H" - #include "initContinuityErrs.H" - #include "createGradP.H" - - Info<< "\nStarting time loop\n" << endl; - - while (runTime.loop()) - { - Info<< "Time = " << runTime.timeName() << nl << endl; - - #include "readPISOControls.H" - - #include "CourantNo.H" - - sgsModel->correct(); - - fvVectorMatrix UEqn - ( - fvm::ddt(U) - + fvm::div(phi, U) - + sgsModel->divDevBeff(U) - == - flowDirection*gradP - ); - - if (momentumPredictor) - { - solve(UEqn == -fvc::grad(p)); - } - - - // --- PISO loop - - volScalarField rAU(1.0/UEqn.A()); - - for (int corr=0; corr sgsModel - ( - incompressible::LESModel::New(U, phi, laminarTransport) - ); diff --git a/applications/solvers/incompressible/channelFoam/createGradP.H b/applications/solvers/incompressible/channelFoam/createGradP.H deleted file mode 100644 index 643509c46f..0000000000 --- a/applications/solvers/incompressible/channelFoam/createGradP.H +++ /dev/null @@ -1,24 +0,0 @@ - dimensionedScalar gradP - ( - "gradP", - dimensionSet(0, 1, -2, 0, 0), - 0.0 - ); - - - IFstream gradPFile - ( - runTime.path()/runTime.timeName()/"uniform"/"gradP.raw" - ); - - if (gradPFile.good()) - { - gradPFile >> gradP; - Info<< "Reading average pressure gradient" < UEqn fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) - == - sources(U) ); UEqn().relax(); @@ -17,5 +15,5 @@ volScalarField rAU(1.0/UEqn().A()); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(U)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 61acd7d697..55062637c2 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -1,4 +1,4 @@ -U = rAU*UEqn().H(); +U = rAU*(UEqn() == sources(U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -36,3 +36,4 @@ p.relax(); U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H index 5a211caa9c..618816f5fe 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H @@ -9,9 +9,11 @@ tmp UEqn UEqn().relax(); +sources.constrain(UEqn()); + rAU = 1.0/UEqn().A(); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p)); + solve(UEqn() == -fvc::grad(p) + sources(U)); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H index aeef26a837..dd90826e7d 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pEqn.H @@ -1,4 +1,4 @@ -U = rAU*UEqn().H(); +U = rAU*(UEqn() == sources(U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -46,3 +46,4 @@ fvc::makeRelative(phi, U); U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H index c869df39a2..74e84d9bfc 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H @@ -3,8 +3,6 @@ tmp UEqn fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) - == - sources(U) ); @@ -14,5 +12,5 @@ sources.constrain(UEqn()); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p_gh)); + solve(UEqn() == -fvc::grad(p_gh) + sources(U)); } diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H index a5adeb9e91..d7cf6cd5b1 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H @@ -1,7 +1,7 @@ volScalarField rAU(1.0/UEqn().A()); surfaceScalarField rAUf(rAU.name() + 'f', fvc::interpolate(rAU)); -U = rAU*UEqn().H(); +U = rAU*(UEqn() == sources(U))().H(); if (pimple.nCorrPISO() <= 1) { @@ -41,3 +41,4 @@ p = p_gh + (g & (mesh.C() + zeta - refLevel)); U -= rAU*fvc::grad(p_gh); U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H index 2d2540d303..93d6537b6a 100644 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H @@ -34,4 +34,5 @@ // Momentum corrector U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); } diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H index 54eab9cba7..b9a9079b92 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/pEqn.H @@ -34,4 +34,5 @@ // Momentum corrector Urel -= rAUrel*fvc::grad(p); Urel.correctBoundaryConditions(); + sources.correct(Urel); } diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index 966dedb616..78dd40500b 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -34,4 +34,5 @@ // Momentum corrector U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); } diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H index 70f7520190..b381b2901d 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/UEqn.H @@ -7,7 +7,6 @@ == rho.dimensionedInternalField()*g + parcels.SU(U) - + sources(rho, U) ); sources.constrain(UEqn); @@ -16,5 +15,5 @@ if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p)); + solve(UEqn == -fvc::grad(p) + sources(rho, U)); } diff --git a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H index 141faa30bf..8a77a2656e 100644 --- a/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/LTSReactingParcelFoam/pEqn.H @@ -6,7 +6,7 @@ thermo.rho() -= psi*p; volScalarField rAU(1.0/UEqn.A()); - U = rAU*UEqn.H(); + U = rAU*(UEqn == sources(rho, U))().H(); if (pZones.size() > 0) { @@ -60,6 +60,7 @@ U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); rho = thermo.rho(); rho = max(rho, rhoMin); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H index fe7b047d9a..24f56e83d2 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H @@ -7,7 +7,6 @@ rho.dimensionedInternalField()*g + coalParcels.SU(U) + limestoneParcels.SU(U) - + sources(rho, U) ); UEqn.relax(); @@ -16,6 +15,6 @@ if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p)); + solve(UEqn == -fvc::grad(p) + sources(rho, U)); K = 0.5*magSqr(U); } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index 56435d31ce..cb8553bbfb 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -1,7 +1,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); -U = rAU*UEqn.H(); +U = rAU*(UEqn == sources(rho, U))().H(); if (pimple.transonic()) { @@ -74,6 +74,8 @@ else U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); + K = 0.5*magSqr(U); dpdt = fvc::ddt(p); diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H index 28f6f81d9f..ce25309532 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/UEqn.H @@ -7,7 +7,6 @@ == rho.dimensionedInternalField()*g + parcels.SU(U) - + sources(rho, U) ); UEqn.relax(); @@ -18,7 +17,7 @@ if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p)); + solve(UEqn == -fvc::grad(p) + sources(rho, U)); K = 0.5*magSqr(U); } diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H index 080faecced..6ed7affe77 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/pEqn.H @@ -6,7 +6,7 @@ thermo.rho() -= psi*p; volScalarField rAU(1.0/UEqn.A()); - U = rAU*UEqn.H(); + U = rAU*(UEqn == sources(rho, U))().H(); if (pZones.size() > 0) { @@ -59,6 +59,8 @@ U -= rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); + K = 0.5*magSqr(U); dpdt = fvc::ddt(p); diff --git a/applications/solvers/multiphase/interFoam/alphaEqn.H b/applications/solvers/multiphase/interFoam/alphaEqn.H index d19ae9bb70..dc1146944e 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interFoam/alphaEqn.H @@ -30,7 +30,7 @@ } Info<< "Liquid phase volume fraction = " - << alpha1.weightedAverage(mesh.V()).value() + << alpha1.weightedAverage(mesh.Vsc()).value() << " Min(alpha1) = " << min(alpha1).value() << " Max(alpha1) = " << max(alpha1).value() << endl; diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H index b93ea3a020..675a410a16 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/pEqn.H @@ -155,7 +155,6 @@ phasei++; } Dp = mag(Dp); - adjustPhi(phi0, U, p); while (pimple.correctNonOrthogonal()) { diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 4c23251542..7ba18b3cc8 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -203,10 +203,15 @@ void Foam::Time::setControls() ) ); - if (timeDict.readIfPresent("deltaT", deltaT_)) + // Read and set the deltaT only if time-step adjustment is active + // otherwise use the deltaT from the controlDict + if (controlDict_.lookupOrDefault("adjustTimeStep", false)) { - deltaTSave_ = deltaT_; - deltaT0_ = deltaT_; + if (timeDict.readIfPresent("deltaT", deltaT_)) + { + deltaTSave_ = deltaT_; + deltaT0_ = deltaT_; + } } timeDict.readIfPresent("deltaT0", deltaT0_); diff --git a/src/OpenFOAM/interpolations/interpolation2DTable/interpolation2DTable.C b/src/OpenFOAM/interpolations/interpolation2DTable/interpolation2DTable.C index e1f744b07e..baa873f5fc 100644 --- a/src/OpenFOAM/interpolations/interpolation2DTable/interpolation2DTable.C +++ b/src/OpenFOAM/interpolations/interpolation2DTable/interpolation2DTable.C @@ -36,7 +36,6 @@ void Foam::interpolation2DTable::readTable() // Read data from file reader_()(fName, *this); - //IFstream(fName)() >> *this; if (this->empty()) { @@ -361,7 +360,6 @@ void Foam::interpolation2DTable::write(Ostream& os) const { reader_->write(os); } - //*this >> os; } @@ -654,100 +652,6 @@ Type Foam::interpolation2DTable::operator() } } - label loY2 = 0; - label hiY2 = 0; - - nY = matrix::operator[](hiX).second().size(); - - minLimit = matrix::operator[](loX).second()[0].first(); - maxLimit = matrix::operator[](loX).second()[nY-1].first(); - - if (lookupValue < minLimit) - { - switch (boundsHandling_) - { - case interpolation2DTable::ERROR: - { - FatalErrorIn - ( - "Foam::interpolation2DTable::operator[]" - "(const scalar, const scalar) const" - ) << "value (" << lookupValue << ") underflow" << nl - << exit(FatalError); - break; - } - case interpolation2DTable::WARN: - { - WarningIn - ( - "Foam::interpolation2DTable::operator[]" - "(const scalar, const scalar) const" - ) << "value (" << lookupValue << ") underflow" << nl - << " Continuing with the first entry" - << endl; - // fall-through to 'CLAMP' - } - case interpolation2DTable::CLAMP: - { - loY2 = 0; - loY2 = 1; - break; - } - } - } - else if (lookupValue >= maxLimit) - { - switch (boundsHandling_) - { - case interpolation2DTable::ERROR: - { - FatalErrorIn - ( - "Foam::interpolation2DTable::operator[]" - "(const scalar, const scalar) const" - ) << "value (" << lookupValue << ") overflow" << nl - << exit(FatalError); - break; - } - case interpolation2DTable::WARN: - { - WarningIn - ( - "Foam::interpolation2DTable::operator[]" - "(const scalar, const scalar) const" - ) << "value (" << lookupValue << ") overflow" << nl - << " Continuing with the last entry" - << endl; - // fall-through to 'CLAMP' - } - case interpolation2DTable::CLAMP: - { - loY2 = nY-1; - loY2 = nY; - break; - } - } - } - else - { - // Finds the lo and hi of Y on the high x - for (label i = 0; i < nY; ++i) - { - if - ( - lookupValue >= matrix::operator[](hiX).second()[i].first() - ) - { - loY2 = hiY2 = i; - } - else - { - hiY2 = i; - break; - } - } - } - if (loX == hiX) { // we are at the end of the table - or there is only a single entry diff --git a/src/fieldSources/basicSource/basicSource/IObasicSourceList.H b/src/fieldSources/basicSource/basicSource/IObasicSourceList.H index 9b915899fb..69070b18db 100644 --- a/src/fieldSources/basicSource/basicSource/IObasicSourceList.H +++ b/src/fieldSources/basicSource/basicSource/IObasicSourceList.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class IObasicSourceList Declaration + Class IObasicSourceList Declaration \*---------------------------------------------------------------------------*/ class IObasicSourceList @@ -80,6 +80,8 @@ public: {} + // Member Functions + //- Read dictionary virtual bool read(); }; diff --git a/src/fieldSources/basicSource/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource/basicSource.C index 40f283a78a..355073b33a 100644 --- a/src/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/fieldSources/basicSource/basicSource/basicSource.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,6 +26,7 @@ License #include "basicSource.H" #include "fvMesh.H" #include "fvMatrices.H" +#include "volFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -161,7 +162,7 @@ void Foam::basicSource::setCellSet() } case smMapRegion: { - if(active_) + if (active_) { Info<< indent << "- selecting inter region mapping" << endl; const fvMesh& secondaryMesh = @@ -170,7 +171,6 @@ void Foam::basicSource::setCellSet() const boundBox secondaryBB = secondaryMesh.bounds(); if (secondaryBB.overlaps(primaryBB)) { - // Dummy patches wordList cuttingPatches; HashTable patchMap; @@ -218,7 +218,7 @@ void Foam::basicSource::setCellSet() } // Set volume information - if(selectionMode_ != smMapRegion) + if (selectionMode_ != smMapRegion) { V_ = 0.0; forAll(cells_, i) @@ -303,6 +303,7 @@ Foam::autoPtr Foam::basicSource::New return autoPtr(cstrIter()(name, modelType, coeffs, mesh)); } + Foam::basicSource::~basicSource() { if (!secondaryToPrimaryInterpPtr_.empty()) @@ -364,6 +365,36 @@ void Foam::basicSource::checkApplied() const } +void Foam::basicSource::correct(volScalarField& fld) +{ + // do nothing +} + + +void Foam::basicSource::correct(volVectorField& fld) +{ + // do nothing +} + + +void Foam::basicSource::correct(volSphericalTensorField& fld) +{ + // do nothing +} + + +void Foam::basicSource::correct(volSymmTensorField& fld) +{ + // do nothing +} + + +void Foam::basicSource::correct(volTensorField& fld) +{ + // do nothing +} + + void Foam::basicSource::addSup(fvMatrix& eqn, const label fieldI) { // do nothing diff --git a/src/fieldSources/basicSource/basicSource/basicSource.H b/src/fieldSources/basicSource/basicSource/basicSource.H index 1bff312111..ca105f90b1 100644 --- a/src/fieldSources/basicSource/basicSource/basicSource.H +++ b/src/fieldSources/basicSource/basicSource/basicSource.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,6 +47,7 @@ SourceFiles #define basicSource_H #include "fvMatricesFwd.H" +#include "volFieldsFwd.H" #include "cellSet.H" #include "autoPtr.H" #include "meshToMesh.H" @@ -60,7 +61,6 @@ namespace Foam class fvMesh; - /*---------------------------------------------------------------------------*\ Class basicSource Declaration \*---------------------------------------------------------------------------*/ @@ -330,6 +330,24 @@ public: // Evaluation + // Correct + + //- Scalar + virtual void correct(volScalarField& fld); + + //- Vector + virtual void correct(volVectorField& fld); + + //- Spherical tensor + virtual void correct(volSphericalTensorField& fld); + + //- Symmetric tensor + virtual void correct(volSymmTensorField& fld); + + //- Tensor + virtual void correct(volTensorField& fld); + + // Add explicit and implicit contributions //- Scalar diff --git a/src/fieldSources/basicSource/basicSource/basicSourceI.H b/src/fieldSources/basicSource/basicSource/basicSourceI.H index 84444144f3..6ffc096def 100644 --- a/src/fieldSources/basicSource/basicSource/basicSourceI.H +++ b/src/fieldSources/basicSource/basicSource/basicSourceI.H @@ -135,4 +135,5 @@ inline const Foam::word Foam::basicSource::mapRegionName() const return mapRegionName_; } + // ************************************************************************* // diff --git a/src/fieldSources/basicSource/basicSource/basicSourceList.H b/src/fieldSources/basicSource/basicSource/basicSourceList.H index 5e5b5fda14..7d77de55d1 100644 --- a/src/fieldSources/basicSource/basicSource/basicSourceList.H +++ b/src/fieldSources/basicSource/basicSource/basicSourceList.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,6 +95,11 @@ public: // Member Functions + //- Correct + template + void correct(GeometricField& fld); + + // Sources //- Return source for equation diff --git a/src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C b/src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C index aafa91d098..7c83f7f522 100644 --- a/src/fieldSources/basicSource/basicSource/basicSourceListTemplates.C +++ b/src/fieldSources/basicSource/basicSource/basicSourceListTemplates.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,39 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::basicSourceList::correct +( + GeometricField& fld +) +{ + const word& fieldName = fld.name(); + + forAll(*this, i) + { + basicSource& source = this->operator[](i); + + label fieldI = source.applyToField(fieldName); + + if (fieldI != -1) + { + source.setApplied(fieldI); + + if (source.isActive()) + { + if (debug) + { + Info<< "Correcting source " << source.name() + << " for field " << fieldName << endl; + } + + source.correct(fld); + } + } + } +} + + template Foam::tmp > Foam::basicSourceList::operator() ( diff --git a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C index e3ff7ca50e..c13720b831 100644 --- a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.C +++ b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,53 +69,6 @@ void Foam::pressureGradientExplicitSource::writeGradP() const } -void Foam::pressureGradientExplicitSource::update(fvMatrix& eqn) -{ - volVectorField& U = const_cast(eqn.psi()); - - const volScalarField& rAU = - mesh_.lookupObject("(1|A(" + U.name() + "))"); - - // Integrate flow variables over cell set - scalar magUbarAve = 0.0; - scalar rAUave = 0.0; - const scalarField& cv = mesh_.V(); - forAll(cells_, i) - { - label cellI = cells_[i]; - scalar volCell = cv[cellI]; - magUbarAve += (flowDir_ & U[cellI])*volCell; - rAUave += rAU[cellI]*volCell; - } - - // Collect across all processors - reduce(magUbarAve, sumOp()); - - // Volume averages - magUbarAve /= V_; - rAUave /= V_; - - // Calculate the pressure gradient increment needed to adjust the average - // flow-rate to the desired value - scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave; - - // Apply correction to velocity field - forAll(cells_, i) - { - label cellI = cells_[i]; - U[cellI] += flowDir_*rAU[cellI]*gradPplus; - } - - // Update pressure gradient - gradP_.value() += gradPplus; - - Info<< "Uncorrected Ubar = " << magUbarAve << tab - << "Pressure gradient = " << gradP_.value() << endl; - - writeGradP(); -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::pressureGradientExplicitSource::pressureGradientExplicitSource @@ -123,7 +76,7 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource const word& sourceName, const word& modelType, const dictionary& dict, - const fvMesh& mesh + const fvMesh& mesh ) : basicSource(sourceName, modelType, dict, mesh), @@ -133,6 +86,23 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource flowDir_(Ubar_/mag(Ubar_)) { coeffs_.lookup("fieldNames") >> fieldNames_; + + if (fieldNames_.size() != 1) + { + FatalErrorIn + ( + "Foam::pressureGradientExplicitSource::" + "pressureGradientExplicitSource" + "(" + "onst word&, " + "const word&, " + "const dictionary&, " + "const fvMesh&" + ")" + ) << "Source can only be applied to a single field. Current " + << "settings are:" << fieldNames_ << exit(FatalError); + } + applied_.setSize(fieldNames_.size(), false); // Read the initial pressure gradient from file if it exists @@ -160,8 +130,6 @@ void Foam::pressureGradientExplicitSource::addSup const label fieldI ) { - update(eqn); - DimensionedField Su ( IOobject @@ -178,7 +146,53 @@ void Foam::pressureGradientExplicitSource::addSup UIndirectList(Su, cells_) = flowDir_*gradP_.value(); - eqn -= Su; + eqn += Su; +} + + +void Foam::pressureGradientExplicitSource::correct(volVectorField& U) +{ + const volScalarField& rAU = + mesh_.lookupObject("(1|A(" + U.name() + "))"); + + // Integrate flow variables over cell set + scalar magUbarAve = 0.0; + scalar rAUave = 0.0; + const scalarField& cv = mesh_.V(); + forAll(cells_, i) + { + label cellI = cells_[i]; + scalar volCell = cv[cellI]; + magUbarAve += (flowDir_ & U[cellI])*volCell; + rAUave += rAU[cellI]*volCell; + } + + // Collect across all processors + reduce(magUbarAve, sumOp()); + reduce(rAUave, sumOp()); + + // Volume averages + magUbarAve /= V_; + rAUave /= V_; + + // Calculate the pressure gradient increment needed to adjust the average + // flow-rate to the desired value + scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave; + + // Apply correction to velocity field + forAll(cells_, i) + { + label cellI = cells_[i]; + U[cellI] += flowDir_*rAU[cellI]*gradPplus; + } + + // Update pressure gradient + gradP_.value() += gradPplus; + + Info<< "Pressure gradient source: uncorrected Ubar = " << magUbarAve + << ", pressure gradient = " << gradP_.value() << endl; + + writeGradP(); } diff --git a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H index 287c1701f3..bf760254af 100644 --- a/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.H +++ b/src/fieldSources/basicSource/pressureGradientExplicitSource/pressureGradientExplicitSource.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -118,7 +118,10 @@ public: // Member Functions - // Access + // Evaluate + + //- Correct the pressure gradient + virtual void correct(volVectorField& U); //- Add explicit contribution to equation virtual void addSup(fvMatrix& eqn, const label fieldI); diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 2d4930f385..db1aee788a 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -170,7 +170,7 @@ $(derivedFvPatchFields)/swirlFlowRateInletVelocity/swirlFlowRateInletVelocityFvP $(derivedFvPatchFields)/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/outletMappedUniformInlet/outletMappedUniformInletFvPatchFields.C $(derivedFvPatchFields)/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C - +$(derivedFvPatchFields)/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C fvsPatchFields = fields/fvsPatchFields $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C diff --git a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C new file mode 100644 index 0000000000..6b9a22da0f --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.C @@ -0,0 +1,202 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "phaseHydrostaticPressureFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "uniformDimensionedFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseHydrostaticPressureFvPatchScalarField:: +phaseHydrostaticPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(p, iF), + phaseName_("alpha"), + rho_(0.0), + pRefValue_(0.0), + pRefPoint_(vector::zero) +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} + + +Foam::phaseHydrostaticPressureFvPatchScalarField:: +phaseHydrostaticPressureFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF), + phaseName_(dict.lookupOrDefault("phaseName", "alpha")), + rho_(readScalar(dict.lookup("rho"))), + pRefValue_(readScalar(dict.lookup("pRefValue"))), + pRefPoint_(dict.lookup("pRefPoint")) +{ + this->refValue() = pRefValue_; + + if (dict.found("value")) + { + fvPatchScalarField::operator= + ( + scalarField("value", dict, p.size()) + ); + } + else + { + fvPatchScalarField::operator=(this->refValue()); + } + + this->refGrad() = 0.0; + this->valueFraction() = 0.0; +} + + +Foam::phaseHydrostaticPressureFvPatchScalarField:: +phaseHydrostaticPressureFvPatchScalarField +( + const phaseHydrostaticPressureFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(ptf, p, iF, mapper), + phaseName_(ptf.phaseName_), + rho_(ptf.rho_), + pRefValue_(ptf.pRefValue_), + pRefPoint_(ptf.pRefPoint_) +{} + + +Foam::phaseHydrostaticPressureFvPatchScalarField:: +phaseHydrostaticPressureFvPatchScalarField +( + const phaseHydrostaticPressureFvPatchScalarField& ptf +) +: + mixedFvPatchScalarField(ptf), + phaseName_(ptf.phaseName_) +{} + + +Foam::phaseHydrostaticPressureFvPatchScalarField:: +phaseHydrostaticPressureFvPatchScalarField +( + const phaseHydrostaticPressureFvPatchScalarField& ptf, + const DimensionedField& iF +) +: + mixedFvPatchScalarField(ptf, iF), + phaseName_(ptf.phaseName_), + rho_(ptf.rho_), + pRefValue_(ptf.pRefValue_), + pRefPoint_(ptf.pRefPoint_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + const scalarField& alphap = + patch().lookupPatchField + ( + phaseName_ + ); + + const uniformDimensionedVectorField& g = + db().lookupObject("g"); + + // scalar rhor = 1000; + // scalarField alphap1 = max(min(alphap, 1.0), 0.0); + // valueFraction() = alphap1/(alphap1 + rhor*(1.0 - alphap1)); + valueFraction() = max(min(alphap, 1.0), 0.0); + + refValue() = + pRefValue_ + + rho_*((g.value() & patch().Cf()) - (g.value() & pRefPoint_)); + + mixedFvPatchScalarField::updateCoeffs(); +} + + +void Foam::phaseHydrostaticPressureFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); + if (phaseName_ != "alpha") + { + os.writeKeyword("phaseName") + << phaseName_ << token::END_STATEMENT << nl; + } + os.writeKeyword("rho") << rho_ << token::END_STATEMENT << nl; + os.writeKeyword("pRefValue") << pRefValue_ << token::END_STATEMENT << nl; + os.writeKeyword("pRefPoint") << pRefPoint_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::phaseHydrostaticPressureFvPatchScalarField::operator= +( + const fvPatchScalarField& ptf +) +{ + fvPatchScalarField::operator= + ( + valueFraction()*refValue() + + (1 - valueFraction())*ptf + ); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + phaseHydrostaticPressureFvPatchScalarField + ); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H new file mode 100644 index 0000000000..4c14094f49 --- /dev/null +++ b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H @@ -0,0 +1,223 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Class + Foam::phaseHydrostaticPressureFvPatchScalarField + +Description + Phase hydrostatic pressure boundary condition calculated as + + pRefValue + rho*g.(x - pRefPoint) + + where rho is provided and assumed uniform + + applied according to the phase-fraction field provided: + 1 -> fix value to that provided + 0 -> zero-gradient + +SourceFiles + phaseHydrostaticPressureFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseHydrostaticPressureFvPatchScalarField_H +#define phaseHydrostaticPressureFvPatchScalarField_H + +#include "mixedFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phaseHydrostaticPressureFvPatch Declaration +\*---------------------------------------------------------------------------*/ + +class phaseHydrostaticPressureFvPatchScalarField +: + public mixedFvPatchScalarField +{ + +protected: + + // Protected data + + //- Name of phase-fraction field + word phaseName_; + + //- Constant density in the far-field + scalar rho_; + + //- Reference pressure + scalar pRefValue_; + + //- Reference pressure location + vector pRefPoint_; + + +public: + + //- Runtime type information + TypeName("phaseHydrostaticPressure"); + + + // Constructors + + //- Construct from patch and internal field + phaseHydrostaticPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + phaseHydrostaticPressureFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // phaseHydrostaticPressureFvPatchScalarField onto a new patch + phaseHydrostaticPressureFvPatchScalarField + ( + const phaseHydrostaticPressureFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + phaseHydrostaticPressureFvPatchScalarField + ( + const phaseHydrostaticPressureFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new phaseHydrostaticPressureFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + phaseHydrostaticPressureFvPatchScalarField + ( + const phaseHydrostaticPressureFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new phaseHydrostaticPressureFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the phaseName + const word& phaseName() const + { + return phaseName_; + } + + //- Return reference to the phaseName to allow adjustment + word& phaseName() + { + return phaseName_; + } + + //- Return the constant density in the far-field + scalar rho() const + { + return rho_; + } + + //- Return reference to the constant density in the far-field + // to allow adjustment + scalar& rho() + { + return rho_; + } + + //- Return the reference pressure + scalar pRefValue() const + { + return pRefValue_; + } + + //- Return reference to the reference pressure to allow adjustment + scalar& pRefValue() + { + return pRefValue_; + } + + //- Return the pressure reference location + const vector& pRefPoint() const + { + return pRefPoint_; + } + + //- Return reference to the pressure reference location + // to allow adjustment + vector& pRefPoint() + { + return pRefPoint_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchScalarField& pvf); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C index 2b60f241b5..b2e878055c 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C @@ -26,6 +26,7 @@ License #include "PatchPostProcessing.H" #include "Pstream.H" #include "stringListOps.H" +#include "ListOps.H" #include "ListListOps.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -55,9 +56,12 @@ void Foam::PatchPostProcessing::write() { forAll(patchData_, i) { + List > procTimes(Pstream::nProcs()); + procTimes[Pstream::myProcNo()] = times_[i]; + Pstream::gatherList(procTimes); + List > procData(Pstream::nProcs()); procData[Pstream::myProcNo()] = patchData_[i]; - Pstream::gatherList(procData); if (Pstream::master()) @@ -100,18 +104,33 @@ void Foam::PatchPostProcessing::write() procData, accessOp >() ); - sort(globalData); + + List globalTimes; + globalTimes = ListListOps::combine > + ( + procTimes, + accessOp >() + ); + + labelList indices; + sortedOrder(globalTimes, indices); string header("# Time currentProc " + parcelType::propHeader); patchOutFile<< header.c_str() << nl; - forAll(globalData, dataI) + forAll(globalTimes, i) { - patchOutFile<< globalData[dataI].c_str() << nl; + label dataI = indices[i]; + + patchOutFile + << globalTimes[dataI] << ' ' + << globalData[dataI].c_str() + << nl; } } patchData_[i].clearStorage(); + times_[i].clearStorage(); } } @@ -128,6 +147,7 @@ Foam::PatchPostProcessing::PatchPostProcessing CloudFunctionObject(dict, owner, typeName), maxStoredParcels_(readScalar(this->coeffDict().lookup("maxStoredParcels"))), patchIDs_(), + times_(), patchData_() { const wordList allPatchNames = owner.mesh().boundaryMesh().names(); @@ -167,6 +187,7 @@ Foam::PatchPostProcessing::PatchPostProcessing } patchData_.setSize(patchIDs_.size()); + times_.setSize(patchIDs_.size()); } @@ -179,6 +200,7 @@ Foam::PatchPostProcessing::PatchPostProcessing CloudFunctionObject(ppm), maxStoredParcels_(ppm.maxStoredParcels_), patchIDs_(ppm.patchIDs_), + times_(ppm.times_), patchData_(ppm.patchData_) {} @@ -203,9 +225,11 @@ void Foam::PatchPostProcessing::postPatch const label localPatchI = applyToPatch(patchI); if (localPatchI != -1 && patchData_[localPatchI].size() < maxStoredParcels_) { + times_[localPatchI].append(this->owner().time().value()); + OStringStream data; - data<< this->owner().time().timeName() << ' ' << Pstream::myProcNo() - << ' ' << p; + data<< Pstream::myProcNo() << ' ' << p; + patchData_[localPatchI].append(data.str()); } } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H index 83aaa1663b..9945d24b58 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H @@ -61,6 +61,9 @@ class PatchPostProcessing //- List of patch indices to post-process labelList patchIDs_; + //- List of time for each data record + List > times_; + //- List of output data per patch List > patchData_; diff --git a/tutorials/Alltest b/tutorials/Alltest index 8d8790a58d..63a70167c6 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -39,6 +39,7 @@ usage() usage: ${0##*/} [OPTION] options: + -root specify root folder to run tests from -default sets up a default scheme on all schemes -help print the usage @@ -52,16 +53,22 @@ USAGE unset DEFAULT_SCHEMES +ROOT="./" + # parse options while [ "$#" -gt 0 ] do case "$1" in + -r | -root) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + ROOT="$2" + shift + ;; -h | -help) usage ;; -d | -default) DEFAULT_SCHEMES=true - shift ;; -*) usage "unknown option: '$*'" @@ -70,6 +77,7 @@ do break ;; esac + shift done @@ -123,7 +131,7 @@ done [ -f "$MAIN_CONTROL_DICT" ] || usage "main controlDict not found" -TUTORIALS_DIR=. +TUTORIALS_DIR=$ROOT TEST_RUN_DIR=../tutorialsTest FV_SCHEMES=\ " \ @@ -198,8 +206,10 @@ then done fi +cp -f $FOAM_TUTORIALS/Allrun . ./Allrun + sed -e :a -e '/\\$/N; s/\\\n//; ta' Allrun > temp APPLICATIONS=\ `grep "applications=" temp | sed 's/applications=\"\([A-Za-z \t]*\)\"/\1/g'` diff --git a/tutorials/incompressible/channelFoam/channel395/0.org/B b/tutorials/incompressible/pimpleFoam/channel395/0.org/B similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0.org/B rename to tutorials/incompressible/pimpleFoam/channel395/0.org/B diff --git a/tutorials/incompressible/channelFoam/channel395/0.org/U b/tutorials/incompressible/pimpleFoam/channel395/0.org/U similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0.org/U rename to tutorials/incompressible/pimpleFoam/channel395/0.org/U diff --git a/tutorials/incompressible/channelFoam/channel395/0.org/k b/tutorials/incompressible/pimpleFoam/channel395/0.org/k similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0.org/k rename to tutorials/incompressible/pimpleFoam/channel395/0.org/k diff --git a/tutorials/incompressible/channelFoam/channel395/0.org/nuSgs b/tutorials/incompressible/pimpleFoam/channel395/0.org/nuSgs similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0.org/nuSgs rename to tutorials/incompressible/pimpleFoam/channel395/0.org/nuSgs diff --git a/tutorials/incompressible/channelFoam/channel395/0.org/nuTilda b/tutorials/incompressible/pimpleFoam/channel395/0.org/nuTilda similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0.org/nuTilda rename to tutorials/incompressible/pimpleFoam/channel395/0.org/nuTilda diff --git a/tutorials/incompressible/channelFoam/channel395/0.org/p b/tutorials/incompressible/pimpleFoam/channel395/0.org/p similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0.org/p rename to tutorials/incompressible/pimpleFoam/channel395/0.org/p diff --git a/tutorials/incompressible/channelFoam/channel395/0/B.gz b/tutorials/incompressible/pimpleFoam/channel395/0/B.gz similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0/B.gz rename to tutorials/incompressible/pimpleFoam/channel395/0/B.gz diff --git a/tutorials/incompressible/channelFoam/channel395/0/U.gz b/tutorials/incompressible/pimpleFoam/channel395/0/U.gz similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0/U.gz rename to tutorials/incompressible/pimpleFoam/channel395/0/U.gz diff --git a/tutorials/incompressible/channelFoam/channel395/0/k.gz b/tutorials/incompressible/pimpleFoam/channel395/0/k.gz similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0/k.gz rename to tutorials/incompressible/pimpleFoam/channel395/0/k.gz diff --git a/tutorials/incompressible/channelFoam/channel395/0/nuSgs.gz b/tutorials/incompressible/pimpleFoam/channel395/0/nuSgs.gz similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0/nuSgs.gz rename to tutorials/incompressible/pimpleFoam/channel395/0/nuSgs.gz diff --git a/tutorials/incompressible/channelFoam/channel395/0/nuTilda.gz b/tutorials/incompressible/pimpleFoam/channel395/0/nuTilda.gz similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0/nuTilda.gz rename to tutorials/incompressible/pimpleFoam/channel395/0/nuTilda.gz diff --git a/tutorials/incompressible/channelFoam/channel395/0/p.gz b/tutorials/incompressible/pimpleFoam/channel395/0/p.gz similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/0/p.gz rename to tutorials/incompressible/pimpleFoam/channel395/0/p.gz diff --git a/tutorials/incompressible/channelFoam/channel395/Allrun b/tutorials/incompressible/pimpleFoam/channel395/Allrun similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/Allrun rename to tutorials/incompressible/pimpleFoam/channel395/Allrun diff --git a/tutorials/incompressible/channelFoam/channel395/constant/LESProperties b/tutorials/incompressible/pimpleFoam/channel395/constant/LESProperties similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/constant/LESProperties rename to tutorials/incompressible/pimpleFoam/channel395/constant/LESProperties diff --git a/tutorials/incompressible/channelFoam/channel395/constant/polyMesh/blockMeshDict b/tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/blockMeshDict similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/constant/polyMesh/blockMeshDict rename to tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/blockMeshDict diff --git a/tutorials/incompressible/channelFoam/channel395/constant/polyMesh/boundary b/tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/boundary similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/constant/polyMesh/boundary rename to tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/boundary diff --git a/tutorials/incompressible/channelFoam/channel395/constant/postChannelDict b/tutorials/incompressible/pimpleFoam/channel395/constant/postChannelDict similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/constant/postChannelDict rename to tutorials/incompressible/pimpleFoam/channel395/constant/postChannelDict diff --git a/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties b/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties new file mode 100644 index 0000000000..106403ce53 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties @@ -0,0 +1,35 @@ +/*--------------------------------*- 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 dictionary; + location "constant"; + object sourcesProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +momentumSource +{ + type pressureGradientExplicitSource; + active on; //on/off switch + timeStart 0.0; //start time + duration 1000000.0; //duration + selectionMode all; //cellSet // points //cellZone + + pressureGradientExplicitSourceCoeffs + { + fieldNames (U); + Ubar ( 0.1335 0 0 ); + gradPini gradPIni [0 1 -2 0 0 ] 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/channelFoam/channel395/constant/transportProperties b/tutorials/incompressible/pimpleFoam/channel395/constant/transportProperties similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/constant/transportProperties rename to tutorials/incompressible/pimpleFoam/channel395/constant/transportProperties diff --git a/tutorials/incompressible/pimpleFoam/channel395/constant/turbulenceProperties b/tutorials/incompressible/pimpleFoam/channel395/constant/turbulenceProperties new file mode 100644 index 0000000000..2d60fc8bf1 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/channel395/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- 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 dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType LESModel; + +// ************************************************************************* // diff --git a/tutorials/incompressible/channelFoam/channel395/system/controlDict b/tutorials/incompressible/pimpleFoam/channel395/system/controlDict similarity index 98% rename from tutorials/incompressible/channelFoam/channel395/system/controlDict rename to tutorials/incompressible/pimpleFoam/channel395/system/controlDict index a8083d9305..9dc482f560 100644 --- a/tutorials/incompressible/channelFoam/channel395/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/channel395/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application channelFoam; +application pimpleFoam; startFrom startTime; diff --git a/tutorials/incompressible/channelFoam/channel395/system/fvSchemes b/tutorials/incompressible/pimpleFoam/channel395/system/fvSchemes similarity index 100% rename from tutorials/incompressible/channelFoam/channel395/system/fvSchemes rename to tutorials/incompressible/pimpleFoam/channel395/system/fvSchemes diff --git a/tutorials/incompressible/channelFoam/channel395/system/fvSolution b/tutorials/incompressible/pimpleFoam/channel395/system/fvSolution similarity index 78% rename from tutorials/incompressible/channelFoam/channel395/system/fvSolution rename to tutorials/incompressible/pimpleFoam/channel395/system/fvSolution index 1621115467..cc56bcbe20 100644 --- a/tutorials/incompressible/channelFoam/channel395/system/fvSolution +++ b/tutorials/incompressible/pimpleFoam/channel395/system/fvSolution @@ -33,41 +33,25 @@ solvers relTol 0; } - U + "(U|k)" { solver PBiCG; preconditioner DILU; tolerance 1e-05; - relTol 0; + relTol 0.1; } - k + "(U|k)Final" { - solver PBiCG; - preconditioner DILU; - tolerance 1e-05; - relTol 0; - } - - B - { - solver PBiCG; - preconditioner DILU; - tolerance 1e-05; - relTol 0; - } - - nuTilda - { - solver PBiCG; - preconditioner DILU; + $U; tolerance 1e-05; relTol 0; } } -PISO +PIMPLE { + nOuterCorrectors 1; nCorrectors 2; nNonOrthogonalCorrectors 0; pRefCell 1001; diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution index 570725e737..c93b34506b 100644 --- a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution @@ -128,7 +128,7 @@ relaxationFactors } equations { - "(U|k|epsilon|omega|R|nuTilda)" 1; + "(U|k|epsilon|omega|R|nuTilda).*" 1; } }