From c78bbf63ac64894835bf9f0e72e5c564cefc70d8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 Mar 2009 12:49:08 +0000 Subject: [PATCH 01/25] added typename --- .../displacementFvMotionSolver/displacementFvMotionSolver.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C index aee52c717c..b94a1d77be 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C @@ -32,8 +32,8 @@ License namespace Foam { -// defineTypeNameAndDebug(displacementFvMotionSolver, 0); -// + defineTypeNameAndDebug(displacementFvMotionSolver, 0); + // addToRunTimeSelectionTable // ( // fvMotionSolver, From ba36ccf55adf5854a8efe45fc8d2c9b09de853f1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 Mar 2009 12:49:34 +0000 Subject: [PATCH 02/25] check for decomposed cyclics causing different number of points --- .../processor/processorPointPatch.C | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C index 6ef8787d77..eee664b1fb 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C @@ -236,6 +236,7 @@ void processorPointPatch::initPatchPatchPoints() ); toNeighbProc + << ppmp.size() // number of points for checking << patchPatchPoints << patchPatchPointNormals; @@ -257,13 +258,33 @@ void Foam::processorPointPatch::calcPatchPatchPoints() neighbProcNo() ); + label nbrNPoints(readLabel(fromNeighbProc)); labelListList patchPatchPoints(fromNeighbProc); List > patchPatchPointNormals(fromNeighbProc); pointBoundaryMesh& pbm = const_cast(boundaryMesh()); - const labelList& ppmp = meshPoints(); + // Simple check for the very rare situation when not the same number + // of points on both sides. This can happen with decomposed cyclics. + // If on one side the cyclic shares a point with proc faces coming from + // internal faces it will have a different number of points from + // the situation where the cyclic and the 'normal' proc faces are fully + // separate. + if (nbrNPoints != ppmp.size()) + { + WarningIn("processorPointPatch::calcPatchPatchPoints()") + << "Processor patch " << name() + << " has " << ppmp.size() << " points; coupled patch has " + << nbrNPoints << " points." << endl + << " (usually due to decomposed cyclics)." + << " This might give problems" << endl + << " when using point fields (interpolation, mesh motion)." + << endl; + } + + + // Loop over the patches looking for other patches that share points forAll(patchPatchPoints, patchi) { From fe55f58d461e75d39238dbbd9492c0da07214154 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 23 Mar 2009 16:35:53 +0000 Subject: [PATCH 03/25] new turbulence setup --- .../t-junction/constant/turbulenceProperties | 20 +++++++++++++++++++ .../pimpleFoam/t-junction/system/controlDict | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 tutorials/incompressible/pimpleFoam/t-junction/constant/turbulenceProperties diff --git a/tutorials/incompressible/pimpleFoam/t-junction/constant/turbulenceProperties b/tutorials/incompressible/pimpleFoam/t-junction/constant/turbulenceProperties new file mode 100644 index 0000000000..a18cc53b5b --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/t-junction/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.5 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RASModel; + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict b/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict index a5ba827eec..22f3756880 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict @@ -62,6 +62,8 @@ functions ( 0.21 0 0.01 ) ); fields ( p U ); + outputControl outputTime; + outputInterval 1; } } From 852d9f32982594bf4ff63fda41b083bc31145855 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 23 Mar 2009 18:39:29 +0100 Subject: [PATCH 04/25] #undef VTKPV3FOAM_DUALPORT to disable dual-port output for paraview reader --- .../PV3FoamReader/vtkPV3FoamReader.cxx | 27 ++++++++++++------- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 3 ++- .../PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H | 2 ++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx index 0d99f3e95b..47e919c9c3 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/PV3FoamReader/vtkPV3FoamReader.cxx @@ -50,6 +50,7 @@ vtkPV3FoamReader::vtkPV3FoamReader() output0_ = NULL; +#ifdef VTKPV3FOAM_DUALPORT // Add second output for the Lagrangian this->SetNumberOfOutputPorts(2); vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New(); @@ -57,6 +58,7 @@ vtkPV3FoamReader::vtkPV3FoamReader() this->GetExecutive()->SetOutputData(1, lagrangian); lagrangian->Delete(); +#endif TimeStepRange[0] = 0; TimeStepRange[1] = 0; @@ -319,15 +321,6 @@ int vtkPV3FoamReader::RequestData ) ); - vtkMultiBlockDataSet* lagrangianOutput = vtkMultiBlockDataSet::SafeDownCast - ( - outputVector->GetInformationObject(1)->Get - ( - vtkMultiBlockDataSet::DATA_OBJECT() - ) - ); - - if (Foam::vtkPV3Foam::debug) { cout<< "update output with " @@ -376,7 +369,21 @@ int vtkPV3FoamReader::RequestData #else - foamData_->Update(output, lagrangianOutput); +#ifdef VTKPV3FOAM_DUALPORT + foamData_->Update + ( + output, + vtkMultiBlockDataSet::SafeDownCast + ( + outputVector->GetInformationObject(1)->Get + ( + vtkMultiBlockDataSet::DATA_OBJECT() + ) + ); + ); +#else + foamData_->Update(output, output); +#endif if (ShowPatchNames) { diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 624358b4a0..118e99fc91 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -465,7 +465,6 @@ void Foam::vtkPV3Foam::Update cout<< " Foam::vtkPV3Foam::Update - output with " << output->GetNumberOfBlocks() << " and " << lagrangianOutput->GetNumberOfBlocks() << " blocks\n"; - output->Print(cout); lagrangianOutput->Print(cout); printMemory(); @@ -504,8 +503,10 @@ void Foam::vtkPV3Foam::Update reader_->UpdateProgress(0.7); } +#ifdef VTKPV3FOAM_DUALPORT // restart port1 at block=0 blockNo = 0; +#endif convertMeshLagrangian(lagrangianOutput, blockNo); reader_->UpdateProgress(0.8); diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index c6dd65af9e..4e203eacec 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -71,6 +71,8 @@ SourceFiles #include "PrimitivePatchInterpolation.H" #include "volPointInterpolation.H" +#undef VTKPV3FOAM_DUALPORT + // * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // class vtkDataArraySelection; From 232d22a7a10ac47f9e0ba970fc923d24f4154149 Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 23 Mar 2009 19:25:17 +0000 Subject: [PATCH 05/25] New version from Niklas. --- .../engineCompRatio/engineCompRatio.C | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C b/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C index 34ebbc75dc..65356b382b 100644 --- a/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C +++ b/applications/utilities/postProcessing/miscellaneous/engineCompRatio/engineCompRatio.C @@ -40,57 +40,50 @@ Description int main(int argc, char *argv[]) { + #include "setRootCase.H" + #include "createEngineTime.H" + #include "createEngineMesh.H" -# include "setRootCase.H" -# include "createEngineTime.H" -# include "createEngineMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // scalar eps = 1.0e-10; scalar fullCycle = 360.0; scalar ca0 = -180.0; scalar ca1 = 0.0; - scalar ca = runTime.theta(); - while (ca > ca0) + while (runTime.theta() > ca0) { ca0 += fullCycle; ca1 += fullCycle; } - if (mag(ca - ca0) > eps) + while (mag(runTime.theta() - ca0) > eps) { - while(mag(ca - ca0) > eps) - { - ca = runTime.theta(); - scalar t0 = runTime.userTimeToTime(ca0 - ca); - runTime.setDeltaT(t0); - runTime++; - Info << "CA = " << ca << endl; - mesh.move(); - } + scalar t0 = runTime.userTimeToTime(ca0 - runTime.theta()); + runTime.setDeltaT(t0); + runTime++; + Info<< "CA = " << runTime.theta() << endl; + mesh.move(); } scalar Vmax = sum(mesh.V().field()); - while(mag(ca-ca1) > eps) + while (mag(runTime.theta()-ca1) > eps) { - ca = runTime.theta(); - scalar t1 = runTime.userTimeToTime(ca1-ca); + scalar t1 = runTime.userTimeToTime(ca1-runTime.theta()); runTime.setDeltaT(t1); runTime++; - Info << "CA = " << runTime.theta() << endl; + Info<< "CA = " << runTime.theta() << endl; mesh.move(); } scalar Vmin = sum(mesh.V().field()); - Info << "\nVmax = " << Vmax; - Info << ", Vmin = " << Vmin << endl; - Info << "Vmax/Vmin = " << Vmax/Vmin << endl; - Info << "\n end\n"; + Info<< "\nVmax = " << Vmax; + Info<< ", Vmin = " << Vmin << endl; + Info<< "Vmax/Vmin = " << Vmax/Vmin << endl; + Info<< "\nEnd" << endl; return 0; } From b5b5ed12164cb6edc78d6eda897f3809efeb4294 Mon Sep 17 00:00:00 2001 From: henry Date: Mon, 23 Mar 2009 22:30:04 +0000 Subject: [PATCH 06/25] Reinstated defineTypeNameAndDebug to remove the "undefined" error in compiling the mesh-motion solvers. --- .../displacementFvMotionSolver.C | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C b/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C index aee52c717c..aa3d51bd4f 100644 --- a/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C +++ b/src/fvMotionSolver/fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C @@ -32,23 +32,13 @@ License namespace Foam { -// defineTypeNameAndDebug(displacementFvMotionSolver, 0); -// -// addToRunTimeSelectionTable -// ( -// fvMotionSolver, -// displacementFvMotionSolver, -// dictionary -// ); + defineTypeNameAndDebug(displacementFvMotionSolver, 0); } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::displacementFvMotionSolver:: -displacementFvMotionSolver +Foam::displacementFvMotionSolver::displacementFvMotionSolver ( const polyMesh& mesh, Istream& From f663c782779322f946a4012bad21e90ca620a2b7 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Mar 2009 09:59:45 +0000 Subject: [PATCH 07/25] updates --- .../greyDiffusiveRadiationMixedFvPatchScalarField.C | 5 ++++- .../wideBandDiffusiveRadiationMixedFvPatchScalarField.C | 5 ++++- .../fvDOM/radiativeIntensityRay/radiativeIntensityRay.C | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index e7daa58aaf..1f9a6ac63c 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -151,7 +151,10 @@ updateCoeffs() const scalarField& Tp = patch().lookupPatchField(TName_); - const fvDOM& dom = db().lookupObject("radiationProperties"); + const radiationModel& radiation = + db().lookupObject("radiationProperties"); + + const fvDOM& dom(refCast(radiation)); const label patchI = patch().index(); diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index eb65337aca..eec4d22021 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -147,7 +147,10 @@ updateCoeffs() return; } - const fvDOM& dom = db().lookupObject("radiationProperties"); + const radiationModel& radiation = + db().lookupObject("radiationProperties"); + + const fvDOM& dom(refCast(radiation)); const label patchI = patch().index(); diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C index 96090a3ef2..74ec95827c 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C @@ -182,7 +182,7 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct() fvScalarMatrix IiEq ( - fvm::div(Ji, ILambda_[lambdaI], " div(Ji,Ii_h)") + fvm::div(Ji, ILambda_[lambdaI], "div(Ji,Ii_h)") + fvm::Sp(k*omega_, ILambda_[lambdaI]) == 1.0/Foam::mathematicalConstant::pi From 98363e5825c888640e26fcdc32b1fce1e73dcc9e Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Mar 2009 11:47:42 +0000 Subject: [PATCH 08/25] updated database --- .../radiation/radiationModel/radiationModel/radiationModel.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C b/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C index 131221c308..92c6397fb5 100644 --- a/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiation/radiationModel/radiationModel/radiationModel.C @@ -51,7 +51,7 @@ Foam::radiation::radiationModel::radiationModel(const volScalarField& T) ( "radiationProperties", T.time().constant(), - T.mesh().objectRegistry::db(), + T.mesh(), IOobject::MUST_READ, IOobject::NO_WRITE ) @@ -79,7 +79,7 @@ Foam::radiation::radiationModel::radiationModel ( "radiationProperties", T.time().constant(), - T.mesh().objectRegistry::db(), + T.mesh(), IOobject::MUST_READ, IOobject::NO_WRITE ) From 590293fe955f1d5e39433c338c12a4b8b16687dc Mon Sep 17 00:00:00 2001 From: henry Date: Tue, 24 Mar 2009 12:14:33 +0000 Subject: [PATCH 09/25] Use the PIMPLE rather than PISO dictionary. --- .../incompressible/pimpleDyMFoam/createFields.H | 3 +-- .../incompressible/pimpleDyMFoam/pimpleDyMFoam.C | 2 +- .../incompressible/pimpleDyMFoam/readControls.H | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/applications/solvers/incompressible/pimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleDyMFoam/createFields.H index ff3f9c5169..bc798ba988 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/createFields.H @@ -1,4 +1,3 @@ - Info<< "Reading field p\n" << endl; volScalarField p ( @@ -33,7 +32,7 @@ label pRefCell = 0; scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue); + setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue); singlePhaseTransportModel laminarTransport(U, phi); diff --git a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C index b705d2bbb7..9dc779fa23 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleDyMFoam/pimpleDyMFoam.C @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) # include "createTime.H" # include "createDynamicFvMesh.H" -# include "readPISOControls.H" +# include "readPIMPLEControls.H" # include "initContinuityErrs.H" # include "createFields.H" # include "readTimeControls.H" diff --git a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H b/applications/solvers/incompressible/pimpleDyMFoam/readControls.H index 9336616a1b..3bd20c5c5c 100644 --- a/applications/solvers/incompressible/pimpleDyMFoam/readControls.H +++ b/applications/solvers/incompressible/pimpleDyMFoam/readControls.H @@ -1,14 +1,14 @@ # include "readTimeControls.H" -# include "readPISOControls.H" +# include "readPIMPLEControls.H" bool correctPhi = false; - if (piso.found("correctPhi")) + if (pimple.found("correctPhi")) { - correctPhi = Switch(piso.lookup("correctPhi")); + correctPhi = Switch(pimple.lookup("correctPhi")); } bool checkMeshCourantNo = false; - if (piso.found("checkMeshCourantNo")) + if (pimple.found("checkMeshCourantNo")) { - checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo")); + checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo")); } From cb96ef9a3056916af08e84c686e2ab45a1b220a1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 24 Mar 2009 13:41:35 +0100 Subject: [PATCH 10/25] fixed stupid replacement error introduced by 0bada1e31b625ee3d9146b1cec01e77b934395cd --- src/OpenFOAM/db/dictionary/dictionary.C | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 8c351510e7..fd89f0f608 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -529,7 +529,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) } else { - IOWarningIn("dictionary::add(entry*)", (*this)) + IOWarningIn("dictionary::add(entry*, bool)", (*this)) << "problem replacing entry "<< entryPtr->keyword() << " in dictionary " << name() << endl; @@ -558,7 +558,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) } else { - IOWarningIn("dictionary::add(entry* entryPtr)", (*this)) + IOWarningIn("dictionary::add(entry*, bool)", (*this)) << "attempt to add entry "<< entryPtr->keyword() << " which already exists in dictionary " << name() << endl; @@ -574,11 +574,13 @@ void Foam::dictionary::add(const entry& e, bool mergeEntry) add(e.clone(*this).ptr(), mergeEntry); } + void Foam::dictionary::add(const keyType& k, const word& w, bool overwrite) { add(new primitiveEntry(k, token(w)), overwrite); } + void Foam::dictionary::add ( const keyType& k, @@ -589,16 +591,19 @@ void Foam::dictionary::add add(new primitiveEntry(k, token(s)), overwrite); } + void Foam::dictionary::add(const keyType& k, const label l, bool overwrite) { add(new primitiveEntry(k, token(l)), overwrite); } + void Foam::dictionary::add(const keyType& k, const scalar s, bool overwrite) { add(new primitiveEntry(k, token(s)), overwrite); } + void Foam::dictionary::add ( const keyType& k, @@ -628,6 +633,7 @@ void Foam::dictionary::set(const entry& e) set(e.clone(*this).ptr()); } + void Foam::dictionary::set(const keyType& k, const dictionary& d) { set(new dictionaryEntry(k, *this, d)); @@ -770,7 +776,7 @@ bool Foam::dictionary::merge(const dictionary& dict) bool changed = false; - forAllConstIter(IDLList, *this, iter) + forAllConstIter(IDLList, dict, iter) { HashTable::iterator fnd = hashedEntries_.find(iter().keyword()); From e0c1ac3baeea2700f8d6aa8b1ffc9ec24080afce Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Mar 2009 12:52:59 +0000 Subject: [PATCH 11/25] cosmetics --- .../radiationModel/fvDOM/fvDOM/fvDOM.H | 17 +++++++---------- .../radiativeIntensityRay.C | 9 ++++----- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.H b/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.H index 3cbd921406..1d2662e307 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.H +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.H @@ -37,19 +37,19 @@ Description i.e. dictionary fvDOMCoeffs { - Nphi 1; // azimuthal angles in PI/2 on X-Y.(from Y to X) - Ntheta 2; // polar angles in P1 (from Z to X-Y plane) + nPhi 1; // azimuthal angles in PI/2 on X-Y.(from Y to X) + nTheta 2; // polar angles in PI (from Z to X-Y plane) convergence 1e-4; // convergence criteria for radiation iteration } - nFlowIterPerRadIter 1; // Number of flow iterations per radiation + solverFreq 1; // Number of flow iterations per radiation iteration - The total number of solid angles is 4*Nphi*Ntheta. + The total number of solid angles is 4*nPhi*nTheta. - In 1D the direction of the rays is X (Nphi and Ntheta are ignored) - In 2D the direction of the rays is on X-Y plane (only Nphi is considered) - In 3D (Nphi and Ntheta are considered) + In 1D the direction of the rays is X (nPhi and nTheta are ignored) + In 2D the direction of the rays is on X-Y plane (only nPhi is considered) + In 3D (nPhi and nTheta are considered) SourceFiles fvDOM.C @@ -127,9 +127,6 @@ class fvDOM //- Disallow default bitwise assignment void operator=(const fvDOM&); - //- Update Absorption Coefficients -// void updateAbsorptionCoeffs(void); - //- Update nlack body emission void updateBlackBodyEmission(); diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C index 74ec95827c..cba8dd855a 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C @@ -113,11 +113,11 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay 0.5*deltaPhi*Foam::sin(2.0*theta)*Foam::sin(deltaTheta) ); - forAll(ILambda_, i) + forAll(ILambda_, lambdaI) { IOobject IHeader ( - "ILambda_" + name(rayId) + "_" + name(i), + "ILambda_" + name(rayId) + "_" + name(lambdaI), mesh_.time().timeName(), mesh_, IOobject::MUST_READ, @@ -129,7 +129,7 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay { ILambda_.set ( - i, + lambdaI, new volScalarField(IHeader, mesh_) ); } @@ -150,7 +150,7 @@ Foam::radiation::radiativeIntensityRay::radiativeIntensityRay ILambda_.set ( - i, + lambdaI, new volScalarField(IHeader, IDefault) ); } @@ -201,7 +201,6 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct() ).initialResidual(); maxResidual = max(eqnResidual, maxResidual); - } return maxResidual; From 78ec9c1a8d43f79e257c66ea6add43c140d0bb2a Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 24 Mar 2009 13:42:04 +0000 Subject: [PATCH 12/25] comments --- src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C | 2 ++ src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C index aff80a2ac3..d0b81bc8c2 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C @@ -32,6 +32,7 @@ defineTypeNameAndDebug(Foam::dynamicFvMesh, 0); defineRunTimeSelectionTable(Foam::dynamicFvMesh, IOobject); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io) @@ -45,4 +46,5 @@ Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io) Foam::dynamicFvMesh::~dynamicFvMesh() {} + // ************************************************************************* // diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H index dc437ea48e..04d7a69e59 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H @@ -26,7 +26,7 @@ Class Foam::dynamicFvMesh Description - The dynamicFvMesh is .. + Abstract base class for geometry and/or topology changing fvMesh. SourceFiles dynamicFvMesh.C From 6b3c5e22e2286cbae69dd162e2a7ab0fe3e90ac5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 24 Mar 2009 13:42:30 +0000 Subject: [PATCH 13/25] minor change --- .../movingConeTopoFvMesh/movingConeTopoFvMesh.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C index 2f3804afde..dedf725e24 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C +++ b/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C @@ -343,7 +343,7 @@ bool Foam::movingConeTopoFvMesh::update() // << endl; { - OFstream str(thisDb().path()/"meshPoints.obj"); + OFstream str(time().timePath()/"meshPoints.obj"); Pout<< "Writing mesh with meshPoints to " << str.name() << endl; @@ -361,7 +361,7 @@ bool Foam::movingConeTopoFvMesh::update() } } { - OFstream str(thisDb().path()/"preMotionPoints.obj"); + OFstream str(time().timePath()/"preMotionPoints.obj"); Pout<< "Writing mesh with preMotionPoints to " << str.name() << endl; From 950c77117b80dd23435911fd8aaa547b9e8c8aff Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 24 Mar 2009 18:02:42 +0000 Subject: [PATCH 14/25] comment --- .../pimpleFoam/t-junction/0/epsilon | 2 +- .../incompressible/pimpleFoam/t-junction/0/k | 2 +- .../incompressible/pimpleFoam/t-junction/0/p | 10 ++++++++-- .../pimpleFoam/t-junction/constant/p0vsTime | 4 ++++ .../pimpleFoam/t-junction/system/controlDict | 16 +++++++++++----- 5 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 tutorials/incompressible/pimpleFoam/t-junction/constant/p0vsTime diff --git a/tutorials/incompressible/pimpleFoam/t-junction/0/epsilon b/tutorials/incompressible/pimpleFoam/t-junction/0/epsilon index 2c4cfab1c0..5b446a2d8a 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction/0/epsilon +++ b/tutorials/incompressible/pimpleFoam/t-junction/0/epsilon @@ -24,7 +24,7 @@ boundaryField inlet { type turbulentMixingLengthDissipationRateInlet; - mixingLength 0.01; + mixingLength 0.01; // 1cm - half channel height value uniform 1; } diff --git a/tutorials/incompressible/pimpleFoam/t-junction/0/k b/tutorials/incompressible/pimpleFoam/t-junction/0/k index 51c0ab7cd3..ad217bc9e4 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction/0/k +++ b/tutorials/incompressible/pimpleFoam/t-junction/0/k @@ -24,7 +24,7 @@ boundaryField inlet { type turbulentIntensityKineticEnergyInlet; - intensity 0.05; + intensity 0.05; // 5% turbulent intensity value uniform 1; } diff --git a/tutorials/incompressible/pimpleFoam/t-junction/0/p b/tutorials/incompressible/pimpleFoam/t-junction/0/p index b3d4646058..2446eb2f7c 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction/0/p +++ b/tutorials/incompressible/pimpleFoam/t-junction/0/p @@ -22,8 +22,14 @@ boundaryField { inlet { - type totalPressure; - p0 uniform 100040; + //type totalPressure; + //p0 uniform 100040; + + type timeVaryingTotalPressure; + p0 100040; // only used for restarts + outOfBounds clamp; + fileName "$FOAM_CASE/constant/p0vsTime"; + U U; phi phi; rho none; diff --git a/tutorials/incompressible/pimpleFoam/t-junction/constant/p0vsTime b/tutorials/incompressible/pimpleFoam/t-junction/constant/p0vsTime new file mode 100644 index 0000000000..a9ee6bb3e7 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/t-junction/constant/p0vsTime @@ -0,0 +1,4 @@ +( + (0 100010) + (1 100040) +) diff --git a/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict b/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict index 22f3756880..2d7aaa81da 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/t-junction/system/controlDict @@ -52,16 +52,22 @@ functions probes { type probes; - name probes; + // Where to load it from functionObjectLibs ( "libsampling.so" ); + // Name of the directory for probe data + name probes; probeLocations ( - ( 1e-06 0 0.01 ) - ( 0.21 -0.20999 0.01 ) - ( 0.21 0.20999 0.01 ) - ( 0.21 0 0.01 ) + ( 1e-06 0 0.01 ) // at inlet + ( 0.21 -0.20999 0.01 ) // at outlet1 + ( 0.21 0.20999 0.01 ) // at outlet2 + ( 0.21 0 0.01 ) // at central block ); + + // Fields to be probed fields ( p U ); + + // Write at same frequency as fields outputControl outputTime; outputInterval 1; } From f8c6cfe0b5f50596a53ec206aab327d2f90a2f13 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 26 Mar 2009 11:34:13 +0000 Subject: [PATCH 15/25] added construct by components --- .../interpolationTable/interpolationTable.C | 18 ++++++++++++++++-- .../interpolationTable/interpolationTable.H | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C index aa6d0d750f..9ea1307ee1 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C +++ b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C @@ -67,11 +67,25 @@ Foam::interpolationTable::interpolationTable() template -Foam::interpolationTable::interpolationTable(const fileName& fn) +Foam::interpolationTable::interpolationTable +( + const List >& values, + const boundsHandling bounds, + const fileName& fName +) +: + List >(values), + boundsHandling_(bounds), + fileName_(fName) +{} + + +template +Foam::interpolationTable::interpolationTable(const fileName& fName) : List >(), boundsHandling_(interpolationTable::WARN), - fileName_(fn) + fileName_(fName) { readTable(); } diff --git a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H index 2637ccf808..884c3cabd7 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H +++ b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H @@ -102,8 +102,16 @@ public: //- Construct null interpolationTable(); + //- Construct from components + interpolationTable + ( + const List >& values, + const boundsHandling bounds, + const fileName& fName + ); + //- Construct given the name of the file containing the table of data - interpolationTable(const fileName& fn); + interpolationTable(const fileName& fName); //- Construct by reading the fileName and boundsHandling from dictionary // and read the table from that file. From dae6cbbea7580c5de320f7cccd3f61eb0b660c96 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 26 Mar 2009 11:34:32 +0000 Subject: [PATCH 16/25] cosmetics --- .../interpolationLookUpTable.C | 82 ++++++++----------- .../interpolationLookUpTable.H | 12 +-- .../greyMeanAbsorptionEmission.H | 2 +- 3 files changed, 42 insertions(+), 54 deletions(-) diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.C index e9e28658c4..f000e43fa3 100755 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.C @@ -29,23 +29,23 @@ License // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template -Foam::label Foam::interpolationLookUpTable ::index +Foam::label Foam::interpolationLookUpTable::index ( const List& indices, const bool lastDim ) const { - label totalindex = 0; + label totalIndex = 0; - for (int i = 0; i < dim_.size() - 1; i++) + forAll(dim_, i) { label dim = 1; for (int j = i + 1; j < dim_.size(); j++) { - dim *=(dim_[j]+1); + dim *= dim_[j] + 1; } - totalindex += + totalIndex += dim *min ( @@ -57,7 +57,7 @@ Foam::label Foam::interpolationLookUpTable ::index if (lastDim) { label iLastdim = dim_.size() - 1; - totalindex += Foam::min + totalIndex += Foam::min ( max ( @@ -68,12 +68,12 @@ Foam::label Foam::interpolationLookUpTable ::index ); } - return totalindex; + return totalIndex; } template -Foam::label Foam::interpolationLookUpTable ::index +Foam::label Foam::interpolationLookUpTable::index ( const scalar indice ) const @@ -171,15 +171,15 @@ void Foam::interpolationLookUpTable::dimensionTable() max_[i] = readScalar(entries_[i].lookup("max")); min_[i] = readScalar(entries_[i].lookup("min")); delta_[i] = (max_[i] - min_[i])/dim_[i]; - tableDim *= (dim_[i] + 1); - fieldIndices_.insert(entries_[i].lookup("name"),index); + tableDim *= dim_[i] + 1; + fieldIndices_.insert(entries_[i].lookup("name"), index); entryIndices_[i] = index; index++; } forAll(output_,i) { - fieldIndices_.insert(output_[i].lookup("name"),index); + fieldIndices_.insert(output_[i].lookup("name"), index); outputIndices_[i] = index; index++; } @@ -229,8 +229,7 @@ void Foam::interpolationLookUpTable::readTable FatalErrorIn ( "Foam::interpolationLookUpTable::readTable()" - ) << "table is empty" << nl - << exit(FatalError); + ) << "table is empty" << nl << exit(FatalError); } } @@ -240,7 +239,7 @@ void Foam::interpolationLookUpTable::readTable template Foam::interpolationLookUpTable::interpolationLookUpTable() : - List(), + List(), fileName_("fileNameIsUndefined") {} @@ -251,7 +250,7 @@ Foam::interpolationLookUpTable::interpolationLookUpTable const fileName& fn, const word& instance, const fvMesh& mesh ) : - List(), + List(), fileName_(fn), dim_(0), min_(0), @@ -273,7 +272,7 @@ Foam::interpolationLookUpTable::interpolationLookUpTable const interpolationLookUpTable& interpTable ) : - List(interpTable), + List(interpTable), fileName_(interpTable.fileName_), entryIndices_(interpTable.entryIndices_), outputIndices_(interpTable.outputIndices_), @@ -293,7 +292,7 @@ Foam::interpolationLookUpTable::interpolationLookUpTable const dictionary& dict ) : - List(), + List(), fileName_(fileName(dict.lookup("fileName")).expand()), dim_(0), min_(0.0), @@ -315,20 +314,19 @@ Foam::interpolationLookUpTable::interpolationLookUpTable template void Foam::interpolationLookUpTable::check() const { -// check order in the first dimension. - - scalar prevValue = List::operator[](0).operator[](0); - label dim = 1 ; + // check order in the first dimension. + scalar prevValue = List::operator[](0).operator[](0); + label dim = 1; for (int j = 1; j < dim_.size(); j++) { - dim *=(dim_[j]+1); + dim *= dim_[j] + 1; } for (label i = 1; i < dim_[0]; i++) { label index = i*dim; const scalar currValue = - List::operator[](0).operator[](index); + List::operator[](0).operator[](index); // avoid duplicate values (divide-by-zero error) if (currValue <= prevValue) @@ -336,9 +334,8 @@ void Foam::interpolationLookUpTable::check() const FatalErrorIn ( "Foam::interpolationLookUpTable::checkOrder() const" - ) << "out-of-order value: " - << currValue << " at index " << index << nl - << exit(FatalError); + ) << "out-of-order value: " << currValue + << " at index " << index << nl << exit(FatalError); } prevValue = currValue; } @@ -379,8 +376,7 @@ void Foam::interpolationLookUpTable::write FatalErrorIn ( "Foam::interpolationTable::write()" - ) << "table is empty" << nl - << exit(FatalError); + ) << "table is empty" << nl << exit(FatalError); } os.writeKeyword("values"); os << *this << token::END_STATEMENT << nl; @@ -400,31 +396,25 @@ Foam::interpolationLookUpTable::operator[](const label i) { FatalErrorIn ( - "Foam::interpolationLookUpTable::operator[]" - "(const label) const" - ) << "table has (" << n << ") columns" << nl - << exit(FatalError); + "Foam::interpolationLookUpTable::operator[](const label)" + ) << "table has (" << n << ") columns" << nl << exit(FatalError); } else if (ii < 0) { FatalErrorIn ( - "Foam::interpolationLookUpTable::operator[]" - "(const label) const" - ) << "index (" << ii << ") underflow" << nl - << exit(FatalError); + "Foam::interpolationLookUpTable::operator[](const label)" + ) << "index (" << ii << ") underflow" << nl << exit(FatalError); } else if (ii > n) { FatalErrorIn ( - "Foam::interpolationLookUpTable::operator[]" - "(const label) const" - ) << "index (" << ii << ") overflow" << nl - << exit(FatalError); + "Foam::interpolationLookUpTable::operator[](const label)" + ) << "index (" << ii << ") overflow" << nl << exit(FatalError); } - return List::operator[](ii); + return List::operator[](ii); } @@ -441,8 +431,7 @@ Foam::interpolationLookUpTable::operator[](const label i) const ( "Foam::interpolationLookUpTable::operator[]" "(const label) const" - ) << "table has (" << n << ") columns" << nl - << exit(FatalError); + ) << "table has (" << n << ") columns" << nl << exit(FatalError); } else if (ii < 0) { @@ -450,8 +439,7 @@ Foam::interpolationLookUpTable::operator[](const label i) const ( "Foam::interpolationLookUpTable::operator[]" "(const label) const" - ) << "index (" << ii << ") underflow" << nl - << exit(FatalError); + ) << "index (" << ii << ") underflow" << nl << exit(FatalError); } else if (ii > n) @@ -464,7 +452,7 @@ Foam::interpolationLookUpTable::operator[](const label i) const << exit(FatalError); } - return List::operator[](ii); + return List::operator[](ii); } @@ -500,7 +488,7 @@ void Foam::interpolationLookUpTable::findHi forAll(entryIndices_,i) { - if (checkRange(retvals,entryIndices_[i])) + if (checkRange(retvals, entryIndices_[i])) { label dim = 1; diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.H b/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.H index d2518d4e02..6140ae4bc3 100755 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.H +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/interpolationLookUpTable/interpolationLookUpTable.H @@ -54,7 +54,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interpolationLookUpTable Declaration + Class interpolationLookUpTable Declaration \*---------------------------------------------------------------------------*/ template @@ -64,22 +64,22 @@ class interpolationLookUpTable { private: - // Private data + // Privsate data //- File name fileName fileName_; //- Table dimensions - List