diff --git a/applications/solvers/DNS/dnsFoam/Make/options b/applications/solvers/DNS/dnsFoam/Make/options index 34c3503a51737b0cbe058747a1b9a55fc0ed0282..e0e7a30d72df5ee6b9f4fdc6b4c44aa8724edb50 100644 --- a/applications/solvers/DNS/dnsFoam/Make/options +++ b/applications/solvers/DNS/dnsFoam/Make/options @@ -1,10 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/randomProcesses/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/randomProcesses/lnInclude EXE_LIBS = \ -lfiniteVolume \ - -lrandomProcesses \ - -lsampling \ - -lmeshTools + -lrandomProcesses diff --git a/applications/solvers/basic/scalarTransportFoam/Make/options b/applications/solvers/basic/scalarTransportFoam/Make/options index 725122ea1df804ba46bb14bdca8a527b9e8386cc..e6fbbb80000d244fa102764e6fb9dfc5e361c696 100644 --- a/applications/solvers/basic/scalarTransportFoam/Make/options +++ b/applications/solvers/basic/scalarTransportFoam/Make/options @@ -1,4 +1,11 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude -EXE_LIBS = -lfiniteVolume +EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lmeshTools \ + -lsampling diff --git a/applications/solvers/basic/scalarTransportFoam/createFields.H b/applications/solvers/basic/scalarTransportFoam/createFields.H index 07731be3d6e07f2f23744f180e18eefd4aa573eb..394fe42e9727985bfcb1f939e1df49d572edfe18 100644 --- a/applications/solvers/basic/scalarTransportFoam/createFields.H +++ b/applications/solvers/basic/scalarTransportFoam/createFields.H @@ -45,7 +45,7 @@ ); - Info<< "Reading diffusivity D\n" << endl; + Info<< "Reading diffusivity DT\n" << endl; dimensionedScalar DT ( diff --git a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C index 8eade6a545b2364cdad526c755470f23f734409c..deae96ea02b80c23877ec35fb05305d12e19a57d 100644 --- a/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.C +++ b/applications/solvers/basic/scalarTransportFoam/scalarTransportFoam.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 @@ -30,6 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" +#include "IObasicSourceList.H" #include "simpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,6 +41,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" + #include "createSources.H" simpleControl simple(mesh); @@ -60,6 +62,8 @@ int main(int argc, char *argv[]) fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(DT, T) + == + sources(T) ); } diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options index 135659c2766cb7ec98124f7969e95a8fad1d6f48..b6c6398fdea5b27262b932e70ebb32a5cf5dc078 100644 --- a/applications/solvers/combustion/PDRFoam/Make/options +++ b/applications/solvers/combustion/PDRFoam/Make/options @@ -5,7 +5,6 @@ EXE_INC = \ -IPDRModels/dragModels/PDRDragModel \ -IlaminarFlameSpeed/SCOPE \ -I$(LIB_SRC)/engine/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C index 44c4f6052fbc03448ee8a5f34e9f7b9875578cc0..fb61460facf54a6f03625b2fb9e0046b3aed6e6d 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.C @@ -116,7 +116,7 @@ void PDRkEpsilon::correct() } tmp<volTensorField> tgradU = fvc::grad(U_); - volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update espsilon and G at the wall diff --git a/applications/solvers/combustion/XiFoam/EaEqn.H b/applications/solvers/combustion/XiFoam/EaEqn.H index 6840c4eb6d0893d5697a812f91e8b68d7c446ffc..2565e3f9e3aa4c6a7ac0ba6ee18c0311a2d6f32e 100644 --- a/applications/solvers/combustion/XiFoam/EaEqn.H +++ b/applications/solvers/combustion/XiFoam/EaEqn.H @@ -16,10 +16,16 @@ : -dpdt ) - fvm::laplacian(turbulence->alphaEff(), hea) + + sources(rho, hea) ); EaEqn.relax(); + + sources.constrain(EaEqn); + EaEqn.solve(); + sources.correct(hea); + thermo.correct(); } diff --git a/applications/solvers/combustion/XiFoam/EauEqn.H b/applications/solvers/combustion/XiFoam/EauEqn.H index b13a63bb60b0c0bc852df6c7413021764adced61..092cdc2a6d8546e54e3a1299a6e79887da1e9720 100644 --- a/applications/solvers/combustion/XiFoam/EauEqn.H +++ b/applications/solvers/combustion/XiFoam/EauEqn.H @@ -2,7 +2,7 @@ if (ign.ignited()) { volScalarField& heau = thermo.heu(); - solve + fvScalarMatrix heauEqn ( fvm::ddt(rho, heau) + mvConvection->fvmDiv(phi, heau) + (fvc::ddt(rho, K) + fvc::div(phi, K))*rho/thermo.rhou() @@ -23,5 +23,14 @@ if (ign.ignited()) // A possible solution would be to solve for ftu as well as ft. //- fvm::div(muEff*fvc::grad(b)/(b + 0.001), heau) //+ fvm::Sp(fvc::div(muEff*fvc::grad(b)/(b + 0.001)), heau) + + == + sources(rho, heau) ); + + sources.constrain(heauEqn); + + heauEqn.solve(); + + sources.correct(heau); } diff --git a/applications/solvers/combustion/XiFoam/Make/options b/applications/solvers/combustion/XiFoam/Make/options index 0812df5e3bf3bb3979d1bde18c97acb35b91583d..fdebdc8ce844bc066f0a6e3d2806a5fb4f4399d6 100644 --- a/applications/solvers/combustion/XiFoam/Make/options +++ b/applications/solvers/combustion/XiFoam/Make/options @@ -1,14 +1,20 @@ EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude\ -I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lsampling \ + -lmeshTools \ -lengine \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ @@ -16,6 +22,4 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lreactionThermophysicalModels \ -lspecie \ - -llaminarFlameSpeedModels \ - -lfiniteVolume \ - -lmeshTools + -llaminarFlameSpeedModels diff --git a/applications/solvers/combustion/XiFoam/UEqn.H b/applications/solvers/combustion/XiFoam/UEqn.H index b9bc567aae9107cd8d687ec4666488586472f863..95f10bfcc9673d3908bffe5ea6355185c9f9838f 100644 --- a/applications/solvers/combustion/XiFoam/UEqn.H +++ b/applications/solvers/combustion/XiFoam/UEqn.H @@ -5,12 +5,17 @@ + turbulence->divDevRhoReff(U) == rho*g + + sources(rho, U) ); UEqn.relax(); + sources.constrain(UEqn); + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/combustion/XiFoam/XiFoam.C b/applications/solvers/combustion/XiFoam/XiFoam.C index 1573ede331f4406c0645b40d6b7bba92507a43ec..bebbd49266f42eb1c839e5126799d5e6aa225e46 100644 --- a/applications/solvers/combustion/XiFoam/XiFoam.C +++ b/applications/solvers/combustion/XiFoam/XiFoam.C @@ -56,6 +56,7 @@ Description #include "ignition.H" #include "Switch.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,6 +69,7 @@ int main(int argc, char *argv[]) #include "readCombustionProperties.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/combustion/XiFoam/bEqn.H b/applications/solvers/combustion/XiFoam/bEqn.H index ff19598ba13b3298cd00103564765b359be3104c..e10be7b6dfae01f3e551c6f2c30bb0db68a6a01d 100644 --- a/applications/solvers/combustion/XiFoam/bEqn.H +++ b/applications/solvers/combustion/XiFoam/bEqn.H @@ -34,7 +34,7 @@ if (ign.ignited()) // Calculate turbulent flame speed flux // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - surfaceScalarField phiSt(fvc::interpolate(rhou*StCorr*Su*Xi)*nf); + surfaceScalarField phiSt("phiSt", fvc::interpolate(rhou*StCorr*Su*Xi)*nf); scalar StCoNum = max ( @@ -50,9 +50,11 @@ if (ign.ignited()) ( fvm::ddt(rho, b) + mvConvection->fvmDiv(phi, b) - + fvm::div(phiSt, b, "div(phiSt,b)") + + fvm::div(phiSt, b) - fvm::Sp(fvc::div(phiSt), b) - fvm::laplacian(turbulence->alphaEff(), b) + == + sources(rho, b) ); @@ -64,8 +66,13 @@ if (ign.ignited()) // Solve for b // ~~~~~~~~~~~ bEqn.relax(); + + sources.constrain(bEqn); + bEqn.solve(); + sources.correct(b); + Info<< "min(b) = " << min(b).value() << endl; @@ -153,11 +160,17 @@ if (ign.ignited()) == - fvm::SuSp(-rho*Rc*Su0/Su, Su) - fvm::SuSp(rho*(sigmas + Rc), Su) + + sources(rho, Su) ); SuEqn.relax(); + + sources.constrain(SuEqn); + SuEqn.solve(); + sources.correct(Su); + // Limit the maximum Su // ~~~~~~~~~~~~~~~~~~~~ Su.min(SuMax); @@ -234,11 +247,17 @@ if (ign.ignited()) ), Xi ) + + sources(rho, Xi) ); XiEqn.relax(); + + sources.constrain(XiEqn); + XiEqn.solve(); + sources.correct(Xi); + // Correct boundedness of Xi // ~~~~~~~~~~~~~~~~~~~~~~~~~ Xi.max(1.0); diff --git a/applications/solvers/combustion/XiFoam/ftEqn.H b/applications/solvers/combustion/XiFoam/ftEqn.H index 96dbc3f06b6b6aa383d4833a79d20a3af96b5925..013e8b3180fa2f44ea2668ea12ed07b0a3d289c2 100644 --- a/applications/solvers/combustion/XiFoam/ftEqn.H +++ b/applications/solvers/combustion/XiFoam/ftEqn.H @@ -13,10 +13,18 @@ if (composition.contains("ft")) { volScalarField& ft = composition.Y("ft"); - solve + fvScalarMatrix ftEqn ( fvm::ddt(rho, ft) + mvConvection->fvmDiv(phi, ft) - fvm::laplacian(turbulence->alphaEff(), ft) + == + sources(rho, ft) ); + + sources.constrain(ftEqn); + + ftEqn.solve(); + + sources.correct(ft); } diff --git a/applications/solvers/combustion/XiFoam/pEqn.H b/applications/solvers/combustion/XiFoam/pEqn.H index 1543ca539a6793ee15b3df87dec596e415600422..b5a6d173fbe4a1b2c5bd4ef2feb89a1550c5bb40 100644 --- a/applications/solvers/combustion/XiFoam/pEqn.H +++ b/applications/solvers/combustion/XiFoam/pEqn.H @@ -16,6 +16,8 @@ if (pimple.transonic()) ) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -23,8 +25,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -45,6 +51,8 @@ else ) ); + sources.relativeFlux(phiHbyA); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -52,8 +60,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -68,6 +80,7 @@ else U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/combustion/chemFoam/Make/options b/applications/solvers/combustion/chemFoam/Make/options index 7b95c2f16f7a1edd45273879385e064d33ebe805..9facf7ac9c065e01dd5231bdc20edb52f5f49429 100644 --- a/applications/solvers/combustion/chemFoam/Make/options +++ b/applications/solvers/combustion/chemFoam/Make/options @@ -12,6 +12,7 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lreactionThermophysicalModels \ -lfluidThermophysicalModels \ diff --git a/applications/solvers/combustion/coldEngineFoam/Make/options b/applications/solvers/combustion/coldEngineFoam/Make/options index 25217ab23f79c72d9f81c2aba8eb51c0ae138c30..2eaea744b0c5e93ec6a199f72e5463679da2333d 100644 --- a/applications/solvers/combustion/coldEngineFoam/Make/options +++ b/applications/solvers/combustion/coldEngineFoam/Make/options @@ -20,6 +20,5 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lspecie \ -lfiniteVolume \ - -lsampling \ -lmeshTools \ -lfieldSources diff --git a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C index 401690c3e49a263443da462ebca49c6a11863329..3b229ded146743f05850756199267cd92a9d1c3b 100644 --- a/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C +++ b/applications/solvers/combustion/coldEngineFoam/coldEngineFoam.C @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) #include "createEngineTime.H" #include "createEngineMesh.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" #include "readEngineTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/combustion/coldEngineFoam/createFields.H b/applications/solvers/combustion/coldEngineFoam/createFields.H index 72e88435aceacbf2d6fa546b068157dc7caf0de3..f78e5bde2969cd6935e3bccec61887da6f9a2905 100644 --- a/applications/solvers/combustion/coldEngineFoam/createFields.H +++ b/applications/solvers/combustion/coldEngineFoam/createFields.H @@ -69,6 +69,3 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); - - Info<< "Creating sources\n" << endl; - IObasicSourceList sources(mesh); diff --git a/applications/solvers/combustion/engineFoam/Make/options b/applications/solvers/combustion/engineFoam/Make/options index ff38fdf05192bcfac7d2133718dadd6fdd3cb721..c7b3219f2d7f3bbed8115f1c2cda16e3dfda57b6 100644 --- a/applications/solvers/combustion/engineFoam/Make/options +++ b/applications/solvers/combustion/engineFoam/Make/options @@ -1,14 +1,21 @@ EXE_INC = \ - -I../XiFoam \ + -I$(FOAM_SOLVERS)/combustion/XiFoam \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lsampling \ + -lmeshTools \ -lengine \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ @@ -16,5 +23,4 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lreactionThermophysicalModels \ -lspecie \ - -llaminarFlameSpeedModels \ - -lfiniteVolume + -llaminarFlameSpeedModels diff --git a/applications/solvers/combustion/engineFoam/UEqn.H b/applications/solvers/combustion/engineFoam/UEqn.H index f110051946816e9a0f3aab7160c3681af6317377..a8b0207225579307ad9985248ca386f51b992ff7 100644 --- a/applications/solvers/combustion/engineFoam/UEqn.H +++ b/applications/solvers/combustion/engineFoam/UEqn.H @@ -3,10 +3,14 @@ fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divDevRhoReff(U) + == + sources(rho, U) ); if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index 0ee3df6b7b37ea7a77718875b5ea2e42fa2d7c98..f11f677398e14e057c04e685bf052073b24f0acc 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -59,6 +59,7 @@ Description #include "OFstream.H" #include "mathematicalConstants.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,6 +71,7 @@ int main(int argc, char *argv[]) #include "createEngineMesh.H" #include "readCombustionProperties.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" #include "readEngineTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/combustion/engineFoam/pEqn.H b/applications/solvers/combustion/engineFoam/pEqn.H index 7b005cc311926e0009f416408bf1ded3537ae2c1..b38d6dbf4b0506f27a3e8492d1ed22ebc554fdf1 100644 --- a/applications/solvers/combustion/engineFoam/pEqn.H +++ b/applications/solvers/combustion/engineFoam/pEqn.H @@ -13,6 +13,8 @@ if (pimple.transonic()) *((fvc::interpolate(HbyA) & mesh.Sf()) - fvc::meshPhi(rho, U)) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -20,8 +22,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -39,6 +45,8 @@ else *((fvc::interpolate(HbyA) & mesh.Sf()) - fvc::meshPhi(rho, U)) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -46,8 +54,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -62,6 +74,7 @@ else U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/combustion/fireFoam/Make/options b/applications/solvers/combustion/fireFoam/Make/options index 861bde659c1909dc799402c71c154400d023161f..73804d8283937f5150ae8fe419f9d1ba7b5bfdac 100644 --- a/applications/solvers/combustion/fireFoam/Make/options +++ b/applications/solvers/combustion/fireFoam/Make/options @@ -1,6 +1,8 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ + -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ @@ -29,7 +31,9 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lfieldSources \ -lmeshTools \ + -lsampling \ -lcompressibleRASModels \ -lcompressibleLESModels \ -lspecie \ @@ -46,5 +50,6 @@ EXE_LIBS = \ -lradiationModels \ -lsurfaceFilmModels \ -lpyrolysisModels \ + -lregionCoupling \ -llagrangianIntermediate \ -lODE diff --git a/applications/solvers/combustion/fireFoam/UEqn.H b/applications/solvers/combustion/fireFoam/UEqn.H index 31d01e4327c7749a5f9b30ccb1a814bc5f5e8d7c..81d90bd695e912277c83e1744a9814f5b8cca7ec 100644 --- a/applications/solvers/combustion/fireFoam/UEqn.H +++ b/applications/solvers/combustion/fireFoam/UEqn.H @@ -5,10 +5,13 @@ + turbulence->divDevRhoReff(U) == parcels.SU(U) + + sources(rho, U) ); UEqn.relax(); + sources.constrain(UEqn); + if (pimple.momentumPredictor()) { solve @@ -24,5 +27,6 @@ ) ); + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/combustion/fireFoam/YEEqn.H b/applications/solvers/combustion/fireFoam/YEEqn.H index f979d3bb7de445c0edb93d93e6ea5a7ba8469eb0..358e4953d1a274be55da723bf6c0ebabf68c4ed5 100644 --- a/applications/solvers/combustion/fireFoam/YEEqn.H +++ b/applications/solvers/combustion/fireFoam/YEEqn.H @@ -30,11 +30,17 @@ tmp<fv::convectionScheme<scalar> > mvConvection parcels.SYi(i, Yi) + surfaceFilm.Srho(i) + combustion->R(Yi) + + sources(rho, Yi) ); YiEqn.relax(); + + sources.constrain(YiEqn); + YiEqn.solve(mesh.solver("Yi")); + sources.correct(Yi); + Yi.max(0.0); Yt += Yi; } @@ -69,11 +75,17 @@ tmp<fv::convectionScheme<scalar> > mvConvection + radiation->Sh(thermo) + parcels.Sh(he) + surfaceFilm.Sh() + + sources(rho, he) ); EEqn.relax(); + + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); Info<< "min/max(T) = " diff --git a/applications/solvers/combustion/fireFoam/fireFoam.C b/applications/solvers/combustion/fireFoam/fireFoam.C index 9f97843a96b8b86dbf60b9886bc1817c3931e2ab..afe1b815e5eee7938ff0ad94f6caeb3ed4419850 100644 --- a/applications/solvers/combustion/fireFoam/fireFoam.C +++ b/applications/solvers/combustion/fireFoam/fireFoam.C @@ -30,7 +30,6 @@ Description \*---------------------------------------------------------------------------*/ -#include "mapDistribute.H" #include "fvCFD.H" #include "turbulenceModel.H" #include "basicReactingCloud.H" @@ -41,6 +40,7 @@ Description #include "solidChemistryModel.H" #include "psiCombustionModel.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +52,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "createClouds.H" #include "createSurfaceFilmModel.H" #include "createPyrolysisModel.H" diff --git a/applications/solvers/combustion/fireFoam/pEqn.H b/applications/solvers/combustion/fireFoam/pEqn.H index 4c33f5633e1c6b984488bea990e1a142d5da669c..6101c9dd5dbb59d6792ea45f09b11ac52c8ad21c 100644 --- a/applications/solvers/combustion/fireFoam/pEqn.H +++ b/applications/solvers/combustion/fireFoam/pEqn.H @@ -21,6 +21,7 @@ surfaceScalarField phiHbyA + phig ); +sources.relativeFlux(phiHbyA); while (pimple.correctNonOrthogonal()) { @@ -33,8 +34,11 @@ while (pimple.correctNonOrthogonal()) == parcels.Srho() + surfaceFilm.Srho() + + sources(psi, p_rgh, rho.name()) ); + sources.constrain(p_rghEqn); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -42,6 +46,7 @@ while (pimple.correctNonOrthogonal()) phi = phiHbyA + p_rghEqn.flux(); U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() + phig)/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/combustion/fireFoam/rhoEqn.H b/applications/solvers/combustion/fireFoam/rhoEqn.H index f93906018171e762b96eb5ca4bc1e1ca85176742..5cc780abb1d02bd1621841aa52186429eb140d6f 100644 --- a/applications/solvers/combustion/fireFoam/rhoEqn.H +++ b/applications/solvers/combustion/fireFoam/rhoEqn.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 @@ -30,14 +30,21 @@ Description \*---------------------------------------------------------------------------*/ { - solve + fvScalarMatrix rhoEqn ( fvm::ddt(rho) + fvc::div(phi) == parcels.Srho(rho) + surfaceFilm.Srho() + + sources(rho) ); + + sources.constrain(rhoEqn); + + rhoEqn.solve(); + + sources.correct(rho); } // ************************************************************************* // diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake b/applications/solvers/combustion/reactingFoam/Allwmake similarity index 75% rename from applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake rename to applications/solvers/combustion/reactingFoam/Allwmake index 0fe8e8f4ad18ed67c9f57ed5c360bc03d39f69cf..0512e534f35c9310229146aee503deec6d92c507 100755 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake +++ b/applications/solvers/combustion/reactingFoam/Allwmake @@ -3,6 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake -wmake buoyantSimpleRadiationFoam +wmake rhoReactingFoam +wmake rhoReactingBuoyantFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/combustion/reactingFoam/EEqn.H b/applications/solvers/combustion/reactingFoam/EEqn.H index e1bf055604477aed18bdec6b126b03fcfd9b0849..c3f25da17d40f26ee0f1da68f02252c5ee7428cb 100644 --- a/applications/solvers/combustion/reactingFoam/EEqn.H +++ b/applications/solvers/combustion/reactingFoam/EEqn.H @@ -19,11 +19,17 @@ // - fvm::laplacian(turbulence->muEff(), he) // unit lewis no. == reaction->Sh() + + sources(rho, he) ); EEqn.relax(); + + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); Info<< "min/max(T) = " diff --git a/applications/solvers/combustion/reactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/Make/options index 46b69a63cd523c4af2fd12d5f78a228fe64c8b96..d29dc0ed9a0616d836f13a988cb1a6e57ba114a7 100644 --- a/applications/solvers/combustion/reactingFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/Make/options @@ -1,14 +1,21 @@ EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lmeshTools \ + -lsampling \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ @@ -17,5 +24,4 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lchemistryModel \ -lODE \ - -lfiniteVolume \ -lcombustionModels diff --git a/applications/solvers/combustion/reactingFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/UEqn.H index b9bc567aae9107cd8d687ec4666488586472f863..95f10bfcc9673d3908bffe5ea6355185c9f9838f 100644 --- a/applications/solvers/combustion/reactingFoam/UEqn.H +++ b/applications/solvers/combustion/reactingFoam/UEqn.H @@ -5,12 +5,17 @@ + turbulence->divDevRhoReff(U) == rho*g + + sources(rho, U) ); UEqn.relax(); + sources.constrain(UEqn); + if (pimple.momentumPredictor()) { solve(UEqn == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/combustion/reactingFoam/YEqn.H b/applications/solvers/combustion/reactingFoam/YEqn.H index ccc4b135a5dc1e246492cffda6cca93a0bdcacb3..c9b4942a5bad3278266c334a9b8982059bcd741f 100644 --- a/applications/solvers/combustion/reactingFoam/YEqn.H +++ b/applications/solvers/combustion/reactingFoam/YEqn.H @@ -28,11 +28,17 @@ tmp<fv::convectionScheme<scalar> > mvConvection - fvm::laplacian(turbulence->muEff(), Yi) == reaction->R(Yi) + + sources(rho, Yi) ); YiEqn.relax(); + + sources.constrain(YiEqn); + YiEqn.solve(mesh.solver("Yi")); + sources.correct(Yi); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/combustion/reactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/pEqn.H index 1543ca539a6793ee15b3df87dec596e415600422..2ed1bc1ca56166e6df3f500a893e37432957666f 100644 --- a/applications/solvers/combustion/reactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/pEqn.H @@ -16,6 +16,8 @@ if (pimple.transonic()) ) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -23,8 +25,12 @@ if (pimple.transonic()) fvm::ddt(psi, p) + fvm::div(phid, p) - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -45,6 +51,8 @@ else ) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -52,8 +60,12 @@ else fvm::ddt(psi, p) + fvc::div(phiHbyA) - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -68,6 +80,7 @@ else U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); +sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index cd7d371651379bcaf6a071f351a5db23565eba06..5ebd3573a89484de800eed6b27dff907df4c5ee8 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -34,6 +34,7 @@ Description #include "psiCombustionModel.H" #include "multivariateScheme.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,6 +45,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/Make/files b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..2d20fb8f44245af20ba588786d651aa424092faf --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/Make/files @@ -0,0 +1,3 @@ +rhoReactingBuoyantFoam.C + +EXE = $(FOAM_APPBIN)/rhoReactingBuoyantFoam diff --git a/applications/solvers/combustion/rhoReactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/Make/options similarity index 81% rename from applications/solvers/combustion/rhoReactingFoam/Make/options rename to applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/Make/options index 6dbd401b63e46a591930a7cda3d024deab887104..0d1336e1ac931489b22f4fa81c82b37cc547aa64 100644 --- a/applications/solvers/combustion/rhoReactingFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/Make/options @@ -1,17 +1,23 @@ EXE_INC = \ - -I../reactingFoam \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(FOAM_SOLVERS)/combustion/reactingFoam \ -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lmeshTools \ + -lsampling \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ -lcompressibleLESModels \ @@ -20,5 +26,4 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lchemistryModel \ -lODE \ - -lfiniteVolume \ -lcombustionModels diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/UEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..d9aca344a903c8562c07906f2905606376a6e43e --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/UEqn.H @@ -0,0 +1,31 @@ + fvVectorMatrix UEqn + ( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) + == + sources(rho, U) + ); + + UEqn.relax(); + + sources.constrain(UEqn); + + if (pimple.momentumPredictor()) + { + solve + ( + UEqn + == + fvc::reconstruct + ( + ( + - ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) + )*mesh.magSf() + ) + ); + + sources.correct(U); + K = 0.5*magSqr(U); + } diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..4b901672bd0a63bbdedbef68cb190817376d4e62 --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/createFields.H @@ -0,0 +1,124 @@ +Info<< "Creating reaction model\n" << endl; + +autoPtr<combustionModels::rhoCombustionModel> reaction +( + combustionModels::rhoCombustionModel::New(mesh) +); + +rhoReactionThermo& thermo = reaction->thermo(); +thermo.validate(args.executable(), "h", "e"); + +basicMultiComponentMixture& composition = thermo.composition(); +PtrList<volScalarField>& Y = composition.Y(); + +word inertSpecie(thermo.lookup("inertSpecie")); + +volScalarField rho +( + IOobject + ( + "rho", + runTime.timeName(), + mesh + ), + thermo.rho() +); + +Info<< "Reading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + + +volScalarField& p = thermo.p(); +const volScalarField& psi = thermo.psi(); +const volScalarField& T = thermo.T(); + + +#include "compressibleCreatePhi.H" + + +Info << "Creating turbulence model.\n" << nl; +autoPtr<compressible::turbulenceModel> turbulence +( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) +); + +// Set the turbulence into the reaction model +reaction->setTurbulence(turbulence()); + + +Info<< "Calculating field g.h\n" << endl; +volScalarField gh("gh", g & mesh.C()); +surfaceScalarField ghf("ghf", g & mesh.Cf()); + +Info<< "Reading field p_rgh\n" << endl; +volScalarField p_rgh +( + IOobject + ( + "p_rgh", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +// Force p_rgh to be consistent with p +p_rgh = p - rho*gh; + +Info<< "Creating field dpdt\n" << endl; +volScalarField dpdt +( + IOobject + ( + "dpdt", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("dpdt", p.dimensions()/dimTime, 0) +); + +Info<< "Creating field kinetic energy K\n" << endl; +volScalarField K("K", 0.5*magSqr(U)); + + +multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields; + +forAll(Y, i) +{ + fields.add(Y[i]); +} +fields.add(thermo.he()); + +volScalarField dQ +( + IOobject + ( + "dQ", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) +); diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..4fbe3b15a0d76fd7b530b0049510230294b1b850 --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/pEqn.H @@ -0,0 +1,78 @@ +{ + rho = thermo.rho(); + + // Thermodynamic density needs to be updated by psi*d(p) after the + // pressure solution - done in 2 parts. Part 1: + thermo.rho() -= psi*p; + + volScalarField rAU(1.0/UEqn.A()); + surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU)); + + volVectorField HbyA("HbyA", U); + HbyA = rAU*UEqn.H(); + + surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); + + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::interpolate(rho) + *( + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ) + + phig + ); + + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + + fvScalarMatrix p_rghDDtEqn + ( + fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) + + fvc::div(phiHbyA) + == + sources(psi, p_rgh, rho.name()) + ); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_rghEqn + ( + p_rghDDtEqn + - fvm::laplacian(rhorAUf, p_rgh) + ); + + sources.constrain(p_rghEqn); + + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + // Calculate the conservative fluxes + phi = phiHbyA + p_rghEqn.flux(); + + // Explicitly relax pressure for momentum corrector + p_rgh.relax(); + + // Correct the momentum source with the pressure gradient flux + // calculated from the relaxed pressure + U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); + U.correctBoundaryConditions(); + sources.correct(U); + K = 0.5*magSqr(U); + } + } + + p = p_rgh + rho*gh; + + // Second part of thermodynamic density update + thermo.rho() += psi*p; + + if (thermo.dpdt()) + { + dpdt = fvc::ddt(p); + } + + #include "rhoEqn.H" + #include "compressibleContinuityErrs.H" +} diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C similarity index 81% rename from applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C rename to applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C index ac5dc1eadcb3d6c9108160928e93fa67d6e4569d..19356b0fe6affe10c8471cbe6d05230f2ab34fc2 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/rhoPorousMRFPimpleFoam.C +++ b/applications/solvers/combustion/reactingFoam/rhoReactingBuoyantFoam/rhoReactingBuoyantFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,25 +22,20 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application - rhoPorousMRFPimpleFoam + rhoReactingBuoyantFoam Description - Transient solver for laminar or turbulent flow of compressible fluids - with support for porous media and MRF for HVAC and similar applications. - - Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and - pseudo-transient simulations. + Solver for combustion with chemical reactions using density based + thermodynamics package, using enahanced buoyancy treatment. \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "psiThermo.H" +#include "rhoCombustionModel.H" #include "turbulenceModel.H" -#include "bound.H" -#include "MRFZones.H" -#include "IOporosityModelList.H" -#include "IObasicSourceList.H" +#include "multivariateScheme.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,12 +44,15 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" - - pimpleControl pimple(mesh); - + #include "readGravitationalAcceleration.H" #include "createFields.H" - #include "createZones.H" + #include "createSources.H" #include "initContinuityErrs.H" + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + + pimpleControl pimple(mesh); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,18 +65,15 @@ int main(int argc, char *argv[]) #include "setDeltaT.H" runTime++; - Info<< "Time = " << runTime.timeName() << nl << endl; - if (pimple.nCorrPIMPLE() <= 1) - { - #include "rhoEqn.H" - } + #include "rhoEqn.H" // --- Pressure-velocity PIMPLE corrector loop while (pimple.loop()) { #include "UEqn.H" + #include "YEqn.H" #include "EEqn.H" // --- Pressure corrector loop @@ -93,6 +88,8 @@ int main(int argc, char *argv[]) } } + rho = thermo.rho(); + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/combustion/rhoReactingFoam/Make/files b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/Make/files similarity index 100% rename from applications/solvers/combustion/rhoReactingFoam/Make/files rename to applications/solvers/combustion/reactingFoam/rhoReactingFoam/Make/files diff --git a/applications/solvers/combustion/reactingFoam/rhoReactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..0d1336e1ac931489b22f4fa81c82b37cc547aa64 --- /dev/null +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/Make/options @@ -0,0 +1,29 @@ +EXE_INC = \ + -I$(FOAM_SOLVERS)/combustion/reactingFoam \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude + + +EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lmeshTools \ + -lsampling \ + -lcompressibleTurbulenceModel \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -lreactionThermophysicalModels \ + -lspecie \ + -lfluidThermophysicalModels \ + -lchemistryModel \ + -lODE \ + -lcombustionModels diff --git a/applications/solvers/combustion/rhoReactingFoam/createFields.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H similarity index 100% rename from applications/solvers/combustion/rhoReactingFoam/createFields.H rename to applications/solvers/combustion/reactingFoam/rhoReactingFoam/createFields.H diff --git a/applications/solvers/combustion/rhoReactingFoam/pEqn.H b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H similarity index 87% rename from applications/solvers/combustion/rhoReactingFoam/pEqn.H rename to applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H index 85dbbf7f7e6902951fd9072a1ea0f8efd2c234da..cb25d83662c4c1634950e493c25b02f931f816be 100644 --- a/applications/solvers/combustion/rhoReactingFoam/pEqn.H +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/pEqn.H @@ -18,6 +18,8 @@ + fvc::ddtPhiCorr(rAU, rho, U, phi) ); + sources.relativeFlux(phiHbyA); + surfaceScalarField phid("phid", fvc::interpolate(thermo.psi())*phiHbyA); phiHbyA *= fvc::interpolate(rho); @@ -34,8 +36,12 @@ ( pDDtEqn - fvm::laplacian(rho*rAU, p) + == + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -56,10 +62,14 @@ ) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + fvScalarMatrix pDDtEqn ( fvc::ddt(rho) + psi*correction(fvm::ddt(p)) + fvc::div(phiHbyA) + == + sources(psi, p, rho.name()) ); while (pimple.correctNonOrthogonal()) @@ -70,6 +80,8 @@ - fvm::laplacian(rho*rAU, p) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -87,6 +99,7 @@ U = HbyA - rAU*fvc::grad(p); U.correctBoundaryConditions(); + sources.correct(U); K = 0.5*magSqr(U); if (thermo.dpdt()) diff --git a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C similarity index 98% rename from applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C rename to applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C index 3ac060612d68784e0492145480161594b3c88fc9..fffbf485d8f92c4eb5c5ade28159edfd9987829e 100644 --- a/applications/solvers/combustion/rhoReactingFoam/rhoReactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/rhoReactingFoam/rhoReactingFoam.C @@ -35,6 +35,7 @@ Description #include "turbulenceModel.H" #include "multivariateScheme.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,6 +46,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index d0183e9f7df71dca7c768912eff73307de631403..2b04637b041560d751f983cba43a1b6c103a148b 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.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 @@ -38,6 +38,10 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), + UName_("U"), + rhoName_("rho"), + psiName_("thermo:psi"), + muName_("thermo:mu"), accommodationCoeff_(1.0), Twall_(p.size(), 0.0), gamma_(1.4) @@ -57,6 +61,10 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ) : mixedFvPatchScalarField(ptf, p, iF, mapper), + UName_(ptf.UName_), + rhoName_(ptf.rhoName_), + psiName_(ptf.psiName_), + muName_(ptf.muName_), accommodationCoeff_(ptf.accommodationCoeff_), Twall_(ptf.Twall_), gamma_(ptf.gamma_) @@ -71,6 +79,10 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ) : mixedFvPatchScalarField(p, iF), + UName_(dict.lookupOrDefault<word>("U", "U")), + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), + muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")), accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))), Twall_("Twall", dict, p.size()), gamma_(dict.lookupOrDefault<scalar>("gamma", 1.4)) @@ -93,7 +105,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField dict ) << "unphysical accommodationCoeff specified" << "(0 < accommodationCoeff <= 1)" << endl - << exit(FatalError); + << exit(FatalIOError); } if (dict.found("value")) @@ -159,13 +171,13 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs() } const fvPatchScalarField& pmu = - patch().lookupPatchField<volScalarField, scalar>("mu"); + patch().lookupPatchField<volScalarField, scalar>(muName_); const fvPatchScalarField& prho = - patch().lookupPatchField<volScalarField, scalar>("rho"); + patch().lookupPatchField<volScalarField, scalar>(rhoName_); const fvPatchField<scalar>& ppsi = - patch().lookupPatchField<volScalarField, scalar>("psi"); + patch().lookupPatchField<volScalarField, scalar>(psiName_); const fvPatchVectorField& pU = - patch().lookupPatchField<volVectorField, vector>("U"); + patch().lookupPatchField<volVectorField, vector>(UName_); // Prandtl number reading consistent with rhoCentralFoam const dictionary& thermophysicalProperties = @@ -204,6 +216,12 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs() void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); + + writeEntryIfDifferent<word>(os, "U", "U", UName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); + writeEntryIfDifferent<word>(os, "mu", "thermo:mu", muName_); + os.writeKeyword("accommodationCoeff") << accommodationCoeff_ << token::END_STATEMENT << nl; Twall_.writeEntry("Twall", os); diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H index 8f84cfb6e69482e9f7a9d2972c83e55efc6faca4..03625d89682013229f1e17bfa9dce325504fba7d 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.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 @@ -53,13 +53,25 @@ class smoluchowskiJumpTFvPatchScalarField // Private data - // Accommodation coefficient + //- Velocity field name, default = "U" + word UName_; + + //- Density field name, default = "rho" + word rhoName_; + + //- Compressibility field name, default = "thermo:psi" + word psiName_; + + //- Dynamic viscosity field name, default = "thermo:mu" + word muName_; + + //- Accommodation coefficient scalar accommodationCoeff_; - // Wall surface temperature + //- Wall surface temperature scalarField Twall_; - // Heat capacity ratio (default 1.4) + //- Heat capacity ratio (default 1.4) scalar gamma_; public: diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index 875e42683e36badcb530d09208c3fa4482950f9f..6ec81dd4dc905c359d01ab59c2cdf3591bf774be 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -30,20 +30,20 @@ License #include "volFields.H" #include "fvcGrad.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField +Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF ) : mixedFixedValueSlipFvPatchVectorField(p, iF), + TName_("T"), + rhoName_("rho"), + psiName_("thermo:psi"), + muName_("thermo:mu"), + tauMCName_("tauMC"), accommodationCoeff_(1.0), Uwall_(p.size(), vector(0.0, 0.0, 0.0)), thermalCreep_(true), @@ -51,23 +51,28 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField {} -maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField +Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField ( - const maxwellSlipUFvPatchVectorField& tdpvf, + const maxwellSlipUFvPatchVectorField& mspvf, const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const fvPatchFieldMapper& mapper ) : - mixedFixedValueSlipFvPatchVectorField(tdpvf, p, iF, mapper), - accommodationCoeff_(tdpvf.accommodationCoeff_), - Uwall_(tdpvf.Uwall_), - thermalCreep_(tdpvf.thermalCreep_), - curvature_(tdpvf.curvature_) + mixedFixedValueSlipFvPatchVectorField(mspvf, p, iF, mapper), + TName_(mspvf.TName_), + rhoName_(mspvf.rhoName_), + psiName_(mspvf.psiName_), + muName_(mspvf.muName_), + tauMCName_(mspvf.tauMCName_), + accommodationCoeff_(mspvf.accommodationCoeff_), + Uwall_(mspvf.Uwall_), + thermalCreep_(mspvf.thermalCreep_), + curvature_(mspvf.curvature_) {} -maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField +Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, @@ -75,6 +80,11 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField ) : mixedFixedValueSlipFvPatchVectorField(p, iF), + TName_(dict.lookupOrDefault<word>("T", "T")), + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), + muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")), + tauMCName_(dict.lookupOrDefault<word>("tauMC", "tauMC")), accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))), Uwall_("Uwall", dict, p.size()), thermalCreep_(dict.lookupOrDefault("thermalCreep", true)), @@ -88,13 +98,16 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField { FatalIOErrorIn ( - "maxwellSlipUFvPatchScalarField::" - "maxwellSlipUFvPatchScalarField" - "(const fvPatch&, const scalarField&, const dictionary&)", + "maxwellSlipUFvPatchScalarField::maxwellSlipUFvPatchScalarField" + "(" + "const fvPatch&, " + "const DimensionedField<vector, volMesh>&, " + "const dictionary&" + ")", dict ) << "unphysical accommodationCoeff_ specified" << "(0 < accommodationCoeff_ <= 1)" << endl - << exit(FatalError); + << exit(FatalIOError); } if (dict.found("value")) @@ -119,23 +132,28 @@ maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField } -maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField +Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField ( - const maxwellSlipUFvPatchVectorField& tdpvf, + const maxwellSlipUFvPatchVectorField& mspvf, const DimensionedField<vector, volMesh>& iF ) : - mixedFixedValueSlipFvPatchVectorField(tdpvf, iF), - accommodationCoeff_(tdpvf.accommodationCoeff_), - Uwall_(tdpvf.Uwall_), - thermalCreep_(tdpvf.thermalCreep_), - curvature_(tdpvf.curvature_) + mixedFixedValueSlipFvPatchVectorField(mspvf, iF), + TName_(mspvf.TName_), + rhoName_(mspvf.rhoName_), + psiName_(mspvf.psiName_), + muName_(mspvf.muName_), + tauMCName_(mspvf.tauMCName_), + accommodationCoeff_(mspvf.accommodationCoeff_), + Uwall_(mspvf.Uwall_), + thermalCreep_(mspvf.thermalCreep_), + curvature_(mspvf.curvature_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void maxwellSlipUFvPatchVectorField::updateCoeffs() +void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs() { if (updated()) { @@ -143,11 +161,11 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs() } const fvPatchScalarField& pmu = - patch().lookupPatchField<volScalarField, scalar>("mu"); + patch().lookupPatchField<volScalarField, scalar>(muName_); const fvPatchScalarField& prho = - patch().lookupPatchField<volScalarField, scalar>("rho"); + patch().lookupPatchField<volScalarField, scalar>(rhoName_); const fvPatchField<scalar>& ppsi = - patch().lookupPatchField<volScalarField, scalar>("psi"); + patch().lookupPatchField<volScalarField, scalar>(psiName_); Field<scalar> C1 ( @@ -163,7 +181,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs() if (thermalCreep_) { const volScalarField& vsfT = - this->db().objectRegistry::lookupObject<volScalarField>("T"); + this->db().objectRegistry::lookupObject<volScalarField>(TName_); label patchi = this->patch().index(); const fvPatchScalarField& pT = vsfT.boundaryField()[patchi]; Field<vector> gradpT(fvc::grad(vsfT)().boundaryField()[patchi]); @@ -175,7 +193,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs() if (curvature_) { const fvPatchTensorField& ptauMC = - patch().lookupPatchField<volTensorField, tensor>("tauMC"); + patch().lookupPatchField<volTensorField, tensor>(tauMCName_); vectorField n(patch().nf()); refValue() -= C1/prho*transform(I - n*n, (n & ptauMC)); @@ -185,9 +203,15 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs() } -void maxwellSlipUFvPatchVectorField::write(Ostream& os) const +void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); + writeEntryIfDifferent<word>(os, "T", "T", TName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); + writeEntryIfDifferent<word>(os, "mu", "thermo:mu", muName_); + writeEntryIfDifferent<word>(os, "tauMC", "tauMC", tauMCName_); + os.writeKeyword("accommodationCoeff") << accommodationCoeff_ << token::END_STATEMENT << nl; Uwall_.writeEntry("Uwall", os); @@ -204,14 +228,13 @@ void maxwellSlipUFvPatchVectorField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -makePatchTypeField -( - fvPatchVectorField, - maxwellSlipUFvPatchVectorField -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + maxwellSlipUFvPatchVectorField + ); +} // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H index df441c5d91cf0820d7f93321bcfb2e5d3fe3e526..d0e7bf6ce2eaf3239f9ded3b57f909ecd152ecad 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.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 @@ -54,6 +54,21 @@ class maxwellSlipUFvPatchVectorField { // Private data + //- Temperature field name, default = "T" + word TName_; + + //- Density field name, default = "rho" + word rhoName_; + + //- Compressibility field name, default = "thermo:psi" + word psiName_; + + //- Dynamic viscosity field name, default = "thermo:mu" + word muName_; + + //- tauMC field name, default = "tauMC" + word tauMCName_; + // Accommodation coefficient scalar accommodationCoeff_; diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C index 8f31a2b460b8cda1cd2eb670b91327b4fffa8e2f..5c1459381f04bd48f6b415e5e67a7d477664c225 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.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 @@ -98,6 +98,7 @@ mixedFixedValueSlipFvPatchField<Type>::mixedFixedValueSlipFvPatchField valueFraction_(ptf.valueFraction_) {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // Map from self diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C index cf9450a657b0f52ab1ae3a55871acbe4481fcb02..5eefe82ff5dedae1001c4f026b208a56e0b0293a 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.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 @@ -27,27 +27,22 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "surfaceFields.H" -#include "fvCFD.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchScalarField(p, iF) + fixedValueFvPatchScalarField(p, iF), + pName_("p"), + psiName_("thermo:psi") {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( const fixedRhoFvPatchScalarField& ptf, const fvPatch& p, @@ -55,43 +50,51 @@ fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchScalarField(ptf, p, iF, mapper) + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + pName_(ptf.pName_), + psiName_(ptf.psiName_) {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict) + fixedValueFvPatchScalarField(p, iF, dict), + pName_(dict.lookupOrDefault<word>("p", "p")), + psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")) {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( - const fixedRhoFvPatchScalarField& tppsf + const fixedRhoFvPatchScalarField& frpsf ) : - fixedValueFvPatchScalarField(tppsf) + fixedValueFvPatchScalarField(frpsf), + pName_(frpsf.pName_), + psiName_(frpsf.psiName_) {} -fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField +Foam::fixedRhoFvPatchScalarField::fixedRhoFvPatchScalarField ( - const fixedRhoFvPatchScalarField& tppsf, + const fixedRhoFvPatchScalarField& frpsf, const DimensionedField<scalar, volMesh>& iF ) : - fixedValueFvPatchScalarField(tppsf, iF) + fixedValueFvPatchScalarField(frpsf, iF), + pName_(frpsf.pName_), + psiName_(frpsf.psiName_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void fixedRhoFvPatchScalarField::updateCoeffs() +void Foam::fixedRhoFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -99,10 +102,10 @@ void fixedRhoFvPatchScalarField::updateCoeffs() } const fvPatchField<scalar>& psip = - patch().lookupPatchField<volScalarField, scalar>("psi"); + patch().lookupPatchField<volScalarField, scalar>(psiName_); const fvPatchField<scalar>& pp = - patch().lookupPatchField<volScalarField, scalar>("p"); + patch().lookupPatchField<volScalarField, scalar>(pName_); operator==(psip*pp); @@ -110,16 +113,24 @@ void fixedRhoFvPatchScalarField::updateCoeffs() } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const +{ + fvPatchScalarField::write(os); -makePatchTypeField -( - fvPatchScalarField, - fixedRhoFvPatchScalarField -); + writeEntryIfDifferent<word>(os, "p", "p", this->pName_); + writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); + writeEntry("value", os); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + fixedRhoFvPatchScalarField + ); +} // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H index 697ae723a5c0be9ab901fbfac5f63f9af0ad6e63..6efbb4947d0f55f2cf6b92d53f0605a746ea0d97 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.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 @@ -24,9 +24,42 @@ License Class Foam::fixedRhoFvPatchScalarField +Group + grpInletBoundaryConditions + Description Foam::fixedRhoFvPatchScalarField + This boundary condition provides a fixed density inlet condition for + compressible solvers, where the density of calculated using: + + \f{ + \rho = \psi p + \f] + + where + \vartable + p | pressure [Pa] + \rho | density [kg/m3] + \endvartable + + + \heading Patch usage + + \table + Property | Description | Required | Default value + pName | Pressure field name | no | p + psiName | Compressibility field name | no | thermo:psi + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fixedRho; + } + \endverbatim + SourceFiles fixedRhoFvPatchScalarField.C @@ -43,7 +76,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class fixedRhoFvPatchScalarField Declaration + Class fixedRhoFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class fixedRhoFvPatchScalarField @@ -51,6 +84,17 @@ class fixedRhoFvPatchScalarField public fixedValueFvPatchScalarField { +private: + + // Private data + + //- Pressure field name, default = "p" + word pName_; + + //- Compressibility field name, default = "thermo:psi" + word psiName_; + + public: //- Runtime type information @@ -125,6 +169,10 @@ public: //- Update the coefficients associated with the patch field virtual void updateCoeffs(); + + + //- Write + virtual void write(Ostream&) const; }; diff --git a/applications/solvers/compressible/rhoPimpleFoam/Allwmake b/applications/solvers/compressible/rhoPimpleFoam/Allwmake index f6f8ad3635d10f11e2557d9e6f0af3258a738bb2..ac06b7350a1e8ea3ee081768c38ebf5f9d5b031a 100755 --- a/applications/solvers/compressible/rhoPimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoPimpleFoam/Allwmake @@ -4,7 +4,6 @@ set -x wmake wmake rhoPimplecFoam -wmake rhoPorousMRFPimpleFoam -wmake rhoPorousMRFLTSPimpleFoam +wmake rhoLTSPimpleFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H index 1cc6ed584c6c3806864cc0a0f461182796b9799a..712a3a9ab4d4a8885f0b3bc05aa0623eaddbbc1d 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/EEqn.H @@ -21,8 +21,12 @@ ); EEqn.relax(); + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H index 397e8930357dfd548a96f62b9f63acfc943f2423..daa25ac316bcfabeb0ae347c86dd244385cf9491 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/UEqn.H @@ -5,6 +5,8 @@ tmp<fvVectorMatrix> UEqn fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divDevRhoReff(U) + == + sources(rho, U) ); UEqn().relax(); @@ -13,6 +15,8 @@ sources.constrain(UEqn()); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p) + sources(rho, U)); + solve(UEqn() == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/compressible/rhoPimpleFoam/createFields.H b/applications/solvers/compressible/rhoPimpleFoam/createFields.H index 8b3cfd10b9a1180d574c1610ccec487b3ab5ae68..67cc0c3e456573e71fe9f4937a5fd5d3e9253692 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoPimpleFoam/createFields.H @@ -69,6 +69,3 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); - - Info<< "Creating sources\n" << endl; - IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H index 5f28a3456d82c8d6c1b8f05d90b1519e9a5f5931..a656d772481adc52390a1c9fd7889545f6e50d4a 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/pEqn.H @@ -5,7 +5,7 @@ rho.relax(); volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*(UEqn() == sources(rho, U))().H(); +HbyA = rAU*UEqn().H(); if (pimple.nCorrPISO() <= 1) { @@ -24,6 +24,8 @@ if (pimple.transonic()) ) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + volScalarField Dp("Dp", rho*rAU); while (pimple.correctNonOrthogonal()) @@ -37,7 +39,7 @@ if (pimple.transonic()) sources(psi, p, rho.name()) ); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); @@ -59,6 +61,8 @@ else ) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + volScalarField Dp("Dp", rho*rAU); while (pimple.correctNonOrthogonal()) @@ -73,7 +77,7 @@ else sources(psi, p, rho.name()) ); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/files b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..ff61e6022f6a5fae2729c5bd287c2ddacd2390b1 --- /dev/null +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/files @@ -0,0 +1,3 @@ +rhoLTSPimpleFoam.C + +EXE = $(FOAM_APPBIN)/rhoLTSPimpleFoam diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/options similarity index 100% rename from applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/options rename to applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/options diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/rhoLTSPimpleFoam.C similarity index 95% rename from applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C rename to applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/rhoLTSPimpleFoam.C index 82ba5cbac17371b9147b4057d5f657426cff1afc..f3d088b4d627302c1f7092d129588dea020f18f1 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/rhoPorousMRFLTSPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/rhoLTSPimpleFoam.C @@ -26,7 +26,7 @@ Application Description Transient solver for laminar or turbulent flow of compressible fluids - with support for porous media and MRF for HVAC and similar applications. + with support for run-time selectable sources, e.g. MRF, explicit porosity. Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and pseudo-transient simulations with support for local time-stepping for @@ -37,8 +37,6 @@ Description #include "fvCFD.H" #include "psiThermo.H" #include "turbulenceModel.H" -#include "MRFZones.H" -#include "IOporosityModelList.H" #include "IObasicSourceList.H" #include "fvcSmooth.H" #include "pimpleControl.H" @@ -56,7 +54,7 @@ int main(int argc, char *argv[]) #include "setInitialrDeltaT.H" #include "createFields.H" - #include "createZones.H" + #include "createSources.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setInitialrDeltaT.H b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/setInitialrDeltaT.H similarity index 100% rename from applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setInitialrDeltaT.H rename to applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/setInitialrDeltaT.H diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setrDeltaT.H b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/setrDeltaT.H similarity index 100% rename from applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/setrDeltaT.H rename to applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/setrDeltaT.H diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index f9b8a901f721265fe10cd8c478651f8334ba8497..a2b951de7c28bf0ad045d843df2bae96054849db 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H index 628eb71f2961392d5c1173fbbf30aeb07cd5f81b..aa3e615af6ca93aa284b2ada525da95363bb21db 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/pEqn.H @@ -51,7 +51,7 @@ if (pimple.transonic()) // Relax the pressure equation to maintain diagonal dominance pEqn.relax(); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(); @@ -89,7 +89,7 @@ else sources(psi, p, rho.name()) ); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C index 7e1664dbeac745cf8a24e634cfd72b87e4f41213..c1c323e7abe1dbd2e221abef3033d465f37cdc17 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimplecFoam/rhoPimplecFoam.C @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/files b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/files deleted file mode 100644 index 3b438a61773fd05589a0a7d0131d152ceb99d258..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFLTSPimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -rhoPorousMRFLTSPimpleFoam.C - -EXE = $(FOAM_APPBIN)/rhoPorousMRFLTSPimpleFoam diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/files b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/files deleted file mode 100644 index a798455eb7f807cacb1cdcea8d70c02d871821aa..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/files +++ /dev/null @@ -1,4 +0,0 @@ -rhoPorousMRFPimpleFoam.C - -EXE = $(FOAM_APPBIN)/rhoPorousMRFPimpleFoam - diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options deleted file mode 100644 index c78d474b4fb3d4649d7afad5957132ee2da37253..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/Make/options +++ /dev/null @@ -1,20 +0,0 @@ -EXE_INC = \ - -I.. \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/fieldSources/lnInclude - -EXE_LIBS = \ - -lfluidThermophysicalModels \ - -lspecie \ - -lcompressibleTurbulenceModel \ - -lcompressibleRASModels \ - -lcompressibleLESModels \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling \ - -lfieldSources diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H deleted file mode 100644 index 9651610157c483596253639cb1380be1cc8e2f9b..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/UEqn.H +++ /dev/null @@ -1,22 +0,0 @@ -// Solve the Momentum equation - -tmp<fvVectorMatrix> UEqn -( - //pZones.ddt(rho, U) - fvm::ddt(rho, U) - + fvm::div(phi, U) - + turbulence->divDevRhoReff(U) -); - -UEqn().relax(); - -mrfZones.addCoriolis(rho, UEqn()); - -pZones.addResistance(UEqn()); - -sources.constrain(UEqn()); - -if (pimple.momentumPredictor()) -{ - solve(UEqn() == -fvc::grad(p) + sources(rho, U)); -} diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H deleted file mode 100644 index d2522b8c752ada18d083b3ebf450d0ae553aac64..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/createZones.H +++ /dev/null @@ -1,5 +0,0 @@ - MRFZones mrfZones(mesh); - mrfZones.correctBoundaryVelocity(U); - - IOporosityModelList pZones(mesh); - Switch pressureImplicitPorosity(false); diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H b/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H deleted file mode 100644 index 304798b9662d6c7bb8dd3bfc0bded47e552db19e..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPorousMRFPimpleFoam/pEqn.H +++ /dev/null @@ -1,111 +0,0 @@ -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); - -volScalarField rAU(1.0/UEqn().A()); -volVectorField HbyA("HbyA", U); -HbyA = rAU*(UEqn() == sources(rho, U))().H(); - -if (pimple.nCorrPISO() <= 1) -{ - UEqn.clear(); -} - -if (pimple.transonic()) -{ - surfaceScalarField phid - ( - "phid", - fvc::interpolate(psi) - *( - (fvc::interpolate(HbyA) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU, rho, U, phi) - ) - ); - mrfZones.relativeFlux(fvc::interpolate(psi), phid); - - volScalarField Dp("Dp", rho*rAU); - - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvm::div(phid, p) - - fvm::laplacian(Dp, p) - == - sources(psi, p, rho.name()) - ); - - sources.constrain(pEqn, rho.name()); - - pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - - if (pimple.finalNonOrthogonalIter()) - { - phi == pEqn.flux(); - } - } -} -else -{ - surfaceScalarField phiHbyA - ( - "phiHbyA", - fvc::interpolate(rho) - *( - (fvc::interpolate(HbyA) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU, rho, U, phi) - ) - ); - - mrfZones.relativeFlux(fvc::interpolate(rho), phiHbyA); - - volScalarField Dp("Dp", rho*rAU); - - while (pimple.correctNonOrthogonal()) - { - // Pressure corrector - fvScalarMatrix pEqn - ( - fvm::ddt(psi, p) - + fvc::div(phiHbyA) - - fvm::laplacian(Dp, p) - == - sources(psi, p, rho.name()) - ); - - sources.constrain(pEqn, rho.name()); - - pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - - if (pimple.finalNonOrthogonalIter()) - { - phi = phiHbyA + pEqn.flux(); - } - } -} - -#include "rhoEqn.H" -#include "compressibleContinuityErrs.H" - -// Explicitly relax pressure for momentum corrector -p.relax(); - -rho = thermo.rho(); -rho = max(rho, rhoMin); -rho = min(rho, rhoMax); -rho.relax(); -Info<< "rho max/min : " << max(rho).value() - << " " << min(rho).value() << endl; - -U = HbyA - rAU*fvc::grad(p); -U.correctBoundaryConditions(); -sources.correct(U); -K = 0.5*magSqr(U); - -if (thermo.dpdt()) -{ - dpdt = fvc::ddt(p); -} diff --git a/applications/solvers/compressible/rhoSimpleFoam/Allwclean b/applications/solvers/compressible/rhoSimpleFoam/Allwclean index 49e4b694825e9af88024f4e4857c6ca246477bde..a1fd479e12700c0e98e56ad1df4d6e0a7616e545 100755 --- a/applications/solvers/compressible/rhoSimpleFoam/Allwclean +++ b/applications/solvers/compressible/rhoSimpleFoam/Allwclean @@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x wclean -wclean rhoPorousMRFSimpleFoam +wclean rhoPorousSimpleFoam wclean rhoSimplecFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoSimpleFoam/Allwmake b/applications/solvers/compressible/rhoSimpleFoam/Allwmake index e0b621c2530e21c1221271c0afa24a67fa3e2dac..dc0fd648f5ec8c8581720dce6c1a74643d256faf 100755 --- a/applications/solvers/compressible/rhoSimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoSimpleFoam/Allwmake @@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake -wmake rhoPorousMRFSimpleFoam +wmake rhoPorousSimpleFoam wmake rhoSimplecFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H index e496906d082b96a7e2dc8a9aa731dba5372608aa..7adacc8fd1bbae9cd71919fdeaac619d03790708 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H @@ -15,8 +15,12 @@ ); EEqn.relax(); + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H index 21ec2646be5bb5702e0b2210335592e1fe124ec0..c01b4d7984e18b52c5f06460d89941e9628e8a59 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/UEqn.H @@ -4,8 +4,14 @@ ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) + == + sources(rho, U) ); UEqn().relax(); + sources.constrain(UEqn()); + solve(UEqn() == -fvc::grad(p)); + + sources.correct(U); diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index 3f4b2fd0217cb800ae9c25793630f8266ca4d8d4..dea35b76575477e953c521d77f6bb12cf28c3dc0 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -60,6 +60,3 @@ ); dimensionedScalar initialMass = fvc::domainIntegrate(rho); - - Info<< "Creating sources\n" << endl; - IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H index 2ea228f172d80bc4d4a330662723e9754840c0a2..2782d206524c620c7e535a190aecb004ae99f5e9 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/pEqn.H @@ -6,7 +6,7 @@ volScalarField rAU(1.0/UEqn().A()); volVectorField HbyA("HbyA", U); - HbyA = rAU*(UEqn() == sources(rho, U))().H(); + HbyA = rAU*UEqn().H(); UEqn.clear(); @@ -20,6 +20,8 @@ fvc::interpolate(psi)*(fvc::interpolate(HbyA) & mesh.Sf()) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (simple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -33,7 +35,7 @@ // Relax the pressure equation to ensure diagonal-dominance pEqn.relax(); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.setReference(pRefCell, pRefValue); @@ -53,6 +55,8 @@ fvc::interpolate(rho)*(fvc::interpolate(HbyA) & mesh.Sf()) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + closedVolume = adjustPhi(phiHbyA, U, p); while (simple.correctNonOrthogonal()) @@ -67,7 +71,7 @@ pEqn.setReference(pRefCell, pRefValue); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/files b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/files deleted file mode 100644 index d4792428af5f610d9cdfb8ef3ecc1c34c89abc50..0000000000000000000000000000000000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -rhoPorousMRFSimpleFoam.C - -EXE = $(FOAM_APPBIN)/rhoPorousMRFSimpleFoam diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/EEqn.H similarity index 94% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/EEqn.H index e496906d082b96a7e2dc8a9aa731dba5372608aa..7adacc8fd1bbae9cd71919fdeaac619d03790708 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/EEqn.H @@ -15,8 +15,12 @@ ); EEqn.relax(); + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..d108d0246ea8291699b0accf03dc7c4f1ffabb44 --- /dev/null +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/files @@ -0,0 +1,3 @@ +rhoPorousSimpleFoam.C + +EXE = $(FOAM_APPBIN)/rhoPorousSimpleFoam diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/options similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/Make/options rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/Make/options diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/UEqn.H similarity index 95% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/UEqn.H index 52e15e07b5143f0e078cec89c9d1e57ebf04108a..e1c964a1793dc838cd23c1e954f55f1b7065b3e9 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/UEqn.H @@ -33,6 +33,8 @@ U = trTU() & ((UEqn() == sources(rho, U))().H() - gradp); } U.correctBoundaryConditions(); + + sources.correct(U); } else { @@ -42,6 +44,8 @@ solve(UEqn() == -fvc::grad(p) + sources(rho, U)); + sources.correct(U); + trAU = 1.0/UEqn().A(); trAU().rename("rAU"); } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H similarity index 94% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H index ad924283eef67e97e6fcb193e0a12a6ce834ce9d..4fff74d224cadb920dec4f6c42b936dff55f0452 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createFields.H @@ -59,6 +59,3 @@ ); dimensionedScalar initialMass = fvc::domainIntegrate(rho); - - Info<< "Creating sources\n" << endl; - IObasicSourceList sources(mesh); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H similarity index 94% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H index 4eb2cb193cc43ea551ec1a0e03548bd8f498bdf2..614460f82bbc395c3f6022118604ae0adbefd590 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createZones.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/createZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); IOporosityModelList pZones(mesh); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H similarity index 100% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/pEqn.H rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/pEqn.H diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C similarity index 97% rename from applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C rename to applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C index b552cadfcef253000d0e5352d941ae912d65348b..55169f14419694b6189650c2ab559155c60e11f2 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousSimpleFoam/rhoPorousSimpleFoam.C @@ -34,7 +34,7 @@ Description #include "fvCFD.H" #include "rhoThermo.H" #include "RASModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "IObasicSourceList.H" #include "IOporosityModelList.H" #include "simpleControl.H" @@ -50,6 +50,7 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); #include "createFields.H" + #include "createSources.H" #include "createZones.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index efc1067db233ca92b1a286fad6f799a6c77ea6c7..e0adb91773aba04a666bcb2c483eb6a049d8b69c 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H index 1ffacc1afaf9c5a2495e8e321c84f65a7ea592ac..02300d8a9e9a62676aa78bad3a9b53fae6f119ee 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/pEqn.H @@ -45,7 +45,7 @@ if (simple.transonic()) // Relax the pressure equation to maintain diagonal dominance pEqn.relax(); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.setReference(pRefCell, pRefValue); @@ -82,7 +82,7 @@ else sources(psi, p, rho.name()) ); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.setReference(pRefCell, pRefValue); diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C index 41e15dbfa842e5c8b75228e95c37edf5cc3d2234..be186ff319d8b1e91f6cce94e09746308dc7353e 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C @@ -49,6 +49,7 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..712a3a9ab4d4a8885f0b3bc05aa0623eaddbbc1d --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H @@ -0,0 +1,32 @@ +{ + volScalarField& he = thermo.he(); + + fvScalarMatrix EEqn + ( + fvm::ddt(rho, he) + fvm::div(phi, he) + + fvc::ddt(rho, K) + fvc::div(phi, K) + + ( + he.name() == "e" + ? fvc::div + ( + fvc::absolute(phi/fvc::interpolate(rho), U), + p, + "div(phiv,p)" + ) + : -dpdt + ) + - fvm::laplacian(turbulence->alphaEff(), he) + == + sources(rho, he) + ); + + EEqn.relax(); + + sources.constrain(EEqn); + + EEqn.solve(); + + sources.correct(he); + + thermo.correct(); +} diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options index 5d86b094de32587a79d2bade587ef6f47ccbeb90..6962643dcd609b438ad5e64f56641b41fa1221cb 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options @@ -1,21 +1,21 @@ EXE_INC = \ - -I../../compressible/rhoPimpleFoam \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel EXE_LIBS = \ + -lfiniteVolume \ + -lsampling \ -lmeshTools \ + -lfieldSources \ -lfluidThermophysicalModels \ + -lradiationModels \ -lspecie \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ - -lcompressibleLESModels \ - -lfiniteVolume \ - -lsampling \ - -lmeshTools \ - -lfieldSources + -lcompressibleLESModels diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H index d8f3bb56ce13a0455c52f7ccbe598f353ea21b2e..892de138bffdcf71b60214f1ee1944bc8456b662 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/UEqn.H @@ -5,10 +5,14 @@ fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divDevRhoReff(U) + == + sources(rho, U) ); UEqn.relax(); + sources.constrain(UEqn); + if (pimple.momentumPredictor()) { solve @@ -22,7 +26,8 @@ - fvc::snGrad(p_rgh) )*mesh.magSf() ) - + sources(rho, U) ); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index 79d3fb7f2f7668b4dbf1696c25ac7f38a6a0c25b..bac6d8d03e98cd7620e282a18995f02a8bc849dc 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -36,7 +36,7 @@ Description #include "fvCFD.H" #include "rhoThermo.H" #include "turbulenceModel.H" -#include "fixedGradientFvPatchFields.H" +#include "radiationModel.H" #include "IObasicSourceList.H" #include "pimpleControl.H" @@ -49,6 +49,8 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" + #include "createRadiationModel.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index 9838978028edd00a3f9fbce7563b59bce0dcc9cb..eaa078c6ad6ad439d5bc0c74a3188cff234f9490 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -1,9 +1,6 @@ Info<< "Reading thermophysical properties\n" << endl; - autoPtr<rhoThermo> pThermo - ( - rhoThermo::New(mesh) - ); + autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh)); rhoThermo& thermo = pThermo(); thermo.validate(args.executable(), "h", "e"); @@ -89,6 +86,3 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); - - Info<< "Creating sources\n" << endl; - IObasicSourceList sources(mesh); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H index 86c314c9c4bab41f858844d961d85eeaac511ccf..99bef3a118b8f6163992997b6221bfa00ded3185 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/pEqn.H @@ -9,7 +9,7 @@ surfaceScalarField rhorAUf("Dp", fvc::interpolate(rho*rAU)); volVectorField HbyA("HbyA", U); - HbyA = rAU*(UEqn == sources(rho, U))().H(); + HbyA = rAU*UEqn.H(); surfaceScalarField phig(-rhorAUf*ghf*fvc::snGrad(rho)*mesh.magSf()); @@ -24,6 +24,8 @@ + phig ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + fvScalarMatrix p_rghDDtEqn ( fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) @@ -40,7 +42,7 @@ - fvm::laplacian(rhorAUf, p_rgh) ); - sources.constrain(p_rghEqn, rho.name()); + sources.constrain(p_rghEqn); p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H index e4c79b40cc5685ddbeeab18c32e8611d745656b8..f84961f181120c012dc105fb9e641e5e219d770d 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H @@ -10,10 +10,19 @@ : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) ) - fvm::laplacian(turbulence->alphaEff(), he) + == + radiation->Sh(thermo) + + sources(rho, he) ); EEqn.relax(); + + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); + radiation->correct(); } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options index 74ddd1244659aa9f6591ddb2ea9f9b2d46881429..5103b2dd72c6c1c05a19a38ff441ca31f39b197e 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options @@ -1,14 +1,22 @@ EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/turbulenceModels/RAS \ EXE_LIBS = \ + -lfiniteVolume \ + -lfieldSources \ + -lsampling \ -lmeshTools \ -lfluidThermophysicalModels \ -lspecie \ + -lradiationModels \ -lcompressibleTurbulenceModel \ -lcompressibleRASModels \ - -lfiniteVolume + -lmeshTools diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H index ca28910aaf3c51186663b2fb5919104d4fd07398..82e85ca563cba050802eba2ff17264a140494436 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/UEqn.H @@ -4,10 +4,14 @@ ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) + == + sources(rho, U) ); UEqn().relax(); + sources.constrain(UEqn()); + if (simple.momentumPredictor()) { solve @@ -22,4 +26,6 @@ )*mesh.magSf() ) ); + + sources.correct(U); } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index 4a9387c1882b17967d218a95e68553f29d52b64c..0b401c974c3d95b48b4144e936af5552316e683f 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -22,18 +22,20 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Application - buoyantSimpleFoam + buoyantSimpleRadiationFoam Description - Steady-state solver for buoyant, turbulent flow of compressible fluids + Steady-state solver for buoyant, turbulent flow of compressible fluids, + including radiation, for ventilation and heat-transfer. \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "psiThermo.H" #include "RASModel.H" -#include "fixedGradientFvPatchFields.H" +#include "radiationModel.H" #include "simpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,6 +46,8 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" + #include "createRadiationModel.H" #include "initContinuityErrs.H" simpleControl simple(mesh); diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H deleted file mode 100644 index 0d1f41d0c30326a6647e51a0be4cc958921d69b8..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H +++ /dev/null @@ -1,22 +0,0 @@ -{ - volScalarField& he = thermo.he(); - - fvScalarMatrix EEqn - ( - fvm::div(phi, he) - + ( - he.name() == "e" - ? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho)) - : fvc::div(phi, volScalarField("K", 0.5*magSqr(U))) - ) - - fvm::laplacian(turbulence->alphaEff(), he) - == - radiation->Sh(thermo) - ); - - EEqn.relax(); - EEqn.solve(); - - thermo.correct(); - radiation->correct(); -} diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/files b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/files deleted file mode 100644 index a8347c552591472f0adfd57571aebeb0d2cb440e..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -buoyantSimpleRadiationFoam.C - -EXE = $(FOAM_APPBIN)/buoyantSimpleRadiationFoam diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/options deleted file mode 100644 index f26046adb2a08affb14512022e8082ea6fc73b51..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/options +++ /dev/null @@ -1,18 +0,0 @@ -EXE_INC = \ - -I.. \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ - -I$(LIB_SRC)/turbulenceModels \ - -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/RAS \ - -I$(LIB_SRC)/finiteVolume/cfdTools \ - -I$(LIB_SRC)/finiteVolume/lnInclude - -EXE_LIBS = \ - -lfluidThermophysicalModels \ - -lspecie \ - -lradiationModels \ - -lcompressibleTurbulenceModel \ - -lcompressibleRASModels \ - -lfiniteVolume \ - -lmeshTools diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C deleted file mode 100644 index d02853591ebfa8ca324256c1a3a66bbb2baa75ab..0000000000000000000000000000000000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ /dev/null @@ -1,84 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Application - buoyantSimpleRadiationFoam - -Description - Steady-state solver for buoyant, turbulent flow of compressible fluids, - including radiation, for ventilation and heat-transfer. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "psiThermo.H" -#include "RASModel.H" -#include "fixedGradientFvPatchFields.H" -#include "radiationModel.H" -#include "simpleControl.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "setRootCase.H" - #include "createTime.H" - #include "createMesh.H" - #include "readGravitationalAcceleration.H" - #include "createFields.H" - #include "createRadiationModel.H" - #include "initContinuityErrs.H" - - simpleControl simple(mesh); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (simple.loop()) - { - Info<< "Time = " << runTime.timeName() << nl << endl; - - // Pressure-velocity SIMPLE corrector - { - #include "UEqn.H" - #include "EEqn.H" - #include "pEqn.H" - } - - turbulence->correct(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H index f63e12f363774a88972459f748bd5162501fc0a4..2e6cbf3d47d000cd34923efb37740ccd76d6ae3f 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/pEqn.H @@ -17,6 +17,8 @@ fvc::interpolate(rho)*(fvc::interpolate(HbyA) & mesh.Sf()) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + bool closedVolume = adjustPhi(phiHbyA, U, p_rgh); phiHbyA += phig; @@ -43,6 +45,7 @@ // calculated from the relaxed pressure U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C index a0bd72c3b4b73d2d0a28a80acb40f7a95d7ec863..7805adf8d76f7f4753a89aa5115aef2437c479c4 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionFoam.C @@ -45,7 +45,6 @@ Description #include "solidRegionDiffNo.H" #include "solidThermo.H" #include "radiationModel.H" -#include "IOporosityModelList.H" #include "IObasicSourceList.H" diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C index 45861220061db63a2bb6d2fe75671e8addec2b49..149a81a3a4b61484c154809536b9d5048fa013e9 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/chtMultiRegionSimpleFoam.C @@ -36,7 +36,6 @@ Description #include "regionProperties.H" #include "solidThermo.H" #include "radiationModel.H" -#include "IOporosityModelList.H" #include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H index be84cfce0e70866d09a850892603a5845a1e04d5..01f2d3223382941b96c86b0bf99e950dda153399 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/EEqn.H @@ -16,8 +16,13 @@ ); EEqn.relax(); + + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); rad.correct(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H index 8bbc8be5813473b16e1779f85869faee091a4f4e..e5ab958f1098be0db9d7891fd826691f735e57a9 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/UEqn.H @@ -3,13 +3,13 @@ ( fvm::div(phi, U) + turb.divDevRhoReff(U) - + sources(rho, U) + == + sources(rho, U) ); UEqn().relax(); - // Add porous resistance - pZones.addResistance(UEqn()); + sources.constrain(UEqn()); solve ( @@ -23,3 +23,5 @@ )*mesh.magSf() ) ); + + sources.correct(U); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H index 3d66fa798b6bd653efc93ea38b1e35347b72bd9c..cc5eda691d9e2779a037f950e4cb93b0f183accd 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/createFluidFields.H @@ -17,8 +17,7 @@ PtrList<dimensionedScalar> rhoMax(fluidRegions.size()); PtrList<dimensionedScalar> rhoMin(fluidRegions.size()); - PtrList<IObasicSourceList> heatSources(fluidRegions.size()); - PtrList<IOporosityModelList> porousZonesFluid(fluidRegions.size()); + PtrList<IObasicSourceList> fluidSources(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -195,18 +194,11 @@ ); Info<< " Adding sources\n" << endl; - heatSources.set + fluidSources.set ( i, new IObasicSourceList(fluidRegions[i]) ); - - Info<< " Adding porous zones\n" << endl; - porousZonesFluid.set - ( - i, - new IOporosityModelList(fluidRegions[i]) - ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H index d2ea510ced756fd512808be931430aa46287e3a6..fca0848912396266a81e377094fd4c7aaef6548c 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/pEqn.H @@ -23,6 +23,8 @@ phiHbyA += phig; + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + dimensionedScalar compressibility = fvc::domainIntegrate(psi); bool compressible = (compressibility.value() > SMALL); @@ -54,6 +56,7 @@ // calculated from the relaxed pressure U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H index 4f15d8c6192c87acd9401c2ce0184d5c19faa1cb..935b27d57ce1bc83e40aa8113f66fba0bad8ddd2 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/fluid/setRegionFluidFields.H @@ -12,9 +12,7 @@ volScalarField& p = thermo.p(); const volScalarField& psi = thermo.psi(); - IObasicSourceList& sources = heatSources[i]; - - const IOporosityModelList& pZones = porousZonesFluid[i]; + IObasicSourceList& sources = fluidSources[i]; const dimensionedScalar initialMass ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H index a0905d3e4fd9802351c800ae4b96ae52d70885c1..d0f5dbc656a8200148df5e50be0f97ffa9081765 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/solveSolid.H @@ -6,8 +6,14 @@ - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)") + sources(rho, h) ); + hEqn.relax(); + + sources.constrain(hEqn); + hEqn.solve(); + + sources.correct(h); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H index 9f41c9eb37517366bdf4a00913ac440557c73917..143ca3a7425b80fc79a6083d3d7d19eab9472498 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H @@ -22,8 +22,13 @@ ); EEqn.relax(); + + sources.constrain(EEqn); + EEqn.solve(mesh.solver(he.select(finalIter))); + sources.correct(he); + thermo.correct(); rad.correct(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H index 87bd5924f49f92897561eec47e965d2749b05b80..9c32ec054e1e9537fb01b020dd153003f82ce984 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/UEqn.H @@ -9,8 +9,7 @@ UEqn().relax(); - // Add porous resistance - pZones.addResistance(UEqn()); + sources.constrain(UEqn()); if (momentumPredictor) { @@ -21,11 +20,13 @@ fvc::reconstruct ( ( - - ghf*fvc::snGrad(rho) - - fvc::snGrad(p_rgh) + - ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) )*mesh.magSf() ), mesh.solver(U.select(finalIter)) ); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index a2021a5edc66f83255886fc86c18535c4c2e689d..fbc39c85569d6e478ab99659512b2493d9dbf89c 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -14,8 +14,7 @@ List<scalar> initialMassFluid(fluidRegions.size()); - PtrList<IObasicSourceList> heatSources(fluidRegions.size()); - PtrList<IOporosityModelList> porousZonesFluid(fluidRegions.size()); + PtrList<IObasicSourceList> fluidSources(fluidRegions.size()); // Populate fluid field pointer lists forAll(fluidRegions, i) @@ -192,16 +191,9 @@ ); Info<< " Adding sources\n" << endl; - heatSources.set + fluidSources.set ( i, new IObasicSourceList(fluidRegions[i]) ); - - Info<< " Adding porous zones\n" << endl; - porousZonesFluid.set - ( - i, - new IOporosityModelList(fluidRegions[i]) - ); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H index 753c3257de033e361dbeecafced8d21f665bc5f6..2944c6aef06de6b84e767b0e2fa74187078f013a 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H @@ -24,6 +24,8 @@ + phig ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + { fvScalarMatrix p_rghDDtEqn ( @@ -64,6 +66,7 @@ U = HbyA + rAU*fvc::reconstruct((phig + p_rghEqn.flux())/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); K = 0.5*magSqr(U); } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index 28f0ea96834746cf0dfafaea0951bbd8a5b5503c..84a22048e422f86bf48d47b9e2c2891981495e38 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -20,9 +20,7 @@ radiation::radiationModel& rad = radiation[i]; - IObasicSourceList& sources = heatSources[i]; - - const IOporosityModelList& pZones = porousZonesFluid[i]; + IObasicSourceList& sources = fluidSources[i]; const dimensionedScalar initialMass ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index a04750cf17ac37a98c582ff3fd3a5ea8a103944e..be24cc2ba08d3bd53b0efa960847153065789614 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -10,10 +10,17 @@ if (finalIter) ( fvm::ddt(betav*rho, h) - fvm::laplacian(betav*alpha, h, "laplacian(alpha,h)") - + sources(rho, h) + == + sources(rho, h) ); + hEqn().relax(); + + sources.constrain(hEqn()); + hEqn().solve(mesh.solver(h.select(finalIter))); + + sources.correct(h); } } diff --git a/applications/solvers/incompressible/icoFoam/Make/options b/applications/solvers/incompressible/icoFoam/Make/options index fa15f124528ebfcaf279a88a73a0d7954f2e9dc1..d38cd8b1801b429e5f42c7b0ba2ab58ba2cd1d11 100644 --- a/applications/solvers/incompressible/icoFoam/Make/options +++ b/applications/solvers/incompressible/icoFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -lsampling diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C index 7085c5bd351f4957836ef768b7497630abe6112c..19b42eb4d53321b3bac32caeb083efbde9eba69f 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/SRFPimpleFoam.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 @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H index 8b496a6aed5f73765f5156be78af592d1c97e65d..4c5ec3c9a9c0a6303648d4babfcb87051e226c60 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/UrelEqn.H @@ -12,3 +12,5 @@ sources.constrain(UrelEqn()); solve(UrelEqn() == -fvc::grad(p) + sources(Urel)); + + sources.correct(Urel); diff --git a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H index 5895a554429ea70e9f2aac70596632952c50cce5..a6cff20e14249006eca5ae86f7c20745b90e68d0 100644 --- a/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleFoam/SRFPimpleFoam/createFields.H @@ -70,6 +70,3 @@ volVectorField U ), Urel + SRF->U() ); - - -IObasicSourceList sources(mesh); diff --git a/applications/solvers/incompressible/pimpleFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/UEqn.H index a6aef51dafb35a9fee2033b0a07a38f8404f2296..94913478a606ba4990c313f81bdccc5d9f6e9482 100644 --- a/applications/solvers/incompressible/pimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/UEqn.H @@ -5,6 +5,8 @@ tmp<fvVectorMatrix> UEqn fvm::ddt(U) + fvm::div(phi, U) + turbulence->divDevReff(U) + == + sources(U) ); UEqn().relax(); @@ -15,5 +17,7 @@ volScalarField rAU(1.0/UEqn().A()); if (pimple.momentumPredictor()) { - solve(UEqn() == -fvc::grad(p) + sources(U)); + solve(UEqn() == -fvc::grad(p)); + + sources.correct(U); } diff --git a/applications/solvers/incompressible/pimpleFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/createFields.H index bb4366cdd79583acb0121b50362d881431b3e850..e4127150c0d8f3ffba6326ab3edd187434f94c98 100644 --- a/applications/solvers/incompressible/pimpleFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleFoam/createFields.H @@ -40,6 +40,3 @@ autoPtr<incompressible::turbulenceModel> turbulence ( incompressible::turbulenceModel::New(U, phi, laminarTransport) ); - - -IObasicSourceList sources(mesh); diff --git a/applications/solvers/incompressible/pimpleFoam/pEqn.H b/applications/solvers/incompressible/pimpleFoam/pEqn.H index 444ad4450359fccd04531fdede2261c68f33c68f..9fc62bd9f13163a24aff6e02ec7b1dcb804878b2 100644 --- a/applications/solvers/incompressible/pimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pEqn.H @@ -1,5 +1,5 @@ volVectorField HbyA("HbyA", U); -HbyA = rAU*(UEqn() == sources(U))().H(); +HbyA = rAU*UEqn().H(); if (pimple.nCorrPISO() <= 1) { @@ -15,6 +15,8 @@ surfaceScalarField phiHbyA adjustPhi(phiHbyA, U, p); +sources.relativeFlux(phiHbyA); + // Non-orthogonal pressure corrector loop while (pimple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options index 8aa441b18ebacb0a7738d35304c4ae483e6e1636..11c10272ffdb980f046dfeac141a476a640bd65f 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/Make/options @@ -17,6 +17,7 @@ EXE_LIBS = \ -ldynamicMesh \ -lmeshTools \ -lincompressibleTransportModels \ + -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lfiniteVolume \ diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H index 618816f5fe1e3a54d658632ab07d43f12920e9f0..c125d2ac2aee303e75d3dd2ea23f71ca4523344d 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/UEqn.H @@ -16,4 +16,6 @@ rAU = 1.0/UEqn().A(); if (pimple.momentumPredictor()) { solve(UEqn() == -fvc::grad(p) + sources(U)); + + sources.correct(U); } diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H index 701a3ff7330bdb62b8a2faedf2e017cd6d6f5daa..16b3bd977d07b6979d2cb84e5f12100cc8910921 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/createFields.H @@ -56,6 +56,3 @@ runTime.deltaT(), zeroGradientFvPatchScalarField::typeName ); - - - IObasicSourceList sources(mesh); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C index 03299b71bb767c1b6eb0ac2033145451bd224133..27fc93f341a608605efedc9d1acfb9c7eb467c16 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleDyMFoam/pimpleDyMFoam.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 @@ -49,6 +49,7 @@ int main(int argc, char *argv[]) #include "createDynamicFvMesh.H" #include "initContinuityErrs.H" #include "createFields.H" + #include "createSources.H" #include "readTimeControls.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index 8d581934fb2fb15fcacc52964ddf0493f80abef4..ceb186cdbf42bdfc6270115e0d280bbfc333b6a3 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.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 @@ -28,7 +28,9 @@ Description Large time-step transient solver for incompressible, flow using the PIMPLE (merged PISO-SIMPLE) algorithm. - Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. + Sub-models include: + - turbulence modelling, i.e. laminar, RAS or LES + - run-time selectable sources, e.g. MRF, explicit porosity \*---------------------------------------------------------------------------*/ @@ -37,6 +39,8 @@ Description #include "turbulenceModel.H" #include "pimpleControl.H" #include "IObasicSourceList.H" +#include "IOporosityModelList.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,6 +50,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" pimpleControl pimple(mesh); diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H index 74e84d9bfc9a9c41ce65b7f570ece27c735bcdb8..123eaf7ac63e67fc65279a7109f2dfa1ec4e2671 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/UEqn.H @@ -13,4 +13,6 @@ sources.constrain(UEqn()); if (pimple.momentumPredictor()) { solve(UEqn() == -fvc::grad(p_gh) + sources(U)); + + sources.correct(U); } diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/createFields.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/createFields.H index 4437f4983dd4623cdf0de8b837dd83b993709d32..9e1c7aa9ad9a746d5d1d37dc46e4257dc6f35979 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/createFields.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/createFields.H @@ -37,48 +37,6 @@ #include "readGravitationalAcceleration.H" - Info<< "\nReading freeSurfaceProperties\n" << endl; - - IOdictionary freeSurfaceProperties - ( - IOobject - ( - "freeSurfaceProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - word freeSurfacePatch(freeSurfaceProperties.lookup("freeSurfacePatch")); - label freeSurfacePatchI = mesh.boundaryMesh().findPatchID(freeSurfacePatch); - if (freeSurfacePatchI < 0) - { - FatalErrorIn(args.executable()) - << "Patch " << freeSurfacePatch << " not found. " - << "Available patches are:" << mesh.boundaryMesh().names() - << exit(FatalError); - } - - Info<< "Creating field refLevel\n" << endl; - volVectorField refLevel - ( - IOobject - ( - "refLevel", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimensionedVector("zero", dimLength, vector::zero) - ); - - refLevel.boundaryField()[freeSurfacePatchI] - == mesh.C().boundaryField()[freeSurfacePatchI]; - Info<< "Creating field zeta\n" << endl; volVectorField zeta ( @@ -110,12 +68,9 @@ // Force p_gh to be consistent with p // Height is made relative to field 'refLevel' - p_gh = p - (g & (mesh.C() + zeta - refLevel)); + p_gh = p - (g & mesh.C()); label p_ghRefCell = 0; scalar p_ghRefValue = 0.0; setRefCell(p_gh, pimple.dict(), p_ghRefCell, p_ghRefValue); - - - IObasicSourceList sources(mesh); diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H b/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H index 5a521a04fffd27c9b334a9266448f6c3e324f601..42b72484d1d7e9a0f78a4e42570780ce7faaee99 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/pEqn.H @@ -42,7 +42,7 @@ while (pimple.correctNonOrthogonal()) // Explicitly relax pressure for momentum corrector p_gh.relax(); -p = p_gh + (g & (mesh.C() + zeta - refLevel)); +p = p_gh + (g & mesh.C()); U = HbyA - rAU*fvc::grad(p_gh); U.correctBoundaryConditions(); diff --git a/applications/solvers/incompressible/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C b/applications/solvers/incompressible/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C index 35a787e97b989883a91c04c0145823fef9ff215a..114c183c4c47a6892c73548fdaa2a687d8e110a0 100644 --- a/applications/solvers/incompressible/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C +++ b/applications/solvers/incompressible/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.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 @@ -52,6 +52,7 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/incompressible/simpleFoam/Allwmake b/applications/solvers/incompressible/simpleFoam/Allwmake index c73703955a90a1ac95d2b9cd909fdcc599d2e56b..801fd3b767bf1abcd414509438ee99f14456a324 100755 --- a/applications/solvers/incompressible/simpleFoam/Allwmake +++ b/applications/solvers/incompressible/simpleFoam/Allwmake @@ -5,7 +5,6 @@ set -x wmake wmake SRFSimpleFoam -wmake MRFSimpleFoam wmake porousSimpleFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/files b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/files deleted file mode 100644 index 56c194272d88eb33bf2b86f1d54567e0bdf1d930..0000000000000000000000000000000000000000 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -MRFSimpleFoam.C - -EXE = $(FOAM_APPBIN)/MRFSimpleFoam diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/options b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/options deleted file mode 100644 index e9f47baf9b4a1c37fb5444c7aec9168980fbcba4..0000000000000000000000000000000000000000 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/Make/options +++ /dev/null @@ -1,19 +0,0 @@ -EXE_INC = \ - -I.. \ - -I$(LIB_SRC)/turbulenceModels \ - -I$(LIB_SRC)/turbulenceModels/incompressible/RAS/RASModel \ - -I$(LIB_SRC)/transportModels \ - -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/fieldSources/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - - -EXE_LIBS = \ - -lincompressibleRASModels \ - -lincompressibleTransportModels \ - -lfiniteVolume \ - -lmeshTools \ - -lfieldSources \ - -lsampling diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H deleted file mode 100644 index 8c39a839f71f232d21ade27671e2b2fd3e3fa08a..0000000000000000000000000000000000000000 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/UEqn.H +++ /dev/null @@ -1,17 +0,0 @@ - // Momentum predictor - - tmp<fvVectorMatrix> UEqn - ( - fvm::div(phi, U) - + turbulence->divDevReff(U) - == - sources(U) - ); - - mrfZones.addCoriolis(UEqn()); - - sources.constrain(UEqn()); - - UEqn().relax(); - - solve(UEqn() == -fvc::grad(p)); diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H deleted file mode 100644 index b7bf83e8cd98f73c80bf70c0250da8e3d028fa16..0000000000000000000000000000000000000000 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/pEqn.H +++ /dev/null @@ -1,38 +0,0 @@ -{ - volScalarField rAU(1.0/UEqn().A()); - volVectorField HbyA("HbyA", U); - HbyA = rAU*UEqn().H(); - UEqn.clear(); - - surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); - adjustPhi(phiHbyA, U, p); - mrfZones.relativeFlux(phiHbyA); - adjustPhi(phiHbyA, U, p); - - // Non-orthogonal pressure corrector loop - while (simple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(rAU, p) == fvc::div(phiHbyA) - ); - - pEqn.setReference(pRefCell, pRefValue); - pEqn.solve(); - - if (simple.finalNonOrthogonalIter()) - { - phi = phiHbyA - pEqn.flux(); - } - } - - #include "continuityErrs.H" - - // Explicitly relax pressure for momentum corrector - p.relax(); - - // Momentum corrector - U = HbyA - rAU*fvc::grad(p); - U.correctBoundaryConditions(); - sources.correct(U); -} diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.C b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.C index 3631b154a6fa19a8f968fe9d247ff52dbacbbe45..eab6907e8da0dc355f34211373f12f2d98cef851 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/SRFSimpleFoam.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 @@ -45,6 +45,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" simpleControl simple(mesh); diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H index fb605fffd363507c4007333e16afecbb81a5c6da..265a731269581fd04789f21eb537444b4f0baa69 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/UrelEqn.H @@ -14,3 +14,5 @@ sources.constrain(UrelEqn()); solve(UrelEqn() == -fvc::grad(p)); + + sources.correct(Urel); diff --git a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/createFields.H b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/createFields.H index 0df5760babce6bd52ddb0fc41a60480df6e09ab8..78eea98cf3315af16542dcbb8b647f9e4e201f86 100644 --- a/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/createFields.H +++ b/applications/solvers/incompressible/simpleFoam/SRFSimpleFoam/createFields.H @@ -52,9 +52,4 @@ ); Info<< "Creating SRF model\n" << endl; - autoPtr<SRF::SRFModel> SRF - ( - SRF::SRFModel::New(Urel) - ); - - IObasicSourceList sources(mesh); + autoPtr<SRF::SRFModel> SRF(SRF::SRFModel::New(Urel)); diff --git a/applications/solvers/incompressible/simpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/UEqn.H index 786c4f59196305bf0362c6e733165ad8c8cf1525..719e294a08167fa92d68092466b3019fb6e59a1a 100644 --- a/applications/solvers/incompressible/simpleFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/UEqn.H @@ -13,3 +13,5 @@ sources.constrain(UEqn()); solve(UEqn() == -fvc::grad(p)); + + sources.correct(U); diff --git a/applications/solvers/incompressible/simpleFoam/createFields.H b/applications/solvers/incompressible/simpleFoam/createFields.H index 97d40c3f0735ee9e3604f2d46ff79f685391d683..947da10c9d357a84850c37b2ae13f21ae9ab9499 100644 --- a/applications/solvers/incompressible/simpleFoam/createFields.H +++ b/applications/solvers/incompressible/simpleFoam/createFields.H @@ -39,5 +39,3 @@ ( incompressible::RASModel::New(U, phi, laminarTransport) ); - - IObasicSourceList sources(mesh); diff --git a/applications/solvers/incompressible/simpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/pEqn.H index adc0c0761a2f9a08b44270243423b176eea995c7..116929e3ea9ef23ae220cd9910ce240554266954 100644 --- a/applications/solvers/incompressible/simpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/pEqn.H @@ -7,6 +7,8 @@ surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); adjustPhi(phiHbyA, U, p); + sources.relativeFlux(phiHbyA); + // Non-orthogonal pressure corrector loop while (simple.correctNonOrthogonal()) { diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/UEqn.H index 632a160030e9b65501e13d6634ae25a53bfa321b..3ce7e2f533d792b57167d27e0c8a3fa4fea26e35 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/UEqn.H @@ -8,9 +8,9 @@ sources(U) ); - UEqn().relax(); + mrfZones.addCoriolis(UEqn()); - sources.constrain(UEqn()); + UEqn().relax(); // Include the porous media resistance and solve the momentum equation // either implicit in the tensorial resistance or transport using by @@ -26,6 +26,8 @@ trTU = inv(tTU()); trTU().rename("rAU"); + sources.constrain(UEqn()); + volVectorField gradp(fvc::grad(p)); for (int UCorr=0; UCorr<nUCorr; UCorr++) @@ -33,13 +35,19 @@ U = trTU() & (UEqn().H() - gradp); } U.correctBoundaryConditions(); + + sources.correct(U); } else { pZones.addResistance(UEqn()); + sources.constrain(UEqn()); + solve(UEqn() == -fvc::grad(p)); + sources.correct(U); + trAU = 1.0/UEqn().A(); trAU().rename("rAU"); } diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createZones.H similarity index 88% rename from applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H rename to applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createZones.H index 5c6dbea19c4122682311089f3a5f3ddb16d870f6..25c29f024cd215c2785dfceef8a285237fa4b733 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createPorousZones.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/createZones.H @@ -1,3 +1,6 @@ + IOMRFZoneList mrfZones(mesh); + mrfZones.correctBoundaryVelocity(U); + IOporosityModelList pZones(mesh); Switch pressureImplicitPorosity(false); diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H index 8193e072c513972f2463c51339d9a43f4017d109..7aa494744fe554cab28351d8ff2e70dca9bb0ebe 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/pEqn.H @@ -12,6 +12,8 @@ UEqn.clear(); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); adjustPhi(phiHbyA, U, p); +mrfZones.relativeFlux(phiHbyA); + while (simple.correctNonOrthogonal()) { tmp<fvScalarMatrix> tpEqn; @@ -50,3 +52,4 @@ else } U.correctBoundaryConditions(); +sources.correct(U); diff --git a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C index bde78bcbe155eb56a0a213c688e1ee317a1f0d4a..4c3563ac8f14cae5db4cc696001b877f29c36ce6 100644 --- a/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/porousSimpleFoam/porousSimpleFoam.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,15 +26,17 @@ Application Description Steady-state solver for incompressible, turbulent flow with - implicit or explicit porosity treatment + implicit or explicit porosity treatment and support for multiple reference + frames (MRF) \*---------------------------------------------------------------------------*/ #include "fvCFD.H" #include "singlePhaseTransportModel.H" #include "RASModel.H" -#include "IOporosityModelList.H" #include "simpleControl.H" +#include "IOMRFZoneList.H" +#include "IOporosityModelList.H" #include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,7 +50,8 @@ int main(int argc, char *argv[]) simpleControl simple(mesh); #include "createFields.H" - #include "createPorousZones.H" + #include "createSources.H" + #include "createZones.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/incompressible/simpleFoam/simpleFoam.C b/applications/solvers/incompressible/simpleFoam/simpleFoam.C index 3b3d57998d12084811d267880803dea8fca0201d..80bca738bdc3d0241fb84fe9e9e64c0890f9ac6f 100644 --- a/applications/solvers/incompressible/simpleFoam/simpleFoam.C +++ b/applications/solvers/incompressible/simpleFoam/simpleFoam.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 @@ -43,6 +43,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createMesh.H" #include "createFields.H" + #include "createSources.H" #include "initContinuityErrs.H" simpleControl simple(mesh); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H index 92219b9879f0bd5d21b5a3b52217051dea48ee41..37ca5e82a48b82b15ac95fb1e72c0ac32e62f40f 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/EEqn.H @@ -25,9 +25,13 @@ ); EEqn.relax(); + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); radiation->correct(); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H index 24f56e83d23232a5a3e97018f420f73cd13f4abc..3dee99c1c7731e3f375d6394b8e2942f2ed43a92 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/UEqn.H @@ -7,6 +7,7 @@ rho.dimensionedInternalField()*g + coalParcels.SU(U) + limestoneParcels.SU(U) + + sources(rho, U) ); UEqn.relax(); @@ -15,6 +16,8 @@ if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p) + sources(rho, U)); + solve(UEqn == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H index f07208909c9f0fca775d3c5d9cd8db66ee5d885b..a5c39e84736ca4e883c88dd1f98a53ee7ccae863 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/YEqn.H @@ -39,6 +39,8 @@ tmp<fv::convectionScheme<scalar> > mvConvection YiEqn.solve(mesh.solver("Yi")); + sources.correct(Yi); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 6832d01458abe358cf1fdfab87d8b139aad58f00..2197ae8d52577cd1023feefe22cc0438cc7d0969 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -55,6 +55,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "createClouds.H" #include "createRadiationModel.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H index d76805c25a1f3a441cf2765082b5e1a98fba1cba..1a45776ed4d5eb2acb7ce1dec21fc76e348044f7 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createFields.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createFields.H @@ -126,9 +126,6 @@ Info<< "Creating field kinetic energy K\n" << endl; volScalarField K("K", 0.5*magSqr(U)); - Info<< "\nConstructing sources" << endl; - IObasicSourceList sources(mesh); - volScalarField dQ ( IOobject diff --git a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H index 22d927ca6b109b721d4c36f579c6057575b098f0..0baee1ad3027eefd2261248ab45bb988b913c3f0 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/pEqn.H @@ -2,7 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*(UEqn == sources(rho, U))().H(); +HbyA = rAU*UEqn.H(); if (pimple.transonic()) { @@ -16,6 +16,8 @@ if (pimple.transonic()) ) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -28,7 +30,7 @@ if (pimple.transonic()) + sources(psi, p, rho.name()) ); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); @@ -50,6 +52,8 @@ else ) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -62,7 +66,7 @@ else + sources(psi, p, rho.name()) ); - sources.constrain(pEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/rhoEqn.H b/applications/solvers/lagrangian/coalChemistryFoam/rhoEqn.H index c8e8193eb2c7c8eb95c248b472f37c194d14ef25..5c37255fefda07355b4b68bf93f8ca8eecf52090 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/rhoEqn.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 @@ -42,6 +42,8 @@ Description sources.constrain(rhoEqn); rhoEqn.solve(); + + sources.correct(rho); } // ************************************************************************* // diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H index f5a909a9dd00d45733e44175250a9700deb50d24..4abcdcf4414326767ed2525d60abfecbac1c02ba 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/EEqn.H @@ -21,11 +21,17 @@ + surfaceFilm.Sh() + radiation->Sh(thermo) + combustion->Sh() + + sources(rho, he) ); EEqn.relax(); + + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); radiation->correct(); diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options index a477abff475c373cff3e7d55f71c69d7706bb88e..a2d24b6d11d75c9adde33dd5c5cbc3f7df8e69c8 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I${LIB_SRC}/sampling/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ @@ -25,6 +27,8 @@ EXE_INC = \ EXE_LIBS = \ -lfiniteVolume \ + -lfieldSources \ + -lsampling \ -lmeshTools \ -lcompressibleRASModels \ -lcompressibleLESModels \ diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H index 81c587e2438ce31da3b78672923bcf326c7a3a19..81d90bd695e912277c83e1744a9814f5b8cca7ec 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/UEqn.H @@ -5,10 +5,13 @@ + turbulence->divDevRhoReff(U) == parcels.SU(U) + + sources(rho, U) ); UEqn.relax(); + sources.constrain(UEqn); + if (pimple.momentumPredictor()) { solve @@ -23,5 +26,7 @@ )*mesh.magSf() ) ); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H index b14b7d6dae2d32e67e67d7ca2d8ad0fbc8e44533..615342c436419383bccbc1513093c756b7c32e83 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/YEqn.H @@ -22,18 +22,26 @@ tmp<fv::convectionScheme<scalar> > mvConvection { volScalarField& Yi = Y[i]; - solve + fvScalarMatrix YEqn ( fvm::ddt(rho, Yi) + mvConvection->fvmDiv(phi, Yi) - fvm::laplacian(turbulence->alphaEff(), Yi) == parcels.SYi(i, Yi) + + sources(rho, Yi) + + combustion->R(Yi) + surfaceFilm.Srho(i) - + combustion->R(Yi), - mesh.solver("Yi") ); + YEqn.relax(); + + sources.constrain(YEqn); + + YEqn.solve(mesh.solver("Yi")); + + sources.correct(Yi); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H index 6a09845b6b5822e9c71e16c5fdc0475732160b70..bcdd3beca46acfd90b8002086273b1194daa7325 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/pEqn.H @@ -18,6 +18,7 @@ surfaceScalarField phiHbyA + phig ); +sources.relativeFlux(fvc::interpolate(rho), phiHbyA); while (pimple.correctNonOrthogonal()) { @@ -30,8 +31,11 @@ while (pimple.correctNonOrthogonal()) == parcels.Srho() + surfaceFilm.Srho() + + sources(psi, p_rgh, rho.name()) ); + sources.constrain(p_rghEqn); + p_rghEqn.solve(mesh.solver(p_rgh.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -39,6 +43,7 @@ while (pimple.correctNonOrthogonal()) phi = phiHbyA + p_rghEqn.flux(); U = HbyA + rAU*fvc::reconstruct((p_rghEqn.flux() + phig)/rhorAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C index 06df5b17486a10591b46a851a6fe02f7ecf25d7d..80add60630f630f39c358e3ba64106f8436ab052 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/reactingParcelFilmFoam.C @@ -37,6 +37,7 @@ Description #include "psiCombustionModel.H" #include "radiationModel.H" #include "SLGThermo.H" +#include "IObasicSourceList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,6 +50,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "createClouds.H" #include "createRadiationModel.H" #include "createSurfaceFilmModel.H" diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H b/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H index f93906018171e762b96eb5ca4bc1e1ca85176742..5cc780abb1d02bd1621841aa52186429eb140d6f 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/rhoEqn.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 @@ -30,14 +30,21 @@ Description \*---------------------------------------------------------------------------*/ { - solve + fvScalarMatrix rhoEqn ( fvm::ddt(rho) + fvc::div(phi) == parcels.Srho(rho) + surfaceFilm.Srho() + + sources(rho) ); + + sources.constrain(rhoEqn); + + rhoEqn.solve(); + + sources.correct(rho); } // ************************************************************************* // diff --git a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H index c8ef9bf84e3b51d6c1b8d1fe1e706184e34220ac..57456fe791ccbbeba99d488fbeb27aed4dba949b 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/EEqn.H @@ -24,9 +24,13 @@ ); EEqn.relax(); + sources.constrain(EEqn); + EEqn.solve(); + sources.correct(he); + thermo.correct(); radiation->correct(); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C index 4ea17727d9e6cc9088a8952cf6c2175841fd6cf5..c0b75196073ed6890c2b59de3d38f1de0c1b842e 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/LTSReactingParcelFoam/LTSReactingParcelFoam.C @@ -60,11 +60,10 @@ int main(int argc, char *argv[]) #include "readTimeControls.H" #include "createFields.H" + #include "createSources.H" #include "createRDeltaT.H" #include "createRadiationModel.H" #include "createClouds.H" - #include "createExplicitSources.H" - #include "createPorousZones.H" #include "initContinuityErrs.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H index 090922e57215a6080e9b650189abf4353df40dc5..11d4b27ef8e137f9ed31df7d740588a450dcc739 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/UEqn.H @@ -1,22 +1,22 @@ fvVectorMatrix UEqn ( - //pZones.ddt(rho, U) fvm::ddt(rho, U) + fvm::div(phi, U) + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g + parcels.SU(U) + + sources(rho, U) ); UEqn.relax(); sources.constrain(UEqn); - pZones.addResistance(UEqn); - if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p) + sources(rho, U)); + solve(UEqn == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H index a22267d9be2706d4bcc01fc2562436e41b567c64..b7e40dcc59f616b40e4a9b18dbe5c5d280995ba1 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/YEqn.H @@ -38,6 +38,8 @@ tmp<fv::convectionScheme<scalar> > mvConvection YEqn.solve(mesh.solver("Yi")); + sources.correct(Yi); + Yi.max(0.0); Yt += Yi; } diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createExplicitSources.H b/applications/solvers/lagrangian/reactingParcelFoam/createExplicitSources.H deleted file mode 100644 index b2e5775e589ba78bb004f3469fcc52b6aec2384f..0000000000000000000000000000000000000000 --- a/applications/solvers/lagrangian/reactingParcelFoam/createExplicitSources.H +++ /dev/null @@ -1,2 +0,0 @@ -Info<< "Creating sources\n" << endl; -IObasicSourceList sources(mesh); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H b/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H deleted file mode 100644 index 05f0f044ce4314fc37f7c64f0a8808099199a213..0000000000000000000000000000000000000000 --- a/applications/solvers/lagrangian/reactingParcelFoam/createPorousZones.H +++ /dev/null @@ -1,3 +0,0 @@ - Info<< "Creating porous zones" << nl << endl; - - IOporosityModelList pZones(mesh); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H index 1bcdf7c92f917c1a1514b50ab0ccbe95f1d38f15..569beae05861d2922dab4f9e1a0ae40c94eb3753 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/pEqn.H @@ -7,17 +7,19 @@ volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA("HbyA", U); - HbyA = rAU*(UEqn == sources(rho, U))().H(); + HbyA = rAU*UEqn.H(); - surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(HbyA) & mesh.Sf()); - if (!pZones.active()) - { - // ddtPhiCorr only used without porosity - phiHbyA += fvc::ddtPhiCorr(rAU, rho, U, phi); - } - - phiHbyA *= fvc::interpolate(rho); + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::interpolate(rho) + *( + (fvc::interpolate(HbyA) & mesh.Sf()) + + fvc::ddtPhiCorr(rAU, rho, U, phi) + ) + ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); fvScalarMatrix pDDtEqn ( @@ -36,7 +38,7 @@ - fvm::laplacian(rho*rAU, p) ); - sources.constrain(pDDtEqn, rho.name()); + sources.constrain(pEqn); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index a8f43285433a4494c275f66cd556c65fddbc7f4d..c273f71856c525c2d7a84f5472cbbebd95dc424c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -64,8 +64,7 @@ int main(int argc, char *argv[]) #include "createFields.H" #include "createRadiationModel.H" #include "createClouds.H" - #include "createExplicitSources.H" - #include "createPorousZones.H" + #include "createSources.H" #include "initContinuityErrs.H" #include "readTimeControls.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H b/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H index f142f620bee4ebacc444681d4b529776a408780f..6ad34d56c7e082a4733f0dfd91a53ec0fd5e9abc 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/rhoEqn.H @@ -43,6 +43,8 @@ Description rhoEqn.solve(); + sources.correct(rho); + Info<< "rho min/max = " << min(rho).value() << ", " << max(rho).value() << endl; } diff --git a/applications/solvers/lagrangian/sprayFoam/UEqn.H b/applications/solvers/lagrangian/sprayFoam/UEqn.H index 2ddaa2c30155749a087748516f58fb1d1dd18032..11d4b27ef8e137f9ed31df7d740588a450dcc739 100644 --- a/applications/solvers/lagrangian/sprayFoam/UEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/UEqn.H @@ -6,6 +6,7 @@ == rho.dimensionedInternalField()*g + parcels.SU(U) + + sources(rho, U) ); UEqn.relax(); @@ -14,6 +15,8 @@ if (pimple.momentumPredictor()) { - solve(UEqn == -fvc::grad(p) + sources(rho, U)); + solve(UEqn == -fvc::grad(p)); + + sources.correct(U); K = 0.5*magSqr(U); } diff --git a/applications/solvers/lagrangian/sprayFoam/createFields.H b/applications/solvers/lagrangian/sprayFoam/createFields.H index 612ea4f3c9314da5aa9c0d9c1fc71dc472c0b2a8..4aa21b506fbbb0e7eb8d8d07fe55aa966389d86e 100644 --- a/applications/solvers/lagrangian/sprayFoam/createFields.H +++ b/applications/solvers/lagrangian/sprayFoam/createFields.H @@ -107,6 +107,3 @@ mesh, dimensionedScalar("dQ", dimEnergy/dimTime, 0.0) ); - - Info<< "Creating sources\n" << endl; - IObasicSourceList sources(mesh); diff --git a/applications/solvers/lagrangian/sprayFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/pEqn.H index d476a6bda8004f209adf65a540e53415e6a5edf1..9d95ee6dec51a7ea040ce4002e5a36119bd5c403 100644 --- a/applications/solvers/lagrangian/sprayFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/pEqn.H @@ -2,7 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*(UEqn == sources(rho, U))().H(); +HbyA = rAU*UEqn.H(); if (pimple.transonic()) { @@ -16,6 +16,8 @@ if (pimple.transonic()) ) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -28,6 +30,8 @@ if (pimple.transonic()) + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -48,6 +52,8 @@ else ) ); + sources.relativeFlux(fvc::interpolate(psi), phiHbyA); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -60,6 +66,8 @@ else + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) diff --git a/applications/solvers/lagrangian/sprayFoam/rhoEqn.H b/applications/solvers/lagrangian/sprayFoam/rhoEqn.H index b6293f2c1f08f8da4c8e2711158c5034147da285..ecda54ee8337cac84c1f3c3b56226cfcc4ebc26c 100644 --- a/applications/solvers/lagrangian/sprayFoam/rhoEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/rhoEqn.H @@ -42,6 +42,8 @@ Description sources.constrain(rhoEqn); rhoEqn.solve(); + + sources.correct(rho); } // ************************************************************************* // diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H index 0301fba2eaa9a05f2329fdb9db204a49013576ae..d3435a81636e7a7245b0d2642669c432410e8f5e 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/pEqn.H @@ -2,7 +2,7 @@ rho = thermo.rho(); volScalarField rAU(1.0/UEqn.A()); volVectorField HbyA("HbyA", U); -HbyA = rAU*(UEqn == sources(rho, U))().H(); +HbyA = rAU*UEqn.H(); if (pimple.transonic()) { @@ -16,6 +16,8 @@ if (pimple.transonic()) ) ); + sources.relativeFlux(fvc::interpolate(psi), phid); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -28,6 +30,8 @@ if (pimple.transonic()) + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) @@ -48,6 +52,8 @@ else ) ); + sources.relativeFlux(fvc::interpolate(rho), phiHbyA); + while (pimple.correctNonOrthogonal()) { fvScalarMatrix pEqn @@ -60,6 +66,8 @@ else + sources(psi, p, rho.name()) ); + sources.constrain(pEqn); + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); if (pimple.finalNonOrthogonalIter()) diff --git a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C index 1b4f46289fc47944ded482c15f62e95ed66f06c7..fd2df8b2ac2b498a603de038291fbc664e29a7d8 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayEngineFoam/sprayEngineFoam.C @@ -51,6 +51,7 @@ int main(int argc, char *argv[]) #include "createEngineMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "createClouds.H" #include "createRadiationModel.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C index 02739bda71d304101f85f9336aa05d17124a0c05..243c9a6058678ec3baaf017d1ec9d22510b2d81a 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C +++ b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C @@ -49,6 +49,7 @@ int main(int argc, char *argv[]) #include "createMesh.H" #include "readGravitationalAcceleration.H" #include "createFields.H" + #include "createSources.H" #include "createClouds.H" #include "createRadiationModel.H" #include "initContinuityErrs.H" diff --git a/applications/solvers/multiphase/bubbleFoam/DDtU.H b/applications/solvers/multiphase/bubbleFoam/DDtU.H deleted file mode 100644 index 96b6a63a435d405e0d0bd4d5e80ef656b8e620d9..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/DDtU.H +++ /dev/null @@ -1,11 +0,0 @@ -{ - DDtU1 = - fvc::ddt(U1) - + fvc::div(phi1, U1) - - fvc::div(phi1)*U1; - - DDtU2 = - fvc::ddt(U2) - + fvc::div(phi2, U2) - - fvc::div(phi2)*U2; -} diff --git a/applications/solvers/multiphase/bubbleFoam/Make/files b/applications/solvers/multiphase/bubbleFoam/Make/files deleted file mode 100644 index 1bc79aa226480d41eae230745cc2709d8b5241ab..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -bubbleFoam.C - -EXE = $(FOAM_APPBIN)/bubbleFoam diff --git a/applications/solvers/multiphase/bubbleFoam/UEqns.H b/applications/solvers/multiphase/bubbleFoam/UEqns.H deleted file mode 100644 index 703f6b6d8d2a479d56ebf773309a432618460b9a..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/UEqns.H +++ /dev/null @@ -1,74 +0,0 @@ -fvVectorMatrix U1Eqn(U1, U1.dimensions()*dimVol/dimTime); -fvVectorMatrix U2Eqn(U2, U2.dimensions()*dimVol/dimTime); - -{ - volTensorField Rc1(-nuEff1*(T(fvc::grad(U1)))); - Rc1 = Rc1 + (2.0/3.0)*sqr(Ct)*I*k - (2.0/3.0)*I*tr(Rc1); - - surfaceScalarField phiR1 - ( - - fvc::interpolate(nuEff1) - *mesh.magSf()*fvc::snGrad(alpha1) - /fvc::interpolate(alpha1 + scalar(0.001)) - ); - - U1Eqn = - ( - (scalar(1) + Cvm*rho2*alpha2/rho1)* - ( - fvm::ddt(U1) - + fvm::div(phi1, U1, "div(phi1,U1)") - - fvm::Sp(fvc::div(phi1), U1) - ) - - - fvm::laplacian(nuEff1, U1) - + fvc::div(Rc1) - - + fvm::div(phiR1, U1, "div(phi1,U1)") - - fvm::Sp(fvc::div(phiR1), U1) - + (fvc::grad(alpha1)/(fvc::average(alpha1) + scalar(0.001)) & Rc1) - == - // g // Buoyancy term transfered to p-equation - - fvm::Sp(alpha2/rho1*dragCoef, U1) - //+ alpha2/rho1*dragCoef*U2 // Explicit drag transfered to p-equation - - alpha2/rho1*(liftCoeff - Cvm*rho2*DDtU2) - ); - - U1Eqn.relax(); - - - volTensorField Rc2(-nuEff2*T(fvc::grad(U2))); - Rc2 = Rc2 + (2.0/3.0)*I*k - (2.0/3.0)*I*tr(Rc2); - - surfaceScalarField phiR2 - ( - - fvc::interpolate(nuEff2) - *mesh.magSf()*fvc::snGrad(alpha2) - /fvc::interpolate(alpha2 + scalar(0.001)) - ); - - U2Eqn = - ( - (scalar(1) + Cvm*rho2*alpha1/rho2)* - ( - fvm::ddt(U2) - + fvm::div(phi2, U2, "div(phi2,U2)") - - fvm::Sp(fvc::div(phi2), U2) - ) - - - fvm::laplacian(nuEff2, U2) - + fvc::div(Rc2) - - + fvm::div(phiR2, U2, "div(phi2,U2)") - - fvm::Sp(fvc::div(phiR2), U2) - - + (fvc::grad(alpha2)/(fvc::average(alpha2) + scalar(0.001)) & Rc2) - == - // g // Buoyancy term transfered to p-equation - - fvm::Sp(alpha1/rho2*dragCoef, U2) - //+ alpha1/rho2*dragCoef*U1 // Explicit drag transfered to p-equation - + alpha1/rho2*(liftCoeff + Cvm*rho2*DDtU1) - ); - - U2Eqn.relax(); -} diff --git a/applications/solvers/multiphase/bubbleFoam/alphaEqn.H b/applications/solvers/multiphase/bubbleFoam/alphaEqn.H deleted file mode 100644 index 0ecab0301603a5e8af8f452c8d10ce3157220dba..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/alphaEqn.H +++ /dev/null @@ -1,61 +0,0 @@ -{ - word scheme("div(phi,alpha1)"); - - surfaceScalarField phir(phi1 - phi2); - - Info<< "Max Ur Courant Number = " - << ( - max - ( - mesh.surfaceInterpolation::deltaCoeffs()*mag(phir) - /mesh.magSf() - )*runTime.deltaT() - ).value() - << endl; - - for (int acorr=0; acorr<nAlphaCorr; acorr++) - { - fvScalarMatrix alpha1Eqn - ( - fvm::ddt(alpha1) - + fvm::div(phi, alpha1, scheme) - + fvm::div(-fvc::flux(-phir, alpha2, scheme), alpha1, scheme) - ); - alpha1Eqn.relax(); - alpha1Eqn.solve(); - - /* - fvScalarMatrix alpha2Eqn - ( - fvm::ddt(alpha2) - + fvm::div(phi, alpha2, scheme) - + fvm::div - ( - -fvc::flux(phir, scalar(1) - alpha2, scheme), - alpha2, - scheme - ) - ); - alpha2Eqn.relax(); - alpha2Eqn.solve(); - - alpha1 = - 0.5 - *( - scalar(1) - + sqr(scalar(1) - alpha2) - - sqr(scalar(1) - alpha1) - ); - */ - - alpha2 = scalar(1) - alpha1; - } - - Info<< "Dispersed phase volume fraction = " - << alpha1.weightedAverage(mesh.V()).value() - << " Min(alpha1) = " << min(alpha1).value() - << " Max(alpha1) = " << max(alpha1).value() - << endl; -} - -rho = alpha1*rho1 + alpha2*rho2; diff --git a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C b/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C deleted file mode 100644 index 53746755106ea7922b92512ca050075583c1030f..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/bubbleFoam.C +++ /dev/null @@ -1,110 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Application - bubbleFoam - -Description - Solver for a system of 2 incompressible fluid phases with one phase - dispersed, e.g. gas bubbles in a liquid. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "nearWallDist.H" -#include "wallFvPatch.H" -#include "Switch.H" - -#include "pimpleControl.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "setRootCase.H" - - #include "createTime.H" - #include "createMesh.H" - #include "readGravitationalAcceleration.H" - #include "createFields.H" - #include "initContinuityErrs.H" - #include "readTimeControls.H" - #include "CourantNo.H" - #include "setInitialDeltaT.H" - - pimpleControl pimple(mesh); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (runTime.run()) - { - #include "readBubbleFoamControls.H" - #include "CourantNo.H" - #include "setDeltaT.H" - - runTime++; - Info<< "Time = " << runTime.timeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - #include "alphaEqn.H" - #include "liftDragCoeffs.H" - #include "UEqns.H" - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "pEqn.H" - - if (correctAlpha && !pimple.finalIter()) - { - #include "alphaEqn.H" - } - } - - #include "DDtU.H" - - if (pimple.turbCorr()) - { - #include "kEpsilon.H" - nuEff1 = sqr(Ct)*nut2 + nu1; - } - } - - #include "write.H" - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/multiphase/bubbleFoam/createFields.H b/applications/solvers/multiphase/bubbleFoam/createFields.H deleted file mode 100644 index 9c33ee23a17b3b81a069ddf2c9b4124717da771d..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/createFields.H +++ /dev/null @@ -1,195 +0,0 @@ - Info<< "Reading field alpha1\n" << endl; - volScalarField alpha1 - ( - IOobject - ( - "alpha1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - volScalarField alpha2 - ( - IOobject - ( - "alpha2", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - scalar(1) - alpha1 - //,alpha1.boundaryField().types() - ); - - Info<< "Reading field p\n" << endl; - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< "Reading field U1\n" << endl; - volVectorField U1 - ( - IOobject - ( - "U1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - Info<< "Reading field U2\n" << endl; - volVectorField U2 - ( - IOobject - ( - "U2", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ); - - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - alpha1*U1 + alpha2*U2 - ); - - - Info<< "Reading transportProperties\n" << endl; - - IOdictionary transportProperties - ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - dimensionedScalar rho1 - ( - transportProperties.lookup("rho1") - ); - - dimensionedScalar rho2 - ( - transportProperties.lookup("rho2") - ); - - dimensionedScalar nu1 - ( - transportProperties.lookup("nu1") - ); - - dimensionedScalar nu2 - ( - transportProperties.lookup("nu2") - ); - - dimensionedScalar d1 - ( - transportProperties.lookup("d1") - ); - - dimensionedScalar d2 - ( - transportProperties.lookup("d2") - ); - - dimensionedScalar Cvm - ( - transportProperties.lookup("Cvm") - ); - - dimensionedScalar Cl - ( - transportProperties.lookup("Cl") - ); - - dimensionedScalar Ct - ( - transportProperties.lookup("Ct") - ); - - #include "createPhi1.H" - #include "createPhi2.H" - - surfaceScalarField phi - ( - IOobject - ( - "phi", - runTime.timeName(), - mesh - ), - fvc::interpolate(alpha1)*phi1 - + fvc::interpolate(alpha2)*phi2 - ); - - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh - ), - alpha1*rho1 + alpha2*rho2 - ); - - #include "createRASTurbulence.H" - - Info<< "Calculating field DDtU1 and DDtU2\n" << endl; - - volVectorField DDtU1 - ( - fvc::ddt(U1) - + fvc::div(phi1, U1) - - fvc::div(phi1)*U1 - ); - - volVectorField DDtU2 - ( - fvc::ddt(U2) - + fvc::div(phi2, U2) - - fvc::div(phi2)*U2 - ); - - - Info<< "Calculating field g.h\n" << endl; - volScalarField gh("gh", g & mesh.C()); - - - label pRefCell = 0; - scalar pRefValue = 0.0; - setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue); diff --git a/applications/solvers/multiphase/bubbleFoam/createPhi1.H b/applications/solvers/multiphase/bubbleFoam/createPhi1.H deleted file mode 100644 index 81bac77602b4ac7a0d9a98098ed8cb31b79c1e6e..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/createPhi1.H +++ /dev/null @@ -1,67 +0,0 @@ - IOobject phi1Header - ( - "phi1", - runTime.timeName(), - mesh, - IOobject::NO_READ - ); - - autoPtr<surfaceScalarField> phi1Ptr(NULL); - - if (phi1Header.headerOk()) - { - Info<< "Reading face flux field phi1\n" << endl; - - phi1Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi1", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ) - ); - } - else - { - Info<< "Calculating face flux field phi1\n" << endl; - - wordList phiTypes - ( - U1.boundaryField().size(), - calculatedFvPatchScalarField::typeName - ); - - forAll(U1.boundaryField(), i) - { - if (isA<fixedValueFvPatchVectorField>(U1.boundaryField()[i])) - { - phiTypes[i] = fixedValueFvPatchScalarField::typeName; - } - } - - phi1Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi1", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - fvc::interpolate(U1) & mesh.Sf(), - phiTypes - ) - ); - } - - surfaceScalarField& phi1 = phi1Ptr(); diff --git a/applications/solvers/multiphase/bubbleFoam/createPhi2.H b/applications/solvers/multiphase/bubbleFoam/createPhi2.H deleted file mode 100644 index ebba6a3f6cbbc7d08a65f7900681cc16993260bc..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/createPhi2.H +++ /dev/null @@ -1,67 +0,0 @@ - IOobject phi2Header - ( - "phi2", - runTime.timeName(), - mesh, - IOobject::NO_READ - ); - - autoPtr<surfaceScalarField> phi2Ptr(NULL); - - if (phi2Header.headerOk()) - { - Info<< "Reading face flux field phi2\n" << endl; - - phi2Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi2", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ) - ); - } - else - { - Info<< "Calculating face flux field phi2\n" << endl; - - wordList phiTypes - ( - U2.boundaryField().size(), - calculatedFvPatchScalarField::typeName - ); - - forAll(U2.boundaryField(), i) - { - if (isA<fixedValueFvPatchVectorField>(U2.boundaryField()[i])) - { - phiTypes[i] = fixedValueFvPatchScalarField::typeName; - } - } - - phi2Ptr.reset - ( - new surfaceScalarField - ( - IOobject - ( - "phi2", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - fvc::interpolate(U2) & mesh.Sf(), - phiTypes - ) - ); - } - - surfaceScalarField& phi2 = phi2Ptr(); diff --git a/applications/solvers/multiphase/bubbleFoam/liftDragCoeffs.H b/applications/solvers/multiphase/bubbleFoam/liftDragCoeffs.H deleted file mode 100644 index d2ebb75a2f71b542ecdfc3c7f8cb57c8a30d1f2b..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/liftDragCoeffs.H +++ /dev/null @@ -1,23 +0,0 @@ - volVectorField Ur(U1 - U2); - volScalarField magUr(mag(Ur)); - - volScalarField Cd1MagUr - ( - (24.0*nu2/d1)*(scalar(1) + 0.15*pow(d1*magUr/nu2, 0.687)) - ); - - volScalarField Cd2MagUr - ( - (24.0*nu1/d2)*(scalar(1) + 0.15*pow(d2*magUr/nu1, 0.687)) - ); - - volScalarField dragCoef - ( - "Cd", - 0.75*(alpha2*rho2*Cd1MagUr/d1 + alpha1*rho1*Cd2MagUr/d2) - ); - - volVectorField liftCoeff - ( - Cl*(alpha2*rho2 + alpha1*rho1)*(Ur ^ fvc::curl(U)) - ); diff --git a/applications/solvers/multiphase/bubbleFoam/pEqn.H b/applications/solvers/multiphase/bubbleFoam/pEqn.H deleted file mode 100644 index d438b1124f66cbfda30c906124b295c52eac6220..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/pEqn.H +++ /dev/null @@ -1,94 +0,0 @@ -{ - surfaceScalarField alpha1f(fvc::interpolate(alpha1)); - surfaceScalarField alpha2f(scalar(1) - alpha1f); - - volScalarField rAU1(1.0/U1Eqn.A()); - volScalarField rAU2(1.0/U2Eqn.A()); - - surfaceScalarField rAU1f(fvc::interpolate(rAU1)); - surfaceScalarField rAU2f(fvc::interpolate(rAU2)); - - volVectorField HbyA1("HbyA1", U1); - HbyA1 = rAU1*U1Eqn.H(); - - volVectorField HbyA2("HbyA2", U2); - HbyA2 = rAU2*U2Eqn.H(); - - surfaceScalarField phiDrag1 - ( - fvc::interpolate(alpha2/rho1*dragCoef*rAU1)*phi2 - + rAU1f*(g & mesh.Sf()) - ); - surfaceScalarField phiDrag2 - ( - fvc::interpolate(alpha1/rho2*dragCoef*rAU2)*phi1 - + rAU2f*(g & mesh.Sf()) - ); - - forAll(p.boundaryField(), patchi) - { - if (isA<zeroGradientFvPatchScalarField>(p.boundaryField()[patchi])) - { - phiDrag1.boundaryField()[patchi] = 0.0; - phiDrag2.boundaryField()[patchi] = 0.0; - } - } - - surfaceScalarField phiHbyA1 - ( - (fvc::interpolate(HbyA1) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU1, U1, phi1) - ); - - surfaceScalarField phiHbyA2 - ( - (fvc::interpolate(HbyA2) & mesh.Sf()) - + fvc::ddtPhiCorr(rAU2, U2, phi2) - ); - - phi = alpha1f*phiHbyA1 + alpha2f*phiHbyA2; - - phiHbyA1 += phiDrag1; - phiHbyA2 += phiDrag2; - surfaceScalarField phiHbyA("phiHbyA", alpha1f*phiHbyA1 + alpha2f*phiHbyA2); - - surfaceScalarField Dp - ( - "Dp", - alpha1f*rAU1f/rho1 + alpha2f*rAU2f/rho2 - ); - - while (pimple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(Dp, p) == fvc::div(phiHbyA) - ); - - pEqn.setReference(pRefCell, pRefValue); - - pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); - - if (pimple.finalNonOrthogonalIter()) - { - surfaceScalarField SfGradp(pEqn.flux()/Dp); - - phi1 = phiHbyA1 - rAU1f*SfGradp/rho1; - phi2 = phiHbyA2 - rAU2f*SfGradp/rho2; - phi = alpha1f*phi1 + alpha2f*phi2; - - p.relax(); - SfGradp = pEqn.flux()/Dp; - - U1 = HbyA1 + (fvc::reconstruct(phiDrag1 - rAU1f*SfGradp/rho1)); - U1.correctBoundaryConditions(); - - U2 = HbyA2 + (fvc::reconstruct(phiDrag2 - rAU2f*SfGradp/rho2)); - U2.correctBoundaryConditions(); - - U = alpha1*U1 + alpha2*U2; - } - } -} - -#include "continuityErrs.H" diff --git a/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H b/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H deleted file mode 100644 index 248f608f5cca0931d70fd5ca550ed03c9cbcf2b2..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/readBubbleFoamControls.H +++ /dev/null @@ -1,4 +0,0 @@ - - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - - Switch correctAlpha(pimple.dict().lookup("correctAlpha")); diff --git a/applications/solvers/multiphase/bubbleFoam/write.H b/applications/solvers/multiphase/bubbleFoam/write.H deleted file mode 100644 index 303661beb6492a7e608f6d5e2385c824bf8dc55f..0000000000000000000000000000000000000000 --- a/applications/solvers/multiphase/bubbleFoam/write.H +++ /dev/null @@ -1,17 +0,0 @@ - if (runTime.outputTime()) - { - volVectorField Ur - ( - IOobject - ( - "Ur", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - U1 - U2 - ); - - runTime.write(); - } diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index ca9a90cf77ff9ca13a6d06245e87bf179300fc1e..48c253b21316c4e8b76158cc9627723d73fba48b 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lphaseEquationsOfState \ diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options index db259cfbc0163e1ba3ed20f8715937670c75e17d..d4d0fa9b5ab36194421b3a8e160265dff04dd6ef 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/Make/options @@ -11,6 +11,7 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lphaseEquationsOfState \ diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C index c736f8194d5adcb0ed2b2de429b864d584452456..855a862b6ba51ac11c1fdadbae38e37f5fa35dc2 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/compressibleTwoPhaseEulerFoam.C @@ -46,7 +46,7 @@ Description #include "pimpleControl.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H index 4d5c2bab7238658c65b825ef47fa0908c1113335..7b875a20e0c692e0ed341a39563c09545f4b1da0 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/createMRFZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U1); mrfZones.correctBoundaryVelocity(U2); mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/interFoam/Allwclean b/applications/solvers/multiphase/interFoam/Allwclean index 2c54bfa3218478eef96fce9e9bbc8f23612add83..8b080006674b8874606ded342451a96c4de8ac26 100755 --- a/applications/solvers/multiphase/interFoam/Allwclean +++ b/applications/solvers/multiphase/interFoam/Allwclean @@ -7,5 +7,6 @@ wclean interDyMFoam wclean MRFInterFoam wclean porousInterFoam wclean LTSInterFoam +wclean interMixingFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/interFoam/Allwmake b/applications/solvers/multiphase/interFoam/Allwmake index 8044426582eacdd44b4277674eb8d715c0365ed0..cc883614b895212e67e6456ef21ad024c99857ca 100755 --- a/applications/solvers/multiphase/interFoam/Allwmake +++ b/applications/solvers/multiphase/interFoam/Allwmake @@ -7,5 +7,6 @@ wmake interDyMFoam wmake MRFInterFoam wmake porousInterFoam wmake LTSInterFoam +wmake interMixingFoam # ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C index 9d221b5ca93b98f9525f016ad1c07efa191d2bc3..208e1c03b28eecbea9ee5c0ea544ec208754c3dd 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/LTSInterFoam.C @@ -45,6 +45,7 @@ Description #include "turbulenceModel.H" #include "fvcSmooth.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options b/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options index 24349f694e016e85732d7896b7b98c57083eaa66..437d8c57f3258e709b00dc43dec1b3ff94d3a42c 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/Make/options @@ -4,12 +4,19 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C index 5cbbc0b3abe2a8c9c0a18c40c2e8bfc96b08a19f..8950d265b0ada4c15abcd359698407a25c01ee01 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/MRFInterFoam.C @@ -42,8 +42,9 @@ Description #include "interfaceProperties.H" #include "twoPhaseMixture.H" #include "turbulenceModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options b/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options index 24349f694e016e85732d7896b7b98c57083eaa66..437d8c57f3258e709b00dc43dec1b3ff94d3a42c 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/Make/options @@ -4,12 +4,19 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/UEqn.H b/applications/solvers/multiphase/interFoam/MRFInterFoam/UEqn.H index c26df020198f92f72ca3f3f8a871600b5b2d8c61..50f0e4fb91df1b05f1d77b417be25dfd3d04b13b 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/UEqn.H @@ -12,10 +12,13 @@ - fvm::laplacian(muEff, U) - (fvc::grad(U) & fvc::grad(muEff)) //- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf())) + == + sources(rho, U) ); - mrfZones.addCoriolis(rho, UEqn); + mrfZones.addCoriolis(rho, UEqn); UEqn.relax(); + sources.constrain(UEqn); if (pimple.momentumPredictor()) { diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H b/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H index 161446a8e6f2397982c0579c232b8ce3e458053d..dba2f7ae6296444051df84a196d432e898d9d1f8 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/createMRFZones.H @@ -1,2 +1,2 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H b/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H index 1f4f0bbbebc4998d21a8b713f5d54147ce3bcceb..086f39cc3ac2c6fc84102eb677322c7f88359764 100644 --- a/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/MRFInterFoam/pEqn.H @@ -42,6 +42,7 @@ U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options index c8ce69c074b6f87f924a391ae8778b3f19e946ee..3791297ea0fcf9fc903b704e1ac46c9286fa2ac5 100644 --- a/applications/solvers/multiphase/interFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/Make/options @@ -3,12 +3,19 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/multiphase/interFoam/createFields.H b/applications/solvers/multiphase/interFoam/createFields.H index 68765262dbad5fe9d18156fad26d8bf839eabb3e..17f31e6fc64ef0b0af664779455adb0eb67e9ff7 100644 --- a/applications/solvers/multiphase/interFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/createFields.H @@ -131,3 +131,5 @@ ); p_rgh = p - rho*gh; } + + IObasicSourceList sources(mesh); diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options index 102475c1ed51e510ab99a174607cf845510d372c..b01465ff8c7047ee8139a48c73bc4022a8c5cbd7 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/Make/options @@ -6,10 +6,13 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ @@ -17,6 +20,8 @@ EXE_LIBS = \ -lincompressibleLESModels \ -lfiniteVolume \ -ldynamicMesh \ - -lmeshTools \ -ldynamicFvMesh \ - -ltopoChangerFvMesh + -ltopoChangerFvMesh \ + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C index ee927345097f187f019731bb06933517ef6b1782..7304a7841f6560897992b80a6b2b02ce79908877 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/interDyMFoam.C @@ -40,6 +40,7 @@ Description #include "twoPhaseMixture.H" #include "turbulenceModel.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H index 5b089550c56d488461757556102f0812350a809e..84519dbcdd85115907eb2c2c862bf0d55a556521 100644 --- a/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/interDyMFoam/pEqn.H @@ -48,6 +48,7 @@ U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 69eb0964ceabe41911c0593daead4271b68a341f..0cca9e81e5fd46f148319720d39a4224b5d6c08b 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -44,6 +44,7 @@ Description #include "twoPhaseMixture.H" #include "turbulenceModel.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interMixingFoam/Make/files b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/files similarity index 99% rename from applications/solvers/multiphase/interMixingFoam/Make/files rename to applications/solvers/multiphase/interFoam/interMixingFoam/Make/files index 488cd77e56dca265db6dab1b98933df8fe9ae72a..f179f42761fe59e4e586a450e565080c1bb43d53 100644 --- a/applications/solvers/multiphase/interMixingFoam/Make/files +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/files @@ -3,4 +3,3 @@ threePhaseInterfaceProperties/threePhaseInterfaceProperties.C interMixingFoam.C EXE = $(FOAM_APPBIN)/interMixingFoam - diff --git a/applications/solvers/multiphase/interMixingFoam/Make/options b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options similarity index 69% rename from applications/solvers/multiphase/interMixingFoam/Make/options rename to applications/solvers/multiphase/interFoam/interMixingFoam/Make/options index cb135724cf03d61326b5f2dbe095900c545b904b..aeaf998111eeea7c5eed92cf04a183cf2420a810 100644 --- a/applications/solvers/multiphase/interMixingFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options @@ -1,14 +1,15 @@ -INTERFOAM = $(FOAM_SOLVERS)/multiphase/interFoam - EXE_INC = \ - -I$(INTERFOAM) \ + -I.. \ -IincompressibleThreePhaseMixture \ -IthreePhaseInterfaceProperties \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/transportModels + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ -ltwoPhaseInterfaceProperties \ @@ -16,4 +17,7 @@ EXE_LIBS = \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ - -lfiniteVolume + -lfiniteVolume \ + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/multiphase/interMixingFoam/alphaCourantNo.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaCourantNo.H similarity index 96% rename from applications/solvers/multiphase/interMixingFoam/alphaCourantNo.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/alphaCourantNo.H index 45ada1f7174d580b9d4f35a08f85ea0800d67c9d..06e1da1ae49004eb5a3c97ea0020d0a61755b383 100644 --- a/applications/solvers/multiphase/interMixingFoam/alphaCourantNo.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaCourantNo.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 diff --git a/applications/solvers/multiphase/interMixingFoam/alphaEqns.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqns.H similarity index 100% rename from applications/solvers/multiphase/interMixingFoam/alphaEqns.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqns.H diff --git a/applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H similarity index 100% rename from applications/solvers/multiphase/interMixingFoam/alphaEqnsSubCycle.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H diff --git a/applications/solvers/multiphase/interMixingFoam/createFields.H b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H similarity index 98% rename from applications/solvers/multiphase/interMixingFoam/createFields.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H index 60543dc826266392c2738dbfcad79de0442e9f57..ae024d48077acef48cc527366f496ab56f1fd80e 100644 --- a/applications/solvers/multiphase/interMixingFoam/createFields.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/createFields.H @@ -165,3 +165,5 @@ ); p_rgh = p - rho*gh; } + + IObasicSourceList sources(mesh); diff --git a/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C similarity index 98% rename from applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C rename to applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C index 62b837b640223f70258486492a0fe15b5e344005..4d8ead85ce9ec719b737a0fecb28454106b0f141 100644 --- a/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.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 diff --git a/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H similarity index 98% rename from applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H index ba21579f303cbf9915d0c52f47c9ab215e54c7b8..67743ad2e084bdd54fcebb45de9190c62375e904 100644 --- a/applications/solvers/multiphase/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/incompressibleThreePhaseMixture/threePhaseMixture.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 diff --git a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C similarity index 99% rename from applications/solvers/multiphase/interMixingFoam/interMixingFoam.C rename to applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index 33647cd28d13ba19070dd86158ccd7f8dff2853d..dcb314025dfb631b1f0a450dbf6c41b7498c9850 100644 --- a/applications/solvers/multiphase/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -37,6 +37,7 @@ Description #include "threePhaseInterfaceProperties.H" #include "turbulenceModel.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C similarity index 98% rename from applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C rename to applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C index b969ade3f3a1e86ebd6d9f2ee44b3488ed7db914..e16f83bd2e8cd79ba3a112dc4763085e4a0c1e8c 100644 --- a/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.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 diff --git a/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.H b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.H similarity index 98% rename from applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.H rename to applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.H index 39e33575b764284d70c2a4b618ac83313de64a91..0653ab0a2065be1d98b1d32fa53bd4b8aedf8cf9 100644 --- a/applications/solvers/multiphase/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/threePhaseInterfaceProperties/threePhaseInterfaceProperties.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 diff --git a/applications/solvers/multiphase/interFoam/pEqn.H b/applications/solvers/multiphase/interFoam/pEqn.H index 53c2161f97897aaf8c6562e906c735b7e6725b54..83341e02469ff2ae3a2f3ace6f6af6c12a6aef86 100644 --- a/applications/solvers/multiphase/interFoam/pEqn.H +++ b/applications/solvers/multiphase/interFoam/pEqn.H @@ -42,6 +42,7 @@ U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf); U.correctBoundaryConditions(); + sources.correct(U); } } diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options b/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options index a33b9c82be9f4edb030379ce085e7de5cdf097f3..437d8c57f3258e709b00dc43dec1b3ff94d3a42c 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/Make/options @@ -5,13 +5,18 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fieldSources/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ -lincompressibleRASModels \ -lincompressibleLESModels \ -lfiniteVolume \ - -lmeshTools + -lmeshTools \ + -lfieldSources \ + -lsampling diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/UEqn.H b/applications/solvers/multiphase/interFoam/porousInterFoam/UEqn.H index 155c0527b7338035d444a03f97cf52cef2924e3b..e6e58b35e3c4bf4fd56aca8263f674cef450c117 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/UEqn.H @@ -16,11 +16,13 @@ - fvm::laplacian(muEff, U) - (fvc::grad(U) & fvc::grad(muEff)) //- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf())) + == + sources(rho, U) ); UEqn.relax(); - pZones.addResistance(UEqn); + sources.constrain(UEqn); if (pimple.momentumPredictor()) { diff --git a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C index 795b7c14a1f42b47372a48fe029222e4a853f134..f32d6f3e6d991dbeb12bd6da9ab72820865a4fa3 100644 --- a/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C +++ b/applications/solvers/multiphase/interFoam/porousInterFoam/porousInterFoam.C @@ -46,6 +46,7 @@ Description #include "turbulenceModel.H" #include "IOporosityModelList.H" #include "pimpleControl.H" +#include "IObasicSourceList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options index 960639f66a7491157d548f90d8774fa7618d9dd0..5416a161a866fc1d66bd7b320079c1b5c7266fad 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ + -linterfaceProperties \ -ltwoPhaseInterfaceProperties \ -lincompressibleTransportModels \ -lincompressibleTurbulenceModel \ diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H index 326c934eaf1bd14c666b921c2e8b819c2d897e70..f78d168a6dec608b310c6beb913aa234259e06d5 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/multiphaseEulerFoam/createMRFZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter) { diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C index c1d31263525c8989ce6f36b7fc35af22f099d25f..b509b53562cf63daee243cf275856c79e549c19d 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam.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 @@ -40,7 +40,7 @@ Description #include "singlePhaseTransportModel.H" #include "LESModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C index 0179b98e68ca5a45d58f5b5a1701b994f3b4c2f1..1f4b4cdb01c8b2cb41a85e092bc3a8772c0269d8 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/MRFMultiphaseInterFoam/MRFMultiphaseInterFoam.C @@ -35,7 +35,7 @@ Description #include "fvCFD.H" #include "multiphaseMixture.H" #include "turbulenceModel.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" #include "pimpleControl.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 8d161edd82251c037c1415c1fa7c1c63f8215b4c..9a9fdee2df05bf9a0026b69d39d0fd719de02020 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -12,12 +12,12 @@ mesh ); - Info<< "Reading field alpha\n" << endl; - volScalarField alpha + Info<< "Reading field Alpha\n" << endl; + volScalarField Alpha ( IOobject ( - "alpha", + "Alpha", runTime.timeName(), mesh, IOobject::MUST_READ, @@ -100,21 +100,20 @@ IOobject::NO_READ, IOobject::NO_WRITE ), - (scalar(1) - alpha)*rhoc + alpha*rhod + rhoc/(scalar(1) + (rhoc/rhod - 1.0)*Alpha) ); - volScalarField Alpha + volScalarField alpha ( IOobject ( - "Alpha", + "alpha", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), - alpha*rhod/rho, - alpha.boundaryField().types() + rho*Alpha/rhod ); #include "compressibleCreatePhi.H" diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options index 1bf97d106c3075e689f94158c51472d13483f2d4..f4a6229714bfad7927758e93b95b292ebd5b672f 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -I../bubbleFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -IturbulenceModel \ diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H index 4d5c2bab7238658c65b825ef47fa0908c1113335..7b875a20e0c692e0ed341a39563c09545f4b1da0 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/createMRFZones.H @@ -1,4 +1,4 @@ - MRFZones mrfZones(mesh); + IOMRFZoneList mrfZones(mesh); mrfZones.correctBoundaryVelocity(U1); mrfZones.correctBoundaryVelocity(U2); mrfZones.correctBoundaryVelocity(U); diff --git a/applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H b/applications/solvers/multiphase/twoPhaseEulerFoam/createRASTurbulence.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/createRASTurbulence.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/createRASTurbulence.H diff --git a/applications/solvers/multiphase/bubbleFoam/kEpsilon.H b/applications/solvers/multiphase/twoPhaseEulerFoam/kEpsilon.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/kEpsilon.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/kEpsilon.H diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C index 178032db6f51c43eab40666272fa8947df3209c9..67e4174a3be462dde5355be33390a257548ee528 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseEulerFoam.C @@ -46,7 +46,7 @@ Description #include "kineticTheoryModel.H" #include "pimpleControl.H" -#include "MRFZones.H" +#include "IOMRFZoneList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/bubbleFoam/wallDissipation.H b/applications/solvers/multiphase/twoPhaseEulerFoam/wallDissipation.H similarity index 95% rename from applications/solvers/multiphase/bubbleFoam/wallDissipation.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/wallDissipation.H index 14224fd646a3ec4ab00de7ffb2eb05035893bdf9..207fb40a321c9c5ec02b1d4d5c066d6e6859f371 100644 --- a/applications/solvers/multiphase/bubbleFoam/wallDissipation.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/wallDissipation.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 diff --git a/applications/solvers/multiphase/bubbleFoam/wallFunctions.H b/applications/solvers/multiphase/twoPhaseEulerFoam/wallFunctions.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/wallFunctions.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/wallFunctions.H diff --git a/applications/solvers/multiphase/bubbleFoam/wallViscosity.H b/applications/solvers/multiphase/twoPhaseEulerFoam/wallViscosity.H similarity index 100% rename from applications/solvers/multiphase/bubbleFoam/wallViscosity.H rename to applications/solvers/multiphase/twoPhaseEulerFoam/wallViscosity.H diff --git a/applications/test/Circulator/Make/files b/applications/test/Circulator/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..b6a4e63dc25184823344e168fc1249960925b41b --- /dev/null +++ b/applications/test/Circulator/Make/files @@ -0,0 +1,3 @@ +Test-Circulator.C + +EXE = $(FOAM_USER_APPBIN)/Test-Circulator diff --git a/applications/test/Circulator/Make/options b/applications/test/Circulator/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/applications/test/Circulator/Test-Circulator.C b/applications/test/Circulator/Test-Circulator.C new file mode 100644 index 0000000000000000000000000000000000000000..19a21f6b795f388bc561fc694efa2dd400d2ca33 --- /dev/null +++ b/applications/test/Circulator/Test-Circulator.C @@ -0,0 +1,268 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Application + Test-circulator + +Description + +\*---------------------------------------------------------------------------*/ + +#include "List.H" +#include "ListOps.H" +#include "face.H" +#include "circulator.H" +#include "const_circulator.H" + + +using namespace Foam; + + +// return +// 0: no match +// +1: identical +// -1: same face, but different orientation +label compare(const face& a, const face& b) +{ + // Basic rule: we assume that the sequence of labels in each list + // will be circular in the same order (but not necessarily in the + // same direction or from the same starting point). + + // Trivial reject: faces are different size + label sizeA = a.size(); + label sizeB = b.size(); + + if (sizeA != sizeB || sizeA == 0) + { + return 0; + } + + const_circulator<face> aCirc(a); + const_circulator<face> bCirc(b); + + // Rotate face b until its element matches the starting element of face a. + do + { + if (aCirc() == bCirc()) + { + // Set bCirc fulcrum to its iterator and increment the iterators + bCirc.setFulcrumToIterator(); + ++aCirc; + ++bCirc; + + break; + } + } while (bCirc.circulate(CirculatorBase::CLOCKWISE)); + + // Look forwards around the faces for a match + do + { + if (aCirc() != bCirc()) + { + break; + } + } + while + ( + aCirc.circulate(CirculatorBase::CLOCKWISE), + bCirc.circulate(CirculatorBase::CLOCKWISE) + ); + + // If the circulator has stopped then faces a and b matched. + if (!aCirc.circulate()) + { + return 1; + } + else + { + // Reset the circulators back to their fulcrum + aCirc.setIteratorToFulcrum(); + bCirc.setIteratorToFulcrum(); + ++aCirc; + --bCirc; + } + + // Look backwards around the faces for a match + do + { + if (aCirc() != bCirc()) + { + break; + } + } + while + ( + aCirc.circulate(CirculatorBase::CLOCKWISE), + bCirc.circulate(CirculatorBase::ANTICLOCKWISE) + ); + + // If the circulator has stopped then faces a and b matched. + if (!aCirc.circulate()) + { + return -1; + } + + return 0; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + Info<< "Test the implementation of a circular iterator" << nl << endl; + + Info<< "Test const circulator. First go forwards, then backwards." + << nl << endl; + + face f(identity(4)); + + const_circulator<face> cStart(f); + + if (cStart.size()) do + { + Info<< "Iterate forwards over face (prev/curr/next) : " + << cStart.prev() << " / " << cStart() << " / " << cStart.next() + << endl; + + } while (cStart.circulate(CirculatorBase::CLOCKWISE)); + + if (cStart.size()) do + { + Info<< "Iterate backwards over face : " << cStart() << endl; + + } while (cStart.circulate(CirculatorBase::ANTICLOCKWISE)); + + + Info<< nl << nl << "Test non-const circulator" << nl << endl; + + circulator<face> cStart2(f); + + Info<< "Face before : " << f << endl; + + if (cStart2.size()) do + { + Info<< "Iterate forwards over face (prev/curr/next) : " + << cStart2.prev() << " / " << cStart2() << " / " << cStart2.next() + << endl; + + } while (cStart2.circulate(CirculatorBase::CLOCKWISE)); + + if (cStart2.size()) do + { + Info<< "Iterate forwards over face, adding 1 to each element : " + << cStart2(); + + cStart2() += 1; + + Info<< " -> " << cStart2() << endl; + } while (cStart2.circulate(CirculatorBase::CLOCKWISE)); + + Info<< "Face after : " << f << endl; + + + Info<< nl << nl << "Compare two faces: " << endl; + face a(identity(5)); + Info<< "Compare " << a << " and " << a << " Match = " << compare(a, a) + << endl; + + face b(reverseList(a)); + Info<< "Compare " << a << " and " << b << " Match = " << compare(a, b) + << endl; + + face c(a); + c[4] = 3; + Info<< "Compare " << a << " and " << c << " Match = " << compare(a, c) + << endl; + + face d(rotateList(a, 2)); + Info<< "Compare " << a << " and " << d << " Match = " << compare(a, d) + << endl; + + face g(labelList(5, 1)); + face h(g); + Info<< "Compare " << g << " and " << h << " Match = " << compare(g, h) + << endl; + + g[0] = 2; + h[3] = 2; + Info<< "Compare " << g << " and " << h << " Match = " << compare(g, h) + << endl; + + g[4] = 3; + h[4] = 3; + Info<< "Compare " << g << " and " << h << " Match = " << compare(g, h) + << endl; + + face face1(identity(1)); + Info<< "Compare " << face1 << " and " << face1 + << " Match = " << compare(face1, face1) << endl; + + Info<< nl << nl << "Zero face" << nl << endl; + + face fZero; + circulator<face> cZero(fZero); + + if (cZero.size()) do + { + Info<< "Iterate forwards over face : " << cZero() << endl; + + } while (cZero.circulate(CirculatorBase::CLOCKWISE)); + + fZero = face(identity(5)); + + // circulator was invalidated so reset + cZero = circulator<face>(fZero); + + do + { + Info<< "Iterate forwards over face : " << cZero() << endl; + + } while (cZero.circulate(CirculatorBase::CLOCKWISE)); + + + Info<< nl << nl << "Simultaneously go forwards/backwards over face " << f + << nl << endl; + + const_circulator<face> circForward(f); + const_circulator<face> circBackward(f); + + if (circForward.size() && circBackward.size()) do + { + Info<< "Iterate over face forwards : " << circForward() + << ", backwards : " << circBackward() << endl; + } + while + ( + circForward.circulate(CirculatorBase::CLOCKWISE), + circBackward.circulate(CirculatorBase::ANTICLOCKWISE) + ); + + Info<< "\nEnd\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/ListOps/Make/files b/applications/test/ListOps/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..645600a7097870f028f16e42031dffd81b102576 --- /dev/null +++ b/applications/test/ListOps/Make/files @@ -0,0 +1,2 @@ +Test-ListOps.C +EXE = $(FOAM_USER_APPBIN)/Test-ListOps diff --git a/applications/test/ListOps/Make/options b/applications/test/ListOps/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..9e79e9d733a612692478392bb79fff154d2ff181 --- /dev/null +++ b/applications/test/ListOps/Make/options @@ -0,0 +1,3 @@ +EXE_INC = /*-DFULLDEBUG -O0 -g*/ \ + +EXE_LIBS = \ diff --git a/applications/test/ListOps/Test-ListOps.C b/applications/test/ListOps/Test-ListOps.C new file mode 100644 index 0000000000000000000000000000000000000000..f6e5695164398a763009d2794e9f80bcb3dc2032 --- /dev/null +++ b/applications/test/ListOps/Test-ListOps.C @@ -0,0 +1,120 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Application + Test-ListOps + +Description + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "List.H" +#include "SubList.H" +#include "ListOps.H" +#include "face.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + Info<< "Test Rotations:" << nl << endl; + + List<label> forwardRotate(identity(5)); + face testFace(identity(4)); + + for (label i = 0; i < 8; ++i) + { + Info<< "Rotate forward by " << i << " : " + << rotateList(forwardRotate, i) << endl; + } + + for (label i = 0; i < 8; ++i) + { + Info<< "Rotate backward by " << i << " : " + << rotateList(forwardRotate, -i) << endl; + } + + Info<< nl << "Face : " << testFace << endl; + Info<< "Rotate by 2 : " << rotateList(testFace, 2) << endl; + inplaceRotateList(testFace, -6); + Info<< "Rotate inplace by -6 : " << testFace << nl << endl; + + Info<< "Test inplace rotate : " << forwardRotate << endl; + inplaceRotateList(forwardRotate, 2); + Info<< "Rotate to the right by 2 : " << forwardRotate << endl; + inplaceRotateList(forwardRotate, -2); + Info<< "Rotate to the left by 2 : " << forwardRotate << endl; + + List<label> subRotate(identity(10)); + SubList<label> subL(subRotate, 5, 3); + + Info<< "Test inplace rotate on sublist : " << subRotate << endl; + inplaceRotateList(subL, 3); + Info<< "Rotate to the right by 3 : " << subRotate << endl; + inplaceRotateList(subL, -8); + Info<< "Rotate to the left by 3 : " << subRotate << endl; + + Info<< nl << nl << "Test Reversing:" << nl << endl; + + Info<< "List : " << identity(5) << endl; + Info<< "Reverse : " << reverseList(identity(5)) << endl; + Info<< "List : " << identity(6) << endl; + Info<< "Reverse : " << reverseList(identity(6)) << nl << endl; + + List<label> test1(identity(5)); + Info<< "List : " << test1 << endl; + inplaceReverseList(test1); + Info<< "Inplace Reverse : " << test1 << nl << endl; + + List<label> test2(identity(6)); + Info<< "List : " << test2 << endl; + inplaceReverseList(test2); + Info<< "Inplace Reverse : " << test2 << nl << endl; + + face test3(identity(6)); + Info<< "Face : " << test3 << endl; + inplaceReverseList(test3); + Info<< "Inplace Reverse : " << test3 << nl << endl; + + FixedList<label, 6> test4(identity(6)); + Info<< "FixedList : " << test4 << endl; + inplaceReverseList(test4); + Info<< "Inplace Reverse : " << test4 << nl << endl; + + List<label> test5(identity(9)); + SubList<label> test5SubList(test5, 4, 3); + Info<< "List : " << test5 << endl; + inplaceReverseList(test5SubList); + Info<< "Reverse Sublist between 3 and 6 : " << test5 << endl; + + Info<< "\nEnd\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/dynamicIndexedOctree/Test-dynamicIndexedOctree.C b/applications/test/dynamicIndexedOctree/Test-dynamicIndexedOctree.C index b84b39c33b1c00ee6e33a4ba565891946270eb2b..0ccb8e377ff9c7a68f23e540719a182ddbf58bbf 100644 --- a/applications/test/dynamicIndexedOctree/Test-dynamicIndexedOctree.C +++ b/applications/test/dynamicIndexedOctree/Test-dynamicIndexedOctree.C @@ -85,8 +85,8 @@ int main(int argc, char *argv[]) ( dynamicTreeDataPoint(pointList), overallBb, // overall search domain - 20, // max levels; n/a - 100, // maximum ratio of cubes v.s. cells + 20, // max levels + 100, // maximum ratio of cubes v.s. cells 100.0 // max. duplicity; n/a since no bounding boxes. ); diff --git a/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C b/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C index 074996252e396ce5ed4822f8e4d5ca7a447cf1e4..0d9775e84954f86bc08dc7a13932f0ad7bfda4df 100644 --- a/applications/test/fvSolutionCombine/Test-fvSolutionCombine.C +++ b/applications/test/fvSolutionCombine/Test-fvSolutionCombine.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 @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) IOobject ( dictName, - "system", + runTime.system(), runTime, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, @@ -128,9 +128,9 @@ int main(int argc, char *argv[]) return 2; } - if (optRewrite && solutionDict.instance() != "system") + if (optRewrite && solutionDict.instance() != runTime.system()) { - Info<<"instance is not 'system' " + Info<<"instance is not " << runTime.system() "- disabling rewrite for this file" << nl; optRewrite = false; } diff --git a/applications/test/reconstruct/Make/files b/applications/test/reconstruct/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..5dd557e6f885d11423f248b6c9b6928c7aafcba4 --- /dev/null +++ b/applications/test/reconstruct/Make/files @@ -0,0 +1,3 @@ +Test-reconstruct.C + +EXE = $(FOAM_USER_APPBIN)/Test-reconstruct diff --git a/applications/test/reconstruct/Make/options b/applications/test/reconstruct/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..1a8bb549927bbf347ede932e6b39cd75067a322b --- /dev/null +++ b/applications/test/reconstruct/Make/options @@ -0,0 +1,4 @@ +EXE_INC = -g \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = -lfiniteVolume diff --git a/applications/test/reconstruct/Test-reconstruct.C b/applications/test/reconstruct/Test-reconstruct.C new file mode 100644 index 0000000000000000000000000000000000000000..59e9a03bb6ee60d96591dd20c4fa03f1b3c6e8df --- /dev/null +++ b/applications/test/reconstruct/Test-reconstruct.C @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Application + Test-reconstruct + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createMesh.H" + + surfaceScalarField phi(vector(1, 0, 0) & mesh.Sf()); + + volVectorField Uphi + ( + IOobject + ( + "Uphi", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + fvc::reconstruct(phi) + ); + + Uphi.write(); + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/advanced/collapseEdges/Make/files b/applications/utilities/mesh/advanced/collapseEdges/Make/files index a15838abe84da087d0c63693617ed5b410e56b22..d89ca6e737c6c84ce878bd4e57566fbd070333a4 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/Make/files +++ b/applications/utilities/mesh/advanced/collapseEdges/Make/files @@ -1,4 +1,3 @@ collapseEdges.C -pointEdgeCollapse/pointEdgeCollapse.C EXE = $(FOAM_APPBIN)/collapseEdges diff --git a/applications/utilities/mesh/advanced/collapseEdges/Make/options b/applications/utilities/mesh/advanced/collapseEdges/Make/options index d1efa61fd56aef52623d7e352c300f8948503fd2..987eae5ed7dda8023ae8cdbe78624b50cbdb42bc 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/Make/options +++ b/applications/utilities/mesh/advanced/collapseEdges/Make/options @@ -1,8 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -IpointEdgeCollapse + -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ -ldynamicMesh \ diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseDict b/applications/utilities/mesh/advanced/collapseEdges/collapseDict new file mode 100644 index 0000000000000000000000000000000000000000..78905475e33add919a8cc0ece968b737c26fea15 --- /dev/null +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseDict @@ -0,0 +1,85 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: http://www.openfoam.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object collapseDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +collapseEdgesCoeffs +{ + // Edges shorter than this absolute value will be merged + minimumEdgeLength 1e-8; + + // The maximum angle between two edges that share a point attached to + // no other edges + maximumMergeAngle 30; + + // The amount that minimumEdgeLength will be reduced by for each + // edge if that edge's collapse generates a poor quality face + reductionFactor 0.5; +} + + +collapseFacesCoeffs +{ + // The initial face length factor + initialFaceLengthFactor 0.5; + + // The amount that initialFaceLengthFactor will be reduced by for each + // face if its collapse generates a poor quality face + reductionFactor $initialFaceLengthFactor; + + // If the face can't be collapsed to an edge, and it has a span less than + // the target face length multiplied by this coefficient, collapse it + // to a point. + maxCollapseFaceToPointSideLengthCoeff 0.3; + + // Allow early collapse of edges to a point + allowEarlyCollapseToPoint on; + + // Fraction to premultiply maxCollapseFaceToPointSideLengthCoeff by if + // allowEarlyCollapseToPoint is enabled + allowEarlyCollapseCoeff 0.2; + + // Defining how close to the midpoint (M) of the projected + // vertices line a projected vertex (X) can be before making this + // an invalid edge collapse + // + // X---X-g----------------M----X-----------g----X--X + // + // Only allow a collapse if all projected vertices are outwith + // guardFraction (g) of the distance form the face centre to the + // furthest vertex in the considered direction + guardFraction 0.1; +} + + +meshQualityCoeffs +{ + // Name of the dictionary that has the mesh quality coefficients used + // by motionSmoother::checkMesh + meshQualityCoeffDict meshQualityDict; + + // Maximum number of outer iterations is mesh quality checking is enabled + maximumIterations 30; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index c0523bf43b89a8deba0951f7e9112d923764faaf..132a602b1a945c08a7ab9538ec1715c327cbf257 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,1425 +27,96 @@ Description - collapse short edges. Length of edges to collapse provided as argument. - merge two edges if they are in line. Maximum angle provided as argument. - remove unused points. + - collapse faces: + - with small areas to a single point + - that have a high aspect ratio (i.e. sliver face) to a single edge - Optionally removes cells. Can remove faces and points but does not check - for nonsense resulting topology. + Optionally checks the resulting mesh for bad faces and reduces the desired + face length factor for those faces attached to the bad faces. When collapsing an edge with one point on the boundary it will leave the boundary point intact. When both points inside it chooses random. When both points on boundary random again. Usage - - collapseEdges <edge length> <merge angle> [OPTION] - - \param -allowCellCollapse \n - Allow collapsing of cells to a single point - - \param -meshQuality \n - Only collapse if not exceeding user defined (in \a system/meshQualityDict) - quality settings + - collapseEdges [OPTION] \*---------------------------------------------------------------------------*/ #include "argList.H" #include "Time.H" +#include "timeSelector.H" #include "polyTopoChange.H" #include "fvMesh.H" -#include "mapPolyMesh.H" -#include "mathematicalConstants.H" -#include "PackedBoolList.H" -#include "unitConversion.H" -#include "globalMeshData.H" -#include "globalIndex.H" -#include "PointEdgeWave.H" -#include "pointEdgeCollapse.H" -#include "motionSmoother.H" -#include "removePoints.H" +#include "polyMeshFilter.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -void filterFace -( - const label faceI, - face& f, - const List<pointEdgeCollapse>& allPointInfo, - const Map<DynamicList<label> >& collapseStrings -) -{ - label newFp = 0; - - face oldFace = f; - - forAll(f, fp) - { - label pointI = f[fp]; - - label collapsePoint = allPointInfo[pointI].collapseIndex(); - - if (collapseStrings.found(collapsePoint)) - { - collapsePoint = collapseStrings[collapsePoint][0]; - } - - if (collapsePoint == -1) - { - WarningIn - ( - "filterFace" - "(const label, face&, const List<pointEdgeCollapse>&)" - ) - << "Point " << pointI << " was not visited by PointEdgeWave" - << endl; - } - else if (collapsePoint == -2) - { - f[newFp++] = pointI; - } - else - { - if (findIndex(SubList<label>(f, newFp), collapsePoint) == -1) - { - f[newFp++] = collapsePoint; - } - } - } - - - // Check for pinched face. Tries to correct - // - consecutive duplicate vertex. Removes duplicate vertex. - // - duplicate vertex with one other vertex in between (spike). - // Both of these should not really occur! and should be checked before - // collapsing edges. - - const label size = newFp; - - newFp = 2; - - for (label fp = 2; fp < size; fp++) - { - label fp1 = fp-1; - label fp2 = fp-2; - - label pointI = f[fp]; - - // Search for previous occurrence. - label index = findIndex(SubList<label>(f, fp), pointI); - - if (index == fp1) - { - WarningIn - ( - "Foam::edgeCollapser::filterFace(const label faceI, " - "face& f) const" - ) << "Removing consecutive duplicate vertex in face " - << f << endl; - // Don't store current pointI - } - else if (index == fp2) - { - WarningIn - ( - "Foam::edgeCollapser::filterFace(const label faceI, " - "face& f) const" - ) << "Removing non-consecutive duplicate vertex in face " - << f << endl; - // Don't store current pointI and remove previous - newFp--; - } - else if (index != -1) - { - WarningIn - ( - "Foam::edgeCollapser::filterFace(const label faceI, " - "face& f) const" - ) << "Pinched face " << f << endl; - f[newFp++] = pointI; - } - else - { - f[newFp++] = pointI; - } - } - - f.setSize(newFp); -} - - -bool setRefinement -( - const polyMesh& mesh, - polyTopoChange& meshMod, - const List<pointEdgeCollapse>& allPointInfo -) -{ - const cellList& cells = mesh.cells(); - const labelList& faceOwner = mesh.faceOwner(); - const labelList& faceNeighbour = mesh.faceNeighbour(); - const labelListList& pointFaces = mesh.pointFaces(); - const pointZoneMesh& pointZones = mesh.pointZones(); - - globalIndex globalStrings(mesh.nPoints()); - - boolList removedPoints(mesh.nPoints(), false); - - // Create strings of edges. - // Map from collapseIndex(=global master point) to set of points - Map<DynamicList<label> > collapseStrings; - { - // 1. Count elements per collapseIndex - Map<label> nPerIndex(mesh.nPoints()/10); - forAll(allPointInfo, pointI) - { - const label collapseIndex = allPointInfo[pointI].collapseIndex(); - - if (collapseIndex != -1 && collapseIndex != -2) - { - Map<label>::iterator fnd = nPerIndex.find(collapseIndex); - if (fnd != nPerIndex.end()) - { - fnd()++; - } - else - { - nPerIndex.insert(collapseIndex, 1); - } - } - } - - // 2. Size - collapseStrings.resize(2*nPerIndex.size()); - forAllConstIter(Map<label>, nPerIndex, iter) - { - collapseStrings.insert(iter.key(), DynamicList<label>(iter())); - } - - // 3. Fill - forAll(allPointInfo, pointI) - { - const label collapseIndex = allPointInfo[pointI].collapseIndex(); - - if (collapseIndex != -1 && collapseIndex != -2) - { - collapseStrings[collapseIndex].append(pointI); - } - } - } - - - bool meshChanged = false; - - // Current faces (is also collapseStatus: f.size() < 3) - faceList newFaces(mesh.faces()); - - // Current cellCollapse status - boolList cellRemoved(mesh.nCells(), false); - - label nUnvisited = 0; - label nUncollapsed = 0; - label nCollapsed = 0; - - forAll(allPointInfo, pI) - { - const pointEdgeCollapse& pec = allPointInfo[pI]; - - if (pec.collapseIndex() == -1) - { - nUnvisited++; - } - else if (pec.collapseIndex() == -2) - { - nUncollapsed++; - } - else if (pec.collapseIndex() >= 0) - { - nCollapsed++; - } - } - - label nPoints = allPointInfo.size(); - - reduce(nPoints, sumOp<label>()); - reduce(nUnvisited, sumOp<label>()); - reduce(nUncollapsed, sumOp<label>()); - reduce(nCollapsed, sumOp<label>()); - - Info<< incrIndent; - Info<< indent << "Number of points : " << nPoints << nl - << indent << "Not visited : " << nUnvisited << nl - << indent << "Not collapsed : " << nUncollapsed << nl - << indent << "Collapsed : " << nCollapsed << nl - << endl; - Info<< decrIndent; - - do - { - // Update face collapse from edge collapses - forAll(newFaces, faceI) - { - filterFace(faceI, newFaces[faceI], allPointInfo, collapseStrings); - } - - // Check if faces to be collapsed cause cells to become collapsed. - label nCellCollapsed = 0; - - forAll(cells, cellI) - { - if (!cellRemoved[cellI]) - { - const cell& cFaces = cells[cellI]; - - label nFaces = cFaces.size(); - - forAll(cFaces, i) - { - label faceI = cFaces[i]; - - if (newFaces[faceI].size() < 3) - { - --nFaces; - - if (nFaces < 4) - { - Pout<< "Cell:" << cellI - << " uses faces:" << cFaces - << " of which too many are marked for removal:" - << endl - << " "; - forAll(cFaces, j) - { - if (newFaces[cFaces[j]].size() < 3) - { - Pout<< ' '<< cFaces[j]; - } - } - Pout<< endl; - - cellRemoved[cellI] = true; - - // Collapse all edges of cell to nothing - //collapseEdges(cellEdges[cellI]); - - nCellCollapsed++; - - break; - } - } - } - } - } - - if (nCellCollapsed == 0) - { - break; - } - } while (true); - - - // Keep track of faces that have been done already. - boolList doneFace(mesh.nFaces(), false); - - { - // Mark points used. - boolList usedPoint(mesh.nPoints(), false); - - forAll(cellRemoved, cellI) - { - if (cellRemoved[cellI]) - { - meshMod.removeCell(cellI, -1); - } - } - - // Remove faces - forAll(newFaces, faceI) - { - const face& f = newFaces[faceI]; - - if (f.size() < 3) - { - meshMod.removeFace(faceI, -1); - meshChanged = true; - - // Mark face as been done. - doneFace[faceI] = true; - } - else - { - // Kept face. Mark vertices - forAll(f, fp) - { - usedPoint[f[fp]] = true; - } - } - } - - // Remove unused vertices that have not been marked for removal already - forAll(usedPoint, pointI) - { - if (!usedPoint[pointI]) - { - removedPoints[pointI] = true; - meshMod.removePoint(pointI, -1); - meshChanged = true; - } - } - } - - // Modify the point location of the remaining points - forAll(allPointInfo, pointI) - { - const label collapseIndex = allPointInfo[pointI].collapseIndex(); - const point& collapsePoint = allPointInfo[pointI].collapsePoint(); - - if - ( - removedPoints[pointI] == false - && collapseIndex != -1 - && collapseIndex != -2 - ) - { - meshMod.modifyPoint - ( - pointI, - collapsePoint, - pointZones.whichZone(pointI), - false - ); - } - } - - - const polyBoundaryMesh& boundaryMesh = mesh.boundaryMesh(); - const faceZoneMesh& faceZones = mesh.faceZones(); - - // Renumber faces that use points - forAll(allPointInfo, pointI) - { - if (removedPoints[pointI] == true) - { - const labelList& changedFaces = pointFaces[pointI]; - - forAll(changedFaces, changedFaceI) - { - label faceI = changedFaces[changedFaceI]; - - if (!doneFace[faceI]) - { - doneFace[faceI] = true; - - // Get current zone info - label zoneID = faceZones.whichZone(faceI); - - bool zoneFlip = false; - - if (zoneID >= 0) - { - const faceZone& fZone = faceZones[zoneID]; - - zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)]; - } - - // Get current connectivity - label own = faceOwner[faceI]; - label nei = -1; - label patchID = -1; - - if (mesh.isInternalFace(faceI)) - { - nei = faceNeighbour[faceI]; - } - else - { - patchID = boundaryMesh.whichPatch(faceI); - } - - meshMod.modifyFace - ( - newFaces[faceI], // face - faceI, // faceI to change - own, // owner - nei, // neighbour - false, // flipFaceFlux - patchID, // patch - zoneID, - zoneFlip - ); - meshChanged = true; - } - } - } - } - - return meshChanged; -} - - -// Get faceEdges in order of face points, i.e. faceEdges[0] is between -// f[0] and f[1] -labelList getSortedEdges -( - const edgeList& edges, - const labelList& f, - const labelList& edgeLabels -) -{ - labelList faceEdges(edgeLabels.size(), -1); - - // Find starting pos in f for every edgeLabels - forAll(edgeLabels, i) - { - label edgeI = edgeLabels[i]; - - const edge& e = edges[edgeI]; - - label fp = findIndex(f, e[0]); - label fp1 = f.fcIndex(fp); - - if (f[fp1] == e[1]) - { - // EdgeI between fp -> fp1 - faceEdges[fp] = edgeI; - } - else - { - // EdgeI between fp-1 -> fp - faceEdges[f.rcIndex(fp)] = edgeI; - } - } - - return faceEdges; -} - - -// Return master point edge needs to be collapsed to (or -1) -label edgeMaster -( - const labelList& boundaryPoint, - const bool flipEdge, - const edge& e -) -{ - label masterPoint = -1; - - label e0 = e[0]; - label e1 = e[1]; - - if (flipEdge) - { - e0 = e[1]; - e1 = e[0]; - } - - // Check if one of the points is on a processor -// if -// ( -// boundaryPoint[e0] > 0 -// && boundaryPoint[e1] > 0 -// ) -// { -// if (boundaryPoint[e0] != boundaryPoint[e1]) -// { -// return -1; -// } -// } -// -// if (boundaryPoint[e0] > 0) -// { -// return e0; -// } -// else if (boundaryPoint[e1] > 0) -// { -// return e1; -// } - - // Collapse edge to boundary point. - if (boundaryPoint[e0] == 0) - { - if (boundaryPoint[e1] == 0) - { - // Both points on boundary. Choose one to collapse to. - // Note: should look at feature edges/points! - masterPoint = e0; - } - else - { - masterPoint = e0; - } - } - else - { - if (boundaryPoint[e1] == 0) - { - masterPoint = e1; - } - else - { - // None on boundary. Choose arbitrary. - // Note: should look at geometry? - masterPoint = e0; - } - } - - return masterPoint; -} - - -// Create consistent set of collapses. -// collapseEdge : per edge: -// -1 : do not collapse -// 0 : collapse to start -// 1 : collapse to end -// Note: collapseEdge has to be parallel consistent (in orientation) -label syncCollapse -( - const polyMesh& mesh, - const globalIndex& globalStrings, - const labelList& collapseEdge, - List<pointEdgeCollapse>& allPointInfo -) -{ - const edgeList& edges = mesh.edges(); - const pointField& points = mesh.points(); - - label nCollapsed = 0; - - DynamicList<label> initPoints(mesh.nPoints()); - DynamicList<pointEdgeCollapse> initPointInfo(mesh.nPoints()); - allPointInfo.resize(mesh.nPoints()); - - // Initialise edges to no collapse - List<pointEdgeCollapse> allEdgeInfo - ( - mesh.nEdges(), - pointEdgeCollapse(vector::zero, -1) - ); - - // Mark selected edges for collapse - forAll(edges, edgeI) - { - const edge& e = edges[edgeI]; - - if (collapseEdge[edgeI] != -1) - { - label masterPointI = e[collapseEdge[edgeI]]; - - const pointEdgeCollapse pec - ( - points[masterPointI], - globalStrings.toGlobal(masterPointI) - ); - - // Mark as collapsable but with nonsense master so it gets - // overwritten and starts an update wave - allEdgeInfo[edgeI] = pointEdgeCollapse - ( - points[masterPointI], - labelMax - ); - - initPointInfo.append(pec); - initPoints.append(e.start()); - - initPointInfo.append(pec); - initPoints.append(e.end()); - - nCollapsed++; - } - } - - PointEdgeWave<pointEdgeCollapse> collapsePropagator - ( - mesh, - initPoints, - initPointInfo, - allPointInfo, - allEdgeInfo, - mesh.globalData().nTotalPoints() // Maximum number of iterations - ); - - return nCollapsed; -} - - -void syncCollapseEdge(const polyMesh& mesh, labelList& collapseEdge) -{ - // Check whether edge point order is reversed from mesh to coupledPatch - const globalMeshData& globalData = mesh.globalData(); - const mapDistribute& map = globalData.globalEdgeSlavesMap(); - const labelList& coupledMeshEdges = globalData.coupledPatchMeshEdges(); - const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch(); - const PackedBoolList& cppOrientation = globalData.globalEdgeOrientation(); - PackedBoolList meshToPatchSameOrientation(coupledMeshEdges.size(), true); - - forAll(coupledMeshEdges, eI) - { - const label meshEdgeIndex = coupledMeshEdges[eI]; - - if (collapseEdge[meshEdgeIndex] != -1) - { - const edge& meshEdge = mesh.edges()[meshEdgeIndex]; - const edge& coupledPatchEdge = coupledPatch.edges()[eI]; - - if - ( - meshEdge[0] == coupledPatch.meshPoints()[coupledPatchEdge[1]] - && meshEdge[1] == coupledPatch.meshPoints()[coupledPatchEdge[0]] - ) - { - meshToPatchSameOrientation[eI] = false; - } - } - } - - - labelList cppEdgeData(map.constructSize()); - - forAll(coupledMeshEdges, eI) - { - const label meshEdgeIndex = coupledMeshEdges[eI]; - - cppEdgeData[eI] = collapseEdge[meshEdgeIndex]; - - if - ( - (collapseEdge[meshEdgeIndex] != -1) - && (meshToPatchSameOrientation[eI] != cppOrientation[eI]) - ) - { - cppEdgeData[eI] = 1-cppEdgeData[eI]; - } - } - - - // Synchronise cppEdgeData - // Use minEqOp reduction, so that edge will only be collapsed on processor - // boundary if both processors agree to collapse it - globalData.syncData - ( - cppEdgeData, - globalData.globalEdgeSlaves(), - globalData.globalEdgeTransformedSlaves(), - map, - minEqOp<label>() - ); - - - forAll(coupledMeshEdges, eI) - { - const label meshEdgeIndex = coupledMeshEdges[eI]; - - collapseEdge[meshEdgeIndex] = cppEdgeData[eI]; - - if - ( - (cppEdgeData[eI] != -1) - && (meshToPatchSameOrientation[eI] != cppOrientation[eI]) - ) - { - collapseEdge[meshEdgeIndex] = 1-collapseEdge[meshEdgeIndex]; - } - } -} - - -// Mark (in collapseEdge) any edges to collapse -label collapseSmallEdges -( - const polyMesh& mesh, - const labelList& boundaryPoint, - const scalarField& minEdgeLen, - labelList& collapseEdge -) -{ - // Work out which edges to collapse - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - label nCollapsed = 0; - - forAll(mesh.edges(), edgeI) - { - if (collapseEdge[edgeI] == -1) - { - const edge& e = mesh.edges()[edgeI]; - - if (e.mag(mesh.points()) < minEdgeLen[edgeI]) - { - label masterPointI = edgeMaster(boundaryPoint, false, e); - if (masterPointI == e[0]) - { - collapseEdge[edgeI] = 0; - } - else - { - collapseEdge[edgeI] = 1; - } - nCollapsed++; - } - } - } - return nCollapsed; -} - - -// Mark (in collapseEdge) any edges to merge -label mergeEdges -( - const polyMesh& mesh, - const scalar maxCos, - const labelList& boundaryPoint, - const scalarField& minEdgeLen, - labelList& collapseEdge -) -{ - const edgeList& edges = mesh.edges(); - const labelListList& pointEdges = mesh.pointEdges(); - - // Point removal engine - removePoints pointRemover(mesh, false); - - // Find out points that can be deleted - boolList pointCanBeDeleted; - label nTotRemove = pointRemover.countPointUsage(maxCos, pointCanBeDeleted); - - - // Rework point-to-remove into edge-to-collapse. - - label nCollapsed = 0; - - if (nTotRemove > 0) - { - forAll(pointEdges, pointI) - { - if (pointCanBeDeleted[pointI]) - { - const labelList& pEdges = pointEdges[pointI]; - - if (pEdges.size() == 2) - { - // Always the case? - - label e0 = pEdges[0]; - label e1 = pEdges[1]; - - if - ( - collapseEdge[e0] == -1 - && minEdgeLen[e0] >= 0 - && collapseEdge[e1] == -1 - && minEdgeLen[e1] >= 0 - ) - { - // Get the two vertices on both sides of the point - label leftV = edges[e0].otherVertex(pointI); - label rightV = edges[e1].otherVertex(pointI); - - // Can collapse pointI onto either leftV or rightV. - // Preferentially choose an internal point to hopefully - // give less distortion - - if (boundaryPoint[leftV] == -1) - { - collapseEdge[e0] = findIndex(edges[e0], leftV); - } - else - { - collapseEdge[e1] = findIndex(edges[e1], rightV); - } - } - } - } - } - } - return nCollapsed; -} - - -// Make consistent set of collapses that does not collapse any cells -label consistentCollapse -( - const bool allowCellCollapse, - const polyMesh& mesh, - const globalIndex& globalStrings, - labelList& collapseEdge, - List<pointEdgeCollapse>& allPointInfo -) -{ - // Make sure we don't collapse cells - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - while (true) - { - // Sync collapseEdge - syncCollapseEdge(mesh, collapseEdge); - - - // Get collapsed faces - - label nAdditionalCollapsed = 0; - - PackedBoolList isCollapsedFace(mesh.nFaces()); - forAll(mesh.faceEdges(), faceI) - { - const labelList& fEdges = mesh.faceEdges()[faceI]; - - // Count number of remaining edges - label nEdges = fEdges.size(); - forAll(fEdges, fEdgeI) - { - label edgeI = fEdges[fEdgeI]; - if (collapseEdge[edgeI] != -1) - { - nEdges--; - } - } - - if (nEdges < 3) - { - // Face is collapsed. - isCollapsedFace[faceI] = 1; - - if (nEdges == 1) - { - // Cannot collapse face down to single edge. - - //- Option 1: collapse remaining edge as well. However - // if this edge is on the coupled processor patch this - // logic clashes with that of syncCollapseEdge - // (do not collapse if any not collapse) - //forAll(fEdges, fEdgeI) - //{ - // label edgeI = fEdges[fEdgeI]; - // if (collapseEdge[edgeI] == -1) - // { - // collapseEdge[edgeI] = 0; - // nAdditionalCollapsed++; - // } - //} - - //- Option 2: uncollapse this face. - forAll(fEdges, fEdgeI) - { - label edgeI = fEdges[fEdgeI]; - if (collapseEdge[edgeI] != -1) - { - collapseEdge[edgeI] = -1; - nAdditionalCollapsed++; - } - } - } - } - } - - //Pout<< "nAdditionalCollapsed : " << nAdditionalCollapsed << endl; - - - label nUncollapsed = 0; - - if (!allowCellCollapse) - { - // Check collapsed cells - - forAll(mesh.cells(), cellI) - { - const cell& cFaces = mesh.cells()[cellI]; - label nFaces = cFaces.size(); - forAll(cFaces, i) - { - label faceI = cFaces[i]; - if (isCollapsedFace[faceI]) - { - nFaces--; - if (nFaces < 4) - { - // Unmark this face for collapse - const labelList& fEdges = mesh.faceEdges()[faceI]; - - forAll(fEdges, fEdgeI) - { - label edgeI = fEdges[fEdgeI]; - if (collapseEdge[edgeI] != -1) - { - collapseEdge[edgeI] = -1; - nUncollapsed++; - } - } - - // Uncollapsed this face. - isCollapsedFace[faceI] = 0; - nFaces++; - } - } - } - } - //Pout<< "** disallowing cells : nUncollapsed : " - // << nUncollapsed << endl; - } - - - if - ( - returnReduce(nUncollapsed+nAdditionalCollapsed, sumOp<label>()) - == 0 - ) - { - break; - } - } - - - // Create consistent set of collapses - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Note: requires collapseEdge to be synchronised. (above loop makes sure - // of that) - - return syncCollapse(mesh, globalStrings, collapseEdge, allPointInfo); -} - - -// Check mesh and mark points on faces in error -// Returns boolList with points in error set -PackedBoolList checkMeshQuality(const polyMesh& mesh) -{ - //mesh.checkMesh(true); - - IOdictionary meshQualityDict - ( - IOobject - ( - "meshQualityDict", - mesh.time().system(), - mesh.time(), - IOobject::MUST_READ, - IOobject::NO_WRITE - ) - ); - - labelHashSet badFaces(mesh.nFaces()/100); - DynamicList<label> checkFaces(mesh.nFaces()); - - const vectorField& fAreas = mesh.faceAreas(); - - scalar faceAreaLimit = SMALL; - - forAll(fAreas, fI) - { - if (mag(fAreas[fI]) > faceAreaLimit) - { - checkFaces.append(fI); - } - } - - motionSmoother::checkMesh - ( - false, - mesh, - meshQualityDict, - checkFaces, - badFaces - ); - - label nBadFaces = badFaces.size(); - reduce(nBadFaces, sumOp<label>()); - - Info<< nl << "Number of bad faces : " << nBadFaces << endl; - - PackedBoolList isErrorPoint(mesh.nPoints()); - forAllConstIter(labelHashSet, badFaces, iter) - { - const face& f = mesh.faces()[iter.key()]; - - forAll(f, pI) - { - isErrorPoint[f[pI]] = 1; - } - } - - syncTools::syncPointList - ( - mesh, - isErrorPoint, - orEqOp<unsigned int>(), - 0 - ); - - return isErrorPoint; -} - - -// Check mesh with collapses (newMesh), updates minEdgeLen, nFrozenEdges -void checkMeshAndFreezeEdges -( - const polyMesh& newMesh, - const labelList& oldToNewMesh, - const polyMesh& oldMesh, - scalarField& minEdgeLen, - label& nFrozenEdges -) -{ - PackedBoolList isErrorPoint = checkMeshQuality(newMesh); - - forAll(oldMesh.edges(), edgeI) - { - const edge& e = oldMesh.edges()[edgeI]; - label newStart = oldToNewMesh[e[0]]; - label newEnd = oldToNewMesh[e[1]]; - - if - ( - (newStart >= 0 && isErrorPoint[newStart]) - || (newEnd >= 0 && isErrorPoint[newEnd]) - ) - { - // Gradual decrease? For now just hard disable - if (minEdgeLen[edgeI] > -GREAT/2) - { - minEdgeLen[edgeI] = -GREAT; - nFrozenEdges++; - } - } - } -} - - -// Mark boundary points -// boundaryPoint: -// + -1 : point not on boundary -// + 0 : point on a real boundary -// + >0 : point on a processor patch with that ID -labelList findBoundaryPoints(const polyMesh& mesh) -{ - const faceList& faces = mesh.faces(); - const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); - - - labelList boundaryPoint(mesh.nPoints(), -1); - - // Get all points on a boundary - label nIntFaces = mesh.nInternalFaces(); - for (label faceI = nIntFaces; faceI < mesh.nFaces(); faceI++) - { - const face& f = faces[faceI]; - - forAll(f, fp) - { - boundaryPoint[f[fp]] = 0; - } - } - - // Get all processor boundary points and the processor patch label - // that they are on. - forAll(bMesh, patchI) - { - const polyPatch& patch = bMesh[patchI]; - - if (isA<coupledPolyPatch>(patch)) - { - if (patchI == 0) - { - // We mark 'normal' boundary points with 0 so make sure this - // coupled patch is not 0. - FatalErrorIn("findBoundaryPoints(const polyMesh&)") - << "Your patches should have non-coupled ones before any" - << " coupled ones. Current patches " << bMesh.names() - << exit(FatalError); - } - - forAll(patch, fI) - { - const face& f = patch[fI]; - - forAll(f, fp) - { - boundaryPoint[f[fp]] = patchI; - } - } - } - } - - return boundaryPoint; -} - - // Main program: int main(int argc, char *argv[]) { + timeSelector::addOptions(true, false); argList::addNote ( - "Merges small and in-line edges.\n" - "Collapses faces and optionally cells to a point." + "Collapses small edges to a point.\n" + "Optionally collapse small faces to a point and thin faces to an edge." ); -# include "addOverwriteOption.H" - - argList::validArgs.append("edge length [m]"); - argList::validArgs.append("merge angle (degrees)"); argList::addBoolOption ( - "allowCellCollapse", - "Allow collapsing of cells to a single point" + "collapseFaces", + "Collapse small and sliver faces as well as small edges" ); - argList::addBoolOption - ( - "meshQuality", - "Only collapse if not exceeding given meshQualityDict limits" - ); - - +# include "addOverwriteOption.H" # include "setRootCase.H" # include "createTime.H" - runTime.functionObjects().off(); -# include "createPolyMesh.H" - const word oldInstance = mesh.pointsInstance(); - scalar minLen = args.argRead<scalar>(1); - const scalar angle = args.argRead<scalar>(2); - - const bool allowCellCollapse = args.optionFound("allowCellCollapse"); - const bool overwrite = args.optionFound("overwrite"); - const bool checkQuality = args.optionFound("meshQuality"); - - scalar maxCos = Foam::cos(degToRad(angle)); - - Info<< "Merging:" << nl - << " edges with length less than " << minLen << " meters" << nl - << " edges split by a point with edges in line to within " << angle - << " degrees" << nl - << endl; - - if (allowCellCollapse) - { - Info<< "Allowing collapse of cells down to a point." << nl - << endl; - } - else - { - Info<< "Disallowing collapse of cells down to a point." << nl - << endl; - } - - - if (checkQuality) - { - Info<< "Selectively disabling wanted collapses until resulting quality" - << " satisfies constraints in system/meshQualityDict" << nl - << endl; - } - - - - // To mark master of collapes - globalIndex globalStrings(mesh.nPoints()); - - - // Local collapse length. Any edge below this length gets (attempted) - // collapsed. Use either aa gradually decreasing value - // (so from minLen to e.g. 0.5*minLen) or a hard limit (GREAT) - scalarField minEdgeLen(mesh.nEdges(), minLen); - label nFrozenEdges = 0; - - - - // Initial mesh check - // ~~~~~~~~~~~~~~~~~~ - // Do not allow collapses in regions of error. - // Updates minEdgeLen, nFrozenEdges - if (checkQuality) - { - checkMeshAndFreezeEdges - ( - mesh, - identity(mesh.nPoints()), - mesh, - minEdgeLen, - nFrozenEdges - ); - Info<< "Initial frozen edges " - << returnReduce(nFrozenEdges, sumOp<label>()) - << " out of " << returnReduce(mesh.nEdges(), sumOp<label>()) - << endl; - } - - - // Mark points on boundary - const labelList boundaryPoint = findBoundaryPoints(mesh); - - // Copy of current set of topology changes. Used to generate final mesh. - polyTopoChange savedMeshMod(mesh.boundaryMesh().size()); + runTime.functionObjects().off(); + instantList timeDirs = timeSelector::selectIfPresent(runTime, args); - // Keep track of whether mesh has changed at all - bool meshChanged = false; +# include "createMesh.H" + const word oldInstance = mesh.pointsInstance(); + const bool overwrite = args.optionFound("overwrite"); - // Main loop - // ~~~~~~~~~ - // It tries and do some collapses, checks the resulting mesh and - // 'freezes' some edges (by marking in minEdgeLen) and tries again. - // This will iterate ultimately to the situation where every edge is - // frozen and nothing gets collapsed. + const bool collapseFaces = args.optionFound("collapseFaces"); - do + forAll(timeDirs, timeI) { - // Per edge collapse status: - // -1 : not collapsed - // 0 : collapse to start - // 1 : collapse to end - labelList collapseEdge(mesh.nEdges(), -1); - - - // Work out which edges to collapse - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // This is by looking at minEdgeLen (to avoid frozen edges) - // and marking in collapseEdge. - - // Small edges - label nSmallCollapsed = collapseSmallEdges - ( - mesh, - boundaryPoint, - minEdgeLen, - collapseEdge - ); - reduce(nSmallCollapsed, sumOp<label>()); - - Info<< indent << "Collapsing " << nSmallCollapsed - << " small edges" << endl; - - - // Inline edges - label nMerged = mergeEdges - ( - mesh, - maxCos, - boundaryPoint, - minEdgeLen, - collapseEdge - ); - - reduce(nMerged, sumOp<label>()); - Info<< indent << "Collapsing " << nMerged << " in line edges" - << endl; + runTime.setTime(timeDirs[timeI], timeI); + Info<< "Time = " << runTime.timeName() << endl; - // Merge edge collapses into consistent collapse-network. Make sure - // no cells get collapsed. - List<pointEdgeCollapse> allPointInfo; - label nLocalCollapse = consistentCollapse - ( - allowCellCollapse, - mesh, - globalStrings, - collapseEdge, - allPointInfo - ); + polyMeshFilter meshFilter(mesh); - reduce(nLocalCollapse, sumOp<label>()); - Info<< "nLocalCollapse = " << nLocalCollapse << endl; + // newMesh will be empty until it is filtered + const autoPtr<fvMesh>& newMesh = meshFilter.filteredMesh(); - if (nLocalCollapse == 0) + // Filter small edges only. This reduces the number of faces so that + // the face filtering is sped up. + label nBadFaces = meshFilter.filterEdges(0); { - break; - } - - - // There are collapses so mesh will get changed - meshChanged = true; - - - // Apply collapses to current mesh - polyTopoChange meshMod(mesh); - - // Insert mesh refinement into polyTopoChange. - setRefinement(mesh, meshMod, allPointInfo); - - // Do all changes - Info<< indent << "Applying changes to the mesh" << nl - //<< decrIndent - << endl; - - savedMeshMod = meshMod; + polyTopoChange meshMod(newMesh); - autoPtr<fvMesh> newMeshPtr; - autoPtr<mapPolyMesh> mapPtr = meshMod.makeMesh - ( - newMeshPtr, - IOobject - ( - mesh.name(), - mesh.instance(), - mesh.time(), // register with runTime - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - mesh, - true // parallel sync - ); - - fvMesh& newMesh = newMeshPtr(); - const mapPolyMesh& map = mapPtr(); - - // Update fields - newMesh.updateMesh(map); - if (map.hasMotionPoints()) - { - newMesh.movePoints(map.preMotionPoints()); + meshMod.changeMesh(mesh, false); } - - - - // If no checks needed exit. - if (!checkQuality) + if (collapseFaces) { - break; - } - - // Mesh check - // ~~~~~~~~~~~~~~~~~~ - // Do not allow collapses in regions of error. - // Updates minEdgeLen, nFrozenEdges - label nOldFrozenEdges = returnReduce(nFrozenEdges, sumOp<label>()); - checkMeshAndFreezeEdges - ( - newMesh, - map.reversePointMap(), - mesh, - minEdgeLen, - nFrozenEdges - ); - label nNewFrozenEdges = returnReduce(nFrozenEdges, sumOp<label>()); - - Info<< "Frozen edges " - << returnReduce(nFrozenEdges, sumOp<label>()) - << " out of " << returnReduce(mesh.nEdges(), sumOp<label>()) - << endl; - - if (nNewFrozenEdges == nOldFrozenEdges) - { - break; - } - - } while (true); - - - if (meshChanged) - { - // Apply changes to current mesh - autoPtr<mapPolyMesh> mapPtr = savedMeshMod.changeMesh(mesh, false); - const mapPolyMesh& map = mapPtr(); + // Filter faces. Pass in the number of bad faces that are present + // from the previous edge filtering to use as a stopping criterion. + meshFilter.filter(nBadFaces); + { + polyTopoChange meshMod(newMesh); - // Update fields - mesh.updateMesh(map); - if (map.hasMotionPoints()) - { - mesh.movePoints(map.preMotionPoints()); + meshMod.changeMesh(mesh, false); + } } - // Write resulting mesh if (!overwrite) { @@ -1462,7 +133,6 @@ int main(int argc, char *argv[]) mesh.write(); } - Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options index 7d4e1304f0f484fbaa63e7ac699256a3f1ff8eac..4f26f666de6b5f60e27a69d0e4e595a1d594c9be 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/Make/options +++ b/applications/utilities/mesh/advanced/combinePatchFaces/Make/options @@ -5,4 +5,5 @@ EXE_INC = \ EXE_LIBS = \ -lmeshTools \ + -lsampling \ -ldynamicMesh diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 877579fa5fcc9a20c2a53762b7aaa836ab04e5c6..8c8be624f040a21b0db6416559ac8b97cb2246c4 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.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 @@ -53,105 +53,19 @@ Description #include "polyMesh.H" #include "mapPolyMesh.H" #include "unitConversion.H" +#include "motionSmoother.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -// Same check as snapMesh -void checkSnapMesh -( - const Time& runTime, - const polyMesh& mesh, - labelHashSet& wrongFaces -) -{ - IOdictionary snapDict - ( - IOobject - ( - "snapMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - // Max nonorthogonality allowed - scalar maxNonOrtho(readScalar(snapDict.lookup("maxNonOrtho"))); - // Max concaveness allowed. - scalar maxConcave(readScalar(snapDict.lookup("maxConcave"))); - // Min volume allowed (factor of minimum cellVolume) - scalar relMinVol(readScalar(snapDict.lookup("minVol"))); - const scalar minCellVol = min(mesh.cellVolumes()); - const scalar minPyrVol = relMinVol*minCellVol; - // Min area - scalar minArea(readScalar(snapDict.lookup("minArea"))); - - if (maxNonOrtho < 180.0-SMALL) - { - Pout<< "Checking non orthogonality" << endl; - - label nOldSize = wrongFaces.size(); - mesh.setNonOrthThreshold(maxNonOrtho); - mesh.checkFaceOrthogonality(false, &wrongFaces); - - Pout<< "Detected " << wrongFaces.size() - nOldSize - << " faces with non-orthogonality > " << maxNonOrtho << " degrees" - << endl; - } - - if (minPyrVol > -GREAT) - { - Pout<< "Checking face pyramids" << endl; - - label nOldSize = wrongFaces.size(); - mesh.checkFacePyramids(false, minPyrVol, &wrongFaces); - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with illegal face pyramids" << endl; - } - - if (maxConcave < 180.0-SMALL) - { - Pout<< "Checking face angles" << endl; - - label nOldSize = wrongFaces.size(); - mesh.checkFaceAngles(false, maxConcave, &wrongFaces); - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with concavity > " << maxConcave << " degrees" - << endl; - } - - if (minArea > -SMALL) - { - Pout<< "Checking face areas" << endl; - - label nOldSize = wrongFaces.size(); - - const scalarField magFaceAreas(mag(mesh.faceAreas())); - - forAll(magFaceAreas, faceI) - { - if (magFaceAreas[faceI] < minArea) - { - wrongFaces.insert(faceI); - } - } - Pout<< "Detected additional " << wrongFaces.size() - nOldSize - << " faces with area < " << minArea << " m^2" << endl; - } -} - - // Merge faces on the same patch (usually from exposing refinement) // Can undo merges if these cause problems. label mergePatchFaces ( const scalar minCos, const scalar concaveSin, - const bool snapMeshDict, + const autoPtr<IOdictionary>& qualDictPtr, const Time& runTime, polyMesh& mesh ) @@ -212,9 +126,9 @@ label mergePatchFaces // Faces in error. labelHashSet errorFaces; - if (snapMeshDict) + if (qualDictPtr.valid()) { - checkSnapMesh(runTime, mesh, errorFaces); + motionSmoother::checkMesh(false, mesh, qualDictPtr(), errorFaces); } else { @@ -437,8 +351,8 @@ int main(int argc, char *argv[]) ); argList::addBoolOption ( - "snapMesh", - "use system/snapMeshDict" + "meshQuality", + "read user-defined mesh quality criterions from system/meshQualityDict" ); # include "setRootCase.H" @@ -455,8 +369,8 @@ int main(int argc, char *argv[]) scalar concaveAngle = args.optionLookupOrDefault("concaveAngle", 30.0); scalar concaveSin = Foam::sin(degToRad(concaveAngle)); - const bool snapMeshDict = args.optionFound("snapMesh"); const bool overwrite = args.optionFound("overwrite"); + const bool meshQuality = args.optionFound("meshQuality"); Info<< "Merging all faces of a cell" << nl << " - which are on the same patch" << nl @@ -468,23 +382,47 @@ int main(int argc, char *argv[]) << " (sin:" << concaveSin << ')' << nl << endl; + autoPtr<IOdictionary> qualDict; + if (meshQuality) + { + Info<< "Enabling user-defined geometry checks." << nl << endl; + + qualDict.reset + ( + new IOdictionary + ( + IOobject + ( + "meshQualityDict", + mesh.time().system(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ) + ); + } + + if (!overwrite) { runTime++; } + + // Merge faces on same patch label nChanged = mergePatchFaces ( minCos, concaveSin, - snapMeshDict, + qualDict, runTime, mesh ); // Merge points on straight edges and remove unused points - if (snapMeshDict) + if (qualDict.valid()) { Info<< "Merging all 'loose' points on surface edges, " << "regardless of the angle they make." << endl; diff --git a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C index d746d63b8f8db6d2bf1d8ef501089c727dcb5ec0..46954c120ce46d3b1ccc54a9accb6bcfaa1e1e7f 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.C +++ b/applications/utilities/mesh/advanced/modifyMesh/cellSplitter.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cellSplitter, 0); +namespace Foam +{ +defineTypeNameAndDebug(cellSplitter, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C index adb8bdcd5bc80d07e823837e64b9a579c712abd7..eea69b7e51caea0a517b0db5b83495dd19f871b8 100644 --- a/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.C +++ b/applications/utilities/mesh/advanced/modifyMesh/modifyMesh.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 @@ -55,6 +55,7 @@ Description #include "edgeCollapser.H" #include "meshTools.H" #include "Pair.H" +#include "globalIndex.H" using namespace Foam; @@ -569,26 +570,47 @@ int main(int argc, char *argv[]) // Mesh change engine edgeCollapser cutter(mesh); - pointField newPoints(mesh.points()); + const edgeList& edges = mesh.edges(); + const pointField& points = mesh.points(); + + pointField newPoints(points); + + PackedBoolList collapseEdge(mesh.nEdges()); + Map<point> collapsePointToLocation(mesh.nPoints()); // Get new positions and construct collapse network forAllConstIter(Map<point>, edgeToPos, iter) { label edgeI = iter.key(); - const edge& e = mesh.edges()[edgeI]; + const edge& e = edges[edgeI]; + + collapseEdge[edgeI] = true; + collapsePointToLocation.set(e[1], points[e[0]]); - cutter.collapseEdge(edgeI, e[0]); newPoints[e[0]] = iter(); } // Move master point to destination. mesh.movePoints(newPoints); + List<pointEdgeCollapse> allPointInfo; + const globalIndex globalPoints(mesh.nPoints()); + labelList pointPriority(mesh.nPoints(), 0); + + cutter.consistentCollapse + ( + globalPoints, + pointPriority, + collapsePointToLocation, + collapseEdge, + allPointInfo + ); + // Topo change container polyTopoChange meshMod(mesh); // Insert - cutter.setRefinement(meshMod); + cutter.setRefinement(allPointInfo, meshMod); // Do changes autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh, false); diff --git a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H index d722c432e3b4aa5a45e7c11c1e5bfcd7c6d4f7a8..d21b64fdc1fe7affa0afd262c4359d4ba7aa1359 100644 --- a/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToStarMesh/getTimeIndex.H @@ -4,7 +4,7 @@ if ( - runTime.timeName() != "constant" + runTime.timeName() != runTime.constant() && runTime.timeName() != "0" ) { diff --git a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H index d722c432e3b4aa5a45e7c11c1e5bfcd7c6d4f7a8..d21b64fdc1fe7affa0afd262c4359d4ba7aa1359 100644 --- a/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H +++ b/applications/utilities/mesh/conversion/foamToSurface/getTimeIndex.H @@ -4,7 +4,7 @@ if ( - runTime.timeName() != "constant" + runTime.timeName() != runTime.constant() && runTime.timeName() != "0" ) { diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 6f8712a0b357811f4bde59d981725018fa2a9fe0..097330487e2ab92d2a581bf0b02e487ba5b08b6a 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.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 @@ -104,60 +104,50 @@ int main(int argc, char *argv[]) polyMeshDir = polyMesh::meshSubDir; } - autoPtr<IOobject> meshDictIoPtr; + IOobject meshDictIO + ( + dictName, + runTime.constant(), + polyMeshDir, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); if (args.optionFound("dict")) { const fileName dictPath = args["dict"]; - meshDictIoPtr.set - ( - new IOobject - ( - ( - isDir(dictPath) - ? dictPath/dictName - : dictPath - ), - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ); - } - else - { - meshDictIoPtr.set + meshDictIO = IOobject ( - new IOobject ( - dictName, - runTime.constant(), - polyMeshDir, - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) + isDir(dictPath) + ? dictPath/dictName + : dictPath + ), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false ); } - if (!meshDictIoPtr->headerOk()) + if (!meshDictIO.headerOk()) { FatalErrorIn(args.executable()) << "Cannot open mesh description file\n " - << meshDictIoPtr->objectPath() + << meshDictIO.objectPath() << nl << exit(FatalError); } Info<< "Creating block mesh from\n " - << meshDictIoPtr->objectPath() << endl; + << meshDictIO.objectPath() << endl; blockMesh::verbose(true); - IOdictionary meshDict(meshDictIoPtr()); + IOdictionary meshDict(meshDictIO); blockMesh blocks(meshDict, regionName); diff --git a/applications/utilities/mesh/generation/cvMesh/Allwmake b/applications/utilities/mesh/generation/cvMesh/Allwmake index eb453138ce529dfcf03af180f64350cd034726af..d88e8cee4afe888e82031a710e39bd9db82a578d 100755 --- a/applications/utilities/mesh/generation/cvMesh/Allwmake +++ b/applications/utilities/mesh/generation/cvMesh/Allwmake @@ -4,7 +4,8 @@ set -x wmake libso conformalVoronoiMesh wmake -wmake cvMeshBackgroundMesh +#wmake cvMeshBackgroundMesh (cd cvMeshSurfaceSimplify && ./Allwmake) +wmake cellSizeAndAlignmentGrid # ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/mesh/generation/cvMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/Make/options index 2255a9a27164813355db2e5b730673a3441dc4c9..9461fa3725d8b76cc7cdce5cc102b5aa1933bdbf 100644 --- a/applications/utilities/mesh/generation/cvMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/Make/options @@ -2,7 +2,7 @@ EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_FROUNDING_MATH = -frounding-math EXE_NDEBUG = -DNDEBUG -CGAL_EXACT = +CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ CGAL_INEXACT = -DCGAL_INEXACT include $(GENERAL_RULES)/CGAL @@ -17,8 +17,11 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/triSurface/lnInclude + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -IvectorTools EXE_LIBS = \ $(CGAL_LIBS) \ @@ -29,5 +32,7 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -ledgeMesh \ + -lfileFormats \ -ltriSurface \ - -ldynamicMesh + -ldynamicMesh \ + -lsampling diff --git a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/Make/files b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..83b77fdc77ee07fc46cfc37752b42d613bce8154 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/Make/files @@ -0,0 +1,2 @@ +cellSizeAndAlignmentGrid.C +EXE = $(FOAM_USER_APPBIN)/cellSizeAndAlignmentGrid diff --git a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/Make/options b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..31d0d80858fad570a1809d938b72a86a074ab71b --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/Make/options @@ -0,0 +1,40 @@ +EXE_DEBUG = -DFULLDEBUG -g -O0 +EXE_FROUNDING_MATH = -frounding-math +EXE_NDEBUG = -DNDEBUG + +CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ +CGAL_INEXACT = -DCGAL_INEXACT + +include $(GENERAL_RULES)/CGAL + + +EXE_INC = \ + ${EXE_FROUNDING_MATH} \ + ${EXE_NDEBUG} \ + ${CGAL_INEXACT} \ + ${CGAL_INC} \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ + -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(HOME)/OpenFOAM/OpenFOAM-dev/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/lnInclude \ + -I$(HOME)/OpenFOAM/OpenFOAM-dev/applications/utilities/mesh/generation/cvMesh/vectorTools + +EXE_LIBS = \ + $(CGAL_LIBS) \ + -lmpfr \ + -lboost_thread \ + -lconformalVoronoiMesh \ + -lfiniteVolume \ + -lmeshTools \ + -ldecompositionMethods \ + -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ + -ledgeMesh \ + -ltriSurface \ + -ldynamicMesh \ + -lsampling \ + -lfileFormats diff --git a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C new file mode 100644 index 0000000000000000000000000000000000000000..27cc47f823f28099c7b0f30f0319d1893449ab73 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C @@ -0,0 +1,711 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Application + Test-distributedDelaunayMesh + +Description + +\*---------------------------------------------------------------------------*/ + +#include "CGALTriangulation3DKernel.H" + +#include "indexedVertex.H" +#include "indexedCell.H" + +#include "argList.H" +#include "Time.H" +#include "DistributedDelaunayMesh.H" +#include "backgroundMeshDecomposition.H" +#include "searchableSurfaces.H" +#include "conformationSurfaces.H" +#include "PrintTable.H" +#include "Random.H" +#include "boundBox.H" +#include "point.H" +#include "cellShapeControlMesh.H" +#include "triadField.H" +#include "scalarIOField.H" +#include "pointIOField.H" +#include "triadIOField.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +template <class Triangulation, class Type> +Foam::tmp<Foam::Field<Type> > filterFarPoints +( + const Triangulation& mesh, + const Field<Type>& field +) +{ + tmp<Field<Type> > tNewField(new Field<Type>(field.size())); + Field<Type>& newField = tNewField(); + + label added = 0; + label count = 0; + + for + ( + typename Triangulation::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + newField[added++] = field[count]; + } + + count++; + } + + newField.resize(added); + + return tNewField; +} + + +template <class T> +autoPtr<mapDistribute> buildMap +( + const T& mesh, + labelListList& pointPoints +) +{ + pointPoints.setSize(mesh.vertexCount()); + + globalIndex globalIndexing(mesh.vertexCount()); + + for + ( + typename T::Finite_vertices_iterator vit = mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (!vit->real()) + { + continue; + } + + std::list<typename T::Vertex_handle> adjVerts; + mesh.finite_adjacent_vertices(vit, std::back_inserter(adjVerts)); + + DynamicList<label> indices(adjVerts.size()); + + for + ( + typename std::list<typename T::Vertex_handle>::const_iterator + adjVertI = adjVerts.begin(); + adjVertI != adjVerts.end(); + ++adjVertI + ) + { + typename T::Vertex_handle vh = *adjVertI; + + if (!vh->farPoint()) + { + indices.append + ( + globalIndexing.toGlobal(vh->procIndex(), vh->index()) + ); + } + } + + pointPoints[vit->index()].transfer(indices); + } + + List<Map<label> > compactMap; + + return autoPtr<mapDistribute> + ( + new mapDistribute + ( + globalIndexing, + pointPoints, + compactMap + ) + ); +} + + +template <class T> +Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh) +{ + tmp<triadField> tAlignments + ( + new triadField(mesh.vertexCount(), triad::unset) + ); + triadField& alignments = tAlignments(); + + for + ( + typename T::Finite_vertices_iterator vit = mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (!vit->real()) + { + continue; + } + + alignments[vit->index()] = triad + ( + vit->alignment().x(), + vit->alignment().y(), + vit->alignment().z() + ); + } + + return tAlignments; +} + + +template <class T> +Foam::tmp<Foam::pointField> buildPointField(const T& mesh) +{ + tmp<pointField> tPoints + ( + new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT)) + ); + pointField& points = tPoints(); + + for + ( + typename T::Finite_vertices_iterator vit = mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (!vit->real()) + { + continue; + } + + points[vit->index()] = topoint(vit->point()); + } + + return tPoints; +} + + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + label maxRefinementIterations = 0; + label maxSmoothingIterations = 200; + scalar minResidual = 0; + scalar defaultCellSize = 0.0004; + scalar nearFeatDistSqrCoeff = 1e-8; + + + // Need to decouple vertex and cell type from this class? + // Vertex must have: + // + index + // + procIndex + // - type should be optional + cellShapeControlMesh mesh(runTime); + + IOdictionary cvMeshDict + ( + IOobject + ( + "cvMeshDict", + runTime.system(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ); + + Random rndGen(64293*Pstream::myProcNo()); + + searchableSurfaces allGeometry + ( + IOobject + ( + "cvSearchableSurfaces", + runTime.constant(), + "triSurface", + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + cvMeshDict.subDict("geometry") + ); + + conformationSurfaces geometryToConformTo + ( + runTime, + rndGen, + allGeometry, + cvMeshDict.subDict("surfaceConformation") + ); + + autoPtr<backgroundMeshDecomposition> bMesh; + if (Pstream::parRun()) + { + bMesh.set + ( + new backgroundMeshDecomposition + ( + runTime, + rndGen, + geometryToConformTo, + cvMeshDict.subDict("backgroundMeshDecomposition") + ) + ); + } + + // Nice to have IO for the delaunay mesh + // IO depend on vertex type. + // + // Define a delaunay mesh as: + // + list of points of the triangulation + // + optionally a list of cells + + Info<< nl << "Loop over surfaces" << endl; + + forAll(geometryToConformTo.surfaces(), sI) + { + const label surfI = geometryToConformTo.surfaces()[sI]; + + const searchableSurface& surface = + geometryToConformTo.geometry()[surfI]; + + Info<< nl << "Inserting points from surface " << surface.name() + << " (" << surface.type() << ")" << endl; + + const tmp<pointField> tpoints = surface.points(); + const pointField& points = tpoints(); + + Info<< " Number of points = " << points.size() << endl; + + forAll(points, pI) + { + // Is the point in the extendedFeatureEdgeMesh? If so get the + // point normal, otherwise get the surface normal from + // searchableSurface + + pointIndexHit info; + label infoFeature; + geometryToConformTo.findFeaturePointNearest + ( + points[pI], + nearFeatDistSqrCoeff, + info, + infoFeature + ); + + + autoPtr<triad> pointAlignment; + + if (info.hit()) + { + const extendedFeatureEdgeMesh& features = + geometryToConformTo.features()[infoFeature]; + + vectorField norms = features.featurePointNormals(info.index()); + + // Create a triad from these norms. + pointAlignment.set(new triad()); + forAll(norms, nI) + { + pointAlignment() += norms[nI]; + } + + pointAlignment().normalize(); + pointAlignment().orthogonalize(); + } + else + { + geometryToConformTo.findEdgeNearest + ( + points[pI], + nearFeatDistSqrCoeff, + info, + infoFeature + ); + + if (info.hit()) + { + const extendedFeatureEdgeMesh& features = + geometryToConformTo.features()[infoFeature]; + + vectorField norms = features.edgeNormals(info.index()); + + // Create a triad from these norms. + pointAlignment.set(new triad()); + forAll(norms, nI) + { + pointAlignment() += norms[nI]; + } + + pointAlignment().normalize(); + pointAlignment().orthogonalize(); + } + else + { + pointField ptField(1, points[pI]); + scalarField distField(1, nearFeatDistSqrCoeff); + List<pointIndexHit> infoList(1, pointIndexHit()); + + surface.findNearest(ptField, distField, infoList); + + vectorField normals(1); + surface.getNormal(infoList, normals); + + pointAlignment.set(new triad(normals[0])); + } + } + + if (Pstream::parRun()) + { + if (bMesh().positionOnThisProcessor(points[pI])) + { + CellSizeDelaunay::Vertex_handle vh = mesh.insert + ( + points[pI], + defaultCellSize, + pointAlignment() + ); + } + } + else + { + CellSizeDelaunay::Vertex_handle vh = mesh.insert + ( + points[pI], + defaultCellSize, + pointAlignment() + ); + } + } + } + + + for (label iter = 0; iter < maxRefinementIterations; ++iter) + { + DynamicList<point> ptsToInsert; + + for + ( + CellSizeDelaunay::Finite_cells_iterator cit = + mesh.finite_cells_begin(); + cit != mesh.finite_cells_end(); + ++cit + ) + { + const point newPoint = + topoint + ( + CGAL::centroid + ( + cit->vertex(0)->point(), + cit->vertex(1)->point(), + cit->vertex(2)->point(), + cit->vertex(3)->point() + ) + ); + + if (geometryToConformTo.inside(newPoint)) + { + ptsToInsert.append(newPoint); + } + } + + Info<< " Adding " << returnReduce(ptsToInsert.size(), sumOp<label>()) + << endl; + + forAll(ptsToInsert, ptI) + { + mesh.insert + ( + ptsToInsert[ptI], + defaultCellSize, + triad::unset + ); + } + } + + + if (Pstream::parRun()) + { + mesh.distribute(bMesh); + } + + labelListList pointPoints; + autoPtr<mapDistribute> meshDistributor = buildMap(mesh, pointPoints); + + triadField alignments = buildAlignmentField(mesh); + pointField points = buildPointField(mesh); + + mesh.printInfo(Info); + + + // Setup the sizes and alignments on each point + triadField fixedAlignments(mesh.vertexCount(), triad::unset); + + for + ( + CellSizeDelaunay::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + const tensor& alignment = vit->alignment(); + + fixedAlignments[vit->index()] = triad + ( + alignment.x(), + alignment.y(), + alignment.z() + ); + } + } + + + Info<< nl << "Smoothing alignments" << endl; + + for (label iter = 0; iter < maxSmoothingIterations; iter++) + { + Info<< "Iteration " << iter; + + meshDistributor().distribute(points); + meshDistributor().distribute(alignments); + + scalar residual = 0; + + triadField triadAv(alignments.size(), triad::unset); + + forAll(pointPoints, pI) + { + const labelList& pPoints = pointPoints[pI]; + + if (pPoints.empty()) + { + continue; + } + + const triad& oldTriad = alignments[pI]; + triad& newTriad = triadAv[pI]; + + forAll(pPoints, adjPointI) + { + const label adjPointIndex = pPoints[adjPointI]; + + scalar dist = mag(points[pI] - points[adjPointIndex]); + + dist = max(dist, SMALL); + + triad tmpTriad = alignments[adjPointIndex]; + + for (direction dir = 0; dir < 3; dir++) + { + if (tmpTriad.set(dir)) + { + tmpTriad[dir] *= (1.0/dist); + } + } + + newTriad += tmpTriad; + } + + newTriad.normalize(); + newTriad.orthogonalize(); + newTriad = newTriad.sortxyz(); + + // Enforce the boundary conditions + const triad& fixedAlignment = fixedAlignments[pI]; + + label nFixed = 0; + + forAll(fixedAlignment, dirI) + { + if (fixedAlignment[dirI] != triad::unset[dirI]) + { + nFixed++; + } + } + + if (nFixed == 1) + { + forAll(fixedAlignment, dirI) + { + if (fixedAlignment.set(dirI)) + { + newTriad.align(fixedAlignment[dirI]); + } + } + } + else if (nFixed == 2) + { + forAll(fixedAlignment, dirI) + { + if (fixedAlignment.set(dirI)) + { + newTriad[dirI] = fixedAlignment[dirI]; + } + else + { + newTriad[dirI] = triad::unset[dirI]; + } + } + + newTriad.orthogonalize(); + } + else if (nFixed == 3) + { + forAll(fixedAlignment, dirI) + { + if (fixedAlignment.set(dirI)) + { + newTriad[dirI] = fixedAlignment[dirI]; + } + } + } + + if (newTriad.set(vector::X) && oldTriad.set(vector::X)) + { + scalar dotProd = (oldTriad.x() & newTriad.x()); + + scalar diff = mag(dotProd) - 1.0; + residual += mag(diff); + } + if (newTriad.set(vector::Y) && oldTriad.set(vector::Y)) + { + scalar dotProd = (oldTriad.y() & newTriad.y()); + + scalar diff = mag(dotProd) - 1.0; + residual += mag(diff); + } + if (newTriad.set(vector::Z) && oldTriad.set(vector::Z)) + { + scalar dotProd = (oldTriad.z() & newTriad.z()); + + scalar diff = mag(dotProd) - 1.0; + residual += mag(diff); + } + } + + forAll(alignments, pI) + { + alignments[pI] = triadAv[pI].sortxyz(); + } + + reduce(residual, sumOp<scalar>()); + + Info<< ", Residual = " << residual << endl; + + if (residual <= minResidual) + { + break; + } + } + + + // Write alignments to a .obj file + OFstream str(runTime.path()/"alignments.obj"); + + forAll(alignments, pI) + { + const triad& tri = alignments[pI]; + + if (tri.set()) + { + forAll(tri, dirI) + { + meshTools::writeOBJ(str, points[pI], tri[dirI] + points[pI]); + } + } + } + + + // Remove the far points + pointIOField pointsIO + ( + IOobject + ( + "points", + runTime.constant(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + filterFarPoints(mesh, points) + ); + + scalarField sizes(points.size(), defaultCellSize); + scalarIOField sizesIO + ( + IOobject + ( + "sizes", + runTime.constant(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + filterFarPoints(mesh, sizes) + ); + + triadIOField alignmentsIO + ( + IOobject + ( + "alignments", + runTime.constant(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + filterFarPoints(mesh, alignments) + ); + + pointsIO.write(); + sizesIO.write(); + alignmentsIO.write(); + + Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + + Info<< "\nEnd\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/changesLaurence b/applications/utilities/mesh/generation/cvMesh/changesLaurence deleted file mode 100644 index 5f55eff4624d66db182879be4d9a515a9c1ac581..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/cvMesh/changesLaurence +++ /dev/null @@ -1,5 +0,0 @@ -wmake/rules/General/CGAL - - -lboost_thread - -lboost_thread-mt - diff --git a/applications/utilities/mesh/generation/cvMesh/checkCvMesh/meshQualityDict b/applications/utilities/mesh/generation/cvMesh/checkCvMesh/meshQualityDict new file mode 100644 index 0000000000000000000000000000000000000000..fa5319e087c5e36fe7c3cd93d3a69d5ebc75463e --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/checkCvMesh/meshQualityDict @@ -0,0 +1,73 @@ +/*--------------------------------*- 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; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object meshQualityDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Maximum non-orthogonality allowed. Set to 180 to disable. +maxNonOrtho 65; + +//- Max skewness allowed. Set to <0 to disable. +maxBoundarySkewness 50; +maxInternalSkewness 10; + +//- Max concaveness allowed. Is angle (in degrees) below which concavity +// is allowed. 0 is straight face, <0 would be convex face. +// Set to 180 to disable. +maxConcave 80; + +//- Minimum quality of the tet formed by the face-centre +// and variable base point minimum decomposition triangles and +// the cell centre. This has to be a positive number for tracking +// to work. Set to very negative number (e.g. -1E30) to +// disable. +// <0 = inside out tet, +// 0 = flat tet +// 1 = regular tet +minTetQuality 1e-30; + +//- Minimum pyramid volume. Is absolute volume of cell pyramid. +// Set to a sensible fraction of the smallest cell volume expected. +// Set to very negative number (e.g. -1E30) to disable. +minVol 1e-20; + +//- Minimum face area. Set to <0 to disable. +minArea -1; + +//- Minimum face twist. Set to <-1 to disable. dot product of face normal +//- and face centre triangles normal +minTwist 0.001; + +//- minimum normalised cell determinant +//- 1 = hex, <= 0 = folded or flattened illegal cell +minDeterminant 0.001; + +//- minFaceWeight (0 -> 0.5) +minFaceWeight 0.02; + +//- minVolRatio (0 -> 1) +minVolRatio 0.01; + +//must be >0 for Fluent compatibility +minTriangleTwist -1; + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C new file mode 100644 index 0000000000000000000000000000000000000000..a0327ce04f9b5e7b7cc622a0190115b6d21f7be7 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C @@ -0,0 +1,233 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "DelaunayMesh.H" +#include "labelPair.H" +#include "PrintTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Triangulation> +Foam::DelaunayMesh<Triangulation>::DelaunayMesh() +: + Triangulation(), + vertexCount_(0), + cellCount_(0) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Triangulation> +Foam::DelaunayMesh<Triangulation>::~DelaunayMesh() +{} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::reset() +{ + Info<< "Clearing triangulation" << endl; + + this->clear(); + + resetVertexCount(); + resetCellCount(); +} + + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::insertPoints(const List<Vb>& vertices) +{ + rangeInsertWithInfo + ( + vertices.begin(), + vertices.end(), + true + ); +} + + +template<class Triangulation> +bool Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::Less_x_3:: +operator() +( + const Point_3& p, + const Point_3& q +) const +{ + return typename Gt::Less_x_3()(*(p.first), *(q.first)); +} + +template<class Triangulation> +bool Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::Less_y_3:: +operator() +( + const Point_3& p, + const Point_3& q +) const +{ + return typename Gt::Less_y_3()(*(p.first), *(q.first)); +} + +template<class Triangulation> +bool Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::Less_z_3:: +operator() +( + const Point_3& p, + const Point_3& q +) const +{ + return typename Gt::Less_z_3()(*(p.first), *(q.first)); +} + +template<class Triangulation> +typename Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::Less_x_3 +Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::less_x_3_object() +const +{ + return Less_x_3(); +} + +template<class Triangulation> +typename Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::Less_y_3 +Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::less_y_3_object() +const +{ + return Less_y_3(); +} + +template<class Triangulation> +typename Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::Less_z_3 +Foam::DelaunayMesh<Triangulation>::Traits_for_spatial_sort::less_z_3_object() +const +{ + return Less_z_3(); +} + + +template<class Triangulation> +template<class PointIterator> +void Foam::DelaunayMesh<Triangulation>::rangeInsertWithInfo +( + PointIterator begin, + PointIterator end, + bool printErrors +) +{ + typedef DynamicList + < + std::pair + < + const typename Triangulation::Point*, + label + > + > vectorPairPointIndex; + + vectorPairPointIndex points; + + label count = 0; + for (PointIterator it = begin; it != end; ++it) + { + points.append + ( + std::make_pair(&(it->point()), count++) + ); + } + + std::random_shuffle(points.begin(), points.end()); + + spatial_sort + ( + points.begin(), + points.end(), + Traits_for_spatial_sort() + ); + + Vertex_handle hint; + + for + ( + typename vectorPairPointIndex::const_iterator p = points.begin(); + p != points.end(); + ++p + ) + { + const size_t checkInsertion = Triangulation::number_of_vertices(); + + hint = this->insert(*(p->first), hint); + + const Vb& vert = *(begin + p->second); + + if (checkInsertion != Triangulation::number_of_vertices() - 1) + { + if (printErrors) + { + Vertex_handle nearV = + Triangulation::nearest_vertex(*(p->first)); + + Pout<< "Failed insertion : " << vert.info() + << " nearest : " << nearV->info(); + } + } + else + { + hint->index() = getNewVertexIndex(); + hint->type() = vert.type(); + hint->procIndex() = vert.procIndex(); + hint->targetCellSize() = vert.targetCellSize(); + hint->alignment() = vert.alignment(); + } + } +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "DelaunayMeshIO.C" + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..bdeee880e78e1b5bfc9fdf6b0ae7050c915453eb --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H @@ -0,0 +1,238 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::DelaunayMesh + +Description + The vertex and cell classes must have an index defined + +SourceFiles + DelaunayMeshI.H + DelaunayMesh.C + DelaunayMeshIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DelaunayMesh_H +#define DelaunayMesh_H + +#include "Pair.H" +#include "HashSet.H" +#include "FixedList.H" +#include "boundBox.H" +#include "indexedVertex.H" +#include "CGALTriangulation3Ddefs.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class DelaunayMesh Declaration +\*---------------------------------------------------------------------------*/ + +template<class Triangulation> +class DelaunayMesh +: + public Triangulation +{ +public: + + typedef typename Triangulation::Cell_handle Cell_handle; + typedef typename Triangulation::Vertex_handle Vertex_handle; + typedef typename Triangulation::Point Point; + typedef typename Triangulation::Facet Facet; + + typedef typename Triangulation::Finite_vertices_iterator + Finite_vertices_iterator; + typedef typename Triangulation::Finite_cells_iterator + Finite_cells_iterator; + typedef typename Triangulation::Finite_facets_iterator + Finite_facets_iterator; + + typedef HashSet + < + Pair<label>, + FixedList<label, 2>::Hash<> + > labelPairHashSet; + + +private: + + // Private data + + //- Keep track of the number of vertices that have been added. + // This allows a unique index to be assigned to each vertex. + mutable label vertexCount_; + + //- Keep track of the number of cells that have been added. + // This allows a unique index to be assigned to each cell. + mutable label cellCount_; + + //- Spatial sort traits to use with a pair of point pointers and an int. + // Taken from a post on the CGAL lists: 2010-01/msg00004.html by + // Sebastien Loriot (Geometry Factory). + struct Traits_for_spatial_sort + : + public Triangulation::Geom_traits + { + typedef typename Triangulation::Geom_traits Gt; + + typedef std::pair<const typename Triangulation::Point*, int> + Point_3; + + struct Less_x_3 + { + bool operator()(const Point_3& p, const Point_3& q) const; + }; + + struct Less_y_3 + { + bool operator()(const Point_3& p, const Point_3& q) const; + }; + + struct Less_z_3 + { + bool operator()(const Point_3& p, const Point_3& q) const; + }; + + Less_x_3 less_x_3_object() const; + Less_y_3 less_y_3_object() const; + Less_z_3 less_z_3_object() const; + }; + + + // Private Member Functions + + void sortFaces + ( + faceList& faces, + labelList& owner, + labelList& neighbour + ) const; + + void addPatches + ( + const label nInternalFaces, + faceList& faces, + labelList& owner, + labelList& patchSizes, + labelList& patchStarts, + const List<DynamicList<face> >& patchFaces, + const List<DynamicList<label> >& patchOwners + ) const; + + //- Disallow default bitwise copy construct + DelaunayMesh(const DelaunayMesh<Triangulation>&); + + //- Disallow default bitwise assignment + void operator=(const DelaunayMesh<Triangulation>&); + + +public: + + // Constructors + + //- Construct from components + DelaunayMesh(); + + + //- Destructor + ~DelaunayMesh(); + + + // Member Functions + + inline label getNewVertexIndex() const; + + inline label getNewCellIndex() const; + + inline label cellCount() const; + + inline void resetCellCount(); + + inline label vertexCount() const; + + inline void resetVertexCount(); + + + //- Remove the entire triangulation + void reset(); + + void insertPoints(const List<Vb>& vertices); + + //- Function inserting points into a triangulation and setting the + // index and type data of the point in the correct order. This is + // faster than inserting points individually. + // + // Adapted from a post on the CGAL lists: 2010-01/msg00004.html by + // Sebastien Loriot (Geometry Factory). + template<class PointIterator> + void rangeInsertWithInfo + ( + PointIterator begin, + PointIterator end, + bool printErrors = true + ); + + + // Queries + + void printInfo(Ostream& os) const; + + //- Create an fvMesh from the triangulation. + // The mesh is not parallel consistent - only used for viewing + autoPtr<fvMesh> createMesh + ( + const fileName& name, + const Time& runTime, + labelList& vertexMap, + labelList& cellMap + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "DelaunayMeshI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DelaunayMesh.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H new file mode 100644 index 0000000000000000000000000000000000000000..841e5c9024b5954e80a897148c00e4c3bfea3e4e --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Triangulation> +inline Foam::label Foam::DelaunayMesh<Triangulation>::getNewVertexIndex() const +{ + label id = vertexCount_++; + + if (id == labelMax) + { + WarningIn + ( + "Foam::DelaunayMesh<Triangulation>::getNewVertexIndex() const" + ) << "Vertex counter has overflowed." << endl; + } + + return id; +} + + +template<class Triangulation> +inline Foam::label Foam::DelaunayMesh<Triangulation>::getNewCellIndex() const +{ + label id = cellCount_++; + + if (id == labelMax) + { + WarningIn + ( + "Foam::DelaunayMesh<Triangulation>::getNewCellIndex() const" + ) << "Cell counter has overflowed." << endl; + } + + return id; +} + + +template<class Triangulation> +Foam::label Foam::DelaunayMesh<Triangulation>::cellCount() const +{ + return cellCount_; +} + + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::resetCellCount() +{ + cellCount_ = 0; +} + + +template<class Triangulation> +Foam::label Foam::DelaunayMesh<Triangulation>::vertexCount() const +{ + return vertexCount_; +} + + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::resetVertexCount() +{ + vertexCount_ = 0; +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C new file mode 100644 index 0000000000000000000000000000000000000000..63a9889308ee3273e0b372f886edd6efd3e10d51 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshIO.C @@ -0,0 +1,391 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "DelaunayMesh.H" +#include "fvMesh.H" +#include "pointConversion.H" +#include "wallPolyPatch.H" +#include "processorPolyPatch.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::sortFaces +( + faceList& faces, + labelList& owner, + labelList& neighbour +) const +{ + // Upper triangular order: + // + owner is sorted in ascending cell order + // + within each block of equal value for owner, neighbour is sorted in + // ascending cell order. + // + faces sorted to correspond + // e.g. + // owner | neighbour + // 0 | 2 + // 0 | 23 + // 0 | 71 + // 1 | 23 + // 1 | 24 + // 1 | 91 + + List<labelPair> ownerNeighbourPair(owner.size()); + + forAll(ownerNeighbourPair, oNI) + { + ownerNeighbourPair[oNI] = labelPair(owner[oNI], neighbour[oNI]); + } + + Info<< nl + << "Sorting faces, owner and neighbour into upper triangular order" + << endl; + + labelList oldToNew; + + sortedOrder(ownerNeighbourPair, oldToNew); + + oldToNew = invert(oldToNew.size(), oldToNew); + + inplaceReorder(oldToNew, faces); + inplaceReorder(oldToNew, owner); + inplaceReorder(oldToNew, neighbour); +} + + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::addPatches +( + const label nInternalFaces, + faceList& faces, + labelList& owner, + labelList& patchSizes, + labelList& patchStarts, + const List<DynamicList<face> >& patchFaces, + const List<DynamicList<label> >& patchOwners +) const +{ + label nPatches = patchFaces.size(); + + patchSizes.setSize(nPatches, -1); + patchStarts.setSize(nPatches, -1); + + label nBoundaryFaces = 0; + + forAll(patchFaces, p) + { + patchSizes[p] = patchFaces[p].size(); + patchStarts[p] = nInternalFaces + nBoundaryFaces; + + nBoundaryFaces += patchSizes[p]; + } + + faces.setSize(nInternalFaces + nBoundaryFaces); + owner.setSize(nInternalFaces + nBoundaryFaces); + + label faceI = nInternalFaces; + + forAll(patchFaces, p) + { + forAll(patchFaces[p], f) + { + faces[faceI] = patchFaces[p][f]; + owner[faceI] = patchOwners[p][f]; + + faceI++; + } + } +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +template<class Triangulation> +void Foam::DelaunayMesh<Triangulation>::printInfo(Ostream& os) const +{ + PrintTable<word, label> triInfoTable("Mesh Statistics"); + + triInfoTable.add("Points", Triangulation::number_of_vertices()); + triInfoTable.add("Edges", Triangulation::number_of_finite_edges()); + triInfoTable.add("Faces", Triangulation::number_of_finite_facets()); + triInfoTable.add("Cells", Triangulation::number_of_finite_cells()); + + scalar minSize = GREAT; + scalar maxSize = 0; + + for + ( + Finite_vertices_iterator vit = Triangulation::finite_vertices_begin(); + vit != Triangulation::finite_vertices_end(); + ++vit + ) + { + if (!vit->farPoint()) + { + minSize = min(vit->targetCellSize(), minSize); + maxSize = max(vit->targetCellSize(), maxSize); + } + } + + Info<< incrIndent; + triInfoTable.print(Info, true, true); + + Info<< "Size (Min/Max) = " + << returnReduce(minSize, minOp<scalar>()) << " " + << returnReduce(maxSize, maxOp<scalar>()) << endl; + + Info<< decrIndent; +} + + +template<class Triangulation> +Foam::autoPtr<Foam::fvMesh> +Foam::DelaunayMesh<Triangulation>::createMesh +( + const fileName& name, + const Time& runTime, + labelList& vertexMap, + labelList& cellMap +) const +{ + pointField points(Triangulation::number_of_vertices()); + faceList faces(Triangulation::number_of_finite_facets()); + labelList owner(Triangulation::number_of_finite_facets()); + labelList neighbour(Triangulation::number_of_finite_facets()); + + wordList patchNames(1, "cvMesh_defaultPatch"); + wordList patchTypes(1, wallPolyPatch::typeName); + + labelList patchSizes(1, 0); + labelList patchStarts(1, 0); + + List<DynamicList<face> > patchFaces(1, DynamicList<face>()); + List<DynamicList<label> > patchOwners(1, DynamicList<label>()); + + vertexMap.setSize(Triangulation::number_of_vertices()); + cellMap.setSize(Triangulation::number_of_finite_cells()); + + // Calculate pts and a map of point index to location in pts. + label vertI = 0; + + for + ( + Finite_vertices_iterator vit = Triangulation::finite_vertices_begin(); + vit != Triangulation::finite_vertices_end(); + ++vit + ) + { + if (!vit->farPoint()) + { + vertexMap[vit->index()] = vertI; + points[vertI] = topoint(vit->point()); + vertI++; + } + } + + points.setSize(vertI); + + // Index the cells + label cellI = 0; + + for + ( + Finite_cells_iterator cit = Triangulation::finite_cells_begin(); + cit != Triangulation::finite_cells_end(); + ++cit + ) + { + if + ( + !cit->hasFarPoint() + && !Triangulation::is_infinite(cit) + ) + { + cellMap[cit->cellIndex()] = cellI++; + } + } + + label faceI = 0; + labelList verticesOnTriFace(3, -1); + face newFace(verticesOnTriFace); + + for + ( + Finite_facets_iterator fit = Triangulation::finite_facets_begin(); + fit != Triangulation::finite_facets_end(); + ++fit + ) + { + const Cell_handle c1(fit->first); + const int oppositeVertex = fit->second; + const Cell_handle c2(c1->neighbor(oppositeVertex)); + + label c1I = Cb::ctFar; + bool c1Real = false; + if (!c1->hasFarPoint() && !Triangulation::is_infinite(c1)) + { + c1I = cellMap[c1->cellIndex()]; + c1Real = true; + } + + label c2I = Cb::ctFar; + bool c2Real = false; + if (!c2->hasFarPoint() && !Triangulation::is_infinite(c2)) + { + c2I = cellMap[c2->cellIndex()]; + c2Real = true; + } + + if (!c1Real && !c2Real) + { + // Both tets are outside, skip + continue; + } + + label ownerCell = -1; + label neighbourCell = -1; + + for (label i = 0; i < 3; i++) + { + verticesOnTriFace[i] = vertexMap + [ + c1->vertex + ( + Triangulation::vertex_triple_index(oppositeVertex, i) + )->index() + ]; + } + + newFace = face(verticesOnTriFace); + + if (!c1Real || !c2Real) + { + // Boundary face... + if (!c1Real) + { + //... with c1 outside + ownerCell = c2I; + } + else + { + // ... with c2 outside + ownerCell = c1I; + + reverse(newFace); + } + + patchFaces[0].append(newFace); + patchOwners[0].append(ownerCell); + } + else + { + // Internal face... + if (c1I < c2I) + { + // ...with c1 as the ownerCell + ownerCell = c1I; + neighbourCell = c2I; + + reverse(newFace); + } + else + { + // ...with c2 as the ownerCell + ownerCell = c2I; + neighbourCell = c1I; + } + + faces[faceI] = newFace; + owner[faceI] = ownerCell; + neighbour[faceI] = neighbourCell; + faceI++; + } + } + + faces.setSize(faceI); + owner.setSize(faceI); + neighbour.setSize(faceI); + + sortFaces(faces, owner, neighbour); + + addPatches + ( + faceI, + faces, + owner, + patchSizes, + patchStarts, + patchFaces, + patchOwners + ); + + autoPtr<fvMesh> meshPtr + ( + new fvMesh + ( + IOobject + ( + name, + runTime.timeName(), + runTime, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + xferMove(points), + xferMove(faces), + xferMove(owner), + xferMove(neighbour) + ) + ); + + List<polyPatch*> patches(patchStarts.size()); + + label nValidPatches = 0; + + forAll(patches, p) + { + patches[nValidPatches] = polyPatch::New + ( + patchTypes[p], + patchNames[p], + patchSizes[p], + patchStarts[p], + nValidPatches, + meshPtr().boundaryMesh() + ).ptr(); + + nValidPatches++; + } + + patches.setSize(nValidPatches); + + meshPtr().addFvPatches(patches); + + return meshPtr; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C new file mode 100644 index 0000000000000000000000000000000000000000..b2ed781b8b389e32c165a9fc6cddfcb3d930dc1b --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.C @@ -0,0 +1,938 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "DistributedDelaunayMesh.H" +#include "meshSearch.H" +#include "mapDistribute.H" +#include "zeroGradientFvPatchFields.H" +#include "pointConversion.H" +#include "indexedVertexEnum.H" +#include "IOmanip.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + +template<class Triangulation> +Foam::autoPtr<Foam::mapDistribute> +Foam::DistributedDelaunayMesh<Triangulation>::buildMap +( + const List<label>& toProc +) +{ + // Determine send map + // ~~~~~~~~~~~~~~~~~~ + + // 1. Count + labelList nSend(Pstream::nProcs(), 0); + + forAll(toProc, i) + { + label procI = toProc[i]; + + nSend[procI]++; + } + + // Send over how many I need to receive + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + labelListList sendSizes(Pstream::nProcs()); + + sendSizes[Pstream::myProcNo()] = nSend; + + combineReduce(sendSizes, UPstream::listEq()); + + // 2. Size sendMap + labelListList sendMap(Pstream::nProcs()); + + forAll(nSend, procI) + { + sendMap[procI].setSize(nSend[procI]); + + nSend[procI] = 0; + } + + // 3. Fill sendMap + forAll(toProc, i) + { + label procI = toProc[i]; + + sendMap[procI][nSend[procI]++] = i; + } + + // Determine receive map + // ~~~~~~~~~~~~~~~~~~~~~ + + labelListList constructMap(Pstream::nProcs()); + + // Local transfers first + constructMap[Pstream::myProcNo()] = identity + ( + sendMap[Pstream::myProcNo()].size() + ); + + label constructSize = constructMap[Pstream::myProcNo()].size(); + + forAll(constructMap, procI) + { + if (procI != Pstream::myProcNo()) + { + label nRecv = sendSizes[procI][Pstream::myProcNo()]; + + constructMap[procI].setSize(nRecv); + + for (label i = 0; i < nRecv; i++) + { + constructMap[procI][i] = constructSize++; + } + } + } + + return autoPtr<mapDistribute> + ( + new mapDistribute + ( + constructSize, + sendMap.xfer(), + constructMap.xfer() + ) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Triangulation> +Foam::DistributedDelaunayMesh<Triangulation>::DistributedDelaunayMesh() +: + DelaunayMesh<Triangulation>(), + allBackgroundMeshBounds_() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Triangulation> +Foam::DistributedDelaunayMesh<Triangulation>::~DistributedDelaunayMesh() +{} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class Triangulation> +bool Foam::DistributedDelaunayMesh<Triangulation>::distributeBoundBoxes +( + const boundBox& bb +) +{ + allBackgroundMeshBounds_.reset(new List<boundBox>(Pstream::nProcs())); + + // Give the bounds of every processor to every other processor + allBackgroundMeshBounds_()[Pstream::myProcNo()] = bb; + + Pstream::gatherList(allBackgroundMeshBounds_()); + Pstream::scatterList(allBackgroundMeshBounds_()); + + return true; +} + + +template<class Triangulation> +bool Foam::DistributedDelaunayMesh<Triangulation>::isLocal +( + const Vertex_handle& v +) const +{ + return isLocal(v->procIndex()); +} + + +template<class Triangulation> +bool Foam::DistributedDelaunayMesh<Triangulation>::isLocal +( + const label localProcIndex +) const +{ + return localProcIndex == Pstream::myProcNo(); +} + + +template<class Triangulation> +Foam::labelList Foam::DistributedDelaunayMesh<Triangulation>::overlapProcessors +( + const point& centre, + const scalar radiusSqr +) const +{ + DynamicList<label> toProc(Pstream::nProcs()); + + forAll(allBackgroundMeshBounds_(), procI) + { + // Test against the bounding box of the processor + if + ( + !isLocal(procI) + && allBackgroundMeshBounds_()[procI].overlaps(centre, radiusSqr) + ) + { + toProc.append(procI); + } + } + + return toProc; +} + + +template<class Triangulation> +bool Foam::DistributedDelaunayMesh<Triangulation>::checkProcBoundaryCell +( + const Cell_handle& cit, + Map<labelList>& circumsphereOverlaps +) const +{ + const Foam::point& cc = cit->dual(); + + const scalar crSqr = magSqr + ( + cc - topoint(cit->vertex(0)->point()) + ); + + labelList circumsphereOverlap = overlapProcessors + ( + cc, + sqr(1.01)*crSqr + ); + + cit->cellIndex() = this->getNewCellIndex(); + + if (!circumsphereOverlap.empty()) + { + circumsphereOverlaps.insert(cit->cellIndex(), circumsphereOverlap); + + return true; + } + + return false; +} + + +template<class Triangulation> +void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells +( + Map<labelList>& circumsphereOverlaps +) const +{ + // Start by assuming that all the cells have no index + // If they do, they have already been visited so ignore them + + labelHashSet cellToCheck + ( + Triangulation::number_of_finite_cells() + /Pstream::nProcs() + ); + + for + ( + All_cells_iterator cit = Triangulation::all_cells_begin(); + cit != Triangulation::all_cells_end(); + ++cit + ) + { + if (Triangulation::is_infinite(cit)) + { + // Index of infinite vertex in this cell. + int i = cit->index(Triangulation::infinite_vertex()); + + Cell_handle c = cit->neighbor(i); + + if (c->unassigned()) + { + c->cellIndex() = this->getNewCellIndex(); + + if (checkProcBoundaryCell(c, circumsphereOverlaps)) + { + cellToCheck.insert(c->cellIndex()); + } + } + } + else if (cit->parallelDualVertex()) + { + if (cit->unassigned()) + { + if (checkProcBoundaryCell(cit, circumsphereOverlaps)) + { + cellToCheck.insert(cit->cellIndex()); + } + } + } + } + + for + ( + Finite_cells_iterator cit = Triangulation::finite_cells_begin(); + cit != Triangulation::finite_cells_end(); + ++cit + ) + { + if (cellToCheck.found(cit->cellIndex())) + { + // Get the neighbours and check them + for (label adjCellI = 0; adjCellI < 4; ++adjCellI) + { + Cell_handle citNeighbor = cit->neighbor(adjCellI); + + // Ignore if has far point or previously visited + if + ( + !citNeighbor->unassigned() + || !citNeighbor->internalOrBoundaryDualVertex() + || Triangulation::is_infinite(citNeighbor) + ) + { + continue; + } + + checkProcBoundaryCell + ( + citNeighbor, + circumsphereOverlaps + ); + } + } + } +} + + +template<class Triangulation> +void Foam::DistributedDelaunayMesh<Triangulation>::markVerticesToRefer +( + const Map<labelList>& circumsphereOverlaps, + PtrList<labelPairHashSet>& referralVertices, + DynamicList<label>& targetProcessor, + DynamicList<Vb>& parallelInfluenceVertices +) +{ + // Relying on the order of iteration of cells being the same as before + for + ( + Finite_cells_iterator cit = Triangulation::finite_cells_begin(); + cit != Triangulation::finite_cells_end(); + ++cit + ) + { + if (Triangulation::is_infinite(cit)) + { + continue; + } + + Map<labelList>::const_iterator iter = + circumsphereOverlaps.find(cit->cellIndex()); + + // Pre-tested circumsphere potential influence + if (iter != circumsphereOverlaps.cend()) + { + const labelList& citOverlaps = iter(); + + forAll(citOverlaps, cOI) + { + label procI = citOverlaps[cOI]; + + for (int i = 0; i < 4; i++) + { + Vertex_handle v = cit->vertex(i); + + if (v->farPoint()) + { + continue; + } + + label vProcIndex = v->procIndex(); + label vIndex = v->index(); + + const labelPair procIndexPair(vProcIndex, vIndex); + + // Using the hashSet to ensure that each vertex is only + // referred once to each processor. + // Do not refer a vertex to its own processor. + if (vProcIndex != procI) + { + if (referralVertices[procI].insert(procIndexPair)) + { + targetProcessor.append(procI); + + parallelInfluenceVertices.append + ( + Vb + ( + v->point(), + v->index(), + v->type(), + v->procIndex() + ) + ); + + parallelInfluenceVertices.last().targetCellSize() = + v->targetCellSize(); + parallelInfluenceVertices.last().alignment() = + v->alignment(); + } + } + } + } + } + } +} + + +template<class Triangulation> +Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices +( + const DynamicList<label>& targetProcessor, + DynamicList<Vb>& parallelVertices, + PtrList<labelPairHashSet>& referralVertices, + labelPairHashSet& receivedVertices +) +{ + DynamicList<Vb> referredVertices(targetProcessor.size()); + + const label preDistributionSize = parallelVertices.size(); + + mapDistribute pointMap = buildMap(targetProcessor); + + // Make a copy of the original list. + DynamicList<Vb> originalParallelVertices(parallelVertices); + + pointMap.distribute(parallelVertices); + + for (label procI = 0; procI < Pstream::nProcs(); procI++) + { + const labelList& constructMap = pointMap.constructMap()[procI]; + + if (constructMap.size()) + { + forAll(constructMap, i) + { + const Vb& v = parallelVertices[constructMap[i]]; + + if + ( + v.procIndex() != Pstream::myProcNo() + && !receivedVertices.found(labelPair(v.procIndex(), v.index())) + ) + { + referredVertices.append(v); + + receivedVertices.insert + ( + labelPair(v.procIndex(), v.index()) + ); + } + } + } + } + + label preInsertionSize = Triangulation::number_of_vertices(); + + labelPairHashSet pointsNotInserted = rangeInsertReferredWithInfo + ( + referredVertices.begin(), + referredVertices.end() + ); + + if (!pointsNotInserted.empty()) + { + for + ( + typename labelPairHashSet::const_iterator iter + = pointsNotInserted.begin(); + iter != pointsNotInserted.end(); + ++iter + ) + { + if (receivedVertices.found(iter.key())) + { + receivedVertices.erase(iter.key()); + } + } + } + + boolList pointInserted(parallelVertices.size(), true); + + forAll(parallelVertices, vI) + { + const labelPair procIndexI + ( + parallelVertices[vI].procIndex(), + parallelVertices[vI].index() + ); + + if (pointsNotInserted.found(procIndexI)) + { + pointInserted[vI] = false; + } + } + + pointMap.reverseDistribute(preDistributionSize, pointInserted); + + forAll(originalParallelVertices, vI) + { + const label procIndex = targetProcessor[vI]; + + if (!pointInserted[vI]) + { + if (referralVertices[procIndex].size()) + { + if + ( + !referralVertices[procIndex].unset + ( + labelPair + ( + originalParallelVertices[vI].procIndex(), + originalParallelVertices[vI].index() + ) + ) + ) + { + Pout<< "*** not found " + << originalParallelVertices[vI].procIndex() + << " " << originalParallelVertices[vI].index() << endl; + } + + } + } + } + + label postInsertionSize = Triangulation::number_of_vertices(); + + reduce(preInsertionSize, sumOp<label>()); + reduce(postInsertionSize, sumOp<label>()); + + label nTotalToInsert = referredVertices.size(); + + reduce(nTotalToInsert, sumOp<label>()); + + if (preInsertionSize + nTotalToInsert != postInsertionSize) + { + label nNotInserted = + returnReduce(pointsNotInserted.size(), sumOp<label>()); + + Info<< " Inserted = " + << setw(name(label(Triangulation::number_of_finite_cells())).size()) + << nTotalToInsert - nNotInserted + << " / " << nTotalToInsert << endl; + + nTotalToInsert -= nNotInserted; + } + else + { + Info<< " Inserted = " << nTotalToInsert << endl; + } + + return nTotalToInsert; +} + + +template<class Triangulation> +void Foam::DistributedDelaunayMesh<Triangulation>::sync +( + const boundBox& bb, + PtrList<labelPairHashSet>& referralVertices, + labelPairHashSet& receivedVertices, + bool iterateReferral +) +{ + if (!Pstream::parRun()) + { + return; + } + + if (allBackgroundMeshBounds_.empty()) + { + distributeBoundBoxes(bb); + } + + label nVerts = Triangulation::number_of_vertices(); + label nCells = Triangulation::number_of_finite_cells(); + + DynamicList<Vb> parallelInfluenceVertices(0.1*nVerts); + DynamicList<label> targetProcessor(0.1*nVerts); + + // Some of these values will not be used, i.e. for non-real cells + DynamicList<Foam::point> circumcentre(0.1*nVerts); + DynamicList<scalar> circumradiusSqr(0.1*nVerts); + + Map<labelList> circumsphereOverlaps(nCells); + + findProcessorBoundaryCells(circumsphereOverlaps); + + Info<< " Influences = " + << setw(name(nCells).size()) + << returnReduce(circumsphereOverlaps.size(), sumOp<label>()) << " / " + << returnReduce(nCells, sumOp<label>()); + + markVerticesToRefer + ( + circumsphereOverlaps, + referralVertices, + targetProcessor, + parallelInfluenceVertices + ); + + referVertices + ( + targetProcessor, + parallelInfluenceVertices, + referralVertices, + receivedVertices + ); + + if (iterateReferral) + { + label oldNReferred = 0; + label nIterations = 1; + + Info<< incrIndent << indent + << "Iteratively referring referred vertices..." + << endl; + do + { + Info<< indent << "Iteration " << nIterations++ << ":"; + + circumsphereOverlaps.clear(); + targetProcessor.clear(); + parallelInfluenceVertices.clear(); + + findProcessorBoundaryCells(circumsphereOverlaps); + + nCells = Triangulation::number_of_finite_cells(); + + Info<< " Influences = " + << setw(name(nCells).size()) + << returnReduce(circumsphereOverlaps.size(), sumOp<label>()) + << " / " + << returnReduce(nCells, sumOp<label>()); + + markVerticesToRefer + ( + circumsphereOverlaps, + referralVertices, + targetProcessor, + parallelInfluenceVertices + ); + + label nReferred = referVertices + ( + targetProcessor, + parallelInfluenceVertices, + referralVertices, + receivedVertices + ); + + if (nReferred == 0 || nReferred == oldNReferred) + { + break; + } + + oldNReferred = nReferred; + + } while (true); + + Info<< decrIndent; + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template<class Triangulation> +bool Foam::DistributedDelaunayMesh<Triangulation>::distribute +( + const boundBox& bb +) +{ + notImplemented + ( + "Foam::DistributedDelaunayMesh<Triangulation>::distribute" + "(" + " const boundBox& bb" + ")" + ); + + if (!Pstream::parRun()) + { + return false; + } + + distributeBoundBoxes(bb); + + return true; +} + + +template<class Triangulation> +Foam::autoPtr<Foam::mapDistribute> +Foam::DistributedDelaunayMesh<Triangulation>::distribute +( + const backgroundMeshDecomposition& decomposition +) +{ + if (!Pstream::parRun()) + { + return autoPtr<mapDistribute>(); + } + + distributeBoundBoxes(decomposition.procBounds()); + + DynamicList<point> points(Triangulation::number_of_vertices()); + + for + ( + Finite_vertices_iterator vit = Triangulation::finite_vertices_begin(); + vit != Triangulation::finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + points.append(topoint(vit->point())); + } + } + + autoPtr<mapDistribute> mapDist = decomposition.distributePoints(points); + + return mapDist; +} + + +template<class Triangulation> +void Foam::DistributedDelaunayMesh<Triangulation>::sync(const boundBox& bb) +{ + if (!Pstream::parRun()) + { + return; + } + + if (allBackgroundMeshBounds_.empty()) + { + distributeBoundBoxes(bb); + } + + const label nApproxReferred = + Triangulation::number_of_vertices() + /Pstream::nProcs(); + + PtrList<labelPairHashSet> referralVertices(Pstream::nProcs()); + forAll(referralVertices, procI) + { + if (!isLocal(procI)) + { + referralVertices.set(procI, new labelPairHashSet(nApproxReferred)); + } + } + + labelPairHashSet receivedVertices(nApproxReferred); + + sync + ( + bb, + referralVertices, + receivedVertices, + true + ); +} + + +template<class Triangulation> +template<class PointIterator> +typename Foam::DistributedDelaunayMesh<Triangulation>::labelPairHashSet +Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo +( + PointIterator begin, + PointIterator end, + bool printErrors +) +{ + const boundBox& bb = allBackgroundMeshBounds_()[Pstream::myProcNo()]; + + typedef DynamicList + < + std::pair<scalar, label> + > vectorPairPointIndex; + + vectorPairPointIndex pointsBbDistSqr; + + label count = 0; + for (PointIterator it = begin; it != end; ++it) + { + const Foam::point samplePoint(topoint(it->point())); + + scalar distFromBbSqr = 0; + + if (!bb.contains(samplePoint)) + { + const Foam::point nearestPoint = bb.nearest(samplePoint); + + distFromBbSqr = magSqr(nearestPoint - samplePoint); + } + + pointsBbDistSqr.append + ( + std::make_pair(distFromBbSqr, count++) + ); + } + + std::random_shuffle(pointsBbDistSqr.begin(), pointsBbDistSqr.end()); + + // Sort in ascending order by the distance of the point from the centre + // of the processor bounding box + sort(pointsBbDistSqr.begin(), pointsBbDistSqr.end()); + + typename Triangulation::Vertex_handle hint; + + typename Triangulation::Locate_type lt; + int li, lj; + + label nNotInserted = 0; + + labelPairHashSet uninserted + ( + Triangulation::number_of_vertices() + /Pstream::nProcs() + ); + + for + ( + typename vectorPairPointIndex::const_iterator p = + pointsBbDistSqr.begin(); + p != pointsBbDistSqr.end(); + ++p + ) + { + const size_t checkInsertion = Triangulation::number_of_vertices(); + + const Vb& vert = *(begin + p->second); + const Point& pointToInsert = vert.point(); + + // Locate the point + Cell_handle c = Triangulation::locate(pointToInsert, lt, li, lj, hint); + + if (lt == Triangulation::VERTEX) + { + if (printErrors) + { + Vertex_handle nearV = + Triangulation::nearest_vertex(pointToInsert); + + Pout<< "Failed insertion, point already exists" << nl + << "Failed insertion : " << vert.info() + << " nearest : " << nearV->info(); + } + + uninserted.insert(labelPair(vert.procIndex(), vert.index())); + nNotInserted++; + + continue; + } + + // Get the cells that conflict with p in a vector V, + // and a facet on the boundary of this hole in f. + std::vector<Cell_handle> V; + typename Triangulation::Facet f; + + Triangulation::find_conflicts + ( + pointToInsert, + c, + CGAL::Oneset_iterator<typename Triangulation::Facet>(f), + std::back_inserter(V) + ); + + bool insert = false; + for (size_t i = 0; i < V.size(); ++i) + { + if (V[i]->real() || V[i]->hasFarPoint()) + { + insert = true; + break; + } + } + + if (insert) + { + hint = Triangulation::insert_in_hole + ( + pointToInsert, + V.begin(), + V.end(), + f.first, + f.second + ); + + if (checkInsertion != Triangulation::number_of_vertices() - 1) + { + if (printErrors) + { + Vertex_handle nearV = + Triangulation::nearest_vertex(pointToInsert); + + Pout<< "Failed insertion : " << vert.info() + << " nearest : " << nearV->info(); + } + } + else + { + hint->index() = vert.index(); + hint->type() = vert.type(); + hint->procIndex() = vert.procIndex(); + hint->targetCellSize() = vert.targetCellSize(); + hint->alignment() = vert.alignment(); + } + } + else + { + uninserted.insert(labelPair(vert.procIndex(), vert.index())); + nNotInserted++; + } + } + + return uninserted; +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..124f4b39dc1558721662de315c51d50e33584256 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/DelaunayMesh/DistributedDelaunayMesh.H @@ -0,0 +1,207 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::DistributedDelaunayMesh + +Description + +SourceFiles + DistributedDelaunayMeshI.H + DistributedDelaunayMesh.C + DistributedDelaunayMeshIO.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DistributedDelaunayMesh_H +#define DistributedDelaunayMesh_H + +#include "DelaunayMesh.H" +#include "backgroundMeshDecomposition.H" +#include "autoPtr.H" +#include "boundBox.H" +#include "indexedVertex.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapDistribute; + +/*---------------------------------------------------------------------------*\ + Class DistributedDelaunayMesh Declaration +\*---------------------------------------------------------------------------*/ + +template<class Triangulation> +class DistributedDelaunayMesh +: + public DelaunayMesh<Triangulation> +{ +public: + + typedef typename Triangulation::Vertex_handle Vertex_handle; + typedef typename Triangulation::Cell_handle Cell_handle; + typedef typename Triangulation::Point Point; + + typedef typename Triangulation::Finite_vertices_iterator + Finite_vertices_iterator; + typedef typename Triangulation::Finite_cells_iterator + Finite_cells_iterator; + typedef typename Triangulation::All_cells_iterator + All_cells_iterator; + + typedef typename DelaunayMesh<Triangulation>::labelPairHashSet + labelPairHashSet; + + +private: + + autoPtr<List<boundBox> > allBackgroundMeshBounds_; + + + // Private Member Functions + + //- + bool distributeBoundBoxes(const boundBox& bb); + + //- + bool isLocal(const Vertex_handle& v) const; + + bool isLocal(const label localProcIndex) const; + + labelList overlapProcessors + ( + const point& centre, + const scalar radiusSqr + ) const; + + bool checkProcBoundaryCell + ( + const Cell_handle& cit, + Map<labelList>& circumsphereOverlaps + ) const; + + void findProcessorBoundaryCells + ( + Map<labelList>& circumsphereOverlaps + ) const; + + void markVerticesToRefer + ( + const Map<labelList>& circumsphereOverlaps, + PtrList<labelPairHashSet>& referralVertices, + DynamicList<label>& targetProcessor, + DynamicList<Vb>& parallelInfluenceVertices + ); + + label referVertices + ( + const DynamicList<label>& targetProcessor, + DynamicList<Vb>& parallelVertices, + PtrList<labelPairHashSet>& referralVertices, + labelPairHashSet& receivedVertices + ); + + //- Disallow default bitwise copy construct + DistributedDelaunayMesh(const DistributedDelaunayMesh<Triangulation>&); + + //- Disallow default bitwise assignment + void operator=(const DistributedDelaunayMesh<Triangulation>&); + + +public: + + // Constructors + + //- Construct from components + DistributedDelaunayMesh(); + + + //- Destructor + ~DistributedDelaunayMesh(); + + + // Member Functions + + //- Build a mapDistribute for the supplied destination processor data + static autoPtr<mapDistribute> buildMap(const List<label>& toProc); + + //- + bool distribute(const boundBox& bb); + + autoPtr<mapDistribute> distribute + ( + const backgroundMeshDecomposition& decomposition + ); + + //- Refer vertices so that the processor interfaces are consistent + void sync(const boundBox& bb); + + //- Refer vertices so that the processor interfaces are consistent + void sync + ( + const boundBox& bb, + PtrList<labelPairHashSet>& referralVertices, + labelPairHashSet& receivedVertices, + bool iterateReferral = true + ); + + //- Inserts points into the triangulation if the point is within + // the circumsphere of another cell + template<class PointIterator> + labelPairHashSet rangeInsertReferredWithInfo + ( + PointIterator begin, + PointIterator end, + bool printErrors = true + ); + +// distributeField(); + + + // Queries + + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//#include "DistributedDelaunayMeshI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "DistributedDelaunayMesh.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files index 3974c7df757b19c9230a6a904fcc6760435e3ad5..c6e553f64c32b3e7a61d3b26908ecfa3a9e35172 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/files @@ -1,5 +1,8 @@ #include CGAL_FILES +conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C +conformalVoronoiMesh/indexedCell/indexedCellEnum.C + conformalVoronoiMesh/conformalVoronoiMesh.C conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -13,7 +16,20 @@ conformationSurfaces/conformationSurfaces.C backgroundMeshDecomposition/backgroundMeshDecomposition.C -cellSizeControlSurfaces/cellSizeControlSurfaces.C +cellShapeControl/cellShapeControl/cellShapeControl.C + +cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C + +cellSizeAndAlignmentControl = cellShapeControl/cellSizeAndAlignmentControl +$(cellSizeAndAlignmentControl)/cellSizeAndAlignmentControls.C +$(cellSizeAndAlignmentControl)/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.C +$(cellSizeAndAlignmentControl)/fileControl/fileControl.C +$(cellSizeAndAlignmentControl)/searchableSurfaceControl/searchableSurfaceControl.C +/*cellShapeControl/pQuadCoorControl/pQuadCoorControl.C*/ + +cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C + +/*cellSizeControlSurfaces/cellSizeControlSurfaces.C*/ cellSizeFunctions = cellSizeControlSurfaces/cellSizeFunction $(cellSizeFunctions)/cellSizeFunction/cellSizeFunction.C diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options index 97e045f30502c9dc417b7d110e9492f03d29b289..03ee51a4f6366bfdaee9196edb37451f69cfd8b4 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/Make/options @@ -2,7 +2,7 @@ EXE_DEBUG = -DFULLDEBUG -g -O0 EXE_FROUNDING_MATH = -frounding-math EXE_NDEBUG = -DNDEBUG -CGAL_EXACT = +CGAL_EXACT = /*-DCGAL_DONT_USE_LAZY_KERNEL*/ CGAL_INEXACT = -DCGAL_INEXACT include $(GENERAL_RULES)/CGAL @@ -17,12 +17,17 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -IPrintTable \ -I../vectorTools -EXE_LIBS = \ +LIB_LIBS = \ -lmeshTools \ -ledgeMesh \ + -lfileFormats \ -ltriSurface \ - -ldynamicMesh + -ldynamicMesh \ + -lsampling diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTable.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTable.C new file mode 100644 index 0000000000000000000000000000000000000000..ee46bff366915e8ca6ef163b62dcd6629b446b52 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTable.C @@ -0,0 +1,241 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "PrintTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class KeyType, class DataType> +Foam::PrintTable<KeyType, DataType>::PrintTable() +: + table_(), + title_(string::null) +{} + + +template<class KeyType, class DataType> +Foam::PrintTable<KeyType, DataType>::PrintTable(const string& title) +: + table_(), + title_(title) +{} + + +template<class KeyType, class DataType> +Foam::PrintTable<KeyType, DataType>::PrintTable +( + const PrintTable<KeyType, DataType>& table +) +: + table_(table.table_), + title_(table.title_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class KeyType, class DataType> +Foam::PrintTable<KeyType, DataType>::~PrintTable() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template<class KeyType, class DataType> +void Foam::PrintTable<KeyType, DataType>::print +( + Ostream& os, + const bool printSum, + const bool printAverage +) const +{ + HashTable<HashTable<DataType, label>, KeyType> combinedTable; + + List<HashTable<DataType, KeyType> > procData + ( + Pstream::nProcs(), + HashTable<DataType, KeyType>() + ); + + procData[Pstream::myProcNo()] = table_; + + Pstream::gatherList(procData); + + if (Pstream::master()) + { + label largestKeyLength = 6; + label largestDataLength = 0; + + List<label> largestProcSize(Pstream::nProcs(), 0); + + forAll(procData, procI) + { + const HashTable<DataType, KeyType>& procIData + = procData[procI]; + + for + ( + typename HashTable<DataType, KeyType> + ::const_iterator iter = procIData.begin(); + iter != procIData.end(); + ++iter + ) + { + if (!combinedTable.found(iter.key())) + { + combinedTable.insert + ( + iter.key(), + HashTable<DataType, label>() + ); + } + + HashTable<DataType, label>& key + = combinedTable[iter.key()]; + + key.insert(procI, iter()); + + for + ( + typename HashTable<DataType, label> + ::const_iterator dataIter = key.begin(); + dataIter != key.end(); + ++dataIter + ) + { + std::ostringstream buf; + buf << dataIter(); + + largestDataLength = max + ( + largestDataLength, + label(buf.str().length()) + ); + } + + std::ostringstream buf; + buf << iter.key(); + + largestKeyLength = max + ( + largestKeyLength, + label(buf.str().length()) + ); + } + } + + os.width(largestKeyLength); + os << nl << indent << tab << title_.c_str() << endl; + + os.width(largestKeyLength); + os << indent << "Proc #"; + forAll(procData, procI) + { + os << tab; + os.width(largestDataLength); + os << procI; + } + + if (printSum) + { + os << tab; + os.width(largestDataLength); + os << "Sum"; + } + + if (printAverage) + { + os << tab; + os.width(largestDataLength); + os << "Average"; + } + + os << endl; + + const List<KeyType>& sortedTable = combinedTable.sortedToc(); + + forAll(sortedTable, keyI) + { + const HashTable<DataType, label>& procDataList + = combinedTable[sortedTable[keyI]]; + + os.width(largestKeyLength); + os << indent << sortedTable[keyI]; + + forAll(procDataList, elemI) + { + os << tab; + os.width(largestDataLength); + os << procDataList[elemI]; + } + + if (printSum) + { + DataType sum = 0; + forAll(procDataList, elemI) + { + sum += procDataList[elemI]; + } + + os << tab; + os.width(largestDataLength); + os << sum; + + if (printAverage) + { + os << tab; + os.width(largestDataLength); + os << sum/Pstream::nProcs(); + } + } + + os << endl; + } + } +} + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + +template<class KeyType, class DataType> +void Foam::PrintTable<KeyType, DataType>::operator= +( + const PrintTable<KeyType, DataType>& rhs +) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn + ( + "Foam::PrintTable<KeyType, DataType>::operator=" + "(const Foam::PrintTable<KeyType, DataType>&)" + ) << "Attempted assignment to self" + << abort(FatalError); + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTable.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTable.H new file mode 100644 index 0000000000000000000000000000000000000000..7f9ed788713b3860c02721e89e8bf0d5cd4360a1 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTable.H @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::PrintTable + +Description + Print a table in parallel, e.g.; + + \verbatim + Vertex Type Information + Proc # 0 1 2 3 + Total 145680 145278 145751 145359 + Unassigned 0 0 0 0 + nExternalFeatureEdge 883 829 828 960 + nExternalFeaturePoint 8 10 10 12 + nExternalSurface 9533 9488 9502 9482 + nFar 0 0 0 0 + nInternal 125494 125198 125642 125174 + nInternalFeatureEdge 238 241 241 240 + nInternalFeaturePoint 2 2 2 2 + nInternalNearBoundary 0 0 0 0 + nInternalSurface 9522 9510 9526 9489 + nReferred 7545 7497 7500 7587 + \endverbatim + +SourceFiles + PrintTableI.H + PrintTable.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PrintTable_H +#define PrintTable_H + +#include "HashTable.H" +#include "Ostream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PrintTable Declaration +\*---------------------------------------------------------------------------*/ + +template<class KeyType, class DataType> +class PrintTable +{ + // Private data + + //- Hash table holding the data + HashTable<DataType, KeyType> table_; + + //- Title of the table + string title_; + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const PrintTable<KeyType, DataType>&); + + +public: + + // Constructors + + //- Null constructor + PrintTable(); + + //- Construct with a title + explicit PrintTable(const string& title); + + //- Copy constructor + PrintTable(const PrintTable<KeyType, DataType>& table); + + + //- Destructor + ~PrintTable(); + + + // Member Functions + + //- Add an entry (D) to the given key(K) + void add(const KeyType& K, const DataType& D); + + //- Print the table + void print + ( + Ostream& os, + const bool printSum = false, + const bool printAverage = false + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "PrintTableI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "PrintTable.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTableI.H similarity index 71% rename from applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.C rename to applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTableI.H index df7c4dccb82ba97e9bac4344e6a833044105e01a..6c093bc13a2d8ea6e05fa53cc452403950a65743 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/PrintTable/PrintTableI.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,25 +23,20 @@ License \*---------------------------------------------------------------------------*/ -#include "SetPatchFields.H" +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // - -template<class GeoField> -void Foam::SetPatchFields +template<class KeyType, class DataType> +void Foam::PrintTable<KeyType, DataType>::add ( - PtrList<GeoField>& fields, - const label patchI, - const typename GeoField::value_type& initVal + const KeyType& K, + const DataType& D ) { - forAll(fields, i) - { - typename GeoField::PatchFieldType& pfld = - fields[i].boundaryField()[patchI]; - pfld == initVal; - } + table_.set(K, D); } +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index cf7a1eb9021fd476ba2c4589b51ac07963cbc4e6..7f60b96200013c5a9e228c3f5672ead92ebb9ca0 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -25,6 +25,10 @@ License #include "backgroundMeshDecomposition.H" #include "meshSearch.H" +#include "conformationSurfaces.H" +#include "zeroGradientFvPatchFields.H" +#include "Time.H" +#include "Random.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -377,7 +381,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement() if (oldCellI == -1) { newVolumeStatus[newCellI] = - searchableSurface::UNKNOWN;; + searchableSurface::UNKNOWN; } else { @@ -413,8 +417,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement() fvMeshDistribute distributor(mesh_, mergeDist_); - autoPtr<mapDistributePolyMesh> mapDist = - distributor.distribute(newDecomp); + autoPtr<mapDistributePolyMesh> mapDist = distributor.distribute + ( + newDecomp + ); meshCutter_.distribute(mapDist); @@ -527,87 +533,87 @@ bool Foam::backgroundMeshDecomposition::refineCell if (volType == searchableSurface::MIXED) { - // Assess the cell size at the nearest point on the surface for the - // MIXED cells, if the cell is large with respect to the cell size, - // then refine it. - - pointField samplePoints - ( - volRes_*volRes_*volRes_, - vector::zero - ); - - // scalar sampleVol = cellBb.volume()/samplePoints.size(); - - vector delta = cellBb.span()/volRes_; - - label pI = 0; - - for (label i = 0; i < volRes_; i++) - { - for (label j = 0; j < volRes_; j++) - { - for (label k = 0; k < volRes_; k++) - { - samplePoints[pI++] = - cellBb.min() - + vector - ( - delta.x()*(i + 0.5), - delta.y()*(j + 0.5), - delta.z()*(k + 0.5) - ); - } - } - } - - List<pointIndexHit> hitInfo; - labelList hitSurfaces; - - geometry.findSurfaceNearest - ( - samplePoints, - scalarField(samplePoints.size(), sqr(GREAT)), - hitInfo, - hitSurfaces - ); - - // weightEstimate = 0.0; - - scalar minCellSize = GREAT; - - forAll(samplePoints, i) - { - scalar s = cellSizeControl_.cellSize - ( - hitInfo[i].hitPoint() - ); - - // Info<< "cellBb.midpoint() " << cellBb.midpoint() << nl - // << samplePoints[i] << nl - // << hitInfo[i] << nl - // << "cellBb.span() " << cellBb.span() << nl - // << "cellBb.mag() " << cellBb.mag() << nl - // << s << endl; - - if (s < minCellSize) - { - minCellSize = max(s, minCellSizeLimit_); - } - - // Estimate the number of points in the cell by the surface size, - // this is likely to be too small, so reduce. - // weightEstimate += sampleVol/pow3(s); - } - - if (sqr(spanScale_)*sqr(minCellSize) < magSqr(cellBb.span())) - { - return true; - } +// // Assess the cell size at the nearest point on the surface for the +// // MIXED cells, if the cell is large with respect to the cell size, +// // then refine it. +// +// pointField samplePoints +// ( +// volRes_*volRes_*volRes_, +// vector::zero +// ); +// +// // scalar sampleVol = cellBb.volume()/samplePoints.size(); +// +// vector delta = cellBb.span()/volRes_; +// +// label pI = 0; +// +// for (label i = 0; i < volRes_; i++) +// { +// for (label j = 0; j < volRes_; j++) +// { +// for (label k = 0; k < volRes_; k++) +// { +// samplePoints[pI++] = +// cellBb.min() +// + vector +// ( +// delta.x()*(i + 0.5), +// delta.y()*(j + 0.5), +// delta.z()*(k + 0.5) +// ); +// } +// } +// } +// +// List<pointIndexHit> hitInfo; +// labelList hitSurfaces; +// +// geometry.findSurfaceNearest +// ( +// samplePoints, +// scalarField(samplePoints.size(), sqr(GREAT)), +// hitInfo, +// hitSurfaces +// ); +// +// // weightEstimate = 0.0; +// +// scalar minCellSize = GREAT; +// +// forAll(samplePoints, i) +// { +// scalar s = cellShapeControl_.cellSize +// ( +// hitInfo[i].hitPoint() +// ); +// +// // Info<< "cellBb.midpoint() " << cellBb.midpoint() << nl +// // << samplePoints[i] << nl +// // << hitInfo[i] << nl +// // << "cellBb.span() " << cellBb.span() << nl +// // << "cellBb.mag() " << cellBb.mag() << nl +// // << s << endl; +// +// if (s < minCellSize) +// { +// minCellSize = max(s, minCellSizeLimit_); +// } +// +// // Estimate the number of points in the cell by the surface size, +// // this is likely to be too small, so reduce. +// // weightEstimate += sampleVol/pow3(s); +// } +// +// if (sqr(spanScale_)*sqr(minCellSize) < magSqr(cellBb.span())) +// { +// return true; +// } } else if (volType == searchableSurface::INSIDE) { - // scalar s = cvMesh_.cellSizeControl().cellSize(cellBb.midpoint()); + // scalar s = cvMesh_.cellShapeControl_.cellSize(cellBb.midpoint()); // Estimate the number of points in the cell by the size at the cell // midpoint @@ -724,9 +730,7 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree() globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax); - octreeNearestDistances_ = bFTreePtr_().calcNearestDistance(); - - if (cvMeshControls_.objOutput()) + if (false) { OFstream fStr ( @@ -773,15 +777,15 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree() Foam::backgroundMeshDecomposition::backgroundMeshDecomposition ( - const dictionary& coeffsDict, - const conformalVoronoiMesh& cvMesh + const Time& runTime, + Random& rndGen, + const conformationSurfaces& geometryToConformTo, + const dictionary& coeffsDict ) : - runTime_(cvMesh.time()), - geometryToConformTo_(cvMesh.geometryToConformTo()), - cellSizeControl_(cvMesh.cellSizeControl()), - rndGen_(cvMesh.rndGen()), - cvMeshControls_(cvMesh.cvMeshControls()), + runTime_(runTime), + geometryToConformTo_(geometryToConformTo), + rndGen_(rndGen), mesh_ ( IOobject @@ -800,7 +804,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition ), boundaryFacesPtr_(), bFTreePtr_(), - octreeNearestDistances_(), allBackgroundMeshBounds_(Pstream::nProcs()), globalBackgroundBounds_(), decomposeDict_ @@ -857,74 +860,6 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition } -Foam::backgroundMeshDecomposition::backgroundMeshDecomposition -( - const scalar spanScale, - const scalar minCellSizeLimit, - const label minLevels, - const label volRes, - const scalar maxCellWeightCoeff, - - const Time& runTime, - const conformationSurfaces& geometryToConformTo, - const cellSizeControlSurfaces& cellSizeControl, - Random& rndGen, - const cvControls& cvMeshControls -) -: - runTime_(runTime), - geometryToConformTo_(geometryToConformTo), - cellSizeControl_(cellSizeControl), - rndGen_(rndGen), - cvMeshControls_(cvMeshControls), - mesh_ - ( - IOobject - ( - fvMesh::defaultRegion, - runTime_.timeName(), - runTime_, - IOobject::MUST_READ - ) - ), - meshCutter_ - ( - mesh_, - labelList(mesh_.nCells(), 0), - labelList(mesh_.nPoints(), 0) - ), - boundaryFacesPtr_(), - bFTreePtr_(), - octreeNearestDistances_(), - allBackgroundMeshBounds_(Pstream::nProcs()), - globalBackgroundBounds_(), - decomposeDict_ - ( - IOobject - ( - "decomposeParDict", - runTime_.system(), - runTime_, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ), - decomposerPtr_(decompositionMethod::New(decomposeDict_)), - mergeDist_(1e-6*mesh_.bounds().mag()), - spanScale_(spanScale), - minCellSizeLimit_(minCellSizeLimit), - minLevels_(minLevels), - volRes_(volRes), - maxCellWeightCoeff_(maxCellWeightCoeff) -{ - // Stand-alone operation - - Info<< nl << "Building initial background mesh decomposition" << endl; - - initialRefinement(); -} - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition() @@ -936,10 +871,7 @@ Foam::backgroundMeshDecomposition::~backgroundMeshDecomposition() Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::backgroundMeshDecomposition::distribute ( - volScalarField& cellWeights, - List<DynamicList<point> >& cellVertices, - List<DynamicList<label> >& cellVertexIndices, - List<DynamicList<label> >& cellVertexTypes + volScalarField& cellWeights ) { if (debug) @@ -982,10 +914,8 @@ Foam::backgroundMeshDecomposition::distribute { Info<< " cellWeightLimit " << cellWeightLimit << endl; - Pout<< " sum(cellWeights) " - << sum(cellWeights.internalField()) - << " max(cellWeights) " - << max(cellWeights.internalField()) + Pout<< " sum(cellWeights) " << sum(cellWeights.internalField()) + << " max(cellWeights) " << max(cellWeights.internalField()) << endl; } @@ -1049,94 +979,6 @@ Foam::backgroundMeshDecomposition::distribute // Update numbering of cells/vertices. meshCutter_.updateMesh(map); - { - // Map cellVertices, cellVertexIndices and cellVertexTypes - - meshSearch cellSearch(mesh_, polyMesh::FACEPLANES); - - const labelList& reverseCellMap = map().reverseCellMap(); - - List<DynamicList<point> > newCellVertices(mesh_.nCells()); - List<DynamicList<label> > newCellVertexIndices(mesh_.nCells()); - List<DynamicList<label> > newCellVertexTypes(mesh_.nCells()); - - forAll(cellVertices, oldCellI) - { - DynamicList<point>& oldCellVertices = - cellVertices[oldCellI]; - - DynamicList<label>& oldCellVertexIndices = - cellVertexIndices[oldCellI]; - - DynamicList<label>& oldCellVertexTypes = - cellVertexTypes[oldCellI]; - - if (findIndex(newCellsToRefine, oldCellI) >= 0) - { - // This old cell was refined so the cell for the vertices - // in the new mesh needs to be searched for. - - forAll(oldCellVertices, oPI) - { - const point& v = oldCellVertices[oPI]; - - label newCellI = cellSearch.findCell(v); - - if (newCellI == -1) - { - // Pout<< "findCell backgroundMeshDecomposition " - // << v << " " - // << oldCellI - // << newCellI - // << " find nearest cellI "; - - newCellI = cellSearch.findNearestCell(v); - - // Pout<< newCellI << endl; - } - - newCellVertices[newCellI].append(v); - - newCellVertexIndices[newCellI].append - ( - oldCellVertexIndices[oPI] - ); - - newCellVertexTypes[newCellI].append - ( - oldCellVertexTypes[oPI] - ); - } - } - else - { - label newCellI = reverseCellMap[oldCellI]; - - forAll(oldCellVertices, oPI) - { - newCellVertices[newCellI].append - ( - oldCellVertices[oPI] - ); - - newCellVertexIndices[newCellI].append - ( - oldCellVertexIndices[oPI] - ); - - newCellVertexTypes[newCellI].append - ( - oldCellVertexTypes[oPI] - ); - } - } - } - - cellVertices.transfer(newCellVertices); - cellVertexIndices.transfer(newCellVertexIndices); - cellVertexTypes.transfer(newCellVertexTypes); - } - Info<< " Background mesh refined from " << returnReduce(map().nOldCells(), sumOp<label>()) << " to " << mesh_.globalData().nTotalCells() @@ -1193,10 +1035,6 @@ Foam::backgroundMeshDecomposition::distribute cellWeights.write(); } - mapDist().distributeCellData(cellVertices); - mapDist().distributeCellData(cellVertexIndices); - mapDist().distributeCellData(cellVertexTypes); - buildPatchAndTree(); return mapDist; @@ -1227,8 +1065,10 @@ bool Foam::backgroundMeshDecomposition::positionOnThisProcessor // return bFTreePtr_().findAnyOverlap(pt, 0.0); return + ( bFTreePtr_().getVolumeType(pt) - == indexedOctree<treeDataBPatch>::INSIDE; + == indexedOctree<treeDataBPatch>::INSIDE + ); } @@ -1247,6 +1087,7 @@ Foam::boolList Foam::backgroundMeshDecomposition::positionOnThisProcessor return posProc; } + bool Foam::backgroundMeshDecomposition::overlapsThisProcessor ( const treeBoundBox& box @@ -1660,110 +1501,304 @@ Foam::backgroundMeshDecomposition::intersectsProcessors } -Foam::labelListList Foam::backgroundMeshDecomposition::overlapsProcessors +bool Foam::backgroundMeshDecomposition::overlapsOtherProcessors ( - const List<point>& centres, - const List<scalar>& radiusSqrs, - bool includeOwnProcessor + const point& centre, + const scalar& radiusSqr ) const { - DynamicList<label> toCandidateProc; - DynamicList<point> testCentres; - DynamicList<scalar> testRadiusSqrs; - labelList sphereBlockStart(centres.size(), -1); - labelList sphereBlockSize(centres.size(), -1); - - label nTotalCandidates = 0; - - forAll(centres, sI) + forAll(allBackgroundMeshBounds_, procI) { - const point& c = centres[sI]; - scalar rSqr = radiusSqrs[sI]; - - label nCandidates = 0; - - forAll(allBackgroundMeshBounds_, procI) + if (bFTreePtr_().findNearest(centre, radiusSqr).hit()) { - // It is assumed that the sphere in question overlaps the source - // processor, so don't test it, unless includeOwnProcessor is true - if - ( - (includeOwnProcessor || procI != Pstream::myProcNo()) - && allBackgroundMeshBounds_[procI].overlaps(c, rSqr) - ) - { - toCandidateProc.append(procI); - testCentres.append(c); - testRadiusSqrs.append(rSqr); - - nCandidates++; - } + return true; } - - sphereBlockStart[sI] = nTotalCandidates; - sphereBlockSize[sI] = nCandidates; - - nTotalCandidates += nCandidates; } - // Needed for reverseDistribute - label preDistributionToCandidateProcSize = toCandidateProc.size(); - - autoPtr<mapDistribute> map(buildMap(toCandidateProc)); - - map().distribute(testCentres); - map().distribute(testRadiusSqrs); - - List<bool> sphereOverlapsCandidate(testCentres.size(), false); - - // Test candidate spheres on candidate processors - forAll(testCentres, sI) - { - const point& c = testCentres[sI]; - scalar rSqr = testRadiusSqrs[sI]; - - // If the sphere finds a nearest element of the patch, then it overlaps - sphereOverlapsCandidate[sI] = bFTreePtr_().findNearest(c, rSqr).hit(); - //sphereOverlapsCandidate[sI] = bFTreePtr_().findAnyOverlap(c, rSqr); - } - - map().reverseDistribute - ( - preDistributionToCandidateProcSize, - sphereOverlapsCandidate - ); + return false; +} - labelListList sphereProcs(centres.size()); - // Working storage for assessing processors - DynamicList<label> tmpProcs; +Foam::labelList Foam::backgroundMeshDecomposition::overlapProcessors +( + const point& centre, + const scalar radiusSqr +) const +{ + DynamicList<label> toProc(Pstream::nProcs()); - forAll(centres, sI) + forAll(allBackgroundMeshBounds_, procI) { - tmpProcs.clear(); - - // Extract the sub list of results for this point - - SubList<bool> sphereProcResults + // Test against the bounding box of the processor + if ( - sphereOverlapsCandidate, - sphereBlockSize[sI], - sphereBlockStart[sI] - ); - - forAll(sphereProcResults, sPRI) + procI != Pstream::myProcNo() + && allBackgroundMeshBounds_[procI].overlaps(centre, radiusSqr) + ) { - if (sphereProcResults[sPRI]) + // Expensive test +// if (bFTreePtr_().findNearest(centre, radiusSqr).hit()) { - tmpProcs.append(toCandidateProc[sphereBlockStart[sI] + sPRI]); + toProc.append(procI); } } - - sphereProcs[sI] = tmpProcs; } - return sphereProcs; + return toProc; } +//Foam::labelListList Foam::backgroundMeshDecomposition::overlapsProcessors +//( +// const List<point>& centres, +// const List<scalar>& radiusSqrs, +// const Delaunay& T, +// bool includeOwnProcessor +//) const +//{ +// DynamicList<label> toCandidateProc; +// DynamicList<point> testCentres; +// DynamicList<scalar> testRadiusSqrs; +// labelList sphereBlockStart(centres.size(), -1); +// labelList sphereBlockSize(centres.size(), -1); +// +// label nTotalCandidates = 0; +// +// forAll(centres, sI) +// { +// const point& c = centres[sI]; +// scalar rSqr = radiusSqrs[sI]; +// +// label nCandidates = 0; +// +// forAll(allBackgroundMeshBounds_, procI) +// { +// // It is assumed that the sphere in question overlaps the source +// // processor, so don't test it, unless includeOwnProcessor is true +// if +// ( +// (includeOwnProcessor || procI != Pstream::myProcNo()) +// && allBackgroundMeshBounds_[procI].overlaps(c, rSqr) +// ) +// { +// if (bFTreePtr_().findNearest(c, rSqr).hit()) +// { +// toCandidateProc.append(procI); +// testCentres.append(c); +// testRadiusSqrs.append(rSqr); +// +// nCandidates++; +// } +// } +// } +// +// sphereBlockStart[sI] = nTotalCandidates; +// sphereBlockSize[sI] = nCandidates; +// +// nTotalCandidates += nCandidates; +// } +// +// // Needed for reverseDistribute +//// label preDistributionToCandidateProcSize = toCandidateProc.size(); +//// +//// autoPtr<mapDistribute> map(buildMap(toCandidateProc)); +//// +//// map().distribute(testCentres); +//// map().distribute(testRadiusSqrs); +// +// // @todo This is faster, but results in more vertices being referred +// boolList sphereOverlapsCandidate(testCentres.size(), true); +//// boolList sphereOverlapsCandidate(testCentres.size(), false); +//// +//// // Test candidate spheres on candidate processors +//// forAll(testCentres, sI) +//// { +//// const point& c = testCentres[sI]; +//// const scalar rSqr = testRadiusSqrs[sI]; +//// +//// const bool flagOverlap = bFTreePtr_().findNearest(c, rSqr).hit(); +//// +//// if (flagOverlap) +//// { +//// //if (vertexOctree.findAnyOverlap(c, rSqr)) +////// if (vertexOctree.findNearest(c, rSqr*1.001).hit()) +////// { +////// sphereOverlapsCandidate[sI] = true; +////// } +//// +////// Vertex_handle nearestVertex = T.nearest_vertex +////// ( +////// toPoint<Point>(c) +////// ); +////// +////// const scalar distSqr = magSqr +////// ( +////// topoint(nearestVertex->point()) - c +////// ); +////// +////// if (distSqr <= rSqr) +////// { +////// // If the sphere finds a nearest element of the patch, +////// // then it overlaps +//// sphereOverlapsCandidate[sI] = true; +////// } +//// } +//// } +// +//// map().reverseDistribute +//// ( +//// preDistributionToCandidateProcSize, +//// sphereOverlapsCandidate +//// ); +// +// labelListList sphereProcs(centres.size()); +// +// // Working storage for assessing processors +// DynamicList<label> tmpProcs; +// +// forAll(centres, sI) +// { +// tmpProcs.clear(); +// +// // Extract the sub list of results for this point +// +// SubList<bool> sphereProcResults +// ( +// sphereOverlapsCandidate, +// sphereBlockSize[sI], +// sphereBlockStart[sI] +// ); +// +// forAll(sphereProcResults, sPRI) +// { +// if (sphereProcResults[sPRI]) +// { +// tmpProcs.append(toCandidateProc[sphereBlockStart[sI] + sPRI]); +// } +// } +// +// sphereProcs[sI] = tmpProcs; +// } +// +// return sphereProcs; +//} + + +//Foam::labelListList Foam::backgroundMeshDecomposition::overlapProcessors +//( +// const point& cc, +// const scalar rSqr +//) const +//{ +// DynamicList<label> toCandidateProc; +// label sphereBlockStart(-1); +// label sphereBlockSize(-1); +// +// label nCandidates = 0; +// +// forAll(allBackgroundMeshBounds_, procI) +// { +// // It is assumed that the sphere in question overlaps the source +// // processor, so don't test it, unless includeOwnProcessor is true +// if +// ( +// (includeOwnProcessor || procI != Pstream::myProcNo()) +// && allBackgroundMeshBounds_[procI].overlaps(cc, rSqr) +// ) +// { +// toCandidateProc.append(procI); +// +// nCandidates++; +// } +// } +// +// sphereBlockSize = nCandidates; +// nTotalCandidates += nCandidates; +// +// // Needed for reverseDistribute +// label preDistributionToCandidateProcSize = toCandidateProc.size(); +// +// autoPtr<mapDistribute> map(buildMap(toCandidateProc)); +// +// map().distribute(testCentres); +// map().distribute(testRadiusSqrs); +// +// // @todo This is faster, but results in more vertices being referred +//// boolList sphereOverlapsCandidate(testCentres.size(), true); +// boolList sphereOverlapsCandidate(testCentres.size(), false); +// +// // Test candidate spheres on candidate processors +// forAll(testCentres, sI) +// { +// const point& c = testCentres[sI]; +// const scalar rSqr = testRadiusSqrs[sI]; +// +// const bool flagOverlap = bFTreePtr_().findNearest(c, rSqr).hit(); +// +// if (flagOverlap) +// { +// //if (vertexOctree.findAnyOverlap(c, rSqr)) +//// if (vertexOctree.findNearest(c, rSqr*1.001).hit()) +//// { +//// sphereOverlapsCandidate[sI] = true; +//// } +// +//// Vertex_handle nearestVertex = T.nearest_vertex +//// ( +//// toPoint<Point>(c) +//// ); +//// +//// const scalar distSqr = magSqr +//// ( +//// topoint(nearestVertex->point()) - c +//// ); +//// +//// if (distSqr <= rSqr) +//// { +//// // If the sphere finds a nearest element of the patch, then +//// // it overlaps +// sphereOverlapsCandidate[sI] = true; +//// } +// } +// } +// +// map().reverseDistribute +// ( +// preDistributionToCandidateProcSize, +// sphereOverlapsCandidate +// ); +// +// labelListList sphereProcs(centres.size()); +// +// // Working storage for assessing processors +// DynamicList<label> tmpProcs; +// +// forAll(centres, sI) +// { +// tmpProcs.clear(); +// +// // Extract the sub list of results for this point +// +// SubList<bool> sphereProcResults +// ( +// sphereOverlapsCandidate, +// sphereBlockSize[sI], +// sphereBlockStart[sI] +// ); +// +// forAll(sphereProcResults, sPRI) +// { +// if (sphereProcResults[sPRI]) +// { +// tmpProcs.append(toCandidateProc[sphereBlockStart[sI] + sPRI]); +// } +// } +// +// sphereProcs[sI] = tmpProcs; +// } +// +// return sphereProcs; +//} + + // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H index bcdd1638345c49d41a3d0f122546517732d057c7..73aa2fee74a86d32fb81360eec0b602b2aa7ed58 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H @@ -53,7 +53,6 @@ SourceFiles #ifndef backgroundMeshDecomposition_H #define backgroundMeshDecomposition_H -#include "conformalVoronoiMesh.H" #include "fvMesh.H" #include "hexRef8.H" #include "cellSet.H" @@ -81,6 +80,10 @@ namespace Foam typedef PrimitivePatch<face, List, const pointField, point> bPatch; typedef treeDataPrimitivePatch<bPatch> treeDataBPatch; +class Time; +class Random; +class conformationSurfaces; + /*---------------------------------------------------------------------------*\ Class backgroundMeshDecomposition Declaration \*---------------------------------------------------------------------------*/ @@ -98,15 +101,9 @@ class backgroundMeshDecomposition //- Reference to surface const conformationSurfaces& geometryToConformTo_; - //- The cell size control object - const cellSizeControlSurfaces& cellSizeControl_; - //- Random number generator Random& rndGen_; - //- Controls - const cvControls& cvMeshControls_; - //- Mesh stored on for this processor, specifiying the domain that it // is responsible for. fvMesh mesh_; @@ -121,8 +118,6 @@ class backgroundMeshDecomposition //- Search tree for the boundaryFaces_ patch autoPtr<indexedOctree<treeDataBPatch> > bFTreePtr_; - List<scalar> octreeNearestDistances_; - //- The bounds of all background meshes on all processors treeBoundBoxList allBackgroundMeshBounds_; @@ -204,24 +199,10 @@ public: //- Construct from components in cvMesh operation backgroundMeshDecomposition ( - const dictionary& coeffsDict, - const conformalVoronoiMesh& cvMesh - ); - - //- Construct from components for standalone operation - backgroundMeshDecomposition - ( - const scalar spanScale, - const scalar minCellSizeLimit, - const label minLevels, - const label volRes, - const scalar maxCellWeightCoeff, - const Time& runTime, - const conformationSurfaces& geometryToConformTo, - const cellSizeControlSurfaces& cellSizeControl, Random& rndGen, - const cvControls& cvMeshControls + const conformationSurfaces& geometryToConformTo, + const dictionary& coeffsDict ); @@ -238,10 +219,7 @@ public: // returning a map to use to redistribute vertices. autoPtr<mapDistributePolyMesh> distribute ( - volScalarField& cellWeights, - List<DynamicList<point> >& cellVertices, - List<DynamicList<label> >& cellVertexIndices, - List<DynamicList<label> >& cellVertexTypes + volScalarField& cellWeights ); //- Distribute supplied the points to the appropriate processor @@ -300,18 +278,31 @@ public: bool includeOwnProcessor = false ) const; - //- Which processors overlap the given sphere, returns all processors - // whose boundary patch is touched by the sphere or whom the sphere is - // inside. By default this does not return the processor that the - // query is launched from, it is assumed that the point is on that - // processor. - labelListList overlapsProcessors + bool overlapsOtherProcessors ( - const List<point>& centres, - const List<scalar>& radiusSqrs, - bool includeOwnProcessor = false + const point& centre, + const scalar& radiusSqr + ) const; + + labelList overlapProcessors + ( + const point& centre, + const scalar radiusSqr ) const; +// //- Which processors overlap the given sphere, returns all processors +// // whose boundary patch is touched by the sphere or whom the sphere +// // is inside. By default this does not return the processor that the +// // query is launched from, it is assumed that the point is on that +// // processor. +// labelListList overlapsProcessors +// ( +// const List<point>& centres, +// const List<scalar>& radiusSqrs, +// const Delaunay& T, +// bool includeOwnProcessor +// ) const; + // Access //- Return access to the underlying mesh @@ -320,9 +311,6 @@ public: //- Return access to the underlying tree inline const indexedOctree<treeDataBPatch>& tree() const; - //- Return access to the nearest distance of the octree nodes - inline const List<scalar>& octreeNearestDistances() const; - //- Return the boundBox of this processor inline const treeBoundBox& procBounds() const; diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H index 44a007193d8e85fae30c2b8a024385a2c90fedab..1f8b7b0a327a1bd7d74fbf5c1ce49719cd4e9734 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecompositionI.H @@ -30,18 +30,13 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const return mesh_; } + const Foam::indexedOctree<Foam::treeDataBPatch>& Foam::backgroundMeshDecomposition::tree() const { return bFTreePtr_(); } -const Foam::List<Foam::scalar>& -Foam::backgroundMeshDecomposition::octreeNearestDistances() const -{ - return octreeNearestDistances_; -} - const Foam::treeBoundBox& Foam::backgroundMeshDecomposition::procBounds() const diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C new file mode 100644 index 0000000000000000000000000000000000000000..dfba259e674b5dbd6b5cca8bb4e32ab0ff59a3b7 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellAspectRatioControl.H" +#include "vectorTools.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellAspectRatioControl::cellAspectRatioControl +( + const dictionary& motionDict +) +: + aspectRatioDict_(motionDict.subOrEmptyDict("cellAspectRatioControl")), + aspectRatio_(aspectRatioDict_.lookupOrDefault<scalar>("aspectRatio", 1.0)), + aspectRatioDirection_ + ( + aspectRatioDict_.lookupOrDefault<vector> + ( + "aspectRatioDirection", + vector(0, 0, 0) + ) + ) +{ + Info<< nl << " Cell Aspect Ratio Control" << nl + << " Ratio : " << aspectRatio_ << nl + << " Direction : " << aspectRatioDirection_ << nl << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellAspectRatioControl::~cellAspectRatioControl() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::cellAspectRatioControl::updateCellSizeAndFaceArea +( + vector& alignmentDir, + scalar& targetFaceArea, + scalar& targetCellSize +) const +{ + const scalar cosAngle = mag + ( + vectorTools::cosPhi(alignmentDir, aspectRatioDirection_) + ); + + // Change target face area based on aspect ratio + targetFaceArea + += targetFaceArea + *(aspectRatio_ - 1.0) + *(1.0 - cosAngle); + + // Change target cell size based on aspect ratio + targetCellSize + += targetCellSize + *(aspectRatio_ - 1.0) + *cosAngle; + + alignmentDir *= 0.5*targetCellSize; +} + + +void Foam::cellAspectRatioControl::updateDeltaVector +( + const vector& alignmentDir, + const scalar targetCellSize, + const scalar rABMag, + vector& delta +) const +{ + const scalar cosAngle = mag + ( + vectorTools::cosPhi(alignmentDir, aspectRatioDirection_) + ); + + delta += 0.5 + *delta + *cosAngle + *(targetCellSize/rABMag) + *(aspectRatio_ - 1.0); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H new file mode 100644 index 0000000000000000000000000000000000000000..ac47311940a7c3672b9c2e378946d1c5b8b658e1 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H @@ -0,0 +1,115 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellAspectRatioControl + +Description + +SourceFiles + cellAspectRatioControl.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellAspectRatioControl_H +#define cellAspectRatioControl_H + +#include "dictionary.H" +#include "vector.H" +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class cellAspectRatioControl Declaration +\*---------------------------------------------------------------------------*/ + +class cellAspectRatioControl +{ + // Private data + + const dictionary aspectRatioDict_; + + const scalar aspectRatio_; + + const vector aspectRatioDirection_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + cellAspectRatioControl(const cellAspectRatioControl&); + + //- Disallow default bitwise assignment + void operator=(const cellAspectRatioControl&); + + +public: + + // Constructors + + //- Construct from dictionary + cellAspectRatioControl + ( + const dictionary& motionDict + ); + + + //- Destructor + virtual ~cellAspectRatioControl(); + + + // Member Functions + + // Query + + void updateCellSizeAndFaceArea + ( + vector& alignmentDir, + scalar& targetFaceArea, + scalar& targetCellSize + ) const; + + void updateDeltaVector + ( + const vector& alignmentDir, + const scalar targetCellSize, + const scalar rABMag, + vector& delta + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C new file mode 100644 index 0000000000000000000000000000000000000000..a6b47f4ab0874630518bdb6b23268868a6b1150e --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.C @@ -0,0 +1,922 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellShapeControl.H" +#include "pointField.H" +#include "scalarField.H" +#include "cellSizeAndAlignmentControl.H" +#include "searchableSurfaceControl.H" +#include "cellSizeFunction.H" +#include "triad.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template <class Triangulation, class Type> +Foam::tmp<Foam::Field<Type> > Foam::cellShapeControl::filterFarPoints +( + const Triangulation& mesh, + const Field<Type>& field +) +{ + tmp<Field<Type> > tNewField(new Field<Type>(field.size())); + Field<Type>& newField = tNewField(); + + label added = 0; + label count = 0; + + for + ( + typename Triangulation::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + newField[added++] = field[count]; + } + + count++; + } + + newField.resize(added); + + return tNewField; +} + + +template <class Triangulation> +Foam::autoPtr<Foam::mapDistribute> Foam::cellShapeControl::buildReferredMap +( + const Triangulation& mesh, + labelList& indices +) +{ + globalIndex globalIndexing(mesh.vertexCount()); + + DynamicList<label> dynIndices(mesh.vertexCount()/10); + + for + ( + typename Triangulation::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (vit->referred()) + { + dynIndices.append + ( + globalIndexing.toGlobal(vit->procIndex(), vit->index()) + ); + } + } + + indices.transfer(dynIndices); + + List<Map<label> > compactMap; + return autoPtr<mapDistribute> + ( + new mapDistribute + ( + globalIndexing, + indices, + compactMap + ) + ); +} + + +template <class Triangulation> +Foam::autoPtr<Foam::mapDistribute> Foam::cellShapeControl::buildMap +( + const Triangulation& mesh, + labelListList& pointPoints +) +{ + pointPoints.setSize(mesh.vertexCount()); + + globalIndex globalIndexing(mesh.vertexCount()); + + for + ( + typename Triangulation::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (!vit->real()) + { + continue; + } + + std::list<typename Triangulation::Vertex_handle> adjVerts; + mesh.finite_adjacent_vertices(vit, std::back_inserter(adjVerts)); + + DynamicList<label> indices(adjVerts.size()); + + for + ( + typename std::list<typename Triangulation::Vertex_handle>:: + const_iterator adjVertI = adjVerts.begin(); + adjVertI != adjVerts.end(); + ++adjVertI + ) + { + typename Triangulation::Vertex_handle vh = *adjVertI; + + if (!vh->farPoint()) + { + indices.append + ( + globalIndexing.toGlobal(vh->procIndex(), vh->index()) + ); + } + } + + pointPoints[vit->index()].transfer(indices); + } + + List<Map<label> > compactMap; + return autoPtr<mapDistribute> + ( + new mapDistribute + ( + globalIndexing, + pointPoints, + compactMap + ) + ); +} + + +template <class Triangulation> +Foam::tmp<Foam::triadField> Foam::cellShapeControl::buildAlignmentField +( + const Triangulation& mesh +) +{ + tmp<triadField> tAlignments + ( + new triadField(mesh.vertexCount(), triad::unset) + ); + triadField& alignments = tAlignments(); + + for + ( + typename Triangulation::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (!vit->real()) + { + continue; + } + + alignments[vit->index()] = triad + ( + vit->alignment().x(), + vit->alignment().y(), + vit->alignment().z() + ); + } + + return tAlignments; +} + + +template <class Triangulation> +Foam::tmp<Foam::pointField> Foam::cellShapeControl::buildPointField +( + const Triangulation& mesh +) +{ + tmp<pointField> tPoints + ( + new pointField(mesh.vertexCount(), point(GREAT, GREAT, GREAT)) + ); + pointField& points = tPoints(); + + for + ( + typename Triangulation::Finite_vertices_iterator vit = + mesh.finite_vertices_begin(); + vit != mesh.finite_vertices_end(); + ++vit + ) + { + if (!vit->real()) + { + continue; + } + + points[vit->index()] = topoint(vit->point()); + } + + return tPoints; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellShapeControl::cellShapeControl +( + const Time& runTime, + const dictionary& motionDict, + const searchableSurfaces& allGeometry, + const conformationSurfaces& geometryToConformTo +) +: + dictionary(motionDict), + runTime_(runTime), + allGeometry_(allGeometry), + geometryToConformTo_(geometryToConformTo), + defaultCellSize_(readScalar(lookup("defaultCellSize"))), + shapeControlMesh_(runTime), + aspectRatio_(motionDict), + sizeAndAlignment_ + ( + runTime, + motionDict.subDict("shapeControlFunctions"), + geometryToConformTo + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellShapeControl::~cellShapeControl() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalarField Foam::cellShapeControl::cellSize +( + const pointField& pts +) const +{ + scalarField cellSizes(pts.size()); + + forAll(pts, i) + { + cellSizes[i] = cellSize(pts[i]); + } + + return cellSizes; +} + + +Foam::scalar Foam::cellShapeControl::cellSize(const point& pt) const +{ + scalarList bary; + cellShapeControlMesh::Cell_handle ch; + + shapeControlMesh_.barycentricCoords(pt, bary, ch); + + scalar size = 0; + + label nFarPoints = 0; + for (label pI = 0; pI < 4; ++pI) + { + if (ch->vertex(pI)->farPoint()) + { + nFarPoints++; + } + } + + if (shapeControlMesh_.is_infinite(ch)) + { +// if (nFarPoints != 0) +// { +// for (label pI = 0; pI < 4; ++pI) +// { +// if (!ch->vertex(pI)->farPoint()) +// { +// size = ch->vertex(pI)->targetCellSize(); +// return size; +// } +// } +// } + + // Look up nearest point + cellShapeControlMesh::Vertex_handle nearV = + shapeControlMesh_.nearest_vertex + ( + toPoint<cellShapeControlMesh::Point>(pt) + ); + + size = nearV->targetCellSize(); + } + else + { + if (nFarPoints != 0) + { + for (label pI = 0; pI < 4; ++pI) + { + if (!ch->vertex(pI)->farPoint()) + { + size = ch->vertex(pI)->targetCellSize(); + return size; + } + } + } + else + { + forAll(bary, pI) + { + size += bary[pI]*ch->vertex(pI)->targetCellSize(); + } + } + } + + return size; +} + + +//- Return the cell alignment at the given location +Foam::tensor Foam::cellShapeControl::cellAlignment(const point& pt) const +{ + scalarList bary; + cellShapeControlMesh::Cell_handle ch; + + shapeControlMesh_.barycentricCoords(pt, bary, ch); + + tensor alignment = tensor::zero; + + label nFarPoints = 0; + for (label pI = 0; pI < 4; ++pI) + { + if (ch->vertex(pI)->farPoint()) + { + nFarPoints++; + } + } + + if (shapeControlMesh_.is_infinite(ch) || nFarPoints == 4) + { + Pout<< "At Infinite vertex" << endl; + + if (nFarPoints != 0) + { + for (label pI = 0; pI < 4; ++pI) + { + if (!ch->vertex(pI)->farPoint()) + { + alignment = ch->vertex(pI)->alignment(); + return alignment; + } + } + } + +// cellShapeControlMesh::Vertex_handle nearV = +// shapeControlMesh_.nearest_vertex +// ( +// toPoint<cellShapeControlMesh::Point>(pt) +// ); +// +// alignment = nearV->alignment(); + } + else + { +// forAll(bary, pI) +// { +// alignment += bary[pI]*ch->vertex(pI)->alignment(); +// } + + cellShapeControlMesh::Vertex_handle nearV = + shapeControlMesh_.nearest_vertex_in_cell + ( + toPoint<cellShapeControlMesh::Point>(pt), + ch + ); + + alignment = nearV->alignment(); + } + + return alignment; +} + + +void Foam::cellShapeControl::cellSizeAndAlignment +( + const point& pt, + scalar& size, + tensor& alignment +) const +{ + scalarList bary; + cellShapeControlMesh::Cell_handle ch; + + shapeControlMesh_.barycentricCoords(pt, bary, ch); + + alignment = tensor::zero; + size = 0; + + label nFarPoints = 0; + for (label pI = 0; pI < 4; ++pI) + { + if (ch->vertex(pI)->farPoint()) + { + nFarPoints++; + } + } + + if (shapeControlMesh_.is_infinite(ch)) + { + if (nFarPoints != 0) + { + for (label pI = 0; pI < 4; ++pI) + { + if (!ch->vertex(pI)->farPoint()) + { + size = ch->vertex(pI)->targetCellSize(); + alignment = ch->vertex(pI)->alignment(); + return; + } + } + } + +// cellShapeControlMesh::Vertex_handle nearV = +// shapeControlMesh_.nearest_vertex +// ( +// toPoint<cellShapeControlMesh::Point>(pt) +// ); +// +// size = nearV->targetCellSize(); +// alignment = nearV->alignment(); + } + else + { + if (nFarPoints != 0) + { + for (label pI = 0; pI < 4; ++pI) + { + if (!ch->vertex(pI)->farPoint()) + { + size = ch->vertex(pI)->targetCellSize(); + alignment = ch->vertex(pI)->alignment(); + return; + } + } + } + else + { + triad tri; + + forAll(bary, pI) + { + size += bary[pI]*ch->vertex(pI)->targetCellSize(); + + triad triTmp2 + ( + ch->vertex(pI)->alignment().x(), + ch->vertex(pI)->alignment().y(), + ch->vertex(pI)->alignment().z() + ); + + tri += triTmp2*bary[pI]; + } + + tri.normalize(); + tri.orthogonalize(); + tri = tri.sortxyz(); + + alignment = tensor + ( + tri.x(), tri.y(), tri.z() + ); + } + } +} + + +void Foam::cellShapeControl::initialMeshPopulation +( + const autoPtr<backgroundMeshDecomposition>& decomposition +) +{ + // Need to pass in the background mesh decomposition so that can test if + // a point to insert is on the processor. + if (Pstream::parRun()) + { + shapeControlMesh_.insertBoundingPoints(decomposition().procBounds()); + } + else + { + shapeControlMesh_.insertBoundingPoints(allGeometry_.bounds()); + } + + const PtrList<cellSizeAndAlignmentControl>& controlFunctions = + sizeAndAlignment_.controlFunctions(); + + forAll(controlFunctions, fI) + { + const cellSizeAndAlignmentControl& controlFunction = + controlFunctions[fI]; + + Info<< "Inserting points from " << controlFunction.name() + << " (" << controlFunction.type() << ")" << endl; + + pointField pts(1); + scalarField sizes(1); + Field<triad> alignments(1); + + controlFunction.initialVertices(pts, sizes, alignments); + + label nRejected = 0; + + forAll(pts, pI) + { + if (Pstream::parRun()) + { + if (!decomposition().positionOnThisProcessor(pts[pI])) + { + nRejected++; + continue; + } + } + + shapeControlMesh_.insert + ( + pts[pI], + sizes[pI], + alignments[pI] + ); + } + + Info<< " Inserted " + << returnReduce(pts.size() - nRejected, sumOp<label>()) + << "/" << pts.size() + << endl; + } +} + + +Foam::label Foam::cellShapeControl::refineMesh +( + const autoPtr<backgroundMeshDecomposition>& decomposition +) +{ + const pointField cellCentres = shapeControlMesh_.cellCentres(); + + Info<< " Created cell centres" << endl; + + const PtrList<cellSizeAndAlignmentControl>& controlFunctions = + sizeAndAlignment_.controlFunctions(); + + DynamicList<Vb> verts(shapeControlMesh_.number_of_vertices()); + + forAll(cellCentres, cellI) + { + const Foam::point& pt = cellCentres[cellI]; + + if (!geometryToConformTo_.inside(pt)) + { + continue; + } + + scalarList bary; + cellShapeControlMesh::Cell_handle ch; + + shapeControlMesh_.barycentricCoords(pt, bary, ch); + + if (shapeControlMesh_.is_infinite(ch)) + { + continue; + } + + scalar interpolatedSize = 0; + forAll(bary, pI) + { + interpolatedSize += bary[pI]*ch->vertex(pI)->targetCellSize(); + } + + label lastPriority = labelMax; + scalar lastCellSize = GREAT; + forAll(controlFunctions, fI) + { + const cellSizeAndAlignmentControl& controlFunction = + controlFunctions[fI]; + + if (controlFunction.priority() > lastPriority) + { + continue; + } + + if (isA<searchableSurfaceControl>(controlFunction)) + { + const cellSizeFunction& sizeFunction = + dynamicCast<const searchableSurfaceControl> + ( + controlFunction + ).sizeFunction(); + + scalar cellSize = 0; + if (sizeFunction.cellSize(pt, cellSize)) + { + if (controlFunction.priority() == lastPriority) + { + if (cellSize < lastCellSize) + { + lastCellSize = cellSize; + } + } + else + { + lastCellSize = cellSize; + } + + lastPriority = controlFunction.priority(); + } + } + } + + if + ( + lastCellSize < GREAT + && mag(interpolatedSize - lastCellSize)/lastCellSize > 0.2 + ) + { + if (Pstream::parRun()) + { + if (!decomposition().positionOnThisProcessor(pt)) + { + continue; + } + } + + verts.append + ( + Vb + ( + toPoint<cellShapeControlMesh::Point>(pt), + Vb::vtInternal + ) + ); + verts.last().targetCellSize() = lastCellSize; + verts.last().alignment() = tensor::I; + } + } + + shapeControlMesh_.insertPoints(verts); + + return verts.size(); +} + + +void Foam::cellShapeControl::smoothMesh() +{ + label maxSmoothingIterations = 200; + scalar minResidual = 0; + + labelListList pointPoints; + autoPtr<mapDistribute> meshDistributor = buildMap + ( + shapeControlMesh_, + pointPoints + ); + + triadField alignments = buildAlignmentField(shapeControlMesh_); + pointField points = buildPointField(shapeControlMesh_); + // Setup the sizes and alignments on each point + triadField fixedAlignments(shapeControlMesh_.vertexCount(), triad::unset); + + for + ( + CellSizeDelaunay::Finite_vertices_iterator vit = + shapeControlMesh_.finite_vertices_begin(); + vit != shapeControlMesh_.finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + const tensor& alignment = vit->alignment(); + + fixedAlignments[vit->index()] = triad + ( + alignment.x(), + alignment.y(), + alignment.z() + ); + } + } + + Info<< nl << "Smoothing alignments" << endl; + + for (label iter = 0; iter < maxSmoothingIterations; iter++) + { + Info<< "Iteration " << iter; + + meshDistributor().distribute(points); + meshDistributor().distribute(alignments); + + scalar residual = 0; + + triadField triadAv(alignments.size(), triad::unset); + + forAll(pointPoints, pI) + { + const labelList& pPoints = pointPoints[pI]; + + if (pPoints.empty()) + { + continue; + } + + triad& newTriad = triadAv[pI]; + + forAll(pPoints, adjPointI) + { + const label adjPointIndex = pPoints[adjPointI]; + + scalar dist = mag(points[pI] - points[adjPointIndex]); + + dist = max(dist, SMALL); + + triad tmpTriad = alignments[adjPointIndex]; + + for (direction dir = 0; dir < 3; dir++) + { + if (tmpTriad.set(dir)) + { + tmpTriad[dir] *= (1.0/dist); + } + } + + newTriad += tmpTriad; + } + + newTriad.normalize(); + newTriad.orthogonalize(); + newTriad = newTriad.sortxyz(); + + // Enforce the boundary conditions + const triad& fixedAlignment = fixedAlignments[pI]; + + label nFixed = 0; + + forAll(fixedAlignment, dirI) + { + if (fixedAlignment[dirI] != triad::unset[dirI]) + { + nFixed++; + } + } + + if (nFixed == 1) + { + forAll(fixedAlignment, dirI) + { + if (fixedAlignment.set(dirI)) + { + newTriad.align(fixedAlignment[dirI]); + } + } + } + else if (nFixed == 2) + { + forAll(fixedAlignment, dirI) + { + if (fixedAlignment.set(dirI)) + { + newTriad[dirI] = fixedAlignment[dirI]; + } + else + { + newTriad[dirI] = triad::unset[dirI]; + } + } + + newTriad.orthogonalize(); + } + else if (nFixed == 3) + { + forAll(fixedAlignment, dirI) + { + if (fixedAlignment.set(dirI)) + { + newTriad[dirI] = fixedAlignment[dirI]; + } + } + } + + const triad& oldTriad = alignments[pI]; + + if (newTriad.set(vector::X) && oldTriad.set(vector::X)) + { + scalar dotProd = (oldTriad.x() & newTriad.x()); + + scalar diff = mag(dotProd) - 1.0; + residual += mag(diff); + } + if (newTriad.set(vector::Y) && oldTriad.set(vector::Y)) + { + scalar dotProd = (oldTriad.y() & newTriad.y()); + + scalar diff = mag(dotProd) - 1.0; + residual += mag(diff); + } + if (newTriad.set(vector::Z) && oldTriad.set(vector::Z)) + { + scalar dotProd = (oldTriad.z() & newTriad.z()); + + scalar diff = mag(dotProd) - 1.0; + residual += mag(diff); + } + } + + forAll(alignments, pI) + { + alignments[pI] = triadAv[pI].sortxyz(); + } + + reduce(residual, sumOp<scalar>()); + + Info<< ", Residual = " << residual << endl; + + if (residual <= minResidual) + { + break; + } + } + + meshDistributor().distribute(alignments); + + for + ( + CellSizeDelaunay::Finite_vertices_iterator vit = + shapeControlMesh_.finite_vertices_begin(); + vit != shapeControlMesh_.finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + vit->alignment() = tensor + ( + alignments[vit->index()].x(), + alignments[vit->index()].y(), + alignments[vit->index()].z() + ); + } + } + + labelList referredPoints; + autoPtr<mapDistribute> referredDistributor = buildReferredMap + ( + shapeControlMesh_, + referredPoints + ); + + alignments.setSize(shapeControlMesh_.vertexCount()); + referredDistributor().distribute(alignments); + + label referredI = 0; + for + ( + CellSizeDelaunay::Finite_vertices_iterator vit = + shapeControlMesh_.finite_vertices_begin(); + vit != shapeControlMesh_.finite_vertices_end(); + ++vit + ) + { + if (vit->referred()) + { + const triad& t = alignments[referredPoints[referredI++]]; + + vit->alignment() = tensor(t.x(), t.y(), t.z()); + } + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H new file mode 100644 index 0000000000000000000000000000000000000000..3bffe717f7002f3138e29b754b7ff01f899daf35 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControl.H @@ -0,0 +1,212 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellShapeControl + +Description + +SourceFiles + cellShapeControlI.H + cellShapeControl.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellShapeControl_H +#define cellShapeControl_H + +#include "dictionary.H" +#include "autoPtr.H" +#include "tensor.H" +#include "point.H" +#include "primitiveFieldsFwd.H" +#include "pointFieldFwd.H" +#include "triadField.H" +#include "Time.H" +#include "searchableSurfaces.H" +#include "conformationSurfaces.H" +#include "cellAspectRatioControl.H" +#include "cellSizeAndAlignmentControls.H" +#include "cellShapeControlMesh.H" +#include "backgroundMeshDecomposition.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class cellShapeControl Declaration +\*---------------------------------------------------------------------------*/ + +class cellShapeControl +: + public dictionary +{ + // Private data + + const Time& runTime_; + + const searchableSurfaces& allGeometry_; + + const conformationSurfaces& geometryToConformTo_; + + const scalar defaultCellSize_; + + cellShapeControlMesh shapeControlMesh_; + + cellAspectRatioControl aspectRatio_; + + cellSizeAndAlignmentControls sizeAndAlignment_; + + + // Private Member Functions + + template <class Triangulation, class Type> + tmp<Field<Type> > filterFarPoints + ( + const Triangulation& mesh, + const Field<Type>& field + ); + + template <class Triangulation> + autoPtr<mapDistribute> buildMap + ( + const Triangulation& mesh, + labelListList& pointPoints + ); + + template <class Triangulation> + autoPtr<mapDistribute> buildReferredMap + ( + const Triangulation& mesh, + labelList& indices + ); + + template <class Triangulation> + tmp<triadField> buildAlignmentField(const Triangulation& mesh); + + template <class Triangulation> + tmp<pointField> buildPointField(const Triangulation& mesh); + + //- Disallow default bitwise copy construct + cellShapeControl(const cellShapeControl&); + + //- Disallow default bitwise assignment + void operator=(const cellShapeControl&); + + +public: + + //- Runtime type information + ClassName("cellShapeControl"); + + + // Constructors + + //- Construct from dictionary and references to conformalVoronoiMesh and + // searchableSurfaces + cellShapeControl + ( + const Time& runTime, + const dictionary& cellShapeControlDict, + const searchableSurfaces& allGeometry, + const conformationSurfaces& geometryToConformTo + ); + + + //- Destructor + ~cellShapeControl(); + + + // Member Functions + + // Access + + inline const scalar& defaultCellSize() const; + + inline cellShapeControlMesh& shapeControlMesh(); + + inline const cellShapeControlMesh& shapeControlMesh() const; + + inline const cellAspectRatioControl& aspectRatio() const; + + inline const cellSizeAndAlignmentControls& sizeAndAlignment() const; + + + // Query + + //- Return the cell size at the given location + scalar cellSize(const point& pt) const; + + scalarField cellSize(const pointField& pts) const; + + //- Return the cell alignment at the given location + tensor cellAlignment(const point& pt) const; + + void cellSizeAndAlignment + ( + const point& pt, + scalar& size, + tensor& alignment + ) const; + + + // Edit + + void initialMeshPopulation + ( + const autoPtr<backgroundMeshDecomposition>& decomposition + ); + + label refineMesh + ( + const autoPtr<backgroundMeshDecomposition>& decomposition + ); + + void smoothMesh(); + + //- Add a control point with a specified size and alignment +// virtual void addControlPoint +// ( +// const point& pt, +// const scalar& size, +// const tensor& alignment +// ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "cellShapeControlI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H new file mode 100644 index 0000000000000000000000000000000000000000..f7fdebc93192998027adbdfc2ba6527221a0b248 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControl/cellShapeControlI.H @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::cellShapeControlMesh& +Foam::cellShapeControl::shapeControlMesh() +{ + return shapeControlMesh_; +} + + +inline const Foam::cellShapeControlMesh& +Foam::cellShapeControl::shapeControlMesh() const +{ + return shapeControlMesh_; +} + + +inline const Foam::scalar& Foam::cellShapeControl::defaultCellSize() const +{ + return defaultCellSize_; +} + + +inline const Foam::cellAspectRatioControl& +Foam::cellShapeControl::aspectRatio() const +{ + return aspectRatio_; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C new file mode 100644 index 0000000000000000000000000000000000000000..bdcbf5a8857efa543ed0bbd0521e284a58bd1d31 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C @@ -0,0 +1,760 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellShapeControlMesh.H" +#include "pointIOField.H" +#include "scalarIOField.H" +#include "tensorIOField.H" +#include "tetrahedron.H" +#include "plane.H" +#include "transform.H" +#include "meshTools.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(cellShapeControlMesh, 0); + +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +//Foam::tensor Foam::cellShapeControlMesh::requiredAlignment +//( +// const Foam::point& pt, +// const searchableSurfaces& allGeometry, +// const conformationSurfaces& geometryToConformTo +//) const +//{ +// pointIndexHit surfHit; +// label hitSurface; +// +// geometryToConformTo.findSurfaceNearest +// ( +// pt, +// sqr(GREAT), +// surfHit, +// hitSurface +// ); +// +// if (!surfHit.hit()) +// { +// FatalErrorIn +// ( +// "Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment" +// ) << "findSurfaceNearest did not find a hit across the surfaces." +// << exit(FatalError) << endl; +// } +// +// // Primary alignment +// +// vectorField norm(1); +// +// allGeometry[hitSurface].getNormal +// ( +// List<pointIndexHit>(1, surfHit), +// norm +// ); +// +// const vector np = norm[0]; +// +// // Generate equally spaced 'spokes' in a circle normal to the +// // direction from the vertex to the closest point on the surface +// // and look for a secondary intersection. +// +// const vector d = surfHit.hitPoint() - pt; +// +// const tensor Rp = rotationTensor(vector(0,0,1), np); +// +// const label s = 36;//cvMeshControls().alignmentSearchSpokes(); +// +// scalar closestSpokeHitDistance = GREAT; +// +// pointIndexHit closestSpokeHit; +// +// label closestSpokeSurface = -1; +// +// const scalar spanMag = geometryToConformTo.globalBounds().mag(); +// +// for (label i = 0; i < s; i++) +// { +// vector spoke +// ( +// Foam::cos(i*constant::mathematical::twoPi/s), +// Foam::sin(i*constant::mathematical::twoPi/s), +// 0 +// ); +// +// spoke *= spanMag; +// +// spoke = Rp & spoke; +// +// pointIndexHit spokeHit; +// +// label spokeSurface = -1; +// +// // internal spoke +// +// geometryToConformTo.findSurfaceNearestIntersection +// ( +// pt, +// pt + spoke, +// spokeHit, +// spokeSurface +// ); +// +// if (spokeHit.hit()) +// { +// scalar spokeHitDistance = mag +// ( +// spokeHit.hitPoint() - pt +// ); +// +// if (spokeHitDistance < closestSpokeHitDistance) +// { +// closestSpokeHit = spokeHit; +// closestSpokeSurface = spokeSurface; +// closestSpokeHitDistance = spokeHitDistance; +// } +// } +// +// //external spoke +// +// Foam::point mirrorPt = pt + 2*d; +// +// geometryToConformTo.findSurfaceNearestIntersection +// ( +// mirrorPt, +// mirrorPt + spoke, +// spokeHit, +// spokeSurface +// ); +// +// if (spokeHit.hit()) +// { +// scalar spokeHitDistance = mag +// ( +// spokeHit.hitPoint() - mirrorPt +// ); +// +// if (spokeHitDistance < closestSpokeHitDistance) +// { +// closestSpokeHit = spokeHit; +// closestSpokeSurface = spokeSurface; +// closestSpokeHitDistance = spokeHitDistance; +// } +// } +// } +// +// if (closestSpokeSurface == -1) +// { +//// WarningIn +//// ( +//// "conformalVoronoiMesh::requiredAlignment" +//// "(" +//// "const Foam::point& pt" +//// ") const" +//// ) << "No secondary surface hit found in spoke search " +//// << "using " << s +//// << " spokes, try increasing alignmentSearchSpokes." +//// << endl; +// +// return I; +// } +// +// // Auxiliary alignment generated by spoke intersection normal. +// +// allGeometry[closestSpokeSurface].getNormal +// ( +// List<pointIndexHit>(1, closestSpokeHit), +// norm +// ); +// +// const vector& na = norm[0]; +// +// // Secondary alignment +// vector ns = np ^ na; +// +// if (mag(ns) < SMALL) +// { +// FatalErrorIn("conformalVoronoiMesh::requiredAlignment") +// << "Parallel normals detected in spoke search." << nl +// << "point: " << pt << nl +// << "closest surface point: " << surfHit.hitPoint() << nl +// << "closest spoke hit: " << closestSpokeHit.hitPoint() << nl +// << "np: " << surfHit.hitPoint() + np << nl +// << "ns: " << closestSpokeHit.hitPoint() + na << nl +// << exit(FatalError); +// } +// +// ns /= mag(ns); +// +// tensor Rs = rotationTensor((Rp & vector(0,1,0)), ns); +// +// return (Rs & Rp); +//} + + +Foam::label Foam::cellShapeControlMesh::removePoints() +{ + label nRemoved = 0; + for + ( + CellSizeDelaunay::Finite_vertices_iterator vit = + finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + std::list<Vertex_handle> verts; + adjacent_vertices(vit, std::back_inserter(verts)); + + bool removePt = true; + for + ( + std::list<Vertex_handle>::iterator aVit = verts.begin(); + aVit != verts.end(); + ++aVit + ) + { + Vertex_handle avh = *aVit; + + scalar diff = + mag(avh->targetCellSize() - vit->targetCellSize()) + /max(vit->targetCellSize(), 1e-6); + + if (diff > 0.05) + { + removePt = false; + } + } + + if (removePt) + { + remove(vit); + nRemoved++; + } + } + + return nRemoved; +} + + +Foam::tmp<Foam::pointField> Foam::cellShapeControlMesh::cellCentres() const +{ + tmp<pointField> tcellCentres(new pointField(number_of_finite_cells())); + pointField& cellCentres = tcellCentres(); + + label count = 0; + for + ( + CellSizeDelaunay::Finite_cells_iterator c = finite_cells_begin(); + c != finite_cells_end(); + ++c + ) + { + if (c->hasFarPoint()) + { + continue; + } + + scalarList bary; + cellShapeControlMesh::Cell_handle ch; + + const Foam::point centre = topoint + ( + CGAL::centroid<baseK> + ( + c->vertex(0)->point(), + c->vertex(1)->point(), + c->vertex(2)->point(), + c->vertex(3)->point() + ) + ); + + cellCentres[count++] = centre; + } + + cellCentres.resize(count); + + return tcellCentres; +} + + +void Foam::cellShapeControlMesh::writeTriangulation() +{ + OFstream str + ( + "refinementTriangulation_" + + name(Pstream::myProcNo()) + + ".obj" + ); + + label count = 0; + + Info<< "Write refinementTriangulation" << endl; + + for + ( + CellSizeDelaunay::Finite_edges_iterator e = finite_edges_begin(); + e != finite_edges_end(); + ++e + ) + { + Cell_handle c = e->first; + Vertex_handle vA = c->vertex(e->second); + Vertex_handle vB = c->vertex(e->third); + + // Don't write far edges + if (vA->farPoint() || vB->farPoint()) + { + continue; + } + + // Don't write unowned edges + if (vA->referred() && vB->referred()) + { + continue; + } + + pointFromPoint p1 = topoint(vA->point()); + pointFromPoint p2 = topoint(vB->point()); + + meshTools::writeOBJ(str, p1, p2, count); + } + + if (is_valid()) + { + Info<< " Triangulation is valid" << endl; + } + else + { + FatalErrorIn + ( + "Foam::triangulatedMesh::writeRefinementTriangulation()" + ) << "Triangulation is not valid" + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime) +: + runTime_(runTime), + defaultCellSize_(0.0) +{} + + +//Foam::triangulatedMesh::triangulatedMesh +//( +// const Time& runTime, +// const fileName& pointsFile, +// const fileName& sizesFile, +// const fileName& alignmentsFile, +// const scalar& defaultCellSize +//) +//: +// defaultCellSize_(defaultCellSize) +//{ +// Info<< " Reading points from file : " << pointsFile << endl; +// +// pointIOField points +// ( +// IOobject +// ( +// pointsFile, +// runTime.constant(), +// runTime, +// IOobject::MUST_READ, +// IOobject::NO_WRITE +// ) +// ); +// +// Info<< " Reading sizes from file : " << sizesFile << endl; +// +// scalarIOField sizes +// ( +// IOobject +// ( +// sizesFile, +// runTime.constant(), +// runTime, +// IOobject::MUST_READ, +// IOobject::NO_WRITE +// ) +// ); +// +// Info<< " Reading alignments from file : " << alignmentsFile << endl; +// +// tensorIOField alignments +// ( +// IOobject +// ( +// alignmentsFile, +// runTime.constant(), +// runTime, +// IOobject::MUST_READ, +// IOobject::NO_WRITE +// ) +// ); +// +// Info<< " Number of points : " << points.size() << endl; +// Info<< " Minimum size : " << min(sizes) << endl; +// Info<< " Average size : " << average(sizes) << endl; +// Info<< " Maximum size : " << max(sizes) << endl; +// +// forAll(points, pI) +// { +// size_t nVert = number_of_vertices(); +// +// Vertex_handle v = insert +// ( +// Point(points[pI].x(), points[pI].y(), points[pI].z()) +// ); +// +// if (number_of_vertices() == nVert) +// { +// Info<< " Failed to insert point : " << points[pI] << endl; +// } +// +// v->targetCellSize() = sizes[pI]; +// +// const tensor& alignment = alignments[pI]; +// +// +// +// v->alignment() = alignment; +// } +// +//// scalar factor = 1.0; +//// label maxIteration = 1; +//// +//// for (label iteration = 0; iteration < maxIteration; ++iteration) +//// { +//// Info<< "Iteration : " << iteration << endl; +//// +//// label nRefined = refineTriangulation(factor); +//// +//// Info<< " Number of cells refined in refinement iteration : " +//// << nRefined << nl << endl; +//// +//// if (nRefined <= 0 && iteration != 0) +//// { +//// break; +//// } +//// +//// factor *= 1.5; +//// } +// +// //writeRefinementTriangulation(); +//} + + +//Foam::triangulatedMesh::triangulatedMesh +//( +// const Time& runTime, +// const DynamicList<Foam::point>& points, +// const DynamicList<scalar>& sizes, +// const DynamicList<tensor>& alignments, +// const scalar& defaultCellSize +//) +//: +// defaultCellSize_(defaultCellSize) +//{ +// forAll(points, pI) +// { +// size_t nVert = number_of_vertices(); +// +// Vertex_handle v = insert +// ( +// Point(points[pI].x(), points[pI].y(), points[pI].z()) +// ); +// +// if (number_of_vertices() == nVert) +// { +// Info<< "Failed to insert point : " << points[pI] << endl; +// } +// +// v->targetCellSize() = sizes[pI]; +// +// v->alignment() = alignments[pI]; +// } +// +// //writeRefinementTriangulation(); +// +// Info<< nl << "Refinement triangulation information: " << endl; +// Info<< " Number of vertices: " << label(number_of_vertices()) << endl; +// Info<< " Number of cells : " +// << label(number_of_finite_cells()) << endl; +// Info<< " Number of faces : " +// << label(number_of_finite_facets()) << endl; +// Info<< " Number of edges : " +// << label(number_of_finite_edges()) << endl; +// Info<< " Dimensionality : " << label(dimension()) << nl << endl; +//} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellShapeControlMesh::~cellShapeControlMesh() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::cellShapeControlMesh::barycentricCoords +( + const Foam::point& pt, + scalarList& bary, + Cell_handle& ch +) const +{ + // Use the previous cell handle as a hint on where to start searching + ch = locate + ( + Point(pt.x(), pt.y(), pt.z()) + ); + + if (!is_infinite(ch)) + { + oldCellHandle_ = ch; + + tetPointRef tet + ( + topoint(ch->vertex(0)->point()), + topoint(ch->vertex(1)->point()), + topoint(ch->vertex(2)->point()), + topoint(ch->vertex(3)->point()) + ); + + tet.barycentric(pt, bary); + } +} + + +Foam::boundBox Foam::cellShapeControlMesh::bounds() const +{ + DynamicList<Foam::point> pts(number_of_vertices()); + + for + ( + Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + pts.append(topoint(vit->point())); + } + } + + boundBox bb(pts); + + return bb; +} + + +void Foam::cellShapeControlMesh::distribute +( + const backgroundMeshDecomposition& decomposition +) +{ + if (!Pstream::parRun()) + { + return; + } + + autoPtr<mapDistribute> mapDist = + DistributedDelaunayMesh<CellSizeDelaunay>::distribute(decomposition); + + DynamicList<Foam::point> points(number_of_vertices()); + DynamicList<scalar> sizes(number_of_vertices()); + DynamicList<tensor> alignments(number_of_vertices()); + + for + ( + Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + points.append(topoint(vit->point())); + sizes.append(vit->targetCellSize()); + alignments.append(vit->alignment()); + } + } + + mapDist().distribute(points); + mapDist().distribute(sizes); + mapDist().distribute(alignments); + + // Reset the entire tessellation + DelaunayMesh<CellSizeDelaunay>::reset(); + + Info<< nl << " Inserting distributed tessellation" << endl; + + insertBoundingPoints(decomposition.procBounds()); + + // Internal points have to be inserted first + + DynamicList<Vb> verticesToInsert(points.size()); + + forAll(points, pI) + { + verticesToInsert.append + ( + Vb + ( + toPoint<Point>(points[pI]), + -1, + Vb::vtInternal, + Pstream::myProcNo() + ) + ); + + verticesToInsert.last().targetCellSize() = sizes[pI]; + verticesToInsert.last().alignment() = alignments[pI]; + } + + this->rangeInsertWithInfo + ( + verticesToInsert.begin(), + verticesToInsert.end(), + true + ); + + sync(decomposition.procBounds()); + + Info<< " Total number of vertices after redistribution " + << returnReduce(label(number_of_vertices()), sumOp<label>()) << endl; +} + + +Foam::tensorField Foam::cellShapeControlMesh::dumpAlignments() const +{ + tensorField alignmentsTmp(number_of_vertices(), tensor::zero); + + label count = 0; + for + ( + Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + alignmentsTmp[count++] = vit->alignment(); + } + + return alignmentsTmp; +} + + +void Foam::cellShapeControlMesh::insertBoundingPoints(const boundBox& bb) +{ + boundBox bbInflate = bb; + bbInflate.inflate(10); + + pointField pts = bbInflate.points(); + + forAll(pts, pI) + { + insertFar(pts[pI]); + } +} + + +void Foam::cellShapeControlMesh::write() const +{ + Info<< "Writing cell size and alignment mesh" << endl; + + const fileName name("cellSizeAndAlignmentMesh"); + + // Reindex the cells + label cellCount = 0; + for + ( + Finite_cells_iterator cit = finite_cells_begin(); + cit != finite_cells_end(); + ++cit + ) + { + if (!cit->hasFarPoint() && !is_infinite(cit)) + { + cit->cellIndex() = cellCount++; + } + } + + labelList vertexMap; + labelList cellMap; + + autoPtr<fvMesh> meshPtr = DelaunayMesh<CellSizeDelaunay>::createMesh + ( + name, + runTime_, + vertexMap, + cellMap + ); + const fvMesh& mesh = meshPtr(); + + pointScalarField sizes + ( + IOobject + ( + "sizes", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pointMesh::New(mesh), + scalar(0) + ); + + for + ( + Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (!vit->farPoint()) + { + sizes[vertexMap[vit->index()]] = vit->targetCellSize(); + } + } + + mesh.write(); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H new file mode 100644 index 0000000000000000000000000000000000000000..e6cb37a2c3b097b82af919982f1a512331a6bf03 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.H @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellShapeControlMesh + +Description + +SourceFiles + cellShapeControlMeshI.H + cellShapeControlMesh.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellShapeControlMesh_H +#define cellShapeControlMesh_H + +#include "Time.H" +#include "scalar.H" +#include "point.H" +#include "tensor.H" +#include "triad.H" +#include "fileName.H" +#include "searchableSurfaces.H" +#include "conformationSurfaces.H" +#include "DistributedDelaunayMesh.H" +#include "CGALTriangulation3Ddefs.H" +#include "backgroundMeshDecomposition.H" +#include "boundBox.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class cellShapeControlMesh Declaration +\*---------------------------------------------------------------------------*/ + +class cellShapeControlMesh +: + public DistributedDelaunayMesh<CellSizeDelaunay> +{ +public: + + typedef CellSizeDelaunay::Cell_handle Cell_handle; + typedef CellSizeDelaunay::Vertex_handle Vertex_handle; + typedef CellSizeDelaunay::Point Point; + + +private: + + // Private data + + const Time& runTime_; + + mutable Cell_handle oldCellHandle_; + + const scalar defaultCellSize_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + cellShapeControlMesh(const cellShapeControlMesh&); + + //- Disallow default bitwise assignment + void operator=(const cellShapeControlMesh&); + + +public: + + //- Runtime type information + ClassName("cellShapeControlMesh"); + + + // Constructors + + explicit cellShapeControlMesh(const Time& runTime); + + + //- Destructor + ~cellShapeControlMesh(); + + + // Member Functions + + // Query + + //- Calculate and return the barycentric coordinates for + // interpolating quantities on the background mesh + void barycentricCoords + ( + const Foam::point& pt, + scalarList& bary, + Cell_handle& ch + ) const; + + boundBox bounds() const; + + + // Edit + + label removePoints(); + + //- Get the centres of all the tets + tmp<pointField> cellCentres() const; + + inline Vertex_handle insert + ( + const Foam::point& pt, + const scalar& size, + const triad& alignment, + const Foam::indexedVertexEnum::vertexType type = Vb::vtInternal + ); + + inline Vertex_handle insertFar + ( + const Foam::point& pt + ); + + void distribute + ( + const backgroundMeshDecomposition& decomposition + ); + + tensorField dumpAlignments() const; + + void insertBoundingPoints(const boundBox& bb); + + void writeTriangulation(); + + void write() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "cellShapeControlMeshI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMeshI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMeshI.H new file mode 100644 index 0000000000000000000000000000000000000000..305256d4ccaf924d7c5dc19c867b6812ffa724f0 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMeshI.H @@ -0,0 +1,68 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::cellShapeControlMesh::Vertex_handle Foam::cellShapeControlMesh::insert +( + const Foam::point& pt, + const scalar& size, + const triad& alignment, + const Foam::indexedVertexEnum::vertexType type +) +{ + Vertex_handle v = CellSizeDelaunay::insert + ( + Point(pt.x(), pt.y(), pt.z()) + ); + v->type() = type; + v->index() = getNewVertexIndex(); + v->procIndex() = Pstream::myProcNo(); + v->targetCellSize() = size; + v->alignment() = tensor(alignment.x(), alignment.y(), alignment.z()); + + return v; +} + + +Foam::cellShapeControlMesh::Vertex_handle Foam::cellShapeControlMesh::insertFar +( + const Foam::point& pt +) +{ + Vertex_handle v = CellSizeDelaunay::insert + ( + Point(pt.x(), pt.y(), pt.z()) + ); + v->type() = Vb::vtFar; +// v->type() = Vb::vtExternalFeaturePoint; + v->index() = getNewVertexIndex(); + v->procIndex() = Pstream::myProcNo(); + + return v; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.C new file mode 100644 index 0000000000000000000000000000000000000000..3dce1d518e5d90acd1adf7a7363bf80d8d92f43e --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.C @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellSizeAndAlignmentControl.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(cellSizeAndAlignmentControl, 0); +defineRunTimeSelectionTable(cellSizeAndAlignmentControl, dictionary); + +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellSizeAndAlignmentControl::cellSizeAndAlignmentControl +( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry +) +: + runTime_(runTime), + name_(name), + priority_(readLabel(controlFunctionDict.lookup("priority"))) +{} + + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::cellSizeAndAlignmentControl> +Foam::cellSizeAndAlignmentControl::New +( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry +) +{ + word cellSizeAndAlignmentControlTypeName + ( + controlFunctionDict.lookup("type") + ); + + Info<< nl << "Selecting cellSizeAndAlignmentControl " + << cellSizeAndAlignmentControlTypeName << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find + ( + cellSizeAndAlignmentControlTypeName + ); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "cellSizeAndAlignmentControl::New()" + ) << "Unknown cellSizeAndAlignmentControl type " + << cellSizeAndAlignmentControlTypeName + << endl << endl + << "Valid cellSizeAndAlignmentControl types are :" << endl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr<cellSizeAndAlignmentControl> + ( + cstrIter() + ( + runTime, + name, + controlFunctionDict, + allGeometry + ) + ); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellSizeAndAlignmentControl::~cellSizeAndAlignmentControl() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.H new file mode 100644 index 0000000000000000000000000000000000000000..d8589ba6ef483fc467e491a0a7ac21e95b26e314 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControl.H @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellSizeAndAlignmentControl + +Description + +SourceFiles + cellSizeAndAlignmentControlI.H + cellSizeAndAlignmentControl.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellSizeAndAlignmentControl_H +#define cellSizeAndAlignmentControl_H + +#include "dictionary.H" +#include "conformationSurfaces.H" +#include "Time.H" +#include "quaternion.H" +#include "triad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class cellSizeAndAlignmentControl Declaration +\*---------------------------------------------------------------------------*/ + +class cellSizeAndAlignmentControl +{ +protected: + + const Time& runTime_; + + +private: + + // Private data + + const word name_; + + //- Priority of this cellSizeFunction + label priority_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + cellSizeAndAlignmentControl(const cellSizeAndAlignmentControl&); + + //- Disallow default bitwise assignment + void operator=(const cellSizeAndAlignmentControl&); + + +public: + + //- Runtime type information + TypeName("cellSizeAndAlignmentControl"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + cellSizeAndAlignmentControl, + dictionary, + ( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry + ), + (runTime, name, controlFunctionDict, allGeometry) + ); + + + // Constructors + + //- Construct from dictionary and references to conformalVoronoiMesh and + // searchableSurfaces + cellSizeAndAlignmentControl + ( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry + ); + + + // Selectors + + //- Return a reference to the selected cellShapeControl + static autoPtr<cellSizeAndAlignmentControl> New + ( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry + ); + + + //- Destructor + virtual ~cellSizeAndAlignmentControl(); + + + // Member Functions + + // Access + + const word& name() const + { + return name_; + } + + inline label priority() const + { + return priority_; + } + + + // Query + + virtual void initialVertices + ( + pointField& pts, + scalarField& sizes, + Field<triad>& alignments + ) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControls.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControls.C new file mode 100644 index 0000000000000000000000000000000000000000..44c8852abfcb7430dc834d8de27b5f60372e114b --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControls.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "cellSizeAndAlignmentControls.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls +( + const Time& runTime, + const dictionary& shapeControlDict, + const conformationSurfaces& allGeometry +) +: + shapeControlDict_(shapeControlDict), + allGeometry_(allGeometry), + controlFunctions_(shapeControlDict_.size()) +{ + label functionI = 0; + + forAllConstIter(dictionary, shapeControlDict_, iter) + { + word shapeControlEntryName = iter().keyword(); + + const dictionary& controlFunctionDict + ( + shapeControlDict_.subDict(shapeControlEntryName) + ); + + controlFunctions_.set + ( + functionI, + cellSizeAndAlignmentControl::New + ( + runTime, + shapeControlEntryName, + controlFunctionDict, + allGeometry + ) + ); + + functionI++; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::cellSizeAndAlignmentControls::~cellSizeAndAlignmentControls() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControls.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControls.H new file mode 100644 index 0000000000000000000000000000000000000000..dac3ffc13cea99b7649526bd489e33febac9551b --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/cellSizeAndAlignmentControls.H @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::cellSizeAndAlignmentControls + +Description + +SourceFiles + cellSizeAndAlignmentControls.C + +\*---------------------------------------------------------------------------*/ + +#ifndef cellSizeAndAlignmentControls_H +#define cellSizeAndAlignmentControls_H + +#include "dictionary.H" +#include "cellShapeControlMesh.H" +#include "cellSizeAndAlignmentControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class cellSizeAndAlignmentControls Declaration +\*---------------------------------------------------------------------------*/ + +class cellSizeAndAlignmentControls +{ + // Private data + + const dictionary& shapeControlDict_; + + const conformationSurfaces& allGeometry_; + + PtrList<cellSizeAndAlignmentControl> controlFunctions_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + cellSizeAndAlignmentControls(const cellSizeAndAlignmentControls&); + + //- Disallow default bitwise assignment + void operator=(const cellSizeAndAlignmentControls&); + + +public: + + // Constructors + + //- Construct from dictionary + cellSizeAndAlignmentControls + ( + const Time& runTime, + const dictionary& shapeControlDict, + const conformationSurfaces& allGeometry + ); + + + //- Destructor + virtual ~cellSizeAndAlignmentControls(); + + + // Member Functions + + // Access + + const PtrList<cellSizeAndAlignmentControl>& controlFunctions() const + { + return controlFunctions_; + } + + + // Query +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/fileControl/fileControl.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/fileControl/fileControl.C new file mode 100644 index 0000000000000000000000000000000000000000..ce6cb02bbc766b2c6724927cdf9a9dd975e9434f --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/fileControl/fileControl.C @@ -0,0 +1,242 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fileControl.H" +#include "addToRunTimeSelectionTable.H" +#include "tetrahedron.H" +#include "scalarList.H" +#include "vectorTools.H" +#include "pointIOField.H" +#include "scalarIOField.H" +#include "triadIOField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(fileControl, 0); +addToRunTimeSelectionTable +( + cellSizeAndAlignmentControl, + fileControl, + dictionary +); + +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fileControl::fileControl +( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry +) +: + cellSizeAndAlignmentControl + ( + runTime, + name, + controlFunctionDict, + allGeometry + ), + pointsFile_(controlFunctionDict.lookup("pointsFile")), + sizesFile_(controlFunctionDict.lookup("sizesFile")), + alignmentsFile_(controlFunctionDict.lookup("alignmentsFile")) +{ + Info<< indent << "Loading from file... " << nl + << indent << " points : " << pointsFile_ << nl + << indent << " sizes : " << sizesFile_ << nl + << indent << " alignments : " << alignmentsFile_ + << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fileControl::~fileControl() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +// +//Foam::scalar Foam::fileControl::cellSize(const point& pt) const +//{ +// scalarList bary; +// Cell_handle ch; +// +// triangulatedMesh_.barycentricCoords(pt, bary, ch); +// +// scalar size = 0; +// forAll(bary, pI) +// { +// size += bary[pI]*ch->vertex(pI)->size(); +// } +// +// return size; +//} +// +// +////- Return the cell alignment at the given location +//Foam::tensor Foam::fileControl::cellAlignment(const point& pt) const +//{ +// scalarList bary; +// Cell_handle ch; +// +// triangulatedMesh_.barycentricCoords(pt, bary, ch); +// +// label nearest = 0; +// +// tensor alignment = Foam::tensor::zero; +// forAll(bary, pI) +// { +// //alignment += bary[pI]*ch->vertex(pI)->alignment(); +// +// // Find nearest point +// if (bary[pI] > nearest) +// { +// alignment = ch->vertex(pI)->alignment(); +// nearest = bary[pI]; +// } +// } +// +// return alignment; +//} +// +// +////- Return the cell alignment at the given location +//void Foam::fileControl::cellSizeAndAlignment +//( +// const point& pt, +// scalar& size, +// tensor& alignment +//) const +//{ +// scalarList bary; +// Cell_handle ch; +// +// triangulatedMesh_.barycentricCoords(pt, bary, ch); +// +// size = 0; +// forAll(bary, pI) +// { +// size += bary[pI]*ch->vertex(pI)->size(); +// } +// +//// alignment = Foam::tensor::zero; +//// forAll(bary, pI) +//// { +//// alignment += bary[pI]*ch->vertex(pI)->alignment(); +//// } +// +// alignment = cellAlignment(pt); +//} + + +void Foam::fileControl::initialVertices +( + pointField& pts, + scalarField& sizes, + Field<triad>& alignments +) const +{ + Info<< " Reading points from file : " << pointsFile_ << endl; + + pointIOField pointsTmp + ( + IOobject + ( + pointsFile_, + runTime_.constant(), + runTime_, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + pts.transfer(pointsTmp); + + Info<< " Reading sizes from file : " << sizesFile_ << endl; + + scalarIOField sizesTmp + ( + IOobject + ( + sizesFile_, + runTime_.constant(), + runTime_, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + sizes.transfer(sizesTmp); + + Info<< " Reading alignments from file : " << alignmentsFile_ << endl; + + triadIOField alignmentsTmp + ( + IOobject + ( + alignmentsFile_, + runTime_.constant(), + runTime_, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + alignments.transfer(alignmentsTmp); + + if ((pts.size() != sizes.size()) || (pts.size() != alignments.size())) + { + FatalErrorIn + ( + "Foam::fileControl::initialVertices" + "(" + " pointField&," + " scalarField&," + " Field<triad>&" + ")" + ) << "Size of list of points, sizes and alignments do not match:" + << nl + << "Points size = " << pts.size() << nl + << "Sizes size = " << sizes.size() << nl + << "Alignments size = " << alignments.size() + << abort(FatalError); + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/fileControl/fileControl.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/fileControl/fileControl.H new file mode 100644 index 0000000000000000000000000000000000000000..9c84b516d1afc3ec22fec6f16c9c7a52cfd55f13 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/fileControl/fileControl.H @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::fileControl + +Description + +SourceFiles + fileControl.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fileControl_H +#define fileControl_H + +#include "cellSizeAndAlignmentControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class fileControl Declaration +\*---------------------------------------------------------------------------*/ + +class fileControl +: + public cellSizeAndAlignmentControl +{ + // Private data + + const fileName pointsFile_; + + const fileName sizesFile_; + + const fileName alignmentsFile_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + fileControl(const fileControl&); + + //- Disallow default bitwise assignment + void operator=(const fileControl&); + + +public: + + //- Runtime type information + TypeName("fileControl"); + + + // Constructors + + //- Construct from dictionary and references to conformalVoronoiMesh and + // searchableSurfaces + fileControl + ( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry + ); + + //- Destructor + ~fileControl(); + + + // Member Functions + + // Access + + + // Query + +// //- Return the cell size at the given location +// virtual scalar cellSize(const point& pt) const; +// +// //- Return the cell alignment at the given location +// virtual tensor cellAlignment(const point& pt) const; +// +// virtual void cellSizeAndAlignment +// ( +// const point& pt, +// scalar& size, +// tensor& alignment +// ) const; + + + // Edit + + virtual void initialVertices + ( + pointField& pts, + scalarField& sizes, + Field<triad>& alignments + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C new file mode 100644 index 0000000000000000000000000000000000000000..5350bcdd4acc9acd394046de49ace05645094471 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.C @@ -0,0 +1,667 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "searchableSurfaceControl.H" +#include "addToRunTimeSelectionTable.H" +#include "cellSizeFunction.H" +#include "triSurfaceMesh.H" +#include "searchableBox.H" +#include "tetrahedron.H" +#include "vectorTools.H" +#include "quaternion.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(searchableSurfaceControl, 0); +addToRunTimeSelectionTable +( + cellSizeAndAlignmentControl, + searchableSurfaceControl, + dictionary +); + +} + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +//Foam::tensor Foam::surfaceControl::requiredAlignment +//( +// const Foam::point& pt, +// const vectorField& ptNormals +//) const +//{ +//// pointIndexHit surfHit; +//// label hitSurface; +//// +//// geometryToConformTo_.findSurfaceNearest +//// ( +//// pt, +//// sqr(GREAT), +//// surfHit, +//// hitSurface +//// ); +//// +//// if (!surfHit.hit()) +//// { +//// FatalErrorIn +//// ( +//// "Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment" +//// ) +//// << "findSurfaceNearest did not find a hit across the surfaces." +//// << exit(FatalError) << endl; +//// } +//// +////// Primary alignment +//// +//// vectorField norm(1); +//// +//// allGeometry_[hitSurface].getNormal +//// ( +//// List<pointIndexHit>(1, surfHit), +//// norm +//// ); +//// +//// const vector np = norm[0]; +//// +//// const tensor Rp = rotationTensor(vector(0,0,1), np); +//// +//// return (Rp); +// +//// Info<< "Point : " << pt << endl; +//// forAll(ptNormals, pnI) +//// { +//// Info<< " normal " << pnI << " : " << ptNormals[pnI] << endl; +//// } +// +// vector np = ptNormals[0]; +// +// const tensor Rp = rotationTensor(vector(0,0,1), np); +// +// vector na = vector::zero; +// +// scalar smallestAngle = GREAT; +// +// for (label pnI = 1; pnI < ptNormals.size(); ++pnI) +// { +// const vector& nextNormal = ptNormals[pnI]; +// +// const scalar cosPhi = vectorTools::cosPhi(np, nextNormal); +// +// if (mag(cosPhi) < smallestAngle) +// { +// na = nextNormal; +// smallestAngle = cosPhi; +// } +// } +// +// // Secondary alignment +// vector ns = np ^ na; +// +// if (mag(ns) < SMALL) +// { +// WarningIn("conformalVoronoiMesh::requiredAlignment") +// << "Parallel normals detected in spoke search." << nl +// << "point: " << pt << nl +// << "np : " << np << nl +// << "na : " << na << nl +// << "ns : " << ns << nl +// << endl; +// +// ns = np; +// } +// +// ns /= mag(ns); +// +// tensor Rs = rotationTensor((Rp & vector(0,1,0)), ns); +// +//// Info<< "Point " << pt << nl +//// << " np : " << np << nl +//// << " ns : " << ns << nl +//// << " Rp : " << Rp << nl +//// << " Rs : " << Rs << nl +//// << " Rs&Rp: " << (Rs & Rp) << endl; +// +// return (Rs & Rp); +//} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::searchableSurfaceControl::searchableSurfaceControl +( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry +) +: + cellSizeAndAlignmentControl + ( + runTime, + name, + controlFunctionDict, + allGeometry + ), + searchableSurface_(allGeometry.geometry()[name]), + allGeometry_(allGeometry), + cellSizeFunction_ + ( + cellSizeFunction::New(controlFunctionDict, searchableSurface_) + ) +// geometryToConformTo_(geometryToConformTo), +// surfaces_(), +// cellSizeFunctions_(), +// triangulatedMesh_() +{ +// const dictionary& surfacesDict = coeffDict(); +// +// Info<< nl << "Reading cellSizeControlGeometry" << endl; +// +// surfaces_.setSize(surfacesDict.size()); +// +// cellSizeFunctions_.setSize(surfacesDict.size()); +// +// label surfI = 0; +// +// DynamicList<point> pointsToInsert; +// DynamicList<scalar> sizesToInsert; +// DynamicList<tensor> alignmentsToInsert; +// +// forAllConstIter(dictionary, surfacesDict, iter) +// { +// const dictionary& surfaceSubDict +// ( +// surfacesDict.subDict(iter().keyword()) +// ); +// +// // If the "surface" keyword is not found in the dictionary, assume +// // the name of the dictionary is the surface. Distinction required to +// // allow the same surface to be used multiple times to supply multiple +// // cellSizeFunctions +// +// word surfaceName = surfaceSubDict.lookupOrDefault<word> +// ( +// "surface", +// iter().keyword() +// ); +// +// surfaces_[surfI] = allGeometry_.findSurfaceID(surfaceName); +// +// if (surfaces_[surfI] < 0) +// { +// FatalErrorIn +// ( +// "Foam::surfaceControl::surfaceControl" +// ) << "No surface " << surfaceName << " found. " +// << "Valid geometry is " << nl << allGeometry_.names() +// << exit(FatalError); +// } +// +// const searchableSurface& surface = allGeometry_[surfaces_[surfI]]; +// +// Info<< nl << " " << iter().keyword() << nl +// << " surface: " << surfaceName << nl +// << " size : " << surface.size() << endl; +// +// cellSizeFunctions_.set +// ( +// surfI, +// cellSizeFunction::New +// ( +// surfaceSubDict, +// surface +// ) +// ); +// +// surfI++; +// +// if (isA<triSurfaceMesh>(surface)) +// { +// const triSurfaceMesh& tsm +// = refCast<const triSurfaceMesh>(surface); +// +// const pointField& points = tsm.points(); +// const vectorField& faceNormals = tsm.faceNormals(); +// const labelListList& pointFaces = tsm.pointFaces(); +// +// Info<< " Number of points: " << tsm.nPoints() << endl; +// +// forAll(points, pI) +// { +// const Foam::point& pt = points[pI]; +// const labelList& ptFaces = pointFaces[pI]; +// +// vectorField pointNormals(ptFaces.size()); +// +// forAll(pointNormals, pnI) +// { +// pointNormals[pnI] = faceNormals[ptFaces[pnI]]; +// } +// +// pointsToInsert.append(pt); +// +// // Get the value of the point from surfaceCellSizeFunction. If +// // adding points internally then will need to interpolate. +// scalar newSize = 0; +// +// cellSizeFunctions_[surfI - 1].cellSize(pt, newSize); +// sizesToInsert.append(newSize); +// +// tensor newAlignment = requiredAlignment(pt, pointNormals); +// +// alignmentsToInsert.append(newAlignment); +// } +// } +// } +// +// // Add the global bound box to ensure that all internal point queries +// // will return sizes and alignments +//// boundBox bb = allGeometry_.bounds(); +//// +//// pointField bbPoints = bb.points(); +//// +//// forAll(bbPoints, pI) +//// { +//// pointsToInsert.append(bbPoints[pI]); +//// sizesToInsert.append(defaultCellSize()); +//// alignmentsToInsert.append(tensor(1,0,0,0,1,0,0,0,1)); +//// } +// +// triangulatedMesh_.set +// ( +// new triangulatedMesh +// ( +// runTime, +// pointsToInsert, +// sizesToInsert, +// alignmentsToInsert, +// defaultCellSize() +// ) +// ); +// +// scalar factor = 1.0; +// label maxIteration = cellShapeControlDict.lookupOrDefault<label> +// ( +// "maxRefinementIterations", 1 +// ); +// +// +// for (label iteration = 0; iteration < maxIteration; ++iteration) +// { +// Info<< "Iteration : " << iteration << endl; +// +// label nRefined = triangulatedMesh_().refineTriangulation +// ( +// factor, +// allGeometry_, +// geometryToConformTo_ +// ); +// +// Info<< " Number of cells refined in refinement iteration : " +// << nRefined << nl << endl; +// +// if (nRefined <= 0 && iteration != 0) +// { +// break; +// } +// +// factor *= 1.5; +// } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::searchableSurfaceControl::~searchableSurfaceControl() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +//Foam::scalar Foam::surfaceControl::cellSize(const point& pt) const +//{ +// scalarList bary; +// Cell_handle ch; +// +// triangulatedMesh_().barycentricCoords(pt, bary, ch); +// +// scalar size = 0; +// forAll(bary, pI) +// { +// size += bary[pI]*ch->vertex(pI)->size(); +// } +// +// return size; +//} +// +// +////- Return the cell alignment at the given location +//Foam::tensor Foam::surfaceControl::cellAlignment(const point& pt) const +//{ +// scalarList bary; +// Cell_handle ch; +// +// triangulatedMesh_().barycentricCoords(pt, bary, ch); +// +//// vectorField cartesianDirections(3); +//// +//// cartesianDirections[0] = vector(0,0,1); +//// cartesianDirections[1] = vector(0,1,0); +//// cartesianDirections[2] = vector(1,0,0); +//// +//// // Rearrange each alignment tensor so that the x/y/z components are +//// // in order of whichever makes the smallest angle with the global +//// // coordinate system +//// FixedList<tensor, 4> alignments; +//// +//// forAll(alignments, aI) +//// { +//// tensor a = ch->vertex(aI)->alignment(); +//// +//// tensor tmpA = a; +//// +////// Info<< nl << indent<< a << endl; +//// +//// scalar minAngle = 0; +//// +//// scalar axx = vectorTools::cosPhi(a.x(), cartesianDirections[0]); +//// scalar axy = vectorTools::cosPhi(a.y(), cartesianDirections[0]); +//// scalar axz = vectorTools::cosPhi(a.z(), cartesianDirections[0]); +//// +//// scalar ayx = vectorTools::cosPhi(a.x(), cartesianDirections[1]); +//// scalar ayy = vectorTools::cosPhi(a.y(), cartesianDirections[1]); +//// scalar ayz = vectorTools::cosPhi(a.z(), cartesianDirections[1]); +//// +//// scalar azx = vectorTools::cosPhi(a.x(), cartesianDirections[2]); +//// scalar azy = vectorTools::cosPhi(a.y(), cartesianDirections[2]); +//// scalar azz = vectorTools::cosPhi(a.z(), cartesianDirections[2]); +//// +////// Info<< indent << axx << " " << axy << " " << axz << nl +////// << indent << ayx << " " << ayy << " " << ayz << nl +////// << indent << azx << " " << azy << " " << azz << endl; +//// +//// if (mag(axx) >= minAngle) +//// { +//// tmpA.xx() = mag(a.xx()); +//// tmpA.xy() = mag(a.xy()); +//// tmpA.xz() = mag(a.xz()); +//// minAngle = mag(axx); +//// } +//// if (mag(axy) >= minAngle) +//// { +//// tmpA.xx() = mag(a.yx()); +//// tmpA.xy() = mag(a.yy()); +//// tmpA.xz() = mag(a.yz()); +//// minAngle = mag(axy); +//// } +//// if (mag(axz) >= minAngle) +//// { +//// tmpA.xx() = mag(a.zx()); +//// tmpA.xy() = mag(a.zy()); +//// tmpA.xz() = mag(a.zz()); +//// } +//// +//// minAngle = 0; +//// +//// if (mag(ayx) >= minAngle) +//// { +//// tmpA.yx() = mag(a.xx()); +//// tmpA.yy() = mag(a.xy()); +//// tmpA.yz() = mag(a.xz()); +//// minAngle = mag(ayx); +//// } +//// if (mag(ayy) >= minAngle) +//// { +//// tmpA.yx() = mag(a.yx()); +//// tmpA.yy() = mag(a.yy()); +//// tmpA.yz() = mag(a.yz()); +//// minAngle = mag(ayy); +//// } +//// if (mag(ayz) >= minAngle) +//// { +//// tmpA.yx() = mag(a.zx()); +//// tmpA.yy() = mag(a.zy()); +//// tmpA.yz() = mag(a.zz()); +//// } +//// +//// minAngle = 0; +//// +//// if (mag(azx) >= minAngle) +//// { +//// tmpA.zx() = mag(a.xx()); +//// tmpA.zy() = mag(a.xy()); +//// tmpA.zz() = mag(a.xz()); +//// minAngle = mag(azx); +//// } +//// if (mag(azy) >= minAngle) +//// { +//// tmpA.zx() = mag(a.yx()); +//// tmpA.zy() = mag(a.yy()); +//// tmpA.zz() = mag(a.yz()); +//// minAngle = mag(azy); +//// } +//// if (mag(azz) >= minAngle) +//// { +//// tmpA.zx() = mag(a.zx()); +//// tmpA.zy() = mag(a.zy()); +//// tmpA.zz() = mag(a.zz()); +//// } +//// +//// alignments[aI] = tmpA; +//// } +// +// scalar nearest = 0; +// +//// Info<< nl << "Point " << pt << endl; +//// +//// FixedList<quaternion, 4> qAlignments; +//// forAll(qAlignments, aI) +//// { +////// Info<< " Direction " << aI << endl; +////// Info<< " Rot tensor" << alignments[aI] << endl; +//// qAlignments[aI] = quaternion(alignments[aI]); +//// qAlignments[aI].normalize(); +////// Info<< " Quaternion: " << qAlignments[aI] << endl; +////// Info<< " Rot tensor from quat: " << qAlignments[aI].R() +////// << endl; +//// } +// +// tensor alignment = Foam::tensor::zero; +// forAll(bary, pI) +// { +//// alignment += bary[pI]*ch->vertex(pI)->alignment(); +// +//// alignment += bary[pI]*alignments[pI]; +// +// // Try slerp with quaternions +// +// // Find nearest point +// if (bary[pI] > nearest) +// { +// alignment = ch->vertex(pI)->alignment(); +// nearest = bary[pI]; +// } +// } +// +//// quaternion alignment; +// +//// alignment = qAlignments[0]*bary[0] +//// + qAlignments[1]*bary[1] +//// + qAlignments[2]*bary[2] +//// + qAlignments[3]*bary[3]; +// +//// alignment = +//// slerp(qAlignments[0], qAlignments[1], bary[0]+bary[1]+bary[2]); +//// alignment = slerp(alignment, qAlignments[2], bary[0]+bary[1]+bary[2]); +//// alignment = slerp(alignment, qAlignments[3], bary[0]+bary[1]+bary[2]); +//// alignment = +//// slerp(alignment, qAlignments[0], bary[0]/(bary[0]+bary[1]+bary[2])); +// +//// Info<< " Interp alignment : " << alignment << endl; +//// Info<< " Interp rot tensor: " << alignment.R() << endl; +// +// return alignment; +//} +// +// +//void Foam::surfaceControl::cellSizeAndAlignment +//( +// const point& pt, +// scalar& size, +// tensor& alignment +//) const +//{ +// scalarList bary; +// Cell_handle ch; +// +// triangulatedMesh_().barycentricCoords(pt, bary, ch); +// +// size = 0; +// forAll(bary, pI) +// { +// size += bary[pI]*ch->vertex(pI)->size(); +// } +// +//// alignment = Foam::tensor::zero; +//// forAll(bary, pI) +//// { +//// alignment += bary[pI]*ch->vertex(pI)->alignment(); +//// } +// +// alignment = cellAlignment(pt); +//} + + +void Foam::searchableSurfaceControl::initialVertices +( + pointField& pts, + scalarField& sizes, + Field<triad>& alignments +) const +{ + pts = searchableSurface_.points(); + + const scalar nearFeatDistSqrCoeff = 1e-8; + + sizes.setSize(pts.size()); + alignments.setSize(pts.size()); + + forAll(pts, pI) + { + // Is the point in the extendedFeatureEdgeMesh? If so get the + // point normal, otherwise get the surface normal from + // searchableSurface + + pointIndexHit info; + label infoFeature; + allGeometry_.findFeaturePointNearest + ( + pts[pI], + nearFeatDistSqrCoeff, + info, + infoFeature + ); + + autoPtr<triad> pointAlignment; + + if (info.hit()) + { + const extendedFeatureEdgeMesh& features = + allGeometry_.features()[infoFeature]; + + vectorField norms = features.featurePointNormals(info.index()); + + // Create a triad from these norms. + pointAlignment.set(new triad()); + forAll(norms, nI) + { + pointAlignment() += norms[nI]; + } + + pointAlignment().normalize(); + pointAlignment().orthogonalize(); + } + else + { + allGeometry_.findEdgeNearest + ( + pts[pI], + nearFeatDistSqrCoeff, + info, + infoFeature + ); + + if (info.hit()) + { + const extendedFeatureEdgeMesh& features = + allGeometry_.features()[infoFeature]; + + vectorField norms = features.edgeNormals(info.index()); + + // Create a triad from these norms. + pointAlignment.set(new triad()); + forAll(norms, nI) + { + pointAlignment() += norms[nI]; + } + + pointAlignment().normalize(); + pointAlignment().orthogonalize(); + } + else + { + pointField ptField(1, pts[pI]); + scalarField distField(1, nearFeatDistSqrCoeff); + List<pointIndexHit> infoList(1, pointIndexHit()); + + searchableSurface_.findNearest(ptField, distField, infoList); + + vectorField normals(1); + searchableSurface_.getNormal(infoList, normals); + + pointAlignment.set(new triad(normals[0])); + } + } + + if (!cellSizeFunction_().cellSize(pts[pI], sizes[pI])) + { + FatalErrorIn + ( + "Foam::searchableSurfaceControl::initialVertices" + "(pointField&, scalarField&, tensorField&)" + ) << "Could not calculate cell size" + << abort(FatalError); + } + + alignments[pI] = pointAlignment(); + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.H new file mode 100644 index 0000000000000000000000000000000000000000..9ecc3a0ac8ef572526d6e982b58b67d9af0ddf67 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellShapeControl/cellSizeAndAlignmentControl/searchableSurfaceControl/searchableSurfaceControl.H @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::searchableSurfaceControl + +Description + +SourceFiles + searchableSurfaceControl.C + +\*---------------------------------------------------------------------------*/ + +#ifndef searchableSurfaceControl_H +#define searchableSurfaceControl_H + +#include "cellShapeControl.H" +#include "cellSizeFunction.H" +#include "triad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class surfaceControl Declaration +\*---------------------------------------------------------------------------*/ + +class searchableSurfaceControl +: + public cellSizeAndAlignmentControl +{ + // Private data + + //- Reference to the searchableSurface object holding the geometry + // data + const searchableSurface& searchableSurface_; + + const conformationSurfaces& allGeometry_; + + autoPtr<cellSizeFunction> cellSizeFunction_; + + +// const conformationSurfaces& geometryToConformTo_; +// +// //- Indices of surfaces in allGeometry that are to be conformed to +// labelList surfaces_; +// +// //- A list of all of the cellSizeFunction objects +// PtrList<cellSizeFunction> cellSizeFunctions_; +// +// autoPtr<triangulatedMesh> triangulatedMesh_; +// +// +// // Private Member Functions +// +// //- +// tensor requiredAlignment +// ( +// const point& pt, +// const vectorField& ptNormals +// ) const; + + //- Disallow default bitwise copy construct + searchableSurfaceControl(const searchableSurfaceControl&); + + //- Disallow default bitwise assignment + void operator=(const searchableSurfaceControl&); + + +public: + + //- Runtime type information + TypeName("searchableSurfaceControl"); + + + // Constructors + + //- Construct from dictionary and references to conformalVoronoiMesh and + // searchableSurfaces + searchableSurfaceControl + ( + const Time& runTime, + const word& name, + const dictionary& controlFunctionDict, + const conformationSurfaces& allGeometry + ); + + //- Destructor + ~searchableSurfaceControl(); + + + // Member Functions + + // Access + +// //- Return reference to the searchableSurfaces object containing +// // all of the geometry +// inline const searchableSurfaces& geometry() const; +// +// //- Return the surface indices +// inline const labelList& surfaces() const; +// +// +// // Query +// +// //- Return the cell size at the given location +// virtual scalar cellSize(const point& pt) const; +// +// //- Return the cell alignment at the given location +// virtual tensor cellAlignment(const point& pt) const; +// +// virtual void cellSizeAndAlignment +// ( +// const point& pt, +// scalar& size, +// tensor& alignment +// ) const; + + virtual void initialVertices + ( + pointField& pts, + scalarField& sizes, + Field<triad>& alignments + ) const; + + const cellSizeFunction& sizeFunction() const + { + return cellSizeFunction_(); + } + + // Edit + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C index 0b6acc5ca0853e86fb48f399b10d670cb0b24aea..1cc41dc29cc90c1193f4e02a1a7f78435c3431f7 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.C @@ -26,6 +26,9 @@ License #include "cellSizeControlSurfaces.H" #include "conformalVoronoiMesh.H" #include "cellSizeFunction.H" +#include "triSurfaceMesh.H" +#include "tetrahedron.H" +#include "OFstream.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -149,15 +152,358 @@ bool Foam::cellSizeControlSurfaces::evalCellSizeFunctions } +bool Foam::cellSizeControlSurfaces::checkCoplanarTet +( + Cell_handle c, + const scalar tol +) const +{ + plane triPlane + ( + topoint(c->vertex(0)->point()), + topoint(c->vertex(1)->point()), + topoint(c->vertex(2)->point()) + ); + + // Check if the four points are roughly coplanar. If they are then we + // cannot calculate the circumcentre. Better test might be the volume + // of the tet. + if (triPlane.distance(topoint(c->vertex(3)->point())) < tol) + { + return true; + } + + return false; +} + + +bool Foam::cellSizeControlSurfaces::checkClosePoints +( + Cell_handle c, + const scalar tol +) const +{ + for (label v = 0; v < 4; ++v) + { + for (label vA = v + 1; vA < 4; ++vA) + { + if + ( + mag + ( + topoint(c->vertex(v)->point()) + - topoint(c->vertex(vA)->point()) + ) + < tol + ) + { + return true; + } + } + } + + return false; +} + + +Foam::label Foam::cellSizeControlSurfaces::refineTriangulation +( + const scalar factor +) +{ + // Check the tets and insert new points if necessary + List<Foam::point> corners(4); + List<scalar> values(4); + + DynamicList<Foam::point> pointsToInsert(T_.number_of_vertices()); + DynamicList<scalar> valuesToInsert(T_.number_of_vertices()); + + for + ( + Delaunay::Finite_cells_iterator c = T_.finite_cells_begin(); + c != T_.finite_cells_end(); + ++c + ) + { + //const point& newPoint = tet.centre(); + //Cell_handle ch = c; + +// Info<< count++ << endl; +// Info<< " " << topoint(c->vertex(0)->point()) << nl +// << " " << topoint(c->vertex(1)->point()) << nl +// << " " << topoint(c->vertex(2)->point()) << nl +// << " " << topoint(c->vertex(3)->point()) << endl; + + scalar minDist = 1e-6*defaultCellSize_; + + if (checkClosePoints(c, minDist) || checkCoplanarTet(c, minDist)) + { + continue; + } + + const Point circumcenter = CGAL::circumcenter + ( + c->vertex(0)->point(), + c->vertex(1)->point(), + c->vertex(2)->point(), + c->vertex(3)->point() + ); + + pointFromPoint newPoint = topoint(circumcenter); + + if (geometryToConformTo_.outside(newPoint)) + { + continue; + } + + Cell_handle ch = T_.locate + ( + Point(newPoint.x(), newPoint.y(), newPoint.z()) + ); + + forAll(corners, pI) + { + corners[pI] = topoint(ch->vertex(pI)->point()); + values[pI] = ch->vertex(pI)->value(); + } + + tetPointRef tet(corners[0], corners[1], corners[2], corners[3]); + + scalarList bary; + tet.barycentric(newPoint, bary); + + scalar interpolatedSize = 0; + forAll(bary, pI) + { + interpolatedSize += bary[pI]*ch->vertex(pI)->value(); + } + + // Find largest gradient + label maxGradCorner = -1; + scalar maxGradient = 0.0; + forAll(corners, pI) + { + const scalar distance = mag(newPoint - corners[pI]); + const scalar diffSize = interpolatedSize - values[pI]; + + const scalar gradient = diffSize/distance; + + if (gradient > maxGradient) + { + maxGradient = gradient; + maxGradCorner = pI; + } + } + +// if (wallSize < 0.5*defaultCellSize_) +// { +// Info<< "Centre : " << centre +// << " (Default Size: " << defaultCellSize_ << ")" << nl +// << "Interpolated Size : " << interpolatedSize << nl +// << "Distance from wall : " << distanceSize << nl +// << "Wall size : " << wallSize << nl +// << "distanceGradient : " << distanceGradient << nl +// << "interpGradient : " << interpolatedGradient << nl << endl; +// } + + scalar minCellSize = 1e-6; + scalar initialMaxGradient = 0;//0.2*factor; + scalar initialMinGradient = 0;//0.01*(1.0/factor); + scalar idealGradient = 0.2; + + + + // Reduce strong gradients + if (maxGradient > initialMaxGradient) + { + const scalar distance2 = mag(newPoint - corners[maxGradCorner]); + + scalar newSize + = values[maxGradCorner] + idealGradient*distance2; + + pointsToInsert.append(newPoint); + valuesToInsert.append + ( + max(min(newSize, defaultCellSize_), minCellSize) + ); + } + else if (maxGradient < -initialMaxGradient) + { + const scalar distance2 = mag(newPoint - corners[maxGradCorner]); + + scalar newSize + = values[maxGradCorner] - idealGradient*distance2; + + pointsToInsert.append(newPoint); + valuesToInsert.append + ( + max(min(newSize, defaultCellSize_), minCellSize) + ); + } + + // Increase small gradients + if + ( + maxGradient < initialMinGradient + && maxGradient > 0 + && interpolatedSize < 0.5*defaultCellSize_ + ) + { + const scalar distance2 = mag(newPoint - corners[maxGradCorner]); + + scalar newSize + = values[maxGradCorner] + idealGradient*distance2; + + pointsToInsert.append(newPoint); + valuesToInsert.append + ( + max(min(newSize, defaultCellSize_), minCellSize) + ); + } + else if + ( + maxGradient > -initialMinGradient + && maxGradient < 0 + && interpolatedSize > 0.5*defaultCellSize_ + ) + { + const scalar distance2 = mag(newPoint - corners[maxGradCorner]); + + scalar newSize + = values[maxGradCorner] - idealGradient*distance2; + + pointsToInsert.append(newPoint); + valuesToInsert.append + ( + max(min(newSize, defaultCellSize_), minCellSize) + ); + } + } + + if (!pointsToInsert.empty()) + { + Info<< " Minimum Cell Size : " << min(valuesToInsert) << nl + << " Average Cell Size : " << average(valuesToInsert) << nl + << " Maximum Cell Size : " << max(valuesToInsert) << endl; + + forAll(pointsToInsert, pI) + { + Foam::point p = pointsToInsert[pI]; + + Vertex_handle v = T_.insert(Point(p.x(), p.y(), p.z())); + + v->value(valuesToInsert[pI]); + } + } + + return pointsToInsert.size(); +} + + +void Foam::cellSizeControlSurfaces::writeRefinementTriangulation() +{ + OFstream str("refinementTriangulation.obj"); + + label count = 0; + + Info<< "Write refinementTriangulation" << endl; + + for + ( + Delaunay::Finite_edges_iterator e = T_.finite_edges_begin(); + e != T_.finite_edges_end(); + ++e + ) + { + Cell_handle c = e->first; + Vertex_handle vA = c->vertex(e->second); + Vertex_handle vB = c->vertex(e->third); + + pointFromPoint p1 = topoint(vA->point()); + pointFromPoint p2 = topoint(vB->point()); + + meshTools::writeOBJ(str, p1, p2, count); + } + + + OFstream strPoints("refinementObject.obj"); + + Info<< "Write refinementObject" << endl; + + for + ( + Delaunay::Finite_vertices_iterator v = T_.finite_vertices_begin(); + v != T_.finite_vertices_end(); + ++v + ) + { + pointFromPoint p = topoint(v->point()); + + meshTools::writeOBJ + ( + strPoints, + p, + point(p.x() + v->value(), p.y(), p.z()) + ); + } + +// OFstream strDual("refinementDualPoints.obj"); +// +// Info<< "Write refinementDualPoints" << endl; +// +// for +// ( +// Delaunay::Finite_cells_iterator c = T_.finite_cells_begin(); +// c != T_.finite_cells_end(); +// ++c +// ) +// { +// Point circumcenter = CGAL::circumcenter +// ( +// c->vertex(0)->point(), +// c->vertex(1)->point(), +// c->vertex(2)->point(), +// c->vertex(3)->point() +// ); +// +// pointFromPoint p = topoint(circumcenter); +// +// if (geometryToConformTo_.inside(p)) +// { +// meshTools::writeOBJ +// ( +// strDual, +// p +// ); +// } +// } + + if (T_.is_valid()) + { + Info<< " Triangulation is valid" << endl; + } + else + { + FatalErrorIn + ( + "Foam::cellSizeControlSurfaces::writeRefinementTriangulation()" + ) << "Triangulation is not valid" + << abort(FatalError); + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::cellSizeControlSurfaces::cellSizeControlSurfaces ( const searchableSurfaces& allGeometry, + const conformationSurfaces& geometryToConformTo, const dictionary& motionControlDict ) : allGeometry_(allGeometry), + geometryToConformTo_(geometryToConformTo), surfaces_(), cellSizeFunctions_(), defaultCellSize_(readScalar(motionControlDict.lookup("defaultCellSize"))), @@ -214,7 +560,8 @@ Foam::cellSizeControlSurfaces::cellSizeControlSurfaces const searchableSurface& surface = allGeometry_[surfaces_[surfI]]; Info<< nl << " " << iter().keyword() << nl - << " surface: " << surfaceName << endl; + << " surface: " << surfaceName << nl + << " size : " << surface.size() << endl; cellSizeFunctions_.set ( @@ -229,11 +576,78 @@ Foam::cellSizeControlSurfaces::cellSizeControlSurfaces priorities[surfI] = cellSizeFunctions_[surfI].priority(); surfI++; + + if (isA<triSurfaceMesh>(surface)) + { + const triSurfaceMesh& tsm + = refCast<const triSurfaceMesh>(surface); + + const pointField& points = tsm.points(); + + Info<< " number of points: " << tsm.nPoints() << endl; + + std::vector<std::pair<Point, scalar> > pointsToInsert; + + forAll(points, pI) + { + size_t nVert = T_.number_of_vertices(); + + Vertex_handle v = T_.insert + ( + Point(points[pI].x(), points[pI].y(), points[pI].z()) + ); + + if (T_.number_of_vertices() == nVert) + { + Info<< "Failed to insert point : " << points[pI] << endl; + } + + // Get the value of the point from surfaceCellSizeFunction. If + // adding points internally then will need to interpolate. + scalar newSize = 0; + cellSizeFunctions_[surfI-1].cellSize(points[pI], newSize); + v->value(newSize); + } + } } + scalar factor = 1.0; + label maxIteration = 1; + + for (label iteration = 0; iteration < maxIteration; ++iteration) + { + Info<< "Iteration : " << iteration << endl; + + label nRefined = refineTriangulation(factor); + + Info<< " Number of cells refined in refinement iteration : " + << nRefined << nl << endl; + + if (nRefined <= 0 && iteration != 0) + { + break; + } + + factor *= 1.5; + } + + writeRefinementTriangulation(); + + Info<< nl << "Refinement triangulation information: " << endl; + Info<< " Number of vertices: " << label(T_.number_of_vertices()) << endl; + Info<< " Number of cells : " + << label(T_.number_of_finite_cells()) << endl; + Info<< " Number of faces : " + << label(T_.number_of_finite_facets()) << endl; + Info<< " Number of edges : " + << label(T_.number_of_finite_edges()) << endl; + Info<< " Dimensionality : " << label(T_.dimension()) << nl << endl; + + // Sort cellSizeFunctions_ and surfaces_ by priority. Cut off any surfaces // where priority < defaultPriority_ + labelList sortedIndices; sortedOrder(priorities, sortedIndices); @@ -282,8 +696,40 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize { scalar size = defaultCellSize_; -// bool anyFunctionFound = evalCellSizeFunctions(pt, size); - evalCellSizeFunctions(pt, size); + bool refinementTriangulationSwitch = true; + + if (!refinementTriangulationSwitch) + { + evalCellSizeFunctions(pt, size); + } + else + { + Cell_handle ch = T_.locate + ( + Point(pt.x(), pt.y(), pt.z()), + oldCellHandle_ + ); + + oldCellHandle_ = ch; + + pointFromPoint pA = topoint(ch->vertex(0)->point()); + pointFromPoint pB = topoint(ch->vertex(1)->point()); + pointFromPoint pC = topoint(ch->vertex(2)->point()); + pointFromPoint pD = topoint(ch->vertex(3)->point()); + + tetPointRef tet(pA, pB, pC, pD); + + scalarList bary; + tet.barycentric(pt, bary); + + scalar value = 0; + forAll(bary, pI) + { + value += bary[pI]*ch->vertex(pI)->value(); + } + + size = value; + } //if (!anyFunctionFound) //{ diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H index 9f522f0dfcf2d2121f15a5b02127bd6f0e72549b..de3e9d75c1147da334f6a9db9b624d63fb78d1bc 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeControlSurfaces.H @@ -37,9 +37,92 @@ SourceFiles #include "searchableSurfaces.H" #include "searchableSurfacesQueries.H" +#include "conformationSurfaces.H" + +#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> +#include <CGAL/Delaunay_triangulation_3.h> +#include <CGAL/Triangulation_vertex_base_with_info_3.h> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template < class GT, class Vb = CGAL::Triangulation_vertex_base_3<GT> > +class vertexWithInfo +: + public Vb +{ +public: + + Foam::scalar value_; + + Foam::tensor alignment_; + + typedef typename Vb::Vertex_handle Vertex_handle; + typedef typename Vb::Cell_handle Cell_handle; + typedef typename Vb::Point Point; + + template < class TDS2 > + struct Rebind_TDS + { + typedef typename Vb::template Rebind_TDS<TDS2>::Other Vb2; + typedef vertexWithInfo<GT, Vb2> Other; + }; + + vertexWithInfo() + : + Vb(), + value_(0.0), + alignment_(Foam::tensor::zero) + {} + + explicit vertexWithInfo(const Point& p) + : + Vb(p), + value_(0.0), + alignment_(Foam::tensor::zero) + {} + + vertexWithInfo(const Point& p, const Foam::scalar& value) + : + Vb(p), + value_(value), + alignment_(Foam::tensor::zero) + {} + + vertexWithInfo + ( + const Point& p, + const Foam::scalar& value, + const Foam::tensor& alignment + ) + : + Vb(p), + value_(value), + alignment_(alignment) + {} + + + const Foam::scalar& value() const + { + return value_; + } + + void value(const Foam::scalar& value) + { + value_ = value; + } + + const Foam::tensor& alignment() const + { + return alignment_; + } + + void alignment(const Foam::tensor& alignment) + { + alignment_ = alignment; + } +}; + + namespace Foam { @@ -55,11 +138,29 @@ class cellSizeFunction; class cellSizeControlSurfaces { + typedef CGAL::Exact_predicates_inexact_constructions_kernel K; + typedef CGAL::Triangulation_data_structure_3<vertexWithInfo<K> > Tds; + + typedef CGAL::Delaunay_triangulation_3<K, Tds, CGAL::Fast_location> + Delaunay; + + typedef Delaunay::Cell_handle Cell_handle; + typedef Delaunay::Vertex_handle Vertex_handle; + typedef Delaunay::Locate_type Locate_type; + typedef Delaunay::Point Point; + + Delaunay T_; + + mutable Cell_handle oldCellHandle_; + + // Private data //- Reference to the searchableSurfaces object holding all geometry data const searchableSurfaces& allGeometry_; + const conformationSurfaces& geometryToConformTo_; + //- Indices of surfaces in allGeometry that are to be conformed to labelList surfaces_; @@ -84,6 +185,14 @@ class cellSizeControlSurfaces scalar& minSize ) const; + bool checkCoplanarTet(Cell_handle c, const scalar tol) const; + + bool checkClosePoints(Cell_handle c, const scalar tol) const; + + label refineTriangulation(const scalar factor); + + void writeRefinementTriangulation(); + //- Disallow default bitwise copy construct cellSizeControlSurfaces(const cellSizeControlSurfaces&); @@ -104,6 +213,7 @@ public: cellSizeControlSurfaces ( const searchableSurfaces& allGeometry, + const conformationSurfaces& geometryToConformTo, const dictionary& motionControlDict ); diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C index 127613362347607caaed2a085ec3c9c305918d3f..995d10fdc378838042123ad75d5a603831abc46d 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.C @@ -56,8 +56,7 @@ Foam::cellSizeFunction::cellSizeFunction ) ), coeffsDict_(subDict(type + "Coeffs")), - sideMode_(), - priority_(readLabel(cellSizeFunctionDict.lookup("priority"))) + sideMode_() { word mode = cellSizeFunctionDict.lookup("mode"); @@ -77,7 +76,7 @@ Foam::cellSizeFunction::cellSizeFunction } else { - FatalErrorIn("cellSizeFunction::cellSizeFunction") + FatalErrorIn("searchableSurfaceControl::searchableSurfaceControl") << "Unknown mode, expected: inside, outside or bothSides" << nl << exit(FatalError); } @@ -86,7 +85,7 @@ Foam::cellSizeFunction::cellSizeFunction { if (mode != "bothSides") { - WarningIn("cellSizeFunction::cellSizeFunction") + WarningIn("searchableSurfaceControl::searchableSurfaceControl") << "surface does not support volumeType, defaulting mode to " << "bothSides." << endl; diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H index 1e6fd4442eb96d415aa7b3555b978cf2a04ba09e..58ee5d5e0fd18a7cf7d406378437562bb495fc10 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/cellSizeFunction/cellSizeFunction/cellSizeFunction.H @@ -59,9 +59,6 @@ class cellSizeFunction public: - //- Runtime type information - TypeName("cellSizeFunction"); - //- Surface side mode enum sideMode { @@ -70,6 +67,9 @@ public: rmBothsides // Control on both sides of a surface }; + //- Runtime type information + TypeName("cellSizeFunction"); + protected: @@ -97,9 +97,6 @@ protected: //- Mode of size specification, i.e. inside, outside or bothSides sideMode sideMode_; - //- Priority of this cellSizeFunction - label priority_; - private: @@ -162,11 +159,6 @@ public: return coeffsDict_; } - inline label priority() const - { - return priority_; - } - //- Modify scalar argument to the cell size specified by function. // Return a boolean specifying if the function was used, i.e. false if // the point was not in range of the surface for a spatially varying diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C index d30cc2a5ffebe0efc12b7b8e36c7c6f68dcf1847..e8f09cf5f111d088cfb60838c3e53d7432147ca7 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.C @@ -26,6 +26,7 @@ License #include "automatic.H" #include "addToRunTimeSelectionTable.H" #include "triSurfaceMesh.H" +#include "vtkSurfaceWriter.H" #include "Time.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -36,6 +37,59 @@ namespace Foam addToRunTimeSelectionTable(cellSizeCalculationType, automatic, dictionary); } + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::automatic::smoothField(triSurfaceScalarField& surf) +{ + label nSmoothingIterations = 10; + + for (label iter = 0; iter < nSmoothingIterations; ++iter) + { + const pointField& faceCentres = surface_.faceCentres(); + + forAll(surf, sI) + { + const labelList& faceFaces = surface_.faceFaces()[sI]; + + const point& fC = faceCentres[sI]; + const scalar value = surf[sI]; + + scalar newValue = 0; + scalar totalDist = 0; + + label nFaces = 0; + + forAll(faceFaces, fI) + { + const label faceLabel = faceFaces[fI]; + const point& faceCentre = faceCentres[faceLabel]; + + const scalar faceValue = surf[faceLabel]; + const scalar distance = mag(faceCentre - fC); + + newValue += faceValue/distance; + + totalDist += 1.0/distance; + + if (value < faceValue) + { + nFaces++; + } + } + + // Do not smooth out the peak values + if (nFaces == faceFaces.size()) + { + //continue; + } + + surf[sI] = newValue/totalDist; + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::automatic::automatic @@ -90,7 +144,8 @@ Foam::triSurfaceScalarField Foam::automatic::load() if (readCurvature_) { - Info<< indent << "Reading curvature: " << curvatureFile_ << endl; + Info<< indent << "Reading curvature : " + << curvatureFile_ << endl; triSurfacePointScalarField curvature ( @@ -174,7 +229,7 @@ Foam::triSurfaceScalarField Foam::automatic::load() if (readFeatureProximity_) { - Info<< indent << "Reading feature proximity: " + Info<< indent << "Reading feature proximity : " << featureProximityFile_ << endl; triSurfaceScalarField featureProximity @@ -204,8 +259,34 @@ Foam::triSurfaceScalarField Foam::automatic::load() } } + smoothField(surfaceCellSize); + surfaceCellSize.write(); + debug = 1; + + if (debug) + { + faceList faces(surface_.size()); + + forAll(surface_, fI) + { + faces[fI] = surface_.triSurface::operator[](fI).triFaceFace(); + } + + vtkSurfaceWriter().write + ( + surface_.searchableSurface::time().constant()/"triSurface", + surfaceName_, + surface_.points(), + faces, + "cellSize", + surfaceCellSize, + false, + true + ); + } + return surfaceCellSize; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H index 04d8ed7ddb28c14730ac9c2bea77b0f0612c8fe9..4288176e8f3ddccd42dcf074cb5bd2f21d260756 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cellSizeControlSurfaces/surfaceCellSizeFunction/cellSizeCalculationType/automatic/automatic.H @@ -85,6 +85,11 @@ private: const scalar maximumCellSize_; + // Private Member Functions + + void smoothField(triSurfaceScalarField& surf); + + public: //- Runtime type information diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3DKernel.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3DKernel.H new file mode 100644 index 0000000000000000000000000000000000000000..e80b3fb8f4b428ee42d4f739c582e4d429aafe35 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3DKernel.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedefs + CGALTriangulation3DKernel + +Description + +\*---------------------------------------------------------------------------*/ + +#ifndef CGALTriangulation3DKernel_H +#define CGALTriangulation3DKernel_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "CGAL/Delaunay_triangulation_3.h" + +#ifdef CGAL_INEXACT + + // Fast kernel using a double as the storage type but the triangulation may + // fail. Adding robust circumcentre traits + #include "CGAL/Exact_predicates_inexact_constructions_kernel.h" + typedef CGAL::Exact_predicates_inexact_constructions_kernel baseK; +// #include <CGAL/Robust_circumcenter_traits_3.h> + #include <CGAL/Robust_circumcenter_filtered_traits_3.h> +// typedef CGAL::Robust_circumcenter_traits_3<baseK> K; + typedef CGAL::Robust_circumcenter_filtered_traits_3<baseK> K; + +#else + + // Very robust but expensive kernel + #include "CGAL/Exact_predicates_exact_constructions_kernel.h" + typedef CGAL::Exact_predicates_exact_constructions_kernel baseK; + typedef CGAL::Exact_predicates_exact_constructions_kernel K; + +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3Ddefs.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3Ddefs.H index 72d44618a21c589ead0275b7e47864c4ebea548f..4e7dd48c38c76ffe152bf7d194881540ca0c2381 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3Ddefs.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/CGALTriangulation3Ddefs.H @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - Typedefs CGALTriangulation3Ddefs @@ -43,76 +38,20 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "CGAL/Delaunay_triangulation_3.h" +#include "CGALTriangulation3DKernel.H" #include "indexedVertex.H" #include "indexedCell.H" -#ifdef CGAL_INEXACT - // Fast kernel using a double as the storage type but the triangulation may - // fail. Adding robust circumcentre traits - #include "CGAL/Exact_predicates_inexact_constructions_kernel.h" - #include <CGAL/Robust_circumcenter_traits_3.h> - typedef CGAL::Exact_predicates_inexact_constructions_kernel inexactK; - typedef CGAL::Robust_circumcenter_traits_3<inexactK> K; -#else - // Very robust but expensive kernel - #include "CGAL/Exact_predicates_exact_constructions_kernel.h" - typedef CGAL::Exact_predicates_exact_constructions_kernel K; -#endif +typedef CGAL::indexedVertex<K> Vb; +typedef CGAL::indexedCell<K> Cb; -typedef CGAL::indexedVertex<K> Vb; -typedef CGAL::indexedCell<K> Cb; - -typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds; -typedef CGAL::Delaunay_triangulation_3<K, Tds, CGAL::Fast_location> Delaunay; - -typedef Delaunay::Vertex_handle Vertex_handle; -typedef Delaunay::Cell_handle Cell_handle; -typedef Delaunay::Point Point; - - -//- Spatial sort traits to use with a pair of point pointers and an integer. -// Taken from a post on the CGAL lists: 2010-01/msg00004.html by -// Sebastien Loriot (Geometry Factory). -template<class Triangulation> -struct Traits_for_spatial_sort -: - public Triangulation::Geom_traits -{ - typedef typename Triangulation::Geom_traits Gt; - - typedef std::pair<const typename Triangulation::Point*, int> Point_3; - - struct Less_x_3 - { - bool operator()(const Point_3& p, const Point_3& q) const - { - return typename Gt::Less_x_3()(*(p.first), *(q.first)); - } - }; - - struct Less_y_3 - { - bool operator()(const Point_3& p, const Point_3& q) const - { - return typename Gt::Less_y_3()(*(p.first), *(q.first)); - } - }; - - struct Less_z_3 - { - bool operator()(const Point_3& p, const Point_3& q) const - { - return typename Gt::Less_z_3()(*(p.first), *(q.first)); - } - }; - - Less_x_3 less_x_3_object () const {return Less_x_3();} - Less_y_3 less_y_3_object () const {return Less_y_3();} - Less_z_3 less_z_3_object () const {return Less_z_3();} -}; +typedef CGAL::Compact_location CompactLocator; +typedef CGAL::Fast_location FastLocator; +typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds; +typedef CGAL::Delaunay_triangulation_3<K, Tds, CompactLocator> Delaunay; +typedef CGAL::Delaunay_triangulation_3<K, Tds, FastLocator> CellSizeDelaunay; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index de23690ea43b26ca788d49724cb42e2d17a6e192..5c43329acfbcb1397f32634ba3e335290a9a2a7e 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -27,8 +27,11 @@ License #include "initialPointsMethod.H" #include "relaxationModel.H" #include "faceAreaWeightModel.H" -#include "backgroundMeshDecomposition.H" #include "meshSearch.H" +#include "vectorTools.H" +#include "IOmanip.H" +#include "indexedCellChecks.H" + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -44,6 +47,52 @@ const Foam::scalar Foam::conformalVoronoiMesh::tolParallel = 1e-3; // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // +void Foam::conformalVoronoiMesh::cellSizeMeshOverlapsBackground() const +{ + const cellShapeControlMesh& cellSizeMesh = + cellShapeControl_.shapeControlMesh(); + + DynamicList<Foam::point> pts(number_of_vertices()); + + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (vit->internalOrBoundaryPoint()) + { + pts.append(topoint(vit->point())); + } + } + + boundBox bb(pts); + + boundBox cellSizeMeshBb = cellSizeMesh.bounds(); + + bool fullyContained = true; + + if (!cellSizeMeshBb.contains(bb)) + { + Pout<< "Triangulation not fully contained in cell size mesh." + << endl; + + Pout<< "Cell Size Mesh Bounds = " << cellSizeMesh.bounds() << endl; + Pout<< "cvMesh Bounds = " << bb << endl; + + fullyContained = false; + } + + reduce(fullyContained, andOp<unsigned int>()); + + Info<< "Triangulation is " + << (fullyContained ? "fully" : "not fully") + << " contained in the cell size mesh" + << endl; +} + + Foam::scalar Foam::conformalVoronoiMesh::requiredSize ( const Foam::point& pt @@ -72,7 +121,7 @@ Foam::scalar Foam::conformalVoronoiMesh::requiredSize << exit(FatalError) << endl; } - cellSizeHits.append(cellSizeControl().cellSize(pt)); + cellSizeHits.append(cellShapeControls().cellSize(pt)); // Primary alignment @@ -135,7 +184,7 @@ Foam::scalar Foam::conformalVoronoiMesh::requiredSize cellSizeHits.append ( - cellSizeControl().cellSize(hitPt) + cellShapeControls().cellSize(hitPt) ); totalDist += spokeHitDistance; @@ -161,7 +210,7 @@ Foam::scalar Foam::conformalVoronoiMesh::requiredSize cellSizeHits.append ( - cellSizeControl().cellSize(hitPt) + cellShapeControls().cellSize(hitPt) ); totalDist += spokeHitDistance; @@ -176,7 +225,7 @@ Foam::scalar Foam::conformalVoronoiMesh::requiredSize } return cellSize/cellSizeHits.size(); - //return cellSizeControl().cellSize(pt); + //return cellShapeControls().cellSize(pt); } @@ -355,14 +404,12 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment } -void Foam::conformalVoronoiMesh::insertPoints +void Foam::conformalVoronoiMesh::insertInternalPoints ( List<Point>& points, bool distribute ) { - label preInsertionSize(number_of_vertices()); - label nPoints = points.size(); if (Pstream::parRun()) @@ -374,38 +421,13 @@ void Foam::conformalVoronoiMesh::insertPoints if (Pstream::parRun() && distribute) { - label preDistributionSize(points.size()); - - DynamicList<Foam::point> transferPoints; + List<Foam::point> transferPoints(points.size()); - DynamicList<Point> pointsOnProcessor; - - for - ( - List<Point>::iterator pit = points.begin(); - pit != points.end(); - ++pit - ) + forAll(points, pI) { - Foam::point p(topoint(*pit)); - - if (!positionOnThisProc(p)) - { - transferPoints.append(p); - } - else - { - pointsOnProcessor.append(*pit); - } + transferPoints[pI] = topoint(points[pI]); } - points.setSize(pointsOnProcessor.size()); - forAll(pointsOnProcessor, pI) - { - points[pI] = pointsOnProcessor[pI]; - } - pointsOnProcessor.clear(); - // Send the points that are not on this processor to the appropriate // place Foam::autoPtr<Foam::mapDistribute> map @@ -413,41 +435,7 @@ void Foam::conformalVoronoiMesh::insertPoints decomposition_().distributePoints(transferPoints) ); - const label oldSize = points.size(); - - points.setSize(oldSize + transferPoints.size()); - - forAll(transferPoints, tPI) - { - points[tPI + oldSize] = toPoint(transferPoints[tPI]); - } - - label sizeChange = preDistributionSize - points.size(); - - // if (mag(sizeChange) > 0) - // { - // Pout<< " distribution points size change " << sizeChange - // << endl; - // } - - label totalMagSizeChange = returnReduce - ( - mag(sizeChange), sumOp<label>() - ); - - if (totalMagSizeChange > 0) - { - Info<< " distribution points size change total " - << totalMagSizeChange/2 - << endl; - } - - nPoints = points.size(); - - reduce(nPoints, sumOp<label>()); - - Info<< " " << nPoints - << " points to insert after distribution..." << endl; + map().distribute(points); } label nVert = number_of_vertices(); @@ -455,25 +443,18 @@ void Foam::conformalVoronoiMesh::insertPoints // using the range insert (faster than inserting points one by one) insert(points.begin(), points.end()); -// Info<< "USING INDIVIDUAL INSERTION TO DETECT FAILURE" << endl; -// for -// ( -// List<Point>::iterator pit=points.begin(); -// pit != points.end(); -// ++pit -// ) -// { -// insertPoint(topoint(*pit), Vb::vtInternal); -// } - - label nInserted(number_of_vertices() - preInsertionSize); + label nInserted(number_of_vertices() - nVert); if (Pstream::parRun()) { reduce(nInserted, sumOp<label>()); } - Info<< " " << nInserted << " points inserted" << endl; + Info<< " " << nInserted << " points inserted" + << ", failed to insert " << nPoints - nInserted + << " (" + << 100.0*(nPoints - nInserted)/nInserted + << " %)"<< endl; for ( @@ -484,7 +465,8 @@ void Foam::conformalVoronoiMesh::insertPoints { if (vit->uninitialised()) { - vit->index() = nVert++; + vit->index() = getNewVertexIndex(); + vit->type() = Vb::vtInternal; } } } @@ -492,30 +474,22 @@ void Foam::conformalVoronoiMesh::insertPoints void Foam::conformalVoronoiMesh::insertPoints ( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types, + List<Vb>& vertices, bool distribute ) { - // The pts, indices and types lists must be intact and up-to-date at the - // end of this function as they may also be used by other functions - // subsequently. - if (Pstream::parRun() && distribute) { - // The link between vertices that form the boundary via pairs cannot be - // strict because both points may end up on different processors. The - // only important thing is that each vertex knows its own role. - // Therefore, index and type are set to 0 or 1, then on the destination - // processor add back the new index to both. + const label preDistributionSize = vertices.size(); - // Each of points generated in this process are pair points, so there - // is no risk of underflowing "type". + List<Foam::point> pts(preDistributionSize); + + forAll(vertices, vI) + { + const Foam::point& pt = topoint(vertices[vI].point()); - // Pout<< "Points before " - // << pts.size() << " " << indices.size() << " " << types.size() - // << endl; + pts[vI] = pt; + } // Distribute points to their appropriate processor autoPtr<mapDistribute> map @@ -523,97 +497,71 @@ void Foam::conformalVoronoiMesh::insertPoints decomposition_().distributePoints(pts) ); - map().distribute(indices); - map().distribute(types); - - // Pout<< "Points after " - // << pts.size() << " " << indices.size() << " " << types.size() - // << endl; + map().distribute(vertices); - // Info<< returnReduce(pts.size(), sumOp<label>()) - // << " points in total" << endl; + forAll(vertices, vI) + { + vertices[vI].procIndex() = Pstream::myProcNo(); + } } -// -// forAll(pts, pI) -// { -// // creation of points and indices is done assuming that it will be -// // relative to the instantaneous number_of_vertices() at insertion. -// -// label type = types[pI]; -// -// if (type > Vb::vtFar) -// { -// // This is a member of a point pair, don't use the type directly -// // (note that this routine never gets called for referredPoints -// // so type will never be -procI) -// type += number_of_vertices(); -// } -// -// insertPoint -// ( -// pts[pI], -// indices[pI] + number_of_vertices(), -// type -// ); -// } rangeInsertWithInfo ( - pts.begin(), - pts.end(), - *this, - indices, - types + vertices.begin(), + vertices.end(), + true ); } void Foam::conformalVoronoiMesh::insertSurfacePointPairs ( - const List<pointIndexHit>& surfaceHits, - const List<label>& hitSurfaces, + const pointIndexHitAndFeatureList& surfaceHits, const fileName fName ) { - if (surfaceHits.size() != hitSurfaces.size()) - { - FatalErrorIn("Foam::conformalVoronoiMesh::insertPointPairs") - << "surfaceHits and hitSurfaces are not the same size. Sizes " - << surfaceHits.size() << ' ' - << hitSurfaces.size() - << exit(FatalError); - } - - DynamicList<Foam::point> pts; - DynamicList<label> indices; - DynamicList<label> types; + DynamicList<Vb> pts(2.0*surfaceHits.size()); forAll(surfaceHits, i) { vectorField norm(1); - allGeometry_[hitSurfaces[i]].getNormal + const pointIndexHit surfaceHit = surfaceHits[i].first(); + const label featureIndex = surfaceHits[i].second(); + + allGeometry_[featureIndex].getNormal ( - List<pointIndexHit>(1, surfaceHits[i]), + List<pointIndexHit>(1, surfaceHit), norm ); const vector& normal = norm[0]; - const Foam::point& surfacePt(surfaceHits[i].hitPoint()); + const Foam::point& surfacePt(surfaceHit.hitPoint()); - createPointPair - ( - pointPairDistance(surfacePt), - surfacePt, - normal, - pts, - indices, - types - ); + if (geometryToConformTo_.isBaffle(featureIndex)) + { + createBafflePointPair + ( + pointPairDistance(surfacePt), + surfacePt, + normal, + pts + ); + } + else + { + createPointPair + ( + pointPairDistance(surfacePt), + surfacePt, + normal, + pts + ); + } } - insertPoints(pts, indices, types, true); + insertPoints(pts, true); if (cvMeshControls().objOutput() && fName != fileName::null) { @@ -624,35 +572,25 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs void Foam::conformalVoronoiMesh::insertEdgePointGroups ( - const List<pointIndexHit>& edgeHits, - const labelList& featuresHit, + const pointIndexHitAndFeatureList& edgeHits, const fileName fName ) { - if (edgeHits.size() != featuresHit.size()) - { - FatalErrorIn("Foam::conformalVoronoiMesh::insertEdgePointGroups") - << "edgeHits and featuresHit are not the same size. Sizes " - << edgeHits.size() << ' ' - << featuresHit.size() - << exit(FatalError); - } - - DynamicList<Foam::point> pts; - DynamicList<label> indices; - DynamicList<label> types; + DynamicList<Vb> pts(3.0*edgeHits.size()); forAll(edgeHits, i) { const extendedFeatureEdgeMesh& feMesh ( - geometryToConformTo_.features()[featuresHit[i]] + geometryToConformTo_.features()[edgeHits[i].second()] ); - createEdgePointGroup(feMesh, edgeHits[i], pts, indices, types); + createEdgePointGroup(feMesh, edgeHits[i].first(), pts); } - insertPoints(pts, indices, types, true); + pts.shrink(); + + insertPoints(pts, true); if (cvMeshControls().objOutput() && fName != fileName::null) { @@ -680,20 +618,6 @@ bool Foam::conformalVoronoiMesh::nearFeaturePt(const Foam::point& pt) const } -void Foam::conformalVoronoiMesh::reset(const bool distribute) -{ - this->clear(); - - reinsertBoundingPoints(); - - // Reinsert feature points, distributing them as necessary. - reinsertFeaturePoints(distribute); - //insertFeaturePoints(); - - startOfInternalPoints_ = number_of_vertices(); -} - - void Foam::conformalVoronoiMesh::insertInitialPoints() { Info<< nl << "Inserting initial points" << endl; @@ -706,13 +630,43 @@ void Foam::conformalVoronoiMesh::insertInitialPoints() // Assume that the initial points method made the correct decision for // which processor each point should be on, so give distribute = false - insertPoints(initPts, false); + insertInternalPoints(initPts); +} - if (cvMeshControls().objOutput()) + +Foam::scalar Foam::conformalVoronoiMesh::calculateLoadUnbalance() const +{ + label nRealVertices = 0; + + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) { - writePoints("initialPoints.obj", true); + // Only store real vertices that are not feature vertices + if (vit->real() && !vit->featurePoint()) + { + nRealVertices++; + } } + scalar globalNRealVertices = returnReduce + ( + nRealVertices, + sumOp<label>() + ); + + scalar unbalance = returnReduce + ( + mag(1.0 - nRealVertices/(globalNRealVertices/Pstream::nProcs())), + maxOp<scalar>() + ); + + Info<< " Processor unbalance " << unbalance << endl; + + return unbalance; } @@ -729,52 +683,29 @@ bool Foam::conformalVoronoiMesh::distributeBackground() label iteration = 0; + scalar previousLoadUnbalance = 0; + while (true) { - label nRealVertices = 0; + scalar maxLoadUnbalance = calculateLoadUnbalance(); - for + if ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - vit++ + maxLoadUnbalance <= cvMeshControls().maxLoadUnbalance() + || maxLoadUnbalance <= previousLoadUnbalance ) - { - // Only store real vertices that are not feature vertices - if (vit->real() && vit->index() >= startOfInternalPoints_) - { - nRealVertices++; - } - } - - scalar globalNRealVertices = returnReduce - ( - nRealVertices, - sumOp<label>() - ); - - scalar unbalance = returnReduce - ( - mag(1.0 - nRealVertices/(globalNRealVertices/Pstream::nProcs())), - maxOp<scalar>() - ); - - Info<< " Processor unbalance " << unbalance << endl; - - if (unbalance <= cvMeshControls().maxLoadUnbalance()) { // If this is the first iteration, return false, if it was a // subsequent one, return true; return iteration != 0; } + previousLoadUnbalance = maxLoadUnbalance; + Info<< " Total number of vertices before redistribution " << returnReduce(label(number_of_vertices()), sumOp<label>()) << endl; - // Pout<< " Real vertices before distribution " - // << nRealVertices << endl; - const fvMesh& bMesh = decomposition_().mesh(); volScalarField cellWeights @@ -794,42 +725,36 @@ bool Foam::conformalVoronoiMesh::distributeBackground() meshSearch cellSearch(bMesh, polyMesh::FACEPLANES); - List<DynamicList<Foam::point> > cellVertices(bMesh.nCells()); - List<DynamicList<label> > cellVertexIndices(bMesh.nCells()); - List<DynamicList<label> > cellVertexTypes(bMesh.nCells()); + labelList cellVertices(bMesh.nCells(), 0); for ( Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); vit != finite_vertices_end(); - vit++ + ++vit ) { // Only store real vertices that are not feature vertices - if (vit->real() && vit->index() >= startOfInternalPoints_) + if (vit->real() && !vit->featurePoint()) { - Foam::point v = topoint(vit->point()); + pointFromPoint v = topoint(vit->point()); label cellI = cellSearch.findCell(v); if (cellI == -1) { - // Pout<< "findCell conformalVoronoiMesh::distribute " - // << "findCell " - // << vit->type() << " " - // << vit->index() << " " - // << v << " " - // << cellI - // << " find nearest cellI "; +// Pout<< "findCell conformalVoronoiMesh::distribute " +// << "findCell " +// << vit->type() << " " +// << vit->index() << " " +// << v << " " +// << cellI +// << " find nearest cellI "; cellI = cellSearch.findNearestCell(v); - - Pout<< cellI << endl; } - cellVertices[cellI].append(topoint(vit->point())); - cellVertexIndices[cellI].append(vit->index()); - cellVertexTypes[cellI].append(vit->type()); + cellVertices[cellI]++; } } @@ -840,76 +765,148 @@ bool Foam::conformalVoronoiMesh::distributeBackground() // the sum of the normalised weight field. cellWeights.internalField()[cI] = max ( - cellVertices[cI].size(), + cellVertices[cI], 1e-2 ); } autoPtr<mapDistributePolyMesh> mapDist = decomposition_().distribute ( - cellWeights, - cellVertices, - cellVertexIndices, - cellVertexTypes + cellWeights ); - // Reset the entire tessellation - reset(true); + cellShapeControl_.shapeControlMesh().distribute(decomposition_); - timeCheck("Distribution performed"); + distribute(); - Info<< nl << " Inserting distributed tessellation" << endl; + timeCheck("After distribute"); - DynamicList<Foam::point> pointsToInsert; - DynamicList<label> indices; - DynamicList<label> types; + iteration++; + } - forAll(cellVertices, cI) - { - forAll(cellVertices[cI], cVPI) - { - pointsToInsert.append(cellVertices[cI][cVPI]); + return true; +} - // All insertions relative to index of zero - indices.append(0); - label type = cellVertexTypes[cI][cVPI]; +void Foam::conformalVoronoiMesh::distribute() +{ + if (!Pstream::parRun()) + { + return ; + } - if (type > Vb::vtFar) - { - // This is a member of a point pair, don't use the type - // directly, make type relative to the index in preparation - // for insertion. + autoPtr<mapDistribute> mapDist = + DistributedDelaunayMesh<Delaunay>::distribute(decomposition_()); - type -= cellVertexIndices[cI][cVPI]; - } + DynamicList<Foam::point> points(number_of_vertices()); + DynamicList<Foam::indexedVertexEnum::vertexType> types + ( + number_of_vertices() + ); + DynamicList<scalar> sizes(number_of_vertices()); + DynamicList<tensor> alignments(number_of_vertices()); - types.append(type); - } + for + ( + Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (vit->real()) + { + points.append(topoint(vit->point())); + types.append(vit->type()); + sizes.append(vit->targetCellSize()); + alignments.append(vit->alignment()); } + } - // Assume that the distribution made the correct decision for which - // processor each point should be on, so give distribute = false - insertPoints(pointsToInsert, indices, types, false); + mapDist().distribute(points); + mapDist().distribute(types); + mapDist().distribute(sizes); + mapDist().distribute(alignments); + + // Reset the entire tessellation + DelaunayMesh<Delaunay>::reset(); + + Info<< nl << " Inserting distributed tessellation" << endl; + + // Internal points have to be inserted first + + DynamicList<Vb> verticesToInsert(points.size()); + + forAll(points, pI) + { + verticesToInsert.append + ( + Vb + ( + toPoint<Point>(points[pI]), + -1, + types[pI], + Pstream::myProcNo() + ) + ); + + verticesToInsert.last().targetCellSize() = sizes[pI]; + verticesToInsert.last().alignment() = alignments[pI]; + } + + this->rangeInsertWithInfo + ( + verticesToInsert.begin(), + verticesToInsert.end(), + true + ); + + Info<< " Total number of vertices after redistribution " + << returnReduce + ( + label(number_of_vertices()), sumOp<label>() + ) + << endl; +} - Info<< " Total number of vertices after redistribution " - << returnReduce(label(number_of_vertices()), sumOp<label>()) - << endl; - // Pout<< " Real vertices after distribution " - // << label(number_of_vertices() - 8) << endl; +void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh() +{ + cellShapeControl_.initialMeshPopulation(decomposition_); + + cellShapeControlMesh& cellSizeMesh = cellShapeControl_.shapeControlMesh(); + + if (Pstream::parRun()) + { + cellSizeMesh.distribute(decomposition_); + } - if (cvMeshControls().objOutput()) + label nMaxIter = 2; + + for (label i = 0; i < nMaxIter; ++i) + { + label nAdded = cellShapeControl_.refineMesh(decomposition_); + reduce(nAdded, sumOp<label>()); + + if (Pstream::parRun()) { - writePoints("distributedPoints.obj", true); + cellSizeMesh.distribute(decomposition_); } - timeCheck("After distribute"); + if (nAdded == 0) + { + break; + } - iteration++; + Info<< " Iteration " << i << ": Added = " << nAdded << " points" + << endl; } - return true; + cellShapeControl_.smoothMesh(); + + Info<< "Background cell size and alignment mesh:" << endl; + cellSizeMesh.printInfo(Info); + +// cellSizeMesh.write(); } @@ -941,41 +938,48 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments const List<Point>& storePts ) { - timeCheck("Start of storeSizesAndAlignments"); - - Info << nl << "Store size and alignment" << endl; - - sizeAndAlignmentLocations_.setSize(storePts.size()); - - storedSizes_.setSize(sizeAndAlignmentLocations_.size()); - - storedAlignments_.setSize(sizeAndAlignmentLocations_.size()); - - label i = 0; - - checkCellSizing(); - - for - ( - List<Point>::const_iterator pit = storePts.begin(); - pit != storePts.end(); - ++pit - ) - { - sizeAndAlignmentLocations_[i] = topoint(*pit); - - storedSizes_[i] = requiredSize(sizeAndAlignmentLocations_[i]); - - storedAlignments_[i] = requiredAlignment(sizeAndAlignmentLocations_[i]); - - i++; - } - - timeCheck("Sizes and alignments calculated, build tree"); - - buildSizeAndAlignmentTree(); - - timeCheck("Size and alignment tree built"); +// timeCheck("Start of storeSizesAndAlignments"); +// +// Info << nl << "Store size and alignment" << endl; +// +// sizeAndAlignmentLocations_.setSize(storePts.size()); +// +// storedSizes_.setSize(sizeAndAlignmentLocations_.size()); +// +// storedAlignments_.setSize(sizeAndAlignmentLocations_.size()); +// +// label i = 0; +// +// //checkCellSizing(); +// +// for +// ( +// List<Point>::const_iterator pit = storePts.begin(); +// pit != storePts.end(); +// ++pit +// ) +// { +// pointFromPoint pt = topoint(*pit); +// +//// storedAlignments_[i] = requiredAlignment(pt); +//// +//// storedSizes_[i] = cellShapeControls().cellSize(pt); +// +// cellShapeControls().cellSizeAndAlignment +// ( +// pt, +// storedSizes_[i], +// storedAlignments_[i] +// ); +// +// i++; +// } +// +// timeCheck("Sizes and alignments calculated, build tree"); +// +// buildSizeAndAlignmentTree(); +// +// timeCheck("Size and alignment tree built"); } @@ -1016,9 +1020,51 @@ Foam::conformalVoronoiMesh::sizeAndAlignmentTree() const void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment() { - Info<< nl << "Looking up target cell alignment and size" << endl; +// Info<< nl << "Looking up target cell alignment and size" << endl; +// +// const indexedOctree<treeDataPoint>& tree = sizeAndAlignmentTree(); +// +// for +// ( +// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); +// vit != finite_vertices_end(); +// vit++ +// ) +// { +// if +// ( +// vit->internalOrBoundaryPoint() +// || vit->referredInternalOrBoundaryPoint() +// ) +// { +// pointFromPoint pt = topoint(vit->point()); +// +// pointIndexHit info = tree.findNearest(pt, sqr(GREAT)); +// +// if (info.hit()) +// { +// vit->alignment() = storedAlignments_[info.index()]; +// +// vit->targetCellSize() = storedSizes_[info.index()]; +// } +// else +// { +// WarningIn +// ( +// "void " +// "Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()" +// ) +// << "Point " << pt << " did not find a nearest point " +// << " for alignment and size lookup." << endl; +// +// vit->alignment() = cellShapeControls().cellAlignment(pt); +// +// vit->targetCellSize() = cellShapeControls().cellSize(pt); +// } +// } +// } - const indexedOctree<treeDataPoint>& tree = sizeAndAlignmentTree(); + Info<< nl << "Calculating target cell alignment and size" << endl; for ( @@ -1027,57 +1073,23 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment() vit++ ) { - if - ( - vit->internalOrBoundaryPoint() - || vit->referredInternalOrBoundaryPoint() - ) + if (vit->internalOrBoundaryPoint()) { - Foam::point pt(topoint(vit->point())); + pointFromPoint pt = topoint(vit->point()); - pointIndexHit info = tree.findNearest(pt, sqr(GREAT)); - - if (info.hit()) - { - vit->alignment() = storedAlignments_[info.index()]; - - vit->targetCellSize() = storedSizes_[info.index()]; - } - else - { - WarningIn - ( - "void " - "Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()" - ) - << "Point " << pt << " did not find a nearest point " - << " for alignment and size lookup." << endl; + cellShapeControls().cellSizeAndAlignment + ( + pt, + vit->targetCellSize(), + vit->alignment() + ); - vit->alignment() = requiredAlignment(pt); + //vit->alignment() = tensor(1,0,0,0,1,0,0,0,1); + //vit->alignment() = requiredAlignment(pt); - vit->targetCellSize() = cellSizeControl().cellSize(pt); - } + //vit->targetCellSize() = cellShapeControls().cellSize(pt); } } - - // Info<< nl << "Calculating target cell alignment and size" << endl; - - // for - // ( - // Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - // vit != finite_vertices_end(); - // vit++ - // ) - // { - // if (vit->internalOrBoundaryPoint()) - // { - // point pt(topoint(vit->point())); - - // vit->alignment() = requiredAlignment(pt); - - // vit->targetCellSize() = targetCellSize(pt); - // } - // } } @@ -1100,7 +1112,11 @@ Foam::face Foam::conformalVoronoiMesh::buildDualFace do { - if (cc1->farCell() || cc2->farCell()) + if + ( + cc1->hasFarPoint() || cc2->hasFarPoint() + || is_infinite(cc1) || is_infinite(cc2) + ) { Cell_handle c = eit->first; Vertex_handle vA = c->vertex(eit->second); @@ -1138,6 +1154,8 @@ Foam::face Foam::conformalVoronoiMesh::buildDualFace } while (cc1 != ccStart); + verticesOnFace.shrink(); + if (verticesOnFace.size() >= 3 && nUniqueVertices < 3) { // There are not enough unique vertices on this face to @@ -1172,7 +1190,7 @@ Foam::label Foam::conformalVoronoiMesh::maxFilterCount do { - if (cc->farCell()) + if (cc->hasFarPoint()) { Cell_handle c = eit->first; Vertex_handle vA = c->vertex(eit->second); @@ -1215,14 +1233,14 @@ bool Foam::conformalVoronoiMesh::ownerAndNeighbour label dualCellIndexA = vA->index(); - if (!vA->internalOrBoundaryPoint()) + if (!vA->internalOrBoundaryPoint() || vA->referred()) { dualCellIndexA = -1; } label dualCellIndexB = vB->index(); - if (!vB->internalOrBoundaryPoint()) + if (!vB->internalOrBoundaryPoint() || vB->referred()) { dualCellIndexB = -1; } @@ -1289,7 +1307,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh const dictionary& cvMeshDict ) : - Delaunay(), + DistributedDelaunayMesh<Delaunay>(), runTime_(runTime), rndGen_(64293*Pstream::myProcNo()), cvMeshControls_(cvMeshDict), @@ -1313,12 +1331,13 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh allGeometry_, cvMeshDict.subDict("surfaceConformation") ), - cellSizeControl_ + cellShapeControl_ ( + runTime_, + cvMeshDict.subDict("motionControl"), allGeometry_, - cvMeshDict.subDict("motionControl") + geometryToConformTo_ ), - startOfInternalPoints_(0), limitBounds_(), featureVertices_(), featurePointLocations_(), @@ -1354,47 +1373,49 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh ), decomposition_() { + if (cvMeshControls().objOutput()) + { + geometryToConformTo_.writeFeatureObj("cvMesh"); + } + if (Pstream::parRun()) { decomposition_.reset ( new backgroundMeshDecomposition ( - cvMeshDict.subDict("backgroundMeshDecomposition"), - *this + runTime_, + rndGen_, + geometryToConformTo_, + cvMeshDict.subDict("backgroundMeshDecomposition") ) ); } - if (cvMeshControls().objOutput()) - { - geometryToConformTo_.writeFeatureObj("cvMesh"); - } + buildCellSizeAndAlignmentMesh(); - insertBoundingPoints(); + insertInitialPoints(); insertFeaturePoints(); - startOfInternalPoints_ = number_of_vertices(); + setVertexSizeAndAlignment(); - insertInitialPoints(); + cellSizeMeshOverlapsBackground(); // Improve the guess that the backgroundMeshDecomposition makes with the // initial positions. Use before building the surface conformation to // better balance the surface conformation load. distributeBackground(); -// conformToSurface(); - - buildSurfaceConformation(rmCoarse); + buildSurfaceConformation(); // The introduction of the surface conformation may have distorted the // balance of vertices, distribute if necessary. - if (distributeBackground()) + distributeBackground(); + + if (Pstream::parRun()) { - // distributeBackground has destroyed all referred vertices, so the - // parallel interface needs to be rebuilt. - buildParallelInterface("rebuild"); + sync(decomposition_().procBounds()); } // Do not store the surface conformation until after it has been @@ -1402,19 +1423,25 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh storeSurfaceConformation(); // Use storeSizesAndAlignments with no feed points because all background - // points may have been distributed. It is a requirement that none of the - // preceding functions requires look up of sizes or alignments from the - // Delaunay vertices, i.e. setVertexSizeAndAlignment cannot be called - // before this point. + // points may have been distributed. storeSizesAndAlignments(); // Report any Delaunay vertices that do not think that they are in the // domain the processor they are on. // reportProcessorOccupancy(); + cellSizeMeshOverlapsBackground(); + + printVertexInfo(); + if (cvMeshControls().objOutput()) { - writePoints("allInitialPoints.obj", false); + writePoints + ( + "internalPoints_" + runTime_.timeName() + ".obj", + Foam::indexedVertexEnum::vtUnassigned, + Foam::indexedVertexEnum::vtExternalFeaturePoint + ); } } @@ -1435,9 +1462,9 @@ void Foam::conformalVoronoiMesh::move() Info<< nl << "Relaxation = " << relaxation << endl; - pointField dualVertices(number_of_cells()); + pointField dualVertices(number_of_finite_cells()); - label dualVertI = 0; + this->resetCellCount(); // Find the dual point of each tetrahedron and assign it an index. for @@ -1447,19 +1474,22 @@ void Foam::conformalVoronoiMesh::move() ++cit ) { - cit->cellIndex() = Cb::ctFar; + cit->cellIndex() = Cb::ctUnassigned; if (cit->anyInternalOrBoundaryDualVertex()) { - cit->cellIndex() = dualVertI; + cit->cellIndex() = getNewCellIndex(); - dualVertices[dualVertI] = cit->dual(); + dualVertices[cit->cellIndex()] = cit->dual(); + } - dualVertI++; + if (cit->hasFarPoint()) + { + cit->cellIndex() = Cb::ctFar; } } - dualVertices.setSize(dualVertI); + dualVertices.setSize(cellCount()); setVertexSizeAndAlignment(); @@ -1469,9 +1499,9 @@ void Foam::conformalVoronoiMesh::move() vectorField cartesianDirections(3); - cartesianDirections[0] = vector(0,0,1); - cartesianDirections[1] = vector(0,1,0); - cartesianDirections[2] = vector(1,0,0); + cartesianDirections[0] = vector(1, 0, 0); + cartesianDirections[1] = vector(0, 1, 0); + cartesianDirections[2] = vector(0, 0, 1); vectorField displacementAccumulator ( @@ -1498,25 +1528,29 @@ void Foam::conformalVoronoiMesh::move() Vertex_handle vA = c->vertex(eit->second); Vertex_handle vB = c->vertex(eit->third); - if (!vA->internalOrBoundaryPoint() && !vB->internalOrBoundaryPoint()) - { - // At least one vertex has to be a real internalOrBoundaryPoint - continue; - } - if ( - vA->anyInternalOrBoundaryPoint() - && vB->anyInternalOrBoundaryPoint() + ( + vA->internalPoint() && !vA->referred() + && vB->internalOrBoundaryPoint() + ) + || ( + vB->internalPoint() && !vB->referred() + && vA->internalOrBoundaryPoint() + ) ) { - face dualFace = buildDualFace(eit); + pointFromPoint dVA = topoint(vA->point()); + pointFromPoint dVB = topoint(vB->point()); - Foam::point dVA = topoint(vA->point()); - Foam::point dVB = topoint(vB->point()); - - Field<vector> alignmentDirsA(vA->alignment() & cartesianDirections); - Field<vector> alignmentDirsB(vB->alignment() & cartesianDirections); + Field<vector> alignmentDirsA + ( + vA->alignment().T() & cartesianDirections + ); + Field<vector> alignmentDirsB + ( + vB->alignment().T() & cartesianDirections + ); Field<vector> alignmentDirs(3); @@ -1551,7 +1585,11 @@ void Foam::conformalVoronoiMesh::move() { // Removal of close points - if (vA->internalPoint() && vB->internalPoint()) + if + ( + vA->internalPoint() && !vA->referred() + && vB->internalPoint() && !vB->referred() + ) { // Only insert a point at the midpoint of // the short edge if neither attached @@ -1566,17 +1604,17 @@ void Foam::conformalVoronoiMesh::move() { pointsToInsert.append ( - toPoint(0.5*(dVA + dVB)) + toPoint<Point>(0.5*(dVA + dVB)) ); } } - if (vA->internalPoint()) + if (vA->internalPoint() && !vA->referred()) { pointToBeRetained[vA->index()] = false; } - if (vB->internalPoint()) + if (vB->internalPoint() && !vB->referred()) { pointToBeRetained[vB->index()] = false; } @@ -1590,14 +1628,17 @@ void Foam::conformalVoronoiMesh::move() { vector& alignmentDir = alignmentDirs[aD]; - if ((rAB & alignmentDir) < 0) + scalar dotProd = rAB & alignmentDir; + + if (dotProd < 0) { // swap the direction of the alignment so that has the // same sense as rAB alignmentDir *= -1; + dotProd *= -1; } - const scalar alignmentDotProd = ((rAB/rABMag) & alignmentDir); + const scalar alignmentDotProd = dotProd/rABMag; if ( @@ -1605,19 +1646,59 @@ void Foam::conformalVoronoiMesh::move() > cvMeshControls().cosAlignmentAcceptanceAngle() ) { - const scalar targetCellSize = averageCellSize(vA, vB); + scalar targetCellSize = averageCellSize(vA, vB); - const scalar targetFaceArea = sqr(targetCellSize); + scalar targetFaceArea = sqr(targetCellSize); - alignmentDir *= 0.5*targetCellSize; + const vector originalAlignmentDir = alignmentDir; + + // Update cell size and face area + cellShapeControls().aspectRatio().updateCellSizeAndFaceArea + ( + alignmentDir, + targetFaceArea, + targetCellSize + ); // Vector to move end points around middle of vector // to align edge (i.e. dual face normal) with alignment // directions. vector delta = alignmentDir - 0.5*rAB; + face dualFace = buildDualFace(eit); + +// Pout<< dualFace << endl; +// Pout<< " " << vA->info() << endl; +// Pout<< " " << vB->info() << endl; + const scalar faceArea = dualFace.mag(dualVertices); + // Update delta vector + cellShapeControls().aspectRatio().updateDeltaVector + ( + originalAlignmentDir, + targetCellSize, + rABMag, + delta + ); + + if (targetFaceArea == 0) + { + Pout<< vA->info() << vB->info(); + + Cell_handle ch = locate(vA->point()); + if (is_infinite(ch)) + { + Pout<< "vA " << vA->targetCellSize() << endl; + } + + ch = locate(vB->point()); + if (is_infinite(ch)) + { + Pout<< "vB " << vB->targetCellSize() << endl; + } + } + delta *= faceAreaWeightModel_->faceAreaWeight ( faceArea/targetFaceArea @@ -1625,8 +1706,15 @@ void Foam::conformalVoronoiMesh::move() if ( - vA->internalPoint() - && vB->internalPoint() + ( + (vA->internalPoint() && vB->internalPoint()) + && (!vA->referred() || !vB->referred()) +// || +// ( +// vA->referredInternalPoint() +// && vB->referredInternalPoint() +// ) + ) && rABMag > cvMeshControls().insertionDistCoeff()*targetCellSize && faceArea @@ -1636,7 +1724,6 @@ void Foam::conformalVoronoiMesh::move() ) { // Point insertion - if ( !geometryToConformTo_.findSurfaceAnyIntersection @@ -1646,23 +1733,32 @@ void Foam::conformalVoronoiMesh::move() ) ) { - // Prevent insertions spanning surfaces - pointsToInsert.append - ( - toPoint(0.5*(dVA + dVB)) - ); + const Foam::point& newPt = 0.5*(dVA + dVB); + + if (positionOnThisProc(newPt)) + { + // Prevent insertions spanning surfaces + pointsToInsert.append(toPoint<Point>(newPt)); + } } } else if ( - (vA->internalPoint() || vB->internalPoint()) + ( + (vA->internalPoint() && !vA->referred()) + || (vB->internalPoint() && !vB->referred()) + ) && rABMag - < cvMeshControls().removalDistCoeff()*targetCellSize + < cvMeshControls().removalDistCoeff() + *targetCellSize ) { // Point removal - - if (vA->internalPoint() && vB->internalPoint()) + if + ( + vA->internalPoint() && !vA->referred() + && vB->internalPoint() && !vB->referred() + ) { // Only insert a point at the midpoint of // the short edge if neither attached @@ -1676,31 +1772,31 @@ void Foam::conformalVoronoiMesh::move() { pointsToInsert.append ( - toPoint(0.5*(dVA + dVB)) + toPoint<Point>(0.5*(dVA + dVB)) ); } } - if (vA->internalPoint()) + if (vA->internalPoint() && !vA->referred()) { pointToBeRetained[vA->index()] = false; } - if (vB->internalPoint()) + if (vB->internalPoint() && !vB->referred()) { pointToBeRetained[vB->index()] = false; } } else { - if (vA->internalPoint()) + if (vA->internalPoint() && !vA->referred()) { displacementAccumulator[vA->index()] += delta; } - if (vB->internalPoint()) + if (vB->internalPoint() && !vB->referred()) { - displacementAccumulator[vB->index()] += -delta; + displacementAccumulator[vB->index()] -= delta; } } } @@ -1708,6 +1804,8 @@ void Foam::conformalVoronoiMesh::move() } } + Info<< "Limit displacements" << endl; + // Limit displacements that pierce, or get too close to the surface for ( @@ -1716,22 +1814,26 @@ void Foam::conformalVoronoiMesh::move() ++vit ) { - if (vit->internalPoint()) + if (vit->internalPoint() && !vit->referred()) { - limitDisplacement - ( - vit, - displacementAccumulator[vit->index()] - ); + if (pointToBeRetained[vit->index()] == true) + { + limitDisplacement + ( + vit, + displacementAccumulator[vit->index()] + ); + } } } vector totalDisp = gSum(displacementAccumulator); scalar totalDist = gSum(mag(displacementAccumulator)); - // Relax the calculated displacement displacementAccumulator *= relaxation; + Info<< "Sum displacements" << endl; + for ( Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); @@ -1739,7 +1841,7 @@ void Foam::conformalVoronoiMesh::move() ++vit ) { - if (vit->internalPoint()) + if (vit->internalPoint() && !vit->referred()) { if (pointToBeRetained[vit->index()] == true) { @@ -1755,7 +1857,7 @@ void Foam::conformalVoronoiMesh::move() pointsToInsert.append ( - toPoint + toPoint<Point> ( topoint(vit->point()) + displacementAccumulator[vit->index()] @@ -1780,7 +1882,7 @@ void Foam::conformalVoronoiMesh::move() ++vit ) { - if (vit->internalPoint()) + if (vit->internalPoint() && !vit->referred()) { if (pointToBeRetained[vit->index()] == true) { @@ -1797,45 +1899,44 @@ void Foam::conformalVoronoiMesh::move() } // Remove the entire tessellation - reset(); - - if (cvMeshControls().objOutput() && runTime_.outputTime()) - { - writePoints("featurePoints_" + runTime_.timeName() + ".obj", false); - } + DelaunayMesh<Delaunay>::reset(); timeCheck("Displacement calculated"); Info<< nl << "Inserting displaced tessellation" << endl; - insertPoints(pointsToInsert); + insertInternalPoints(pointsToInsert, true); - // Remove internal points that have been inserted outside the surface. - label internalPtIsOutside = 0; - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - ++vit - ) - { - if (vit->internalPoint()) - { - bool inside - = geometryToConformTo_.inside(topoint(vit->point())); - - if (!inside) - { - remove(vit); - internalPtIsOutside++; - } - } - } + reinsertFeaturePoints(true); - Info<< " " << internalPtIsOutside - << " internal points were inserted outside the domain. " - << "They have been removed." << endl; + // Remove internal points that have been inserted outside the surface. +// label internalPtIsOutside = 0; +// +// for +// ( +// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); +// vit != finite_vertices_end(); +// ++vit +// ) +// { +// if (vit->internalPoint() && !vit->referred()) +// { +// bool inside = geometryToConformTo_.inside +// ( +// topoint(vit->point()) +// ); +// +// if (!inside) +// { +// remove(vit); +// internalPtIsOutside++; +// } +// } +// } +// +// Info<< " " << internalPtIsOutside +// << " internal points were inserted outside the domain. " +// << "They have been removed." << endl; // Fix points that have not been significantly displaced // for @@ -1858,15 +1959,39 @@ void Foam::conformalVoronoiMesh::move() // } // } - if (cvMeshControls().objOutput() && runTime_.outputTime()) + timeCheck("Internal points inserted"); + { - writePoints("points_" + runTime_.timeName() + ".obj", true); + // Check that no index is shared between any of the local points + labelHashSet usedIndices; + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (!vit->referred() && !usedIndices.insert(vit->index())) + { + FatalErrorIn("Foam::conformalVoronoiMesh::move()") + << "Index already used! Could not insert: " << nl + << vit->info() + << abort(FatalError); + } + } } - timeCheck("Internal points inserted"); - conformToSurface(); + if (cvMeshControls().objOutput()) + { + writePoints + ( + "internalPoints_" + runTime_.timeName() + ".obj", + Foam::indexedVertexEnum::vtInternal + ); + } + if (cvMeshControls().objOutput() && runTime_.outputTime()) { writeBoundaryPoints("boundaryPoints_" + runTime_.timeName() + ".obj"); @@ -1874,10 +1999,12 @@ void Foam::conformalVoronoiMesh::move() timeCheck("After conformToSurface"); + printVertexInfo(); + // Write the intermediate mesh, do not filter the dual faces. if (runTime_.outputTime()) { - writeMesh(runTime_.timeName(), false); + writeMesh(runTime_.timeName()); } updateSizesAndAlignments(pointsToInsert); @@ -1947,18 +2074,131 @@ Foam::conformalVoronoiMesh::intersectsProc } -Foam::labelListList Foam::conformalVoronoiMesh::overlapsProc -( - const List<Foam::point>& centres, - const List<scalar>& radiusSqrs -) const +//Foam::labelListList Foam::conformalVoronoiMesh::overlapsProc +//( +// const List<Foam::point>& centres, +// const List<scalar>& radiusSqrs +//) const +//{ +// if (!Pstream::parRun()) +// { +// return labelListList(centres.size(), labelList(0)); +// } +// +//// DynamicList<Foam::point> pts(number_of_vertices()); +// +//// for +//// ( +//// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); +//// vit != finite_vertices_end(); +//// vit++ +//// ) +//// { +//// pts.append(topoint(vit->point())); +//// } +//// +//// dynamicIndexedOctree<dynamicTreeDataPoint> vertexOctree +//// ( +//// dynamicTreeDataPoint(pts), +//// treeBoundBox(min(pts), max(pts)), +//// 10, // maxLevel +//// 10, // leafSize +//// 3.0 // duplicity +//// ); +// +// return decomposition_().overlapsProcessors +// ( +// centres, +// radiusSqrs, +// *this, +// false//, +//// vertexOctree +// ); +//} + + +void Foam::conformalVoronoiMesh::checkCoPlanarCells() const { - if (!Pstream::parRun()) + typedef CGAL::Exact_predicates_exact_constructions_kernel Kexact; + typedef CGAL::Point_3<Kexact> PointExact; + + if (!is_valid()) { - return labelListList(centres.size(), labelList(0)); + Pout<< "Triangulation is invalid!" << endl; + } + + OFstream str("badCells.obj"); + + label badCells = 0; + + for + ( + Delaunay::Finite_cells_iterator cit = finite_cells_begin(); + cit != finite_cells_end(); + ++cit + ) + { + const scalar quality = cvMeshChecks::coplanarTet(cit, 1e-16); + + if (quality == 0) + { + Pout<< "COPLANAR: " << cit->info() << nl + << " quality = " << quality << nl + << " dual = " << topoint(cit->dual()) << endl; + + drawDelaunayCell(str, cit, badCells++); + + FixedList<PointExact, 4> cellVerticesExact(PointExact(0,0,0)); + forAll(cellVerticesExact, vI) + { + cellVerticesExact[vI] = PointExact + ( + cit->vertex(vI)->point().x(), + cit->vertex(vI)->point().y(), + cit->vertex(vI)->point().z() + ); + } + + PointExact synchronisedDual = CGAL::circumcenter<Kexact> + ( + cellVerticesExact[0], + cellVerticesExact[1], + cellVerticesExact[2], + cellVerticesExact[3] + ); + + Foam::point exactPt + ( + CGAL::to_double(synchronisedDual.x()), + CGAL::to_double(synchronisedDual.y()), + CGAL::to_double(synchronisedDual.z()) + ); + + Info<< "inexact = " << cit->dual() << nl + << "exact = " << exactPt << endl; + } + } + + Pout<< "There are " << badCells << " bad cells out of " + << number_of_finite_cells() << endl; + + + label nNonGabriel = 0; + for + ( + Delaunay::Finite_facets_iterator fit = finite_facets_begin(); + fit != finite_facets_end(); + ++fit + ) + { + if (!is_Gabriel(*fit)) + { + nNonGabriel++;//Pout<< "Non-gabriel face" << endl; + } } - return decomposition_().overlapsProcessors(centres, radiusSqrs, false); + Pout<< "There are " << nNonGabriel << " non-Gabriel faces out of " + << number_of_finite_facets() << endl; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index 3be6dab81c208b927f333c57500ee7e958f7670b..bf64f6196c4e26970de3581983c8e0c4f8af1e24 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - Class Foam::conformalVoronoiMesh @@ -50,7 +45,7 @@ SourceFiles #include "ulong.H" #include "searchableSurfaces.H" #include "conformationSurfaces.H" -#include "cellSizeControlSurfaces.H" +#include "cellShapeControl.H" #include "cvControls.H" #include "DynamicList.H" #include "PackedBoolList.H" @@ -77,6 +72,11 @@ SourceFiles #include "zeroGradientFvPatchFields.H" #include "globalIndex.H" #include "pointFeatureEdgesTypes.H" +#include "pointConversion.H" +#include "Tuple2.H" +#include "DistributedDelaunayMesh.H" +#include "tensorIOField.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -98,24 +98,25 @@ class backgroundMeshDecomposition; class conformalVoronoiMesh : - public Delaunay + public DistributedDelaunayMesh<Delaunay> { public: enum reconformationMode { - rmNone, // Do not rebuild the surface conformation - rmCoarse, // Rebuild the conformation with coarse tolerances (faster) - rmFine // Rebuild the conformation with fine tolerances (slower) + rmOff, // Do not rebuild the surface conformation + rmOn }; - enum faceCollapseMode - { - fcmNone, // Do not collapse face - fcmEdge, // Collapse face to a single edge - fcmPoint, // Collapse face to a point - fcmDeferredMultiEdge // Collapse face to several edges - }; + typedef Delaunay::Vertex_handle Vertex_handle; + typedef Delaunay::Cell_handle Cell_handle; + typedef Delaunay::Point Point; + + typedef List<DynamicList<Pair<labelPair> > > labelPairPairDynListList; + + typedef Tuple2<pointIndexHit, label> pointIndexHitAndFeature; + typedef List<pointIndexHitAndFeature> pointIndexHitAndFeatureList; + typedef DynamicList<pointIndexHitAndFeature> pointIndexHitAndFeatureDynList; private: @@ -147,12 +148,8 @@ private: //- The surfaces to conform to conformationSurfaces geometryToConformTo_; - //- The cell size control object - cellSizeControlSurfaces cellSizeControl_; - - //- Keep track of the start index of the internal points. Needs - // careful bookkeeping within several functions. - label startOfInternalPoints_; + //- The cell shape control object + cellShapeControl cellShapeControl_; //- Limiting bound box before infinity begins treeBoundBox limitBounds_; @@ -167,11 +164,15 @@ private: //- Search tree for edge point locations mutable autoPtr<dynamicIndexedOctree<dynamicTreeDataPoint> > - edgeLocationTreePtr_; + edgeLocationTreePtr_; + + mutable DynamicList<Foam::point> existingEdgeLocations_; //- Search tree for surface point locations mutable autoPtr<dynamicIndexedOctree<dynamicTreeDataPoint> > - surfacePtLocationTreePtr_; + surfacePtLocationTreePtr_; + + mutable DynamicList<Foam::point> existingSurfacePtLocations_; //- Store locations where the cell size and alignments will be // pre-calculated and looked up @@ -205,6 +206,8 @@ private: // Private Member Functions + inline scalar defaultCellSize() const; + //- Return the local target cell size at the given location. Takes // boolean argument to allow speed-up of queries if the point is going // to be on a surface. @@ -271,82 +274,82 @@ private: //- Return the required alignment directions at the given location tensor requiredAlignment(const Foam::point& pt) const; - //- Insert Foam::point and return its auto-generated index - inline label insertPoint - ( - const Foam::point& p, - const label type - ); - //- Insert Point and return its auto-generated index - inline label insertPoint + inline bool insertPoint ( const Point& P, - const label type + const indexedVertexEnum::vertexType type ); //- Insert Foam::point with specified index and type - inline void insertPoint + inline bool insertPoint ( const Foam::point& p, - const label index, - const label type + const indexedVertexEnum::vertexType type ); - //- Insert Point with specified index and type - inline void insertPoint + //- Insert Point with specified index, type and original processor + inline bool insertReferredPoint ( const Point& P, const label index, - const label type + const indexedVertexEnum::vertexType type, + const label processor + ); + + inline bool insertReferredPoint(const Vb& P); + + //- Insert Foam::point with specified index, type and original processor + inline bool insertReferredPoint + ( + const Foam::point& p, + const label index, + const indexedVertexEnum::vertexType type, + const label processor ); //- Insert Delaunay vertices using the CGAL range insertion method, // optionally check processor occupancy and distribute to other // processors - void insertPoints + void insertInternalPoints ( List<Point>& points, - bool distribute = true + const bool distribute = false ); - //- Insert indexed and typed Delaunay vertices, optionally check - // processor occupancy and distribute to other processors void insertPoints ( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types, + List<Vb>& vertices, bool distribute = true ); - //- Insert a point-pair at a ppDist distance either side of + //- Create a point-pair at a ppDist distance either side of // surface point surfPt, in the direction n - inline void insertPointPair + inline void createPointPair ( const scalar ppDist, const Foam::point& surfPt, - const vector& n + const vector& n, + DynamicList<Vb>& pts ); + inline Foam::point perturbPoint(const Foam::point& pt) const; + //- Create a point-pair at a ppDist distance either side of // surface point surfPt, in the direction n - inline void createPointPair + inline void createBafflePointPair ( const scalar ppDist, const Foam::point& surfPt, const vector& n, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Insert pairs of points on the surface with the given normals, at the // specified spacing void insertSurfacePointPairs ( - const List<pointIndexHit>& surfaceHits, - const List<label>& hitSurfaces, + const pointIndexHitAndFeatureList& surfaceHits, const fileName fName = fileName::null ); @@ -355,8 +358,7 @@ private: // to be conformed to on the corresponding entry in featureHit void insertEdgePointGroups ( - const List<pointIndexHit>& edgeHits, - const labelList& featuresHit, + const pointIndexHitAndFeatureList& edgeHits, const fileName fName = fileName::null ); @@ -365,9 +367,7 @@ private: ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Create points to conform to an external edge @@ -375,9 +375,7 @@ private: ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Create points to conform to an internal edge @@ -385,9 +383,7 @@ private: ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Create points to conform to a flat edge @@ -395,9 +391,7 @@ private: ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Create points to conform to an open edge @@ -405,9 +399,7 @@ private: ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Create points to conform to multiply connected edge @@ -415,39 +407,54 @@ private: ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Determine and insert point groups at the feature points void insertFeaturePoints(); - bool edgesShareNormal(const label e1, const label e2) const; + //- Create point groups at mixed feature points + void createMixedFeaturePoints(DynamicList<Vb>& pts); - //- Create point groups at convex feature points - void createConvexFeaturePoints + void addMasterAndSlavePoints ( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types - ); + const DynamicList<Foam::point>& masterPoints, + const DynamicList<indexedVertexEnum::vertexType>&masterPointsTypes, + const Map<DynamicList<autoPtr<plane> > >& masterPointReflections, + DynamicList<Vb>& pts, + const label ptI + ) const; + + label getSign(const extendedFeatureEdgeMesh::edgeStatus eStatus) const; - //- Create point groups at concave feature points - void createConcaveFeaturePoints + void createMasterAndSlavePoints ( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types - ); + const extendedFeatureEdgeMesh& feMesh, + const label ptI, + DynamicList<Vb>& pts + ) const; - //- Create point groups at mixed feature points - void createMixedFeaturePoints + void createFeaturePoints(DynamicList<Vb>& pts); + + vector sharedFaceNormal ( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types - ); + const extendedFeatureEdgeMesh& feMesh, + const label edgeI, + const label nextEdgeI + ) const; + + List<Foam::point> reflectPointInPlanes + ( + const Foam::point p, + const DynamicList<autoPtr<plane> >& planes + ) const; + + Foam::point reflectPointInPlane + ( + const Foam::point p, + const plane& planeN + ) const; + //- Fill the pointFeatureEdgesType struct with the types of feature // edges that are attached to the point. @@ -467,9 +474,7 @@ private: const pointFeatureEdgesTypes& pFEdgeTypes, const List<extendedFeatureEdgeMesh::edgeStatus>& allEdStat, const label ptI, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ); //- Store the locations of all of the features to be conformed to @@ -486,28 +491,27 @@ private: //- Check if a location is in exclusion range around a feature point bool nearFeaturePt(const Foam::point& pt) const; - //- Clear the entire tesselation - // Reinsert bounding points, feature points and recalculate - // startOfInternalPoints_ - void reset(const bool distribute = false); - - //- Insert far points in a large bounding box to avoid dual edges - // spanning huge distances - void insertBoundingPoints(); - - //- Reinsert the bounding points - void reinsertBoundingPoints(); - //- Insert the initial points into the triangulation, based on the // initialPointsMethod void insertInitialPoints(); + //- Calculate the worst load balance + scalar calculateLoadUnbalance() const; + //- In parallel redistribute the backgroundMeshDecomposition and // vertices to balance the number of vertices on each processor. // Returns true if the background mesh changes as this removes all // referred vertices, so the parallel interface may need rebuilt. bool distributeBackground(); + // Test for full containment + void cellSizeMeshOverlapsBackground() const; + + //- + void distribute(); + + void buildCellSizeAndAlignmentMesh(); + //- Store data for sizeAndAlignmentLocations_, storedSizes_ and // storedAlignments_ and initialise the sizeAndAlignmentTreePtr_, // determining the appropriate sizeAndAlignmentLocations_ @@ -568,9 +572,28 @@ private: // conformation reconformationMode reconformationControl() const; + //- Determines geometrically whether a vertex is close to a surface + // This is an optimisation + label findVerticesNearBoundaries(); + //- Create and insert the necessary point pairs to conform to the // surface, then store the result - void buildSurfaceConformation(reconformationMode reconfMode); + void buildSurfaceConformation(); + + label synchroniseEdgeTrees + ( + pointIndexHitAndFeatureList& featureEdgeHits + ); + + label synchroniseSurfaceTrees + ( + pointIndexHitAndFeatureList& surfaceHits + ); + + bool locationConformsToInside + ( + const pointIndexHitAndFeature& info + ) const; //- Check to see if dual cell specified by given vertex iterator // intersects the boundary and hence reqires a point-pair @@ -583,8 +606,7 @@ private: bool dualCellSurfaceAllIntersections ( const Delaunay::Finite_vertices_iterator& vit, - DynamicList<pointIndexHit>& info, - DynamicList<label>& hitSurface + pointIndexHitAndFeatureDynList& info ) const; //- Return false if the line is entirely outside the current processor @@ -599,64 +621,6 @@ private: Foam::point& b ) const; - label removeProcessorBoundarySeeds(bool reinsertBoundPts); - - void seedProcessorBoundarySurfaces(bool seedProcessors); - - label numberOfUnusedReferredPoints() const; - - //- Build the parallelInterfaces of the mesh - void buildParallelInterface - ( - const word& outputName - ); - - //- Build the parallelInterfaces of the mesh, supply hash sets - // externally to allow updates - void buildParallelInterface - ( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - bool initialEdgeReferral, - const word& outputName - ); - - //- Refer all vertices to all processors - void buildParallelInterfaceAll - ( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - const word& outputName - ); - - //- Refer vertices where there dual edge pierces other processors - void buildParallelInterfaceIntersection - ( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - const word& outputName - ); - - //- Refer vertices that are attached to Delaunay tets whose - // circumspheres touch other processors - void buildParallelInterfaceInfluence - ( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - const word& outputName - ); - - //- Refer vertices to their required processors - void referVertices - ( - const DynamicList<label>& targetProcessor, - DynamicList<Foam::point>& parallelPoints, - DynamicList<label>& parallelIndices, - List<labelHashSet>& receivedVertices, - const word& stageName, - const word& outputName - ); - //- Find the "worst" protrusion of a dual cell through the surface, // subject to the maxSurfaceProtrusion tolerance void dualCellLargestSurfaceProtrusion @@ -681,7 +645,7 @@ private: //- Write out debugging information about the surface conformation // quality - void reportSurfaceConformationQuality(); +// void reportSurfaceConformationQuality(); //- Limit the displacement of a point so that it doesn't penetrate the // surface to be meshed or come too close to it @@ -698,23 +662,19 @@ private: //- Check if a surface point is near another. bool nearSurfacePoint ( - pointIndexHit& pHit, - label& surfaceHit, - DynamicList<Foam::point>& existingSurfacePtLocations + pointIndexHitAndFeature& pHit ) const; //- Append a point to the surface point tree and the existing list bool appendToSurfacePtTree ( - const Foam::point& pt, - DynamicList<Foam::point>& existingSurfacePtLocations + const Foam::point& pt ) const; //- Append a point to the edge location tree and the existing list bool appendToEdgeLocationTree ( - const Foam::point& pt, - DynamicList<Foam::point>& existingEdgeLocations + const Foam::point& pt ) const; //- Return a list of the nearest feature edge locations @@ -745,8 +705,7 @@ private: //- edge conformation location bool nearFeatureEdgeLocation ( - pointIndexHit& pHit, - DynamicList<Foam::point>& existingEdgeLocations + pointIndexHit& pHit ) const; //- Build or rebuild the edge location tree @@ -769,18 +728,11 @@ private: void addSurfaceAndEdgeHits ( const Delaunay::Finite_vertices_iterator& vit, - const Foam::point& vert, - const DynamicList<pointIndexHit>& surfHit, - const DynamicList<label>& hitSurface, + const pointIndexHitAndFeatureDynList& surfaceIntersections, scalar surfacePtReplaceDistCoeffSqr, scalar edgeSearchDistCoeffSqr, - DynamicList<pointIndexHit>& surfaceHits, - DynamicList<label>& hitSurfaces, - DynamicList<pointIndexHit>& featureEdgeHits, - DynamicList<label>& featureEdgeFeaturesHit, - DynamicList<Foam::point>& newEdgeLocations, - DynamicList<Foam::point>& existingEdgeLocations, - DynamicList<Foam::point>& existingSurfacePtLocations + pointIndexHitAndFeatureDynList& surfaceHits, + pointIndexHitAndFeatureDynList& featureEdgeHits ) const; //- Store the surface conformation with the indices offset to be @@ -791,10 +743,19 @@ private: // relative to new number of internal vertices void reinsertSurfaceConformation(); + void checkCells(); + + void checkDuals(); + + void checkVertices(); + + void checkCoPlanarCells() const; + //- Dual calculation void calcDualMesh ( pointField& points, + labelList& boundaryPts, faceList& faces, labelList& owner, labelList& neighbour, @@ -806,7 +767,7 @@ private: pointField& cellCentres, labelList& cellToDelaunayVertex, labelListList& patchToDelaunayVertex, - bool filterFaces + PackedBoolList& boundaryFacesToRemove ); //- Tet mesh calculation @@ -844,77 +805,27 @@ private: const Delaunay::Finite_facets_iterator& fit ) const; - //- Merge adjacent edges that are not attached to other faces - label mergeNearlyParallelEdges + //- Determines if the dual face constructed by the Delaunay + // edge is a processor boundary face + inline bool isProcBoundaryEdge ( - const pointField& pts, - const scalar maxCosAngle - ); + const Delaunay::Finite_edges_iterator& eit + ) const; - //- Merge vertices that are very close together - void mergeCloseDualVertices + //- Merge vertices that are identical + void mergeIdenticalDualVertices ( const pointField& pts, - const PackedBoolList& boundaryPts + const labelList& boundaryPts ); - label mergeCloseDualVertices + label mergeIdenticalDualVertices ( const pointField& pts, - const PackedBoolList& boundaryPts, - Map<label>& dualPtIndexMap - ) const; - - //- Smooth the dual vertices of the dual faces on the boundary - // so that they conform to the surface and remove any - // small, normal oriented faces - void smoothSurface - ( - pointField& pts, - const PackedBoolList& boundaryPts - ); - - label smoothSurfaceDualFaces - ( - pointField& pts, - const PackedBoolList& boundaryPts, + const labelList& boundaryPts, Map<label>& dualPtIndexMap ) const; - //- Collapse a face to a point or an edge, modifying and - // mapping the points, returns the true if the face was - // collapsed in this operation - void collapseFaces - ( - pointField& pts, - const PackedBoolList& boundaryPts, - HashSet<labelPair, labelPair::Hash<> >& deferredCollapseFaces - ); - - label collapseFaces - ( - pointField& pts, - const PackedBoolList& boundaryPts, - Map<label>& dualPtIndexMap, - HashSet<labelPair, labelPair::Hash<> >& deferredCollapseFaces - ) const; - - //- Collapse a face to an edge, updating the point and point - // map. Returns the collapse mode that was applied. - faceCollapseMode collapseFace - ( - const face& f, - pointField& pts, - const PackedBoolList& boundaryPts, - Map<label>& dualPtIndexMap, - scalar targetFaceSize, - scalar collapseSizeLimitCoeff, - label maxFC - ) const; - - //- Identify the index of the longest edge on the face - label longestEdge(const face& f, const pointField& pts) const; - //- Identify the face labels of the deferred collapse faces void deferredCollapseFaceSet ( @@ -943,12 +854,19 @@ private: void indexDualVertices ( pointField& pts, - PackedBoolList& boundaryPts + labelList& boundaryPts ); - //- Re-index all of the the Delaunay cells + //- Re-index all of the Delaunay cells void reindexDualVertices(const Map<label>& dualPtIndexMap); + label createPatchInfo + ( + wordList& patchNames, + wordList& patchTypes, + labelList& procNeighbours + ) const; + //- Create all of the internal and boundary faces void createFacesOwnerNeighbourAndPatches ( @@ -961,6 +879,7 @@ private: labelList& patchStarts, labelList& procNeighbours, labelListList& patchPointPairSlaves, + PackedBoolList& boundaryFacesToRemove, bool includeEmptyPatches = false ) const; @@ -987,7 +906,7 @@ private: List<DynamicList<face> >& patchFaces, List<DynamicList<label> >& patchOwners, List<DynamicList<label> >& patchPointPairSlaves, - List<Pair<DynamicList<label> > >& patchSortingIndices + labelPairPairDynListList& patchSortingIndices ) const; //- Add the faces and owner information for the patches @@ -998,15 +917,18 @@ private: labelList& owner, labelList& patchSizes, labelList& patchStarts, + PackedBoolList& boundaryFacesToRemove, const List<DynamicList<face> >& patchFaces, - const List<DynamicList<label> >& patchOwners + const List<DynamicList<label> >& patchOwners, + const List<DynamicList<bool> >& indirectPatchFace ) const; //- Remove points that are no longer used by any faces void removeUnusedPoints ( faceList& faces, - pointField& pts + pointField& pts, + labelList& boundaryPts ) const; //- Remove dual cells that are not used by any faces. Return compaction @@ -1031,6 +953,21 @@ private: //- Create a polyMesh from points. autoPtr<polyMesh> createPolyMeshFromPoints(const pointField& pts) const; + void checkProcessorPatchesMatch + ( + const wordList& patchTypes, + const labelList& patchSizes, + const labelList& procNeighbours + ) const; + + void reorderPoints + ( + pointField& points, + labelList& boundaryPts, + faceList& faces, + const label nInternalFaces + ) const; + //- Rotate the faces on processor patches if necessary void reorderProcessorPatches ( @@ -1078,6 +1015,8 @@ public: // surface as required void move(); + void printVertexInfo() const; + //- Check if the point is in the domain handled by this processor bool positionOnThisProc(const Foam::point& pt) const; @@ -1094,30 +1033,18 @@ public: const List<Foam::point>& ends ) const; - //- Which other processors does each sphere overlap - labelListList overlapsProc - ( - const List<Foam::point>& centres, - const List<scalar>& radiusSqrs - ) const; - - //- Conversion functions between point (FOAM::) and Point (CGAL) - -# ifdef CGAL_INEXACT - typedef const Foam::point& pointFromPoint; - typedef const Point& PointFrompoint; -# else - typedef Foam::point pointFromPoint; - typedef Point PointFrompoint; -# endif - - inline pointFromPoint topoint(const Point&) const; - inline PointFrompoint toPoint(const Foam::point&) const; +// //- Which other processors does each sphere overlap +// labelListList overlapsProc +// ( +// const List<Foam::point>& centres, +// const List<scalar>& radiusSqrs +// ) const; typedef K::Vector_3 CGALVector; inline CGALVector toCGALVector(const Foam::vector& v) const; + // Access //- Return the Time object @@ -1135,8 +1062,8 @@ public: //- Return the backgroundMeshDecomposition inline const backgroundMeshDecomposition& decomposition() const; - //- Return the cellSizeControlSurfaces object - inline const cellSizeControlSurfaces& cellSizeControl() const; + //- Return the cellShapeControl object + inline const cellShapeControl& cellShapeControls() const; //- Return the cvMeshControls object inline const cvControls& cvMeshControls() const; @@ -1159,8 +1086,21 @@ public: label offset = 0 ) const; - //- Write Delaunay points to .obj file - void writePoints(const fileName& fName, bool internalOnly) const; + //- Write Delaunay points in the range between (and including) + // type startPointType and endPointType to .obj file + void writePoints + ( + const fileName& fName, + const Foam::indexedVertexEnum::vertexType startPointType, + const Foam::indexedVertexEnum::vertexType endPointType + ) const; + + //- Write Delaunay points of type pointType to .obj file + void writePoints + ( + const fileName& fName, + const Foam::indexedVertexEnum::vertexType pointType + ) const; //- Write the boundary Delaunay points to .obj file void writeBoundaryPoints(const fileName& fName) const; @@ -1172,17 +1112,20 @@ public: const List<Foam::point>& points ) const; + //- Write list of points to file + void writePoints + ( + const fileName& fName, + const List<Vb>& points + ) const; + //- Write the internal Delaunay vertices of the tessellation as a // pointField that may be used to restart the meshing process void writeInternalDelaunayVertices(const fileName& instance) const; //- Prepare data and call writeMesh for polyMesh and // tetDualMesh - void writeMesh - ( - const fileName& instance, - bool filterFaces = true - ); + void writeMesh(const fileName& instance); //- Write mesh to disk void writeMesh @@ -1190,6 +1133,7 @@ public: const word& meshName, const fileName& instance, pointField& points, + labelList& boundaryPts, faceList& faces, labelList& owner, labelList& neighbour, @@ -1198,7 +1142,8 @@ public: const labelList& patchSizes, const labelList& patchStarts, const labelList& procNeighbours, - const pointField& cellCentres + const pointField& cellCentres, + const PackedBoolList& boundaryFacesToRemove ) const; //- Write points and faces as .obj file @@ -1214,6 +1159,8 @@ public: // actual cell size (cbrt(actual cell volume)). void writeCellSizes(const fvMesh& mesh) const; + void writeCellAlignments(const fvMesh& mesh) const; + //- Calculate and write the cell centres. void writeCellCentres(const fvMesh& mesh) const; @@ -1226,90 +1173,6 @@ public: const fileName& fName, const faceList& faces ) const; - - //- Function inserting points into a triangulation and setting the - // index and type data of the point in the correct order. This is - // faster than inserting points individually. - // - // Adapted from a post on the CGAL lists: 2010-01/msg00004.html by - // Sebastien Loriot (Geometry Factory). - // - // @todo problems putting declaration in the .C file. Function - // prototype is not recognised. - template<class Triangulation, class Point_iterator> - void rangeInsertWithInfo - ( - Point_iterator begin, - Point_iterator end, - Triangulation& T, - DynamicList<label>& indices, - DynamicList<label>& types - ) - { - typedef std::vector - < - std::pair<const typename Triangulation::Point*, label> - > vectorPairPointIndex; - - vectorPairPointIndex points; - label index = 0; - - for (Point_iterator it = begin; it != end; ++it) - { - points.push_back - ( - std::make_pair(&(toPoint(*it)), index++) - ); - } - - std::random_shuffle(points.begin(), points.end()); - - spatial_sort - ( - points.begin(), - points.end(), - Traits_for_spatial_sort<Triangulation>() - ); - - typename Triangulation::Vertex_handle hint; - - for - ( - typename vectorPairPointIndex::const_iterator - p = points.begin(); - p != points.end(); - ++p - ) - { - const size_t checkInsertion = T.number_of_vertices(); - - hint = T.insert(*(p->first), hint); - - if (checkInsertion != T.number_of_vertices() - 1) - { - Pout<< "Failed to insert point " - << topoint(*(p->first)) << endl; - } - else - { - label oldIndex = p->second; - - label type = types[oldIndex]; - - if (type > Vb::vtFar) - { - // This is a member of a point pair, don't use the - // type directly (note that this routine never gets - // called for referredPoints so type will never be - // -procI - type += checkInsertion; - } - - hint->index() = indices[oldIndex] + checkInsertion; - hint->type() = type; - } - } - } }; @@ -1321,10 +1184,6 @@ public: #include "conformalVoronoiMeshI.H" -//#ifdef NoRepository -//# include "conformalVoronoiMeshTemplates.C" -//#endif - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index ec81b1e944a87fb5ce143b11443d6f430def8325..d2aa6a802719178a934a387ab860f067d7458414 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -27,35 +27,22 @@ License #include "motionSmoother.H" #include "backgroundMeshDecomposition.H" #include "polyMeshGeometry.H" +#include "indexedCellChecks.H" + +#include "CGAL/Exact_predicates_exact_constructions_kernel.h" +#include "CGAL/Gmpq.h" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -void Foam::conformalVoronoiMesh::calcDualMesh -( - pointField& points, - faceList& faces, - labelList& owner, - labelList& neighbour, - wordList& patchTypes, - wordList& patchNames, - labelList& patchSizes, - labelList& patchStarts, - labelList& procNeighbours, - pointField& cellCentres, - labelList& cellToDelaunayVertex, - labelListList& patchToDelaunayVertex, - bool filterFaces -) +void Foam::conformalVoronoiMesh::checkCells() { - timeCheck("Start calcDualMesh"); - - setVertexSizeAndAlignment(); + List<List<FixedList<Foam::point, 4> > > cellListList(Pstream::nProcs()); - timeCheck("After setVertexSizeAndAlignment"); + List<FixedList<Foam::point, 4> > cells(number_of_finite_cells()); - // Make all filterCount values zero except on cells that are attached - // points that are on the parallel interface. These will not be moved. + globalIndex gIndex(number_of_vertices()); + label count = 0; for ( Delaunay::Finite_cells_iterator cit = finite_cells_begin(); @@ -63,214 +50,508 @@ void Foam::conformalVoronoiMesh::calcDualMesh ++cit ) { - if - ( - !cit->vertex(0)->real() - || !cit->vertex(1)->real() - || !cit->vertex(2)->real() - || !cit->vertex(3)->real() - ) + if (tetrahedron(cit).volume() == 0) { - cit->filterCount() = - cvMeshControls().filterCountSkipThreshold() + 1; + Pout<< "ZERO VOLUME TET" << endl; + Pout<< cit->info(); + Pout<< cit->dual(); } - else + + if (cit->hasFarPoint()) + { + continue; + } + + List<labelPair> cellVerticesPair(4); + List<Foam::point> cellVertices(4); + + for (label vI = 0; vI < 4; ++vI) + { + cellVerticesPair[vI] = labelPair + ( + cit->vertex(vI)->procIndex(), + cit->vertex(vI)->index() + ); + cellVertices[vI] = topoint(cit->vertex(vI)->point()); + } + + List<Foam::point> cellVerticesOld(cellVertices); + labelList oldToNew; + sortedOrder(cellVerticesPair, oldToNew); + oldToNew = invert(oldToNew.size(), oldToNew); + inplaceReorder(oldToNew, cellVerticesPair); + inplaceReorder(oldToNew, cellVertices); + +// FixedList<label, 4> globalTetCell +// ( +// cit->globallyOrderedCellVertices(gIndex) +// ); +// +// FixedList<Point, 4> cellVertices(Point(0,0,0)); +// +// forAll(globalTetCell, gvI) +// { +// label gI = globalTetCell[gvI]; +// +// cellVertices[gvI] = cit->vertex(gI)->point(); +// } + +// if (cit->hasFarPoint()) +// { +// continue; +// } + + for (label i = 0; i < 4; ++i) { - cit->filterCount() = 0; + //cells[count][i] = topoint(cit->vertex(i)->point()); + cells[count][i] = cellVertices[i]; } + + count++; } - // THIS CODE STOPS ALL FACES NEAR ANY PROCESSOR BOUNDARY BEING FILTERED. - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - vit++ - ) + cells.setSize(count); + + cellListList[Pstream::myProcNo()] = cells; + + Pstream::gatherList(cellListList); + + if (Pstream::master()) { - std::list<Cell_handle> cells; - incident_cells(vit, std::back_inserter(cells)); + Info<< "Checking on master processor the cells of each " << nl + << "processor point list against the master cell list." << nl + << "There are " << cellListList.size() << " processors" << nl + << "The size of each processor's cell list is:" << endl; + + forAll(cellListList, cfI) + { + Info<< " Proc " << cfI << " has " << cellListList[cfI].size() + << " cells" << endl; + } - bool hasProcPt = false; + label nMatches = 0, nMatchFoundDiffOrder = 0; - for - ( - std::list<Cell_handle>::iterator cit = cells.begin(); - cit != cells.end(); - ++cit - ) + forAll(cellListList[0], cmI) { - // Allow filtering if any vertices are far points. Otherwise faces - // with boundary points attached to a cell with a far point will - // not be filtered. - if - ( - (!(*cit)->vertex(0)->real() && !(*cit)->vertex(0)->farPoint()) - || (!(*cit)->vertex(1)->real() && !(*cit)->vertex(1)->farPoint()) - || (!(*cit)->vertex(2)->real() && !(*cit)->vertex(2)->farPoint()) - || (!(*cit)->vertex(3)->real() && !(*cit)->vertex(3)->farPoint()) - ) + const FixedList<Foam::point, 4>& masterCell = cellListList[0][cmI]; + + bool matchFound = false; + bool matchFoundDiffOrder = false; + + forAll(cellListList, cpI) { - hasProcPt = true; + if (cpI == 0) + { + continue; + } + + forAll(cellListList[cpI], csI) + { + const FixedList<Foam::point, 4>& slaveCell + = cellListList[cpI][csI]; + + if (masterCell == slaveCell) + { + matchFound = true; + break; + } + else + { + label samePt = 0; + + forAll(masterCell, mI) + { + const Foam::point& mPt = masterCell[mI]; + + forAll(slaveCell, sI) + { + const Foam::point& sPt = slaveCell[sI]; + + if (mPt == sPt) + { + samePt++; + } + } + } + + if (samePt == 4) + { + matchFoundDiffOrder = true; + + Pout<< masterCell << nl << slaveCell << endl; + + break; + } + } + } + } - break; + if (matchFound) + { + nMatches++; } - } - if (hasProcPt) - { - for - ( - std::list<Cell_handle>::iterator cit = cells.begin(); - cit != cells.end(); - ++cit - ) + if (matchFoundDiffOrder) { - (*cit)->filterCount() = - cvMeshControls().filterCountSkipThreshold() + 1; + nMatchFoundDiffOrder++; } } + + Info<< "Found " << nMatches << " matching cells and " + << nMatchFoundDiffOrder << " matching cells with different " + << "vertex ordering"<< endl; } +} - PackedBoolList boundaryPts(number_of_cells(), false); - indexDualVertices(points, boundaryPts); +void Foam::conformalVoronoiMesh::checkDuals() +{ + List<List<Point> > pointFieldList(Pstream::nProcs()); + + List<Point> duals(number_of_finite_cells()); + + typedef CGAL::Exact_predicates_exact_constructions_kernel EK2; + typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK; + typedef CGAL::Cartesian_converter<typename baseK::Kernel, EK2> To_exact; + typedef CGAL::Cartesian_converter<EK2, typename baseK::Kernel> + Back_from_exact; + +// PackedBoolList bPoints(number_of_finite_cells()); + +// indexDualVertices(duals, bPoints); + + label count = 0;//duals.size(); + duals.setSize(number_of_finite_cells()); + + globalIndex gIndex(number_of_vertices()); + + for + ( + Delaunay::Finite_cells_iterator cit = finite_cells_begin(); + cit != finite_cells_end(); + ++cit + ) { - // Ideally requires a no-risk face filtering to get rid of zero area - // faces and establish if the mesh can be produced at all to the - // specified criteria + if (cit->hasFarPoint()) + { + continue; + } - Info<< nl << "Merging close points" << endl; + duals[count++] = cit->circumcenter(); - // There is no guarantee that a merge of close points is no-risk - mergeCloseDualVertices(points, boundaryPts); +// List<labelPair> cellVerticesPair(4); +// List<Point> cellVertices(4); +// +// for (label vI = 0; vI < 4; ++vI) +// { +// cellVerticesPair[vI] = labelPair +// ( +// cit->vertex(vI)->procIndex(), +// cit->vertex(vI)->index() +// ); +// cellVertices[vI] = cit->vertex(vI)->point(); +// } +// +// labelList oldToNew; +// sortedOrder(cellVerticesPair, oldToNew); +// oldToNew = invert(oldToNew.size(), oldToNew); +// inplaceReorder(oldToNew, cellVerticesPair); +// inplaceReorder(oldToNew, cellVertices); +// +// duals[count++] = CGAL::circumcenter +// ( +// cellVertices[0], +// cellVertices[1], +// cellVertices[2], +// cellVertices[3] +// ); + +// To_exact to_exact; +// Back_from_exact back_from_exact; +// EK::Construct_circumcenter_3 exact_circumcenter = +// EK().construct_circumcenter_3_object(); +// +// duals[count++] = topoint +// ( +// back_from_exact +// ( +// exact_circumcenter +// ( +// to_exact(cit->vertex(0)->point()), +// to_exact(cit->vertex(1)->point()), +// to_exact(cit->vertex(2)->point()), +// to_exact(cit->vertex(3)->point()) +// ) +// ) +// ); } - timeCheck("After initial close point merge"); + Pout<< "Duals Calculated " << count << endl; - if (filterFaces) - { - label nInitialBadQualityFaces = checkPolyMeshQuality(points).size(); + duals.setSize(count); - reduce(nInitialBadQualityFaces, sumOp<label>()); + pointFieldList[Pstream::myProcNo()] = duals; - Info<< nl << "Initial check before face collapse, found " - << nInitialBadQualityFaces << " bad quality faces" - << endl; + Pstream::gatherList(pointFieldList); - HashSet<labelPair, labelPair::Hash<> > deferredCollapseFaces; + if (Pstream::master()) + { + Info<< "Checking on master processor the dual locations of each " << nl + << "processor point list against the master dual list." << nl + << "There are " << pointFieldList.size() << " processors" << nl + << "The size of each processor's dual list is:" << endl; - if (nInitialBadQualityFaces > 0) + forAll(pointFieldList, pfI) { - Info<< nl - << "A mesh could not be produced to satisfy the specified " - << "quality criteria." << nl - << "The quality and the surface conformation controls " - << "can be altered and the " << nl - << "internalDelaunayVertices read in to try again, or more " - << "cell size resolution " << nl - << "and motion iterations can be applied in areas where " - << "problems are occurring." - << endl; + Info<< " Proc " << pfI << " has " << pointFieldList[pfI].size() + << " duals" << endl; } - if - ( - nInitialBadQualityFaces == 0 - || cvMeshControls().continueFilteringOnBadInitialPolyMesh() - ) + label nNonMatches = 0; + label nNearMatches = 0; + label nExactMatches = 0; + + forAll(pointFieldList[0], pI) { - label nBadQualityFaces = 0; + const Point& masterPoint = pointFieldList[0][pI]; - labelHashSet lastWrongFaces; + bool foundMatch = false; + bool foundNearMatch = false; - label nConsecutiveEqualFaceSets = 0; + scalar minCloseness = GREAT; + Point closestPoint(0, 0, 0); - do + forAll(pointFieldList, pfI) { - // Reindexing the Delaunay cells and regenerating the - // points resets the mesh to the starting condition. + if (pfI == 0) + { + continue; + } - indexDualVertices(points, boundaryPts); +// label pfI = 1; + forAll(pointFieldList[pfI], pISlave) { - Info<< nl << "Merging close points" << endl; + const Point& slavePoint + = pointFieldList[pfI][pISlave]; + + if (masterPoint == slavePoint) + { + foundMatch = true; + break; + } + + const scalar closeness = mag + ( + topoint(masterPoint) - topoint(slavePoint) + ); - mergeCloseDualVertices(points, boundaryPts); + if (closeness < 1e-12) + { + foundNearMatch = true; + } + else + { + if (closeness < minCloseness) + { + minCloseness = closeness; + closestPoint = slavePoint; + } + } } + if (!foundMatch) + { + if (foundNearMatch) + { + CGAL::Gmpq x(CGAL::to_double(masterPoint.x())); + CGAL::Gmpq y(CGAL::to_double(masterPoint.y())); + CGAL::Gmpq z(CGAL::to_double(masterPoint.z())); + + std::cout<< "master = " << x << " " << y << " " << z + << std::endl; + + CGAL::Gmpq xs(CGAL::to_double(closestPoint.x())); + CGAL::Gmpq ys(CGAL::to_double(closestPoint.y())); + CGAL::Gmpq zs(CGAL::to_double(closestPoint.z())); + std::cout<< "slave = " << xs << " " << ys << " " << zs + << std::endl; + + nNearMatches++; + } + else + { + nNonMatches++; + Info<< " Closest point to " << masterPoint << " is " + << closestPoint << nl + << " Separation is " << minCloseness << endl; + + CGAL::Gmpq x(CGAL::to_double(masterPoint.x())); + CGAL::Gmpq y(CGAL::to_double(masterPoint.y())); + CGAL::Gmpq z(CGAL::to_double(masterPoint.z())); + + std::cout<< "master = " << x << " " << y << " " << z + << endl; + + CGAL::Gmpq xs(CGAL::to_double(closestPoint.x())); + CGAL::Gmpq ys(CGAL::to_double(closestPoint.y())); + CGAL::Gmpq zs(CGAL::to_double(closestPoint.z())); + std::cout<< "slave = " << xs << " " << ys << " " << zs + << endl; + } + } + else { - // Risky and undo-able face filtering to reduce - // the face count as much as possible, staying - // within the specified criteria + nExactMatches++; + } + } + } + + Info<< "Found " << nNonMatches << " non-matching duals" << nl + << " and " << nNearMatches << " near matches" + << " and " << nExactMatches << " exact matches" << endl; + } +} - Info<< nl << "Smoothing surface" << endl; - smoothSurface(points, boundaryPts); +void Foam::conformalVoronoiMesh::checkVertices() +{ + List<pointField> pointFieldList(Pstream::nProcs()); - Info<< nl << "Collapsing unnecessary faces" << endl; + pointField points(number_of_vertices()); - collapseFaces(points, boundaryPts, deferredCollapseFaces); + labelPairHashSet duplicateVertices; - const scalar maxCosAngle - = cos(degToRad(cvMeshControls().edgeMergeAngle())); + label count = 0; + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (duplicateVertices.found(labelPair(vit->procIndex(), vit->index()))) + { + Pout<< "DUPLICATE " << vit->procIndex() << vit->index() << endl; + } + else + { + duplicateVertices.insert(labelPair(vit->procIndex(), vit->index())); + } - Info<< nl << "Merging adjacent edges which have an angle " - << "of greater than " - << cvMeshControls().edgeMergeAngle() << ": " << endl; + points[count++] = topoint(vit->point()); + } - label nRemovedEdges = - mergeNearlyParallelEdges(points, maxCosAngle); + pointFieldList[Pstream::myProcNo()] = points; - reduce(nRemovedEdges, sumOp<label>()); + Pstream::gatherList(pointFieldList); - Info<< " Merged " << nRemovedEdges << " edges" << endl; - } + OFstream str("missingPoints.obj"); - labelHashSet wrongFaces = checkPolyMeshQuality(points); + if (Pstream::master()) + { + Info<< "Checking on master processor the point locations of each " << nl + << "processor point list against the master point list." << nl + << "There are " << pointFieldList.size() << " processors" << nl + << "The size of each processor's point list is:" << endl; - nBadQualityFaces = wrongFaces.size(); + forAll(pointFieldList, pfI) + { + Info<< " Proc " << pfI << " has " << pointFieldList[pfI].size() + << " points" << endl; + } - reduce(nBadQualityFaces, sumOp<label>()); + label nNonMatches = 0; - Info<< nl << "Found " << nBadQualityFaces - << " bad quality faces" << endl; + forAll(pointFieldList[0], pI) + { + const Foam::point& masterPoint = pointFieldList[0][pI]; - bool sameFacesAsLastTime(lastWrongFaces == wrongFaces); + forAll(pointFieldList, pfI) + { + if (pI == 0) + { + continue; + } - reduce(sameFacesAsLastTime, andOp<bool>()); + bool foundMatch = false; - if (sameFacesAsLastTime) + forAll(pointFieldList[pfI], pISlave) { - Info<< nl << "Consecutive iterations found the same set " - << "of bad quality faces." << endl; + const Foam::point& slavePoint + = pointFieldList[pfI][pISlave]; - if - ( - ++nConsecutiveEqualFaceSets - >= cvMeshControls().maxConsecutiveEqualFaceSets() - ) + if (masterPoint == slavePoint) { - Info<< nl << nConsecutiveEqualFaceSets - << " consecutive iterations produced the same " - << "bad quality faceSet, stopping filtering" - << endl; - + foundMatch = true; break; } } - else + + if (!foundMatch) { - nConsecutiveEqualFaceSets = 0; + Info<< " Proc " << pfI << " Master != Slave -> " + << masterPoint << endl; - lastWrongFaces = wrongFaces; + meshTools::writeOBJ(str, masterPoint); + + nNonMatches++; } + } + } + + Info<< "Found a total of " << nNonMatches << " non-matching points" + << endl; + } +} - timeCheck("End of filtering iteration"); - } while (nBadQualityFaces > 0); //nInitialBadQualityFaces); - } +void Foam::conformalVoronoiMesh::calcDualMesh +( + pointField& points, + labelList& boundaryPts, + faceList& faces, + labelList& owner, + labelList& neighbour, + wordList& patchTypes, + wordList& patchNames, + labelList& patchSizes, + labelList& patchStarts, + labelList& procNeighbours, + pointField& cellCentres, + labelList& cellToDelaunayVertex, + labelListList& patchToDelaunayVertex, + PackedBoolList& boundaryFacesToRemove +) +{ + timeCheck("Start calcDualMesh"); + +// if (debug) +// { +// Pout<< nl << "Perfoming some checks . . ." << nl << nl +// << "Total number of vertices = " << number_of_vertices() << nl +// << "Total number of cells = " << number_of_finite_cells() +// << endl; +// +// checkVertices(); +// checkCells(); +// checkDuals(); +// +// Info<< nl << "Finished checks" << nl << endl; +// } + + setVertexSizeAndAlignment(); + + timeCheck("After setVertexSizeAndAlignment"); + + indexDualVertices(points, boundaryPts); + + { + Info<< nl << "Merging identical points" << endl; + + // There is no guarantee that a merge of close points is no-risk + mergeIdenticalDualVertices(points, boundaryPts); } // Final dual face and owner neighbour construction @@ -288,6 +569,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh patchStarts, procNeighbours, patchToDelaunayVertex, // from patch face to Delaunay vertex (slavePp) + boundaryFacesToRemove, false ); @@ -299,7 +581,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh cellCentres = pointField(cellCentres, cellToDelaunayVertex); - removeUnusedPoints(faces, points); + removeUnusedPoints(faces, points, boundaryPts); timeCheck("End of calcDualMesh"); } @@ -332,7 +614,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh ++vit ) { - if (vit->internalPoint() || vit->pairPoint()) + if (vit->internalPoint() || vit->boundaryPoint()) { vertexMap[vit->index()] = vertI; points[vertI] = topoint(vit->point()); @@ -376,11 +658,11 @@ void Foam::conformalVoronoiMesh::calcTetMesh List<DynamicList<label> > patchOwners(nPatches, DynamicList<label>(0)); - faces.setSize(number_of_facets()); + faces.setSize(number_of_finite_facets()); - owner.setSize(number_of_facets()); + owner.setSize(number_of_finite_facets()); - neighbour.setSize(number_of_facets()); + neighbour.setSize(number_of_finite_facets()); label faceI = 0; @@ -399,7 +681,7 @@ void Foam::conformalVoronoiMesh::calcTetMesh const int oppositeVertex = fit->second; const Cell_handle c2(c1->neighbor(oppositeVertex)); - if (c1->farCell() && c2->farCell()) + if (c1->hasFarPoint() && c2->hasFarPoint()) { // Both tets are outside, skip continue; @@ -421,10 +703,10 @@ void Foam::conformalVoronoiMesh::calcTetMesh newFace = face(verticesOnTriFace); - if (c1->farCell() || c2->farCell()) + if (c1->hasFarPoint() || c2->hasFarPoint()) { // Boundary face... - if (c1->farCell()) + if (c1->hasFarPoint()) { //... with c1 outside ownerCell = c2I; @@ -490,23 +772,23 @@ void Foam::conformalVoronoiMesh::calcTetMesh sortFaces(faces, owner, neighbour); - addPatches - ( - nInternalFaces, - faces, - owner, - patchSizes, - patchStarts, - patchFaces, - patchOwners - ); +// addPatches +// ( +// nInternalFaces, +// faces, +// owner, +// patchSizes, +// patchStarts, +// patchFaces, +// patchOwners +// ); } -void Foam::conformalVoronoiMesh::mergeCloseDualVertices +void Foam::conformalVoronoiMesh::mergeIdenticalDualVertices ( const pointField& pts, - const PackedBoolList& boundaryPts + const labelList& boundaryPts ) { // Assess close points to be merged @@ -518,18 +800,13 @@ void Foam::conformalVoronoiMesh::mergeCloseDualVertices { Map<label> dualPtIndexMap; - nPtsMerged = mergeCloseDualVertices + nPtsMerged = mergeIdenticalDualVertices ( pts, boundaryPts, dualPtIndexMap ); - // if (nPtsMerged > 0) - // { - // Pout<< " Merged " << nPtsMerged << " points " << endl; - // } - reindexDualVertices(dualPtIndexMap); reduce(nPtsMerged, sumOp<label>()); @@ -545,30 +822,15 @@ void Foam::conformalVoronoiMesh::mergeCloseDualVertices } -Foam::label Foam::conformalVoronoiMesh::mergeCloseDualVertices +Foam::label Foam::conformalVoronoiMesh::mergeIdenticalDualVertices ( const pointField& pts, - const PackedBoolList& boundaryPts, + const labelList& boundaryPts, Map<label>& dualPtIndexMap ) const { label nPtsMerged = 0; - label nIdentical = 0; - label nProcEdge = 0; - - // Relative distance for points to be merged - scalar closenessTolerance = cvMeshControls().mergeClosenessCoeff(); - - // Absolute distance for points to be considered coincident. Bit adhoc - // but points were seen with distSqr ~ 1e-30 which is SMALL^2. Add a few - // digits to account for truncation errors. - scalar coincidentDistanceSqr = sqr - ( - SMALL*1E2*geometryToConformTo_.globalBounds().mag() - ); - - for ( Delaunay::Finite_facets_iterator fit = finite_facets_begin(); @@ -580,1260 +842,312 @@ Foam::label Foam::conformalVoronoiMesh::mergeCloseDualVertices const int oppositeVertex = fit->second; const Cell_handle c2(c1->neighbor(oppositeVertex)); - label& c1I = c1->cellIndex(); - label& c2I = c2->cellIndex(); - - if (dualPtIndexMap.found(c1I) || dualPtIndexMap.found(c2I)) + if (is_infinite(c1) || is_infinite(c2)) { - // One of the points of this edge has already been - // merged this sweep, leave for next sweep - continue; } - if ((c1I != c2I) && !c1->farCell() && !c2->farCell()) + label& c1I = c1->cellIndex(); + label& c2I = c2->cellIndex(); + + if ((c1I != c2I) && !c1->hasFarPoint() && !c2->hasFarPoint()) { - scalar distSqr = magSqr(pts[c1I] - pts[c2I]); + const Foam::point& p1 = pts[c1I]; + const Foam::point& p2 = pts[c2I]; - if (pts[c1I] == pts[c2I] || distSqr < coincidentDistanceSqr) + if (p1 == p2) { - nIdentical++; - - if (boundaryPts[c2I] == true) - { - // If c2I is a boundary point, then it is kept. - // If both are boundary points then c2I is chosen - // arbitrarily to be kept. - - dualPtIndexMap.insert(c1I, c2I); - dualPtIndexMap.insert(c2I, c2I); - nPtsMerged++; - } - else + if (c1I < c2I) { dualPtIndexMap.insert(c1I, c1I); dualPtIndexMap.insert(c2I, c1I); - nPtsMerged++; - } - - } - else if (distSqr < sqr(averageAnyCellSize(fit)*closenessTolerance)) - { - if (c1->parallelDualVertex() || c2->parallelDualVertex()) - //if (isParallelDualEdge(fit)) - { - // Skip if face uses any edge that becomes a processor - // dual face. - // Note: the real test should be whether the Delaunay edge - // will form a processor patch. - nProcEdge++; } - else if (boundaryPts[c2I] == true) + else { - // If c2I is a boundary point, then it is kept. - // If both are boundary points then c2I is chosen - // arbitrarily to be kept. - dualPtIndexMap.insert(c1I, c2I); dualPtIndexMap.insert(c2I, c2I); - nPtsMerged++; - } - else - { - dualPtIndexMap.insert(c1I, c1I); - dualPtIndexMap.insert(c2I, c1I); - nPtsMerged++; - } - } - } - } - - if (debug) - { - Info<< "mergeCloseDualVertices:" - << " coincident distance:" << coincidentDistanceSqr - << " closenessTolerance:" << closenessTolerance << endl - << " zero-length edges : " - << returnReduce(nIdentical, sumOp<label>()) << endl - << " protected processor edges : " - << returnReduce(nProcEdge, sumOp<label>()) << endl - << " collapsed edges : " - << returnReduce(nPtsMerged, sumOp<label>()) << endl - << endl; - } - - return nPtsMerged; -} - - -Foam::label Foam::conformalVoronoiMesh::mergeNearlyParallelEdges -( - const pointField& pts, - const scalar maxCosAngle -) -{ - List<HashSet<label> > pointFaceCount(number_of_cells()); - labelList pointNeighbour(number_of_cells(), -1); - - Map<label> dualPtIndexMap; - - for - ( - Delaunay::Finite_edges_iterator eit = finite_edges_begin(); - eit != finite_edges_end(); - ++eit - ) - { - Cell_handle c = eit->first; - Vertex_handle vA = c->vertex(eit->second); - Vertex_handle vB = c->vertex(eit->third); - - if (isBoundaryDualFace(eit)) - { - const face f = buildDualFace(eit); - - forAll(f, pI) - { - const label pIndex = f[pI]; - - const label prevPointI = f.prevLabel(pI); - const label nextPointI = f.nextLabel(pI); - - pointFaceCount[pIndex].insert(prevPointI); - pointFaceCount[pIndex].insert(nextPointI); - pointNeighbour[pIndex] = nextPointI; - } - } - else if - ( - vA->internalOrBoundaryPoint() - || vB->internalOrBoundaryPoint() - ) - { - const face f = buildDualFace(eit); - const boolList faceBoundaryPoints = dualFaceBoundaryPoints(eit); - - forAll(f, pI) - { - const label pIndex = f[pI]; - - const label prevPointI = f.prevLabel(pI); - const label nextPointI = f.nextLabel(pI); - - pointFaceCount[pIndex].insert(prevPointI); - pointFaceCount[pIndex].insert(nextPointI); - - if (faceBoundaryPoints[pI] == false) - { - pointNeighbour[pIndex] = nextPointI; - } - else - { - if (faceBoundaryPoints[prevPointI] == true) - { - pointNeighbour[pIndex] = prevPointI; - } - else if (faceBoundaryPoints[nextPointI] == true) - { - pointNeighbour[pIndex] = nextPointI; - } - else - { - pointNeighbour[pIndex] = pIndex; - } - } - } - } - } - - forAll(pointFaceCount, pI) - { - if (pointFaceCount[pI].size() == 2) - { - List<vector> edges(2, vector(0, 0, 0)); - - label count = 0; - forAllConstIter(HashSet<label>, pointFaceCount[pI], iter) - { - edges[count] = pts[pI] - pts[iter.key()]; - edges[count] /= mag(edges[count]) + VSMALL; - count++; - } - - if (mag(edges[0] & edges[1]) > maxCosAngle) - { - dualPtIndexMap.insert(pI, pointNeighbour[pI]); - } - } - } - - reindexDualVertices(dualPtIndexMap); - - return dualPtIndexMap.size(); -} - - -void Foam::conformalVoronoiMesh::smoothSurface -( - pointField& pts, - const PackedBoolList& boundaryPts -) -{ - label nCollapsedFaces = 0; - - label iterI = 0; - - do - { - Map<label> dualPtIndexMap; - - nCollapsedFaces = smoothSurfaceDualFaces - ( - pts, - boundaryPts, - dualPtIndexMap - ); - - reduce(nCollapsedFaces, sumOp<label>()); - - reindexDualVertices(dualPtIndexMap); - - mergeCloseDualVertices(pts, boundaryPts); - - if (nCollapsedFaces > 0) - { - Info<< " Collapsed " << nCollapsedFaces << " boundary faces" - << endl; - } - - if (++iterI > cvMeshControls().maxCollapseIterations()) - { - Info<< " maxCollapseIterations reached, stopping collapse" - << endl; - - break; - } - - } while (nCollapsedFaces > 0); - - // Force all points of boundary faces to be on the surface - for - ( - Delaunay::Finite_cells_iterator cit = finite_cells_begin(); - cit != finite_cells_end(); - ++cit - ) - { - label ptI = cit->cellIndex(); - - label fC = cit->filterCount(); - - if (fC > cvMeshControls().filterCountSkipThreshold()) - { - // This vertex has been limited too many times, skip - continue; - } - - // Only cells with indices > -1 are valid - if (ptI > -1) - { - if (boundaryPts[ptI] == true) - { - Foam::point& pt = pts[ptI]; - - pointIndexHit surfHit; - label hitSurface; - - geometryToConformTo_.findSurfaceNearest - ( - pt, - sqr(GREAT), - surfHit, - hitSurface - ); - - if (surfHit.hit()) - { - pt += - (surfHit.hitPoint() - pt) - *pow(cvMeshControls().filterErrorReductionCoeff(), fC); - } - } - } - } - - mergeCloseDualVertices(pts, boundaryPts); -} - - -Foam::label Foam::conformalVoronoiMesh::smoothSurfaceDualFaces -( - pointField& pts, - const PackedBoolList& boundaryPts, - Map<label>& dualPtIndexMap -) const -{ - label nCollapsedFaces = 0; - - const scalar cosPerpendicularToleranceAngle = cos - ( - degToRad(cvMeshControls().surfaceStepFaceAngle()) - ); - - for - ( - Delaunay::Finite_edges_iterator eit = finite_edges_begin(); - eit != finite_edges_end(); - ++eit - ) - { - Cell_circulator ccStart = incident_cells(*eit); - Cell_circulator cc = ccStart; - - bool skipFace = false; - - do - { - if (dualPtIndexMap.found(cc->cellIndex())) - { - // One of the points of this face has already been - // collapsed this sweep, leave for next sweep - - skipFace = true; - - break; - } - - } while (++cc != ccStart); - - if (skipFace) - { - continue; - } - - if (isBoundaryDualFace(eit)) - { - face dualFace = buildDualFace(eit); - - if (dualFace.size() < 3) - { - // This face has been collapsed already - continue; - } - - label maxFC = maxFilterCount(eit); - - if (maxFC > cvMeshControls().filterCountSkipThreshold()) - { - // A vertex on this face has been limited too many - // times, skip - continue; - } - - pointIndexHit surfHit; - label hitSurface; - - geometryToConformTo_.findSurfaceNearest - ( - dualFace.centre(pts), - sqr(GREAT), - surfHit, - hitSurface - ); - - vectorField norm(1); - - allGeometry_[hitSurface].getNormal - ( - List<pointIndexHit>(1, surfHit), - norm - ); - - const vector& surfaceNormal = norm[0]; - - // Orient the face correctly before calculating the normal - - Cell_handle c = eit->first; - Vertex_handle vA = c->vertex(eit->second); - Vertex_handle vB = c->vertex(eit->third); - - if (!vA->internalOrBoundaryPoint()) - { - reverse(dualFace); - } - - vector faceNormal = dualFace.normal(pts); - - if (mag(faceNormal) < VSMALL) - { - // If the face is essentially zero area, then force it - // to be collapsed by making the dot product result -1 - faceNormal = -surfaceNormal; - } - else - { - faceNormal /= mag(faceNormal); - } - - if ((faceNormal & surfaceNormal) < cosPerpendicularToleranceAngle) - { - scalar targetFaceSize = averageAnyCellSize(vA, vB); - - // Selecting faces to collapse based on angle to - // surface, so set collapseSizeLimitCoeff to GREAT to - // allow collapse of all faces - - faceCollapseMode mode = collapseFace - ( - dualFace, - pts, - boundaryPts, - dualPtIndexMap, - targetFaceSize, - GREAT, - maxFC - ); - - if (mode == fcmPoint || mode == fcmEdge) - { - nCollapsedFaces++; - } - } - } - } - - return nCollapsedFaces; -} - - -void Foam::conformalVoronoiMesh::collapseFaces -( - pointField& pts, - const PackedBoolList& boundaryPts, - HashSet<labelPair, labelPair::Hash<> >& deferredCollapseFaces -) -{ - label nCollapsedFaces = 0; - - label iterI = 0; - - do - { - Map<label> dualPtIndexMap; - - deferredCollapseFaces.clear(); - - nCollapsedFaces = collapseFaces - ( - pts, - boundaryPts, - dualPtIndexMap, - deferredCollapseFaces - ); - - reduce(nCollapsedFaces, sumOp<label>()); - - reindexDualVertices(dualPtIndexMap); - - mergeCloseDualVertices(pts, boundaryPts); - - - if (nCollapsedFaces > 0) - { - Info<< " Collapsed " << nCollapsedFaces << " faces" << endl; - // Info<< "dualPtIndexMap" << nl << dualPtIndexMap << endl; - } - - if (++iterI > cvMeshControls().maxCollapseIterations()) - { - Info<< nl << "maxCollapseIterations reached, stopping collapse" - << endl; - - break; - } - - } while (nCollapsedFaces > 0); - -} - - -Foam::label Foam::conformalVoronoiMesh::collapseFaces -( - pointField& pts, - const PackedBoolList& boundaryPts, - Map<label>& dualPtIndexMap, - HashSet<labelPair, labelPair::Hash<> >& deferredCollapseFaces -) const -{ - label nCollapsedFaces = 0; - - scalar collapseSizeLimitCoeff = cvMeshControls().filterSizeCoeff(); - - for - ( - Delaunay::Finite_edges_iterator eit = finite_edges_begin(); - eit != finite_edges_end(); - ++eit - ) - { - Cell_circulator ccStart = incident_cells(*eit); - Cell_circulator cc = ccStart; - - bool skipFace = false; - - do - { - if (dualPtIndexMap.found(cc->cellIndex())) - { - // One of the points of this face has already been - // collapsed this sweep, leave for next sweep - - skipFace = true; - - break; - } - - } while (++cc != ccStart); - - if (skipFace) - { - continue; - } - - Cell_handle c = eit->first; - Vertex_handle vA = c->vertex(eit->second); - Vertex_handle vB = c->vertex(eit->third); - - if - ( - vA->internalOrBoundaryPoint() - || vB->internalOrBoundaryPoint() - ) - { - face dualFace = buildDualFace(eit); - - if (dualFace.size() < 3) - { - continue; - } - - label maxFC = maxFilterCount(eit); - - if (maxFC > cvMeshControls().filterCountSkipThreshold()) - { - continue; - } - - scalar targetFaceSize = averageAnyCellSize(vA, vB); - - faceCollapseMode mode = collapseFace - ( - dualFace, - pts, - boundaryPts, - dualPtIndexMap, - targetFaceSize, - collapseSizeLimitCoeff, - maxFC - ); - - if (mode != fcmNone) - { - if (mode == fcmDeferredMultiEdge) - { - // Determine the owner and neighbour labels - - Pair<label> ownAndNei(-1, -1); - - ownerAndNeighbour - ( - vA, - vB, - ownAndNei.first(), - ownAndNei.second() - ); - - // Record the owner and neighbour of this face for a - // deferredMultiEdge collapse - - deferredCollapseFaces.insert(ownAndNei); - } - else - { - nCollapsedFaces++; - } - } - } - } - - return nCollapsedFaces; -} - - -Foam::conformalVoronoiMesh::faceCollapseMode -Foam::conformalVoronoiMesh::collapseFace -( - const face& f, - pointField& pts, - const PackedBoolList& boundaryPts, - Map<label>& dualPtIndexMap, - scalar targetFaceSize, - scalar collapseSizeLimitCoeff, - label maxFC -) const -{ - bool limitToQuadsOrTris = false; - - bool allowEarlyCollapseToPoint = true; - - -// // Quick exit -// label smallEdges = 0; -// const edgeList& fEdges = f.edges(); -// forAll(fEdges, eI) -// { -// const edge& e = fEdges[eI]; -// -// if (e.mag(pts) < 0.2*targetFaceSize) -// { -// smallEdges++; -// } -// } -// if (smallEdges == 0) -// { -// return fcmNone; -// } - - - // if (maxFC > cvMeshControls().filterCountSkipThreshold() - 3) - // { - // limitToQuadsOrTris = true; - - // allowEarlyCollapseToPoint = false; - // } - - - collapseSizeLimitCoeff *= pow - ( - cvMeshControls().filterErrorReductionCoeff(), - maxFC - ); - - labelList facePts(f); - - const Foam::point fC = f.centre(pts); - - vector fN = f.normal(pts); - - const scalar fA = mag(fN); - - tensor J = f.inertia(pts, fC); - - // Find the dominant collapse direction by finding the eigenvector - // that corresponds to the normal direction, discarding it. The - // eigenvector corresponding to the smaller of the two remaining - // eigenvalues is the dominant axis in a high aspect ratio face. - - scalar magJ = mag(J); - - scalar detJ = SMALL; - - if (magJ > VSMALL) - { - // Normalise inertia tensor to remove problems with small values - - J /= mag(J); - // J /= cmptMax(J); - // J /= max(eigenValues(J).x(), SMALL); - - // Calculating determinant, including stabilisation for zero or - // small negative values - - detJ = max(det(J), SMALL); - } - - vector collapseAxis = vector::zero; - - scalar aspectRatio = 1.0; - - if (detJ < 1e-5) - { - collapseAxis = f.edges()[longestEdge(f, pts)].vec(pts); - - collapseAxis /= mag(collapseAxis); - - // Empirical correlation for high aspect ratio faces - - aspectRatio = sqrt(0.35/detJ); - } - else - { - vector eVals = eigenValues(J); - - if (mag(eVals.y() - eVals.x()) < 100*SMALL) - { - // First two eigenvalues are the same: i.e. a square face - - // Cannot necessarily determine linearly independent - // eigenvectors, or any at all, use longest edge direction. - - collapseAxis = f.edges()[longestEdge(f, pts)].vec(pts); - - collapseAxis /= mag(collapseAxis); - - aspectRatio = 1.0; - } - else - { - // The maximum eigenvalue (z()) must be the direction of the - // normal, as it has the greatest value. The minimum eigenvalue - // is the dominant collapse axis for high aspect ratio faces. - - collapseAxis = eigenVector(J, eVals.x()); - - // The inertia calculation describes the mass distribution as a - // function of distance squared to the axis, so the square root of - // the ratio of face-plane moments gives a good indication of the - // aspect ratio. - - aspectRatio = sqrt(eVals.y()/max(eVals.x(), SMALL)); - } - } - - - scalar maxDist = 0; - scalar minDist = GREAT; -// -// if (f.size() <= 3) -// { -// const edgeList& fEdges = f.edges(); -// -// forAll(fEdges, eI) -// { -// const edge& e = fEdges[eI]; -// const scalar d = e.mag(pts); -// -// if (d > maxDist) -// { -// maxDist = d; -// collapseAxis = e.vec(pts); -// } -// else if (d < minDist && d != 0) -// { -// minDist = d; -// } -// } -// } -// else -// { -// forAll(f, pI) -// { -// for (label i = pI + 1; i < f.size(); ++i) -// { -// if -// ( -// f[i] != f.nextLabel(pI) -// && f[i] != f.prevLabel(pI) -// ) -// { -// scalar d = mag(pts[f[pI]] - pts[f[i]]); -// -// if (d > maxDist) -// { -// maxDist = d; -// collapseAxis = pts[f[pI]] - pts[f[i]]; -// } -// else if (d < minDist && d != 0) -// { -// minDist = d; -// } -// } -// } -// } -// } -// -// const edgeList& fEdges = f.edges(); -// -// scalar perimeter = 0; -// -// forAll(fEdges, eI) -// { -// const edge& e = fEdges[eI]; -// const scalar d = e.mag(pts); -// -// perimeter += d; -// -//// collapseAxis += e.vec(pts); -// -// if (d > maxDist) -// { -// collapseAxis = e.vec(pts); -// maxDist = d; -// } -// else if (d < minDist && d != 0) -// { -// minDist = d; -// } -// } -// -// collapseAxis /= mag(collapseAxis); -// -//// Info<< f.size() << " " << minDist << " " << maxDist << " | " -//// << collapseAxis << endl; -// -// aspectRatio = maxDist/minDist; -// -// aspectRatio = min(aspectRatio, sqr(perimeter)/(16.0*fA)); - - if (magSqr(collapseAxis) < VSMALL) - { - WarningIn - ( - "Foam::conformalVoronoiMesh::collapseFace" - ) - << "No collapse axis found for face, not collapsing." - << endl; - - // Output face and collapse axis for visualisation - - Pout<< "# Aspect ratio = " << aspectRatio << nl -// << "# inertia = " << J << nl -// << "# determinant = " << detJ << nl -// << "# eigenvalues = " << eigenValues(J) << nl - << "# collapseAxis = " << collapseAxis << nl - << "# facePts = " << facePts << nl - << endl; - - forAll(f, fPtI) - { - meshTools::writeOBJ(Pout, pts[f[fPtI]]); - } - - Pout<< "f"; - - forAll(f, fPtI) - { - Pout << " " << fPtI + 1; - } - - Pout<< endl; - - return fcmNone; - } - - // The signed distance along the collapse axis passing through the - // face centre that each vertex projects to. - - Field<scalar> d(f.size()); - - forAll(f, fPtI) - { - const Foam::point& pt = pts[f[fPtI]]; - - d[fPtI] = (collapseAxis & (pt - fC)); - } - - // Sort the projected distances and the corresponding vertex - // indices along the collapse axis - - labelList oldToNew; - - sortedOrder(d, oldToNew); - - oldToNew = invert(oldToNew.size(), oldToNew); - - inplaceReorder(oldToNew, d); - - inplaceReorder(oldToNew, facePts); - - // Shift the points so that they are relative to the centre of the - // collapse line. - - scalar dShift = -0.5*(d.first() + d.last()); - - d += dShift; - - // Form two lists, one for each half of the set of points - // projected along the collapse axis. - - // Middle value, index of first entry in the second half - label middle = -1; - - forAll(d, dI) - { - if (d[dI] > 0) - { - middle = dI; - - break; - } - } - - // Negative half - SubList<scalar> dNeg(d, middle, 0); - SubList<label> facePtsNeg(facePts, middle, 0); - - // Positive half - SubList<scalar> dPos(d, d.size() - middle, middle); - SubList<label> facePtsPos(facePts, d.size() - middle, middle); - - // Defining how close to the midpoint (M) of the projected - // vertices line a projected vertex (X) can be before making this - // an invalid edge collapse - // - // X---X-g----------------M----X-----------g----X--X - // - // Only allow a collapse if all projected vertices are outwith - // guardFraction (g) of the distance form the face centre to the - // furthest vertex in the considered direction - - if (dNeg.size() == 0 || dPos.size() == 0) - { - WarningIn - ( - "Foam::conformalVoronoiMesh::collapseFace" - ) - << "All points on one side of face centre, not collapsing." - << endl; - } - - faceCollapseMode mode = fcmNone; - - if - ( - (fA < aspectRatio*sqr(targetFaceSize*collapseSizeLimitCoeff)) - && (!limitToQuadsOrTris || f.size() <= 4) - ) - { - scalar guardFraction = cvMeshControls().edgeCollapseGuardFraction(); - - if - ( - allowEarlyCollapseToPoint - && (d.last() - d.first()) - < targetFaceSize - *0.2*cvMeshControls().maxCollapseFaceToPointSideLengthCoeff() - ) - { - mode = fcmPoint; - } - else if - ( - (dNeg.last() < guardFraction*dNeg.first()) - && (dPos.first() > guardFraction*dPos.last()) - ) - { - mode = fcmEdge; - } - else if - ( - (d.last() - d.first()) - < targetFaceSize - *cvMeshControls().maxCollapseFaceToPointSideLengthCoeff() - ) - { - // If the face can't be collapsed to an edge, and it has a - // small enough span, collapse it to a point. - - mode = fcmPoint; - } - else - { - // Alternatively, do not topologically collapse face here, - // but push all points onto a line, so that the face area - // is zero and then collapse to a string of edges later. - // The fcmDeferredMultiEdge collapse must be performed at - // the polyMesh stage as this type of collapse can't be - // performed and still maintain topological dual - // consistency with the Delaunay structure - - mode = fcmDeferredMultiEdge; - } - } - - switch (mode) - { - case fcmEdge: - { - // Negative half - - label collapseToPtI = facePtsNeg.first(); - - Foam::point collapseToPt = - collapseAxis*(sum(dNeg)/dNeg.size() - dShift) + fC; - -// DynamicList<label> faceBoundaryPts(f.size()); - - forAll(facePtsNeg, fPtI) - { - if (boundaryPts[facePtsNeg[fPtI]] == true) - { - // If there is a point which is on the boundary, - // use it as the point to collapse others to, will - // use the first boundary point encountered if - // there are multiple boundary points. - - collapseToPtI = facePtsNeg[fPtI]; - - collapseToPt = pts[collapseToPtI]; - - break; - -// faceBoundaryPts.append(facePtsNeg[fPtI]); - } - } - -// if (!faceBoundaryPts.empty()) -// { -// if (faceBoundaryPts.size() == 2) -// { -// collapseToPtI = faceBoundaryPts[0]; -// -// collapseToPt = -// 0.5 -// *( -// pts[faceBoundaryPts[0]] -// + pts[faceBoundaryPts[1]] -// ); -// } -// else if (faceBoundaryPts.size() < f.size()) -// { -// face bFace(faceBoundaryPts); -// -// collapseToPtI = faceBoundaryPts.first(); -// -// collapseToPt = bFace.centre(pts); -// } -// } -// -// faceBoundaryPts.clear(); - - // ...otherwise arbitrarily choosing the most distant - // point as the index to collapse to. - - forAll(facePtsNeg, fPtI) - { - dualPtIndexMap.insert(facePtsNeg[fPtI], collapseToPtI); - } - - pts[collapseToPtI] = collapseToPt; - - // Positive half - - collapseToPtI = facePtsPos.last(); - - collapseToPt = collapseAxis*(sum(dPos)/dPos.size() - dShift) + fC; - - forAll(facePtsPos, fPtI) - { - if (boundaryPts[facePtsPos[fPtI]] == true) - { - // If there is a point which is on the boundary, - // use it as the point to collapse others to, will - // use the first boundary point encountered if - // there are multiple boundary points. - - collapseToPtI = facePtsPos[fPtI]; - - collapseToPt = pts[collapseToPtI]; - - break; - -// faceBoundaryPts.append(facePtsNeg[fPtI]); - } - } - -// if (!faceBoundaryPts.empty()) -// { -// if (faceBoundaryPts.size() == 2) -// { -// collapseToPtI = faceBoundaryPts[0]; -// -// collapseToPt = -// 0.5 -// *( -// pts[faceBoundaryPts[0]] -// + pts[faceBoundaryPts[1]] -// ); -// } -// else if (faceBoundaryPts.size() < f.size()) -// { -// face bFace(faceBoundaryPts); -// -// collapseToPtI = faceBoundaryPts.first(); -// -// collapseToPt = bFace.centre(pts); -// } -// } - - // ...otherwise arbitrarily choosing the most distant - // point as the index to collapse to. - - forAll(facePtsPos, fPtI) - { - dualPtIndexMap.insert(facePtsPos[fPtI], collapseToPtI); - } - - pts[collapseToPtI] = collapseToPt; - - break; - } - - case fcmPoint: - { - label collapseToPtI = facePts.first(); - - Foam::point collapseToPt = fC; - - DynamicList<label> faceBoundaryPts(f.size()); - - forAll(facePts, fPtI) - { - if (boundaryPts[facePts[fPtI]] == true) - { - // If there is a point which is on the boundary, - // use it as the point to collapse others to, will - // use the first boundary point encountered if - // there are multiple boundary points. - -// collapseToPtI = facePts[fPtI]; -// -// collapseToPt = pts[collapseToPtI]; -// -// break; - - faceBoundaryPts.append(facePts[fPtI]); - } - } - - if (!faceBoundaryPts.empty()) - { - if (faceBoundaryPts.size() == 2) - { - collapseToPtI = faceBoundaryPts[0]; - - collapseToPt = - 0.5*(pts[faceBoundaryPts[0]] + pts[faceBoundaryPts[1]]); - } - else if (faceBoundaryPts.size() < f.size()) - { - face bFace(faceBoundaryPts); - - collapseToPtI = faceBoundaryPts.first(); - - collapseToPt = bFace.centre(pts); - } - } - - // ...otherwise arbitrarily choosing the first point as - // the index to collapse to. Collapse to the face centre. - - forAll(facePts, fPtI) - { - dualPtIndexMap.insert(facePts[fPtI], collapseToPtI); - } - - pts[collapseToPtI] = collapseToPt; - - break; - } - - case fcmDeferredMultiEdge: - { - // forAll(facePts, fPtI) - // { - // label ptI = facePts[fPtI]; - - // pts[ptI] = collapseAxis*(d[fPtI] - dShift) + fC; - - // dualPtIndexMap.insert(ptI, ptI); - // } - - break; - } - - case fcmNone: - { - break; - } - } - - // if (mode == fcmDeferredMultiEdge) - // if (mode != fcmNone) - // { - // // Output face and collapse axis for visualisation - - // Pout<< "# Aspect ratio = " << aspectRatio << nl - // << "# determinant = " << detJ << nl - // << "# collapseAxis = " << collapseAxis << nl - // << "# mode = " << mode << nl - // << "# facePts = " << facePts << nl - // // << "# eigenvalues = " << eVals - // << endl; - - // scalar scale = 2.0*mag(fC - pts[f[0]]); - - // meshTools::writeOBJ(Pout, fC); - // meshTools::writeOBJ(Pout, fC + scale*collapseAxis); - - // Pout<< "f 1 2" << endl; - - // forAll(f, fPtI) - // { - // meshTools::writeOBJ(Pout, pts[f[fPtI]]); - // } - - // Pout<< "f"; - - // forAll(f, fPtI) - // { - // Pout << " " << fPtI + 3; - // } - - // Pout<< nl << "# " << d << endl; - - // Pout<< "# " << d.first() << " " << d.last() << endl; - - // forAll(d, dI) - // { - // meshTools::writeOBJ(Pout, fC + (d[dI] - dShift)*collapseAxis); - // } - - // Pout<< endl; - // } - - return mode; -} - - -Foam::label Foam::conformalVoronoiMesh::longestEdge -( - const face& f, - const pointField& pts -) const -{ - const edgeList& eds = f.edges(); - - label longestEdgeI = -1; + } - scalar longestEdgeLength = -SMALL; + nPtsMerged++; + } + } + } - forAll(eds, edI) + if (debug) { - scalar edgeLength = eds[edI].mag(pts); - - if (edgeLength > longestEdgeLength) - { - longestEdgeI = edI; - - longestEdgeLength = edgeLength; - } + Info<< "mergeIdenticalDualVertices:" << endl + << " zero-length edges : " + << returnReduce(nPtsMerged, sumOp<label>()) << endl + << endl; } - return longestEdgeI; + return nPtsMerged; } +//void Foam::conformalVoronoiMesh::smoothSurface +//( +// pointField& pts, +// const labelList& boundaryPts +//) +//{ +// label nCollapsedFaces = 0; +// +// label iterI = 0; +// +// do +// { +// Map<label> dualPtIndexMap; +// +// nCollapsedFaces = smoothSurfaceDualFaces +// ( +// pts, +// boundaryPts, +// dualPtIndexMap +// ); +// +// reduce(nCollapsedFaces, sumOp<label>()); +// +// reindexDualVertices(dualPtIndexMap); +// +// mergeIdenticalDualVertices(pts, boundaryPts); +// +// if (nCollapsedFaces > 0) +// { +// Info<< " Collapsed " << nCollapsedFaces << " boundary faces" +// << endl; +// } +// +// if (++iterI > cvMeshControls().maxCollapseIterations()) +// { +// Info<< " maxCollapseIterations reached, stopping collapse" +// << endl; +// +// break; +// } +// +// } while (nCollapsedFaces > 0); +// +// // Force all points of boundary faces to be on the surface +//// for +//// ( +//// Delaunay::Finite_cells_iterator cit = finite_cells_begin(); +//// cit != finite_cells_end(); +//// ++cit +//// ) +//// { +//// label ptI = cit->cellIndex(); +//// +//// label fC = cit->filterCount(); +//// +//// if (fC > cvMeshControls().filterCountSkipThreshold()) +//// { +//// // This vertex has been limited too many times, skip +//// continue; +//// } +//// +//// // Only cells with indices > -1 are valid +//// if (ptI > -1) +//// { +//// if (boundaryPts[ptI] != -1) +//// { +//// Foam::point& pt = pts[ptI]; +//// +//// pointIndexHit surfHit; +//// label hitSurface; +//// +//// geometryToConformTo_.findSurfaceNearest +//// ( +//// pt, +//// sqr(GREAT), +//// surfHit, +//// hitSurface +//// ); +//// +//// if (surfHit.hit()) +//// { +//// pt += (surfHit.hitPoint() - pt) +//// *pow +//// ( +//// cvMeshControls().filterErrorReductionCoeff(), +//// fC +//// ); +//// } +//// } +//// } +//// } +//// +//// mergeCloseDualVertices(pts, boundaryPts); +//} +// +// +//Foam::label Foam::conformalVoronoiMesh::smoothSurfaceDualFaces +//( +// pointField& pts, +// const labelList& boundaryPts, +// Map<label>& dualPtIndexMap +//) const +//{ +// label nCollapsedFaces = 0; +// +// const scalar cosPerpendicularToleranceAngle = cos +// ( +// degToRad(cvMeshControls().surfaceStepFaceAngle()) +// ); +// +// for +// ( +// Delaunay::Finite_edges_iterator eit = finite_edges_begin(); +// eit != finite_edges_end(); +// ++eit +// ) +// { +// Cell_circulator ccStart = incident_cells(*eit); +// Cell_circulator cc = ccStart; +// +// bool skipFace = false; +// +// do +// { +// if (dualPtIndexMap.found(cc->cellIndex())) +// { +// // One of the points of this face has already been +// // collapsed this sweep, leave for next sweep +// +// skipFace = true; +// +// break; +// } +// +// } while (++cc != ccStart); +// +// if (skipFace) +// { +// continue; +// } +// +// if (isBoundaryDualFace(eit)) +// { +// face dualFace = buildDualFace(eit); +// +// if (dualFace.size() < 3) +// { +// // This face has been collapsed already +// continue; +// } +// +// label maxFC = maxFilterCount(eit); +// +// if (maxFC > cvMeshControls().filterCountSkipThreshold()) +// { +// // A vertex on this face has been limited too many +// // times, skip +// continue; +// } +// +// Cell_handle c = eit->first; +// Vertex_handle vA = c->vertex(eit->second); +// Vertex_handle vB = c->vertex(eit->third); +// +// if +// ( +// vA->internalBoundaryPoint() && vA->surfacePoint() +// && vB->externalBoundaryPoint() && vB->surfacePoint() +// ) +// { +// if (vA->index() == vB->index() - 1) +// { +// continue; +// } +// } +// else if +// ( +// vA->externalBoundaryPoint() && vA->surfacePoint() +// && vB->internalBoundaryPoint() && vB->surfacePoint() +// ) +// { +// if (vA->index() == vB->index() + 1) +// { +// continue; +// } +// } +//// else if +//// ( +//// vA->internalBoundaryPoint() && vA->featureEdgePoint() +//// && vB->externalBoundaryPoint() && vB->featureEdgePoint() +//// ) +//// { +//// if (vA->index() == vB->index() - 1) +//// { +//// continue; +//// } +//// } +//// else if +//// ( +//// vA->externalBoundaryPoint() && vA->featureEdgePoint() +//// && vB->internalBoundaryPoint() && vB->featureEdgePoint() +//// ) +//// { +//// if (vA->index() == vB->index() + 1) +//// { +//// continue; +//// } +//// } +//// else if +//// ( +//// vA->internalBoundaryPoint() && vA->featurePoint() +//// && vB->externalBoundaryPoint() && vB->featurePoint() +//// ) +//// { +//// if (vA->index() == vB->index() - 1) +//// { +//// continue; +//// } +//// } +//// else if +//// ( +//// vA->externalBoundaryPoint() && vA->featurePoint() +//// && vB->internalBoundaryPoint() && vB->featurePoint() +//// ) +//// { +//// if (vA->index() == vB->index() + 1) +//// { +//// continue; +//// } +//// } +// +// +// if ((faceNormal & surfaceNormal) < cosPerpendicularToleranceAngle) +// { +// scalar targetFaceSize = averageAnyCellSize(vA, vB); +// +// // Selecting faces to collapse based on angle to +// // surface, so set collapseSizeLimitCoeff to GREAT to +// // allow collapse of all faces +// +// faceCollapseMode mode = collapseFace +// ( +// dualFace, +// pts, +// boundaryPts, +// dualPtIndexMap, +// targetFaceSize, +// GREAT, +// maxFC +// ); +// +// if (mode == fcmPoint || mode == fcmEdge) +// { +// nCollapsedFaces++; +// } +// } +// } +// } +// +// return nCollapsedFaces; +//} + + void Foam::conformalVoronoiMesh::deferredCollapseFaceSet ( labelList& owner, @@ -1871,6 +1185,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints labelList procNeighbours; pointField cellCentres; labelListList patchToDelaunayVertex; + PackedBoolList boundaryFacesToRemove; timeCheck("Start of checkPolyMeshQuality"); @@ -1887,6 +1202,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints patchStarts, procNeighbours, patchToDelaunayVertex, + boundaryFacesToRemove, false ); @@ -1926,7 +1242,6 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints if (patchTypes[p] == processorPolyPatch::typeName) { // Do not create empty processor patches - if (patchSizes[p] > 0) { patches[nValidPatches] = new processorPolyPatch @@ -1937,7 +1252,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints nValidPatches, pMesh.boundaryMesh(), Pstream::myProcNo(), - procNeighbours[p] + procNeighbours[p], + coupledPolyPatch::COINCIDENTFULLMATCH ); nValidPatches++; @@ -1991,13 +1307,13 @@ void Foam::conformalVoronoiMesh::checkCellSizing() timeCheck("Start of Cell Sizing"); - PackedBoolList boundaryPts(number_of_cells(), false); + labelList boundaryPts(number_of_finite_cells(), -1); pointField ptsField; indexDualVertices(ptsField, boundaryPts); // Merge close dual vertices. - mergeCloseDualVertices(ptsField, boundaryPts); + mergeIdenticalDualVertices(ptsField, boundaryPts); autoPtr<polyMesh> meshPtr = createPolyMeshFromPoints(ptsField); const polyMesh& pMesh = meshPtr(); @@ -2092,10 +1408,10 @@ void Foam::conformalVoronoiMesh::checkCellSizing() } } - Info<< " Automatically re-sizing " << cellsToResize.size() + Info<< " DISABLED: Automatically re-sizing " << cellsToResize.size() << " cells that are attached to the bad faces: " << endl; - cellSizeControl_.setCellSizes(cellsToResize); + //cellSizeControl_.setCellSizes(cellsToResize); } timeCheck("End of Cell Sizing"); @@ -2181,8 +1497,6 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality labelHashSet wrongFaces(pMesh.nFaces()/100); - Info << endl; - DynamicList<label> checkFaces(pMesh.nFaces()); const vectorField& fAreas = pMesh.faceAreas(); @@ -2197,7 +1511,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality } } - Info<< "Excluding " + Info<< nl << "Excluding " << returnReduce(fAreas.size() - checkFaces.size(), sumOp<label>()) << " faces from check, < " << faceAreaLimit << " area" << endl; @@ -2371,18 +1685,16 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality void Foam::conformalVoronoiMesh::indexDualVertices ( pointField& pts, - PackedBoolList& boundaryPts + labelList& boundaryPts ) { // Indexing Delaunay cells, which are the dual vertices - label dualVertI = 0; - - pts.setSize(number_of_cells()); + this->resetCellCount(); - boundaryPts.setSize(number_of_cells(), false); + pts.setSize(number_of_finite_cells()); - boundaryPts = false; + boundaryPts.setSize(number_of_finite_cells(), -1); for ( @@ -2391,19 +1703,83 @@ void Foam::conformalVoronoiMesh::indexDualVertices ++cit ) { - if (cit->internalOrBoundaryDualVertex()) +// if (tetrahedron(cit).volume() == 0) +// { +// Pout<< "ZERO VOLUME TET" << endl; +// Pout<< cit->info(); +// Pout<< "Dual = " << cit->dual(); +// } + + if (!cit->hasFarPoint()) { - cit->cellIndex() = dualVertI; + cit->cellIndex() = getNewCellIndex(); - pts[dualVertI] = cit->dual(); + // For nearly coplanar Delaunay cells that are present on different + // processors the result of the circumcentre calculation depends on + // the ordering of the vertices, so synchronise it across processors - if (cit->boundaryDualVertex()) + if (Pstream::parRun() && cit->parallelDualVertex()) + { + typedef CGAL::Exact_predicates_exact_constructions_kernel Exact; + typedef CGAL::Point_3<Exact> ExactPoint; + + List<labelPair> cellVerticesPair(4); + List<ExactPoint> cellVertices(4); + + for (label vI = 0; vI < 4; ++vI) + { + cellVerticesPair[vI] = labelPair + ( + cit->vertex(vI)->procIndex(), + cit->vertex(vI)->index() + ); + + cellVertices[vI] = ExactPoint + ( + cit->vertex(vI)->point().x(), + cit->vertex(vI)->point().y(), + cit->vertex(vI)->point().z() + ); + } + + // Sort the vertices so that they will be in the same order on + // each processor + labelList oldToNew; + sortedOrder(cellVerticesPair, oldToNew); + oldToNew = invert(oldToNew.size(), oldToNew); + inplaceReorder(oldToNew, cellVertices); + + ExactPoint synchronisedDual = CGAL::circumcenter + ( + cellVertices[0], + cellVertices[1], + cellVertices[2], + cellVertices[3] + ); + + pts[cit->cellIndex()] = Foam::point + ( + CGAL::to_double(synchronisedDual.x()), + CGAL::to_double(synchronisedDual.y()), + CGAL::to_double(synchronisedDual.z()) + ); + } + else { - // This is a boundary dual vertex - boundaryPts[dualVertI] = true; + pts[cit->cellIndex()] = cit->dual(); } - dualVertI++; + if (cit->boundaryDualVertex()) + { + if (cit->featureEdgeDualVertex()) + { + boundaryPts[cit->cellIndex()] = 1; + } + else + { + boundaryPts[cit->cellIndex()] = 0; + } + } } else { @@ -2411,9 +1787,9 @@ void Foam::conformalVoronoiMesh::indexDualVertices } } - pts.setSize(dualVertI); + pts.setSize(this->cellCount()); - boundaryPts.setSize(dualVertI); + boundaryPts.setSize(this->cellCount()); } @@ -2437,18 +1813,11 @@ void Foam::conformalVoronoiMesh::reindexDualVertices } -void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches +Foam::label Foam::conformalVoronoiMesh::createPatchInfo ( - faceList& faces, - labelList& owner, - labelList& neighbour, - wordList& patchTypes, wordList& patchNames, - labelList& patchSizes, - labelList& patchStarts, - labelList& procNeighbours, - labelListList& patchPointPairSlaves, - bool includeEmptyPatches + wordList& patchTypes, + labelList& procNeighbours ) const { patchNames = geometryToConformTo_.patchNames(); @@ -2467,7 +1836,13 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches if (Pstream::parRun()) { - boolList procUsed(Pstream::nProcs(), false); + List<boolList> procUsedList + ( + Pstream::nProcs(), + boolList(Pstream::nProcs(), false) + ); + + boolList& procUsed = procUsedList[Pstream::myProcNo()]; // Determine which processor patches are required for @@ -2477,12 +1852,30 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches vit++ ) { + // This test is not sufficient if one of the processors does + // not receive a referred vertex from another processor, but does + // send one to the other processor. if (vit->referred()) { procUsed[vit->procIndex()] = true; } } + // Because the previous test was insufficient, combine the lists. + Pstream::gatherList(procUsedList); + Pstream::scatterList(procUsedList); + + forAll(procUsedList, procI) + { + if (procI != Pstream::myProcNo()) + { + if (procUsedList[procI][Pstream::myProcNo()]) + { + procUsed[procI] = true; + } + } + } + forAll(procUsed, pUI) { if (procUsed[pUI]) @@ -2493,9 +1886,9 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches label nNonProcPatches = patchNames.size(); + patchNames.setSize(nNonProcPatches + nProcPatches); patchTypes.setSize(nNonProcPatches + nProcPatches); procNeighbours.setSize(nNonProcPatches + nProcPatches, -1); - patchNames.setSize(nNonProcPatches + nProcPatches); label procAddI = 0; @@ -2519,25 +1912,46 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches } } - // Pout<< patchTypes << " " << patchNames << endl; + return defaultPatchIndex; +} - label nPatches = patchNames.size(); - List<DynamicList<face> > patchFaces(nPatches, DynamicList<face>(0)); +void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches +( + faceList& faces, + labelList& owner, + labelList& neighbour, + wordList& patchTypes, + wordList& patchNames, + labelList& patchSizes, + labelList& patchStarts, + labelList& procNeighbours, + labelListList& patchPointPairSlaves, + PackedBoolList& boundaryFacesToRemove, + bool includeEmptyPatches +) const +{ + const label defaultPatchIndex = createPatchInfo + ( + patchNames, + patchTypes, + procNeighbours + ); - List<DynamicList<label> > patchOwners(nPatches, DynamicList<label>(0)); + const label nPatches = patchNames.size(); + List<DynamicList<face> > patchFaces(nPatches, DynamicList<face>(0)); + List<DynamicList<label> > patchOwners(nPatches, DynamicList<label>(0)); // Per patch face the index of the slave node of the point pair List<DynamicList<label> > patchPPSlaves(nPatches, DynamicList<label>(0)); + List<DynamicList<bool> > indirectPatchFace(nPatches, DynamicList<bool>(0)); - faces.setSize(number_of_edges()); + faces.setSize(number_of_finite_edges()); + owner.setSize(number_of_finite_edges()); + neighbour.setSize(number_of_finite_edges()); - owner.setSize(number_of_edges()); - - neighbour.setSize(number_of_edges()); - - List<Pair<DynamicList<label> > > procPatchSortingIndex(nPatches); + labelPairPairDynListList procPatchSortingIndex(nPatches); label dualFaceI = 0; @@ -2554,8 +1968,8 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches if ( - vA->internalOrBoundaryPoint() - || vB->internalOrBoundaryPoint() + (vA->internalOrBoundaryPoint() && !vA->referred()) + || (vB->internalOrBoundaryPoint() && !vB->referred()) ) { face newDualFace = buildDualFace(eit); @@ -2574,44 +1988,56 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches { // boundary face - Foam::point ptA = topoint(vA->point()); - Foam::point ptB = topoint(vB->point()); + pointFromPoint ptA = topoint(vA->point()); + pointFromPoint ptB = topoint(vB->point()); label patchIndex = -1; - if - ( - vA->referredInternalOrBoundaryPoint() - || vB->referredInternalOrBoundaryPoint() - ) + if (isProcBoundaryEdge(eit)) { // One (and only one) of the points is an internal // point from another processor label procIndex = max(vA->procIndex(), vB->procIndex()); - patchIndex = findIndex(procNeighbours, procIndex); + patchIndex = max + ( + findIndex(procNeighbours, vA->procIndex()), + findIndex(procNeighbours, vB->procIndex()) + ); // The lower processor index is the owner of the - // two for the purposed of sorting the patch faces. + // two for the purpose of sorting the patch faces. if (Pstream::myProcNo() < procIndex) { // Use this processor's vertex index as the master // for sorting - Pair<DynamicList<label> >& sortingIndex = - procPatchSortingIndex[patchIndex]; + DynamicList<Pair<labelPair> >& sortingIndex = + procPatchSortingIndex[patchIndex]; - if (vB->referredInternalOrBoundaryPoint()) + if (vB->internalOrBoundaryPoint() && vB->referred()) { - sortingIndex.first().append(vA->index()); - sortingIndex.second().append(vB->index()); + sortingIndex.append + ( + Pair<labelPair> + ( + labelPair(vA->index(), vA->procIndex()), + labelPair(vB->index(), vB->procIndex()) + ) + ); } else { - sortingIndex.first().append(vB->index()); - sortingIndex.second().append(vA->index()); + sortingIndex.append + ( + Pair<labelPair> + ( + labelPair(vB->index(), vB->procIndex()), + labelPair(vA->index(), vA->procIndex()) + ) + ); } } else @@ -2619,30 +2045,42 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches // Use the other processor's vertex index as the // master for sorting - Pair<DynamicList<label> >& sortingIndex = + DynamicList<Pair<labelPair> >& sortingIndex = procPatchSortingIndex[patchIndex]; - if (vA->referredInternalOrBoundaryPoint()) + if (vA->internalOrBoundaryPoint() && vA->referred()) { - sortingIndex.first().append(vA->index()); - sortingIndex.second().append(vB->index()); + sortingIndex.append + ( + Pair<labelPair> + ( + labelPair(vA->index(), vA->procIndex()), + labelPair(vB->index(), vB->procIndex()) + ) + ); } else { - sortingIndex.first().append(vB->index()); - sortingIndex.second().append(vA->index()); + sortingIndex.append + ( + Pair<labelPair> + ( + labelPair(vB->index(), vB->procIndex()), + labelPair(vA->index(), vA->procIndex()) + ) + ); } } - // Pout<< ptA << " " << ptB - // << " proc indices " - // << vA->procIndex() << " " << vB->procIndex() - // << " indices " << vA->index() - // << " " << vB->index() - // << " my proc " << Pstream::myProcNo() - // << " addedIndex " - // << procPatchSortingIndex[patchIndex].last() - // << endl; +// Pout<< ptA << " " << ptB +// << " proc indices " +// << vA->procIndex() << " " << vB->procIndex() +// << " indices " << vA->index() +// << " " << vB->index() +// << " my proc " << Pstream::myProcNo() +// << " addedIndex " +// << procPatchSortingIndex[patchIndex].last() +// << endl; } else { @@ -2667,6 +2105,17 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches patchFaces[patchIndex].append(newDualFace); patchOwners[patchIndex].append(own); + // If the two vertices are a pair, then the patch face is + // a desired one. + if (vA->type() == vB->index()) + { + indirectPatchFace[patchIndex].append(true); + } + else + { + indirectPatchFace[patchIndex].append(false); + } + // Store the non-internal or boundary point if (vA->internalOrBoundaryPoint()) { @@ -2680,7 +2129,6 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches else { // internal face - faces[dualFaceI] = newDualFace; owner[dualFaceI] = own; neighbour[dualFaceI] = nei; @@ -2727,8 +2175,10 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches owner, patchSizes, patchStarts, + boundaryFacesToRemove, patchFaces, - patchOwners + patchOwners, + indirectPatchFace ); // Return patchPointPairSlaves.setSize(nPatches); @@ -2738,14 +2188,28 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches patchPointPairSlaves[patchI].transfer(patchPPSlaves[patchI]); } - if (cvMeshControls().objOutput()) +// if (cvMeshControls().objOutput()) { + Info<< "Writing processor interfaces" << endl; + forAll(procNeighbours, nbI) { if (patchFaces[nbI].size() > 0) { const label neighbour = procNeighbours[nbI]; + faceList procPatchFaces = patchFaces[nbI]; + + // Reverse faces as it makes it easier to analyse the output + // using a diff + if (neighbour < Pstream::myProcNo()) + { + forAll(procPatchFaces, fI) + { + procPatchFaces[fI] = procPatchFaces[fI].reverseFace(); + } + } + if (neighbour != -1) { word fName = @@ -2755,11 +2219,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches + name(neighbour) + "_interface.obj"; - writeProcessorInterface - ( - fName, - patchFaces[nbI] - ); + writeProcessorInterface(fName, procPatchFaces); } } } @@ -2785,9 +2245,7 @@ void Foam::conformalVoronoiMesh::createCellCentres { if (vit->internalOrBoundaryPoint()) { - cellCentres[vit->index()] = topoint(vit->point()); - - vertI++; + cellCentres[vertI++] = topoint(vit->point()); } } @@ -2800,6 +2258,8 @@ Foam::tmp<Foam::pointField> Foam::conformalVoronoiMesh::allPoints() const tmp<pointField> tpts(new pointField(number_of_vertices(), point::max)); pointField& pts = tpts(); + label nVert = 0; + for ( Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); @@ -2809,7 +2269,7 @@ Foam::tmp<Foam::pointField> Foam::conformalVoronoiMesh::allPoints() const { if (vit->internalOrBoundaryPoint()) { - pts[vit->index()] = topoint(vit->point()); + pts[nVert++] = topoint(vit->point()); } } @@ -2838,8 +2298,12 @@ void Foam::conformalVoronoiMesh::sortFaces // 1 | 24 // 1 | 91 - // Two stage sort: - // 1) sort by owner + List<labelPair> ownerNeighbourPair(owner.size()); + + forAll(ownerNeighbourPair, oNI) + { + ownerNeighbourPair[oNI] = labelPair(owner[oNI], neighbour[oNI]); + } Info<< nl << "Sorting faces, owner and neighbour into upper triangular order" @@ -2847,71 +2311,13 @@ void Foam::conformalVoronoiMesh::sortFaces labelList oldToNew; - sortedOrder(owner, oldToNew); + sortedOrder(ownerNeighbourPair, oldToNew); oldToNew = invert(oldToNew.size(), oldToNew); inplaceReorder(oldToNew, faces); inplaceReorder(oldToNew, owner); inplaceReorder(oldToNew, neighbour); - - // 2) in each block of owners sort by neighbour - - // Reset map. Elements that are not sorted will retain their -1 - // value, which will mean that they are ignored by inplaceReorder - - oldToNew = -1; - - label blockStart = 0; - - for (label i = 1; i < owner.size(); i++) - { - label blockLength = -1; - - if (owner[i] > owner[i - 1]) - { - blockLength = i - blockStart; - } - else if (i == owner.size() - 1) - { - // If the last element is not a jump in owner, then it - // needs to trigger a sort of the last block, but with a - // block length that is one element longer so that it - // sorts itself. - - // If it is a jump in owner, then it will form a block of - // length one, and so will not need sorted. - - blockLength = i - blockStart + 1; - } - - if (blockLength >= 1) - { - labelList blockIndices = identity(blockLength) + blockStart; - - SubList<label> neighbourBlock - ( - neighbour, - blockLength, - blockStart - ); - - sortedOrder(neighbourBlock, blockIndices); - - blockIndices = invert(blockIndices.size(), blockIndices); - - forAll(blockIndices, b) - { - oldToNew[blockStart + b] = blockIndices[b] + blockStart; - } - - blockStart = i; - } - } - - // owner does not need re-sorted - inplaceReorder(oldToNew, faces); - inplaceReorder(oldToNew, neighbour); } @@ -2920,7 +2326,7 @@ void Foam::conformalVoronoiMesh::sortProcPatches List<DynamicList<face> >& patchFaces, List<DynamicList<label> >& patchOwners, List<DynamicList<label> >& patchPointPairSlaves, - List<Pair<DynamicList<label> > >& patchSortingIndices + labelPairPairDynListList& patchSortingIndices ) const { if (!Pstream::parRun()) @@ -2934,18 +2340,16 @@ void Foam::conformalVoronoiMesh::sortProcPatches labelList& owner = patchOwners[patchI]; DynamicList<label>& slaves = patchPointPairSlaves[patchI]; - Pair<DynamicList<label> >& sortingIndices = patchSortingIndices[patchI]; - - List<label>& primary = sortingIndices.first(); - List<label>& secondary = sortingIndices.second(); + DynamicList<Pair<labelPair> >& sortingIndices + = patchSortingIndices[patchI]; - if (!primary.empty()) + if (!sortingIndices.empty()) { if ( - faces.size() != primary.size() - || owner.size() != primary.size() - || slaves.size() != primary.size() + faces.size() != sortingIndices.size() + || owner.size() != sortingIndices.size() + || slaves.size() != sortingIndices.size() ) { FatalErrorIn @@ -2962,80 +2366,18 @@ void Foam::conformalVoronoiMesh::sortProcPatches << " faces.size() " << faces.size() << nl << " owner.size() " << owner.size() << nl << " slaves.size() " << slaves.size() << nl - << " sortingIndices.first().size() " - << sortingIndices.first().size() + << " sortingIndices.size() " + << sortingIndices.size() << exit(FatalError) << endl; } - // Two stage sort: - // 1) sort by primary - labelList oldToNew; - sortedOrder(primary, oldToNew); + sortedOrder(sortingIndices, oldToNew); oldToNew = invert(oldToNew.size(), oldToNew); - inplaceReorder(oldToNew, primary); - inplaceReorder(oldToNew, secondary); - inplaceReorder(oldToNew, faces); - inplaceReorder(oldToNew, owner); - inplaceReorder(oldToNew, slaves); - - // 2) in each block of primary sort by secondary - - // Reset map. Elements that are not sorted will retain their -1 - // value, which will mean that they are ignored by inplaceReorder - - oldToNew = -1; - - label blockStart = 0; - - for (label i = 1; i < primary.size(); i++) - { - label blockLength = -1; - - if (primary[i] > primary[i - 1]) - { - blockLength = i - blockStart; - } - else if (i == primary.size() - 1) - { - // If the last element is not a jump in index, then it - // needs to trigger a sort of the last block, but with a - // block length that is one element longer so that it - // sorts itself. - - // If it is a jump in index, then it will form a block of - // length one, and so will not need sorted. - - blockLength = i - blockStart + 1; - } - - if (blockLength >= 1) - { - labelList blockIndices = identity(blockLength) + blockStart; - - SubList<label> secondaryBlock - ( - secondary, - blockLength, - blockStart - ); - - sortedOrder(secondaryBlock, blockIndices); - - blockIndices = invert(blockIndices.size(), blockIndices); - - forAll(blockIndices, b) - { - oldToNew[blockStart + b] = blockIndices[b] + blockStart; - } - - blockStart = i; - } - } - + inplaceReorder(oldToNew, sortingIndices); inplaceReorder(oldToNew, faces); inplaceReorder(oldToNew, owner); inplaceReorder(oldToNew, slaves); @@ -3051,8 +2393,10 @@ void Foam::conformalVoronoiMesh::addPatches labelList& owner, labelList& patchSizes, labelList& patchStarts, + PackedBoolList& boundaryFacesToRemove, const List<DynamicList<face> >& patchFaces, - const List<DynamicList<label> >& patchOwners + const List<DynamicList<label> >& patchOwners, + const List<DynamicList<bool> >& indirectPatchFace ) const { label nPatches = patchFaces.size(); @@ -3081,6 +2425,7 @@ void Foam::conformalVoronoiMesh::addPatches { faces[faceI] = patchFaces[p][f]; owner[faceI] = patchOwners[p][f]; + boundaryFacesToRemove[faceI] = indirectPatchFace[p][f]; faceI++; } @@ -3091,7 +2436,8 @@ void Foam::conformalVoronoiMesh::addPatches void Foam::conformalVoronoiMesh::removeUnusedPoints ( faceList& faces, - pointField& pts + pointField& pts, + labelList& boundaryPts ) const { Info<< nl << "Removing unused points" << endl; @@ -3126,6 +2472,7 @@ void Foam::conformalVoronoiMesh::removeUnusedPoints } inplaceReorder(oldToNew, pts); + inplaceReorder(oldToNew, boundaryPts); Info<< " Removing " << returnReduce(pts.size() - pointI, sumOp<label>()) @@ -3133,6 +2480,7 @@ void Foam::conformalVoronoiMesh::removeUnusedPoints << endl; pts.setSize(pointI); + boundaryPts.setSize(pointI); // Renumber the faces to use the new point numbers @@ -3198,8 +2546,9 @@ Foam::labelList Foam::conformalVoronoiMesh::removeUnusedCells if (unusedCells.size() > 0) { - // Pout<< "Removing " << unusedCells.size() << " unused cell labels" - // << endl; + Info<< " Removing " + << returnReduce(unusedCells.size(), sumOp<label>()) + << " unused cell labels" << endl; forAll(owner, oI) { diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index 2d850aff09fbde354f69a752082cd99b3d3815e0..14c5428c816f2941e2889eb16fe92f8b128a1978 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -26,6 +26,8 @@ License #include "conformalVoronoiMesh.H" #include "backgroundMeshDecomposition.H" #include "vectorTools.H" +#include "indexedCellChecks.H" +#include "IOmanip.H" using namespace Foam::vectorTools; @@ -35,34 +37,44 @@ const Foam::scalar Foam::conformalVoronoiMesh::searchConeAngle const Foam::scalar Foam::conformalVoronoiMesh::searchAngleOppositeSurface = Foam::cos(degToRad(150)); + // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // void Foam::conformalVoronoiMesh::conformToSurface() { - reconformationMode reconfMode = reconformationControl(); - -// if (Pstream::parRun()) -// { -// seedProcessorBoundarySurfaces(true); -// } + this->resetCellCount(); + // Index the cells + for + ( + Delaunay::Finite_cells_iterator cit = finite_cells_begin(); + cit != finite_cells_end(); + ++cit + ) + { + cit->cellIndex() = Cb::ctUnassigned; + } - if (reconfMode == rmNone) + if (reconformationControl() == rmOff) { // Reinsert stored surface conformation reinsertSurfaceConformation(); - buildParallelInterface("move_" + runTime_.timeName()); + if (Pstream::parRun()) + { + sync(decomposition_().procBounds()); + } } else { // Rebuild, insert and store new surface conformation - buildSurfaceConformation(reconfMode); + buildSurfaceConformation(); if (distributeBackground()) { - // distributeBackground has destroyed all referred vertices, so the - // parallel interface needs to be rebuilt. - buildParallelInterface("rebuild"); + if (Pstream::parRun()) + { + sync(decomposition_().procBounds()); + } // Use storeSizesAndAlignments with no feed points because all // background points may have been distributed. @@ -74,16 +86,6 @@ void Foam::conformalVoronoiMesh::conformToSurface() storeSurfaceConformation(); } -// if (Pstream::parRun()) -// { -// label nFarPoints = removeProcessorBoundarySeeds(true); -// -// reduce(nFarPoints, sumOp<label>()); -// -// Info<< " Removed " << nFarPoints -// << " far points from the mesh." << endl; -// } - // reportSurfaceConformationQuality(); } @@ -91,47 +93,143 @@ void Foam::conformalVoronoiMesh::conformToSurface() Foam::conformalVoronoiMesh::reconformationMode Foam::conformalVoronoiMesh::reconformationControl() const { - if (!runTime_.run()) - { - Info<< nl << "Rebuilding surface conformation for final output" - << endl; - - return rmFine; - } - else if + if ( runTime_.timeIndex() % cvMeshControls().surfaceConformationRebuildFrequency() == 0 ) { - Info<< nl << "Rebuilding surface conformation for more iterations" - << endl; - - return rmCoarse; + return rmOn; } - return rmNone; + return rmOff; } -void Foam::conformalVoronoiMesh::buildSurfaceConformation -( - reconformationMode reconfMode -) +// @todo Investigate topological tests +Foam::label Foam::conformalVoronoiMesh::findVerticesNearBoundaries() { - timeCheck("Start buildSurfaceConformation"); + label countNearBoundaryVertices = 0; - if (reconfMode == rmCoarse) + for + ( + Delaunay::Finite_facets_iterator fit = finite_facets_begin(); + fit != finite_facets_end(); + ++fit + ) { - Info<< nl << "Build coarse surface conformation" << endl; + if + ( + is_infinite(fit->first) + || is_infinite(fit->first->neighbor(fit->second)) + ) + { + continue; + } + + Cell_handle c1 = fit->first; + Cell_handle c2 = fit->first->neighbor(fit->second); + + pointFromPoint dE0 = c1->dual(); + pointFromPoint dE1 = c2->dual(); + + if (!geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1)) + { + continue; + } + + for (label cellI = 0; cellI < 4; ++cellI) + { + Vertex_handle v = c1->vertex(cellI); + + if + ( + !is_infinite(v) + && v->internalPoint() + && fit->second != cellI + ) + { + v->setNearBoundary(); + } + } + + for (label cellI = 0; cellI < 4; ++cellI) + { + Vertex_handle v = c2->vertex(cellI); + + if + ( + !is_infinite(v) + && v->internalPoint() + && fit->second != cellI + ) + { + v->setNearBoundary(); + } + } } - else if (reconfMode == rmFine) + + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) { - Info<< nl << "Build fine surface conformation" << endl; + if (vit->nearBoundary()) + { + countNearBoundaryVertices++; + } } - else if (reconfMode == rmNone) + + // Geometric test. +// for +// ( +// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); +// vit != finite_vertices_end(); +// ++vit +// ) +// { +// if (vit->internalPoint() && !vit->nearBoundary()) +// { +// pointFromPoint pt = topoint(vit->point()); +// +// const scalar range = sqr +// ( +// cvMeshControls().nearBoundaryDistanceCoeff() +// *targetCellSize(pt) +// ); +// +// pointIndexHit pHit; +// label hitSurface; +// +// geometryToConformTo_.findSurfaceNearest +// ( +// pt, +// range, +// pHit, +// hitSurface +// ); +// +// if (pHit.hit()) +// { +// vit->setNearBoundary(); +// countNearBoundaryVertices++; +// } +// } +// } + + return countNearBoundaryVertices; +} + + +void Foam::conformalVoronoiMesh::buildSurfaceConformation() +{ + timeCheck("Start buildSurfaceConformation"); + + if (reconformationControl() == rmOff) { - WarningIn("buildSurfaceConformation(reconformationMode reconfMode)") + WarningIn("buildSurfaceConformation()") << "reconformationMode rmNone specified, not building conformation" << endl; @@ -139,21 +237,15 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation } else { - WarningIn("buildSurfaceConformation(reconformationMode reconfMode)") - << "Unknown reconformationMode " << reconfMode - << " not building conformation" << endl; - - return; + Info<< nl << "Rebuilding surface conformation for more iterations" + << endl; } - // Initialise containers to store the edge conformation locations - DynamicList<Foam::point> newEdgeLocations; - - DynamicList<Foam::point> existingEdgeLocations; - DynamicList<Foam::point> existingSurfacePtLocations; + existingEdgeLocations_.clearStorage(); + existingSurfacePtLocations_.clearStorage(); - buildEdgeLocationTree(existingEdgeLocations); - buildSurfacePtLocationTree(existingSurfacePtLocations); + buildEdgeLocationTree(existingEdgeLocations_); + buildSurfacePtLocationTree(existingSurfacePtLocations_); label initialTotalHits = 0; @@ -177,7 +269,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation // -------- // // Shoot ray and find intersection with outside segment (x) and - // introduce pointpair (..) + // introduce point pair (..) // // | // \ . / @@ -185,57 +277,27 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation // \ . / // ---x---- - label countNearBoundaryVertices = 0; - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - vit++ - ) - { - if (vit->internalPoint() && !vit->nearBoundary()) - { - pointFromPoint pt = topoint(vit->point()); - const scalar range = sqr(2.0*targetCellSize(pt)); - - pointIndexHit pHit; - label hitSurface; - - geometryToConformTo_.findSurfaceNearest - ( - pt, - range, - pHit, - hitSurface - ); - - if (pHit.hit()) - { - vit->setNearBoundary(); - countNearBoundaryVertices++; - } - } - } + // Find vertices near boundaries to speed up subsequent checks. + label countNearBoundaryVertices = findVerticesNearBoundaries(); Info<< " Vertices marked as being near a boundary: " - << countNearBoundaryVertices << " (estimated)" << endl; + << returnReduce(countNearBoundaryVertices, sumOp<label>()) + << " (estimated)" << endl; timeCheck("After set near boundary"); - // Initial surface protrusion conformation - nearest surface point - { - const scalar edgeSearchDistCoeffSqr = - cvMeshControls().edgeSearchDistCoeffSqrInitial(reconfMode); + const scalar edgeSearchDistCoeffSqr = + cvMeshControls().edgeSearchDistCoeffSqr(); - const scalar surfacePtReplaceDistCoeffSqr = - cvMeshControls().surfacePtReplaceDistCoeffSqrInitial(reconfMode); + const scalar surfacePtReplaceDistCoeffSqr = + cvMeshControls().surfacePtReplaceDistCoeffSqr(); - DynamicList<pointIndexHit> surfaceHits; - DynamicList<label> hitSurfaces; + const label AtoV = label(6/Foam::pow(scalar(number_of_vertices()), 3)); - DynamicList<pointIndexHit> featureEdgeHits; - DynamicList<label> featureEdgeFeaturesHit; + // Initial surface protrusion conformation - nearest surface point + { + pointIndexHitAndFeatureDynList featureEdgeHits(AtoV/4); + pointIndexHitAndFeatureDynList surfaceHits(AtoV); for ( @@ -244,25 +306,16 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation vit++ ) { - if (vit->internalPoint() && vit->nearBoundary()) + if (vit->nearBoundary()) { - const Foam::point vert = topoint(vit->point()); - - if (!positionOnThisProc(vert)) - { - continue; - } - - DynamicList<pointIndexHit> surfHitList; - DynamicList<label> hitSurfaceList; + pointIndexHitAndFeatureDynList surfaceIntersections(AtoV); if ( dualCellSurfaceAllIntersections ( vit, - surfHitList, - hitSurfaceList + surfaceIntersections ) ) { @@ -273,18 +326,11 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation addSurfaceAndEdgeHits ( vit, - vert, - surfHitList, - hitSurfaceList, + surfaceIntersections, surfacePtReplaceDistCoeffSqr, edgeSearchDistCoeffSqr, surfaceHits, - hitSurfaces, - featureEdgeHits, - featureEdgeFeaturesHit, - newEdgeLocations, - existingEdgeLocations, - existingSurfacePtLocations + featureEdgeHits ); } else @@ -296,7 +342,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation } Info<< " Vertices marked as being near a boundary: " - << countNearBoundaryVertices + << returnReduce(countNearBoundaryVertices, sumOp<label>()) << " (after dual surface intersection)" << endl; label nVerts = number_of_vertices(); @@ -316,17 +362,27 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation << " Number of edge hits " << nFeatEdHits << endl; + // In parallel, synchronise the surface trees + if (Pstream::parRun()) + { + synchroniseSurfaceTrees(surfaceHits); + } + insertSurfacePointPairs ( surfaceHits, - hitSurfaces, "surfaceConformationLocations_initial.obj" ); + // In parallel, synchronise the edge trees + if (Pstream::parRun()) + { + synchroniseEdgeTrees(featureEdgeHits); + } + insertEdgePointGroups ( featureEdgeHits, - featureEdgeFeaturesHit, "edgeConformationLocations_initial.obj" ); @@ -337,32 +393,56 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation // Remember which vertices were referred to each processor so only updates // are sent. - List<labelHashSet> referralVertices(Pstream::nProcs()); + PtrList<labelPairHashSet> referralVertices(Pstream::nProcs()); // Store the vertices that have been received and added from each processor // already so that there is no attempt to add them more than once. - List<labelHashSet> receivedVertices(Pstream::nProcs()); + autoPtr<labelPairHashSet> receivedVertices; + + if (Pstream::parRun()) + { + forAll(referralVertices, procI) + { + if (procI != Pstream::myProcNo()) + { + referralVertices.set + ( + procI, + new labelPairHashSet(number_of_vertices()/Pstream::nProcs()) + ); + } + } + + receivedVertices.set + ( + new labelPairHashSet(number_of_vertices()/Pstream::nProcs()) + ); - // Build the parallel interface the initial surface conformation - buildParallelInterface(referralVertices, receivedVertices, true, "initial"); + // Build the parallel interface the initial surface conformation + sync + ( + decomposition_().procBounds(), + referralVertices, + receivedVertices() + ); + } label iterationNo = 0; - label maxIterations = - cvMeshControls().maxConformationIterations(reconfMode); + label maxIterations = cvMeshControls().maxConformationIterations(); scalar iterationToInitialHitRatioLimit = - cvMeshControls().iterationToInitialHitRatioLimit(reconfMode); + cvMeshControls().iterationToInitialHitRatioLimit(); label hitLimit = label(iterationToInitialHitRatioLimit*initialTotalHits); Info<< nl << "Stopping iterations when: " << nl - <<" total number of hits drops below " - << iterationToInitialHitRatioLimit << " of initial hits (" - << hitLimit << ")" << nl + << " total number of hits drops below " + << iterationToInitialHitRatioLimit + << " of initial hits (" << hitLimit << ")" << nl << " or " << nl - << " maximum number of iterations (" - << maxIterations << ") is reached" + << " maximum number of iterations (" << maxIterations + << ") is reached" << endl; // Set totalHits to a large enough positive value to enter the while loop on @@ -376,17 +456,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation && iterationNo < maxIterations ) { - scalar edgeSearchDistCoeffSqr = - cvMeshControls().edgeSearchDistCoeffSqrIteration(reconfMode); - - scalar surfacePtReplaceDistCoeffSqr = - cvMeshControls().surfacePtReplaceDistCoeffSqrIteration(reconfMode); - - DynamicList<pointIndexHit> surfaceHits; - DynamicList<label> hitSurfaces; - - DynamicList<pointIndexHit> featureEdgeHits; - DynamicList<label> featureEdgeFeaturesHit; + pointIndexHitAndFeatureDynList surfaceHits(0.5*AtoV); + pointIndexHitAndFeatureDynList featureEdgeHits(0.25*AtoV); for ( @@ -402,11 +473,11 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation if ( vit->nearBoundary() - || vit->ppMaster() - || vit->referredInternalOrBoundaryPoint() + || vit->internalBoundaryPoint() + || (vit->internalOrBoundaryPoint() && vit->referred()) ) { - const Foam::point vert = topoint(vit->point()); + pointIndexHitAndFeatureDynList surfaceIntersections(0.5*AtoV); pointIndexHit surfHit; label hitSurface; @@ -417,37 +488,34 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation if (surfHit.hit()) { - DynamicList<pointIndexHit> tmpPIH; - tmpPIH.append(surfHit); - - DynamicList<label> tmpHS; - tmpHS.append(hitSurface); + surfaceIntersections.append + ( + pointIndexHitAndFeature(surfHit, hitSurface) + ); addSurfaceAndEdgeHits ( vit, - vert, - tmpPIH, - tmpHS, + surfaceIntersections, surfacePtReplaceDistCoeffSqr, edgeSearchDistCoeffSqr, surfaceHits, - hitSurfaces, - featureEdgeHits, - featureEdgeFeaturesHit, - newEdgeLocations, - existingEdgeLocations, - existingSurfacePtLocations + featureEdgeHits ); } -// else -// { -// vit->setInternal(); -// } + else + { + // No surface hit detected so if internal then don't check + // again + if (vit->nearBoundary()) + { + vit->setInternal(); + } + } } - else if (vit->ppSlave() || vit->referredExternal()) + else if (vit->externalBoundaryPoint()) { - const Foam::point vert = topoint(vit->point()); + pointIndexHitAndFeatureDynList surfaceIntersections(0.5*AtoV); pointIndexHit surfHit; label hitSurface; @@ -458,33 +526,21 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation if (surfHit.hit()) { - DynamicList<pointIndexHit> tmpPIH; - tmpPIH.append(surfHit); - - DynamicList<label> tmpHS; - tmpHS.append(hitSurface); + surfaceIntersections.append + ( + pointIndexHitAndFeature(surfHit, hitSurface) + ); addSurfaceAndEdgeHits ( vit, - vert, - tmpPIH, - tmpHS, + surfaceIntersections, surfacePtReplaceDistCoeffSqr, edgeSearchDistCoeffSqr, surfaceHits, - hitSurfaces, - featureEdgeHits, - featureEdgeFeaturesHit, - newEdgeLocations, - existingEdgeLocations, - existingSurfacePtLocations + featureEdgeHits ); } -// else -// { -// vit->setInternal(); -// } } } @@ -507,41 +563,47 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation totalHits = nSurfHits + nFeatEdHits; + label nNotInserted = 0; + if (totalHits > 0) { + // In parallel, synchronise the surface trees + if (Pstream::parRun()) + { + nNotInserted += synchroniseSurfaceTrees(surfaceHits); + } + insertSurfacePointPairs ( surfaceHits, - hitSurfaces, - fileName - ( - "surfaceConformationLocations_" + name(iterationNo) + ".obj" - ) + "surfaceConformationLocations_" + name(iterationNo) + ".obj" ); + // In parallel, synchronise the edge trees + if (Pstream::parRun()) + { + nNotInserted += synchroniseEdgeTrees(featureEdgeHits); + } + insertEdgePointGroups ( featureEdgeHits, - featureEdgeFeaturesHit, "edgeConformationLocations_" + name(iterationNo) + ".obj" ); + + if (Pstream::parRun()) + { + sync + ( + decomposition_().procBounds(), + referralVertices, + receivedVertices() + ); + } } timeCheck("Conformation iteration " + name(iterationNo)); - // Only need to update the interface if there are surface/edge hits - if (totalHits > 0) - { - // Update the parallel interface - buildParallelInterface - ( - referralVertices, - receivedVertices, - false, - name(iterationNo) - ); - } - iterationNo++; if (iterationNo == maxIterations) @@ -551,6 +613,14 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation << maxIterations << ") reached." << endl; } + if (totalHits <= nNotInserted) + { + Info<< nl << "Total hits (" << totalHits + << ") less than number of failed insertions (" << nNotInserted + << "), stopping iterations" << endl; + break; + } + if (totalHits < hitLimit) { Info<< nl << "Total hits (" << totalHits @@ -558,76 +628,286 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation << "), stopping iterations" << endl; } } + + edgeLocationTreePtr_.clear(); + surfacePtLocationTreePtr_.clear(); } -bool Foam::conformalVoronoiMesh::dualCellSurfaceAnyIntersection +Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees ( - const Delaunay::Finite_vertices_iterator& vit -) const + pointIndexHitAndFeatureList& surfaceHits +) { - std::list<Facet> facets; - incident_facets(vit, std::back_inserter(facets)); + Info<< " Surface tree synchronisation" << endl; - for + pointIndexHitAndFeatureDynList synchronisedSurfLocations ( - std::list<Facet>::iterator fit=facets.begin(); - fit != facets.end(); - ++fit - ) + surfaceHits.size() + ); + + List<pointIndexHitAndFeatureDynList> procSurfLocations(Pstream::nProcs()); + + procSurfLocations[Pstream::myProcNo()] = surfaceHits; + + Pstream::gatherList(procSurfLocations); + Pstream::scatterList(procSurfLocations); + + List<labelHashSet> hits(Pstream::nProcs()); + + label nStoppedInsertion = 0; + + // Do the nearness tests here + for (label procI = 0; procI < Pstream::nProcs(); ++procI) { - if - ( - is_infinite(fit->first) - || is_infinite(fit->first->neighbor(fit->second)) - ) + // Skip own points + if (procI >= Pstream::myProcNo()) { continue; } - Foam::point dE0 = fit->first->dual(); - Foam::point dE1 = fit->first->neighbor(fit->second)->dual(); + const pointIndexHitAndFeatureList& otherSurfEdges = + procSurfLocations[procI]; - if (Pstream::parRun()) + forAll(otherSurfEdges, peI) { - Foam::point& a = dE0; - Foam::point& b = dE1; + const Foam::point& pt = otherSurfEdges[peI].first().hitPoint(); - bool inProc = clipLineToProc(topoint(vit->point()), a, b); + pointIndexHit nearest; + pointIsNearSurfaceLocation(pt, nearest); - // Check for the edge passing through a surface - if - ( - inProc - && geometryToConformTo_.findSurfaceAnyIntersection(a, b) - ) + pointIndexHit nearestEdge; + pointIsNearFeatureEdgeLocation(pt, nearestEdge); + + bool isNearFeaturePt = nearFeaturePt(pt); + + if (nearest.hit() || nearestEdge.hit() || isNearFeaturePt) { - // Pout<< "# findSurfaceAnyIntersection" << endl; - // meshTools::writeOBJ(Pout, a); - // meshTools::writeOBJ(Pout, b); - // Pout<< "l cr0 cr1" << endl; + nStoppedInsertion++; - return true; + if (!hits[procI].found(peI)) + { + hits[procI].insert(peI); + } } } - else + } + + Pstream::listCombineGather(hits, plusEqOp<labelHashSet>()); + Pstream::listCombineScatter(hits); + + forAll(surfaceHits, eI) + { + if (!hits[Pstream::myProcNo()].found(eI)) { - if (geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1)) - { - return true; - } + synchronisedSurfLocations.append(surfaceHits[eI]); } } - return false; + forAll(synchronisedSurfLocations, pI) + { + appendToSurfacePtTree + ( + synchronisedSurfLocations[pI].first().hitPoint() + ); + } + + const label nNotInserted = returnReduce(nStoppedInsertion, sumOp<label>()); + + Info<< " Not inserting total of " << nNotInserted << " locations" + << endl; + + surfaceHits = synchronisedSurfLocations; + + return nNotInserted; +} + + +Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees +( + pointIndexHitAndFeatureList& featureEdgeHits +) +{ + Info<< " Edge tree synchronisation" << endl; + + pointIndexHitAndFeatureDynList synchronisedEdgeLocations + ( + featureEdgeHits.size() + ); + + List<pointIndexHitAndFeatureDynList> procEdgeLocations(Pstream::nProcs()); + + procEdgeLocations[Pstream::myProcNo()] = featureEdgeHits; + + Pstream::gatherList(procEdgeLocations); + Pstream::scatterList(procEdgeLocations); + + List<labelHashSet> hits(Pstream::nProcs()); + + label nStoppedInsertion = 0; + + // Do the nearness tests here + for (label procI = 0; procI < Pstream::nProcs(); ++procI) + { + // Skip own points + if (procI >= Pstream::myProcNo()) + { + continue; + } + + pointIndexHitAndFeatureList& otherProcEdges = procEdgeLocations[procI]; + + forAll(otherProcEdges, peI) + { + const Foam::point& pt = otherProcEdges[peI].first().hitPoint(); + + pointIndexHit nearest; + pointIsNearFeatureEdgeLocation(pt, nearest); + + bool isNearFeaturePt = nearFeaturePt(pt); + + if (nearest.hit() || isNearFeaturePt) + { + nStoppedInsertion++; + + if (!hits[procI].found(peI)) + { + hits[procI].insert(peI); + } + } + } + } + + Pstream::listCombineGather(hits, plusEqOp<labelHashSet>()); + Pstream::listCombineScatter(hits); + + forAll(featureEdgeHits, eI) + { + if (!hits[Pstream::myProcNo()].found(eI)) + { + synchronisedEdgeLocations.append(featureEdgeHits[eI]); + } + } + + forAll(synchronisedEdgeLocations, pI) + { + appendToEdgeLocationTree + ( + synchronisedEdgeLocations[pI].first().hitPoint() + ); + } + + const label nNotInserted = returnReduce(nStoppedInsertion, sumOp<label>()); + + Info<< " Not inserting total of " << nNotInserted << " locations" + << endl; + + featureEdgeHits = synchronisedEdgeLocations; + + return nNotInserted; +} + + +bool Foam::conformalVoronoiMesh::locationConformsToInside +( + const pointIndexHitAndFeature& info +) const +{ + bool keepLocation = true; + + if (info.first().hit()) + { + vectorField norm(1); + + allGeometry_[info.second()].getNormal + ( + List<pointIndexHit>(1, info.first()), + norm + ); + + const vector& n = norm[0]; + + const scalar ppDist = pointPairDistance(info.first().hitPoint()); + + const Foam::point innerPoint = info.first().hitPoint() - ppDist*n; + + if (!geometryToConformTo_.inside(innerPoint)) + { + keepLocation = false; + } + } + else + { + keepLocation = false; + } + + return keepLocation; +} + + +bool Foam::conformalVoronoiMesh::dualCellSurfaceAnyIntersection +( + const Delaunay::Finite_vertices_iterator& vit +) const +{ + std::list<Facet> facets; + incident_facets(vit, std::back_inserter(facets)); + + for + ( + std::list<Facet>::iterator fit=facets.begin(); + fit != facets.end(); + ++fit + ) + { + if + ( + is_infinite(fit->first) + || is_infinite(fit->first->neighbor(fit->second)) + || !fit->first->hasInternalPoint() + || !fit->first->neighbor(fit->second)->hasInternalPoint() + ) + { + continue; + } + + Foam::point dE0 = fit->first->dual(); + Foam::point dE1 = fit->first->neighbor(fit->second)->dual(); + + if (Pstream::parRun()) + { + Foam::point& a = dE0; + Foam::point& b = dE1; + + bool inProc = clipLineToProc(topoint(vit->point()), a, b); + + // Check for the edge passing through a surface + if + ( + inProc + && geometryToConformTo_.findSurfaceAnyIntersection(a, b) + ) + { + return true; + } + } + else + { + if (geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1)) + { + return true; + } + } + } + + return false; } bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections ( const Delaunay::Finite_vertices_iterator& vit, - DynamicList<pointIndexHit>& infoList, - DynamicList<label>& hitSurfaceList + pointIndexHitAndFeatureDynList& infoList ) const { bool flagIntersection = false; @@ -646,6 +926,10 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections ( is_infinite(fit->first) || is_infinite(fit->first->neighbor(fit->second)) + || !fit->first->hasInternalPoint() + || !fit->first->neighbor(fit->second)->hasInternalPoint() +// || fit->first->hasFarPoint() +// || fit->first->neighbor(fit->second)->hasFarPoint() ) { continue; @@ -689,7 +973,7 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections const vector& n = norm[0]; - const Foam::point vertex = topoint(vit->point()); + pointFromPoint vertex = topoint(vit->point()); const plane p(infoIntersection.hitPoint(), n); @@ -699,36 +983,45 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections const Foam::point newPoint = vertex + d*n; - pointIndexHit info; - label hitSurface = -1; + pointIndexHitAndFeature info; geometryToConformTo_.findSurfaceNearest ( newPoint, surfaceSearchDistanceSqr(newPoint), - info, - hitSurface + info.first(), + info.second() ); bool rejectPoint = false; - if (info.hit()) + if (!locationConformsToInside(info)) + { + rejectPoint = true; + } + + if (!rejectPoint && info.first().hit()) { if (!infoList.empty()) { forAll(infoList, hitI) { // Reject point if the point is already added - if (infoList[hitI].index() == info.index()) + if + ( + infoList[hitI].first().index() + == info.first().index() + ) { rejectPoint = true; break; } - const Foam::point& p = infoList[hitI].hitPoint(); + const Foam::point& p + = infoList[hitI].first().hitPoint(); const scalar separationDistance = - mag(p - info.hitPoint()); + mag(p - info.first().hitPoint()); const scalar minSepDist = sqr @@ -751,1059 +1044,59 @@ bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections // The normal ray from the vertex will not always result in a hit // because another surface may be in the way. - if (!rejectPoint && info.hit()) + if (!rejectPoint && info.first().hit()) { flagIntersection = true; infoList.append(info); - hitSurfaceList.append(hitSurface); } } } - return flagIntersection; -} - - -bool Foam::conformalVoronoiMesh::clipLineToProc -( - const Foam::point& pt, - Foam::point& a, - Foam::point& b -) const -{ - bool inProc = false; - - pointIndexHit findAnyIntersection = decomposition_().findLine(a, b); - - if (!findAnyIntersection.hit()) - { - pointIndexHit info = decomposition_().findLine(a, pt); - - if (!info.hit()) - { - inProc = true; - } - else - { - inProc = false; - } - } - else - { - pointIndexHit info = decomposition_().findLine(a, pt); - - if (!info.hit()) - { - inProc = true; - b = findAnyIntersection.hitPoint(); - } - else - { - inProc = true; - a = findAnyIntersection.hitPoint(); - } - } - - return inProc; -} - - -void Foam::conformalVoronoiMesh::buildParallelInterface -( - const word& outputName -) -{ - List<labelHashSet> referralVertices(Pstream::nProcs()); - List<labelHashSet> receivedVertices(Pstream::nProcs()); - - buildParallelInterface - ( - referralVertices, - receivedVertices, - true, - outputName - ); -} - - -Foam::label Foam::conformalVoronoiMesh::removeProcessorBoundarySeeds -( - bool reinsertBoundPts -) -{ - label nFarPoints = 0; - - - - std::list<Vertex_handle> toRemove; - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - ++vit - ) - { - if (vit->farPoint()) - { - //remove(vit); - toRemove.push_back(vit); - nFarPoints++; - } - } - - // This function removes the points in the iterator range and then - // retriangulates. - timeCheck("Start Removing Seeded Points " + name(toRemove.size())); - - remove_cluster(toRemove.begin(), toRemove.end()); - - - // Need to do this to make sure the triangulation is well-behaved - if (reinsertBoundPts) - { - reinsertBoundingPoints(); - } - - - -// DynamicList<Foam::point> toAdd; -// DynamicList<label> indices; -// DynamicList<label> types; -// -// for -// ( -// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); -// vit != finite_vertices_end(); -// ++vit -// ) -// { -// if (!vit->farPoint()) -// { -// toAdd.append(topoint(vit->point())); -// indices.append(vit->index()); -// types.append(vit->type()); -// -// nFarPoints++; -// } -// } -// -// this->clear(); -// -// // Need to do this to make sure the triangulation is well-behaved -// if (reinsertBoundPts) -// { -// reinsertBoundingPoints(); -// } -// -// forAll(toAdd, pI) -// { -// insertPoint(toAdd[pI], indices[pI], types[pI]); -// } - - - timeCheck("End Removing Seeded Points"); - - return nFarPoints; -} - - -void Foam::conformalVoronoiMesh::seedProcessorBoundarySurfaces -( - bool seedProcessors -) -{ - //removeProcessorBoundarySeeds(false); - - // Loop over processor patch faces and insert a point in the centre of the - // face - const fvMesh& mesh = decomposition_().mesh(); - const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); - - DynamicList<Foam::point> pts; - DynamicList<label> indices; - DynamicList<label> types; - - label nFarPoints = 0; - - const scalar normalDistance = 2.0; - const scalar pert = 0.1*(rndGen_.scalar01() - 0.5); - - forAll(bMesh, patchI) - { - const polyPatch& patch = bMesh[patchI]; - - if (!seedProcessors && isA<processorPolyPatch>(patch)) - { - continue; - } - - forAll(patch, faceI) - { - if (faceI % 1 == 0) - { - const face& f = patch[faceI]; - - pts.append - ( - f.centre(mesh.points()) - + pert*normalDistance*f.normal(mesh.points()) - ); - indices.append(nFarPoints++); - types.append(Vb::vtFar); - } - } - } - - insertPoints(pts, indices, types, false); - - reduce(nFarPoints, sumOp<label>()); - - Info<< " Inserted " << nFarPoints - << " far points into the mesh." << endl; -} - - -void Foam::conformalVoronoiMesh::buildParallelInterface -( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - bool initialEdgeReferral, - const word& outputName -) -{ - if (!Pstream::parRun()) - { - return; - } - - Info<< nl << "Parallel interface construction" << endl; - - timeCheck("Before buildParallelInterface"); - - // Hard coded switch, can be turned on for testing and debugging purposes - - // all vertices will be referred to all processors, use with caution for - // big cases. - bool allPointReferral = false; - - if (allPointReferral) - { - buildParallelInterfaceAll - ( - referralVertices, - receivedVertices, - outputName - ); - - timeCheck("After buildParallelInterfaceAll"); - } - - - // Reject points that are not near the boundary from the subsequent - // searches - -// label nearProcCount = 0; -// label notNearProcCount = 0; -// boundBox quickRejectionBox(decomposition_().procBounds()); -// -//// Pout<< "Processor boundBox: " << quickRejectionBox << endl; -// -// quickRejectionBox.inflate(-0.1); -// -// OFstream str("rejectionBox_" + name(Pstream::myProcNo()) + ".obj"); -// -// meshTools::writeOBJ -// ( -// str, -// boundBox::faces(), -// quickRejectionBox.points() -// ); -// -// Pout<< "Inflated rejection boundBox: " << quickRejectionBox << endl; - -// for -// ( -// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); -// vit != finite_vertices_end(); -// vit++ -// ) -// { -// if (vit->real() && !vit->nearProcBoundary()) -// { -// const Foam::point& pt = topoint(vit->point()); -// const scalar range = targetCellSize(pt); -// -//// if -//// ( -//// decomposition_().overlapsThisProcessor -//// ( -//// pt, -//// range -//// ) -//// ) -// if (!quickRejectionBox.contains(pt)) -// { -// vit->setNearProcBoundary(); -// nearProcCount++; -// } -// else -// { -// //vit->setNearProcBoundary(); -// notNearProcCount++; -// } -// } -// } -// -// reduce(nearProcCount, sumOp<label>()); -// reduce(notNearProcCount, sumOp<label>()); -// -// timeCheck -// ( -// "End of potential intersection search. " -// + name(nearProcCount) + " are near a processor boundary. " -// + name(notNearProcCount) + " are not." -// ); - -// if (initialEdgeReferral) -// { -// // Used as an initial pass to localise the vertex referring - find -// // vertices whose dual edges pierce nearby processor volumes and refer -// // them to establish a sensible boundary interface region before -// // running a circumsphere assessment. -// -// buildParallelInterfaceIntersection -// ( -// referralVertices, -// receivedVertices, -// outputName -// ); -// -// timeCheck("After buildParallelInterfaceIntersection"); -// } - - buildParallelInterfaceInfluence - ( - referralVertices, - receivedVertices, - outputName - ); - - timeCheck("After buildParallelInterface"); - - // Check all referred vertices are actually used on the processor. - label nUnusedReferred = numberOfUnusedReferredPoints(); - - reduce(nUnusedReferred, sumOp<label>()); - - Info<< " Number of referred points that are not used : " - << nUnusedReferred << " (approximate)" << endl; -} - - -Foam::label Foam::conformalVoronoiMesh::numberOfUnusedReferredPoints() const -{ - label nUnusedPoints = 0; - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - ++vit - ) - { - if (vit->referred()) - { - std::list<Vertex_handle> adjVertices; - finite_adjacent_vertices(vit, std::back_inserter(adjVertices)); - - bool isUsed = false; - - for - ( - std::list<Vertex_handle>::iterator adjVit = adjVertices.begin(); - adjVit != adjVertices.end(); - ++adjVit - ) - { - if ((*adjVit)->real()) - { - isUsed = true; - } - } - - if (!isUsed) - { - nUnusedPoints++; - } - } - } - - return nUnusedPoints; -} - - -void Foam::conformalVoronoiMesh::buildParallelInterfaceAll -( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - const word& outputName -) -{ - // Refer all points to all processors - - DynamicList<Foam::point> parallelAllPoints; - DynamicList<label> targetProcessor; - DynamicList<label> parallelAllIndices; - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - ++vit - ) - { - if (!vit->farPoint()) - { - for (label procI = 0; procI < Pstream::nProcs(); procI++) - { - if (procI == Pstream::myProcNo()) - { - continue; - } - - label vIndex = vit->index(); - - // Using the hashSet to ensure that each vertex is - // only referred once to each processor - if (!referralVertices[procI].found(vIndex)) - { - referralVertices[procI].insert(vIndex); - - parallelAllPoints.append - ( - topoint(vit->point()) - ); - - targetProcessor.append(procI); - - if (vit->internalOrBoundaryPoint()) - { - parallelAllIndices.append(vIndex); - } - else - { - parallelAllIndices.append(-vIndex); - } - } - } - } - } - - referVertices - ( - targetProcessor, - parallelAllPoints, - parallelAllIndices, - receivedVertices, - "all", - outputName - ); -} - -void Foam::conformalVoronoiMesh::buildParallelInterfaceIntersection -( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - const word& outputName -) -{ - DynamicList<Foam::point> parallelIntersectionPoints; - DynamicList<label> targetProcessor; - DynamicList<label> parallelIntersectionIndices; - - // End points of dual edges. Some of these values will not be used, - // i.e. for edges with non-real vertices. - DynamicList<Foam::point> dE0; - DynamicList<Foam::point> dE1; - - PackedBoolList testFacetIntersection(number_of_facets(), false); - - // Index outer (all) Delaunauy facets for whether they are potential - // intersections, index (inner) the list of tests an results. - label fIInner = 0; - label fIOuter = 0; - - for - ( - Delaunay::Finite_facets_iterator fit = finite_facets_begin(); - fit != finite_facets_end(); - ++fit - ) - { - const Cell_handle c1(fit->first); - const Cell_handle c2(c1->neighbor(fit->second)); - - // If either Delaunay cell at the end of the Dual edge is infinite, - // skip. - if - ( - !is_infinite(c1) && !is_infinite(c2) - ) - { - // The Delaunauy cells at either end of the dual edge need to be - // real, i.e. all vertices form part of the internal or boundary - // definition - if - ( - c1->internalOrBoundaryDualVertex() - && c2->internalOrBoundaryDualVertex() - ) - { - const Foam::point& a = c1->dual(); - const Foam::point& b = c2->dual(); - - // Only if the dual edge cuts the boundary of this processor is - // it going to be counted. - pointIndexHit info = decomposition_().findLineAny(a, b); - - if (info.hit()) - { - dE0.append(a); - dE1.append(b); - - testFacetIntersection[fIOuter] = true; - } - } - } - - fIOuter++; - } - - reduce(fIOuter, sumOp<label>()); - - timeCheck - ( - "End of actual intersection search over " - + name(fIOuter) - + " faces." - ); - - // Preform intersections in both directions, as there is no sense - // associated with the Dual edge - List<List<pointIndexHit> > intersectionForward(intersectsProc(dE0, dE1)); - List<List<pointIndexHit> > intersectionReverse(intersectsProc(dE1, dE0)); - - timeCheck("End of find processor intersection"); - - // Reset counter - fIOuter = 0; - - // Relying on the order of iteration of facets being the same as before - for - ( - Delaunay::Finite_facets_iterator fit = finite_facets_begin(); - fit != finite_facets_end(); - ++fit - ) - { - const Cell_handle c1(fit->first); - const Cell_handle c2(c1->neighbor(fit->second)); - - // Pre-tested facet intersection potential - if (testFacetIntersection[fIOuter]) - { - const Foam::point a = dE0[fIInner]; - const Foam::point b = dE1[fIInner]; - - scalar hitDistSqr = GREAT; - label closestHitProc = -1; - scalar closestHitDistSqr = GREAT; - - // Find the closest intersection with the other background meshes - // of the other processors in each direction, finding the closest. - forAll(intersectionForward[fIInner], iFI) - { - const pointIndexHit& info = intersectionForward[fIInner][iFI]; - - if (info.hit()) - { - // Line was a -> hit - hitDistSqr = magSqr(a - info.hitPoint()); - } - - if (hitDistSqr < closestHitDistSqr) - { - closestHitProc = info.index(); - closestHitDistSqr = hitDistSqr; - } - } - - forAll(intersectionReverse[fIInner], iRI) - { - const pointIndexHit& info = intersectionReverse[fIInner][iRI]; - - if (info.hit()) - { - // Line was b -> hit - hitDistSqr = magSqr(b - info.hitPoint()); - } - - if (hitDistSqr < closestHitDistSqr) - { - closestHitProc = info.index(); - closestHitDistSqr = hitDistSqr; - } - } - - if (closestHitProc >= 0) - { - // This dual edge pierces a processor, refer all vertices from - // both Delaunauy cells to it. - - for (int i = 0; i < 4; i++) - { - Vertex_handle v = c1->vertex(i); - - label vIndex = v->index(); - - if (v->farPoint() || v->referred()) - { - continue; - } - - // Using the hashSet to ensure that each vertex is only - // referred once to each processor - if (!referralVertices[closestHitProc].found(vIndex)) - { - referralVertices[closestHitProc].insert(vIndex); - - parallelIntersectionPoints.append(topoint(v->point())); - - targetProcessor.append(closestHitProc); - - if (v->internalOrBoundaryPoint()) - { - parallelIntersectionIndices.append(vIndex); - } - else - { - parallelIntersectionIndices.append(-vIndex); - } - - // Pout<< "Refer " - // << parallelIntersectionPoints.last() - // << " " << parallelIntersectionIndices.last() - // << " " << closestHitProc - // << endl; - } - } - - for (int i = 0; i < 4; i++) - { - Vertex_handle v = c2->vertex(i); - - label vIndex = v->index(); - - if (v->farPoint() || v->referred()) - { - continue; - } - - // Using the hashSet to ensure that each vertex is only - // referred once to each processor - if (!referralVertices[closestHitProc].found(vIndex)) - { - referralVertices[closestHitProc].insert(vIndex); - - parallelIntersectionPoints.append(topoint(v->point())); - - targetProcessor.append(closestHitProc); - - if (v->internalOrBoundaryPoint()) - { - parallelIntersectionIndices.append(vIndex); - } - else - { - parallelIntersectionIndices.append(-vIndex); - } - - // Pout<< "Refer " - // << parallelIntersectionPoints.last() - // << " " << parallelIntersectionIndices.last() - // << " " << closestHitProc - // << endl; - } - } - } - - fIInner++; - } - - fIOuter++; - } - - referVertices - ( - targetProcessor, - parallelIntersectionPoints, - parallelIntersectionIndices, - receivedVertices, - "intersection", - outputName - ); -} - - -void Foam::conformalVoronoiMesh::buildParallelInterfaceInfluence -( - List<labelHashSet>& referralVertices, - List<labelHashSet>& receivedVertices, - const word& outputName -) -{ - DynamicList<Foam::point> parallelInfluencePoints; - DynamicList<label> targetProcessor; - DynamicList<label> parallelInfluenceIndices; - - // Some of these values will not be used, i.e. for non-real cells - DynamicList<Foam::point> circumcentre; - DynamicList<scalar> circumradiusSqr; - - - // Index outer (all) Delaunauy cells for whether they are potential - // overlaps, index (inner) the list of tests an results. - label cIInner = 0; - label cIOuter = 0; - - seedProcessorBoundarySurfaces(true); - - label cellIndexCount = 0; - for - ( - Delaunay::Finite_cells_iterator cit = finite_cells_begin(); - cit != finite_cells_end(); - ++cit - ) - { - cit->cellIndex() = cellIndexCount++; - } - - - timeCheck("End of cell Indexing"); - - labelList testCellInfluence(number_of_cells(), 0); - - label nQuickRejections = 0; - - for - ( - Delaunay::Finite_cells_iterator cit = finite_cells_begin(); - cit != finite_cells_end(); - ++cit - ) - { - const Foam::point& cc = cit->dual(); - - const scalar crSqr = magSqr(cc - topoint(cit->vertex(0)->point())); - - if - ( - decomposition_().tree().quickCircumsphereRejection - ( - cc, - crSqr, - decomposition_().octreeNearestDistances() - ) - ) - { - nQuickRejections++; - //testCellInfluence[cit->cellIndex()] = -1; - } - } - - timeCheck("End of octreeNearestDistances calculation"); - - for - ( - Delaunay::Finite_cells_iterator cit = finite_cells_begin(); - cit != finite_cells_end(); - ++cit - ) - { - // Assess the influence of the circumsphere of each Delaunay cell with - // the defining volumes for all processors. Any processor touched by - // the circumsphere requires all points of the cell to be referred to - // it. - - // The Delaunay cells to assess have to be real, i.e. all vertices form - // part of the internal or any part of the boundary definition - if - ( - (testCellInfluence[cit->cellIndex()] == 0) - && (cit->real() || cit->hasFarPoint()) - ) - { - const Foam::point& cc = cit->dual(); - - const scalar crSqr = magSqr(cc - topoint(cit->vertex(0)->point())); - - // Only if the circumsphere overlaps the boundary of this processor - // is there a chance of it overlapping others - if (decomposition_().overlapsThisProcessor(cc, sqr(1.01)*crSqr)) - { - circumcentre.append(cc); - circumradiusSqr.append(crSqr); - - testCellInfluence[cit->cellIndex()] = 1; - } - } - - cIOuter++; - } - - timeCheck("End of testing cell influence"); - -// Pout<< "Number of quick rejections = " << nQuickRejections << endl; - Pout<< "Number of influences = " << circumcentre.size() << endl; - - // Increasing the circumspheres to increase the overlaps and compensate for - // floating point errors missing some referrals - labelListList circumsphereOverlaps - = decomposition_().overlapsProcessors - ( - circumcentre, - sqr(1.01)*circumradiusSqr, - false - ); - - timeCheck("End of increasing overlaps"); - - // Reset counters - cIOuter = 0; - - // Relying on the order of iteration of cells being the same as before - for - ( - Delaunay::Finite_cells_iterator cit = finite_cells_begin(); - cit != finite_cells_end(); - ++cit - ) - { - // Pre-tested circumsphere potential influence - if (testCellInfluence[cit->cellIndex()] == 1) - { - const labelList& citOverlaps = circumsphereOverlaps[cIInner]; - - forAll(citOverlaps, cOI) - { - label procI = citOverlaps[cOI]; - - for (int i = 0; i < 4; i++) - { - Vertex_handle v = cit->vertex(i); - - label vIndex = v->index(); - - if (v->farPoint() || v->referred()) - { - continue; - } - - // Using the hashSet to ensure that each vertex is only - // referred once to each processor - if (!referralVertices[procI].found(vIndex)) - { - referralVertices[procI].insert(vIndex); - - parallelInfluencePoints.append(topoint(v->point())); - - targetProcessor.append(procI); - - if (v->internalOrBoundaryPoint()) - { - parallelInfluenceIndices.append(vIndex); - } - else - { - parallelInfluenceIndices.append(-vIndex); - } - } - } - } - - cIInner++; - } - - cIOuter++; - } - - label nFarPoints = removeProcessorBoundarySeeds(true); - - reduce(nFarPoints, sumOp<label>()); - - Info<< " Removed " << nFarPoints - << " far points from the mesh." << endl; - - -// seedProcessorBoundarySurfaces(false); - -// cIInner = 0; -// cIOuter = 0; - - - // Relying on the order of iteration of cells being the same as before -// for -// ( -// Delaunay::Finite_cells_iterator cit = finite_cells_begin(); -// cit != finite_cells_end(); -// ++cit -// ) -// { -// // Pre-tested circumsphere potential influence -// if (testCellInfluence[cIOuter]) -// { -// const labelList& citOverlaps = circumsphereOverlaps[cIInner]; -// -// forAll(citOverlaps, cOI) -// { -// label procI = citOverlaps[cOI]; -// -// recursiveCircumsphereSearch -// ( -// cit, -// procI, -// referralVertices, -// checkedCells, -// parallelInfluencePoints, -// parallelInfluenceIndices, -// targetProcessor -// ); -// } -// -// cIInner++; -// } -// -// cIOuter++; -// } - -// for -// ( -// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); -// vit != finite_vertices_end(); -// ++vit -// ) -// { -// if (vit->referred()) -// { -// //Pout << "REMOVE: " << topoint(vit->point()) << endl; -// remove(vit); -// } -// } - - referVertices - ( - targetProcessor, - parallelInfluencePoints, - parallelInfluenceIndices, - receivedVertices, - "influence", - outputName - ); -} - - -void Foam::conformalVoronoiMesh::referVertices -( - const DynamicList<label>& targetProcessor, - DynamicList<Foam::point>& parallelPoints, - DynamicList<label>& parallelIndices, - List<labelHashSet>& receivedVertices, - const word& stageName, - const word& outputName -) -{ - timeCheck("Start of referVertices " + stageName); - - if (cvMeshControls().objOutput()) - { - writePoints - ( - "parallel_" + stageName +"_pointsToSend_" + outputName + ".obj", - parallelPoints - ); - } - - mapDistribute pointMap = backgroundMeshDecomposition::buildMap - ( - targetProcessor - ); - - label totalVertices = parallelPoints.size(); + return flagIntersection; +} - reduce(totalVertices, sumOp<label>()); - pointMap.distribute(parallelPoints); +bool Foam::conformalVoronoiMesh::clipLineToProc +( + const Foam::point& pt, + Foam::point& a, + Foam::point& b +) const +{ + bool inProc = false; - pointMap.distribute(parallelIndices); + pointIndexHit findAnyIntersection = decomposition_().findLine(a, b); - if (cvMeshControls().objOutput()) + if (!findAnyIntersection.hit()) { - writePoints - ( - "parallel_" + stageName +"_pointsReceived_" + outputName + ".obj", - parallelPoints - ); - } - - timeCheck("Start of referVertices " + stageName + " insertion."); - - label inserted = 0; + pointIndexHit info = decomposition_().findLine(a, pt); - for (label procI = 0; procI < Pstream::nProcs(); procI++) + if (!info.hit()) + { + inProc = true; + } + else + { + inProc = false; + } + } + else { - const labelList& constructMap = pointMap.constructMap()[procI]; + pointIndexHit info = decomposition_().findLine(a, pt); - if (constructMap.size()) + if (!info.hit()) { - forAll(constructMap, i) - { - label origIndex = parallelIndices[constructMap[i]]; - - if (!receivedVertices[procI].found(origIndex)) - { - // For the initial referred vertices, the original - // processor is the one that is sending it. - label encodedProcI = Vb::encodeProcIndex(procI); - - // Pout<< "Insert " - // << parallelPoints[constructMap[i]] - // << " " << origIndex - // << " " << procI - // << endl; - - insertPoint - ( - parallelPoints[constructMap[i]], - origIndex, - encodedProcI - ); - - inserted++; - - receivedVertices[procI].insert(origIndex); - } - } + inProc = true; + b = findAnyIntersection.hitPoint(); + } + else + { + inProc = true; + a = findAnyIntersection.hitPoint(); } } - reduce(inserted, sumOp<label>()); - - Info<< " Inserted " << stageName << " vertices " << inserted << endl; - - Info<< " Total " << stageName << " vertices " << totalVertices << endl; - - timeCheck("End of referVertices " + stageName); + return inProc; } @@ -1821,7 +1114,7 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceProtrusion std::list<Facet> facets; finite_incident_facets(vit, std::back_inserter(facets)); - const Foam::point vert = topoint(vit->point()); + pointFromPoint vert = topoint(vit->point()); scalar maxProtrusionDistance = maxSurfaceProtrusion(vert); @@ -1832,12 +1125,20 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceProtrusion ++fit ) { - const Foam::point edgeMid = - 0.5 - *( - fit->first->dual() - + fit->first->neighbor(fit->second)->dual() - ); + Cell_handle c1 = fit->first; + Cell_handle c2 = fit->first->neighbor(fit->second); + + if + ( + is_infinite(c1) || is_infinite(c2) + || !c1->hasInternalPoint() || !c2->hasInternalPoint() + || !c1->real() || !c2->real() + ) + { + continue; + } + + Foam::point edgeMid = 0.5*(c1->dual() + c2->dual()); pointIndexHit surfHit; label hitSurface; @@ -1906,7 +1207,7 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion std::list<Facet> facets; finite_incident_facets(vit, std::back_inserter(facets)); - const Foam::point vert = topoint(vit->point()); + pointFromPoint vert = topoint(vit->point()); scalar minIncursionDistance = -maxSurfaceProtrusion(vert); @@ -1917,12 +1218,20 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion ++fit ) { - const Foam::point edgeMid = - 0.5 - *( - fit->first->dual() - + fit->first->neighbor(fit->second)->dual() - ); + Cell_handle c1 = fit->first; + Cell_handle c2 = fit->first->neighbor(fit->second); + + if + ( + is_infinite(c1) || is_infinite(c2) + || !c1->hasInternalPoint() || !c2->hasInternalPoint() + || !c1->real() || !c2->real() + ) + { + continue; + } + + Foam::point edgeMid = 0.5*(c1->dual() + c2->dual()); pointIndexHit surfHit; label hitSurface; @@ -2003,111 +1312,110 @@ void Foam::conformalVoronoiMesh::reportProcessorOccupancy() } -void Foam::conformalVoronoiMesh::reportSurfaceConformationQuality() -{ - Info<< nl << "Check surface conformation quality" << endl; - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - vit++ - ) - { - if (vit->internalOrBoundaryPoint()) - { - Foam::point vert(topoint(vit->point())); - pointIndexHit surfHit; - label hitSurface; - - dualCellLargestSurfaceProtrusion(vit, surfHit, hitSurface); - - if (surfHit.hit()) - { - Pout<< nl << "Residual penetration: " << nl - << vit->index() << nl - << vit->type() << nl - << vit->ppMaster() << nl - << "nearFeaturePt " - << nearFeaturePt(surfHit.hitPoint()) << nl - << vert << nl - << surfHit.hitPoint() - << endl; - } - } - } - - { - // Assess close surface points - - setVertexSizeAndAlignment(); - - for - ( - Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); - vit != finite_vertices_end(); - vit++ - ) - { - if (vit->ppMaster()) - { - std::list<Vertex_handle> adjacentVertices; - - adjacent_vertices(vit, std::back_inserter(adjacentVertices)); - - Foam::point pt = topoint(vit->point()); - - // Pout<< nl << "vit: " << vit->index() << " " - // << topoint(vit->point()) - // << endl; - - // Pout<< adjacentVertices.size() << endl; - - for - ( - std::list<Vertex_handle>::iterator - avit = adjacentVertices.begin(); - avit != adjacentVertices.end(); - ++avit - ) - { - Vertex_handle avh = *avit; - - // The lower indexed vertex will perform the assessment - if - ( - avh->ppMaster() - && vit->index() < avh->index() - && vit->type() != avh->type() - ) - { - scalar targetSize = 0.2*averageAnyCellSize(vit, avh); - - // Pout<< "diff " << mag(pt - topoint(avh->point())) - // << " " << targetSize << endl; - - if - ( - magSqr(pt - topoint(avh->point())) - < sqr(targetSize) - ) - { - Pout<< nl << "vit: " << vit->index() << " " - << topoint(vit->point()) - << endl; - - Pout<< " adjacent too close: " - << avh->index() << " " - << topoint(avh->point()) - << endl; - } - } - } - } - } - } -} - +//void Foam::conformalVoronoiMesh::reportSurfaceConformationQuality() +//{ +// Info<< nl << "Check surface conformation quality" << endl; +// +// for +// ( +// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); +// vit != finite_vertices_end(); +// vit++ +// ) +// { +// if (vit->internalOrBoundaryPoint()) +// { +// Foam::point vert(topoint(vit->point())); +// pointIndexHit surfHit; +// label hitSurface; +// +// dualCellLargestSurfaceProtrusion(vit, surfHit, hitSurface); +// +// if (surfHit.hit()) +// { +// Pout<< nl << "Residual penetration: " << nl +// << vit->index() << nl +// << vit->type() << nl +// << vit->ppMaster() << nl +// << "nearFeaturePt " +// << nearFeaturePt(surfHit.hitPoint()) << nl +// << vert << nl +// << surfHit.hitPoint() +// << endl; +// } +// } +// } +// +// { +// // Assess close surface points +// +// setVertexSizeAndAlignment(); +// +// for +// ( +// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); +// vit != finite_vertices_end(); +// vit++ +// ) +// { +// if (vit->ppMaster()) +// { +// std::list<Vertex_handle> adjacentVertices; +// +// adjacent_vertices(vit, std::back_inserter(adjacentVertices)); +// +// Foam::point pt = topoint(vit->point()); +// +// // Pout<< nl << "vit: " << vit->index() << " " +// // << topoint(vit->point()) +// // << endl; +// +// // Pout<< adjacentVertices.size() << endl; +// +// for +// ( +// std::list<Vertex_handle>::iterator +// avit = adjacentVertices.begin(); +// avit != adjacentVertices.end(); +// ++avit +// ) +// { +// Vertex_handle avh = *avit; +// +// // The lower indexed vertex will perform the assessment +// if +// ( +// avh->ppMaster() +// && vit->index() < avh->index() +// && vit->type() != avh->type() +// ) +// { +// scalar targetSize = 0.2*averageAnyCellSize(vit, avh); +// +// // Pout<< "diff " << mag(pt - topoint(avh->point())) +// // << " " << targetSize << endl; +// +// if +// ( +// magSqr(pt - topoint(avh->point())) +// < sqr(targetSize) +// ) +// { +// Pout<< nl << "vit: " << vit->index() << " " +// << topoint(vit->point()) +// << endl; +// +// Pout<< " adjacent too close: " +// << avh->index() << " " +// << topoint(avh->point()) +// << endl; +// } +// } +// } +// } +// } +// } +//} void Foam::conformalVoronoiMesh::limitDisplacement ( @@ -2124,7 +1432,7 @@ void Foam::conformalVoronoiMesh::limitDisplacement return; } - Foam::point pt = topoint(vit->point()); + pointFromPoint pt = topoint(vit->point()); Foam::point dispPt = pt + displacement; bool limit = false; @@ -2205,6 +1513,11 @@ Foam::scalar Foam::conformalVoronoiMesh::angleBetweenSurfacePoints pAsurfaceHit ); + if (!pAhit.hit()) + { + return constant::mathematical::pi; + } + vectorField norm(1); allGeometry_[pAsurfaceHit].getNormal @@ -2226,6 +1539,11 @@ Foam::scalar Foam::conformalVoronoiMesh::angleBetweenSurfacePoints pBsurfaceHit ); + if (!pBhit.hit()) + { + return constant::mathematical::pi; + } + allGeometry_[pBsurfaceHit].getNormal ( List<pointIndexHit>(1, pBhit), @@ -2240,84 +1558,81 @@ Foam::scalar Foam::conformalVoronoiMesh::angleBetweenSurfacePoints bool Foam::conformalVoronoiMesh::nearSurfacePoint ( - pointIndexHit& pHit, - label& surfaceHit, - DynamicList<Foam::point>& existingSurfacePtLocations + pointIndexHitAndFeature& pHit ) const { - const Foam::point& pt = pHit.hitPoint(); + const Foam::point& pt = pHit.first().hitPoint(); pointIndexHit closePoint; const bool closeToSurfacePt = pointIsNearSurfaceLocation(pt, closePoint); - if (closeToSurfacePt) - { - const scalar cosAngle - = angleBetweenSurfacePoints(pt, closePoint.hitPoint()); - - // @todo make this tolerance run-time selectable? - if (cosAngle < searchAngleOppositeSurface) - { - pointIndexHit pCloseHit; - label pCloseSurfaceHit = -1; - - const scalar searchDist = targetCellSize(closePoint.hitPoint()); - - geometryToConformTo_.findSurfaceNearest - ( - closePoint.hitPoint(), - searchDist, - pCloseHit, - pCloseSurfaceHit - ); - - vectorField norm(1); - - allGeometry_[pCloseSurfaceHit].getNormal - ( - List<pointIndexHit>(1, pCloseHit), - norm - ); - - const vector nA = norm[0]; - - pointIndexHit oppositeHit; - label oppositeSurfaceHit = -1; - - geometryToConformTo_.findSurfaceNearestIntersection - ( - closePoint.hitPoint() + SMALL*nA, - closePoint.hitPoint() + mag(pt - closePoint.hitPoint())*nA, - oppositeHit, - oppositeSurfaceHit - ); - - if (oppositeHit.hit()) - { - // Replace point - pHit = oppositeHit; - surfaceHit = oppositeSurfaceHit; - - Foam::point newPt = oppositeHit.hitPoint(); - - appendToSurfacePtTree(newPt, existingSurfacePtLocations); - - return !closeToSurfacePt; - - if (debug) - { - Info<< "Point " << pt - << " is close to " << closePoint.hitPoint() - << " so will be moved to " << oppositeHit.hitPoint() - << endl; - } - } - } - } - else +// if +// ( +// closeToSurfacePt +// && mag(pt - closePoint.hitPoint()) > pointPairDistance(pt) +// ) +// { +// const scalar cosAngle +// = angleBetweenSurfacePoints(pt, closePoint.hitPoint()); +// +// // @todo make this tolerance run-time selectable? +// if (cosAngle < searchAngleOppositeSurface) +// { +// pointIndexHit pCloseHit; +// label pCloseSurfaceHit = -1; +// +// const scalar searchDist = targetCellSize(closePoint.hitPoint()); +// +// if (searchDist < SMALL) +// { +// Pout<< "WARNING: SMALL CELL SIZE" << endl; +// } +// +// geometryToConformTo_.findSurfaceNearest +// ( +// closePoint.hitPoint(), +// searchDist, +// pCloseHit, +// pCloseSurfaceHit +// ); +// +// vectorField norm(1); +// +// allGeometry_[pCloseSurfaceHit].getNormal +// ( +// List<pointIndexHit>(1, pCloseHit), +// norm +// ); +// +// const vector nA = norm[0]; +// +// pointIndexHit oppositeHit; +// label oppositeSurfaceHit = -1; +// +// geometryToConformTo_.findSurfaceNearestIntersection +// ( +// closePoint.hitPoint() + SMALL*nA, +// closePoint.hitPoint() + mag(pt - closePoint.hitPoint())*nA, +// oppositeHit, +// oppositeSurfaceHit +// ); +// +// if (oppositeHit.hit()) +// { +// // Replace point +// pHit.first() = oppositeHit; +// pHit.second() = oppositeSurfaceHit; +// +// appendToSurfacePtTree(pHit.first().hitPoint()); +// +// return !closeToSurfacePt; +// } +// } +// } +// else { - appendToSurfacePtTree(pt, existingSurfacePtLocations); + appendToSurfacePtTree(pt); } return closeToSurfacePt; @@ -2326,15 +1641,14 @@ bool Foam::conformalVoronoiMesh::nearSurfacePoint bool Foam::conformalVoronoiMesh::appendToSurfacePtTree ( - const Foam::point& pt, - DynamicList<Foam::point>& existingSurfacePtLocations + const Foam::point& pt ) const { - label startIndex = existingSurfacePtLocations.size(); + label startIndex = existingSurfacePtLocations_.size(); - existingSurfacePtLocations.append(pt); + existingSurfacePtLocations_.append(pt); - label endIndex = existingSurfacePtLocations.size(); + label endIndex = existingSurfacePtLocations_.size(); return surfacePtLocationTreePtr_().insert(startIndex, endIndex); } @@ -2342,15 +1656,14 @@ bool Foam::conformalVoronoiMesh::appendToSurfacePtTree bool Foam::conformalVoronoiMesh::appendToEdgeLocationTree ( - const Foam::point& pt, - DynamicList<Foam::point>& existingEdgeLocations + const Foam::point& pt ) const { - label startIndex = existingEdgeLocations.size(); + label startIndex = existingEdgeLocations_.size(); - existingEdgeLocations.append(pt); + existingEdgeLocations_.append(pt); - label endIndex = existingEdgeLocations.size(); + label endIndex = existingEdgeLocations_.size(); return edgeLocationTreePtr_().insert(startIndex, endIndex); } @@ -2442,8 +1755,7 @@ bool Foam::conformalVoronoiMesh::pointIsNearSurfaceLocation bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation ( - pointIndexHit& pHit, - DynamicList<Foam::point>& existingEdgeLocations + pointIndexHit& pHit ) const { Foam::point pt = pHit.hitPoint(); @@ -2513,7 +1825,7 @@ bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation if (!closeToFeatureEdge) { - appendToEdgeLocationTree(pt, existingEdgeLocations); + appendToEdgeLocationTree(pt); } return closeToFeatureEdge; @@ -2609,57 +1921,34 @@ void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits ( const Delaunay::Finite_vertices_iterator& vit, - const Foam::point& vert, - const DynamicList<pointIndexHit>& surfHit, - const DynamicList<label>& hitSurface, + const pointIndexHitAndFeatureDynList& surfaceIntersections, scalar surfacePtReplaceDistCoeffSqr, scalar edgeSearchDistCoeffSqr, - DynamicList<pointIndexHit>& surfaceHits, - DynamicList<label>& hitSurfaces, - DynamicList<pointIndexHit>& featureEdgeHits, - DynamicList<label>& featureEdgeFeaturesHit, - DynamicList<Foam::point>& newEdgeLocations, - DynamicList<Foam::point>& existingEdgeLocations, - DynamicList<Foam::point>& existingSurfacePtLocations + pointIndexHitAndFeatureDynList& surfaceHits, + pointIndexHitAndFeatureDynList& featureEdgeHits ) const { - const scalar cellSize = targetCellSize(vert); + const scalar cellSize = targetCellSize(topoint(vit->point())); const scalar cellSizeSqr = sqr(cellSize); - forAll(surfHit, sI) + forAll(surfaceIntersections, sI) { - bool keepSurfacePoint = true; + pointIndexHitAndFeature surfHitI = surfaceIntersections[sI]; - pointIndexHit surfHitI = surfHit[sI]; - label hitSurfaceI = hitSurface[sI]; + bool keepSurfacePoint = true; - if (!surfHitI.hit()) + if (!surfHitI.first().hit()) { continue; } - bool isNearFeaturePt = nearFeaturePt(surfHitI.hitPoint()); + bool isNearFeaturePt = nearFeaturePt(surfHitI.first().hitPoint()); - bool isNearSurfacePt = nearSurfacePoint - ( - surfHitI, - hitSurfaceI, - existingSurfacePtLocations - ); + bool isNearSurfacePt = nearSurfacePoint(surfHitI); if (isNearFeaturePt || isNearSurfacePt) { keepSurfacePoint = false; - - // If the triggering Vertex is part of a feature point, allow it to - // conform to the surface. - // @todo Is this needed?! Shouldn't be any feature points here... - if (vit->index() < startOfInternalPoints_) - { - surfaceHits.append(surfHitI); - - hitSurfaces.append(hitSurfaceI); - } } List<List<pointIndexHit> > edHitsByFeature; @@ -2670,7 +1959,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits geometryToConformTo_.findAllNearestEdges ( - surfHitI.hitPoint(), + surfHitI.first().hitPoint(), searchRadiusSqr, edHitsByFeature, featuresHit @@ -2688,11 +1977,13 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits if (edHit.hit()) { - if (!nearFeaturePt(edHit.hitPoint())) + const Foam::point& edPt = edHit.hitPoint(); + + if (!nearFeaturePt(edPt)) { if ( - magSqr(edHit.hitPoint() - surfHitI.hitPoint()) + magSqr(edPt - surfHitI.first().hitPoint()) < surfacePtReplaceDistCoeffSqr*cellSizeSqr ) { @@ -2703,25 +1994,26 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits keepSurfacePoint = false; // NEED TO REMOVE FROM THE SURFACE TREE... - surfacePtLocationTreePtr_().remove - ( - existingSurfacePtLocations.size() - 1 - ); +// surfacePtLocationTreePtr_().remove +// ( +// existingSurfacePtLocations_.size() - 1 +// ); } if ( !nearFeatureEdgeLocation ( - edHit, - existingEdgeLocations + edHit ) ) { // Do not place edge control points too close to a // feature point or existing edge control points - featureEdgeHits.append(edHit); - featureEdgeFeaturesHit.append(featureHit); + featureEdgeHits.append + ( + pointIndexHitAndFeature(edHit, featureHit) + ); } } } @@ -2731,7 +2023,6 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits if (keepSurfacePoint) { surfaceHits.append(surfHitI); - hitSurfaces.append(hitSurfaceI); } } } @@ -2758,8 +2049,8 @@ void Foam::conformalVoronoiMesh::storeSurfaceConformation() if ( !vit->referred() - && vit->pairPoint() - && vit->index() >= startOfInternalPoints_ + && vit->boundaryPoint() + && !vit->featurePoint() ) { tempSurfaceVertices.append @@ -2767,8 +2058,7 @@ void Foam::conformalVoronoiMesh::storeSurfaceConformation() Vb ( vit->point(), - 0, // index, reset to zero - vit->type() - vit->index() // type, relative to index + vit->type() ) ); } @@ -2784,7 +2074,7 @@ void Foam::conformalVoronoiMesh::storeSurfaceConformation() label(surfaceConformationVertices_.size()), sumOp<label>() ) - << " vertices" << endl; + << " vertices" << nl << endl; } @@ -2792,35 +2082,24 @@ void Foam::conformalVoronoiMesh::reinsertSurfaceConformation() { Info<< nl << "Reinserting stored surface conformation" << endl; - label preReinsertionSize(number_of_vertices()); + const label preReinsertionSize(number_of_vertices()); // It is assumed that the stored surface conformation is on the correct // processor and does not need distributed - - for + rangeInsertWithInfo ( - List<Vb>::iterator vit=surfaceConformationVertices_.begin(); - vit != surfaceConformationVertices_.end(); - ++vit - ) - { - // Assuming that all of the reinsertions are pair points, and that the - // index and type are relative, i.e. index 0 and type relative to it. - insertPoint - ( - vit->point(), - vit->index() + number_of_vertices(), - vit->type() + number_of_vertices() - ); - } + surfaceConformationVertices_.begin(), + surfaceConformationVertices_.end(), + true + ); - Info<< " Reinserted " - << returnReduce - ( - label(number_of_vertices()) - preReinsertionSize, - sumOp<label>() - ) - << " vertices" << endl; + const label nInserted = label(number_of_vertices()) - preReinsertionSize; + const label nFailed = surfaceConformationVertices_.size() - nInserted; + + Info<< " " << returnReduce(nInserted, sumOp<label>()) + << " points reinserted, failed to insert " + << returnReduce(nFailed, sumOp<label>()) + << endl; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C index 2882be0c6ff55a98741a1b996b69c86caeeb7ffd..2f7579cbbff95339c341b32c9857ec82dcc100b0 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C @@ -48,39 +48,7 @@ Foam::conformalVoronoiMesh::calcPointFeatureEdgesTypes eS = feMesh.getEdgeStatus(edgeI); - switch (eS) - { - case extendedFeatureEdgeMesh::EXTERNAL: - { - pFEdgeTypes.nExternal++; - break; - } - case extendedFeatureEdgeMesh::INTERNAL: - { - pFEdgeTypes.nInternal++; - break; - } - case extendedFeatureEdgeMesh::FLAT: - { - pFEdgeTypes.nFlat++; - break; - } - case extendedFeatureEdgeMesh::OPEN: - { - pFEdgeTypes.nOpen++; - break; - } - case extendedFeatureEdgeMesh::MULTIPLE: - { - pFEdgeTypes.nMultiple++; - break; - } - case extendedFeatureEdgeMesh::NONE: - { - pFEdgeTypes.nNonFeature++; - break; - } - } + pFEdgeTypes(eS)++; } if (debug) @@ -99,15 +67,22 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint const pointFeatureEdgesTypes& pFEdgesTypes, const List<extendedFeatureEdgeMesh::edgeStatus>& allEdStat, const label ptI, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { if ( - pFEdgesTypes.nExternal == 2 - && pFEdgesTypes.nInternal == 1 + !pFEdgesTypes.found(extendedFeatureEdgeMesh::EXTERNAL) + || !pFEdgesTypes.found(extendedFeatureEdgeMesh::INTERNAL) + ) + { + return false; + } + + if + ( + pFEdgesTypes[extendedFeatureEdgeMesh::EXTERNAL] == 2 + && pFEdgesTypes[extendedFeatureEdgeMesh::INTERNAL] == 1 && pEds.size() == 3 ) { @@ -120,6 +95,8 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint return false; } + label nVert = number_of_vertices(); + const label initialNumOfPoints = pts.size(); const scalar ppDist = pointPairDistance(featPt); @@ -212,18 +189,20 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint - 2.0*planeA.distance(concaveEdgeExternalPt) *concaveEdgePlaneANormal; - pts.append(internalPtA); - indices.append(0); - types.append(4); + pts.append + ( + Vb(internalPtA, Vb::vtInternalFeaturePoint) + ); const Foam::point internalPtB = concaveEdgeExternalPt - 2.0*planeB.distance(concaveEdgeExternalPt) *concaveEdgePlaneBNormal; - pts.append(internalPtB); - indices.append(0); - types.append(3); + pts.append + ( + Vb(internalPtB, Vb::vtInternalFeaturePoint) + ); // Add the external points @@ -295,8 +274,7 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint for (label i = 0; i < 2; ++i) { pts.remove(); - indices.remove(); - types.remove(); + nVert--; } return false; @@ -325,9 +303,10 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint + 2.0*planeC.distance(internalPtA) *convexEdgePlaneCNormal; - pts.append(externalPtD); - indices.append(0); - types.append(-2); + pts.append + ( + Vb(externalPtD, Vb::vtExternalFeaturePoint) + ); } } } @@ -355,17 +334,19 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint + 2.0*planeD.distance(internalPtB) *convexEdgePlaneDNormal; - pts.append(externalPtE); - indices.append(0); - types.append(-2); + pts.append + ( + Vb(externalPtE, Vb::vtExternalFeaturePoint) + ); } } } } - pts.append(concaveEdgeExternalPt); - indices.append(0); - types.append(-4); + pts.append + ( + Vb(concaveEdgeExternalPt, Vb::vtExternalFeaturePoint) + ); const scalar totalAngle = radToDeg ( @@ -375,12 +356,13 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint if (totalAngle > cvMeshControls().maxQuadAngle()) { - // Add additional mitering points + // Add additional mitreing points //scalar angleSign = 1.0; vector convexEdgesPlaneNormal = 0.5*(convexEdgePlaneCNormal + convexEdgePlaneDNormal); + plane planeM(featPt, convexEdgesPlaneNormal); // if @@ -410,17 +392,19 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint //+ (2.0 + guard)*(concaveEdgeLocalFeatPt - concaveEdgeExternalPt); + 2.0*(concaveEdgeLocalFeatPt - concaveEdgeExternalPt); - pts.append(internalPtF); - indices.append(0); - types.append(1); + pts.append + ( + Vb(internalPtF, Vb::vtInternalFeaturePoint) + ); const Foam::point externalPtG = internalPtF + 2.0*planeM.distance(internalPtF)*convexEdgesPlaneNormal; - pts.append(externalPtG); - indices.append(0); - types.append(-1); + pts.append + ( + Vb(externalPtG, Vb::vtExternalFeaturePoint) + ); } if (debug) @@ -428,13 +412,17 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint for (label ptI = initialNumOfPoints; ptI < pts.size(); ++ptI) { Info<< "Point " << ptI << " : "; - meshTools::writeOBJ(Info, pts[ptI]); + meshTools::writeOBJ(Info, topoint(pts[ptI].point())); } } return true; } - else if (pFEdgesTypes.nExternal == 1 && pFEdgesTypes.nInternal == 2) + else if + ( + pFEdgesTypes[extendedFeatureEdgeMesh::EXTERNAL] == 1 + && pFEdgesTypes[extendedFeatureEdgeMesh::INTERNAL] == 2 + ) { // Info<< "nExternal == 1 && nInternal == 2" << endl; diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C index 407de61b3988746ec85d797ea8651d0fdb6e2b19..028dd5a0df09cf18f6e1a55b3fd3e6be08fbc1ad 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePoints.C @@ -25,40 +25,19 @@ License #include "conformalVoronoiMesh.H" #include "vectorTools.H" +#include "triangle.H" +#include "tetrahedron.H" +#include "const_circulator.H" using namespace Foam::vectorTools; // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -void Foam::conformalVoronoiMesh::insertBoundingPoints() -{ - pointField farPts(geometryToConformTo_.globalBounds().points()); - - // Shift corners of bounds relative to origin - farPts -= geometryToConformTo_.globalBounds().midpoint(); - - // Scale the box up - farPts *= 10.0; - - // Shift corners of bounds back to be relative to midpoint - farPts += geometryToConformTo_.globalBounds().midpoint(); - - limitBounds_ = treeBoundBox(farPts); - - forAll(farPts, fPI) - { - insertPoint(farPts[fPI], Vb::vtFar); - } -} - - void Foam::conformalVoronoiMesh::createEdgePointGroup ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { label edgeI = edHit.index(); @@ -69,27 +48,27 @@ void Foam::conformalVoronoiMesh::createEdgePointGroup { case extendedFeatureEdgeMesh::EXTERNAL: { - createExternalEdgePointGroup(feMesh, edHit, pts, indices, types); + createExternalEdgePointGroup(feMesh, edHit, pts); break; } case extendedFeatureEdgeMesh::INTERNAL: { - createInternalEdgePointGroup(feMesh, edHit, pts, indices, types); + createInternalEdgePointGroup(feMesh, edHit, pts); break; } case extendedFeatureEdgeMesh::FLAT: { - createFlatEdgePointGroup(feMesh, edHit, pts, indices, types); + createFlatEdgePointGroup(feMesh, edHit, pts); break; } case extendedFeatureEdgeMesh::OPEN: { - //createOpenEdgePointGroup(feMesh, edHit, pts, indices, types); + createOpenEdgePointGroup(feMesh, edHit, pts); break; } case extendedFeatureEdgeMesh::MULTIPLE: { - //createMultipleEdgePointGroup(feMesh, edHit, pts, indices, types); + createMultipleEdgePointGroup(feMesh, edHit, pts); break; } case extendedFeatureEdgeMesh::NONE: @@ -104,9 +83,7 @@ void Foam::conformalVoronoiMesh::createExternalEdgePointGroup ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { const Foam::point& edgePt = edHit.hitPoint(); @@ -158,22 +135,30 @@ void Foam::conformalVoronoiMesh::createExternalEdgePointGroup // Insert the master point pairing the the first slave - pts.append(refPt); - indices.append(0); - types.append(1); + if (!geometryToConformTo_.inside(refPt)) + { + return; + } + + pts.append + ( + Vb(refPt, Vb::vtInternalFeatureEdge) + ); // Insert the slave points by reflecting refPt in both faces. // with each slave refering to the master Foam::point reflectedA = refPt + 2*ppDist*nA; - pts.append(reflectedA); - indices.append(0); - types.append(-1); + pts.append + ( + Vb(reflectedA, Vb::vtExternalFeatureEdge) + ); Foam::point reflectedB = refPt + 2*ppDist*nB; - pts.append(reflectedB); - indices.append(0); - types.append(-2); + pts.append + ( + Vb(reflectedB, Vb::vtExternalFeatureEdge) + ); } @@ -181,9 +166,7 @@ void Foam::conformalVoronoiMesh::createInternalEdgePointGroup ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { const Foam::point& edgePt = edHit.hitPoint(); @@ -245,9 +228,6 @@ void Foam::conformalVoronoiMesh::createInternalEdgePointGroup // required number of quadrants. int nAddPoints = min(max(nQuads - 2, 0), 2); - // index of reflMaster - label reflectedMaster = 2 + nAddPoints; - // Add number_of_vertices() at insertion of first vertex to all numbers: // Result for nAddPoints 1 when the points are eventually inserted // pt index type @@ -270,41 +250,56 @@ void Foam::conformalVoronoiMesh::createInternalEdgePointGroup // reflectedBb 3 4 // reflMasterPt 4 0 + if + ( + !geometryToConformTo_.inside(reflectedA) + || !geometryToConformTo_.inside(reflectedB) + ) + { + return; + } + // Master A is inside. - pts.append(reflectedA); - indices.append(0); - types.append(reflectedMaster--); + pts.append + ( + Vb(reflectedA, Vb::vtInternalFeatureEdge) + ); // Master B is inside. - pts.append(reflectedB); - indices.append(0); - types.append(reflectedMaster--); + pts.append + ( + Vb(reflectedB, Vb::vtInternalFeatureEdge) + ); if (nAddPoints == 1) { // One additinal point is the reflection of the slave point, // i.e. the original reference point - pts.append(refPt); - indices.append(0); - types.append(reflectedMaster--); + pts.append + ( + Vb(refPt, Vb::vtInternalFeatureEdge) + ); } else if (nAddPoints == 2) { Foam::point reflectedAa = refPt + ppDist*nB; - pts.append(reflectedAa); - indices.append(0); - types.append(reflectedMaster--); + pts.append + ( + Vb(reflectedAa, Vb::vtInternalFeatureEdge) + ); Foam::point reflectedBb = refPt + ppDist*nA; - pts.append(reflectedBb); - indices.append(0); - types.append(reflectedMaster--); + pts.append + ( + Vb(reflectedBb, Vb::vtInternalFeatureEdge) + ); } // Slave is outside. - pts.append(reflMasterPt); - indices.append(0); - types.append(-(nAddPoints + 2)); + pts.append + ( + Vb(reflMasterPt, Vb::vtExternalFeatureEdge) + ); } @@ -312,9 +307,7 @@ void Foam::conformalVoronoiMesh::createFlatEdgePointGroup ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { const Foam::point& edgePt = edHit.hitPoint(); @@ -337,8 +330,8 @@ void Foam::conformalVoronoiMesh::createFlatEdgePointGroup // is a flat edge vector s = ppDist*(feMesh.edgeDirections()[edHit.index()] ^ n); - createPointPair(ppDist, edgePt + s, n, pts, indices, types); - createPointPair(ppDist, edgePt - s, n, pts, indices, types); + createPointPair(ppDist, edgePt + s, n, pts); + createPointPair(ppDist, edgePt - s, n, pts); } @@ -346,11 +339,33 @@ void Foam::conformalVoronoiMesh::createOpenEdgePointGroup ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { +// // Assume it is a baffle and insert flat edge point pairs +// const Foam::point& edgePt = edHit.hitPoint(); +// +// const scalar ppDist = pointPairDistance(edgePt); +// +// const vectorField& feNormals = feMesh.normals(); +// const labelList& edNormalIs = feMesh.edgeNormals()[edHit.index()]; +// +// // As this is a flat edge, there are two normals by definition +// const vector& nA = feNormals[edNormalIs[0]]; +// const vector& nB = feNormals[edNormalIs[1]]; +// +// // Average normal to remove any bias to one side, although as this +// // is a flat edge, the normals should be essentially the same +// const vector n = 0.5*(nA + nB); +// +// // Direction along the surface to the control point, sense of edge +// // direction not important, as +s and -s can be used because this +// // is a flat edge +// vector s = ppDist*(feMesh.edgeDirections()[edHit.index()] ^ n); +// +// createBafflePointPair(ppDist, edgePt + s, n, pts); +// createBafflePointPair(ppDist, edgePt - s, n, pts); + Info<< "NOT INSERTING OPEN EDGE POINT GROUP, NOT IMPLEMENTED" << endl; } @@ -359,279 +374,34 @@ void Foam::conformalVoronoiMesh::createMultipleEdgePointGroup ( const extendedFeatureEdgeMesh& feMesh, const pointIndexHit& edHit, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { Info<< "NOT INSERTING MULTIPLE EDGE POINT GROUP, NOT IMPLEMENTED" << endl; } -void Foam::conformalVoronoiMesh::reinsertBoundingPoints() -{ - tmp<pointField> farPts = limitBounds_.points(); - - forAll(farPts(), fPI) - { - insertPoint(farPts()[fPI], Vb::vtFar); - } -} - - void Foam::conformalVoronoiMesh::reinsertFeaturePoints(bool distribute) { Info<< nl << "Reinserting stored feature points" << endl; label preReinsertionSize(number_of_vertices()); - if (distribute) - { - DynamicList<Foam::point> pointsToInsert; - DynamicList<label> indices; - DynamicList<label> types; - - for - ( - List<Vb>::iterator vit=featureVertices_.begin(); - vit != featureVertices_.end(); - ++vit - ) - { - pointsToInsert.append(topoint(vit->point())); - indices.append(vit->index()); - types.append(vit->type()); - } - - // Insert distributed points - insertPoints(pointsToInsert, indices, types, true); - - // Save points in new distribution - featureVertices_.clear(); - featureVertices_.setSize(pointsToInsert.size()); - - forAll(pointsToInsert, pI) - { - featureVertices_[pI] = - Vb(toPoint(pointsToInsert[pI]), indices[pI], types[pI]); - } - } - else - { - for - ( - List<Vb>::iterator vit=featureVertices_.begin(); - vit != featureVertices_.end(); - ++vit - ) - { - // Assuming that all of the reinsertions are pair points, and that - // the index and type are relative, i.e. index 0 and type relative - // to it. - insertPoint - ( - vit->point(), - vit->index() + number_of_vertices(), - vit->type() + number_of_vertices() - ); - } - } - - Info<< " Reinserted " - << returnReduce - ( - label(number_of_vertices()) - preReinsertionSize, - sumOp<label>() - ) - << " vertices" << endl; -} - - -bool Foam::conformalVoronoiMesh::edgesShareNormal -( - const label e1, - const label e2 -) const -{ - const PtrList<extendedFeatureEdgeMesh>& feMeshes - ( - geometryToConformTo_.features() - ); - - forAll(feMeshes, i) - { - const extendedFeatureEdgeMesh& feMesh(feMeshes[i]); - - const vectorField& e1normals = feMesh.edgeNormals(e1); - const vectorField& e2normals = feMesh.edgeNormals(e2); - - forAll(e1normals, nI1) - { - forAll(e2normals, nI2) - { - if (degAngleBetween(e1normals[nI1], e2normals[nI2]) < 1) - { - return true; - } - } - } - } - - return false; -} - - -void Foam::conformalVoronoiMesh::createConvexFeaturePoints -( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types -) -{ - const PtrList<extendedFeatureEdgeMesh>& feMeshes - ( - geometryToConformTo_.features() - ); - - forAll(feMeshes, i) - { - const extendedFeatureEdgeMesh& feMesh(feMeshes[i]); - - for - ( - label ptI = feMesh.convexStart(); - ptI < feMesh.concaveStart(); - ptI++ - ) - { - const Foam::point& featPt = feMesh.points()[ptI]; - - if (!positionOnThisProc(featPt)) - { - continue; - } - - const vectorField& featPtNormals = feMesh.featurePointNormals(ptI); - - const scalar ppDist = - pointPairDistance(featPt); - - vector cornerNormal = sum(featPtNormals); - cornerNormal /= mag(cornerNormal); - - Foam::point internalPt = featPt + ppDist*cornerNormal; - - // Result when the points are eventually inserted (example n = 4) - // Add number_of_vertices() at insertion of first vertex to all - // numbers: - // pt index type - // internalPt 0 1 - // externalPt0 1 0 - // externalPt1 2 0 - // externalPt2 3 0 - // externalPt3 4 0 + insertPoints(featureVertices_, distribute); - pts.append(internalPt); - indices.append(0); - types.append(1); - - label internalPtIndex = -1; - - forAll(featPtNormals, nI) - { - const vector& n = featPtNormals[nI]; - - plane planeN = plane(featPt, n); - - Foam::point externalPt = - internalPt + 2.0 * planeN.distance(internalPt) * n; - - pts.append(externalPt); - indices.append(0); - types.append(internalPtIndex--); - } - } - } -} - - -void Foam::conformalVoronoiMesh::createConcaveFeaturePoints -( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types -) -{ - const PtrList<extendedFeatureEdgeMesh>& feMeshes + const label nReinserted = returnReduce ( - geometryToConformTo_.features() + label(number_of_vertices()) - preReinsertionSize, + sumOp<label>() ); - forAll(feMeshes, i) - { - const extendedFeatureEdgeMesh& feMesh(feMeshes[i]); - - for - ( - label ptI = feMesh.concaveStart(); - ptI < feMesh.mixedStart(); - ptI++ - ) - { - const Foam::point& featPt = feMesh.points()[ptI]; - - if (!positionOnThisProc(featPt)) - { - continue; - } - - const vectorField& featPtNormals = feMesh.featurePointNormals(ptI); - const scalar ppDist = pointPairDistance(featPt); - - vector cornerNormal = sum(featPtNormals); - cornerNormal /= mag(cornerNormal); - - Foam::point externalPt = featPt + ppDist*cornerNormal; - - label externalPtIndex = featPtNormals.size(); - - // Result when the points are eventually inserted (example n = 5) - // Add number_of_vertices() at insertion of first vertex to all - // numbers: - // pt index type - // internalPt0 0 5 - // internalPt1 1 5 - // internalPt2 2 5 - // internalPt3 3 5 - // internalPt4 4 5 - // externalPt 5 4 - - forAll(featPtNormals, nI) - { - const vector& n = featPtNormals[nI]; - - const plane planeN = plane(featPt, n); - - const Foam::point internalPt = - externalPt - 2.0 * planeN.distance(externalPt) * n; - - pts.append(internalPt); - indices.append(0); - types.append(externalPtIndex--); - } - - pts.append(externalPt); - indices.append(0); - types.append(-1); - } - } + Info<< " Reinserted " << nReinserted << " vertices" << endl; } void Foam::conformalVoronoiMesh::createMixedFeaturePoints ( - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { if (cvMeshControls().mixedFeaturePointPPDistanceCoeff() < 0) @@ -659,6 +429,13 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints ptI++ ) { + const Foam::point& featPt = points[ptI]; + + if (!positionOnThisProc(featPt)) + { + continue; + } + const labelList& pEds = pointsEdges[ptI]; pointFeatureEdgesTypes pFEdgeTypes(ptI); @@ -672,8 +449,7 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints { specialisedSuccess = createSpecialisedFeaturePoint ( - feMesh, pEds, pFEdgeTypes, allEdStat, ptI, - pts, indices, types + feMesh, pEds, pFEdgeTypes, allEdStat, ptI, pts ); } @@ -715,12 +491,9 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints continue; } - const Foam::point& pt = points[ptI]; +// createFeaturePoints(feMesh, ptI, pts, types); - if (!positionOnThisProc(pt)) - { - continue; - } + const Foam::point pt = points[ptI]; const scalar edgeGroupDistance = mixedFeaturePointDistance(pt); @@ -733,13 +506,13 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints const pointIndexHit edgeHit(true, edgePt, edgeI); - createEdgePointGroup(feMesh, edgeHit, pts, indices, types); + createEdgePointGroup(feMesh, edgeHit, pts); } } } } } - +// // //void Foam::conformalVoronoiMesh::createFeaturePoints //( @@ -787,7 +560,7 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints // surfaceConformationVertices_[indices[pI]]; // } // -// forAll() +// forAll(feMesh.) // // // Now find the nearest points within the edge cones. // @@ -803,22 +576,36 @@ void Foam::conformalVoronoiMesh::insertFeaturePoints() { Info<< nl << "Conforming to feature points" << endl; - DynamicList<Foam::point> pts; - DynamicList<label> indices; - DynamicList<label> types; + DynamicList<Vb> pts; const label preFeaturePointSize = number_of_vertices(); - createConvexFeaturePoints(pts, indices, types); + createFeaturePoints(pts); - createConcaveFeaturePoints(pts, indices, types); + createMixedFeaturePoints(pts); -// createFeaturePoints(pts, indices, types); + // Points added using the createEdgePointGroup function will be labelled as + // internal/external feature edges. Relabel them as feature points, + // otherwise they are inserted as both feature points and surface points. + forAll(pts, pI) + { + Vb& pt = pts[pI]; - createMixedFeaturePoints(pts, indices, types); + if (pt.featureEdgePoint()) + { + if (pt.internalBoundaryPoint()) + { + pt.type() = Vb::vtInternalFeaturePoint; + } + else if (pt.externalBoundaryPoint()) + { + pt.type() = Vb::vtExternalFeaturePoint; + } + } + } // Insert the created points, distributing to the appropriate processor - insertPoints(pts, indices, types, true); + insertPoints(pts, true); if (cvMeshControls().objOutput()) { @@ -843,7 +630,7 @@ void Foam::conformalVoronoiMesh::insertFeaturePoints() forAll(pts, pI) { - featureVertices_[pI] = Vb(toPoint(pts[pI]), indices[pI], types[pI]); + featureVertices_[pI] = pts[pI]; } constructFeaturePointLocations(); @@ -924,3 +711,525 @@ Foam::conformalVoronoiMesh::findSurfacePtLocationsNearFeaturePoint return dynPointList.shrink(); } + + +void Foam::conformalVoronoiMesh::addMasterAndSlavePoints +( + const DynamicList<Foam::point>& masterPoints, + const DynamicList<Foam::indexedVertexEnum::vertexType>& masterPointsTypes, + const Map<DynamicList<autoPtr<plane> > >& masterPointReflections, + DynamicList<Vb>& pts, + const label ptI +) const +{ + typedef DynamicList<autoPtr<plane> > planeDynList; + typedef Foam::indexedVertexEnum::vertexType vertexType; + + forAll(masterPoints, pI) + { + // Append master to the list of points + +// OFstream strMasters("fpm_" + name(ptI) + ".obj"); +// OFstream strSlaves("fps_" + name(ptI) + ".obj"); + + const Foam::point& masterPt = masterPoints[pI]; + const vertexType masterType = masterPointsTypes[pI]; + + pts.append + ( + Vb + ( + masterPt, + masterType + ) + ); + +// meshTools::writeOBJ(strMasters, masterPt); + + const planeDynList& masterPointPlanes = masterPointReflections[pI]; + + forAll(masterPointPlanes, planeI) + { + // Reflect master points in the planes and insert the slave points + + const plane& reflPlane = masterPointPlanes[planeI](); + + const Foam::point slavePt = + reflectPointInPlane(masterPt, reflPlane); + + const vertexType slaveType = + ( + masterType == Vb::vtInternalFeaturePoint + ? Vb::vtExternalFeaturePoint // true + : Vb::vtInternalFeaturePoint // false + ); + + pts.append + ( + Vb + ( + slavePt, + slaveType + ) + ); + +// meshTools::writeOBJ(strSlaves, slavePt); + } + } +} + + +Foam::label Foam::conformalVoronoiMesh::getSign +( + const extendedFeatureEdgeMesh::edgeStatus eStatus +) const +{ + if (eStatus == extendedFeatureEdgeMesh::EXTERNAL) + { + return -1; + } + else if (eStatus == extendedFeatureEdgeMesh::INTERNAL) + { + return 1; + } + + return 0; +} + + +void Foam::conformalVoronoiMesh::createMasterAndSlavePoints +( + const extendedFeatureEdgeMesh& feMesh, + const label ptI, + DynamicList<Vb>& pts +) const +{ + typedef DynamicList<autoPtr<plane> > planeDynList; + typedef Foam::indexedVertexEnum::vertexType vertexType; + typedef Foam::extendedFeatureEdgeMesh::edgeStatus edgeStatus; + + const Foam::point& featPt = feMesh.points()[ptI]; + + if (!positionOnThisProc(featPt)) + { + return; + } + + const scalar ppDist = pointPairDistance(featPt); + + // Maintain a list of master points and the planes to relect them in + DynamicList<Foam::point> masterPoints; + DynamicList<vertexType> masterPointsTypes; + Map<planeDynList> masterPointReflections; + + const labelList& featPtEdges = feMesh.featurePointEdges()[ptI]; + + const_circulator<labelList> circ(featPtEdges); + +// Info<< "Point = " << ptI << endl; + + // Loop around the edges of the feature point + if (circ.size()) do + { +// const edgeStatus eStatusPrev = feMesh.getEdgeStatus(circ.prev()); + const edgeStatus eStatusCurr = feMesh.getEdgeStatus(circ()); +// const edgeStatus eStatusNext = feMesh.getEdgeStatus(circ.next()); + +// Info<< "Prev = " +// << extendedFeatureEdgeMesh::edgeStatusNames_[eStatusPrev] +// << " Curr = " +// << extendedFeatureEdgeMesh::edgeStatusNames_[eStatusCurr] +//// << " Next = " +//// << extendedFeatureEdgeMesh::edgeStatusNames_[eStatusNext] +// << endl; + + // Get the direction in which to move the point in relation to the + // feature point + label sign = getSign(eStatusCurr); + + const vector n = sharedFaceNormal(feMesh, circ(), circ.next()); + + const vector pointMotionDirection = sign*0.5*ppDist*n; + + if (masterPoints.empty()) + { + // Initialise with the first master point + + Foam::point pt = featPt + pointMotionDirection; + + planeDynList firstPlane; + firstPlane.append(autoPtr<plane>(new plane(featPt, n))); + + masterPoints.append(pt); + + masterPointsTypes.append + ( + sign == 1 + ? Vb::vtExternalFeaturePoint // true + : Vb::vtInternalFeaturePoint // false + ); + + if + ( + masterPointsTypes.last() == Vb::vtInternalFeaturePoint + && !geometryToConformTo_.inside(masterPoints.last()) + ) + { + return; + } + + const Foam::point reflectedPoint = reflectPointInPlane + ( + masterPoints.last(), + firstPlane.last()() + ); + + if + ( + masterPointsTypes.last() == Vb::vtExternalFeaturePoint + && !geometryToConformTo_.inside(reflectedPoint) + ) + { + return; + } + + masterPointReflections.insert + ( + masterPoints.size() - 1, + firstPlane + ); + } +// else if +// ( +// eStatusPrev == extendedFeatureEdgeMesh::INTERNAL +// && eStatusCurr == extendedFeatureEdgeMesh::EXTERNAL +// ) +// { +// // Insert a new master point. +// Foam::point pt = featPt + pointMotionDirection; +// +// planeDynList firstPlane; +// firstPlane.append(autoPtr<plane>(new plane(featPt, n))); +// +// masterPoints.append(pt); +// +// masterPointsTypes.append +// ( +// sign == 1 +// ? Vb::vtExternalFeaturePoint // true +// : Vb::vtInternalFeaturePoint // false +// ); +// +// masterPointReflections.insert +// ( +// masterPoints.size() - 1, +// firstPlane +// ); +// } +// else if +// ( +// eStatusPrev == extendedFeatureEdgeMesh::EXTERNAL +// && eStatusCurr == extendedFeatureEdgeMesh::INTERNAL +// ) +// { +// +// } + else + { + // Just add this face contribution to the latest master point + + masterPoints.last() += pointMotionDirection; + + masterPointReflections[masterPoints.size() - 1].append + ( + autoPtr<plane>(new plane(featPt, n)) + ); + } + + } while (circ.circulate(CirculatorBase::CLOCKWISE)); + + addMasterAndSlavePoints + ( + masterPoints, + masterPointsTypes, + masterPointReflections, + pts, + ptI + ); +} + + +void Foam::conformalVoronoiMesh::createFeaturePoints(DynamicList<Vb>& pts) +{ + const PtrList<extendedFeatureEdgeMesh>& feMeshes + ( + geometryToConformTo_.features() + ); + + forAll(feMeshes, i) + { + Info<< indent << "Edge mesh = " << feMeshes[i].name() << nl << endl; + + const extendedFeatureEdgeMesh& feMesh(feMeshes[i]); + + for + ( + label ptI = feMesh.convexStart(); + ptI < feMesh.mixedStart(); + ptI++ + ) + { + createMasterAndSlavePoints(feMesh, ptI, pts); + } + } +} + + +//Foam::scalar Foam::conformalVoronoiMesh::pyramidVolume +//( +// const Foam::point& apex, +// const Foam::point& a, +// const Foam::point& b, +// const Foam::point& c, +// const bool printInfo +//) const +//{ +// triPointRef tri(a, b, c); +// +// tetPointRef tet(tri.a(), tri.b(), tri.c(), apex); +// +// scalar volume = tet.mag(); +// +//// scalar volume = (1.0/3.0)*constant::mathematical::pi; +//// +//// K::Circle_3 circle(toPoint(a), toPoint(b), toPoint(c)); +//// +//// scalar height = mag(topoint(circle.center()) - apex); +//// +//// volume *= circle.squared_radius()*height; +// +// if (printInfo) +// { +// Info<< "Calculating volume of pyramid..." << nl +// << " Apex : " << apex << nl +// << " Point a : " << a << nl +// << " Point b : " << b << nl +// << " Point c : " << c << nl +// << " Center : " << tri.centre() << nl +// << " Volume : " << volume << endl; +// } +// +// return volume; +//} + + +//void Foam::conformalVoronoiMesh::createPyramidMasterPoint +//( +// const Foam::point& apex, +// const vectorField& edgeDirections, +// Foam::point& masterPoint, +// vectorField& norms +//) const +//{ +// pointField basePoints(edgeDirections.size() + 1); +// +// forAll(edgeDirections, eI) +// { +// basePoints[eI] = edgeDirections[eI] + apex; +// } +// +// basePoints[edgeDirections.size() + 1] = apex; +// +// face f(identity(edgeDirections.size())); +// +// pyramidPointFaceRef p(f, apex); +// +// const scalar ppDist = pointPairDistance(apex); +// +// +// vector unitDir = f.centre(); +// unitDir /= mag(unitDir); +// +// masterPoint = apex + ppDist*unitDir; +// +// norms.setSize(edgeDirections.size()); +// +// forAll(norms, nI) +// { +// norms[nI] = +// } +//} + + +//void Foam::conformalVoronoiMesh::createConvexConcaveFeaturePoints +//( +// DynamicList<Foam::point>& pts, +// DynamicList<label>& indices, +// DynamicList<label>& types +//) +//{ +// const PtrList<extendedFeatureEdgeMesh>& feMeshes +// ( +// geometryToConformTo_.features() +// ); +// +// forAll(feMeshes, i) +// { +// const extendedFeatureEdgeMesh& feMesh(feMeshes[i]); +// +// for +// ( +// label ptI = feMesh.convexStart(); +// ptI < feMesh.mixedStart(); +// ptI++ +// ) +// { +// const Foam::point& apex = feMesh.points()[ptI]; +// +// if (!positionOnThisProc(apex)) +// { +// continue; +// } +// +// const vectorField& featPtEdgeDirections +// = feMesh.featurePointEdgeDirections(ptI); +// +// Foam::point masterPoint; +// vectorField tetNorms; +// +// createPyramidMasterPoint +// ( +// apex, +// featPtEdgeDirections, +// masterPoint, +// tetNorms +// ); +// +// +// +// // Result when the points are eventually inserted (example n = 4) +// // Add number_of_vertices() at insertion of first vertex to all +// // numbers: +// // pt index type +// // internalPt 0 1 +// // externalPt0 1 0 +// // externalPt1 2 0 +// // externalPt2 3 0 +// // externalPt3 4 0 +// +// // Result when the points are eventually inserted (example n = 5) +// // Add number_of_vertices() at insertion of first vertex to all +// // numbers: +// // pt index type +// // internalPt0 0 5 +// // internalPt1 1 5 +// // internalPt2 2 5 +// // internalPt3 3 5 +// // internalPt4 4 5 +// // externalPt 5 4 +// +// if (geometryToConformTo_.inside(masterPoint)) +// { +// +// } +// else +// { +// +// } +// +// pts.append(masterPoint); +// indices.append(0); +// types.append(1); +// +// label internalPtIndex = -1; +// +// forAll(tetNorms, nI) +// { +// const vector& n = tetNorms[nI]; +// +// Foam::point reflectedPoint +// = reflectPoint(featPt, masterPoint, n); +// +// pts.append(reflectedPoint); +// indices.append(0); +// types.append(internalPtIndex--); +// } +// } +// } +//} + + +Foam::vector Foam::conformalVoronoiMesh::sharedFaceNormal +( + const extendedFeatureEdgeMesh& feMesh, + const label edgeI, + const label nextEdgeI +) const +{ + const labelList& edgeInormals = feMesh.edgeNormals()[edgeI]; + const labelList& nextEdgeInormals = feMesh.edgeNormals()[nextEdgeI]; + + const vector& A1 = feMesh.normals()[edgeInormals[0]]; + const vector& A2 = feMesh.normals()[edgeInormals[1]]; + + const vector& B1 = feMesh.normals()[nextEdgeInormals[0]]; + const vector& B2 = feMesh.normals()[nextEdgeInormals[1]]; + + const scalar A1B1 = mag(A1 ^ B1); + const scalar A1B2 = mag(A1 ^ B2); + const scalar A2B1 = mag(A2 ^ B1); + const scalar A2B2 = mag(A2 ^ B2); + + if (A1B1 < A1B2 && A1B1 < A2B1 && A1B1 < A2B2) + { + return 0.5*(A1 + B1); + } + else if (A1B2 < A1B1 && A1B2 < A2B1 && A1B2 < A2B2) + { + return 0.5*(A1 + B2); + } + else if (A2B1 < A1B1 && A2B1 < A1B2 && A2B1 < A2B2) + { + return 0.5*(A2 + B1); + } + else + { + return 0.5*(A2 + B2); + } +} + + +Foam::List<Foam::point> Foam::conformalVoronoiMesh::reflectPointInPlanes +( + const Foam::point p, + const DynamicList<autoPtr<plane> >& planes +) const +{ + List<Foam::point> reflectedPoints(planes.size()); + + forAll(planes, planeI) + { + reflectedPoints[planeI] = reflectPointInPlane(p, planes[planeI]()); + } + + return reflectedPoints; +} + + +Foam::point Foam::conformalVoronoiMesh::reflectPointInPlane +( + const Foam::point p, + const plane& planeN +) const +{ + const vector reflectedPtDir = p - planeN.nearestPoint(p); + + if ((planeN.normal() & reflectedPtDir) > 0) + { + return p - 2.0*planeN.distance(p)*planeN.normal(); + } + else + { + return p + 2.0*planeN.distance(p)*planeN.normal(); + } +} diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H index 43d8c077fc785724ad83b37ac8e48a7a76f77ba9..7d664407dcb357815ebba50111fe17677e374573 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H @@ -21,21 +21,28 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +inline Foam::scalar Foam::conformalVoronoiMesh::defaultCellSize() const +{ + return readScalar + ( + cvMeshControls().cvMeshDict().subDict("motionControl").lookup + ( + "defaultCellSize" + ) + ); +} + + inline Foam::scalar Foam::conformalVoronoiMesh::targetCellSize ( const Foam::point& pt ) const { - return cellSizeControl().cellSize(pt); + return cellShapeControls().cellSize(pt); } @@ -66,8 +73,8 @@ inline Foam::scalar Foam::conformalVoronoiMesh::averageAnyCellSize { if ( - !vA->internalOrBoundaryPoint() - && !vB->internalOrBoundaryPoint() + (!vA->internalOrBoundaryPoint() || vA->referred()) + && (!vB->internalOrBoundaryPoint() || vB->referred()) ) { // There are no internalOrBoundaryPoints available, determine @@ -80,11 +87,11 @@ inline Foam::scalar Foam::conformalVoronoiMesh::averageAnyCellSize *targetCellSize(topoint(vB->point())) ); } - else if (!vB->internalOrBoundaryPoint()) + else if (!vB->internalOrBoundaryPoint() || vB->referred()) { return vA->targetCellSize(); } - else if (!vA->internalOrBoundaryPoint()) + else if (!vA->internalOrBoundaryPoint() || vA->referred()) { return vB->targetCellSize(); } @@ -98,9 +105,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::averageAnyCellSize const Delaunay::Finite_facets_iterator& fit ) const { - // Geometric mean + // Arithmetic mean + + scalar sizeSum = 0; - scalar sizeProduct = 1; label nProducts = 0; const Cell_handle c(fit->first); @@ -110,10 +118,10 @@ inline Foam::scalar Foam::conformalVoronoiMesh::averageAnyCellSize { Vertex_handle v = c->vertex(vertex_triple_index(oppositeVertex, i)); - if (v->internalOrBoundaryPoint()) + if (v->internalOrBoundaryPoint() && !v->referred()) { - sizeProduct *= v->targetCellSize(); + sizeSum += v->targetCellSize(); nProducts++; } @@ -128,13 +136,22 @@ inline Foam::scalar Foam::conformalVoronoiMesh::averageAnyCellSize { Vertex_handle v = c->vertex(vertex_triple_index(oppositeVertex, i)); - sizeProduct *= targetCellSize(topoint(v->point())); + sizeSum += targetCellSize(topoint(v->point())); } nProducts = 3; } - return pow(sizeProduct, (1.0/nProducts)); + if (sizeSum < 0) + { + WarningIn("averageAnyCellSize(const Delaunay::Finite_facets_iterator&)") + << "sizeSum = " << sizeSum + << endl; + + return 0; + } + + return pow(sizeSum, (1.0/nProducts)); } @@ -219,125 +236,155 @@ inline Foam::scalar Foam::conformalVoronoiMesh::maxSurfaceProtrusion } -inline Foam::label Foam::conformalVoronoiMesh::insertPoint +inline bool Foam::conformalVoronoiMesh::insertPoint ( const Foam::point& p, - const label type + const indexedVertexEnum::vertexType type ) { - return insertPoint(toPoint(p), type); + return insertPoint(toPoint<Point>(p), type); } -inline Foam::label Foam::conformalVoronoiMesh::insertPoint +inline bool Foam::conformalVoronoiMesh::insertPoint ( const Point& P, - const label type + const indexedVertexEnum::vertexType type ) { uint nVert = number_of_vertices(); Vertex_handle vh = insert(P); + bool pointInserted = true; + if (nVert == number_of_vertices()) { - Pout << "Failed to insert point " << topoint(P) << endl; + Pout<< "Failed to insert point : " << topoint(P) + << " of type " << type << endl; + pointInserted = false; } else { - vh->index() = nVert; + vh->index() = getNewVertexIndex(); vh->type() = type; } - return vh->index(); + return pointInserted; } -inline void Foam::conformalVoronoiMesh::insertPoint +inline bool Foam::conformalVoronoiMesh::insertReferredPoint(const Vb& P) +{ + return insertReferredPoint(P.point(), P.index(), P.type(), P.procIndex()); +} + + +inline bool Foam::conformalVoronoiMesh::insertReferredPoint ( const Foam::point& p, const label index, - const label type + const indexedVertexEnum::vertexType type, + const label processor ) { - insertPoint(toPoint(p), index, type); + return insertReferredPoint(toPoint<Point>(p), index, type, processor); } -inline void Foam::conformalVoronoiMesh::insertPoint +inline bool Foam::conformalVoronoiMesh::insertReferredPoint ( const Point& P, const label index, - const label type + const indexedVertexEnum::vertexType type, + const label processor ) { uint nVert = number_of_vertices(); Vertex_handle vh = insert(P); + bool pointInserted = true; + if (nVert == number_of_vertices()) { - Pout << "Failed to insert point " << topoint(P) << endl; + Pout<< "Failed to insert point " << topoint(P) + << " type: " << type << " index: " << index + << " proc: " << processor << endl; + pointInserted = false; } else { vh->index() = index; vh->type() = type; + vh->procIndex() = processor; } + + return pointInserted; } -inline void Foam::conformalVoronoiMesh::insertPointPair +inline void Foam::conformalVoronoiMesh::createPointPair ( const scalar ppDist, const Foam::point& surfPt, - const vector& n + const vector& n, + DynamicList<Vb>& pts ) { - Pout<< "insertPointPair is depricated, " - << " it does not check parallel insertion." << endl; - vector ppDistn = ppDist*n; - label master = insertPoint + pts.append ( - surfPt - ppDistn, - number_of_vertices() + 1 + Vb(surfPt - ppDistn, Vb::vtInternalSurface) ); - insertPoint(surfPt + ppDistn, master); + pts.append + ( + Vb(surfPt + ppDistn, Vb::vtExternalSurface) + ); } -inline void Foam::conformalVoronoiMesh::createPointPair +inline Foam::point Foam::conformalVoronoiMesh::perturbPoint +( + const Foam::point& pt +) const +{ + Foam::point perturbedPt(pt); + +// vector delta(xR/ni, yR/nj, zR/nk); +// scalar pert = randomPerturbationCoeff*cmptMin(delta); + + scalar pert = 1e-12*defaultCellSize(); + + perturbedPt.x() += pert*(rndGen_.scalar01() - 0.5); + perturbedPt.y() += pert*(rndGen_.scalar01() - 0.5); + perturbedPt.z() += pert*(rndGen_.scalar01() - 0.5); + + return perturbedPt; +} + + +inline void Foam::conformalVoronoiMesh::createBafflePointPair ( const scalar ppDist, const Foam::point& surfPt, const vector& n, - DynamicList<Foam::point>& pts, - DynamicList<label>& indices, - DynamicList<label>& types + DynamicList<Vb>& pts ) { vector ppDistn = ppDist*n; - // Result when the points are eventually inserted. - // Add number_of_vertices() at insertion of first vertex to all numbers: - // pt index type - // surfPt - ppDistn 0 1 - // surfPt + ppDistn 1 0 - - // Master, index = number_of_vertices(), type = number_of_vertices() + 1 - pts.append(surfPt - ppDistn); - indices.append(0); - types.append(1); + pts.append + ( + Vb(surfPt - ppDistn, Vb::vtInternalSurface) + ); - // Slave, index = number_of_vertices()(new) + 1, type = index of master. - // This will be inserted after the master, so number_of_vertices() will - // have increased - pts.append(surfPt + ppDistn); - indices.append(0); - types.append(-1); + pts.append + ( + Vb(surfPt + ppDistn, Vb::vtInternalSurface) + ); } @@ -350,13 +397,30 @@ inline bool Foam::conformalVoronoiMesh::isBoundaryDualFace Vertex_handle vA = c->vertex(eit->second); Vertex_handle vB = c->vertex(eit->third); +// if (vA->internalBoundaryPoint() && vB->externalBoundaryPoint()) +// { +// if (vA->index() == vB->index() - 1) +// { +// return true; +// } +// } +// else if (vA->externalBoundaryPoint() && vB->internalBoundaryPoint()) +// { +// if (vA->index() == vB->index() + 1) +// { +// return true; +// } +// } +// +// return false; + // A dual face on the boundary will result from one Dv inside and // one outside return ( ( - vA->internalOrBoundaryPoint() - || vB->internalOrBoundaryPoint() + (vA->internalOrBoundaryPoint() && !vA->referred()) + || (vB->internalOrBoundaryPoint() && !vB->referred()) ) && ( !vA->internalOrBoundaryPoint() @@ -458,58 +522,35 @@ inline bool Foam::conformalVoronoiMesh::isParallelDualEdge } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -#ifdef CGAL_INEXACT - -inline Foam::conformalVoronoiMesh::pointFromPoint -Foam::conformalVoronoiMesh::topoint +inline bool Foam::conformalVoronoiMesh::isProcBoundaryEdge ( - const Point& P -) const -{ - return reinterpret_cast<pointFromPoint>(P); -} - - -inline Foam::conformalVoronoiMesh::PointFrompoint -Foam::conformalVoronoiMesh::toPoint -( - const Foam::point& p + const Delaunay::Finite_edges_iterator& eit ) const { - return reinterpret_cast<PointFrompoint>(p); -} - -#else + bool isProcBoundaryEdge = false; + Cell_handle c = eit->first; + Vertex_handle vA = c->vertex(eit->second); + Vertex_handle vB = c->vertex(eit->third); -inline Foam::conformalVoronoiMesh::pointFromPoint -Foam::conformalVoronoiMesh::topoint -( - const Point& P -) const -{ - return Foam::point + if ( - CGAL::to_double(P.x()), - CGAL::to_double(P.y()), - CGAL::to_double(P.z()) - ); -} - + ( + (vA->referred() && !vB->referred()) + || (vB->referred() && !vA->referred()) + ) + && vA->internalOrBoundaryPoint() + && vB->internalOrBoundaryPoint() + ) + { + isProcBoundaryEdge = true; + } -inline Foam::conformalVoronoiMesh::PointFrompoint -Foam::conformalVoronoiMesh::toPoint -( - const Foam::point& p -) const -{ - return Point(p.x(), p.y(), p.z()); + return isProcBoundaryEdge; } -#endif +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // inline Foam::conformalVoronoiMesh::CGALVector Foam::conformalVoronoiMesh::toCGALVector(const Foam::vector& v) const @@ -562,10 +603,10 @@ Foam::conformalVoronoiMesh::decomposition() const } -inline const Foam::cellSizeControlSurfaces& -Foam::conformalVoronoiMesh::cellSizeControl() const +inline const Foam::cellShapeControl& +Foam::conformalVoronoiMesh::cellShapeControls() const { - return cellSizeControl_; + return cellShapeControl_; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 68f98e8a9d3e01cf1238bd3817f403b6109fbe84..e35a711148f3a0bda8ffb65c9714444704ef902e 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -28,6 +28,11 @@ License #include "OFstream.H" #include "pointMesh.H" #include "pointFields.H" +#include "ListOps.H" +#include "polyMeshFilter.H" +#include "polyTopoChange.H" +#include "PrintTable.H" +#include "pointMesh.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -57,61 +62,185 @@ void Foam::conformalVoronoiMesh::timeCheck if (m.valid()) { - label mSize = m.size(); - label mPeak = m.peak(); - label mRss = m.rss(); + PrintTable<word, label> memoryTable("Memory Usage (kB)"); + + memoryTable.add("mSize", m.size()); + memoryTable.add("mPeak", m.peak()); + memoryTable.add("mRss", m.rss()); + + Info<< incrIndent; + memoryTable.print(Info); + Info<< decrIndent; + } + } +} - if (Pstream::parRun()) + +void Foam::conformalVoronoiMesh::printVertexInfo() const +{ + label nInternal = 0; + label nInternalRef = 0; + label nUnassigned = 0; + label nUnassignedRef = 0; + label nInternalNearBoundary = 0; + label nInternalNearBoundaryRef = 0; + label nInternalSurface = 0; + label nInternalSurfaceRef = 0; + label nInternalFeatureEdge = 0; + label nInternalFeatureEdgeRef = 0; + label nInternalFeaturePoint = 0; + label nInternalFeaturePointRef = 0; + label nExternalSurface = 0; + label nExternalSurfaceRef = 0; + label nExternalFeatureEdge = 0; + label nExternalFeatureEdgeRef = 0; + label nExternalFeaturePoint = 0; + label nExternalFeaturePointRef = 0; + label nFar = 0; + label nReferred = 0; + + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + ++vit + ) + { + if (vit->type() == Vb::vtInternal) + { + if (vit->referred()) { - labelList allMSize(Pstream::nProcs()); - labelList allMPeak(Pstream::nProcs()); - labelList allMRss(Pstream::nProcs()); - - allMSize[Pstream::myProcNo()] = mSize; - allMPeak[Pstream::myProcNo()] = mPeak; - allMRss[Pstream::myProcNo()] = mRss; - - Pstream::gatherList(allMSize); - Pstream::gatherList(allMPeak); - Pstream::gatherList(allMRss); - - Info<< "--- [ " - << "mem (kB) " << tab - << "size" << tab - << "peak" << tab - << "rss" - << " ] --- " << endl; - - forAll(allMSize, procI) - { - Info<< "--- [ " - << procI << " " << tab - << allMSize[procI] << tab - << allMPeak[procI] << tab - << allMRss[procI] - << " ] --- " << endl; - } + nReferred++; + nInternalRef++; + } + + nInternal++; + } + else if (vit->type() == Vb::vtUnassigned) + { + if (vit->referred()) + { + nReferred++; + nUnassignedRef++; + } + + nUnassigned++; + } + else if (vit->type() == Vb::vtInternalNearBoundary) + { + if (vit->referred()) + { + nReferred++; + nInternalNearBoundaryRef++; + } + + nInternalNearBoundary++; + } + else if (vit->type() == Vb::vtInternalSurface) + { + if (vit->referred()) + { + nReferred++; + nInternalSurfaceRef++; + } + + nInternalSurface++; + } + else if (vit->type() == Vb::vtInternalFeatureEdge) + { + if (vit->referred()) + { + nReferred++; + nInternalFeatureEdgeRef++; + } + + nInternalFeatureEdge++; + } + else if (vit->type() == Vb::vtInternalFeaturePoint) + { + if (vit->referred()) + { + nReferred++; + nInternalFeaturePointRef++; + } - Info<< "--- [ " - << "sum " << tab - << sum(allMSize) << tab - << sum(allMPeak) << tab - << sum(allMRss) - << " ] --- " << endl; + nInternalFeaturePoint++; + } + else if (vit->type() == Vb::vtExternalSurface) + { + if (vit->referred()) + { + nReferred++; + nExternalSurfaceRef++; + } + nExternalSurface++; + } + else if (vit->type() == Vb::vtExternalFeatureEdge) + { + if (vit->referred()) + { + nReferred++; + nExternalFeatureEdgeRef++; } - else + + nExternalFeatureEdge++; + } + else if (vit->type() == Vb::vtExternalFeaturePoint) + { + if (vit->referred()) { - Info<< "--- [ " - << "mem size " << mSize << " kB, " - << "mem peak " << mPeak << " kB, " - << "mem rss " << mRss << " kB" - << " ] --- " << endl; + nReferred++; + nExternalFeaturePointRef++; } + + nExternalFeaturePoint++; + } + else if (vit->type() == Vb::vtFar) + { + nFar++; } } + + label nTotalVertices + = nUnassigned + + nInternal + + nInternalNearBoundary + + nInternalSurface + + nInternalFeatureEdge + + nInternalFeaturePoint + + nExternalSurface + + nExternalFeatureEdge + + nExternalFeaturePoint + + nFar; + + if (nTotalVertices != label(number_of_vertices())) + { + WarningIn("Foam::conformalVoronoiMesh::printVertexInfo()") + << nTotalVertices << " does not equal " << number_of_vertices() + << endl; + } + + PrintTable<word, label> vertexTable("Vertex Type Information"); + + vertexTable.add("Total", nTotalVertices); + vertexTable.add("Unassigned", nUnassigned); + vertexTable.add("nInternal", nInternal); + vertexTable.add("nInternalNearBoundary", nInternalNearBoundary); + vertexTable.add("nInternalSurface", nInternalSurface); + vertexTable.add("nInternalFeatureEdge", nInternalFeatureEdge); + vertexTable.add("nInternalFeaturePoint", nInternalFeaturePoint); + vertexTable.add("nExternalSurface", nExternalSurface); + vertexTable.add("nExternalFeatureEdge", nExternalFeatureEdge); + vertexTable.add("nExternalFeaturePoint", nExternalFeaturePoint); + vertexTable.add("nFar", nFar); + vertexTable.add("nReferred", nReferred); + + Info<< endl; + vertexTable.print(Info); } + void Foam::conformalVoronoiMesh::drawDelaunayCell ( Ostream& os, @@ -120,7 +249,7 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell ) const { // Supply offset as tet number - offset *= 5; + offset *= 4; os << "# cell index: " << label(c->cellIndex()) << endl; @@ -130,9 +259,10 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell for (int i = 0; i < 4; i++) { - os << "# index type: " + os << "# index / type / procIndex: " << label(c->vertex(i)->index()) << " " - << label(c->vertex(i)->type()) << endl; + << label(c->vertex(i)->type()) << " " + << label(c->vertex(i)->procIndex()) << endl; meshTools::writeOBJ(os, topoint(c->vertex(i)->point())); } @@ -142,23 +272,39 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell << "f " << 1 + offset << " " << 4 + offset << " " << 3 + offset << nl << "f " << 1 + offset << " " << 2 + offset << " " << 4 + offset << endl; - os << "# cicumcentre " << endl; +// os << "# cicumcentre " << endl; - meshTools::writeOBJ(os, c->dual()); +// meshTools::writeOBJ(os, c->dual()); - os << "l " << 1 + offset << " " << 5 + offset << endl; +// os << "l " << 1 + offset << " " << 5 + offset << endl; } void Foam::conformalVoronoiMesh::writePoints ( const fileName& fName, - bool internalOnly + const Foam::indexedVertexEnum::vertexType startPointType, + const Foam::indexedVertexEnum::vertexType endPointType ) const { OFstream str(runTime_.path()/fName); - Pout<< nl << "Writing points to " << str.name() << endl; + Pout<< nl << "Writing points of types:" << nl; + + forAllConstIter + ( + HashTable<int>, + Foam::indexedVertexEnum::vertexTypeNames_, + iter + ) + { + if (iter() >= startPointType && iter() <= endPointType) + { + Pout<< " " << iter.key() << nl; + } + } + + Pout<< "to " << str.name() << endl; for ( @@ -167,7 +313,7 @@ void Foam::conformalVoronoiMesh::writePoints ++vit ) { - if (!internalOnly || vit->internalPoint()) + if (vit->type() >= startPointType && vit->type() <= endPointType) { meshTools::writeOBJ(str, topoint(vit->point())); } @@ -175,6 +321,16 @@ void Foam::conformalVoronoiMesh::writePoints } +void Foam::conformalVoronoiMesh::writePoints +( + const fileName& fName, + const Foam::indexedVertexEnum::vertexType pointType +) const +{ + writePoints(fName, pointType, pointType); +} + + void Foam::conformalVoronoiMesh::writeBoundaryPoints ( const fileName& fName @@ -220,6 +376,27 @@ void Foam::conformalVoronoiMesh::writePoints } +void Foam::conformalVoronoiMesh::writePoints +( + const fileName& fName, + const List<Vb>& points +) const +{ + if (points.size()) + { + OFstream str(runTime_.path()/fName); + + Pout<< nl << "Writing " << points.size() << " points from pointList to " + << str.name() << endl; + + forAll(points, p) + { + meshTools::writeOBJ(str, topoint(points[p].point())); + } + } +} + + void Foam::conformalVoronoiMesh::writeProcessorInterface ( const fileName& fName, @@ -228,9 +405,7 @@ void Foam::conformalVoronoiMesh::writeProcessorInterface { OFstream str(runTime_.path()/fName); - Pout<< "Writing processor interface" << endl; - - pointField points(number_of_cells(), point::max); + pointField points(number_of_finite_cells(), point::max); for ( @@ -239,15 +414,13 @@ void Foam::conformalVoronoiMesh::writeProcessorInterface ++cit ) { - if (!cit->farCell()) + if (!cit->hasFarPoint() && !is_infinite(cit)) { points[cit->cellIndex()] = cit->dual(); } } meshTools::writeOBJ(str, faces, points); - - Pout<< "Written processor interface" << endl; } @@ -297,11 +470,7 @@ void Foam::conformalVoronoiMesh::writeInternalDelaunayVertices } -void Foam::conformalVoronoiMesh::writeMesh -( - const fileName& instance, - bool filterFaces -) +void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance) { writeInternalDelaunayVertices(instance); @@ -314,6 +483,7 @@ void Foam::conformalVoronoiMesh::writeMesh { pointField points; + labelList boundaryPts(number_of_finite_cells(), -1); faceList faces; labelList owner; labelList neighbour; @@ -323,9 +493,12 @@ void Foam::conformalVoronoiMesh::writeMesh labelList procNeighbours; pointField cellCentres; + PackedBoolList boundaryFacesToRemove; + calcDualMesh ( points, + boundaryPts, faces, owner, neighbour, @@ -337,7 +510,7 @@ void Foam::conformalVoronoiMesh::writeMesh cellCentres, cellToDelaunayVertex, patchToDelaunayVertex, - filterFaces + boundaryFacesToRemove ); Info<< nl << "Writing polyMesh to " << instance << endl; @@ -347,6 +520,7 @@ void Foam::conformalVoronoiMesh::writeMesh Foam::polyMesh::defaultRegion, instance, points, + boundaryPts, faces, owner, neighbour, @@ -355,12 +529,11 @@ void Foam::conformalVoronoiMesh::writeMesh patchSizes, dualPatchStarts, procNeighbours, - cellCentres + cellCentres, + boundaryFacesToRemove ); } - - if (cvMeshControls().writeTetDualMesh()) { // Determine map from Delaunay vertex to Dual mesh @@ -389,6 +562,7 @@ void Foam::conformalVoronoiMesh::writeMesh forAll(patchToDelaunayVertex, patchI) { const labelList& patchVertices = patchToDelaunayVertex[patchI]; + forAll(patchVertices, i) { label vertI = patchVertices[i]; @@ -416,6 +590,7 @@ void Foam::conformalVoronoiMesh::writeMesh // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pointField points; + labelList boundaryPts(number_of_finite_cells(), -1); // From tet point back to Delaunay vertex index labelList pointToDelaunayVertex; faceList faces; @@ -541,23 +716,24 @@ void Foam::conformalVoronoiMesh::writeMesh labelList procNeighbours(patchNames.size(), -1); - Info<< nl << "Writing tetDualMesh to " << instance << endl; - - writeMesh - ( - "tetDualMesh", - instance, - points, - faces, - owner, - neighbour, - patchTypes, - patchNames, - patchSizes, - patchStarts, - procNeighbours, - cellCentres - ); +// Info<< nl << "Writing tetDualMesh to " << instance << endl; + +// writeMesh +// ( +// "tetDualMesh", +// instance, +// points, +// boundaryPts, +// faces, +// owner, +// neighbour, +// patchTypes, +// patchNames, +// patchSizes, +// patchStarts, +// procNeighbours, +// cellCentres +// ); } } @@ -598,7 +774,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh patchI, mesh.boundaryMesh(), Pstream::myProcNo(), - procNeighbours[patchI] + procNeighbours[patchI], + coupledPolyPatch::COINCIDENTFULLMATCH ); } else @@ -620,6 +797,122 @@ Foam::autoPtr<Foam::fvMesh> Foam::conformalVoronoiMesh::createDummyMesh } +void Foam::conformalVoronoiMesh::checkProcessorPatchesMatch +( + const wordList& patchTypes, + const labelList& patchSizes, + const labelList& procNeighbours +) const +{ + // Check patch sizes + labelListList procPatchSizes + ( + Pstream::nProcs(), + labelList(Pstream::nProcs(), -1) + ); + + forAll(patchTypes, patchI) + { + if (patchTypes[patchI] == processorPolyPatch::typeName) + { + procPatchSizes[Pstream::myProcNo()][procNeighbours[patchI]] + = patchSizes[patchI]; + } + } + + Pstream::gatherList(procPatchSizes); + + if (Pstream::master()) + { + bool allMatch = true; + + forAll(procPatchSizes, procI) + { + const labelList& patchSizes = procPatchSizes[procI]; + + forAll(patchSizes, patchI) + { + if (patchSizes[patchI] != procPatchSizes[patchI][procI]) + { + allMatch = false; + + Info<< indent << "Patches " << procI << " and " << patchI + << " have different sizes: " << patchSizes[patchI] + << " and " << procPatchSizes[patchI][procI] << endl; + } + } + } + + if (allMatch) + { + Info<< indent << "All processor patches have matching numbers of " + << "faces" << endl; + } + } +} + + +void Foam::conformalVoronoiMesh::reorderPoints +( + pointField& points, + labelList& boundaryPts, + faceList& faces, + const label nInternalFaces +) const +{ + Info<< incrIndent << indent << "Reordering points into internal/external" + << endl; + + labelList oldToNew(points.size(), 0); + + // Find points that are internal + for (label fI = nInternalFaces; fI < faces.size(); ++fI) + { + const face& f = faces[fI]; + + forAll(f, fpI) + { + oldToNew[f[fpI]] = 1; + } + } + + const label nInternalPoints = points.size() - sum(oldToNew); + + label countInternal = 0; + label countExternal = nInternalPoints; + + forAll(points, pI) + { + if (oldToNew[pI] == 0) + { + oldToNew[pI] = countInternal++; + } + else + { + oldToNew[pI] = countExternal++; + } + } + + Info<< indent + << "Number of internal points: " << countInternal << nl + << indent << "Number of external points: " << countExternal + << decrIndent << endl; + + inplaceReorder(oldToNew, points); + inplaceReorder(oldToNew, boundaryPts); + + forAll(faces, fI) + { + face& f = faces[fI]; + + forAll(f, fpI) + { + f[fpI] = oldToNew[f[fpI]]; + } + } +} + + void Foam::conformalVoronoiMesh::reorderProcessorPatches ( const word& meshName, @@ -633,6 +926,11 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches const labelList& procNeighbours ) const { + Info<< incrIndent << indent << "Reordering processor patches" << endl; + + Info<< incrIndent; + checkProcessorPatchesMatch(patchTypes, patchSizes, procNeighbours); + // Create dummy mesh with correct proc boundaries to do sorting autoPtr<fvMesh> sortMeshPtr ( @@ -656,8 +954,26 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches ); const fvMesh& sortMesh = sortMeshPtr(); + // Change the transform type on processors to coincident full match. +// forAll(sortMesh.boundaryMesh(), patchI) +// { +// const polyPatch& patch = sortMesh.boundaryMesh()[patchI]; +// +// if (isA<processorPolyPatch>(patch)) +// { +// const processorPolyPatch& cpPatch +// = refCast<const processorPolyPatch>(patch); +// +// processorPolyPatch& pPatch +// = const_cast<processorPolyPatch&>(cpPatch); +// +// pPatch.transform() = coupledPolyPatch::COINCIDENTFULLMATCH; +// } +// } + // Rotation on new faces. - labelList rotation(faces.size(), 0); + labelList rotation(faces.size(), -1); + labelList faceMap(faces.size(), -1); PstreamBuffers pBufs(Pstream::nonBlocking); @@ -699,23 +1015,22 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches labelList patchFaceMap(patchSizes[patchI], -1); labelList patchFaceRotation(patchSizes[patchI], 0); - bool changed = - refCast<const processorPolyPatch>(pp).order + bool changed = refCast<const processorPolyPatch>(pp).order + ( + pBufs, + primitivePatch ( - pBufs, - primitivePatch + SubList<face> ( - SubList<face> - ( - faces, - patchSizes[patchI], - patchStarts[patchI] - ), - points + faces, + patchSizes[patchI], + patchStarts[patchI] ), - patchFaceMap, - patchFaceRotation - ); + points + ), + patchFaceMap, + patchFaceRotation + ); if (changed) { @@ -724,8 +1039,17 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches forAll(patchFaceRotation, patchFaceI) { - rotation[patchFaceI + start] = - patchFaceRotation[patchFaceI]; + rotation[patchFaceI + start] + = patchFaceRotation[patchFaceI]; + } + + forAll(patchFaceMap, patchFaceI) + { + if (patchFaceMap[patchFaceI] != patchFaceI) + { + faceMap[patchFaceI + start] + = patchFaceMap[patchFaceI] + start; + } } anyChanged = true; @@ -738,13 +1062,26 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches if (anyChanged) { // Rotate faces (rotation is already in new face indices). + label nRotated = 0; + forAll(rotation, faceI) { + if (rotation[faceI] == -1) + { + continue; + } + if (rotation[faceI] != 0) { - faces[faceI] = faces[faceI].rotateFace(rotation[faceI]); + inplaceRotateList<List, label>(faces[faceI], rotation[faceI]); + nRotated++; } } + + inplaceReorder(faceMap, faces); + + Info<< indent << returnReduce(nRotated, sumOp<label>()) + << " faces have been rotated" << decrIndent << decrIndent << endl; } } @@ -754,6 +1091,7 @@ void Foam::conformalVoronoiMesh::writeMesh const word& meshName, const fileName& instance, pointField& points, + labelList& boundaryPts, faceList& faces, labelList& owner, labelList& neighbour, @@ -762,7 +1100,8 @@ void Foam::conformalVoronoiMesh::writeMesh const labelList& patchSizes, const labelList& patchStarts, const labelList& procNeighbours, - const pointField& cellCentres + const pointField& cellCentres, + const PackedBoolList& boundaryFacesToRemove ) const { if (cvMeshControls().objOutput()) @@ -770,6 +1109,8 @@ void Foam::conformalVoronoiMesh::writeMesh writeObjMesh(points, faces, word(meshName + ".obj")); } + reorderPoints(points, boundaryPts, faces, patchStarts[0]); + if (Pstream::parRun()) { reorderProcessorPatches @@ -786,6 +1127,10 @@ void Foam::conformalVoronoiMesh::writeMesh ); } + Info<< " Constructing mesh" << endl; + + timeCheck("Before fvMesh construction"); + fvMesh mesh ( IOobject @@ -802,6 +1147,8 @@ void Foam::conformalVoronoiMesh::writeMesh xferMove(neighbour) ); + Info<< " Adding patches to mesh" << endl; + List<polyPatch*> patches(patchStarts.size()); label nValidPatches = 0; @@ -811,7 +1158,6 @@ void Foam::conformalVoronoiMesh::writeMesh if (patchTypes[p] == processorPolyPatch::typeName) { // Do not create empty processor patches - if (patchSizes[p] > 0) { patches[nValidPatches] = new processorPolyPatch @@ -822,7 +1168,8 @@ void Foam::conformalVoronoiMesh::writeMesh nValidPatches, mesh.boundaryMesh(), Pstream::myProcNo(), - procNeighbours[p] + procNeighbours[p], + coupledPolyPatch::NOORDERING ); nValidPatches++; @@ -848,18 +1195,224 @@ void Foam::conformalVoronoiMesh::writeMesh mesh.addFvPatches(patches); + timeCheck("Before fvMesh filtering"); + + autoPtr<polyMeshFilter> meshFilter; + + label nInitialBadFaces = 0; + + if (cvMeshControls().filterEdges()) + { + Info<< nl << "Filtering edges on polyMesh" << nl << endl; + + meshFilter.reset(new polyMeshFilter(mesh)); + + // Filter small edges only. This reduces the number of faces so that + // the face filtering is sped up. + nInitialBadFaces = meshFilter().filterEdges(0); + { + const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh(); + + polyTopoChange meshMod(newMesh); + + meshMod.changeMesh(mesh, false); + } + } + + if (cvMeshControls().filterFaces()) + { + Info<< nl << "Filtering faces on polyMesh" << nl << endl; + + meshFilter.reset(new polyMeshFilter(mesh)); + + meshFilter().filter(nInitialBadFaces); + { + const autoPtr<fvMesh>& newMesh = meshFilter().filteredMesh(); + + polyTopoChange meshMod(newMesh); + + meshMod.changeMesh(mesh, false); + } + } + + timeCheck("After fvMesh filtering"); + + mesh.setInstance(instance); + if (!mesh.write()) { FatalErrorIn("Foam::conformalVoronoiMesh::writeMesh(..)") << "Failed writing polyMesh." << exit(FatalError); } + else + { + Info<< nl << "Written filtered mesh to " + << mesh.polyMesh::instance() << nl + << endl; + } - writeCellSizes(mesh); - writeCellCentres(mesh); + volTensorField alignments + ( + IOobject + ( + "alignmentsField", + runTime_.timeName(), + runTime_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + tensor::zero + ); - findRemainingProtrusionSet(mesh); + forAll(mesh.cellCentres(), pI) + { + Vertex_handle nearV = + nearest_vertex + ( + toPoint<Point>(mesh.cellCentres()[pI]) + ); + alignments[pI] = nearV->alignment(); + } + alignments.write(); + + { + volVectorField alignmentx + ( + IOobject + ( + "alignmentsx", + runTime_.timeName(), + runTime_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + vector::zero + ); + forAll(alignmentx, aI) + { + alignmentx[aI] = alignments[aI].x(); + } + alignmentx.write(); + } + { + volVectorField alignmenty + ( + IOobject + ( + "alignmentsy", + runTime_.timeName(), + runTime_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + vector::zero + ); + forAll(alignmenty, aI) + { + alignmenty[aI] = alignments[aI].y(); + } + alignmenty.write(); + } + { + volVectorField alignmentz + ( + IOobject + ( + "alignmentsz", + runTime_.timeName(), + runTime_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + vector::zero + ); + forAll(alignmentz, aI) + { + alignmentz[aI] = alignments[aI].z(); + } + alignmentz.write(); + } + labelIOList boundaryIOPts + ( + IOobject + ( + "boundaryPoints", + instance, + runTime_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + boundaryPts + ); + + + + + // Dump list of boundary points + forAll(mesh.boundaryMesh(), patchI) + { + const polyPatch& pp = mesh.boundaryMesh()[patchI]; + + if (!isA<coupledPolyPatch>(pp)) + { + forAll(pp, fI) + { + const face& boundaryFace = pp[fI]; + + forAll(boundaryFace, pI) + { + const label boundaryPointI = boundaryFace[pI]; + + boundaryIOPts[boundaryPointI] = boundaryPts[boundaryPointI]; + } + } + } + } + + boundaryIOPts.write(); + +// forAllConstIter(labelHashSet, pointsInPatch, pI) +// { +// const Foam::point& ptMaster = mesh.points()[pI.key()]; +// +// forAllConstIter(labelHashSet, pointsInPatch, ptI) +// { +// if (ptI.key() != pI.key()) +// { +// const Foam::point& ptSlave = mesh.points()[ptI.key()]; +// +// const scalar dist = mag(ptMaster - ptSlave); +// if (ptMaster == ptSlave) +// { +// Pout<< "Point(" << pI.key() << ") " << ptMaster +// << " == " +// << "(" << ptI.key() << ") " << ptSlave +// << endl; +// } +// else if (dist == 0) +// { +// Pout<< "Point(" << pI.key() << ") " << ptMaster +// << " ~= " +// << "(" << ptI.key() << ") " << ptSlave +// << endl; +// } +// } +// } +// } + +// writeCellSizes(mesh); + +// writeCellAlignments(mesh); + +// writeCellCentres(mesh); + +// findRemainingProtrusionSet(mesh); } @@ -926,7 +1479,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes forAll(cellSize, i) { - cellSize[i] = cellSizeControl().cellSize(C[i]); + cellSize[i] = cellShapeControls().cellSize(C[i]); } // Info<< nl << "Create targetCellVolume volScalarField" << endl; @@ -1036,7 +1589,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes // forAll(cellSize, i) // { - // cellSize[i] = cellSizeControl().cellSize(P[i]); + // cellSize[i] = cellShapeControls().cellSize(P[i]); // } // ptTargetCellSize.write(); @@ -1044,6 +1597,61 @@ void Foam::conformalVoronoiMesh::writeCellSizes } +void Foam::conformalVoronoiMesh::writeCellAlignments +( + const fvMesh& mesh +) const +{ +// Info<< nl << "Create cellAlignments volTensorField" << endl; +// +// volTensorField cellAlignments +// ( +// IOobject +// ( +// "cellAlignments", +// mesh.polyMesh::instance(), +// mesh, +// IOobject::NO_READ, +// IOobject::AUTO_WRITE +// ), +// mesh, +// tensor::I, +// zeroGradientFvPatchTensorField::typeName +// ); +// +// tensorField& cellAlignment = cellAlignments.internalField(); +// +// const vectorField& C = mesh.cellCentres(); +// +// vectorField xDir(cellAlignment.size()); +// vectorField yDir(cellAlignment.size()); +// vectorField zDir(cellAlignment.size()); +// +// forAll(cellAlignment, i) +// { +// cellAlignment[i] = cellShapeControls().cellAlignment(C[i]); +// xDir[i] = cellAlignment[i] & vector(1, 0, 0); +// yDir[i] = cellAlignment[i] & vector(0, 1, 0); +// zDir[i] = cellAlignment[i] & vector(0, 0, 1); +// } +// +// OFstream xStr("xDir.obj"); +// OFstream yStr("yDir.obj"); +// OFstream zStr("zDir.obj"); +// +// forAll(xDir, i) +// { +// meshTools::writeOBJ(xStr, C[i], C[i] + xDir[i]); +// meshTools::writeOBJ(yStr, C[i], C[i] + yDir[i]); +// meshTools::writeOBJ(zStr, C[i], C[i] + zDir[i]); +// } +// +// cellAlignments.correctBoundaryConditions(); +// +// cellAlignments.write(); +} + + void Foam::conformalVoronoiMesh::writeCellCentres ( const fvMesh& mesh diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.C similarity index 67% rename from applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.C rename to applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.C index 06b2c4d400890eeaf97fda4e60110090ec18a4f7..bd4973b32b91f5e81e317fbf6b5d88376a246315 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.C @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - \*---------------------------------------------------------------------------*/ #include "indexedCell.H" @@ -41,8 +36,47 @@ Foam::Ostream& Foam::operator<< { const CGAL::indexedCell<Gt, Cb>& iv = p.t_; - os << "Cell : index:" << iv.index_ << " filterCount:" << iv.filterCount_ - << nl; + os << "Cell: "; + + if (iv.index_ == CGAL::indexedCell<Gt, Cb>::ctFar) + { + os << "far"; + } + else if (iv.index_ >= 0) + { + os << iv.index_; + } + else if (iv.index_ == CGAL::indexedCell<Gt, Cb>::ctInternal) + { + os << "internal"; + } + else if (iv.index_ == CGAL::indexedCell<Gt, Cb>::ctSurface) + { + os << "surface"; + } + else if (iv.index_ == CGAL::indexedCell<Gt, Cb>::ctFeatureEdge) + { + os << "featureEdge"; + } + else if (iv.index_ == CGAL::indexedCell<Gt, Cb>::ctFeaturePoint) + { + os << "featurePoint"; + } + else + { + os << "unassigned"; + } + + if (iv.parallelDualVertex()) + { + os << " (processor)"; + } + else + { + os << " (local)"; + } + + os << " filterCount: " << iv.filterCount_ << nl; os << " " << iv.vertex(0)->info(); os << " " << iv.vertex(1)->info(); os << " " << iv.vertex(2)->info(); diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H similarity index 84% rename from applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H rename to applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H index eab096819aedc3669652182f349712344c0a23b6..4669110b6e9edbb95dd1e0a9ea240576f95a49fd 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - Class indexedCell @@ -52,6 +47,8 @@ SourceFiles #include "InfoProxy.H" #include "tetCell.H" #include "typeInfo.H" +#include "vectorTools.H" +#include "indexedCellEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -85,6 +82,7 @@ template > class indexedCell : + public Foam::indexedCellEnum, public Cb { // Private data @@ -98,6 +96,7 @@ class indexedCell // not on a processor face // < 0 && > ctFar : the (global) index of a dual point on a processor // face + int index_; //- The number of times that this Delaunay cell has been limited @@ -105,14 +104,17 @@ class indexedCell int filterCount_; -public: + // Private member functions - enum cellTypes - { - ctFar = INT_MIN - }; + //- Same as globallyOrderedCellVertices but without sorting + Foam::tetCell unsortedVertexGlobalIndices + ( + const Foam::globalIndex& globalDelaunayVertexIndices + ) const; +public: + typedef typename Cb::Vertex_handle Vertex_handle; typedef typename Cb::Cell_handle Cell_handle; @@ -155,9 +157,13 @@ public: inline int cellIndex() const; +#ifdef CGAL_INEXACT inline const Foam::point& dual(); +#else + inline const Foam::point dual(); +#endif - inline bool farCell() const; + inline bool unassigned() const; inline int& filterCount(); @@ -169,6 +175,12 @@ public: //- Does the Delaunay cell have a far point inline bool hasFarPoint() const; + //- Does the Delaunay cell have a feature point + inline bool hasFeaturePoint() const; + + //- Does the Delaunay cell have a seed point + inline bool hasSeedPoint() const; + inline bool hasInternalPoint() const; //- Does the Dual vertex form part of a processor patch @@ -186,6 +198,13 @@ public: const Foam::globalIndex& globalDelaunayVertexIndices ) const; + //- Using the globalIndex object, return a list of four vertices with + // so that the cell has a consistent orientation in parallel. + inline Foam::FixedList<Foam::label, 4> globallyOrderedCellVertices + ( + const Foam::globalIndex& globalDelaunayVertexIndices + ) const; + //- Is the Delaunay cell part of the final dual mesh, i.e. any vertex // form part of the internal or boundary definition inline bool internalOrBoundaryDualVertex() const; @@ -198,8 +217,13 @@ public: // least one Delaunay vertex outside and at least one inside inline bool boundaryDualVertex() const; + //- A dual vertex on a feature edge will result from this Delaunay cell + inline bool featureEdgeDualVertex() const; + inline bool nearProcBoundary() const; + inline bool potentialCoplanarCell() const; + // Info diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C new file mode 100644 index 0000000000000000000000000000000000000000..7213739844d2035931f2177751a37ac76311ea1a --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "plane.H" +#include "tetrahedron.H" +#include "pointConversion.H" +#include "CGALTriangulation3DKernel.H" + + +template <typename Cell> +Foam::scalar Foam::cvMeshChecks::coplanarTet +( + Cell& c, + const scalar tol +) +{ + tetPointRef tet + ( + topoint(c->vertex(0)->point()), + topoint(c->vertex(1)->point()), + topoint(c->vertex(2)->point()), + topoint(c->vertex(3)->point()) + ); + + const scalar quality = tet.quality(); + + if (quality < tol) + { + return quality; + } + + return 0; + +// plane triPlane +// ( +// topoint(c->vertex(0)->point()), +// topoint(c->vertex(1)->point()), +// topoint(c->vertex(2)->point()) +// ); +// +// const scalar distance = triPlane.distance(topoint(c->vertex(3)->point())); +// +// // Check if the four points are roughly coplanar. If they are then we +// // cannot calculate the circumcentre. Better test might be the volume +// // of the tet. +// if (distance < tol) +// { +// return 0; +// } +// +// return distance; +} + + +template <typename Cell> +bool Foam::cvMeshChecks::closePoints +( + Cell& c, + const scalar tol +) +{ + for (label v = 0; v < 4; ++v) + { + for (label vA = v + 1; vA < 4; ++vA) + { + if + ( + mag + ( + topoint(c->vertex(v)->point()) + - topoint(c->vertex(vA)->point()) + ) + < tol + ) + { + return true; + } + } + } + + return false; +} + + +template <typename Cell> +bool Foam::cvMeshChecks::smallVolume +( + Cell& c, + const scalar tol +) +{ + CGAL::Tetrahedron_3<baseK> tet + ( + c->vertex(0)->point(), + c->vertex(1)->point(), + c->vertex(2)->point(), + c->vertex(3)->point() + ); + + if (tet.volume() < tol) + { + return true; + } + + return false; +} diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H new file mode 100644 index 0000000000000000000000000000000000000000..c040eafab67c1b07447377de165db13fb32b7dce --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellChecks.H @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef indexedCellChecks_H +#define indexedCellChecks_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace cvMeshChecks +{ + + template <typename Cell> + scalar coplanarTet + ( + Cell& c, + const scalar tol = 1e-12 + ); + + template <typename Cell> + bool closePoints + ( + Cell& c, + const scalar tol = 1e-12 + ); + + template <typename Cell> + bool smallVolume + ( + Cell& c, + const scalar tol = 0.0 + ); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace cvMeshChecks + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "indexedCellChecks.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C new file mode 100644 index 0000000000000000000000000000000000000000..5d7d953948bb73934c550843bb1371d068a3b249 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "indexedCellEnum.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* +Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6>::names[] = +{ + "Unassigned", + "Internal", + "Surface", + "FeatureEdge", + "FeaturePoint", + "Far" +}; + +const Foam::NamedEnum<Foam::indexedCellEnum::cellTypes, 6> +cellTypesNames_; + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H new file mode 100644 index 0000000000000000000000000000000000000000..5ccef621e74d1bf80816da1fd6380a77779fac15 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellEnum.H @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + indexedCellEnum + +Description + +SourceFiles + indexedCellEnum.C + +\*---------------------------------------------------------------------------*/ + +#ifndef indexedCellEnum_H +#define indexedCellEnum_H + +#include "NamedEnum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +class indexedCellEnum +{ +public: + + + enum cellTypes + { + ctUnassigned = INT_MIN, + ctFar = INT_MIN + 1, + ctInternal = INT_MIN + 2, + ctSurface = INT_MIN + 3, + ctFeatureEdge = INT_MIN + 4, + ctFeaturePoint = INT_MIN + 5 + }; + + static const Foam::NamedEnum<cellTypes, 6> cellTypesNames_; +}; + + +template<> +inline bool contiguous<indexedCellEnum>() +{ + return true; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCellI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H similarity index 51% rename from applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCellI.H rename to applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H index eb5e0b44bd15d4ac01fb83e6b44d0528be489986..83434ba2f12712085d2ca796067708d195eddc8a 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCellI.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H @@ -21,20 +21,41 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - \*---------------------------------------------------------------------------*/ +//#include "indexedCellChecks.H" + +template<class Gt, class Cb> +Foam::tetCell CGAL::indexedCell<Gt, Cb>::unsortedVertexGlobalIndices +( + const Foam::globalIndex& globalDelaunayVertexIndices +) const +{ + Foam::tetCell tVGI; + + for (int i = 0; i < 4; i++) + { + Vertex_handle v = this->vertex(i); + + // Finding the global index of each Delaunay vertex + tVGI[i] = globalDelaunayVertexIndices.toGlobal + ( + Foam::Pstream::myProcNo(), + v->index() + ); + } + + return tVGI; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Gt, class Cb> CGAL::indexedCell<Gt, Cb>::indexedCell() : Cb(), - index_(ctFar), + index_(ctUnassigned), filterCount_(0) {} @@ -46,7 +67,7 @@ CGAL::indexedCell<Gt, Cb>::indexedCell ) : Cb(v0, v1, v2, v3), - index_(ctFar), + index_(ctUnassigned), filterCount_(0) {} @@ -65,7 +86,7 @@ CGAL::indexedCell<Gt, Cb>::indexedCell ) : Cb(v0, v1, v2, v3, n0, n1, n2, n3), - index_(ctFar), + index_(ctUnassigned), filterCount_(0) {} @@ -86,28 +107,37 @@ int CGAL::indexedCell<Gt, Cb>::cellIndex() const } -template<class Gt, class Cb> -const Foam::point& CGAL::indexedCell<Gt, Cb>::dual() -{ #ifdef CGAL_INEXACT - return reinterpret_cast<const Foam::point&>(this->circumcenter()); + template<class Gt, class Cb> + const Foam::point& CGAL::indexedCell<Gt, Cb>::dual() + { + // if (Foam::cvMeshChecks::coplanarTet(*this, 1e-20) == 0) + // { + // Do exact calc + // } + + return reinterpret_cast<const Foam::point&>(this->circumcenter()); + } #else - const typename Gt::Point_3& P = this->circumcenter(); + template<class Gt, class Cb> + const Foam::point CGAL::indexedCell<Gt, Cb>::dual() + { + const typename Gt::Point_3& P = this->circumcenter(); - return - ( - CGAL::to_double(P.x()), - CGAL::to_double(P.y()), - CGAL::to_double(P.z()) - ); + return Foam::point + ( + CGAL::to_double(P.x()), + CGAL::to_double(P.y()), + CGAL::to_double(P.z()) + ); + } #endif -} template<class Gt, class Cb> -inline bool CGAL::indexedCell<Gt, Cb>::farCell() const +inline bool CGAL::indexedCell<Gt, Cb>::unassigned() const { - return index_ == ctFar; + return index_ == ctUnassigned; } @@ -160,6 +190,32 @@ inline bool CGAL::indexedCell<Gt, Cb>::hasFarPoint() const } +template<class Gt, class Cb> +inline bool CGAL::indexedCell<Gt, Cb>::hasFeaturePoint() const +{ + return + ( + this->vertex(0)->featurePoint() + || this->vertex(1)->featurePoint() + || this->vertex(2)->featurePoint() + || this->vertex(3)->featurePoint() + ); +} + + +template<class Gt, class Cb> +inline bool CGAL::indexedCell<Gt, Cb>::hasSeedPoint() const +{ + return + ( + this->vertex(0)->seedPoint() + || this->vertex(1)->seedPoint() + || this->vertex(2)->seedPoint() + || this->vertex(3)->seedPoint() + ); +} + + template<class Gt, class Cb> inline bool CGAL::indexedCell<Gt, Cb>::hasInternalPoint() const { @@ -178,10 +234,21 @@ inline bool CGAL::indexedCell<Gt, Cb>::parallelDualVertex() const { return ( - this->vertex(0)->referred() - || this->vertex(1)->referred() - || this->vertex(2)->referred() - || this->vertex(3)->referred() + !this->hasFarPoint() + && + ( + this->vertex(0)->referred() + || this->vertex(1)->referred() + || this->vertex(2)->referred() + || this->vertex(3)->referred() + ) + && + ( + this->vertex(0)->real() + || this->vertex(1)->real() + || this->vertex(2)->real() + || this->vertex(3)->real() + ) ); } @@ -247,34 +314,38 @@ inline Foam::tetCell CGAL::indexedCell<Gt, Cb>::vertexGlobalIndices ) const { // tetVertexGlobalIndices - Foam::tetCell tVGI; + Foam::tetCell tVGI + = unsortedVertexGlobalIndices(globalDelaunayVertexIndices); - for (int i = 0; i < 4; i++) + // bubble sort + for (int i = 0; i < tVGI.size(); i++) { - Vertex_handle v = this->vertex(i); - - // Finding the global index of each Delaunay vertex - - if (v->referred()) - { - // Referred vertices may have negative indices - - tVGI[i] = globalDelaunayVertexIndices.toGlobal - ( - v->procIndex(), - Foam::mag(v->index()) - ); - } - else + for (int j = tVGI.size() - 1 ; j > i; j--) { - tVGI[i] = globalDelaunayVertexIndices.toGlobal - ( - Foam::Pstream::myProcNo(), - v->index() - ); + if (tVGI[j - 1] > tVGI[j]) + { + Foam::Swap(tVGI[j - 1], tVGI[j]); + } } } + return tVGI; +} + + +template<class Gt, class Cb> +inline Foam::FixedList<Foam::label, 4> +CGAL::indexedCell<Gt, Cb>::globallyOrderedCellVertices +( + const Foam::globalIndex& globalDelaunayVertexIndices +) const +{ + // tetVertexGlobalIndices + Foam::tetCell tVGI + = unsortedVertexGlobalIndices(globalDelaunayVertexIndices); + + Foam::FixedList<Foam::label, 4> vertexMap(Foam::identity(4)); + // bubble sort for (int i = 0; i < tVGI.size(); i++) { @@ -283,10 +354,16 @@ inline Foam::tetCell CGAL::indexedCell<Gt, Cb>::vertexGlobalIndices if (tVGI[j - 1] > tVGI[j]) { Foam::Swap(tVGI[j - 1], tVGI[j]); + Foam::Swap(vertexMap[j - 1], vertexMap[j]); } } } + for (int i = 0; i < 4; i++) + { + tVGI[i] = vertexMap[i]; + } + return tVGI; } @@ -309,10 +386,14 @@ inline bool CGAL::indexedCell<Gt, Cb>::anyInternalOrBoundaryDualVertex() const { return ( - this->vertex(0)->anyInternalOrBoundaryPoint() - || this->vertex(1)->anyInternalOrBoundaryPoint() - || this->vertex(2)->anyInternalOrBoundaryPoint() - || this->vertex(3)->anyInternalOrBoundaryPoint() + this->vertex(0)->internalOrBoundaryPoint() + || this->vertex(0)->externalBoundaryPoint() + || this->vertex(1)->internalOrBoundaryPoint() + || this->vertex(1)->externalBoundaryPoint() + || this->vertex(2)->internalOrBoundaryPoint() + || this->vertex(2)->externalBoundaryPoint() + || this->vertex(3)->internalOrBoundaryPoint() + || this->vertex(3)->externalBoundaryPoint() ); } @@ -323,21 +404,34 @@ inline bool CGAL::indexedCell<Gt, Cb>::boundaryDualVertex() const return ( ( - this->vertex(0)->internalOrBoundaryPoint() - || this->vertex(1)->internalOrBoundaryPoint() - || this->vertex(2)->internalOrBoundaryPoint() - || this->vertex(3)->internalOrBoundaryPoint() + this->vertex(0)->internalBoundaryPoint() + || this->vertex(1)->internalBoundaryPoint() + || this->vertex(2)->internalBoundaryPoint() + || this->vertex(3)->internalBoundaryPoint() ) && ( - !this->vertex(0)->internalOrBoundaryPoint() - || !this->vertex(1)->internalOrBoundaryPoint() - || !this->vertex(2)->internalOrBoundaryPoint() - || !this->vertex(3)->internalOrBoundaryPoint() + this->vertex(0)->externalBoundaryPoint() + || this->vertex(1)->externalBoundaryPoint() + || this->vertex(2)->externalBoundaryPoint() + || this->vertex(3)->externalBoundaryPoint() ) ); } +template<class Gt, class Cb> +inline bool CGAL::indexedCell<Gt, Cb>::featureEdgeDualVertex() const +{ + return + ( + this->vertex(0)->featureEdgePoint() + && this->vertex(1)->featureEdgePoint() + && this->vertex(2)->featureEdgePoint() + && this->vertex(3)->featureEdgePoint() + ); +} + + template<class Gt, class Cb> inline bool CGAL::indexedCell<Gt, Cb>::nearProcBoundary() const { @@ -351,4 +445,94 @@ inline bool CGAL::indexedCell<Gt, Cb>::nearProcBoundary() const } +template<class Gt, class Cb> +inline bool CGAL::indexedCell<Gt, Cb>::potentialCoplanarCell() const +{ + Foam::label nMasters = 0; + Foam::label nSlaves = 0; + + Vertex_handle vM[2]; + Vertex_handle vS[2]; + + for (Foam::label i = 0; i < 4; ++i) + { + Vertex_handle v = this->vertex(i); + + if (v->internalBoundaryPoint()) + { + vM[nMasters] = v; + nMasters++; + } + + if (v->externalBoundaryPoint()) + { + vS[nSlaves] = v; + nSlaves++; + } + } + + Foam::label nPairs = 0; + + if (nMasters == 2 && nSlaves == 2) + { + Foam::vector vp0(Foam::vector::zero); + Foam::vector vp1(Foam::vector::zero); + + if + ( + vM[0]->type() == vS[0]->index() + && vM[0]->index() == vS[0]->type() + ) + { + vp0 = reinterpret_cast<const Foam::point&>(vM[0]->point()) + - reinterpret_cast<const Foam::point&>(vS[0]->point()); + nPairs++; + } + else if + ( + vM[0]->type() == vS[1]->index() + && vM[0]->index() == vS[1]->type() + ) + { + vp0 = reinterpret_cast<const Foam::point&>(vM[0]->point()) + - reinterpret_cast<const Foam::point&>(vS[1]->point()); + nPairs++; + } + + if + ( + vM[1]->type() == vS[0]->index() + && vM[1]->index() == vS[0]->type() + ) + { + vp1 = reinterpret_cast<const Foam::point&>(vM[1]->point()) + - reinterpret_cast<const Foam::point&>(vS[0]->point()); + nPairs++; + } + else if + ( + vM[1]->type() == vS[1]->index() + && vM[1]->index() == vS[1]->type() + ) + { + vp1 = reinterpret_cast<const Foam::point&>(vM[1]->point()) + - reinterpret_cast<const Foam::point&>(vS[1]->point()); + nPairs++; + } + + if (nPairs == 2) + { + if (Foam::vectorTools::areParallel(vp0, vp1)) + { + Foam::Pout<< "PARALLEL" << Foam::endl; + + return true; + } + } + } + + return false; +} + + // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.C deleted file mode 100644 index 2f1fa3c5bbb4b2185b61ea679014140d1eebfcae..0000000000000000000000000000000000000000 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.C +++ /dev/null @@ -1,115 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - -\*---------------------------------------------------------------------------*/ - -#include "indexedVertex.H" -#include "point.H" - -// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // - -template<class Gt, class Vb> -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const InfoProxy<CGAL::indexedVertex<Gt, Vb> >& p -) -{ - const CGAL::indexedVertex<Gt, Vb>& iv = p.t_; - - if (iv.type_ == CGAL::indexedVertex<Gt, Vb>::vtNearBoundary) - { - os << "internal near boundary point" << nl; - } - else if (iv.type_ == CGAL::indexedVertex<Gt, Vb>::vtInternal) - { - os << "internal point" << nl; - } - else if (iv.type_ == CGAL::indexedVertex<Gt, Vb>::vtFar) - { - os << "far point" << nl; - } - else if (iv.type_ > CGAL::indexedVertex<Gt, Vb>::vtFar && iv.type_ < 0) - { - if (iv.index_ >= 0) - { - os << "referred (master) point from processor " << iv.procIndex() - << nl; - } - else - { - os << "referred (slave) point from processor " << iv.procIndex() - << nl; - } - } - else if (iv.type_ >= 0) - { - if (iv.ppMaster()) - { - os << "master of point pair. paired up with point " << iv.index_ - << nl; - } - else if (iv.ppSlave()) - { - os << "slave of point pair. paired up with point " << iv.index_ - << nl; - } - else - { - FatalErrorIn - ( - "operator<<" - "(Ostream&, const InfoProxy<CGAL::indexedVertex<Gt, Vb> >&)" - ) << "unhandled type " << iv.type_ << " index " << iv.index_ - << abort(FatalError); - } - } - else - { - FatalErrorIn - ( - "operator<<" - "(Ostream&, const InfoProxy<CGAL::indexedVertex<Gt, Vb> >&)" - ) << "unhandled type " << iv.type_ << " index " << iv.index_ - << abort(FatalError); - } - const Foam::point pos - ( - CGAL::to_double(iv.point().x()), - CGAL::to_double(iv.point().y()), - CGAL::to_double(iv.point().z()) - ); - - os << " type:" << iv.type_ << " index:" << iv.index_ - << " at:" << pos << nl; - - return os; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C new file mode 100644 index 0000000000000000000000000000000000000000..5aa39368740d93ff1203ba896c98a6364755e512 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.C @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "indexedVertex.H" +#include "point.H" +#include "Istream.H" +#include "Ostream.H" +#include "OStringStream.H" +#include "IStringStream.H" + +// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // + +Foam::Istream& Foam::operator>> +( + Istream& is, + CGAL::Point_3<baseK>& p +) +{ +// string data(is); +// +// std::istringstream stdIs; +// +// CGAL::set_ascii_mode(stdIs); +// +// stdIs.str(data); +// +// CGAL::Gmpz xNumer, xDenom; +// CGAL::Gmpz yNumer, yDenom; +// CGAL::Gmpz zNumer, zDenom; +// +// stdIs >> xNumer >> xDenom >> yNumer >> yDenom >> zNumer >> zDenom; +// +// CGAL::Gmpq x(xNumer, xDenom); +// CGAL::Gmpq y(yNumer, yDenom); +// CGAL::Gmpq z(zNumer, zDenom); +// +// p = CGAL::Point_3<baseK> +// ( +// CGAL::to_double(x), +// CGAL::to_double(y), +// CGAL::to_double(z) +// ); + + Foam::point pt; + + is >> pt.x() >> pt.y() >> pt.z(); + + p = CGAL::Point_3<baseK> + ( + pt.x(), + pt.y(), + pt.z() + ); + + return is; +} + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const CGAL::Point_3<baseK>& p +) +{ +// CGAL::Gmpq x(CGAL::to_double(p.x())); +// CGAL::Gmpq y(CGAL::to_double(p.y())); +// CGAL::Gmpq z(CGAL::to_double(p.z())); +// +// std::ostringstream stdOs; +// +// CGAL::set_ascii_mode(stdOs); +// +// stdOs<< x.numerator() << ' ' << x.denominator() << ' ' +// << y.numerator() << ' ' << y.denominator() << ' ' +// << z.numerator() << ' ' << z.denominator(); +// +// os << stdOs.str(); + + os << CGAL::to_double(p.x()) << ' ' + << CGAL::to_double(p.y()) << ' ' + << CGAL::to_double(p.z()); + + return os; +} + + +template<class Gt, class Vb> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const CGAL::indexedVertex<Gt, Vb>& p +) +{ + os << p.point() + << p.index() + << static_cast<int>(p.type()) + << p.procIndex() + << p.alignment() + << p.targetCellSize(); + + return os; +} + + +template<class Gt, class Vb> +Foam::Istream& Foam::operator>> +( + Istream& is, + CGAL::indexedVertex<Gt, Vb>& p +) +{ + is >> p.point() + >> p.index(); + + int type; + is >> type; + + p.type() = static_cast<Foam::indexedVertexEnum::vertexType>(type); + + is >> p.procIndex() + >> p.alignment() + >> p.targetCellSize(); + + return is; +} + + +template<class Gt, class Vb> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const InfoProxy<CGAL::indexedVertex<Gt, Vb> >& p +) +{ + const CGAL::indexedVertex<Gt, Vb>& iv = p.t_; + + const Foam::point pt + ( + CGAL::to_double(iv.point().x()), + CGAL::to_double(iv.point().y()), + CGAL::to_double(iv.point().z()) + ); + + string referred + ( + Pstream::myProcNo() == iv.processor_ + ? string(" (local)") + : string(" (from " + name(iv.processor_) + ")") + ); + + os << iv.index_ << " " + << CGAL::indexedVertex<Gt, Vb>::vertexTypeNames_[iv.type_] + << " at:" << pt + << " size:" << iv.targetCellSize_ + << " alignment:" << iv.alignment_ + << referred.c_str() + << endl; + + return os; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H similarity index 57% rename from applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H rename to applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H index c3d13ab05eb8b6d413c655cb25eeca246726ca85..f39e90761d0666415b2ab03878a65addf72d2744 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - Class indexedVertex @@ -43,9 +38,11 @@ SourceFiles #define indexedVertex_H #include <CGAL/Triangulation_3.h> +#include "CGALTriangulation3DKernel.H" #include "tensor.H" #include "InfoProxy.H" #include "point.H" +#include "indexedVertexEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,13 +53,41 @@ template<class Gt, class Vb> class indexedVertex; namespace Foam { + class Ostream; +class Istream; + template<class Gt, class Vb> Ostream& operator<< ( Ostream&, const Foam::InfoProxy<CGAL::indexedVertex<Gt, Vb> >& ); -} + +template<class Gt, class Vb> Ostream& operator<< +( + Ostream&, + const CGAL::indexedVertex<Gt, Vb>& +); + +template<class Gt, class Vb> Istream& operator>> +( + Istream&, + CGAL::indexedVertex<Gt, Vb>& +); + +inline Istream& operator>> +( + Istream& is, + CGAL::Point_3<baseK>& p +); + +inline Ostream& operator<< +( + Ostream& os, + const CGAL::Point_3<baseK>& p +); + +} // End namespace Foam namespace CGAL @@ -72,26 +97,24 @@ namespace CGAL Class indexedVertex Declaration \*---------------------------------------------------------------------------*/ -template<class Gt, class Vb=CGAL::Triangulation_vertex_base_3<Gt> > +template<class Gt, class Vb = CGAL::Triangulation_vertex_base_3<Gt> > class indexedVertex : + public Foam::indexedVertexEnum, public Vb { // Private data + //- Type of pair-point + vertexType type_; + //- The index for this Delaunay vertex. For referred vertices, the // index is negative for vertices that are the outer (slave) of point // pairs int index_; - //- type of pair-point : - // vtNearBoundary : internal near boundary point. - // vtInternal : internal point. - // vtFar : far-point. - // > vtFar, < 0 : referred point from processor -(type_ + 1) - // >= 0 : part of point-pair. Index of other point. - // Lowest numbered is inside one (master). - int type_; + //- Number of the processor that owns this vertex + int processor_; //- Required alignment of the dual cell of this vertex Foam::tensor alignment_; @@ -100,29 +123,15 @@ class indexedVertex Foam::scalar targetCellSize_; //- Specify whether the vertex is fixed or movable. - bool vertexFixed_; - - bool nearProcBoundary_; +// bool vertexFixed_; public: - enum vertexTypes - { - vtNearBoundary = INT_MIN, - vtInternal = INT_MIN + 1, - vtFar = INT_MIN + 2 - }; - - enum vertexMotion - { - fixed = 0, - movable = 1 - }; - - typedef typename Vb::Vertex_handle Vertex_handle; - typedef typename Vb::Cell_handle Cell_handle; - typedef typename Vb::Point Point; + typedef typename Vb::Triangulation_data_structure Tds; + typedef typename Vb::Point Point; + typedef typename Tds::Vertex_handle Vertex_handle; + typedef typename Tds::Cell_handle Cell_handle; template<typename TDS2> struct Rebind_TDS @@ -131,14 +140,23 @@ public: typedef indexedVertex<Gt,Vb2> Other; }; - // Constructors inline indexedVertex(); inline indexedVertex(const Point& p); - inline indexedVertex(const Point& p, int index, int type); + inline indexedVertex(const Point& p, vertexType type); + + inline indexedVertex(const Foam::point& p, vertexType type); + + inline indexedVertex + ( + const Point& p, + int index, + vertexType type, + int processor + ); inline indexedVertex(const Point& p, Cell_handle f); @@ -151,9 +169,9 @@ public: inline int index() const; - inline int& type(); + inline vertexType& type(); - inline int type() const; + inline vertexType type() const; inline Foam::tensor& alignment(); @@ -171,26 +189,18 @@ public: //- Is point internal, i.e. not on boundary inline bool internalPoint() const; - //- Is point internal, i.e. not on boundary, external query. - inline static bool internalPoint(int type); - - // is this a referred vertex + //- Is this a referred vertex inline bool referred() const; - // is this a referred internal or boundary vertex - inline bool referredInternalOrBoundaryPoint() const; - - // is this a referred external (pair slave) vertex - inline bool referredExternal() const; - - // Is this a "real" point on this processor, i.e. is it internal or part - // of the boundary description, and not a "far" or "referred" point + //- Is this a "real" point on this processor, i.e. is internal or part + // of the boundary description, and not a "far" or "referred" point inline bool real() const; // For referred vertices, what is the original processor index inline int procIndex() const; - inline static int encodeProcIndex(int procI); + // For referred vertices, set the original processor index + inline int& procIndex(); //- Set the point to be internal inline void setInternal(); @@ -208,45 +218,61 @@ public: inline void setNearProcBoundary(); //- Either master or slave of pointPair. - inline bool pairPoint() const; - - //- Master of a pointPair is the lowest numbered one. - inline bool ppMaster() const; - - //- Master of a pointPair is the lowest numbered one, external query. - inline static bool ppMaster(int index, int type); - - //- Slave of a pointPair is the highest numbered one. - inline bool ppSlave() const; + inline bool boundaryPoint() const; //- Either original internal point or master of pointPair. inline bool internalOrBoundaryPoint() const; - //- Either original internal point or master of pointPair. - // External query. - inline static bool internalOrBoundaryPoint(int index, int type); - //- Is point near the boundary or part of the boundary definition inline bool nearOrOnBoundary() const; - //- Either a real or referred internal or boundary point - inline bool anyInternalOrBoundaryPoint() const; + //- Part of a feature point + inline bool featurePoint() const; - //- Is the vertex fixed or movable - inline bool isVertexFixed() const; + //- Part of a feature edge + inline bool featureEdgePoint() const; - //- Fix the vertex so that it can't be moved - inline void setVertexFixed(); + //- Part of a surface point pair + inline bool surfacePoint() const; - // inline void operator=(const Delaunay::Finite_vertices_iterator vit) - // { - // Vb::operator=indexedVertex(vit->point()); + inline bool internalBoundaryPoint() const; - // this->index_ = vit->index(); + inline bool externalBoundaryPoint() const; - // this->type_ = vit->type(); - // } +// //- Is the vertex fixed or movable +// inline bool isVertexFixed() const; +// +// //- Fix the vertex so that it can't be moved +// inline void setVertexFixed(); + inline indexedVertex& operator=(const indexedVertex& rhs) + { + Vb::operator=(rhs); + + this->type_ = rhs.type(); + this->index_ = rhs.index(); + this->processor_ = rhs.procIndex(); + this->alignment_ = rhs.alignment(); + this->targetCellSize_ = rhs.targetCellSize(); + + return *this; + } + + inline bool operator==(const indexedVertex& rhs) const + { + return + ( + //this->point() == rhs.point() + this->type_ == rhs.type() + && this->index_ == rhs.index() + && this->processor_ == rhs.procIndex() + ); + } + + inline bool operator!=(const indexedVertex& rhs) const + { + return !(*this == rhs); + } // Info @@ -264,6 +290,17 @@ public: const Foam::InfoProxy<indexedVertex<Gt, Vb> >& ); + friend Foam::Ostream& Foam::operator<< <Gt, Vb> + ( + Foam::Ostream&, + const indexedVertex<Gt, Vb>& + ); + + friend Foam::Istream& Foam::operator>> <Gt, Vb> + ( + Foam::Istream&, + indexedVertex<Gt, Vb>& + ); }; @@ -271,6 +308,37 @@ public: } // End namespace CGAL +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +#ifdef CGAL_INEXACT +namespace Foam +{ + // For inexact representations where the storage type is a double, the data + // is contiguous. This may not be true for exact number types. + template<> + inline bool contiguous + < + CGAL::indexedVertex + < + K, + CGAL::Triangulation_vertex_base_3<K> + > + >() + { + return true; + } + + + template<> + inline bool contiguous<CGAL::Triangulation_vertex_base_3<K>::Point>() + { + return true; + } + +} // End namespace Foam +#endif + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "indexedVertexI.H" diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C new file mode 100644 index 0000000000000000000000000000000000000000..ee394b16fa62de04af248b5609c81baa1a2e9295 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.C @@ -0,0 +1,88 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "indexedVertexEnum.H" +#include "Pstream.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* +Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 10>::names[] = +{ + "Unassigned", + "Internal", + "InternalNearBoundary", + "InternalSurface", + "InternalFeatureEdge", + "InternalFeaturePoint", + "ExternalSurface", + "ExternalFeatureEdge", + "ExternalFeaturePoint", + "Far" +}; + +const Foam::NamedEnum<Foam::indexedVertexEnum::vertexType, 10> +Foam::indexedVertexEnum::vertexTypeNames_; + + +template<> +const char* +Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2>::names[] = +{ + "fixed", + "movable" +}; + +const Foam::NamedEnum<Foam::indexedVertexEnum::vertexMotion, 2> +vertexMotionNames_; + + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const Foam::indexedVertexEnum::vertexType& v +) +{ + os << static_cast<int>(v); + + return os; +} + +Foam::Istream& Foam::operator>> +( + Istream& is, + Foam::indexedVertexEnum::vertexType& v +) +{ + int type; + is >> type; + + v = static_cast<Foam::indexedVertexEnum::vertexType>(type); + + return is; +} + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H new file mode 100644 index 0000000000000000000000000000000000000000..c597d8a17307cf790fee28c068f857c7c5f68691 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexEnum.H @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + indexedVertexEnum + +Description + +SourceFiles + indexedVertexEnum.C + +\*---------------------------------------------------------------------------*/ + +#ifndef indexedVertexEnum_H +#define indexedVertexEnum_H + +#include "NamedEnum.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +class indexedVertexEnum +{ +public: + + enum vertexType + { + vtUnassigned = 0, + vtInternal = 1, + vtInternalNearBoundary = 2, + vtInternalSurface = 3, + vtInternalFeatureEdge = 4, + vtInternalFeaturePoint = 5, + vtExternalSurface = 6, + vtExternalFeatureEdge = 7, + vtExternalFeaturePoint = 8, + vtFar = 9 + }; + + enum vertexMotion + { + fixed = 0, + movable = 1 + }; + + static const Foam::NamedEnum<vertexType, 10> vertexTypeNames_; + + static const Foam::NamedEnum<vertexMotion, 2> vertexMotionNames_; + + friend Ostream& operator<<(Foam::Ostream&, const vertexType&); + + friend Istream& operator>>(Foam::Istream&, vertexType&); +}; + + +template<> +inline bool contiguous<indexedVertexEnum>() +{ + return true; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertexI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H similarity index 56% rename from applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertexI.H rename to applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H index f427316fc544e10a9371d2e1bdce365a9e8dd396..02d37c1b05caa7cd82d4a3d3317cfd5c25121a66 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertexI.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H @@ -21,25 +21,21 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - \*---------------------------------------------------------------------------*/ +#include "Pstream.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class Gt, class Vb> inline CGAL::indexedVertex<Gt, Vb>::indexedVertex() : Vb(), - index_(vtInternal), - type_(vtInternal), - alignment_(), - targetCellSize_(0.0), - vertexFixed_(false), - nearProcBoundary_(false) + type_(vtUnassigned), + index_(vtUnassigned), + processor_(Foam::Pstream::myProcNo()), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) {} @@ -47,12 +43,43 @@ template<class Gt, class Vb> inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p) : Vb(p), - index_(vtInternal), - type_(vtInternal), - alignment_(), - targetCellSize_(0.0), - vertexFixed_(false), - nearProcBoundary_(false) + type_(vtUnassigned), + index_(vtUnassigned), + processor_(Foam::Pstream::myProcNo()), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) +{} + + +template<class Gt, class Vb> +inline CGAL::indexedVertex<Gt, Vb>::indexedVertex +( + const Point& p, + vertexType type +) +: + Vb(p), + type_(type), + index_(-1), + processor_(Foam::Pstream::myProcNo()), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) +{} + + +template<class Gt, class Vb> +inline CGAL::indexedVertex<Gt, Vb>::indexedVertex +( + const Foam::point& p, + vertexType type +) +: + Vb(Point(p.x(), p.y(), p.z())), + type_(type), + index_(-1), + processor_(Foam::Pstream::myProcNo()), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) {} @@ -61,16 +88,16 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex ( const Point& p, int index, - int type + vertexType type, + int processor ) : Vb(p), - index_(index), type_(type), - alignment_(), - targetCellSize_(0.0), - vertexFixed_(false), - nearProcBoundary_(false) + index_(index), + processor_(processor), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) {} @@ -78,12 +105,11 @@ template<class Gt, class Vb> inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p, Cell_handle f) : Vb(f, p), - index_(vtInternal), - type_(vtInternal), - alignment_(), - targetCellSize_(0.0), - vertexFixed_(false), - nearProcBoundary_(false) + type_(vtUnassigned), + index_(vtUnassigned), + processor_(Foam::Pstream::myProcNo()), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) {} @@ -91,12 +117,11 @@ template<class Gt, class Vb> inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(Cell_handle f) : Vb(f), - index_(vtInternal), - type_(vtInternal), - alignment_(), - targetCellSize_(0.0), - vertexFixed_(false), - nearProcBoundary_(false) + type_(vtUnassigned), + index_(vtUnassigned), + processor_(Foam::Pstream::myProcNo()), + alignment_(Foam::tensor::zero), + targetCellSize_(0.0) {} @@ -117,14 +142,16 @@ inline int CGAL::indexedVertex<Gt, Vb>::index() const template<class Gt, class Vb> -inline int& CGAL::indexedVertex<Gt, Vb>::type() +inline typename CGAL::indexedVertex<Gt, Vb>::vertexType& +CGAL::indexedVertex<Gt, Vb>::type() { return type_; } template<class Gt, class Vb> -inline int CGAL::indexedVertex<Gt, Vb>::type() const +inline typename CGAL::indexedVertex<Gt, Vb>::vertexType +CGAL::indexedVertex<Gt, Vb>::type() const { return type_; } @@ -161,7 +188,7 @@ inline Foam::scalar CGAL::indexedVertex<Gt, Vb>::targetCellSize() const template<class Gt, class Vb> inline bool CGAL::indexedVertex<Gt, Vb>::uninitialised() const { - return type_ == vtInternal && index_ == vtInternal; + return type_ == vtUnassigned; } @@ -175,63 +202,41 @@ inline bool CGAL::indexedVertex<Gt, Vb>::farPoint() const template<class Gt, class Vb> inline bool CGAL::indexedVertex<Gt, Vb>::internalPoint() const { - return internalPoint(type_); -} - - -template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::internalPoint(int type) -{ - return type <= vtInternal; + return type_ == vtInternal || type_ == vtInternalNearBoundary; } template<class Gt, class Vb> inline bool CGAL::indexedVertex<Gt, Vb>::referred() const { - return (type_ < 0 && type_ > vtFar); -} - - -template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::referredInternalOrBoundaryPoint() const -{ - return referred() && index_ >= 0; -} - + // Can't be zero as the first few points are far points which won't be + // referred + //return index_ < 0; -template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::referredExternal() const -{ - return referred() && index_ < 0; + // processor_ will be take the value of the processor that this vertex is + // from, so it cannot be on this processor. + return processor_ != Foam::Pstream::myProcNo(); } template<class Gt, class Vb> inline bool CGAL::indexedVertex<Gt, Vb>::real() const { - return internalPoint() || pairPoint(); + return (internalPoint() || boundaryPoint()) && !referred(); } template<class Gt, class Vb> inline int CGAL::indexedVertex<Gt, Vb>::procIndex() const { - if (referred()) - { - return -(type_ + 1); - } - else - { - return -1; - } + return processor_; } template<class Gt, class Vb> -inline int CGAL::indexedVertex<Gt, Vb>::encodeProcIndex(int procI) +inline int& CGAL::indexedVertex<Gt, Vb>::procIndex() { - return -(procI + 1); + return processor_; } @@ -245,115 +250,85 @@ inline void CGAL::indexedVertex<Gt, Vb>::setInternal() template<class Gt, class Vb> inline bool CGAL::indexedVertex<Gt, Vb>::nearBoundary() const { - return type_ == vtNearBoundary; + return type_ == vtInternalNearBoundary; } template<class Gt, class Vb> inline void CGAL::indexedVertex<Gt, Vb>::setNearBoundary() { - type_ = vtNearBoundary; -} - - -template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::nearProcBoundary() const -{ - return nearProcBoundary_; -} - - -template<class Gt, class Vb> -inline void CGAL::indexedVertex<Gt, Vb>::setNearProcBoundary() -{ - nearProcBoundary_ = true; + type_ = vtInternalNearBoundary; } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::pairPoint() const +inline bool CGAL::indexedVertex<Gt, Vb>::boundaryPoint() const { - return type_ >= 0; + return type_ >= vtInternalSurface && !farPoint(); } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::ppMaster() const -{ - return ppMaster(index_, type_); -} - - -template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::ppMaster(int index, int type) +inline bool CGAL::indexedVertex<Gt, Vb>::internalOrBoundaryPoint() const { - if (index >= 0 && type > index) - { - return true; - } - - return false; + return internalPoint() || internalBoundaryPoint(); } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::ppSlave() const +inline bool CGAL::indexedVertex<Gt, Vb>::nearOrOnBoundary() const { - if (type_ >= 0 && type_ < index_) - { - return true; - } - else - { - return false; - } + return boundaryPoint() || nearBoundary(); } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::internalOrBoundaryPoint() const +inline bool CGAL::indexedVertex<Gt, Vb>::internalBoundaryPoint() const { - return internalOrBoundaryPoint(index_, type_); + return type_ >= vtInternalSurface && type_ <= vtInternalFeaturePoint; } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::internalOrBoundaryPoint -( - int index, - int type -) +inline bool CGAL::indexedVertex<Gt, Vb>::externalBoundaryPoint() const { - return internalPoint(type) || ppMaster(index, type); + return type_ >= vtExternalSurface && type_ <= vtExternalFeaturePoint; } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::nearOrOnBoundary() const +inline bool CGAL::indexedVertex<Gt, Vb>::featurePoint() const { - return pairPoint() || nearBoundary(); + return type_ == vtInternalFeaturePoint || type_ == vtExternalFeaturePoint; } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::anyInternalOrBoundaryPoint() const +inline bool CGAL::indexedVertex<Gt, Vb>::featureEdgePoint() const { - return internalOrBoundaryPoint() || referredInternalOrBoundaryPoint(); + return type_ == vtInternalFeatureEdge || type_ == vtExternalFeatureEdge; } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::isVertexFixed() const +inline bool CGAL::indexedVertex<Gt, Vb>::surfacePoint() const { - return vertexFixed_; + return type_ == vtInternalSurface || type_ == vtExternalSurface; } -template<class Gt, class Vb> -inline void CGAL::indexedVertex<Gt, Vb>::setVertexFixed() -{ - vertexFixed_ = true; -} +//template<class Gt, class Vb> +//inline bool CGAL::indexedVertex<Gt, Vb>::isVertexFixed() const +//{ +// return vertexFixed_; +//} +// +// +//template<class Gt, class Vb> +//inline void CGAL::indexedVertex<Gt, Vb>::setVertexFixed() +//{ +// vertexFixed_ = true; +//} // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointConversion.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointConversion.H new file mode 100644 index 0000000000000000000000000000000000000000..6242a3a6feab4f4ccd89542efe3bca4c29a07a55 --- /dev/null +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointConversion.H @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + pointConversion + +Description + + Conversion functions between point (FOAM::) and Point (CGAL) + +\*---------------------------------------------------------------------------*/ + +#ifndef pointConversion_H +#define pointConversion_H + +#include "point.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef CGAL_INEXACT + + // Define Point to be contiguous for inexact (double storage) kernel + typedef const Foam::point& pointFromPoint; + typedef const CGAL::Triangulation_vertex_base_3<K>::Point& PointFrompoint; + +#else + + typedef Foam::point pointFromPoint; + typedef CGAL::Triangulation_vertex_base_3<K>::Point PointFrompoint; + +#endif + +namespace Foam +{ + +#ifdef CGAL_INEXACT + + template<typename Point> + inline pointFromPoint topoint(const Point& P) + { + return reinterpret_cast<pointFromPoint>(P); + } + + template<typename Point> + inline PointFrompoint toPoint(const Foam::point& p) + { + return reinterpret_cast<PointFrompoint>(p); + } + +#else + + template<typename Point> + inline pointFromPoint topoint(const Point& P) + { + return Foam::point + ( + CGAL::to_double(P.x()), + CGAL::to_double(P.y()), + CGAL::to_double(P.z()) + ); + } + + template<typename Point> + inline Point toPoint(const Foam::point& p) + { + return Point(p.x(), p.y(), p.z()); + } + +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H index 8838487f1e5dae657ced3fe3fab48b6e7a154b84..5bae06d86f198c3e8bd8ec49cea7bed9c3168cf7 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - Class pointFeatureEdgesTypes @@ -48,28 +43,39 @@ namespace Foam \*---------------------------------------------------------------------------*/ //- Hold the types of feature edges attached to the point. -struct pointFeatureEdgesTypes +class pointFeatureEdgesTypes +: + public HashTable<label, extendedFeatureEdgeMesh::edgeStatus> { - label ptI; - label nExternal, nInternal; - label nFlat, nOpen, nMultiple, nNonFeature; + label pointLabel_; + +public: pointFeatureEdgesTypes(const label pointLabel) - { - ptI = pointLabel; - nExternal = nInternal = 0; - nFlat = nOpen = nMultiple = nNonFeature = 0; - } + : + HashTable<label, extendedFeatureEdgeMesh::edgeStatus>(), + pointLabel_(pointLabel) + {} + friend Ostream& operator<<(Ostream& os, const pointFeatureEdgesTypes& p) { - os << "E " << "I " << "F " << "O " << "M " << "N " - << "Pt" << nl - << p.nExternal << " " << p.nInternal << " " - << p.nFlat << " " << p.nOpen << " " - << p.nMultiple << " " << p.nNonFeature << " " - << p.ptI - << endl; + os << "Point = " << p.pointLabel_ << endl; + + for + ( + HashTable<label, extendedFeatureEdgeMesh::edgeStatus> + ::const_iterator iter = p.cbegin(); + iter != p.cend(); + ++iter + ) + { + os << " " + << extendedFeatureEdgeMesh::edgeStatusNames_[iter.key()] + << " = " + << iter() + << endl; + } return os; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C index 50d2384f24c149d8d573363d5469a283065f20bf..64f753fb99d102e5309f06c345f36c4bd996c590 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.C @@ -117,7 +117,6 @@ Foam::conformationSurfaces::conformationSurfaces } } - word featureMethod = surfaceSubDict.lookup("featureMethod"); if (featureMethod == "extendedFeatureEdgeMesh") @@ -230,7 +229,12 @@ Foam::conformationSurfaces::conformationSurfaces // Extend the global bounds to stop the bound box sitting on the surfaces // to be conformed to - globalBounds_ = globalBounds_.extend(rndGen_, 1e-4); + //globalBounds_ = globalBounds_.extend(rndGen_, 1e-4); + + vector newSpan = 1e-4*globalBounds_.span(); + + globalBounds_.min() -= newSpan; + globalBounds_.max() += newSpan; // Look at all surfaces at determine whether the locationInMesh point is // inside or outside each, to establish a signature for the domain to be diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.H index c1bdac76ba2ef772c19fc9dce17e3eadbd3f10fa..3acb10d53a86eefb61b311a240cd89244c82c815 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformationSurfaces/conformationSurfaces.H @@ -45,9 +45,6 @@ SourceFiles namespace Foam { -// Forward declaration of classes -class conformalVoronoiMesh; - /*---------------------------------------------------------------------------*\ Class conformationSurfaces Declaration \*---------------------------------------------------------------------------*/ diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.C index 15c82e64c5c9a9fdbb47ec73dc2affedc48bf7be..e65cbea4e9ebbbb7bfc6517418f44311998fd2b4 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.C @@ -84,126 +84,42 @@ Foam::cvControls::cvControls // Controls for coarse surface conformation - const dictionary& coarseDict + const dictionary& conformationControlsDict ( - surfDict.subDict("coarseConformationControls") - ); - - const dictionary& coarseInitialDict - ( - coarseDict.subDict("initial") - ); - - const dictionary& coarseIterationDict - ( - coarseDict.subDict("iteration") + surfDict.subDict("conformationControls") ); surfacePtExclusionDistanceCoeff_ = readScalar ( - coarseInitialDict.lookup("surfacePtExclusionDistanceCoeff") - ); - - edgeSearchDistCoeffSqr_coarse_initial_ = sqr - ( - readScalar - ( - coarseInitialDict.lookup("edgeSearchDistCoeff") - ) - ); - - edgeSearchDistCoeffSqr_coarse_iteration_ = sqr - ( - readScalar - ( - coarseIterationDict.lookup("edgeSearchDistCoeff") - ) - ); - - surfacePtReplaceDistCoeffSqr_coarse_initial_ = sqr - ( - readScalar - ( - coarseInitialDict.lookup("surfacePtReplaceDistCoeff") - ) - ); - - surfacePtReplaceDistCoeffSqr_coarse_iteration_ = sqr - ( - readScalar - ( - coarseIterationDict.lookup("surfacePtReplaceDistCoeff") - ) - ); - - maxConformationIterations_coarse_ = readLabel - ( - coarseDict.lookup("maxIterations") - ); - - iterationToInitialHitRatioLimit_coarse_ = readScalar - ( - coarseDict.lookup("iterationToInitialHitRatioLimit") - ); - - // Controls for fine surface conformation - - const dictionary& fineDict - ( - surfDict.subDict("fineConformationControls") - ); - - const dictionary& fineInitialDict - ( - fineDict.subDict("initial") - ); - - const dictionary& fineIterationDict - ( - fineDict.subDict("iteration") + conformationControlsDict.lookup("surfacePtExclusionDistanceCoeff") ); - edgeSearchDistCoeffSqr_fine_initial_ = sqr + edgeSearchDistCoeffSqr_ = sqr ( readScalar ( - fineInitialDict.lookup("edgeSearchDistCoeff") + conformationControlsDict.lookup("edgeSearchDistCoeff") ) ); - edgeSearchDistCoeffSqr_fine_iteration_ = sqr + surfacePtReplaceDistCoeffSqr_ = sqr ( readScalar ( - fineIterationDict.lookup("edgeSearchDistCoeff") + conformationControlsDict.lookup("surfacePtReplaceDistCoeff") ) ); - surfacePtReplaceDistCoeffSqr_fine_initial_ = sqr + maxConformationIterations_ = readLabel ( - readScalar - ( - fineInitialDict.lookup("surfacePtReplaceDistCoeff") - ) - ); - - surfacePtReplaceDistCoeffSqr_fine_iteration_ = sqr - ( - readScalar - ( - fineIterationDict.lookup("surfacePtReplaceDistCoeff") - ) + conformationControlsDict.lookup("maxIterations") ); - maxConformationIterations_fine_ = readLabel + iterationToInitialHitRatioLimit_ = readScalar ( - fineDict.lookup("maxIterations") + conformationControlsDict.lookup("iterationToInitialHitRatioLimit") ); - iterationToInitialHitRatioLimit_fine_ = readScalar - ( - fineDict.lookup("iterationToInitialHitRatioLimit") - ); // Motion control controls @@ -279,248 +195,22 @@ Foam::cvControls::cvControls const dictionary& filteringDict(cvMeshDict_.subDict("polyMeshFiltering")); - writeTetDualMesh_ = Switch(filteringDict.lookup("writeTetDualMesh")); - - filterSizeCoeff_ = readScalar - ( - filteringDict.lookup("filterSizeCoeff") - ); - - mergeClosenessCoeff_ = readScalar - ( - filteringDict.lookup("mergeClosenessCoeff") - ); - - edgeMergeAngle_ = readScalar - ( - filteringDict.lookup("edgeMergeAngle") - ); - - continueFilteringOnBadInitialPolyMesh_ = Switch - ( - filteringDict.lookupOrDefault<Switch> - ( - "continueFilteringOnBadInitialPolyMesh", - false - ) - ); - - filterErrorReductionCoeff_ = readScalar - ( - filteringDict.lookup("filterErrorReductionCoeff") - ); - - filterCountSkipThreshold_ = readLabel - ( - filteringDict.lookup("filterCountSkipThreshold") - ); - - maxCollapseIterations_ = readLabel - ( - filteringDict.lookup("maxCollapseIterations") - ); - - maxConsecutiveEqualFaceSets_ = readLabel - ( - filteringDict.lookup("maxConsecutiveEqualFaceSets") - ); - - surfaceStepFaceAngle_ = readScalar - ( - filteringDict.lookup("surfaceStepFaceAngle") - ); - - edgeCollapseGuardFraction_ = readScalar + filterEdges_ = Switch ( - filteringDict.lookup("edgeCollapseGuardFraction") + filteringDict.lookupOrDefault<Switch>("filterEdges", true) ); - maxCollapseFaceToPointSideLengthCoeff_ = readScalar + filterFaces_ = Switch ( - filteringDict.lookup("maxCollapseFaceToPointSideLengthCoeff") + filteringDict.lookupOrDefault<Switch>("filterFaces", false) ); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::cvControls::edgeSearchDistCoeffSqrInitial -( - int reconfMode -) const -{ - if (reconfMode == conformalVoronoiMesh::rmCoarse) - { - return edgeSearchDistCoeffSqr_coarse_initial_; - } - - else if (reconfMode == conformalVoronoiMesh::rmFine) - { - return edgeSearchDistCoeffSqr_fine_initial_; - } - else - { - FatalErrorIn - ( - "Foam::cvControls::edgeSearchDistCoeffSqrInitial" - "(" - "int reconfMode" - ") const" - ) << "Unknown reconformationMode " << reconfMode - << exit(FatalError); - } - - return 0; -} - - -Foam::scalar Foam::cvControls::edgeSearchDistCoeffSqrIteration -( - int reconfMode -) const -{ - if (reconfMode == conformalVoronoiMesh::rmCoarse) - { - return edgeSearchDistCoeffSqr_coarse_iteration_; - } - - else if (reconfMode == conformalVoronoiMesh::rmFine) - { - return edgeSearchDistCoeffSqr_fine_iteration_; - } - else - { - FatalErrorIn - ( - "Foam::cvControls::edgeSearchDistCoeffSqrIteration" - "(" - "int reconfMode" - ") const" - ) << "Unknown reconformationMode " << reconfMode - << exit(FatalError); - } - - return 0; -} - - -Foam::scalar Foam::cvControls::surfacePtReplaceDistCoeffSqrInitial -( - int reconfMode -) const -{ - if (reconfMode == conformalVoronoiMesh::rmCoarse) - { - return surfacePtReplaceDistCoeffSqr_coarse_initial_; - } - - else if (reconfMode == conformalVoronoiMesh::rmFine) - { - return surfacePtReplaceDistCoeffSqr_fine_initial_; - } - else - { - FatalErrorIn - ( - "Foam::cvControls::surfacePtReplaceDistCoeffSqrInitial" - "(" - "int reconfMode" - ") const" - ) << "Unknown reconformationMode " << reconfMode - << exit(FatalError); - } - - return 0; -} - - -Foam::scalar Foam::cvControls::surfacePtReplaceDistCoeffSqrIteration -( - int reconfMode -) const -{ - if (reconfMode == conformalVoronoiMesh::rmCoarse) - { - return surfacePtReplaceDistCoeffSqr_coarse_iteration_; - } - - else if (reconfMode == conformalVoronoiMesh::rmFine) - { - return surfacePtReplaceDistCoeffSqr_fine_iteration_; - } - else - { - FatalErrorIn - ( - "Foam::cvControls::surfacePtReplaceDistCoeffSqrIteration" - "(" - "int reconfMode" - ") const" - ) << "Unknown reconformationMode " << reconfMode - << exit(FatalError); - } - - return 0; -} - - -Foam::label Foam::cvControls::maxConformationIterations -( - int reconfMode -) const -{ - if (reconfMode == conformalVoronoiMesh::rmCoarse) - { - return maxConformationIterations_coarse_; - } - - else if (reconfMode == conformalVoronoiMesh::rmFine) - { - return maxConformationIterations_fine_; - } - else - { - FatalErrorIn - ( - "Foam::cvControls::maxConformationIterations" - "(" - "int reconfMode" - ") const" - ) << "Unknown reconformationMode " << reconfMode - << exit(FatalError); - } - - return 0; -} - -Foam::scalar Foam::cvControls::iterationToInitialHitRatioLimit -( - int reconfMode -) const -{ - if (reconfMode == conformalVoronoiMesh::rmCoarse) + if (filterFaces_) { - return iterationToInitialHitRatioLimit_coarse_; + filterEdges_ = Switch::ON; } - else if (reconfMode == conformalVoronoiMesh::rmFine) - { - return iterationToInitialHitRatioLimit_fine_; - } - else - { - FatalErrorIn - ( - "Foam::cvControls::iterationToInitialHitRatioLimit" - "(" - "int reconfMode" - ") const" - ) << "Unknown reconformationMode " << reconfMode - << exit(FatalError); - } - - return 0; + writeTetDualMesh_ = Switch(filteringDict.lookup("writeTetDualMesh")); } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.H index 58dd06fc741ee6b1c88dc14a5d1cd6756de93692..e8184753b0b6af1bf2914e4c8a4b20dae8cd6811 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControls.H @@ -37,6 +37,7 @@ SourceFiles #include "dictionary.H" #include "Switch.H" +#include "vector.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -106,74 +107,21 @@ class cvControls //- Distance to search for feature edges near to // surface protrusions - fraction of the local target - // cell size. Coarse conformation, initial protrusion - // tests. - scalar edgeSearchDistCoeffSqr_coarse_initial_; - - //- Distance to search for feature edges near to - // surface protrusions - fraction of the local target - // cell size. Coarse conformation, iteration - // protrusion tests. - scalar edgeSearchDistCoeffSqr_coarse_iteration_; - - //- Proximity to a feature edge where a surface hit is - // not created, only the edge conformation is created - // - fraction of the local target cell size. Coarse - // conformation, initial protrusion tests. - scalar surfacePtReplaceDistCoeffSqr_coarse_initial_; + // cell size. + scalar edgeSearchDistCoeffSqr_; //- Proximity to a feature edge where a surface hit is // not created, only the edge conformation is created - // - fraction of the local target cell size. Coarse - // conformation, iteration protrusion tests. - scalar surfacePtReplaceDistCoeffSqr_coarse_iteration_; + // - fraction of the local target cell size. + scalar surfacePtReplaceDistCoeffSqr_; - //- Maximum allowed number coarse surface conformation - // iterations. - label maxConformationIterations_coarse_; + //- Maximum allowed number surface conformation iterations. + label maxConformationIterations_; - //- Termination criterion for coarse surface - // conformation iterations. When the number of - // surface protrusions drops below this ratio of the - // initial number of protrusions. - scalar iterationToInitialHitRatioLimit_coarse_; - - - // Controls for fine surface conformation - - //- Distance to search for feature edges near to - // surface protrusions - fraction of the local target - // cell size. Fine conformation, initial protrusion - // tests. - scalar edgeSearchDistCoeffSqr_fine_initial_; - - //- Distance to search for feature edges near to - // surface protrusions - fraction of the local target - // cell size. Fine conformation, iteration protrusion - // tests. - scalar edgeSearchDistCoeffSqr_fine_iteration_; - - //- Proximity to a feature edge where a surface hit is - // not created, only the edge conformation is created - // - fraction of the local target cell size. Fine - // conformation, initial protrusion tests. - scalar surfacePtReplaceDistCoeffSqr_fine_initial_; - - //- Proximity to a feature edge where a surface hit is - // not created, only the edge conformation is created - // - fraction of the local target cell size. Fine - // conformation, iteration protrusion tests. - scalar surfacePtReplaceDistCoeffSqr_fine_iteration_; - - //- Maximum allowed number fine surface conformation - // iterations. - label maxConformationIterations_fine_; - - //- Termination criterion for fine surface conformation - // iterations. When the number of surface protrusions - // drops below this ratio of the initial number of - // protrusions. - scalar iterationToInitialHitRatioLimit_fine_; + //- Termination criterion for conformation iterations. + // When the number of surface protrusions drops below this + // ratio of the initial number of protrusions. + scalar iterationToInitialHitRatioLimit_; // Motion control controls @@ -198,6 +146,7 @@ class cvControls //- Now often to re-store the size and alignment data label sizeAndAlignmentRebuildFrequency_; + // Point insertion criteria //- Length between Delaunay vertices above which a new Dv should be @@ -223,66 +172,14 @@ class cvControls // polyMesh filtering controls - //- Write tet mesh at output time (it always writes the Voronoi) - Switch writeTetDualMesh_; + //- Activates the mesh edge filtering. On by default. + Switch filterEdges_; - //- Upper limit on the size of faces to be filtered from, - // fraction of the local target cell size - scalar filterSizeCoeff_; - - //- Upper limit on how close two dual vertices can be before - // being merged, fraction of the local target cell size - scalar mergeClosenessCoeff_; - - //- If the angle between two dual edges that are connected by a single - // point is less than this angle, then the edges will be merged into a - // single edge. - scalar edgeMergeAngle_; - - //- If the mesh quality criteria cannot be satisfied, continue - // with filtering anyway? - Switch continueFilteringOnBadInitialPolyMesh_; - - //- When a face is "bad", what fraction should the filterSizeCoeff_ be - // reduced by. Recursive, so for a filterCount value of fC, the - // filterSizeCoeff is reduced by pow(filterErrorReductionCoeff_, fC) - scalar filterErrorReductionCoeff_; - - //- Maximum number of filterCount applications before a face - // is not attempted to be filtered - label filterCountSkipThreshold_; - - //- Maximum number of permissible iterations of the face collapse - // algorithm. The value to choose will be related the maximum number - // of points on a face that is to be collapsed and how many faces - // around it need to be collapsed. - label maxCollapseIterations_; - - //- Maximum number of times an to allow an equal faceSet to be - // returned from the face quality assessment before stopping iterations - // to break an infinitie loop. - label maxConsecutiveEqualFaceSets_; - - //- The maximum allowed angle between a boundary face normal and the - // local surface normal before face will be aggressively collapsed - scalar surfaceStepFaceAngle_; - - //- Defining how close to the midpoint (M) of the projected - // vertices line a projected vertex (X) can be before making - // an edge collapse invalid - // - // X---X-g----------------M----X-----------g----X--X - // - // Only allow a collapse if all projected vertices are - // outwith edgeCollapseGuardFraction (g) of the distance form - // the face centre to the furthest vertex in the considered - // direction - scalar edgeCollapseGuardFraction_; + //- Activates the mesh face filtering. Off by default. + Switch filterFaces_; - //- The maximum allowed length of the longest edge of a face - // to enable a face to be collapsed to a point, fraction of - // the local target cell size - scalar maxCollapseFaceToPointSideLengthCoeff_; + //- Write tet mesh at output time (it always writes the Voronoi) + Switch writeTetDualMesh_; // Private Member Functions @@ -346,30 +243,17 @@ public: //- Return the surfaceConformationRebuildFrequency inline label surfaceConformationRebuildFrequency() const; - //- Return the edgeSearchDistCoeffSqr for initial - // conformation for the given reconformationMode. - scalar edgeSearchDistCoeffSqrInitial(int reconfMode) const; - - //- Return the edgeSearchDistCoeffSqr for conformation - // iterations for the given reconformationMode. - scalar edgeSearchDistCoeffSqrIteration(int reconfMode) const; + //- Return the edgeSearchDistCoeffSqr for conformation. + scalar edgeSearchDistCoeffSqr() const; - //- Return the surfacePtReplaceDistCoeffSqr for initial - // conformation for the given reconformationMode. - scalar surfacePtReplaceDistCoeffSqrInitial(int reconfMode) const; + //- Return the surfacePtReplaceDistCoeffSqr for conformation. + scalar surfacePtReplaceDistCoeffSqr() const; - //- Return the surfacePtReplaceDistCoeffSqr for - // conformation iterations for the given - // reconformationMode. - scalar surfacePtReplaceDistCoeffSqrIteration(int reconfMode) const; + //- Return the maxConformationIterations + label maxConformationIterations() const; - //- Return the maxConformationIterations for the given - // reconformationMode. - label maxConformationIterations(int reconfMode) const; - - //- Return the iterationToInitialHitRatioLimit for the - // given reconformationMode. - scalar iterationToInitialHitRatioLimit(int reconfMode) const; + //- Return the iterationToInitialHitRatioLimit + scalar iterationToInitialHitRatioLimit() const; //- Return the objOutput Switch inline Switch objOutput() const; @@ -389,6 +273,12 @@ public: //- Return the sizeAndAlignmentRebuildFrequency inline label sizeAndAlignmentRebuildFrequency() const; + //- Return the aspectRatio + inline scalar aspectRatio() const; + + //- Return the aspectRatioDirection + inline const vector& aspectRatioDirection() const; + //- Return the insertionDistCoeff inline scalar insertionDistCoeff() const; @@ -401,44 +291,14 @@ public: //- Return removalDistCoeff inline scalar removalDistCoeff() const; - //- Write tetMesh at output time - inline Switch writeTetDualMesh() const; - - //- Return the filterSizeCoeff - inline scalar filterSizeCoeff() const; + //- Filter edges at output time + inline Switch filterEdges() const; - //- Return the mergeClosenessCoeff - inline scalar mergeClosenessCoeff() const; + //- Filter faces at output time + inline Switch filterFaces() const; - //- Return the edgeMergeAngle - inline scalar edgeMergeAngle() const; - - //- Return the continueFilteringOnBadInitialPolyMesh Switch - inline Switch continueFilteringOnBadInitialPolyMesh() const; - - //- Return the filterErrorReductionCoeff - inline scalar filterErrorReductionCoeff() const; - - //- Return the maxCollapseIterations - inline label maxCollapseIterations() const; - - //- Return the maxConsecutiveEqualFaceSets - inline label maxConsecutiveEqualFaceSets() const; - - //- Return the filterCountSkipThreshold - inline label filterCountSkipThreshold() const; - - //- Return the maxCollapseIterations - inline label minCollapseFaces() const; - - //- Return the surfaceStepFaceAngle - inline scalar surfaceStepFaceAngle() const; - - //- Return the edgeCollapseGuardFraction - inline scalar edgeCollapseGuardFraction() const; - - //- Return the maxCollapseFaceToPointSideLengthCoeff - inline scalar maxCollapseFaceToPointSideLengthCoeff() const; + //- Write tetMesh at output time + inline Switch writeTetDualMesh() const; }; diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControlsI.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControlsI.H index 50df7e8f5841b36d61322b0931f6840a4de52cf1..befc7b5666ac0c84f320419ae0fa69e481c728fa 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControlsI.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/cvControls/cvControlsI.H @@ -88,6 +88,30 @@ inline Foam::label Foam::cvControls::surfaceConformationRebuildFrequency() const } +inline Foam::scalar Foam::cvControls::edgeSearchDistCoeffSqr() const +{ + return edgeSearchDistCoeffSqr_; +} + + +inline Foam::scalar Foam::cvControls::surfacePtReplaceDistCoeffSqr() const +{ + return surfacePtReplaceDistCoeffSqr_; +} + + +inline Foam::label Foam::cvControls::maxConformationIterations() const +{ + return maxConformationIterations_; +} + + +inline Foam::scalar Foam::cvControls::iterationToInitialHitRatioLimit() const +{ + return iterationToInitialHitRatioLimit_; +} + + inline Foam::Switch Foam::cvControls::objOutput() const { return objOutput_; @@ -148,77 +172,19 @@ inline Foam::scalar Foam::cvControls::removalDistCoeff() const } -inline Foam::Switch Foam::cvControls::writeTetDualMesh() const -{ - return writeTetDualMesh_; -} - - -inline Foam::scalar Foam::cvControls::filterSizeCoeff() const -{ - return filterSizeCoeff_; -} - - -inline Foam::scalar Foam::cvControls::mergeClosenessCoeff() const -{ - return mergeClosenessCoeff_; -} - - -inline Foam::scalar Foam::cvControls::edgeMergeAngle() const -{ - return edgeMergeAngle_; -} - - -inline Foam::Switch -Foam::cvControls::continueFilteringOnBadInitialPolyMesh() const +inline Foam::Switch Foam::cvControls::filterEdges() const { - return continueFilteringOnBadInitialPolyMesh_; + return filterEdges_; } - -inline Foam::scalar Foam::cvControls::filterErrorReductionCoeff() const +inline Foam::Switch Foam::cvControls::filterFaces() const { - return filterErrorReductionCoeff_; + return filterFaces_; } - -inline Foam::label Foam::cvControls::filterCountSkipThreshold() const -{ - return filterCountSkipThreshold_; -} - - -inline Foam::label Foam::cvControls::maxCollapseIterations() const -{ - return maxCollapseIterations_; -} - - -inline Foam::label Foam::cvControls::maxConsecutiveEqualFaceSets() const -{ - return maxConsecutiveEqualFaceSets_; -} - - -inline Foam::scalar Foam::cvControls::surfaceStepFaceAngle() const -{ - return surfaceStepFaceAngle_; -} - - -inline Foam::scalar Foam::cvControls::edgeCollapseGuardFraction() const -{ - return edgeCollapseGuardFraction_; -} - - -inline Foam::scalar -Foam::cvControls::maxCollapseFaceToPointSideLengthCoeff() const +inline Foam::Switch Foam::cvControls::writeTetDualMesh() const { - return maxCollapseFaceToPointSideLengthCoeff_; + return writeTetDualMesh_; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C index 2b7d83f2b2ae1c7e37d187eae1a54e2255b471e0..0aace4f77fca09c19a7c72a0d1873672bdd62762 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/autoDensity/autoDensity.C @@ -339,7 +339,7 @@ bool Foam::autoDensity::fillBox pointField corners(bb.points()); - scalarField cornerSizes = cvMesh_.cellSizeControl().cellSize(corners); + scalarField cornerSizes = cvMesh_.cellShapeControls().cellSize(corners); Field<bool> insideCorners = combinedWellInside(corners, cornerSizes); @@ -448,7 +448,7 @@ bool Foam::autoDensity::fillBox ); } - lineSizes = cvMesh_.cellSizeControl().cellSize(linePoints); + lineSizes = cvMesh_.cellShapeControls().cellSize(linePoints); Field<bool> insideLines = combinedWellInside ( @@ -547,7 +547,7 @@ bool Foam::autoDensity::fillBox // corner when only some these points are required. shuffle(samplePoints); - scalarField sampleSizes = cvMesh_.cellSizeControl().cellSize + scalarField sampleSizes = cvMesh_.cellShapeControls().cellSize ( samplePoints ); @@ -713,7 +713,7 @@ bool Foam::autoDensity::fillBox point p = min + cmptMultiply(span, rnd.vector01()); - scalar localSize = cvMesh_.cellSizeControl().cellSize(p); + scalar localSize = cvMesh_.cellShapeControls().cellSize(p); bool insidePoint = false; diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C index 751a743e6d9c0b705985156c2b40e1754c70b942..c69e7ac8fb314d334c595d103e9dd70ffe7fd9fc 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/bodyCentredCubic/bodyCentredCubic.C @@ -167,7 +167,7 @@ List<Vb::Point> bodyCentredCubic::initialPoints() const minimumSurfaceDistanceCoeffSqr_ *sqr ( - cvMesh_.cellSizeControl().cellSize(points) + cvMesh_.cellShapeControls().cellSize(points) ) ); diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C index a1c1f383b068728f3b6d7edf69675a2940495cc8..af2e7dfbf4d833d0e76585bc8c322bad152aa3a9 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/faceCentredCubic/faceCentredCubic.C @@ -228,7 +228,7 @@ List<Vb::Point> faceCentredCubic::initialPoints() const minimumSurfaceDistanceCoeffSqr_ *sqr ( - cvMesh_.cellSizeControl().cellSize(points) + cvMesh_.cellShapeControls().cellSize(points) ) ); diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C index eb67cf60e241507af524755b8340142b14ea6600..19861f3e817b26968eca7e463f5ab5e01dddfdda 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/pointFile/pointFile.C @@ -132,7 +132,7 @@ List<Vb::Point> pointFile::initialPoints() const minimumSurfaceDistanceCoeffSqr_ *sqr ( - cvMesh_.cellSizeControl().cellSize(points) + cvMesh_.cellShapeControls().cellSize(points) ) ); diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C index 3bc914ea43b36ac1e70a4e461a2302e594aeb176..2538c90702d18efb3548ead731d88ab57bacf1ae 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/initialPointsMethod/uniformGrid/uniformGrid.C @@ -144,7 +144,7 @@ List<Vb::Point> uniformGrid::initialPoints() const minimumSurfaceDistanceCoeffSqr_ *sqr ( - cvMesh_.cellSizeControl().cellSize(points) + cvMesh_.cellShapeControls().cellSize(points) ) ); diff --git a/applications/utilities/mesh/generation/cvMesh/cvMesh.C b/applications/utilities/mesh/generation/cvMesh/cvMesh.C index ecd7f102baa7ab22e1161473c7defc665ef58a3d..e9487b909b8bafca164f8aa01d8ee6f299bd26dd 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/cvMesh.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 @@ -21,11 +21,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - As a special exception, you have permission to link this program with the - CGAL library and distribute executables, as long as you follow the - requirements of the GNU GPL in regard to all of the software in the - executable aside from CGAL. - Application cvMesh @@ -36,6 +31,7 @@ Description #include "argList.H" #include "conformalVoronoiMesh.H" +#include "vtkSetWriter.H" using namespace Foam; @@ -43,10 +39,10 @@ using namespace Foam; int main(int argc, char *argv[]) { - argList::addBoolOption + Foam::argList::addBoolOption ( - "noFilter", - "Do not filter the mesh" + "checkGeometry", + "check all surface geometry for quality" ); #include "setRootCase.H" @@ -54,9 +50,7 @@ int main(int argc, char *argv[]) runTime.functionObjects().off(); - const bool noFilter = !args.optionFound("noFilter"); - - Info<< "Mesh filtering is " << (noFilter ? "on" : "off") << endl; + const bool checkGeometry = args.optionFound("checkGeometry"); IOdictionary cvMeshDict ( @@ -70,10 +64,46 @@ int main(int argc, char *argv[]) ) ); + + if (checkGeometry) + { + const searchableSurfaces allGeometry + ( + IOobject + ( + "cvSearchableSurfaces", + runTime.constant(), + "triSurface", + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + cvMeshDict.subDict("geometry") + ); + + // Write some stats + allGeometry.writeStats(List<wordList>(0), Info); + // Check topology + allGeometry.checkTopology(true); + // Check geometry + allGeometry.checkGeometry + ( + 100.0, // max size ratio + 1e-9, // intersection tolerance + autoPtr<writer<scalar> >(new vtkSetWriter<scalar>()), + 0.01, // min triangle quality + true + ); + + return 0; + } + + conformalVoronoiMesh::debug = true; conformalVoronoiMesh mesh(runTime, cvMeshDict); + while (runTime.loop()) { Info<< nl << "Time = " << runTime.timeName() << endl; @@ -82,15 +112,9 @@ int main(int argc, char *argv[]) Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; + << endl; } - mesh.writeMesh(runTime.constant(), noFilter); - - Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - Info<< nl << "End" << nl << endl; return 0; diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options b/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options index 2d1ad7bfdae88ad8cc5e9c295859aacad27d7198..0322435c8c9c6d6512c5e3ec2e0a91e08199d84f 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/Make/options @@ -11,21 +11,23 @@ EXE_INC = \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I../vectorTools EXE_LIBS = \ $(CGAL_LIBS) \ -lboost_thread \ -lmpfr \ + -lgmp \ -lconformalVoronoiMesh \ -ldecompositionMethods /* -L$(FOAM_LIBBIN)/dummy -lscotchDecomp */ \ -ledgeMesh \ - -lsampling \ -ltriSurface \ -lmeshTools \ + -lfileFormats \ + -lsampling \ -ldynamicMesh \ -lfiniteVolume diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/cvMeshBackgroundMesh.C b/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/cvMeshBackgroundMesh.C index 485c5568b4846f077ba4e6aabed1ccee647a91ff..53766c59a02c2209f86ae725362b7a24eb8edeb5 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/cvMeshBackgroundMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshBackgroundMesh/cvMeshBackgroundMesh.C @@ -36,7 +36,7 @@ Description #include "triSurface.H" #include "searchableSurfaces.H" #include "conformationSurfaces.H" -#include "cellSizeControlSurfaces.H" +#include "cellShapeControl.H" #include "backgroundMeshDecomposition.H" #include "cellShape.H" #include "cellModeller.H" @@ -450,10 +450,15 @@ int main(int argc, char *argv[]) cvMeshDict.subDict("surfaceConformation") ); - cellSizeControlSurfaces cellSizeControl + autoPtr<cellShapeControl> cellShapeControls ( - allGeometry, - cvMeshDict.subDict("motionControl") + cellShapeControl::New + ( + runTime, + cvMeshDict.subDict("motionControl"), + allGeometry, + geometryToConformTo + ) ); @@ -464,7 +469,7 @@ int main(int argc, char *argv[]) // Determine the number of cells in each direction. const vector span = bb.span(); - vector nScalarCells = span/cellSizeControl.defaultCellSize(); + vector nScalarCells = span/cellShapeControls().defaultCellSize(); // Calculate initial cell size to be a little bit smaller than the // defaultCellSize to avoid initial refinement triggering. @@ -580,7 +585,7 @@ int main(int argc, char *argv[]) 20.0, //maxCellWeightCoeff runTime, geometryToConformTo, - cellSizeControl, + cellShapeControls(), rndGen, cvMeshDict ); diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshDict b/applications/utilities/mesh/generation/cvMesh/cvMeshDict index 513d73573baba9fd0b01188b00a30fb9a0ef89a9..28f3b0043bc210b672a0b30d10fd035cc8bbeb19 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshDict +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshDict @@ -263,7 +263,7 @@ initialPoints // It determines the cell size given a location. It then uses all // the rules // - defaultCellSize -// - cellSizeControlGeometry +// - cellShapeControl // to determine target cell size. Rule with highest priority wins. If same // priority smallest cell size wins. motionControl @@ -271,10 +271,28 @@ motionControl // Absolute cell size of back ground mesh. This is the maximum cell size. defaultCellSize 0.00075; - // Assign a priority to all requests for cell sizes, the highest overrules. - defaultPriority 0; + //cellShapeControl constantControl; + //cellShapeControl fileControl; + cellShapeControl surfaceControl; - cellSizeControlGeometry + // Provide constant values for cell size and alignment + constantControlCoeffs + { + cellSize 0.00075; + cellAlignment (1 0 0 0 1 0 0 0 1); + } + + // Read in the points of the background grid used for cell shape control + // from a file, with corresponding files for alignment and size + fileControlCoeffs + { + pointFile ""; + sizesFile ""; + alignmentsFile ""; + } + + // Calculate the sizes and alignments from surfaces + surfaceControlCoeffs { ref7_outside { @@ -319,6 +337,16 @@ motionControl } } + // Provide an aspect ratio and the direction in which it acts on the mesh. + // Default is 1.0 if this section is not present in the dictionary + cellAspectRatioControl + { + // Aspect ratio. + aspectRatio 2.0; + // Direction of action of the aspect ratio + aspectRatioDirection (1 0 0); + } + // Underrelaxation for point motion. Simulated annealing: starts off at 1 // and lowers to 0 (at simulation endTime) to converge points. // adaptiveLinear is preferred choice. @@ -396,6 +424,12 @@ motionControl // Do not change. See cvControls.H polyMeshFiltering { + // Filter small edges + filterEdges on; + + // Filter small and sliver faces + filterFaces off; + // Write the underlying Delaunay tet mesh at output time writeTetDualMesh false; //true; diff --git a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options index c7c073ab1764bc3672e63a10d8aa3ec580b88156..7bd92a24abf566234ee02a26c3615c10151286a1 100644 --- a/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options +++ b/applications/utilities/mesh/generation/cvMesh/cvMeshSurfaceSimplify/Make/options @@ -9,6 +9,7 @@ EXE_INC = \ -I$(FASTDUALOCTREE_SRC_PATH) \ -I../conformalVoronoiMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -21,6 +22,7 @@ EXE_LIBS = \ -lconformalVoronoiMesh \ -ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lscotchDecomp \ -ledgeMesh \ + -lfileFormats \ -ltriSurface \ -lmeshTools \ -ldynamicMesh diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 1f72f1d2213057f834c1f458314a53768d1d07cc..bafe30550467b75f30c33effec03008170addf4e 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -473,6 +473,7 @@ int main(int argc, char *argv[]) ) { label nbrProcI = patchToNbrProc[patchI]; + word name = "procBoundary" + Foam::name(Pstream::myProcNo()) @@ -755,6 +756,9 @@ int main(int argc, char *argv[]) const edgeList& edges = mesh.edges(); const pointField& points = mesh.points(); + PackedBoolList collapseEdge(mesh.nEdges()); + Map<point> collapsePointToLocation(mesh.nPoints()); + forAll(edges, edgeI) { const edge& e = edges[edgeI]; @@ -766,15 +770,29 @@ int main(int argc, char *argv[]) Info<< "Merging edge " << e << " since length " << d << " << " << mergeDim << nl; - // Collapse edge to e[0] - collapser.collapseEdge(edgeI, e[0]); + collapseEdge[edgeI] = true; + collapsePointToLocation.set(e[1], points[e[0]]); } } + List<pointEdgeCollapse> allPointInfo; + const globalIndex globalPoints(mesh.nPoints()); + labelList pointPriority(mesh.nPoints(), 0); + + collapser.consistentCollapse + ( + globalPoints, + pointPriority, + collapsePointToLocation, + collapseEdge, + allPointInfo + ); + // Topo change container polyTopoChange meshMod(mesh); + // Put all modifications into meshMod - bool anyChange = collapser.setRefinement(meshMod); + bool anyChange = collapser.setRefinement(allPointInfo, meshMod); if (anyChange) { diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index b1bcf33d8269ccb64c75fa9d98821187bd00fc4a..b159f9c096dd5e8d5813568a2fe52a9d3abfeee3 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -132,456 +132,12 @@ Notes: #include "surfaceFields.H" #include "pointFields.H" //#include "ReadFields.H" - +#include "fvMeshTools.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//template<class GeoField> -//void addPatchFields(const fvMesh& mesh, const word& patchFieldType) -//{ -// HashTable<const GeoField*> flds -// ( -// mesh.objectRegistry::lookupClass<GeoField>() -// ); -// -// forAllConstIter(typename HashTable<const GeoField*>, flds, iter) -// { -// const GeoField& fld = *iter(); -// -// typename GeoField::GeometricBoundaryField& bfld = -// const_cast<typename GeoField::GeometricBoundaryField&> -// ( -// fld.boundaryField() -// ); -// -// label sz = bfld.size(); -// -// for (label i = 0; i < sz; i++) -// { -// bfld.set -// ( -// i, -// bfld.clone(GeoField::PatchFieldType::New -// ( -// patchFieldType, -// fld.mesh().boundary()[sz], -// fld.dimensionedInternalField() -// ) -// ); -// -// -// -// Pout<< "fld:" << fld.name() << " had " << sz << " patches." << endl; -// Pout<< "fld before:" << fld << endl; -// Pout<< "adding on patch:" << fld.mesh().boundary()[sz].name() << endl; -// -// bfld.setSize(sz+1); -// bfld.set -// ( -// sz, -// GeoField::PatchFieldType::New -// ( -// patchFieldType, -// fld.mesh().boundary()[sz], -// fld.dimensionedInternalField() -// ) -// ); -// -// bfld[sz].operator=(pTraits<typename GeoField::value_type>::zero); -// -// Pout<< "fld:" << fld.name() << " now " << bfld.size() << " patches." -// << endl; -// -// const typename GeoField::PatchFieldType& pfld = bfld[sz]; -// Pout<< "pfld:" << pfld << endl; -// -// -// Pout<< "fld value:" << fld << endl; -// } -//} - - -// Remove last patch field -template<class GeoField> -void trimPatchFields(fvMesh& mesh, const label nPatches) -{ - HashTable<const GeoField*> flds - ( - mesh.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ).setSize(nPatches); - } -} - - -// Reorder patch field -template<class GeoField> -void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew) -{ - HashTable<const GeoField*> flds - ( - mesh.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); - - bfld.reorder(oldToNew); - } -} - - -//void addCalculatedPatchFields(const fvMesh& mesh) -//{ -// addPatchFields<volScalarField> -// ( -// mesh, -// calculatedFvPatchField<scalar>::typeName -// ); -// addPatchFields<volVectorField> -// ( -// mesh, -// calculatedFvPatchField<vector>::typeName -// ); -// addPatchFields<volSphericalTensorField> -// ( -// mesh, -// calculatedFvPatchField<sphericalTensor>::typeName -// ); -// addPatchFields<volSymmTensorField> -// ( -// mesh, -// calculatedFvPatchField<symmTensor>::typeName -// ); -// addPatchFields<volTensorField> -// ( -// mesh, -// calculatedFvPatchField<tensor>::typeName -// ); -// -// // Surface fields -// -// addPatchFields<surfaceScalarField> -// ( -// mesh, -// calculatedFvPatchField<scalar>::typeName -// ); -// addPatchFields<surfaceVectorField> -// ( -// mesh, -// calculatedFvPatchField<vector>::typeName -// ); -// addPatchFields<surfaceSphericalTensorField> -// ( -// mesh, -// calculatedFvPatchField<sphericalTensor>::typeName -// ); -// addPatchFields<surfaceSymmTensorField> -// ( -// mesh, -// calculatedFvPatchField<symmTensor>::typeName -// ); -// addPatchFields<surfaceTensorField> -// ( -// mesh, -// calculatedFvPatchField<tensor>::typeName -// ); -// -// // Point fields -// -// addPatchFields<pointScalarField> -// ( -// mesh, -// calculatedFvPatchField<scalar>::typeName -// ); -// addPatchFields<pointVectorField> -// ( -// mesh, -// calculatedFvPatchField<vector>::typeName -// ); -//} -// -// -//void addAllPatchFields(fvMesh& mesh, const label insertPatchI) -//{ -// polyBoundaryMesh& polyPatches = -// const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); -// fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); -// -// label sz = polyPatches.size(); -// -// addPatchFields<volScalarField> -// ( -// mesh, -// calculatedFvPatchField<scalar>::typeName -// ); -// addPatchFields<volVectorField> -// ( -// mesh, -// calculatedFvPatchField<vector>::typeName -// ); -// addPatchFields<volSphericalTensorField> -// ( -// mesh, -// calculatedFvPatchField<sphericalTensor>::typeName -// ); -// addPatchFields<volSymmTensorField> -// ( -// mesh, -// calculatedFvPatchField<symmTensor>::typeName -// ); -// addPatchFields<volTensorField> -// ( -// mesh, -// calculatedFvPatchField<tensor>::typeName -// ); -// -// // Surface fields -// -// addPatchFields<surfaceScalarField> -// ( -// mesh, -// calculatedFvPatchField<scalar>::typeName -// ); -// addPatchFields<surfaceVectorField> -// ( -// mesh, -// calculatedFvPatchField<vector>::typeName -// ); -// addPatchFields<surfaceSphericalTensorField> -// ( -// mesh, -// calculatedFvPatchField<sphericalTensor>::typeName -// ); -// addPatchFields<surfaceSymmTensorField> -// ( -// mesh, -// calculatedFvPatchField<symmTensor>::typeName -// ); -// addPatchFields<surfaceTensorField> -// ( -// mesh, -// calculatedFvPatchField<tensor>::typeName -// ); -// -// // Create reordering list -// // patches before insert position stay as is -// labelList oldToNew(sz); -// for (label i = 0; i < insertPatchI; i++) -// { -// oldToNew[i] = i; -// } -// // patches after insert position move one up -// for (label i = insertPatchI; i < sz-1; i++) -// { -// oldToNew[i] = i+1; -// } -// // appended patch gets moved to insert position -// oldToNew[sz-1] = insertPatchI; -// -// // Shuffle into place -// polyPatches.reorder(oldToNew); -// fvPatches.reorder(oldToNew); -// -// reorderPatchFields<volScalarField>(mesh, oldToNew); -// reorderPatchFields<volVectorField>(mesh, oldToNew); -// reorderPatchFields<volSphericalTensorField>(mesh, oldToNew); -// reorderPatchFields<volSymmTensorField>(mesh, oldToNew); -// reorderPatchFields<volTensorField>(mesh, oldToNew); -// reorderPatchFields<surfaceScalarField>(mesh, oldToNew); -// reorderPatchFields<surfaceVectorField>(mesh, oldToNew); -// reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew); -// reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew); -// reorderPatchFields<surfaceTensorField>(mesh, oldToNew); -//} - - -//// Adds patch if not yet there. Returns patchID. -//template<class PatchType> -//label addPatch(fvMesh& mesh, const word& patchName, const dictionary& dict) -//{ -// polyBoundaryMesh& polyPatches = -// const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); -// -// label patchI = polyPatches.findPatchID(patchName); -// if (patchI != -1) -// { -// if (isA<PatchType>(polyPatches[patchI])) -// { -// // Already there -// return patchI; -// } -// else -// { -// FatalErrorIn("addPatch<PatchType>(fvMesh&, const word&)") -// << "Already have patch " << patchName -// << " but of type " << PatchType::typeName -// << exit(FatalError); -// } -// } -// -// -// label insertPatchI = polyPatches.size(); -// label startFaceI = mesh.nFaces(); -// -// forAll(polyPatches, patchI) -// { -// const polyPatch& pp = polyPatches[patchI]; -// -// if (isA<processorPolyPatch>(pp)) -// { -// insertPatchI = patchI; -// startFaceI = pp.start(); -// break; -// } -// } -// -// dictionary patchDict(dict); -// patchDict.set("type", PatchType::typeName); -// patchDict.set("nFaces", 0); -// patchDict.set("startFace", startFaceI); -// -// -// // Below is all quite a hack. Feel free to change once there is a better -// // mechanism to insert and reorder patches. -// -// // Clear local fields and e.g. polyMesh parallelInfo. -// mesh.clearOut(); -// -// label sz = polyPatches.size(); -// -// fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); -// -// // Add polyPatch at the end -// polyPatches.setSize(sz+1); -// polyPatches.set -// ( -// sz, -// polyPatch::New -// ( -// patchName, -// patchDict, -// insertPatchI, -// polyPatches -// ) -// ); -// fvPatches.setSize(sz+1); -// fvPatches.set -// ( -// sz, -// fvPatch::New -// ( -// polyPatches[sz], // point to newly added polyPatch -// mesh.boundary() -// ) -// ); -// -// addAllPatchFields(mesh, insertPatchI); -// -// return insertPatchI; -//} -// -// -//template<class PatchType> -//label addPatch(fvMesh& mesh, const word& patchName) -//{ -//Pout<< "addPatch:" << patchName << endl; -// -// polyBoundaryMesh& polyPatches = -// const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); -// -// label patchI = polyPatches.findPatchID(patchName); -// if (patchI != -1) -// { -// if (isA<PatchType>(polyPatches[patchI])) -// { -// // Already there -// return patchI; -// } -// else -// { -// FatalErrorIn("addPatch<PatchType>(fvMesh&, const word&)") -// << "Already have patch " << patchName -// << " but of type " << PatchType::typeName -// << exit(FatalError); -// } -// } -// -// -// label insertPatchI = polyPatches.size(); -// label startFaceI = mesh.nFaces(); -// -// forAll(polyPatches, patchI) -// { -// const polyPatch& pp = polyPatches[patchI]; -// -// if (isA<processorPolyPatch>(pp)) -// { -// insertPatchI = patchI; -// startFaceI = pp.start(); -// break; -// } -// } -// -// // Below is all quite a hack. Feel free to change once there is a better -// // mechanism to insert and reorder patches. -// -// // Clear local fields and e.g. polyMesh parallelInfo. -// mesh.clearOut(); -// -// label sz = polyPatches.size(); -// -// fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); -// -// // Add polyPatch at the end -// polyPatches.setSize(sz+1); -// polyPatches.set -// ( -// sz, -// polyPatch::New -// ( -// PatchType::typeName, -// patchName, -// 0, // size -// startFaceI, -// insertPatchI, -// polyPatches -// ) -// ); -// fvPatches.setSize(sz+1); -// fvPatches.set -// ( -// sz, -// fvPatch::New -// ( -// polyPatches[sz], // point to newly added polyPatch -// mesh.boundary() -// ) -// ); -// -// addAllPatchFields(mesh, insertPatchI); -// -// return insertPatchI; -//} - - label findPatchID(const List<polyPatch*>& newPatches, const word& name) { forAll(newPatches, i) @@ -712,53 +268,6 @@ label addPatch } -// Reorder and delete patches. -void reorderPatches -( - fvMesh& mesh, - const labelList& oldToNew, - const label nNewPatches -) -{ - polyBoundaryMesh& polyPatches = - const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); - fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); - - // Shuffle into place - polyPatches.reorder(oldToNew); - fvPatches.reorder(oldToNew); - - reorderPatchFields<volScalarField>(mesh, oldToNew); - reorderPatchFields<volVectorField>(mesh, oldToNew); - reorderPatchFields<volSphericalTensorField>(mesh, oldToNew); - reorderPatchFields<volSymmTensorField>(mesh, oldToNew); - reorderPatchFields<volTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceScalarField>(mesh, oldToNew); - reorderPatchFields<surfaceVectorField>(mesh, oldToNew); - reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceTensorField>(mesh, oldToNew); - reorderPatchFields<pointScalarField>(mesh, oldToNew); - reorderPatchFields<pointVectorField>(mesh, oldToNew); - - // Remove last. - polyPatches.setSize(nNewPatches); - fvPatches.setSize(nNewPatches); - trimPatchFields<volScalarField>(mesh, nNewPatches); - trimPatchFields<volVectorField>(mesh, nNewPatches); - trimPatchFields<volSphericalTensorField>(mesh, nNewPatches); - trimPatchFields<volSymmTensorField>(mesh, nNewPatches); - trimPatchFields<volTensorField>(mesh, nNewPatches); - trimPatchFields<surfaceScalarField>(mesh, nNewPatches); - trimPatchFields<surfaceVectorField>(mesh, nNewPatches); - trimPatchFields<surfaceSphericalTensorField>(mesh, nNewPatches); - trimPatchFields<surfaceSymmTensorField>(mesh, nNewPatches); - trimPatchFields<surfaceTensorField>(mesh, nNewPatches); - trimPatchFields<pointScalarField>(mesh, nNewPatches); - trimPatchFields<pointVectorField>(mesh, nNewPatches); -} - - // Remove zero-sized patches void deleteEmptyPatches(fvMesh& mesh) { @@ -837,7 +346,7 @@ void deleteEmptyPatches(fvMesh& mesh) } } - reorderPatches(mesh, oldToNew, usedI); + fvMeshTools::reorderPatches(mesh, oldToNew, usedI, true); } @@ -1732,8 +1241,7 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" - argList::addOption("dict", "name", "specify alternative dictionary"); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" #include "createNamedMesh.H" @@ -1754,19 +1262,14 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); bool overwrite = args.optionFound("overwrite"); - const word dictName - (args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict")); - IOdictionary dict - ( - IOobject - ( - dictName, - runTime.system(), - runTime, - IOobject::MUST_READ_IF_MODIFIED - ) - ); + + const word dictName("extrudeToRegionMeshDict"); + + #include "setSystemMeshDictionaryIO.H" + + IOdictionary dict(dictIO); + // Point generator autoPtr<extrudeModel> model(extrudeModel::New(dict)); @@ -1805,18 +1308,26 @@ int main(int argc, char *argv[]) mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")]; const Switch oneD(dict.lookup("oneD")); + Switch oneDNonManifoldEdges(false); + word oneDPatchType(emptyPolyPatch::typeName); + if (oneD) + { + oneDNonManifoldEdges = dict.lookupOrDefault("nonManifold", false); + dict.lookup("oneDPolyPatchType") >> oneDPatchType; + } + const Switch adaptMesh(dict.lookup("adaptMesh")); if (hasZones) { - Pout<< "Extruding zones " << zoneNames + Info<< "Extruding zones " << zoneNames << " on mesh " << regionName << " into shell mesh " << shellRegionName << endl; } else { - Pout<< "Extruding faceSets " << zoneNames + Info<< "Extruding faceSets " << zoneNames << " on mesh " << regionName << " into shell mesh " << shellRegionName << endl; @@ -1832,6 +1343,26 @@ int main(int argc, char *argv[]) } + if (oneD) + { + if (oneDNonManifoldEdges) + { + Info<< "Extruding as 1D columns with sides in patch type " + << oneDPatchType + << " and connected points (except on non-manifold areas)." + << endl; + } + else + { + Info<< "Extruding as 1D columns with sides in patch type " + << oneDPatchType + << " and duplicated points (overlapping volumes)." + << endl; + } + } + + + //// Read objects in time directory //IOobjectList objects(mesh, runTime.timeName()); @@ -1894,7 +1425,7 @@ int main(int argc, char *argv[]) { meshInstance = oldInstance; } - Pout<< "Writing meshes to " << meshInstance << nl << endl; + Info<< "Writing meshes to " << meshInstance << nl << endl; const polyBoundaryMesh& patches = mesh.boundaryMesh(); @@ -2130,7 +1661,7 @@ int main(int argc, char *argv[]) const labelListList& edgeFaces = extrudePatch.edgeFaces(); - Pout<< "extrudePatch :" + Info<< "extrudePatch :" << " faces:" << extrudePatch.size() << " points:" << extrudePatch.nPoints() << " edges:" << extrudePatch.nEdges() @@ -2325,7 +1856,7 @@ int main(int argc, char *argv[]) ( mesh, zoneNames, - (oneD ? dict.lookup("oneDPolyPatchType") : word::null), + (oneD ? oneDPatchType : word::null), regionPatches, zoneSidePatch @@ -2416,10 +1947,18 @@ int main(int argc, char *argv[]) { ePatches[i] = zoneSidePatch[zoneID[eFaces[i]]]; } - //- Set nonManifoldEdge[edgeI] for non-manifold edges only - // The other option is to have non-manifold edges everywhere - // and generate space overlapping columns of cells. - if (eFaces.size() != 2) + + if (oneDNonManifoldEdges) + { + //- Set nonManifoldEdge[edgeI] for non-manifold edges only + // The other option is to have non-manifold edges everywhere + // and generate space overlapping columns of cells. + if (eFaces.size() != 2) + { + nonManifoldEdge[edgeI] = 1; + } + } + else { nonManifoldEdge[edgeI] = 1; } @@ -2834,7 +2373,7 @@ int main(int argc, char *argv[]) "point to patch point addressing"; - Pout<< "Writing mesh " << regionMesh.name() + Info<< "Writing mesh " << regionMesh.name() << " to " << regionMesh.facesInstance() << nl << endl; @@ -3013,7 +2552,7 @@ int main(int argc, char *argv[]) // Remove any unused patches deleteEmptyPatches(mesh); - Pout<< "Writing mesh " << mesh.name() + Info<< "Writing mesh " << mesh.name() << " to " << mesh.facesInstance() << nl << endl; diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict index a768615f854ea39952c226d9221de459587da089..ffa2db8b19ff1779d0ca9e25c2e3c22711e51311 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMeshDict @@ -40,11 +40,20 @@ adaptMesh true; // Sample mode for inter-region communication sampleMode nearestPatchFace; -// Extrude 1D-columns of cells? -oneD false; -// If oneD is true. Specify which boundary is wanted between the layers -//oneDPolyPatchType empty; //wedge +// 1 D extrusion +// ~~~~~~~~~~~~~ + + // Extrude 1D-columns of cells? This by default duplicates points so can + // have overlapping columns (i.e. non space filling) + oneD false; + + //- If oneD: specify which boundary is wanted between the layers + //oneDPolyPatchType empty; //wedge + + //- If oneD: specify whether to duplicate points (i.e. disconnect 1D + // columns) or only on non-manifold extrusion areas. Default is false. + // nonManifold true; //- Extrusion model to use. The only logical choice is linearNormal? diff --git a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C index f161523ffd4c56ce1456218cc92da08075b91fa8..aa033f26d316739e07033b8bc7cb743f7cddac51 100644 --- a/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C +++ b/applications/utilities/mesh/generation/extrude2DMesh/extrude2DMeshApp.C @@ -43,6 +43,7 @@ Note #include "edgeCollapser.H" #include "addPatchCellLayer.H" #include "patchToPoly2DMesh.H" +#include "globalIndex.H" using namespace Foam; @@ -260,6 +261,9 @@ int main(int argc, char *argv[]) const boundBox& bb = mesh().bounds(); const scalar mergeDim = 1e-4 * bb.minDim(); + PackedBoolList collapseEdge(mesh().nEdges()); + Map<point> collapsePointToLocation(mesh().nPoints()); + forAll(edges, edgeI) { const edge& e = edges[edgeI]; @@ -271,14 +275,27 @@ int main(int argc, char *argv[]) Info<< "Merging edge " << e << " since length " << d << " << " << mergeDim << nl; - // Collapse edge to e[0] - collapser.collapseEdge(edgeI, e[0]); + collapseEdge[edgeI] = true; + collapsePointToLocation.set(e[1], points[e[0]]); } } + List<pointEdgeCollapse> allPointInfo; + const globalIndex globalPoints(mesh().nPoints()); + labelList pointPriority(mesh().nPoints(), 0); + + collapser.consistentCollapse + ( + globalPoints, + pointPriority, + collapsePointToLocation, + collapseEdge, + allPointInfo + ); + polyTopoChange meshModCollapse(mesh()); - collapser.setRefinement(meshModCollapse); + collapser.setRefinement(allPointInfo, meshModCollapse); // Create a mesh from topo changes. autoPtr<mapPolyMesh> morphMap diff --git a/applications/utilities/mesh/generation/snappyHexMesh/Make/options b/applications/utilities/mesh/generation/snappyHexMesh/Make/options index b7fd6d3bd227e7ed7d2bf9f5b6c79121d34a1446..af056ec7cb640728dde3af9003c460d860c4bbb7 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/Make/options +++ b/applications/utilities/mesh/generation/snappyHexMesh/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \ -I$(LIB_SRC)/mesh/autoMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ @@ -13,5 +14,6 @@ EXE_LIBS = \ -ldecompositionMethods \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -lmeshTools \ + -lfileFormats \ -ldynamicMesh \ -lautoMesh diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 2372b144ec9af2d0a7e5920b3e22f9ff8281e407..2406cb667c45098ebd0ae54dfbf61f325e48d68c 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -46,7 +46,7 @@ Description #include "refinementParameters.H" #include "snapParameters.H" #include "layerParameters.H" - +#include "vtkSetWriter.H" using namespace Foam; @@ -122,6 +122,12 @@ void writeMesh int main(int argc, char *argv[]) { # include "addOverwriteOption.H" + Foam::argList::addBoolOption + ( + "checkGeometry", + "check all surface geometry for quality" + ); + # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); @@ -131,6 +137,7 @@ int main(int argc, char *argv[]) << runTime.cpuTimeIncrement() << " s" << endl; const bool overwrite = args.optionFound("overwrite"); + const bool checkGeometry = args.optionFound("checkGeometry"); // Check patches and faceZones are synchronised mesh.boundaryMesh().checkParallelSync(true); @@ -244,6 +251,56 @@ int main(int argc, char *argv[]) << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + // Checking only? + + if (checkGeometry) + { + // Extract patchInfo + List<wordList> patchTypes(allGeometry.size()); + + const PtrList<dictionary>& patchInfo = surfaces.patchInfo(); + const labelList& surfaceGeometry = surfaces.surfaces(); + forAll(surfaceGeometry, surfI) + { + label geomI = surfaceGeometry[surfI]; + const wordList& regNames = allGeometry.regionNames()[geomI]; + + patchTypes[geomI].setSize(regNames.size()); + forAll(regNames, regionI) + { + label globalRegionI = surfaces.globalRegion(surfI, regionI); + + if (patchInfo.set(globalRegionI)) + { + patchTypes[geomI][regionI] = + word(patchInfo[globalRegionI].lookup("type")); + } + else + { + patchTypes[geomI][regionI] = wallPolyPatch::typeName; + } + } + } + + // Write some stats + allGeometry.writeStats(patchTypes, Info); + // Check topology + allGeometry.checkTopology(true); + // Check geometry + allGeometry.checkGeometry + ( + 100.0, // max size ratio + 1e-9, // intersection tolerance + autoPtr<writer<scalar> >(new vtkSetWriter<scalar>()), + 0.01, // min triangle quality + true + ); + + return 0; + } + + + // Read refinement shells // ~~~~~~~~~~~~~~~~~~~~~~ @@ -312,7 +369,10 @@ int main(int argc, char *argv[]) // Add all the surface regions as patches // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - labelList globalToPatch; + //- Global surface region to patch (non faceZone surface) or patches + // (faceZone surfaces) + labelList globalToMasterPatch; + labelList globalToSlavePatch; { Info<< nl << "Adding patches for surface regions" << nl @@ -320,7 +380,8 @@ int main(int argc, char *argv[]) << endl; // From global region number to mesh patch. - globalToPatch.setSize(surfaces.nRegions(), -1); + globalToMasterPatch.setSize(surfaces.nRegions(), -1); + globalToSlavePatch.setSize(surfaces.nRegions(), -1); Info<< "Patch\tType\tRegion" << nl << "-----\t----\t------" @@ -337,36 +398,111 @@ int main(int argc, char *argv[]) Info<< surfaces.names()[surfI] << ':' << nl << nl; - forAll(regNames, i) + if (surfaces.faceZoneNames()[surfI].empty()) { - label globalRegionI = surfaces.globalRegion(surfI, i); - - label patchI; - - if (surfacePatchInfo.set(globalRegionI)) + // 'Normal' surface + forAll(regNames, i) { - patchI = meshRefiner.addMeshedPatch - ( - regNames[i], - surfacePatchInfo[globalRegionI] - ); + label globalRegionI = surfaces.globalRegion(surfI, i); + + label patchI; + + if (surfacePatchInfo.set(globalRegionI)) + { + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + surfacePatchInfo[globalRegionI] + ); + } + else + { + dictionary patchInfo; + patchInfo.set("type", wallPolyPatch::typeName); + + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + patchInfo + ); + } + + Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type() + << '\t' << regNames[i] << nl; + + globalToMasterPatch[globalRegionI] = patchI; + globalToSlavePatch[globalRegionI] = patchI; } - else + } + else + { + // Zoned surface + forAll(regNames, i) { - dictionary patchInfo; - patchInfo.set("type", wallPolyPatch::typeName); - - patchI = meshRefiner.addMeshedPatch - ( - regNames[i], - patchInfo - ); + label globalRegionI = surfaces.globalRegion(surfI, i); + + // Add master side patch + { + label patchI; + + if (surfacePatchInfo.set(globalRegionI)) + { + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + surfacePatchInfo[globalRegionI] + ); + } + else + { + dictionary patchInfo; + patchInfo.set("type", wallPolyPatch::typeName); + + patchI = meshRefiner.addMeshedPatch + ( + regNames[i], + patchInfo + ); + } + + Info<< patchI << '\t' + << mesh.boundaryMesh()[patchI].type() + << '\t' << regNames[i] << nl; + + globalToMasterPatch[globalRegionI] = patchI; + } + // Add slave side patch + { + const word slaveName = regNames[i] + "_slave"; + label patchI; + + if (surfacePatchInfo.set(globalRegionI)) + { + patchI = meshRefiner.addMeshedPatch + ( + slaveName, + surfacePatchInfo[globalRegionI] + ); + } + else + { + dictionary patchInfo; + patchInfo.set("type", wallPolyPatch::typeName); + + patchI = meshRefiner.addMeshedPatch + ( + slaveName, + patchInfo + ); + } + + Info<< patchI << '\t' + << mesh.boundaryMesh()[patchI].type() + << '\t' << slaveName << nl; + + globalToSlavePatch[globalRegionI] = patchI; + } } - - Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type() - << '\t' << regNames[i] << nl; - - globalToPatch[globalRegionI] = patchI; } Info<< nl; @@ -422,7 +558,8 @@ int main(int argc, char *argv[]) meshRefiner, decomposer, distributor, - globalToPatch + globalToMasterPatch, + globalToSlavePatch ); // Refinement parameters @@ -453,7 +590,8 @@ int main(int argc, char *argv[]) autoSnapDriver snapDriver ( meshRefiner, - globalToPatch + globalToMasterPatch, + globalToSlavePatch ); // Snap parameters @@ -487,7 +625,12 @@ int main(int argc, char *argv[]) { cpuTime timer; - autoLayerDriver layerDriver(meshRefiner, globalToPatch); + autoLayerDriver layerDriver + ( + meshRefiner, + globalToMasterPatch, + globalToSlavePatch + ); // Layer addition parameters layerParameters layerParams(layerDict, mesh.boundaryMesh()); diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 050204d8a8718a798f844e14f98b2344ade54800..99d1d5dcfbc2c7e149fccbf8bd00612760b169c8 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -149,6 +149,7 @@ castellatedMeshControls patchInfo { type patch; + inGroups (meshedPatches); } //- Optional angle to detect small-large cell situation @@ -337,7 +338,7 @@ addLayersControls // Advanced settings // When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // are perpendicular featureAngle 60; // At non-patched sides allow mesh to slip if extrusion direction makes diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 4eb19041aa7f17e471b9a12ae454478da556fcd3..ef521a257d2238f164acab87bf6e4307d8c8218a 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -262,175 +262,185 @@ bool Foam::checkWedges } -bool Foam::checkCoupledPoints -( - const polyMesh& mesh, - const bool report, - labelHashSet* setPtr -) +namespace Foam { - const pointField& p = mesh.points(); - const faceList& fcs = mesh.faces(); - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - - // Check size of faces - label maxSize = 0; + //- Default transformation behaviour for position + class transformPositionList { - labelList nbrSize(fcs.size()-mesh.nInternalFaces(), 0); + public: - // Exchange size - forAll(patches, patchI) + //- Transform patch-based field + void operator() + ( + const coupledPolyPatch& cpp, + List<pointField>& pts + ) const { - if (patches[patchI].coupled()) + // Each element of pts is all the points in the face. Convert into + // lists of size cpp to transform. + + List<pointField> newPts(pts.size()); + forAll(pts, faceI) { - const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> - ( - patches[patchI] - ); + newPts[faceI].setSize(pts[faceI].size()); + } - forAll(cpp, i) + label index = 0; + while (true) + { + label n = 0; + + // Extract for every face the i'th position + pointField ptsAtIndex(pts.size(), vector::zero); + forAll(cpp, faceI) { - label bFaceI = cpp.start()+i-mesh.nInternalFaces(); - nbrSize[bFaceI] = cpp[i].size(); - maxSize = max(maxSize, cpp[i].size()); + const pointField& facePts = pts[faceI]; + if (facePts.size() > index) + { + ptsAtIndex[faceI] = facePts[index]; + n++; + } } - } - } - syncTools::swapBoundaryFaceList(mesh, nbrSize); + if (n == 0) + { + break; + } - // Check on owner - label nErrorFaces = 0; - forAll(patches, patchI) - { - if (patches[patchI].coupled()) - { - const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> - ( - patches[patchI] - ); + // Now ptsAtIndex will have for every face either zero or + // the position of the i'th vertex. Transform. + cpp.transformPosition(ptsAtIndex); - if (cpp.owner()) + // Extract back from ptsAtIndex into newPts + forAll(cpp, faceI) { - forAll(cpp, i) + pointField& facePts = newPts[faceI]; + if (facePts.size() > index) { - label bFaceI = cpp.start()+i-mesh.nInternalFaces(); - - if (cpp[i].size() != nbrSize[bFaceI]) - { - if (setPtr) - { - setPtr->insert(cpp.start()+i); - } - nErrorFaces++; - } + facePts[index] = ptsAtIndex[faceI]; } } + + index++; } + + pts.transfer(newPts); } + }; +} - reduce(nErrorFaces, sumOp<label>()); - if (nErrorFaces > 0) + +bool Foam::checkCoupledPoints +( + const polyMesh& mesh, + const bool report, + labelHashSet* setPtr +) +{ + const pointField& p = mesh.points(); + const faceList& fcs = mesh.faces(); + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + // Zero'th point on coupled faces + //pointField nbrZeroPoint(fcs.size()-mesh.nInternalFaces(), vector::max); + List<pointField> nbrPoints(fcs.size() - mesh.nInternalFaces()); + + // Exchange zero point + forAll(patches, patchI) + { + if (patches[patchI].coupled()) { - if (report) + const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> + ( + patches[patchI] + ); + + forAll(cpp, i) { - Info<< " **Error in coupled faces: " - << nErrorFaces - << " faces have different size " - << " compared to their coupled equivalent." << endl; + label bFaceI = cpp.start() + i - mesh.nInternalFaces(); + const face& f = cpp[i]; + nbrPoints[bFaceI].setSize(f.size()); + forAll(f, fp) + { + const point& p0 = p[f[fp]]; + nbrPoints[bFaceI][fp] = p0; + } } - return true; } - - reduce(maxSize, maxOp<label>()); } - - + syncTools::syncBoundaryFaceList + ( + mesh, + nbrPoints, + eqOp<pointField>(), + transformPositionList() + ); + + // Compare to local ones. Use same tolerance as for matching label nErrorFaces = 0; scalar avgMismatch = 0; label nCoupledPoints = 0; - for (label index = 0; index < maxSize; index++) + forAll(patches, patchI) { - // point at index on coupled faces - pointField nbrPoint(fcs.size()-mesh.nInternalFaces(), vector::max); - - // Exchange point - forAll(patches, patchI) + if (patches[patchI].coupled()) { - if (patches[patchI].coupled()) + const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> + ( + patches[patchI] + ); + + if (cpp.owner()) { - const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> + scalarField smallDist ( - patches[patchI] + cpp.calcFaceTol + ( + //cpp.matchTolerance(), + cpp, + cpp.points(), + cpp.faceCentres() + ) ); forAll(cpp, i) { + label bFaceI = cpp.start() + i - mesh.nInternalFaces(); const face& f = cpp[i]; - if (f.size() > index) + + if (f.size() != nbrPoints[bFaceI].size()) { - label bFaceI = cpp.start()+i-mesh.nInternalFaces(); - nbrPoint[bFaceI] = p[f[index]]; + FatalErrorIn + ( + "Foam::checkCoupledPoints\n" + "(\n" + " const polyMesh&, const bool, labelHashSet*\n" + ")\n" + ) << "Local face size : " << f.size() + << " does not equal neighbour face size : " + << nbrPoints[bFaceI].size() + << abort(FatalError); } - } - } - } - syncTools::swapBoundaryFacePositions(mesh, nbrPoint); - - - // Compare to local ones. Use same tolerance as for matching - forAll(patches, patchI) - { - if (patches[patchI].coupled()) - { - const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> - ( - patches[patchI] - ); - - if (cpp.owner()) - { - scalarField smallDist - ( - cpp.calcFaceTol - ( - //cpp.matchTolerance(), - cpp, - cpp.points(), - cpp.faceCentres() - ) - ); - - forAll(cpp, i) + label fp = 0; + forAll(f, j) { - const face& f = cpp[i]; - if (f.size() > index) - { - label bFaceI = cpp.start()+i-mesh.nInternalFaces(); - label reverseIndex = (f.size()-index)%f.size(); - scalar d = mag(p[f[reverseIndex]]-nbrPoint[bFaceI]); + const point& p0 = p[f[fp]]; + scalar d = mag(p0 - nbrPoints[bFaceI][j]); - if (d > smallDist[i]) + if (d > smallDist[i]) + { + if (setPtr) { - if (setPtr) - { - // Avoid duplicate counting of faces - if (setPtr->insert(cpp.start()+i)) - { - nErrorFaces++; - } - } - else - { - // No checking on duplicates - nErrorFaces++; - } + setPtr->insert(cpp.start()+i); } - avgMismatch += d; - nCoupledPoints++; + nErrorFaces++; + break; } + avgMismatch += d; + nCoupledPoints++; + + fp = f.rcIndex(fp); } } } @@ -793,7 +803,7 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry) if (allGeometry) { cellSet cells(mesh, "underdeterminedCells", mesh.nCells()/100); - if (mesh.checkCellDeterminant(true, &cells, mesh.geometricD())) + if (mesh.checkCellDeterminant(true, &cells)) { noFailedChecks++; diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 39e7375a67bcec4f6d8428a0386c1960dfd0884b..7e395be8798c20f2eb69ca922253d12ced914fb8 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -235,7 +235,7 @@ Foam::label Foam::checkTopology if (nOneCells > 0) { Info<< " <<Writing " << nOneCells - << " cells with with zero or one non-boundary face to set " + << " cells with zero or one non-boundary face to set " << oneCells.name() << endl; oneCells.instance() = mesh.pointsInstance(); @@ -247,7 +247,7 @@ Foam::label Foam::checkTopology if (nTwoCells > 0) { Info<< " <<Writing " << nTwoCells - << " cells with with two non-boundary faces to set " + << " cells with two non-boundary faces to set " << twoCells.name() << endl; twoCells.instance() = mesh.pointsInstance(); diff --git a/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C b/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C index 9ff4ed0334b64bd8b532af204c0759acffaa1d7a..9d49ffa2a93929492c06edc7e57fd70ed7b9ec46 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C +++ b/applications/utilities/mesh/manipulation/checkMesh/printMeshStats.C @@ -155,11 +155,11 @@ void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology) Info<< " Breakdown of polyhedra by number of faces:" << nl << " faces" << " number of cells" << endl; - labelList sortedKeys = polyhedralFaces.sortedToc(); + const labelList sortedKeys = polyhedralFaces.sortedToc(); forAll(sortedKeys, keyI) { - label nFaces = sortedKeys[keyI]; + const label nFaces = sortedKeys[keyI]; Info<< setf(std::ios::right) << setw(13) << nFaces << " " << polyhedralFaces[nFaces] << nl; diff --git a/applications/utilities/mesh/manipulation/createBaffles/Make/files b/applications/utilities/mesh/manipulation/createBaffles/Make/files index 4d4c0ea538d50b84731d01d3b9907219c8bcd5f8..734f2bce7641e300da014efca552a63a5ad13226 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/Make/files +++ b/applications/utilities/mesh/manipulation/createBaffles/Make/files @@ -1,3 +1,7 @@ +faceSelection/faceSelection.C +faceSelection/faceZoneSelection.C +faceSelection/searchableSurfaceSelection.C + createBaffles.C EXE = $(FOAM_APPBIN)/createBaffles diff --git a/applications/utilities/mesh/manipulation/createBaffles/Make/options b/applications/utilities/mesh/manipulation/createBaffles/Make/options index f7e0c60fedea00451bdc73c3c14e83ad22937f70..3c8db281299ce9067f6033527fc2ee310cff3a3c 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/Make/options +++ b/applications/utilities/mesh/manipulation/createBaffles/Make/options @@ -1,4 +1,5 @@ EXE_INC = \ + -IfaceSelection \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 6fb57aa027c9978398cea5e4dcb53bf0541a97e3..89beec32efee04e612c4ace9eab43c561032f1c5 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -26,25 +26,26 @@ Description mergeOrSplitBaffles. Note: if any coupled patch face is selected for baffling the opposite - member has to be selected for baffling as well. Note that this - is the same as repatching. This was added only for convenience so - you don't have to filter coupled boundary out of your set. + member has to be selected for baffling as well. + + - if the patch already exists will not override it nor its fields + - if the patch does not exist it will be created together with 'calculated' + patchfields unless the field is mentioned in the patchFields section. \*---------------------------------------------------------------------------*/ -#include "syncTools.H" #include "argList.H" #include "Time.H" -#include "faceSet.H" #include "polyTopoChange.H" #include "polyModifyFace.H" #include "polyAddFace.H" #include "ReadFields.H" #include "volFields.H" #include "surfaceFields.H" -#include "ZoneIDs.H" #include "fvMeshMapper.H" -#include "SetPatchFields.H" +#include "faceSelection.H" + +#include "fvMeshTools.H" using namespace Foam; @@ -107,21 +108,6 @@ void modifyOrAddFace } -label findPatchID(const polyMesh& mesh, const word& name) -{ - const label patchI = mesh.boundaryMesh().findPatchID(name); - - if (patchI == -1) - { - FatalErrorIn("findPatchID(const polyMesh&, const word&)") - << "Cannot find patch " << name << endl - << "Valid patches are " << mesh.boundaryMesh().names() - << exit(FatalError); - } - return patchI; -} - - // Main program: int main(int argc, char *argv[]) @@ -129,102 +115,63 @@ int main(int argc, char *argv[]) argList::addNote ( "Makes internal faces into boundary faces.\n" - "Does not duplicate points, unlike mergeOrSplitBaffles." + "Does not duplicate points." ); - + #include "addDictOption.H" #include "addOverwriteOption.H" + #include "addDictOption.H" #include "addRegionOption.H" - - argList::validArgs.append("faceZone"); - argList::validArgs.append("(masterPatch slavePatch)"); - argList::addOption - ( - "additionalPatches", - "((master2 slave2) .. (masterN slaveN))" - ); - argList::addBoolOption - ( - "internalFacesOnly", - "do not convert boundary faces" - ); - argList::addBoolOption - ( - "updateFields", - "update fields to include new patches:" - " NOTE: updated field values may need to be edited" - ); - #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); #include "createNamedMesh.H" - const word oldInstance = mesh.pointsInstance(); - - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - const faceZoneMesh& faceZones = mesh.faceZones(); - - // Faces to baffle - faceZoneID zoneID(args.additionalArgs()[0], faceZones); - Info<< "Converting faces on zone " << zoneID.name() - << " into baffles." << nl << endl; - - if (zoneID.index() == -1) - { - FatalErrorIn(args.executable()) << "Cannot find faceZone " - << zoneID.name() << endl - << "Valid zones are " << faceZones.names() - << exit(FatalError); - } + const bool overwrite = args.optionFound("overwrite"); - const faceZone& fZone = faceZones[zoneID.index()]; + const word oldInstance = mesh.pointsInstance(); - Info<< "Found " << returnReduce(fZone.size(), sumOp<label>()) - << " faces on zone " << zoneID.name() << nl << endl; + const word dictName("createBafflesDict"); + #include "setSystemMeshDictionaryIO.H" - // Make sure patches and zoneFaces are synchronised across couples - patches.checkParallelSync(true); - fZone.checkParallelSync(true); + Switch internalFacesOnly(false); - // Patches to put baffles into - DynamicList<label> newMasterPatches(1); - DynamicList<label> newSlavePatches(1); + Switch noFields(false); - const Pair<word> patchNames(IStringStream(args.additionalArgs()[1])()); - newMasterPatches.append(findPatchID(mesh, patchNames[0])); - newSlavePatches.append(findPatchID(mesh, patchNames[1])); - Info<< "Using master patch " << patchNames[0] - << " at index " << newMasterPatches[0] << endl; - Info<< "Using slave patch " << patchNames[1] - << " at index " << newSlavePatches[0] << endl; + PtrList<faceSelection> selectors; + { + Info<< "Reading baffle criteria from " << dictName << nl << endl; + IOdictionary dict(dictIO); + dict.lookup("internalFacesOnly") >> internalFacesOnly; + noFields = dict.lookupOrDefault("noFields", false); - // Additional patches - if (args.optionFound("additionalPatches")) - { - const List<Pair<word> > patchNames - ( - args.optionLookup("additionalPatches")() - ); + const dictionary& selectionsDict = dict.subDict("baffles"); - newMasterPatches.reserve(patchNames.size() + 1); - newSlavePatches.reserve(patchNames.size() + 1); - forAll(patchNames, i) + label n = 0; + forAllConstIter(dictionary, selectionsDict, iter) + { + if (iter().isDict()) + { + n++; + } + } + selectors.setSize(n); + n = 0; + forAllConstIter(dictionary, selectionsDict, iter) { - newMasterPatches.append(findPatchID(mesh, patchNames[i][0])); - newSlavePatches.append(findPatchID(mesh, patchNames[i][1])); - Info<< "Using additional patches " << patchNames[i] - << " at indices " << newMasterPatches.last() - << " and " << newSlavePatches.last() - << endl; + if (iter().isDict()) + { + selectors.set + ( + n++, + faceSelection::New(iter().keyword(), mesh, iter().dict()) + ); + } } } - const bool overwrite = args.optionFound("overwrite"); - const bool internalFacesOnly = args.optionFound("internalFacesOnly"); - if (internalFacesOnly) { Info<< "Not converting faces on non-coupled patches." << nl << endl; @@ -237,208 +184,433 @@ int main(int argc, char *argv[]) // Read vol fields. Info<< "Reading geometric fields" << nl << endl; PtrList<volScalarField> vsFlds; - ReadFields(mesh, objects, vsFlds); + if (!noFields) ReadFields(mesh, objects, vsFlds); PtrList<volVectorField> vvFlds; - ReadFields(mesh, objects, vvFlds); + if (!noFields) ReadFields(mesh, objects, vvFlds); PtrList<volSphericalTensorField> vstFlds; - ReadFields(mesh, objects, vstFlds); + if (!noFields) ReadFields(mesh, objects, vstFlds); PtrList<volSymmTensorField> vsymtFlds; - ReadFields(mesh, objects, vsymtFlds); + if (!noFields) ReadFields(mesh, objects, vsymtFlds); PtrList<volTensorField> vtFlds; - ReadFields(mesh, objects, vtFlds); + if (!noFields) ReadFields(mesh, objects, vtFlds); // Read surface fields. PtrList<surfaceScalarField> ssFlds; - ReadFields(mesh, objects, ssFlds); + if (!noFields) ReadFields(mesh, objects, ssFlds); PtrList<surfaceVectorField> svFlds; - ReadFields(mesh, objects, svFlds); + if (!noFields) ReadFields(mesh, objects, svFlds); PtrList<surfaceSphericalTensorField> sstFlds; - ReadFields(mesh, objects, sstFlds); + if (!noFields) ReadFields(mesh, objects, sstFlds); PtrList<surfaceSymmTensorField> ssymtFlds; - ReadFields(mesh, objects, ssymtFlds); + if (!noFields) ReadFields(mesh, objects, ssymtFlds); PtrList<surfaceTensorField> stFlds; - ReadFields(mesh, objects, stFlds); + if (!noFields) ReadFields(mesh, objects, stFlds); - // Mesh change container - polyTopoChange meshMod(mesh); - // Do the actual changes. Note: - // - loop in incrementing face order (not necessary if faceZone ordered). - // Preserves any existing ordering on patch faces. - // - two passes, do non-flip faces first and flip faces second. This - // guarantees that when e.g. creating a cyclic all faces from one - // side come first and faces from the other side next. + // Creating (if necessary) baffles + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + forAll(selectors, selectorI) + { + const word& name = selectors[selectorI].name(); + + if (mesh.faceZones().findZoneID(name) == -1) + { + mesh.faceZones().clearAddressing(); + label sz = mesh.faceZones().size(); + + labelList addr(0); + boolList flip(0); + mesh.faceZones().setSize(sz+1); + mesh.faceZones().set + ( + sz, + new faceZone(name, addr, flip, sz, mesh.faceZones()) + ); + } + } - // Whether first use of face (modify) or consecutive (add) - PackedBoolList modifiedFace(mesh.nFaces()); - label nModified = 0; - forAll(newMasterPatches, i) + // Select faces + // ~~~~~~~~~~~~ + + //- Per face zoneID it is in and flip status. + labelList faceToZoneID(mesh.nFaces(), -1); + boolList faceToFlip(mesh.nFaces(), false); + forAll(selectors, selectorI) { - // Pass 1. Do selected side of zone - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const word& name = selectors[selectorI].name(); + label zoneID = mesh.faceZones().findZoneID(name); + + selectors[selectorI].select(zoneID, faceToZoneID, faceToFlip); + } - for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + // Add faces to faceZones + labelList nFaces(mesh.faceZones().size(), 0); + forAll(faceToZoneID, faceI) + { + label zoneID = faceToZoneID[faceI]; + if (zoneID != -1) { - label zoneFaceI = fZone.whichFace(faceI); + nFaces[zoneID]++; + } + } - if (zoneFaceI != -1) + forAll(selectors, selectorI) + { + const word& name = selectors[selectorI].name(); + label zoneID = mesh.faceZones().findZoneID(name); + + label& n = nFaces[zoneID]; + labelList addr(n); + boolList flip(n); + n = 0; + forAll(faceToZoneID, faceI) + { + label zone = faceToZoneID[faceI]; + if (zone == zoneID) { - if (!fZone.flipMap()[zoneFaceI]) - { - // Use owner side of face - modifyOrAddFace - ( - meshMod, - mesh.faces()[faceI], // modified face - faceI, // label of face - mesh.faceOwner()[faceI],// owner - false, // face flip - newMasterPatches[i], // patch for face - zoneID.index(), // zone for face - false, // face flip in zone - modifiedFace // modify or add status - ); - } - else - { - // Use neighbour side of face - modifyOrAddFace - ( - meshMod, - mesh.faces()[faceI].reverseFace(), // modified face - faceI, // label of face - mesh.faceNeighbour()[faceI],// owner - true, // face flip - newMasterPatches[i], // patch for face - zoneID.index(), // zone for face - true, // face flip in zone - modifiedFace // modify or add status - ); - } - - nModified++; + addr[n] = faceI; + flip[n] = faceToFlip[faceI]; + n++; } } + Info<< "Created zone " << name + << " at index " << zoneID + << " with " << n << " faces" << endl; + + mesh.faceZones().set + ( + zoneID, + new faceZone(name, addr, flip, zoneID, mesh.faceZones()) + ); + } + - // Pass 2. Do other side of zone - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + // Count patches to add + // ~~~~~~~~~~~~~~~~~~~~ + HashSet<word> bafflePatches; + { + forAll(selectors, selectorI) { - label zoneFaceI = fZone.whichFace(faceI); + const dictionary& patchSources + ( + selectors[selectorI].dict().subDict("patches") + ); + forAllConstIter(dictionary, patchSources, iter) + { + //const word& patchName = iter().keyword(); + const word patchName(iter().dict()["name"]); + bafflePatches.insert(patchName); + } + } + } + - if (zoneFaceI != -1) + + // Create baffles + // ~~~~~~~~~~~~~~ + // Is done in multiple steps + // - create patches with 'calculated' patchFields + // - move faces into these patches + // - change the patchFields to the wanted type + // This order is done so e.g. fixedJump works: + // - you cannot create patchfields at the same time as patches since + // they do an evaluate upon construction + // - you want to create the patchField only after you have faces + // so you don't get the 'create-from-nothing' mapping problem. + + + // Pass 1: add patches + // ~~~~~~~~~~~~~~~~~~~ + + //HashSet<word> addedPatches; + { + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + forAll(selectors, selectorI) + { + const dictionary& patchSources + ( + selectors[selectorI].dict().subDict("patches") + ); + forAllConstIter(dictionary, patchSources, iter) { - if (!fZone.flipMap()[zoneFaceI]) + //const word& patchName = iter().keyword(); + const word patchName(iter().dict()["name"]); + + label destPatchI = pbm.findPatchID(patchName); + + if (destPatchI == -1) { - // Use neighbour side of face - modifyOrAddFace + dictionary patchDict = iter().dict(); + patchDict.set("nFaces", 0); + patchDict.set("startFace", 0); + + Info<< "Adding new patch " << patchName + << " from " << patchDict << endl; + + autoPtr<polyPatch> ppPtr ( - meshMod, - mesh.faces()[faceI].reverseFace(), // modified face - faceI, // label of face - mesh.faceNeighbour()[faceI], // owner - true, // face flip - newSlavePatches[i], // patch for face - zoneID.index(), // zone for face - true, // face flip in zone - modifiedFace // modify or add + polyPatch::New + ( + patchName, + patchDict, + 0, + pbm + ) ); + + // Add patch, create calculated everywhere + fvMeshTools::addPatch + ( + mesh, + ppPtr(), + dictionary(), // do not set specialised patchFields + calculatedFvPatchField<scalar>::typeName, + true // parallel sync'ed addition + ); + + //addedPatches.insert(patchName); } else { - // Use owner side of face - modifyOrAddFace - ( - meshMod, - mesh.faces()[faceI], // modified face - faceI, // label of face - mesh.faceOwner()[faceI],// owner - false, // face flip - newSlavePatches[i], // patch for face - zoneID.index(), // zone for face - false, // face flip in zone - modifiedFace // modify or add status - ); + Info<< "Patch '" << patchName << "' already exists. Only " + << "moving patch faces - type will remain the same" + << endl; } } } + } - // Modify any boundary faces - // ~~~~~~~~~~~~~~~~~~~~~~~~~ - // Normal boundary: - // - move to new patch. Might already be back-to-back baffle - // you want to add cyclic to. Do warn though. - // - // Processor boundary: - // - do not move to cyclic - // - add normal patches though. + // Make sure patches and zoneFaces are synchronised across couples + mesh.boundaryMesh().checkParallelSync(true); + mesh.faceZones().checkParallelSync(true); - // For warning once per patch. - labelHashSet patchWarned; - forAll(patches, patchI) - { - const polyPatch& pp = patches[patchI]; - label newPatchI = newMasterPatches[i]; + // Mesh change container + polyTopoChange meshMod(mesh); + + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + + // Do the actual changes. Note: + // - loop in incrementing face order (not necessary if faceZone ordered). + // Preserves any existing ordering on patch faces. + // - two passes, do non-flip faces first and flip faces second. This + // guarantees that when e.g. creating a cyclic all faces from one + // side come first and faces from the other side next. - if (pp.coupled() && patches[newPatchI].coupled()) + // Whether first use of face (modify) or consecutive (add) + PackedBoolList modifiedFace(mesh.nFaces()); + label nModified = 0; + + forAll(selectors, selectorI) + { + const word& name = selectors[selectorI].name(); + label zoneID = mesh.faceZones().findZoneID(name); + const faceZone& fZone = mesh.faceZones()[zoneID]; + + const dictionary& patchSources + ( + selectors[selectorI].dict().subDict("patches") + ); + + DynamicList<label> newMasterPatches(patchSources.size()); + DynamicList<label> newSlavePatches(patchSources.size()); + + bool master = true; + + forAllConstIter(dictionary, patchSources, iter) + { + //const word& patchName = iter().keyword(); + const word patchName(iter().dict()["name"]); + label patchI = pbm.findPatchID(patchName); + if (master) { - // Do not allow coupled faces to be moved to different coupled - // patches. + newMasterPatches.append(patchI); } - else if (pp.coupled() || !internalFacesOnly) + else { - forAll(pp, i) - { - label faceI = pp.start()+i; + newSlavePatches.append(patchI); + } + master = !master; + } - label zoneFaceI = fZone.whichFace(faceI); - if (zoneFaceI != -1) - { - if (patchWarned.insert(patchI)) - { - WarningIn(args.executable()) - << "Found boundary face (in patch " << pp.name() - << ") in faceZone " << fZone.name() - << " to convert to baffle patch " - << patches[newPatchI].name() - << endl - << " Run with -internalFacesOnly option" - << " if you don't wish to convert" - << " boundary faces." << endl; - } + forAll(newMasterPatches, i) + { + // Pass 1. Do selected side of zone + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label zoneFaceI = fZone.whichFace(faceI); + + if (zoneFaceI != -1) + { + if (!fZone.flipMap()[zoneFaceI]) + { + // Use owner side of face modifyOrAddFace ( meshMod, - mesh.faces()[faceI], // modified face + mesh.faces()[faceI], // modified face + faceI, // label of face + mesh.faceOwner()[faceI],// owner + false, // face flip + newMasterPatches[i], // patch for face + fZone.index(), // zone for face + false, // face flip in zone + modifiedFace // modify or add status + ); + } + else + { + // Use neighbour side of face + modifyOrAddFace + ( + meshMod, + mesh.faces()[faceI].reverseFace(), // modified face faceI, // label of face - mesh.faceOwner()[faceI], // owner - false, // face flip - newPatchI, // patch for face - zoneID.index(), // zone for face - fZone.flipMap()[zoneFaceI], // face flip in zone + mesh.faceNeighbour()[faceI],// owner + true, // face flip + newMasterPatches[i], // patch for face + fZone.index(), // zone for face + true, // face flip in zone modifiedFace // modify or add status ); - nModified++; + } + + nModified++; + } + } + + + // Pass 2. Do other side of zone + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) + { + label zoneFaceI = fZone.whichFace(faceI); + + if (zoneFaceI != -1) + { + if (!fZone.flipMap()[zoneFaceI]) + { + // Use neighbour side of face + modifyOrAddFace + ( + meshMod, + mesh.faces()[faceI].reverseFace(), // modified face + faceI, // label of face + mesh.faceNeighbour()[faceI], // owner + true, // face flip + newSlavePatches[i], // patch for face + fZone.index(), // zone for face + true, // face flip in zone + modifiedFace // modify or add + ); + } + else + { + // Use owner side of face + modifyOrAddFace + ( + meshMod, + mesh.faces()[faceI], // modified face + faceI, // label of face + mesh.faceOwner()[faceI],// owner + false, // face flip + newSlavePatches[i], // patch for face + fZone.index(), // zone for face + false, // face flip in zone + modifiedFace // modify or add status + ); + } + } + } + + + // Modify any boundary faces + // ~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Normal boundary: + // - move to new patch. Might already be back-to-back baffle + // you want to add cyclic to. Do warn though. + // + // Processor boundary: + // - do not move to cyclic + // - add normal patches though. + + // For warning once per patch. + labelHashSet patchWarned; + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + label newPatchI = newMasterPatches[i]; + + if (pp.coupled() && pbm[newPatchI].coupled()) + { + // Do not allow coupled faces to be moved to different + // coupled patches. + } + else if (pp.coupled() || !internalFacesOnly) + { + forAll(pp, i) + { + label faceI = pp.start()+i; + + label zoneFaceI = fZone.whichFace(faceI); + + if (zoneFaceI != -1) + { + if (patchWarned.insert(patchI)) + { + WarningIn(args.executable()) + << "Found boundary face (in patch " + << pp.name() + << ") in faceZone " << fZone.name() + << " to convert to baffle patch " + << pbm[newPatchI].name() + << endl + << " Run with -internalFacesOnly option" + << " if you don't wish to convert" + << " boundary faces." << endl; + } + + modifyOrAddFace + ( + meshMod, + mesh.faces()[faceI], // modified face + faceI, // label of face + mesh.faceOwner()[faceI], // owner + false, // face flip + newPatchI, // patch for face + fZone.index(), // zone for face + fZone.flipMap()[zoneFaceI], // face flip in zone + modifiedFace // modify or add + ); + nModified++; + } } } } @@ -447,7 +619,8 @@ int main(int argc, char *argv[]) Info<< "Converted " << returnReduce(nModified, sumOp<label>()) - << " faces into boundary faces on patches " << patchNames << nl << endl; + << " faces into boundary faces in patches " + << bafflePatches.sortedToc() << nl << endl; if (!overwrite) { @@ -460,14 +633,20 @@ int main(int argc, char *argv[]) // Update fields mesh.updateMesh(map); + + // Correct boundary faces mapped-out-of-nothing. + // This is just a hack to correct the value field. { fvMeshMapper mapper(mesh, map); bool hasWarned = false; - forAll(newMasterPatches, i) + + forAllConstIter(HashSet<word>, bafflePatches, iter) { - label patchI = newMasterPatches[i]; + label patchI = mesh.boundaryMesh().findPatchID(iter.key()); + const fvPatchMapper& pm = mapper.boundaryMap()[patchI]; + if (pm.sizeBeforeMapping() == 0) { if (!hasWarned) @@ -478,40 +657,48 @@ int main(int argc, char *argv[]) << "You might have to edit these fields." << endl; } - SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero); - SetPatchFields(vvFlds, patchI, pTraits<vector>::zero); - SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero); - SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero); - SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero); - - SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero); - SetPatchFields(svFlds, patchI, pTraits<vector>::zero); - SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero); - SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero); - SetPatchFields(stFlds, patchI, pTraits<tensor>::zero); + fvMeshTools::zeroPatchFields(mesh, patchI); } } - forAll(newSlavePatches, i) + } + + + // Pass 2: change patchFields + // ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + { + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + forAll(selectors, selectorI) { - label patchI = newSlavePatches[i]; - const fvPatchMapper& pm = mapper.boundaryMap()[patchI]; - if (pm.sizeBeforeMapping() == 0) + const dictionary& patchSources + ( + selectors[selectorI].dict().subDict("patches") + ); + forAllConstIter(dictionary, patchSources, iter) { - SetPatchFields(vsFlds, patchI, pTraits<scalar>::zero); - SetPatchFields(vvFlds, patchI, pTraits<vector>::zero); - SetPatchFields(vstFlds, patchI, pTraits<sphericalTensor>::zero); - SetPatchFields(vsymtFlds, patchI, pTraits<symmTensor>::zero); - SetPatchFields(vtFlds, patchI, pTraits<tensor>::zero); - - SetPatchFields(ssFlds, patchI, pTraits<scalar>::zero); - SetPatchFields(svFlds, patchI, pTraits<vector>::zero); - SetPatchFields(sstFlds, patchI, pTraits<sphericalTensor>::zero); - SetPatchFields(ssymtFlds, patchI, pTraits<symmTensor>::zero); - SetPatchFields(stFlds, patchI, pTraits<tensor>::zero); + //const word& patchName = iter().keyword(); + const word patchName(iter().dict()["name"]); + label patchI = pbm.findPatchID(patchName); + + if (iter().dict().found("patchFields")) + { + const dictionary& patchFieldsDict = iter().dict().subDict + ( + "patchFields" + ); + + fvMeshTools::setPatchFields + ( + mesh, + patchI, + patchFieldsDict + ); + } } } } + // Move mesh (since morphing might not do this) if (map().hasMotionPoints()) { @@ -522,6 +709,7 @@ int main(int argc, char *argv[]) { mesh.setInstance(oldInstance); } + Info<< "Writing mesh to " << runTime.timeName() << endl; mesh.write(); diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict b/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict new file mode 100644 index 0000000000000000000000000000000000000000..99c03b4cfc7429af81364a42f2613eec1ee21bb9 --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/createBafflesDict @@ -0,0 +1,189 @@ +/*--------------------------------*- 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; + object createBafflesDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Whether to convert internal faces only (so leave boundary faces intact). +// This is only relevant if your face selection type can pick up boundary +// faces. +internalFacesOnly true; + +// Optionally do not read/convert/write any fields. +//noFields true; + + +// Baffles to create. +baffles +{ + baffleFaces + { + //- Use predefined faceZone to select faces and orientation. + type faceZone; + zoneName baffleFaces; + + + //- Optional flip + //flip false; + + patches + { + master + { + //- Master side patch + name baffles; + type wall; + + //- Optional override of added patchfields. If not specified + // any added patchfields are of type calculated. + patchFields + { + epsilon + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + k + { + type kqRWallFunction; + value uniform 0; + } + nut + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + nuTilda + { + type zeroGradient; + } + p + { + type zeroGradient; + } + U + { + type fixedValue; + value uniform (0 0 0); + } + } + } + slave + { + //- Slave side patch + name baffles; + type wall; + + patchFields + { + epsilon + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + k + { + type kqRWallFunction; + value uniform 0; + } + nut + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + nuTilda + { + type zeroGradient; + } + p + { + type zeroGradient; + } + U + { + type fixedValue; + value uniform (0 0 0); + } + } + } + } + } + + + + cyclicFaces + { + //- Select faces and orientation through a searchableSurface + type searchableSurface; + surface searchablePlate; + origin (0.099 -0.006 0.004); + span (0 0.012 0.012); + + patches + { + master + { + //- Master side patch + + name fan_half0; + type cyclic; + neighbourPatch fan_half1; + + patchFields + { + p + { + type fan; + patchType cyclic; + jump uniform 0; + value uniform 0; + jumpTable polynomial 1((100 0)); + } + } + } + slave + { + //- Slave side patch + + name fan_half1; + type cyclic; + neighbourPatch fan_half0; + + patchFields + { + p + { + type fan; + patchType cyclic; + value uniform 0; + } + } + } + } + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.C b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.C new file mode 100644 index 0000000000000000000000000000000000000000..57a6b554c7990d7f50a2b84ae0f1dba9500a58eb --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.C @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "faceSelection.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(faceSelection, 0); + defineRunTimeSelectionTable(faceSelection, dictionary); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::faceSelection::faceSelection +( + const word& name, + const fvMesh& mesh, + const dictionary& dict +) +: + name_(name), + mesh_(mesh), + dict_(dict), + flip_(dict.lookupOrDefault("flip", false)) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::faceSelection::~faceSelection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::faceSelection> Foam::faceSelection::New +( + const word& name, + const fvMesh& mesh, + const dictionary& dict +) +{ + const word sampleType(dict.lookup("type")); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(sampleType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "faceSelection::New" + "(const word&, const fvMesh&, const dictionary&)" + ) << "Unknown faceSelection type " + << sampleType << nl << nl + << "Valid faceSelection types : " << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr<faceSelection>(cstrIter()(name, mesh, dict)); +} + + +void Foam::faceSelection::select +( + const label zoneID, + labelList& faceToZoneID, + boolList& faceToFlip +) const +{ + if (flip_) + { + forAll(faceToZoneID, faceI) + { + if (faceToZoneID[faceI] == zoneID) + { + faceToFlip[faceI] = !faceToFlip[faceI]; + } + } + } +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H new file mode 100644 index 0000000000000000000000000000000000000000..7be333f030fc8dcd888d41f12badc6d35c97bf7c --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceSelection.H @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::faceSelection + +Description + Face selection method for createBaffles + +SourceFiles + faceSelection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef faceSelection_H +#define faceSelection_H + +#include "dictionary.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "autoPtr.H" +#include "boolList.H" +#include "labelList.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class faceSelection Declaration +\*---------------------------------------------------------------------------*/ + +class faceSelection +{ +protected: + + // Protected data + + //- Name + const word name_; + + //- Reference to mesh + const fvMesh& mesh_; + + //- Input dictionary + const dictionary dict_; + + //- Switch direction? + const Switch flip_; + +public: + + //- Runtime type information + TypeName("faceSelection"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + faceSelection, + dictionary, + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict + ), + (name, mesh, dict) + ); + + + // Constructors + + //- Construct from dictionary + faceSelection + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Clone + autoPtr<faceSelection> clone() const + { + notImplemented("autoPtr<faceSelection> clone() const"); + return autoPtr<faceSelection>(NULL); + } + + + // Selectors + + //- Return a reference to the selected faceSelection + static autoPtr<faceSelection> New + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict + ); + + + //- Destructor + virtual ~faceSelection(); + + + // Member Functions + + const word& name() const + { + return name_; + } + + const dictionary& dict() const + { + return dict_; + } + + virtual void select(const label, labelList&, boolList&) const = 0; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C new file mode 100644 index 0000000000000000000000000000000000000000..bdc6d84e67d3b3c4b55eefe1c6bf0030e28c5857 --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "faceZoneSelection.H" +#include "addToRunTimeSelectionTable.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace faceSelections +{ + defineTypeNameAndDebug(faceZoneSelection, 0); + addToRunTimeSelectionTable(faceSelection, faceZoneSelection, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::faceSelections::faceZoneSelection::faceZoneSelection +( + const word& name, + const fvMesh& mesh, + const dictionary& dict +) +: + faceSelection(name, mesh, dict), + zoneName_(dict_.lookup("zoneName")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::faceSelections::faceZoneSelection::~faceZoneSelection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::faceSelections::faceZoneSelection::select +( + const label zoneID, + labelList& faceToZoneID, + boolList& faceToFlip +) const +{ + label readID = mesh_.faceZones().findZoneID(zoneName_); + + if (readID == -1) + { + FatalErrorIn + ( + "faceSelections::faceZoneSelection::select(labelList&) const" + ) << "Cannot find faceZone " << zoneName_ << nl << "Valid zones are " + << mesh_.faceZones().names() + << exit(FatalError); + } + + const faceZone& fZone = mesh_.faceZones()[readID]; + + forAll(fZone, i) + { + label faceI = fZone[i]; + + if (faceToZoneID[faceI] == -1) + { + faceToZoneID[faceI] = zoneID; + faceToFlip[faceI] = fZone.flipMap()[i]; + } + else if (faceToZoneID[faceI] != zoneID) + { + FatalErrorIn + ( + "faceSelections::faceZoneSelection::select(labelList&) const" + ) << "Face " << faceI << " already in faceZone " + << faceToZoneID[faceI] + << exit(FatalError); + } + } + + faceSelection::select(zoneID, faceToZoneID, faceToFlip); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H new file mode 100644 index 0000000000000000000000000000000000000000..1a2b15d36640e841e915d8aa6100229e088d0273 --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/faceZoneSelection.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::faceSelections::faceZoneSelection + +Description + Deselect cells not reachable from 'inside' points + +SourceFiles + faceZoneSelection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef faceZoneSelection_H +#define faceZoneSelection_H + +#include "faceSelection.H" +#include "pointField.H" +#include "boolList.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class regionSplit; + +namespace faceSelections +{ + +/*---------------------------------------------------------------------------*\ + Class faceZoneSelection Declaration +\*---------------------------------------------------------------------------*/ + +class faceZoneSelection +: + public faceSelection +{ + // Private data + + //- Name of faceZone + const word zoneName_; + + + // Private Member Functions + +public: + + //- Runtime type information + TypeName("faceZone"); + + + // Constructors + + //- Construct from dictionary + faceZoneSelection + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Clone + autoPtr<faceSelection> clone() const + { + notImplemented("autoPtr<faceSelection> clone() const"); + return autoPtr<faceSelection>(NULL); + } + + + //- Destructor + virtual ~faceZoneSelection(); + + + // Member Functions + + //- Apply this selector + virtual void select(const label zoneID, labelList&, boolList&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace faceSelections +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C new file mode 100644 index 0000000000000000000000000000000000000000..1dbaaafaf8415d43339f57bfc499ac91cc3b32f7 --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.C @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "searchableSurfaceSelection.H" +#include "addToRunTimeSelectionTable.H" +#include "syncTools.H" +#include "searchableSurface.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace faceSelections +{ + defineTypeNameAndDebug(searchableSurfaceSelection, 0); + addToRunTimeSelectionTable + ( + faceSelection, + searchableSurfaceSelection, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::faceSelections::searchableSurfaceSelection::searchableSurfaceSelection +( + const word& name, + const fvMesh& mesh, + const dictionary& dict +) +: + faceSelection(name, mesh, dict), + surfacePtr_ + ( + searchableSurface::New + ( + word(dict.lookup("surface")), + mesh.objectRegistry::db(), + dict + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::faceSelections::searchableSurfaceSelection::~searchableSurfaceSelection() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::faceSelections::searchableSurfaceSelection::select +( + const label zoneID, + labelList& faceToZoneID, + boolList& faceToFlip +) const +{ + // Get cell-cell centre vectors + + pointField start(mesh_.nFaces()); + pointField end(mesh_.nFaces()); + + // Internal faces + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + start[faceI] = mesh_.cellCentres()[mesh_.faceOwner()[faceI]]; + end[faceI] = mesh_.cellCentres()[mesh_.faceNeighbour()[faceI]]; + } + + // Boundary faces + vectorField neighbourCellCentres; + syncTools::swapBoundaryCellList + ( + mesh_, + mesh_.cellCentres(), + neighbourCellCentres + ); + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (pp.coupled()) + { + forAll(pp, i) + { + label faceI = pp.start()+i; + start[faceI] = mesh_.cellCentres()[mesh_.faceOwner()[faceI]]; + end[faceI] = neighbourCellCentres[faceI-mesh_.nInternalFaces()]; + } + } + else + { + forAll(pp, i) + { + label faceI = pp.start()+i; + start[faceI] = mesh_.cellCentres()[mesh_.faceOwner()[faceI]]; + end[faceI] = mesh_.faceCentres()[faceI]; + } + } + } + + List<pointIndexHit> hits; + surfacePtr_().findLine(start, end, hits); + pointField normals; + surfacePtr_().getNormal(hits, normals); + + //- Note: do not select boundary faces. + + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + if (hits[faceI].hit()) + { + faceToZoneID[faceI] = zoneID; + vector d = end[faceI]-start[faceI]; + faceToFlip[faceI] = ((normals[faceI] & d) < 0); + } + } + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (pp.coupled()) + { + forAll(pp, i) + { + label faceI = pp.start()+i; + if (hits[faceI].hit()) + { + faceToZoneID[faceI] = zoneID; + vector d = end[faceI]-start[faceI]; + faceToFlip[faceI] = ((normals[faceI] & d) < 0); + } + } + } + } + + faceSelection::select(zoneID, faceToZoneID, faceToFlip); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H new file mode 100644 index 0000000000000000000000000000000000000000..f983132552799c5aff690c06cca9e492d16da4ae --- /dev/null +++ b/applications/utilities/mesh/manipulation/createBaffles/faceSelection/searchableSurfaceSelection.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::faceSelections::searchableSurfaceSelection + +Description + Selects all (internal or coupled) faces intersecting the searchableSurface. + +SourceFiles + searchableSurfaceSelection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef searchableSurfaceSelection_H +#define searchableSurfaceSelection_H + +#include "faceSelection.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class searchableSurface; + +namespace faceSelections +{ + +/*---------------------------------------------------------------------------*\ + Class searchableSurfaceSelection Declaration +\*---------------------------------------------------------------------------*/ + +class searchableSurfaceSelection +: + public faceSelection +{ + // Private data + + autoPtr<searchableSurface> surfacePtr_; + +public: + + //- Runtime type information + TypeName("searchableSurface"); + + + // Constructors + + //- Construct from dictionary + searchableSurfaceSelection + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict + ); + + //- Clone + autoPtr<faceSelection> clone() const + { + notImplemented("autoPtr<faceSelection> clone() const"); + return autoPtr<faceSelection>(NULL); + } + + + //- Destructor + virtual ~searchableSurfaceSelection(); + + + // Member Functions + + virtual void select(const label zoneID, labelList&, boolList&) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace faceSelections +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 7a969e15d16ffdf7c952a608e3c5780c999b7b38..9e89c8d4dfc67f57522ba2ac516db98ccfe480b3 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -505,13 +505,7 @@ int main(int argc, char *argv[]) { #include "addOverwriteOption.H" #include "addRegionOption.H" - argList::addOption - ( - "dict", - "word", - "name of dictionary to provide patch information" - ); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); @@ -521,38 +515,20 @@ int main(int argc, char *argv[]) const bool overwrite = args.optionFound("overwrite"); - word dictName - ( - args.optionLookupOrDefault<word>("dict", "createPatchDict") - ); + #include "createNamedPolyMesh.H" - Info<< "Reading " << dictName << nl << endl; + const word oldInstance = mesh.pointsInstance(); - IOdictionary dict - ( - IOobject - ( - dictName, - runTime.system(), - ( - meshRegionName != polyMesh::defaultRegion - ? meshRegionName - : word::null - ), - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ); + const word dictName("createPatchDict"); + #include "setSystemMeshDictionaryIO.H" + Info<< "Reading " << dictName << nl << endl; + + IOdictionary dict(dictIO); // Whether to synchronise points const Switch pointSync(dict.lookup("pointSync")); - #include "createNamedPolyMesh.H" - - const word oldInstance = mesh.pointsInstance(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C index df572a3619489a0f93cd5ff24f51bd6358ef918a..26d472c44d8b0577ed1eb478770de710e0822bbd 100644 --- a/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C +++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergePolyMesh.C @@ -33,7 +33,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::mergePolyMesh, 1); +namespace Foam +{ +defineTypeNameAndDebug(mergePolyMesh, 1); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C index e0dabffedb69980041d9c36b3b440f5ffc17174a..a86343da254aaaacb49cac350c9d8a8a5c430831 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/meshDualiser.C @@ -34,7 +34,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::meshDualiser, 0); +namespace Foam +{ +defineTypeNameAndDebug(meshDualiser, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C index f8a206e651cee834f7b39288bd2d22955ad47ef6..098864102d65185e290f572a5a50fcc2dca57b9a 100644 --- a/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C +++ b/applications/utilities/mesh/manipulation/refineMesh/refineMesh.C @@ -298,12 +298,7 @@ int main(int argc, char *argv[]) #include "addOverwriteOption.H" #include "addRegionOption.H" - argList::addBoolOption - ( - "dict", - "refine according to system/refineMeshDict" - ); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); @@ -327,19 +322,12 @@ int main(int argc, char *argv[]) if (readDict) { - Info<< "Refining according to refineMeshDict" << nl << endl; + const word dictName("refineMeshDict"); + #include "setSystemMeshDictionaryIO.H" - refineDict = IOdictionary - ( - IOobject - ( - "refineMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + Info<< "Refining according to " << dictName << nl << endl; + + refineDict = IOdictionary(dictIO); const word setName(refineDict.lookup("set")); diff --git a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C index e64f6cb78ffd432c3c521de2b0c997003b05856a..d03f24cd7c2e4f442f2143b95c0ba59028420f28 100644 --- a/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C +++ b/applications/utilities/mesh/manipulation/renumberMesh/renumberMesh.C @@ -471,6 +471,47 @@ autoPtr<mapPolyMesh> reorderMesh true ); + + // Re-do the faceZones + { + faceZoneMesh& faceZones = mesh.faceZones(); + faceZones.clearAddressing(); + forAll(faceZones, zoneI) + { + faceZone& fZone = faceZones[zoneI]; + labelList newAddressing(fZone.size()); + boolList newFlipMap(fZone.size()); + forAll(fZone, i) + { + label oldFaceI = fZone[i]; + newAddressing[i] = reverseFaceOrder[oldFaceI]; + if (flipFaceFlux.found(newAddressing[i])) + { + newFlipMap[i] = !fZone.flipMap()[i]; + } + else + { + newFlipMap[i] = fZone.flipMap()[i]; + } + } + fZone.resetAddressing(newAddressing, newFlipMap); + } + } + // Re-do the cellZones + { + cellZoneMesh& cellZones = mesh.cellZones(); + cellZones.clearAddressing(); + forAll(cellZones, zoneI) + { + cellZones[zoneI] = UIndirectList<label> + ( + reverseCellOrder, + cellZones[zoneI] + )(); + } + } + + return autoPtr<mapPolyMesh> ( new mapPolyMesh @@ -573,11 +614,7 @@ int main(int argc, char *argv[]) # include "addRegionOption.H" # include "addOverwriteOption.H" # include "addTimeOptions.H" - argList::addBoolOption - ( - "dict", - "renumber according to system/renumberMeshDict" - ); +# include "addDictOption.H" argList::addBoolOption ( "frontWidth", @@ -659,23 +696,13 @@ int main(int argc, char *argv[]) if (readDict) { - Info<< "Renumber according to renumberMeshDict." << nl << endl; + const word dictName("renumberMeshDict"); + #include "setSystemMeshDictionaryIO.H" - renumberDictPtr.reset - ( - new IOdictionary - ( - IOobject - ( - "renumberMeshDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ) - ); - const IOdictionary renumberDict = renumberDictPtr(); + Info<< "Renumber according to " << dictName << nl << endl; + + renumberDictPtr.reset(new IOdictionary(dictIO)); + const IOdictionary& renumberDict = renumberDictPtr(); renumberPtr = renumberMethod::New(renumberDict); diff --git a/applications/utilities/mesh/manipulation/setsToZones/Make/options b/applications/utilities/mesh/manipulation/setsToZones/Make/options index 54c035b8f55d183c1ad02bc372398feceaf31718..ec38e1cbdb1b325739635bd6690d5e060fc069e7 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/Make/options +++ b/applications/utilities/mesh/manipulation/setsToZones/Make/options @@ -2,4 +2,5 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ - -lmeshTools + -lmeshTools \ + -lsampling diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index 2f56bb56930911cc67427cf7d451fc34e6c41b2a..c3d3d6297afa1938c22edbba58e65b5d3259a5cc 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.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 @@ -48,6 +48,7 @@ Description #include "IFstream.H" #include "IOobjectList.H" #include "SortableList.H" +#include "timeSelector.H" using namespace Foam; @@ -57,6 +58,7 @@ using namespace Foam; int main(int argc, char *argv[]) { + timeSelector::addOptions(true, false); argList::addNote ( "add point/face/cell Zones from similar named point/face/cell Sets" @@ -76,15 +78,7 @@ int main(int argc, char *argv[]) const bool noFlipMap = args.optionFound("noFlipMap"); // Get times list - instantList Times = runTime.times(); - - label startTime = Times.size()-1; - label endTime = Times.size(); - - // check -time and -latestTime options - #include "checkTimeOption.H" - - runTime.setTime(Times[startTime], startTime); + (void)timeSelector::selectIfPresent(runTime, args); #include "createNamedPolyMesh.H" diff --git a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C index 4abdc6c607c25e0fa85c29d14395dc2a5d8b6c62..b57e181a03684ca1ff7708a2f94722bbe5117bc5 100644 --- a/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C +++ b/applications/utilities/mesh/manipulation/splitMeshRegions/splitMeshRegions.C @@ -101,296 +101,13 @@ Description #include "syncTools.H" #include "ReadFields.H" #include "mappedWallPolyPatch.H" +#include "fvMeshTools.H" #include "zeroGradientFvPatchFields.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template<class GeoField> -void addPatchFields(fvMesh& mesh, const word& patchFieldType) -{ - HashTable<const GeoField*> flds - ( - mesh.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); - - label sz = bfld.size(); - bfld.setSize(sz+1); - bfld.set - ( - sz, - GeoField::PatchFieldType::New - ( - patchFieldType, - mesh.boundary()[sz], - fld.dimensionedInternalField() - ) - ); - } -} - - -// Remove last patch field -template<class GeoField> -void trimPatchFields(fvMesh& mesh, const label nPatches) -{ - HashTable<const GeoField*> flds - ( - mesh.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ).setSize(nPatches); - } -} - - -// Reorder patch field -template<class GeoField> -void reorderPatchFields(fvMesh& mesh, const labelList& oldToNew) -{ - HashTable<const GeoField*> flds - ( - mesh.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); - - bfld.reorder(oldToNew); - } -} - - -// Adds patch if not yet there. Returns patchID. -label addPatch(fvMesh& mesh, const polyPatch& patch) -{ - polyBoundaryMesh& polyPatches = - const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); - - label patchI = polyPatches.findPatchID(patch.name()); - if (patchI != -1) - { - if (polyPatches[patchI].type() == patch.type()) - { - // Already there - return patchI; - } - else - { - FatalErrorIn("addPatch(fvMesh&, const polyPatch*)") - << "Already have patch " << patch.name() - << " but of type " << patch.type() - << exit(FatalError); - } - } - - - label insertPatchI = polyPatches.size(); - label startFaceI = mesh.nFaces(); - - forAll(polyPatches, patchI) - { - const polyPatch& pp = polyPatches[patchI]; - - if (isA<processorPolyPatch>(pp)) - { - insertPatchI = patchI; - startFaceI = pp.start(); - break; - } - } - - - // Below is all quite a hack. Feel free to change once there is a better - // mechanism to insert and reorder patches. - - // Clear local fields and e.g. polyMesh parallelInfo. - mesh.clearOut(); - - label sz = polyPatches.size(); - - fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); - - // Add polyPatch at the end - polyPatches.setSize(sz+1); - polyPatches.set - ( - sz, - patch.clone - ( - polyPatches, - insertPatchI, //index - 0, //size - startFaceI //start - ) - ); - fvPatches.setSize(sz+1); - fvPatches.set - ( - sz, - fvPatch::New - ( - polyPatches[sz], // point to newly added polyPatch - mesh.boundary() - ) - ); - - addPatchFields<volScalarField> - ( - mesh, - calculatedFvPatchField<scalar>::typeName - ); - addPatchFields<volVectorField> - ( - mesh, - calculatedFvPatchField<vector>::typeName - ); - addPatchFields<volSphericalTensorField> - ( - mesh, - calculatedFvPatchField<sphericalTensor>::typeName - ); - addPatchFields<volSymmTensorField> - ( - mesh, - calculatedFvPatchField<symmTensor>::typeName - ); - addPatchFields<volTensorField> - ( - mesh, - calculatedFvPatchField<tensor>::typeName - ); - - // Surface fields - - addPatchFields<surfaceScalarField> - ( - mesh, - calculatedFvPatchField<scalar>::typeName - ); - addPatchFields<surfaceVectorField> - ( - mesh, - calculatedFvPatchField<vector>::typeName - ); - addPatchFields<surfaceSphericalTensorField> - ( - mesh, - calculatedFvPatchField<sphericalTensor>::typeName - ); - addPatchFields<surfaceSymmTensorField> - ( - mesh, - calculatedFvPatchField<symmTensor>::typeName - ); - addPatchFields<surfaceTensorField> - ( - mesh, - calculatedFvPatchField<tensor>::typeName - ); - - // Create reordering list - // patches before insert position stay as is - labelList oldToNew(sz+1); - for (label i = 0; i < insertPatchI; i++) - { - oldToNew[i] = i; - } - // patches after insert position move one up - for (label i = insertPatchI; i < sz; i++) - { - oldToNew[i] = i+1; - } - // appended patch gets moved to insert position - oldToNew[sz] = insertPatchI; - - // Shuffle into place - polyPatches.reorder(oldToNew); - fvPatches.reorder(oldToNew); - - reorderPatchFields<volScalarField>(mesh, oldToNew); - reorderPatchFields<volVectorField>(mesh, oldToNew); - reorderPatchFields<volSphericalTensorField>(mesh, oldToNew); - reorderPatchFields<volSymmTensorField>(mesh, oldToNew); - reorderPatchFields<volTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceScalarField>(mesh, oldToNew); - reorderPatchFields<surfaceVectorField>(mesh, oldToNew); - reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceTensorField>(mesh, oldToNew); - - return insertPatchI; -} - - -// Reorder and delete patches. -void reorderPatches -( - fvMesh& mesh, - const labelList& oldToNew, - const label nNewPatches -) -{ - polyBoundaryMesh& polyPatches = - const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); - fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); - - // Shuffle into place - polyPatches.reorder(oldToNew); - fvPatches.reorder(oldToNew); - - reorderPatchFields<volScalarField>(mesh, oldToNew); - reorderPatchFields<volVectorField>(mesh, oldToNew); - reorderPatchFields<volSphericalTensorField>(mesh, oldToNew); - reorderPatchFields<volSymmTensorField>(mesh, oldToNew); - reorderPatchFields<volTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceScalarField>(mesh, oldToNew); - reorderPatchFields<surfaceVectorField>(mesh, oldToNew); - reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew); - reorderPatchFields<surfaceTensorField>(mesh, oldToNew); - - // Remove last. - polyPatches.setSize(nNewPatches); - fvPatches.setSize(nNewPatches); - trimPatchFields<volScalarField>(mesh, nNewPatches); - trimPatchFields<volVectorField>(mesh, nNewPatches); - trimPatchFields<volSphericalTensorField>(mesh, nNewPatches); - trimPatchFields<volSymmTensorField>(mesh, nNewPatches); - trimPatchFields<volTensorField>(mesh, nNewPatches); - trimPatchFields<surfaceScalarField>(mesh, nNewPatches); - trimPatchFields<surfaceVectorField>(mesh, nNewPatches); - trimPatchFields<surfaceSphericalTensorField>(mesh, nNewPatches); - trimPatchFields<surfaceSymmTensorField>(mesh, nNewPatches); - trimPatchFields<surfaceTensorField>(mesh, nNewPatches); -} - - // Prepend prefix to selected patches. void renamePatches ( @@ -1193,8 +910,8 @@ void createAndWriteRegion } } - reorderPatches(newMesh(), oldToNew, nNewPatches); - + //reorderPatches(newMesh(), oldToNew, nNewPatches); + fvMeshTools::reorderPatches(newMesh(), oldToNew, nNewPatches, true); // Rename shared patches with region name if (prefixRegion) @@ -1360,7 +1077,15 @@ labelList addRegionPatches mesh.boundaryMesh() ); - interfacePatches[interI] = addPatch(mesh, patch1); + //interfacePatches[interI] = addPatch(mesh, patch1); + interfacePatches[interI] = fvMeshTools::addPatch + ( + mesh, + patch1, + dictionary(), //optional per field value + calculatedFvPatchField<scalar>::typeName, + true //validBoundary + ); mappedWallPolyPatch patch2 ( @@ -1374,7 +1099,15 @@ labelList addRegionPatches point::zero, // offset mesh.boundaryMesh() ); - addPatch(mesh, patch2); + //addPatch(mesh, patch2); + fvMeshTools::addPatch + ( + mesh, + patch2, + dictionary(), //optional per field value + calculatedFvPatchField<scalar>::typeName, + true //validBoundary + ); Info<< "For interface between region " << regionNames[e[0]] << " and " << regionNames[e[1]] << " added patches" << endl diff --git a/applications/utilities/mesh/manipulation/subsetMesh/Make/options b/applications/utilities/mesh/manipulation/subsetMesh/Make/options index 969020c4afaf5d784299462b9e1af282040ba6b4..52519d4f3b39906bbae2403ceff8169a07c822fa 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/Make/options +++ b/applications/utilities/mesh/manipulation/subsetMesh/Make/options @@ -1,8 +1,11 @@ EXE_INC = \ + -IcellSelection \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ -lfiniteVolume \ + -ldynamicMesh \ -lmeshTools \ -lgenericPatchFields diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index f95b906f5f7ee0e6ce319b11575203d444887aaa..a3358770a82f1bbf748cd1cad672d4de4289d4bd 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.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 diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSet.C b/applications/utilities/mesh/manipulation/topoSet/topoSet.C index c124ca3992358d225aee566436968ed93fb80ee0..6dee4fd0b509ff679245d5ed4f31b440bc4a1f4d 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSet.C +++ b/applications/utilities/mesh/manipulation/topoSet/topoSet.C @@ -193,12 +193,7 @@ polyMesh::readUpdateState meshReadUpdate(polyMesh& mesh) int main(int argc, char *argv[]) { timeSelector::addOptions(true, false); - argList::addOption - ( - "dict", - "file", - "specify an alternative dictionary for the topoSet dictionary" - ); + #include "addDictOption.H" #include "addRegionOption.H" argList::addBoolOption ( @@ -216,41 +211,11 @@ int main(int argc, char *argv[]) const bool noSync = args.optionFound("noSync"); const word dictName("topoSetDict"); - - fileName dictPath = dictName; - if (args.optionFound("dict")) - { - dictPath = args["dict"]; - if (isDir(dictPath)) - { - dictPath = dictPath / dictName; - } - } + #include "setSystemMeshDictionaryIO.H" Info<< "Reading " << dictName << "\n" << endl; - IOdictionary topoSetDict - ( - ( - args.optionFound("dict") - ? IOobject - ( - dictPath, - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - : IOobject - ( - dictName, - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ) - ); - + IOdictionary topoSetDict(dictIO); // Read set construct info from dictionary PtrList<dictionary> actions(topoSetDict.lookup("actions")); diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 31fa348e979b2e66b93d0a96394aaaf99b549234..57514a205352c76e8b6f0e167a8a8739c436c808 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -167,8 +167,10 @@ FoamFile // source regionToCell; // sourceInfo // { -// set c0; // name of cellSet giving mesh subset -// insidePoint (1 2 3); // point inside region to select +// set c0; // optional name of cellSet giving mesh subset +// insidePoints ((1 2 3)); // points inside region to select +// nErode 0; // optional number of layers to erode +// // selection // } // // // Cells underneath plane such that volume is reached. E.g. for use @@ -226,6 +228,12 @@ FoamFile // // (regular expressions allowed) // } // +// // All boundary faces +// source boundaryToFace; +// sourceInfo +// { +// } +// // // All faces of faceZone // source zoneToFace; // sourceInfo @@ -359,6 +367,21 @@ FoamFile // cellSet c0; // name of cellSet of slave side // } // +// // Select based on surface. Orientation from normals on surface +// { +// name fz0; +// type faceZoneSet; +// action new; +// source searchableSurfaceToFaceZone; +// sourceInfo +// { +// surface searchableSphere; +// centre (0.05 0.05 0.005); +// radius 0.025; +// } +// } +// +// // // pointZoneSet // ~~~~~~~~~~~~ diff --git a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C index 5b85aee0771e769ba869076b6ede2c878d9d5839..49c70eb1c355747cc611092d4b295f36edec694c 100644 --- a/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C +++ b/applications/utilities/miscellaneous/foamInfoExec/foamInfoExec.C @@ -51,12 +51,7 @@ int main(int argc, char *argv[]) "keywords", "report keywords for the specified dictionary" ); - argList::addOption - ( - "dict", - "file", - "specify a dictionary to interrogate" - ); + #include "addDictOption.H" argList::addOption ( "entry", @@ -81,9 +76,12 @@ int main(int argc, char *argv[]) if (args.optionFound("dict")) { + fileName dictPath = args["dict"]; const fileName dictFileName ( - args.rootPath()/args.caseName()/args["dict"] + dictPath.isAbsolute() + ? dictPath + : args.rootPath()/args.caseName()/args["dict"] ); IFstream dictFile(dictFileName); diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index 1dd38329e705d2c241d27dc216d77aa3ccab6f65..f5dabf60770a244550405980a9ab250b74b5f6e7 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.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 @@ -428,12 +428,12 @@ bool Foam::domainDecomposition::writeDecomposition() : curProcessorPatchSizes[procPatchI] - subStarts[i] ); - //Info<< "From processor:" << procI << endl - // << " to processor:" << curNeighbourProcessors[procPatchI] - // << endl - // << " via patch:" << subPatchID[i] << endl - // << " start :" << curStart << endl - // << " size :" << size << endl; +// Info<< "From processor:" << procI << endl +// << " to processor:" << curNeighbourProcessors[procPatchI] +// << endl +// << " via patch:" << subPatchID[i] << endl +// << " start :" << curStart << endl +// << " size :" << size << endl; if (subPatchID[i] == -1) { @@ -454,9 +454,14 @@ bool Foam::domainDecomposition::writeDecomposition() } else { + const coupledPolyPatch& pcPatch + = refCast<const coupledPolyPatch> + ( + boundaryMesh()[subPatchID[i]] + ); + // From cyclic - const word& referPatch = - boundaryMesh()[subPatchID[i]].name(); + const word& referPatch = pcPatch.name(); procPatches[nPatches] = new processorCyclicPolyPatch @@ -472,7 +477,8 @@ bool Foam::domainDecomposition::writeDecomposition() procMesh.boundaryMesh(), procI, curNeighbourProcessors[procPatchI], - referPatch + referPatch, + pcPatch.transform() ); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H index 491ada9a43d9c628d295b70555ccec2c2dee0d84..53e234939e22d7bdb310e85ff92e4aa414f66988 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/getTimeIndex.H @@ -9,7 +9,7 @@ } else if ( - runTime.timeName() != "constant" + runTime.timeName() != runTime.constant() && runTime.timeName() != "0" ) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options b/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options index 5c515d8f95b74b2155dc0d75f0fda4bc389a7130..87b432481021cc47b9d9dcbbbfc4be342bd1ac53 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/Make/options @@ -1,15 +1,9 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/turbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ - -I$(LIB_SRC)/lagrangian/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ - -I$(LIB_SRC)/browser/lnInclude \ - -I$(LIB_SRC)/foam/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude EXE_LIBS = \ diff --git a/applications/utilities/postProcessing/foamCalc/foamCalcApp.C b/applications/utilities/postProcessing/foamCalc/foamCalcApp.C index 39d0a581d509bc84a2dd95a7f6310f72c97d6b64..3e5c99f3e43835fe6bff33583b5561823aecdee9 100644 --- a/applications/utilities/postProcessing/foamCalc/foamCalcApp.C +++ b/applications/utilities/postProcessing/foamCalc/foamCalcApp.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 @@ -49,12 +49,7 @@ int main(int argc, char *argv[]) "noWrite", "suppress writing results" ); - Foam::argList::addOption - ( - "dict", - "name", - "dictionary to use" - ); +# include "addDictOption.H" if (argc < 2) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index 1e49db7505d92ce4844129e1c33d6a72db9ca272..054582768f6b3a5e25b2a3a24921166f29a35094 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.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 @@ -40,7 +40,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::vtkPV3Foam, 0); +namespace Foam +{ +defineTypeNameAndDebug(vtkPV3Foam, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -575,7 +579,7 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) // skip "constant" time whenever possible if (timeI == 0 && nTimes > 1) { - if (timeLst[timeI].name() == "constant") + if (timeLst[timeI].name() == runTime.constant()) { ++timeI; --nTimes; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H index 397dc7ecc2eb6c6d8ef2c1d08039ce07921643f7..363f09d7f3c3728c6376a910e0736320bb5e6b93 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.H @@ -446,13 +446,6 @@ class vtkPV3Foam template<class PatchType> vtkPolyData* patchVTKMesh(const word& name, const PatchType&); - //- Add face zone mesh - vtkPolyData* faceZoneVTKMesh - ( - const fvMesh&, - const labelList& faceLabels - ); - //- Add point zone vtkPolyData* pointZoneVTKMesh ( diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C index b229da947902fe89801f34f796464eb561da8c41..b80acb4949984b50d1145d06d96c20d65f4eb012 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMesh.C @@ -450,7 +450,8 @@ void Foam::vtkPV3Foam::convertMeshFaceZones << zoneName << endl; } - vtkPolyData* vtkmesh = faceZoneVTKMesh(mesh, zMesh[zoneId]); + vtkPolyData* vtkmesh = patchVTKMesh(zoneName, zMesh[zoneId]()); + if (vtkmesh) { AddToBlock(output, vtkmesh, range, datasetNo, zoneName); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 28a1fd4c5f432b58080495a42cbbf042f147ba6d..bfa3e1acc903c0fbd9d087a6590601fa17c4c03c 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.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 @@ -35,78 +35,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh -( - const fvMesh& mesh, - const labelList& faceLabels -) -{ - vtkPolyData* vtkmesh = vtkPolyData::New(); - - if (debug) - { - Info<< "<beg> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; - printMemory(); - } - - // Construct primitivePatch of faces in faceZone - - const faceList& meshFaces = mesh.faces(); - faceList patchFaces(faceLabels.size()); - forAll(faceLabels, faceI) - { - patchFaces[faceI] = meshFaces[faceLabels[faceI]]; - } - primitiveFacePatch p(patchFaces, mesh.points()); - - - // The balance of this routine should be identical to patchVTKMesh - - // Convert OpenFOAM mesh vertices to VTK - const pointField& points = p.localPoints(); - - vtkPoints* vtkpoints = vtkPoints::New(); - vtkpoints->Allocate(points.size()); - forAll(points, i) - { - vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); - } - - vtkmesh->SetPoints(vtkpoints); - vtkpoints->Delete(); - - - // Add faces as polygons - const faceList& faces = p.localFaces(); - - vtkCellArray* vtkcells = vtkCellArray::New(); - vtkcells->Allocate(faces.size()); - - forAll(faces, faceI) - { - const face& f = faces[faceI]; - vtkIdType nodeIds[f.size()]; - - forAll(f, fp) - { - nodeIds[fp] = f[fp]; - } - vtkcells->InsertNextCell(f.size(), nodeIds); - } - - vtkmesh->SetPolys(vtkcells); - vtkcells->Delete(); - - if (debug) - { - Info<< "<end> Foam::vtkPV3Foam::faceZoneVTKMesh" << endl; - printMemory(); - } - - return vtkmesh; -} - - vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh ( const fvMesh& mesh, diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 78582fe7e371304e9a8f52c7464d175521933add..e74937cd2f7f4d0598604195476a3adda76b1cb0 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.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 @@ -129,6 +129,42 @@ void Foam::vtkPV3Foam::convertPointFields datasetNo ); } + + // + // Convert faceZones - if activated + // + for + ( + int partId = arrayRangeFaceZones_.start(); + partId < arrayRangeFaceZones_.end(); + ++partId + ) + { + const word zoneName = getPartName(partId); + const label datasetNo = partDataset_[partId]; + const label zoneId = mesh.faceZones().findZoneID(zoneName); + + if (!partStatus_[partId] || datasetNo < 0 || zoneId < 0) + { + continue; + } + + // Extract the field on the zone + Field<Type> fld + ( + ptf.internalField(), + mesh.faceZones()[zoneId]().meshPoints() + ); + + convertPatchPointField + ( + fieldName, + fld, + output, + arrayRangeFaceZones_, + datasetNo + ); + } } } diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C index 5d47947d88300bfe9d8e1cafa30e6d1e51f0076b..74e6d23d2dc5f94e1cc9ee074beb58ab98c1c3f2 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.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 @@ -41,7 +41,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::vtkPV3blockMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(vtkPV3blockMesh, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/vtkPV3Readers.C b/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/vtkPV3Readers.C index cd1e6eb6c81107ad1de6184e2ae25fbe911f2e44..4daf45fc48111deebe69109d4018bb7336341da4 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/vtkPV3Readers.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/vtkPV3Readers.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 @@ -39,7 +39,11 @@ Description // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::vtkPV3Readers, 0); +namespace Foam +{ +defineTypeNameAndDebug(vtkPV3Readers, 0); +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options b/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options index 3bcea78b3b21c4981a3fc3b20014411934fbb380..b653926f93a610c3f724d7b7a4e3855f9492d145 100644 --- a/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options +++ b/applications/utilities/postProcessing/lagrangian/particleTracks/Make/options @@ -1,12 +1,12 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude EXE_LIBS = \ -lfiniteVolume \ -lmeshTools \ - -lsampling \ + -lfileFormats \ -lgenericPatchFields \ -llagrangian diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/createFields.H b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/createFields.H index 24854ab6b60d038d41997f97de85c4433d0cddde..309d7718f6682283ce980002cf146e94c49c5d3a 100644 --- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/createFields.H +++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/createFields.H @@ -1,16 +1,9 @@ -word dictName(args.optionLookupOrDefault<word>("dict", "particleTrackDict")); +const word dictName("particleTrackDict"); -IOdictionary propsDict -( - IOobject - ( - dictName, - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED - ) -); +#include "setConstantMeshDictionaryIO.H" + +IOdictionary propsDict(dictIO); word cloudName(propsDict.lookup("cloudName")); -List<word> userFields(propsDict.lookup("fields")); \ No newline at end of file +List<word> userFields(propsDict.lookup("fields")); diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C index 4c1bea3c2d0e89f6334602523a6f215d2304ccdf..5a6fad75a696b5a8554012ace76107dd2f337ec5 100644 --- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.C +++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracks.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 @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) argList::noParallel(); timeSelector::addOptions(); #include "addRegionOption.H" - argList::validOptions.insert("dict", ""); + #include "addDictOption.H" #include "setRootCase.H" diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C index b133509318af20c296c833c54ab8138119d5272b..e5c6735d8c8b52545c2efd19728131c0a6f3bfe7 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C @@ -65,7 +65,6 @@ namespace Foam IOobject ( args["dict"], - runTime.system(), runTime, IOobject::MUST_READ_IF_MODIFIED ) diff --git a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C index 5c02fe31e715bc9160b0c9d8519c9bc34fbf9a64..59c73ffc60d8cff7c586f294ebea851ec4e84d0c 100644 --- a/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.C +++ b/applications/utilities/postProcessing/sampling/probeLocations/probeLocations.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 @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) ( probes::typeName, mesh, - "probesDict", + word("probesDict"), // force the use of the system directory IOobject::MUST_READ, true ); diff --git a/applications/utilities/postProcessing/sampling/sample/Make/options b/applications/utilities/postProcessing/sampling/sample/Make/options index 88c6039b4e048acf84a463e29ff47746419c9d85..4de726a20fe6d4836f6aa33f3576202aec07fcdc 100644 --- a/applications/utilities/postProcessing/sampling/sample/Make/options +++ b/applications/utilities/postProcessing/sampling/sample/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude @@ -9,6 +10,7 @@ EXE_LIBS = \ -lfiniteVolume \ -lgenericPatchFields \ -lmeshTools \ + -lfileFormats \ -lsampling \ -lsurfMesh \ -llagrangian diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C index 6b09aa19b9b6777f8e42b599ff260526f65e5249..6641508a573946fbf394db86662bcd97d38eb1b2 100644 --- a/applications/utilities/postProcessing/sampling/sample/sample.C +++ b/applications/utilities/postProcessing/sampling/sample/sample.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 @@ -97,37 +97,82 @@ int main(int argc, char *argv[]) { timeSelector::addOptions(); #include "addRegionOption.H" - argList::addOption - ( - "dict", - "word", - "name of dictionary to provide sample information" - ); - + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); #include "createNamedMesh.H" - word sampleDict(args.optionLookupOrDefault<word>("dict", "sampleDict")); - - IOsampledSets sSets - ( - sampledSets::typeName, - mesh, - sampleDict, - IOobject::MUST_READ_IF_MODIFIED, - true - ); - - IOsampledSurfaces sSurfs - ( - sampledSurfaces::typeName, - mesh, - sampleDict, - IOobject::MUST_READ_IF_MODIFIED, - true - ); + const word dictName("sampleDict"); + + autoPtr<IOsampledSets> sSetsPtr; + autoPtr<IOsampledSurfaces> sSurfsPtr; + + if (args.optionFound("dict")) + { + // Construct from fileName + + fileName dictPath = args["dict"]; + if (isDir(dictPath)) + { + dictPath = dictPath / dictName; + } + + sSetsPtr.reset + ( + new IOsampledSets + ( + sampledSets::typeName, + mesh, + dictPath, + IOobject::MUST_READ_IF_MODIFIED, + true + ) + ); + + sSurfsPtr.reset + ( + new IOsampledSurfaces + ( + sampledSurfaces::typeName, + mesh, + dictPath, + IOobject::MUST_READ_IF_MODIFIED, + true + ) + ); + } + else + { + // Construct from name in system() directory + + sSetsPtr.reset + ( + new IOsampledSets + ( + sampledSets::typeName, + mesh, + dictName, + IOobject::MUST_READ_IF_MODIFIED, + true + ) + ); + + sSurfsPtr.reset + ( + new IOsampledSurfaces + ( + sampledSurfaces::typeName, + mesh, + dictName, + IOobject::MUST_READ_IF_MODIFIED, + true + ) + ); + } + + IOsampledSets& sSets = sSetsPtr(); + IOsampledSurfaces& sSurfs = sSurfsPtr(); forAll(timeDirs, timeI) { diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 58bdc7c59cee694920619d7192288cf813c7fed6..86ba1b4849f442f22d78b2ec6e1b2f67d30b85c8 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -140,6 +140,7 @@ sets patchSeed { + type patchSeed; patches (".*Wall.*"); // Number of points to seed. Divided amongst all processors according // to fraction of patches they hold. diff --git a/applications/utilities/postProcessing/velocityField/Pe/Make/options b/applications/utilities/postProcessing/velocityField/Pe/Make/options index 29d9b4d8c303aacfa11a0947d384d103d21923e4..1d984aa9b559049112c465682139fcf44dcd7daf 100644 --- a/applications/utilities/postProcessing/velocityField/Pe/Make/options +++ b/applications/utilities/postProcessing/velocityField/Pe/Make/options @@ -5,8 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ $(FOAM_LIBBIN)/postCalc.o \ diff --git a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C index 2f8b1503418c5b08bfb13033618f93960e3a0e12..58f6a7b063aaf037615e8fe4e4c70126ce30be26 100644 --- a/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C +++ b/applications/utilities/postProcessing/wall/yPlusRAS/yPlusRAS.C @@ -55,7 +55,7 @@ void calcIncompressibleYPlus volScalarField& yPlus ) { - typedef incompressible::RASModels::nutWallFunctionFvPatchScalarField + typedef incompressible::nutWallFunctionFvPatchScalarField wallFunctionPatchField; #include "createPhi.H" @@ -107,7 +107,7 @@ void calcCompressibleYPlus volScalarField& yPlus ) { - typedef compressible::RASModels::mutWallFunctionFvPatchScalarField + typedef compressible::mutWallFunctionFvPatchScalarField wallFunctionPatchField; IOobject rhoHeader diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C index 13c5841c3aeb2f1c7f52cbd8fd1acf129f78849e..b4a83722e6e3205d4bf57a2e18487ea9234f9af0 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C +++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) } // Create G field - used by RAS wall functions - volScalarField G("RASModel.G", nut*2*sqr(S)); + volScalarField G(turbulence().type() + ".G", nut*2*sqr(S)); //--- Read and modify turbulence fields diff --git a/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C b/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C index 9b89af1c4de67beb66dfebe184fdf66982234f9b..38b0bf0eb73e95dcfb9c96840bc2fc41c278cb6f 100644 --- a/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.C +++ b/applications/utilities/preProcessing/applyWallFunctionBoundaryConditions/applyWallFunctionBoundaryConditions.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 @@ -232,43 +232,42 @@ void updateCompressibleCase(const fvMesh& mesh) ( mesh, "mut", - compressible::RASModels::mutkWallFunctionFvPatchScalarField::typeName, + compressible::mutkWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "epsilon", - compressible::RASModels::epsilonWallFunctionFvPatchScalarField:: - typeName, + compressible::epsilonWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "omega", - compressible::RASModels::omegaWallFunctionFvPatchScalarField::typeName, + compressible::omegaWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "k", - compressible::RASModels::kqRWallFunctionFvPatchField<scalar>::typeName, + compressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "q", - compressible::RASModels::kqRWallFunctionFvPatchField<scalar>::typeName, + compressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "R", - compressible::RASModels::kqRWallFunctionFvPatchField<symmTensor>:: + compressible::kqRWallFunctionFvPatchField<symmTensor>:: typeName, "(0 0 0 0 0 0)" ); @@ -284,14 +283,14 @@ void updateIncompressibleCase(const fvMesh& mesh) ( mesh, "nut", - incompressible::RASModels::nutkWallFunctionFvPatchScalarField::typeName, + incompressible::nutkWallFunctionFvPatchScalarField::typeName, "0" ); replaceBoundaryType ( mesh, "epsilon", - incompressible::RASModels::epsilonWallFunctionFvPatchScalarField:: + incompressible::epsilonWallFunctionFvPatchScalarField:: typeName, "0" ); @@ -299,7 +298,7 @@ void updateIncompressibleCase(const fvMesh& mesh) ( mesh, "omega", - incompressible::RASModels::omegaWallFunctionFvPatchScalarField:: + incompressible::omegaWallFunctionFvPatchScalarField:: typeName, "0" ); @@ -307,24 +306,21 @@ void updateIncompressibleCase(const fvMesh& mesh) ( mesh, "k", - incompressible::RASModels::kqRWallFunctionFvPatchField<scalar>:: - typeName, + incompressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "q", - incompressible::RASModels::kqRWallFunctionFvPatchField<scalar>:: - typeName, + incompressible::kqRWallFunctionFvPatchField<scalar>::typeName, "0" ); replaceBoundaryType ( mesh, "R", - incompressible::RASModels::kqRWallFunctionFvPatchField<symmTensor>:: - typeName, + incompressible::kqRWallFunctionFvPatchField<symmTensor>::typeName, "(0 0 0 0 0 0)" ); } diff --git a/applications/utilities/preProcessing/boxTurb/Make/options b/applications/utilities/preProcessing/boxTurb/Make/options index 749a3d512477c50731fad604faf65992b488f76e..e24cee9cb9d235b1870e28189a8633d7352dbe7c 100644 --- a/applications/utilities/preProcessing/boxTurb/Make/options +++ b/applications/utilities/preProcessing/boxTurb/Make/options @@ -1,10 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/randomProcesses/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude EXE_LIBS = \ -lrandomProcesses \ - -lsampling \ - -lmeshTools \ -lfiniteVolume diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index 3c664cfc3b29297010cd924cc15dfd75d398d422..4bb711880a309c5c51c39be36ace7ae95abcb576 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -385,12 +385,7 @@ bool merge int main(int argc, char *argv[]) { - argList::addOption - ( - "dict", - "file", - "specify an alternative to system/changeDictionaryDict" - ); + #include "addDictOption.H" argList::addOption ( "instance", @@ -432,21 +427,8 @@ int main(int argc, char *argv[]) runTime.setTime(times[0], 0); word instance = args.optionLookupOrDefault("instance", runTime.timeName()); - #include "createNamedMesh.H" - const word dictName("changeDictionaryDict"); - - fileName dictPath = dictName; - if (args.optionFound("dict")) - { - dictPath = args["dict"]; - if (isDir(dictPath)) - { - dictPath = dictPath / dictName; - } - } - const bool literalRE = args.optionFound("literalRE"); if (literalRE) { @@ -493,27 +475,10 @@ int main(int argc, char *argv[]) // Get the replacement rules from a dictionary - IOdictionary dict - ( - ( - args.optionFound("dict") - ? IOobject - ( - dictPath, - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - : IOobject - ( - dictName, - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ) - ); + + const word dictName("changeDictionaryDict"); + #include "setSystemMeshDictionaryIO.H" + IOdictionary dict(dictIO); const dictionary& replaceDicts = dict.subDict("dictionaryReplacement"); Info<< "Read dictionary " << dict.name() diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 39b6572ef11640e5df8ed0d470058b95987404fe..2e3a56007b22561df858fd9675a9534e928b3c9a 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.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 @@ -48,22 +48,22 @@ using namespace Foam; int main(int argc, char *argv[]) { #include "addRegionOption.H" - argList::addOption - ( - "dict", - "word", - "name of dictionary to provide patch agglomeration controls" - ); + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" #include "createNamedMesh.H" - word agglomDictName - ( - args.optionLookupOrDefault<word>("dict", "faceAgglomerateDict") - ); + const word dictName("faceAgglomerateDict"); + + #include "setConstantMeshDictionaryIO.H" + + // Read control dictionary + const IOdictionary agglomDict(dictIO); + + bool writeAgglom = readBool(agglomDict.lookup("writeFacesAgglomeration")); - const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + const polyBoundaryMesh& boundary = mesh.boundaryMesh(); labelListIOList finalAgglom ( @@ -76,27 +76,9 @@ int main(int argc, char *argv[]) IOobject::NO_WRITE, false ), - patches.size() - ); - - - // Read control dictionary - IOdictionary agglomDict - ( - IOobject - ( - agglomDictName, - runTime.constant(), - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE - ) + boundary.size() ); - bool writeAgglom = readBool(agglomDict.lookup("writeFacesAgglomeration")); - - const polyBoundaryMesh& boundary = mesh.boundaryMesh(); - forAll(boundary, patchId) { const polyPatch& pp = boundary[patchId]; @@ -178,7 +160,6 @@ int main(int argc, char *argv[]) forAll(boundary, patchId) { - fvPatchScalarField& bFacesAgglomeration = facesAgglomeration.boundaryField()[patchId]; @@ -188,7 +169,7 @@ int main(int argc, char *argv[]) } } - Info << "\nWriting facesAgglomeration" << endl; + Info<< "\nWriting facesAgglomeration" << endl; facesAgglomeration.write(); } diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict new file mode 100644 index 0000000000000000000000000000000000000000..9c164f15092a651ef06fa0b1f871dbee69d2fa82 --- /dev/null +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict @@ -0,0 +1,28 @@ +/*--------------------------------*- 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; + object viewFactorsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Write agglomeration as a volScalarField with calculated boundary values +writeFacesAgglomeration true; + +// Per patch (wildcard possible) the coarsening level +bottomAir_to_heater +{ + nFacesInCoarsestLevel 30; + featureAngle 10; +} + + +// ************************************************************************* // diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index ebc43d84f23e2dbf09c01ac2536c5f6f993e1ae2..274258ffd22f2e65a29893902bc02ed8856c9ba6 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -227,7 +227,11 @@ bool setFaceFieldType // Override bool hasWarned = false; - labelList nChanged(field.boundaryField().size(), 0); + labelList nChanged + ( + returnReduce(field.boundaryField().size(), maxOp<label>()), + 0 + ); forAll(selectedFaces, i) { label facei = selectedFaces[i]; @@ -359,9 +363,10 @@ public: int main(int argc, char *argv[]) { -# include "setRootCase.H" -# include "createTime.H" -# include "createMesh.H" + #include "addRegionOption.H" + #include "setRootCase.H" + #include "createTime.H" + #include "createNamedMesh.H" Info<< "Reading setFieldsDict\n" << endl; diff --git a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C index 3393edb00d9ce90587892be0dc674abb716d8428..ce64e65f3a523db1a107814ba19f6e34e212b162 100644 --- a/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C +++ b/applications/utilities/surface/surfaceBooleanFeatures/surfaceBooleanFeatures.C @@ -446,6 +446,7 @@ int main(int argc, char *argv[]) edgeDirections, edgeNormals, labelListList(0), // featurePointNormals, + labelListList(0), // featurePointEdges, labelList(0) // regionEdges ); diff --git a/applications/utilities/surface/surfaceClean/collapseBase.C b/applications/utilities/surface/surfaceClean/collapseBase.C index 37e5b4da3bc5a7a7c541b76708d4d049f8577c1d..ceb834b56f195ef3005dd636eb28a4111606cce3 100644 --- a/applications/utilities/surface/surfaceClean/collapseBase.C +++ b/applications/utilities/surface/surfaceClean/collapseBase.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 @@ -36,55 +36,55 @@ using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Dump collapse region to .obj file -static void writeRegionOBJ -( - const triSurface& surf, - const label regionI, - const labelList& collapseRegion, - const labelList& outsideVerts -) -{ - fileName dir("regions"); - - mkDir(dir); - fileName regionName(dir / "region_" + name(regionI) + ".obj"); - - Pout<< "Dumping region " << regionI << " to file " << regionName << endl; - - boolList include(surf.size(), false); - - forAll(collapseRegion, faceI) - { - if (collapseRegion[faceI] == regionI) - { - include[faceI] = true; - } - } - - labelList pointMap, faceMap; - - triSurface regionSurf(surf.subsetMesh(include, pointMap, faceMap)); - - Pout<< "Region " << regionI << " surface:" << nl; - regionSurf.writeStats(Pout); - - regionSurf.write(regionName); - - - // Dump corresponding outside vertices. - fileName pointsName(dir / "regionPoints_" + name(regionI) + ".obj"); - - Pout<< "Dumping region " << regionI << " points to file " << pointsName - << endl; - - OFstream str(pointsName); - - forAll(outsideVerts, i) - { - meshTools::writeOBJ(str, surf.localPoints()[outsideVerts[i]]); - } -} +//// Dump collapse region to .obj file +//static void writeRegionOBJ +//( +// const triSurface& surf, +// const label regionI, +// const labelList& collapseRegion, +// const labelList& outsideVerts +//) +//{ +// fileName dir("regions"); +// +// mkDir(dir); +// fileName regionName(dir / "region_" + name(regionI) + ".obj"); +// +// Pout<< "Dumping region " << regionI << " to file " << regionName << endl; +// +// boolList include(surf.size(), false); +// +// forAll(collapseRegion, faceI) +// { +// if (collapseRegion[faceI] == regionI) +// { +// include[faceI] = true; +// } +// } +// +// labelList pointMap, faceMap; +// +// triSurface regionSurf(surf.subsetMesh(include, pointMap, faceMap)); +// +// Pout<< "Region " << regionI << " surface:" << nl; +// regionSurf.writeStats(Pout); +// +// regionSurf.write(regionName); +// +// +// // Dump corresponding outside vertices. +// fileName pointsName(dir / "regionPoints_" + name(regionI) + ".obj"); +// +// Pout<< "Dumping region " << regionI << " points to file " << pointsName +// << endl; +// +// OFstream str(pointsName); +// +// forAll(outsideVerts, i) +// { +// meshTools::writeOBJ(str, surf.localPoints()[outsideVerts[i]]); +// } +//} // Split triangle into multiple triangles because edge e being split diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index b3b390af515122423aaf6a99116a267366cd1da2..fb54a417a18db446c66801e42e7acb086eb6d356 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -680,35 +680,17 @@ int main(int argc, char *argv[]) ); argList::noParallel(); - argList::addOption - ( - "dict", - "word", - "specify alternative dictionary for the feature extraction information" - ); +# include "addDictOption.H" # include "setRootCase.H" # include "createTime.H" - word dictName - ( - args.optionLookupOrDefault<word>("dict", "surfaceFeatureExtractDict") - ); + const word dictName("surfaceFeatureExtractDict"); +# include "setSystemRunTimeDictionaryIO.H" Info<< "Reading " << dictName << nl << endl; - IOdictionary dict - ( - IOobject - ( - dictName, - runTime.system(), - runTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ) - ); + const IOdictionary dict(dictIO); forAllConstIter(dictionary, dict, iter) { @@ -779,7 +761,7 @@ int main(int argc, char *argv[]) // Either construct features from surface & featureAngle or read set. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - surfaceFeatures set(surf); + autoPtr<surfaceFeatures> set; scalar includedAngle = -1; @@ -799,7 +781,7 @@ int main(int argc, char *argv[]) Info<< nl << "Reading existing feature edges from file " << featureEdgeFile << endl; - set = surfaceFeatures(surf, eMesh.points(), eMesh.edges()); + set.set(new surfaceFeatures(surf, eMesh.points(), eMesh.edges())); } else if (extractionMethod == "extractFromSurface") { @@ -814,7 +796,7 @@ int main(int argc, char *argv[]) Info<< nl << "Constructing feature set from included angle " << includedAngle << endl; - set = surfaceFeatures(surf, includedAngle); + set.set(new surfaceFeatures(surf, includedAngle)); } else { @@ -825,16 +807,6 @@ int main(int argc, char *argv[]) << exit(FatalError); } - Info<< nl - << "Initial feature set:" << nl - << " feature points : " << set.featurePoints().size() << nl - << " feature edges : " << set.featureEdges().size() << nl - << " of which" << nl - << " region edges : " << set.nRegionEdges() << nl - << " external edges : " << set.nExternalEdges() << nl - << " internal edges : " << set.nInternalEdges() << nl - << endl; - // Trim set // ~~~~~~~~ @@ -856,7 +828,7 @@ int main(int argc, char *argv[]) Info<< "Removing features with number of edges < " << minElem << endl; - set.trimFeatures(minLen, minElem); + set().trimFeatures(minLen, minElem); } } @@ -865,7 +837,7 @@ int main(int argc, char *argv[]) // ~~~~~~ // Convert to marked edges, points - List<surfaceFeatures::edgeStatus> edgeStat(set.toStatus()); + List<surfaceFeatures::edgeStatus> edgeStat(set().toStatus()); if (surfaceDict.isDict("subsetFeatures")) { @@ -958,6 +930,16 @@ int main(int argc, char *argv[]) surfaceFeatures newSet(surf); newSet.setFromStatus(edgeStat); + Info<< nl + << "Initial feature set:" << nl + << " feature points : " << newSet.featurePoints().size() << nl + << " feature edges : " << newSet.featureEdges().size() << nl + << " of which" << nl + << " region edges : " << newSet.nRegionEdges() << nl + << " external edges : " << newSet.nExternalEdges() << nl + << " internal edges : " << newSet.nInternalEdges() << nl + << endl; + //if (writeObj) //{ // newSet.writeObj("final"); @@ -974,17 +956,10 @@ int main(int argc, char *argv[]) if (surfaceDict.isDict("addFeatures")) { - const dictionary& subsetDict = surfaceDict.subDict - ( - "addFeatures" - ); - - const word addFeName = subsetDict["name"]; + const word addFeName = surfaceDict.subDict("addFeatures")["name"]; Info<< "Adding (without merging) features from " << addFeName << nl << endl; - const Switch flip = subsetDict["flip"]; - extendedFeatureEdgeMesh addFeMesh ( IOobject @@ -1000,14 +975,6 @@ int main(int argc, char *argv[]) Info<< "Read " << addFeMesh.name() << nl; writeStats(addFeMesh, Info); - if (flip) - { - Info<< "Flipping " << addFeMesh.name() << endl; - addFeMesh.flipNormals(); - Info<< "After flipping " << addFeMesh.name() << nl; - writeStats(addFeMesh, Info); - } - feMesh.add(addFeMesh); } diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index 305786f963dbc8fd30ecac409b5e451bcc396ac8..ea30c2dd55d4631fb3e6a2f1aacb6d24f9a4bb3c 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -96,12 +96,7 @@ int main(int argc, char *argv[]) "factor", "geometry scaling factor on output" ); - argList::addOption - ( - "dict", - "file", - "specify alternative dictionary for the coordinateSystems descriptions" - ); + #include "addDictOption.H" argList::addOption ( "from", @@ -154,19 +149,28 @@ int main(int argc, char *argv[]) { autoPtr<IOobject> csDictIoPtr; + const word dictName("coordinateSystems::typeName"); + + // Note: cannot use setSystemRunTimeDictionaryIO.H since dictionary + // is in constant + + fileName dictPath = ""; if (args.optionFound("dict")) { - const fileName dictPath = args["dict"]; + dictPath = args["dict"]; + if (isDir(dictPath)) + { + dictPath = dictPath / dictName; + } + } + if (dictPath.size()) + { csDictIoPtr.set ( new IOobject ( - ( - isDir(dictPath) - ? dictPath/coordinateSystems::typeName - : dictPath - ), + dictPath, runTime, IOobject::MUST_READ, IOobject::NO_WRITE, @@ -180,7 +184,7 @@ int main(int argc, char *argv[]) ( new IOobject ( - coordinateSystems::typeName, + dictName, runTime.constant(), runTime, IOobject::MUST_READ, diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C index 7c9b3be904d7989160b98d77602da3c2564efb9b..f8a5ebf57a25ad8cd4dafa325b265203e459f1e3 100644 --- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C +++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C @@ -103,12 +103,7 @@ int main(int argc, char *argv[]) "factor", "geometry scaling factor on output - default is 1" ); - argList::addOption - ( - "dict", - "file", - "specify an alternative dictionary for constant/coordinateSystems" - ); + #include "addDictOption.H" argList::addOption ( "from", diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C index 3a14ac63c42371d6e4dd20c69cfaa570b57596d3..87ff39d182edceabeeb8a6555a3b0ff31f641258 100644 --- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C +++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C @@ -103,12 +103,7 @@ int main(int argc, char *argv[]) "factor", "geometry scaling factor on output - default is 1" ); - argList::addOption - ( - "dict", - "file", - "specify an alternative dictionary for constant/coordinateSystems" - ); + #include "addDictOption.H" argList::addOption ( "from", diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials index 6b530e3cb983ced77140e6acf635abb4a239898d..a2c33cfb8e7935f4087738e0f18935f833bd5cf1 100755 --- a/bin/foamRunTutorials +++ b/bin/foamRunTutorials @@ -37,6 +37,8 @@ # normally use "make" make="make" +runTests=false +skipFirst=false ## set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set #if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ] @@ -73,8 +75,32 @@ then thisScript="$PWD/$thisScript" fi + +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -t | -test) + runTests=true + shift + ;; + -s | -skipFirst) + skipFirst=true + shift + ;; + *) + break + ;; + esac +done + + # If an argument is supplied do not execute ./Allrun to avoid recursion -if [ $# = 0 -a -f "./Allrun" ] +if ! $skipFirst && $runTests && [ -f "./Alltest" ] +then + # Run a special test script. + ./Alltest +elif ! $skipFirst && [ -f "./Allrun" ] then # Specialised script. ./Allrun @@ -104,7 +130,10 @@ else #done FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs) #$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$WM_SCHEDULER $thisScript" - $make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$thisScript" + + passArgs=$(if $runTests; then echo "-test"; fi) + + $make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$thisScript" FOAM_ARGS="$passArgs" fi #------------------------------------------------------------------------------ diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 758627a29a3568ed4ad239d644213255b785a404..bd1659e6fc56e2676b406f0b0ba32be4e7f8c3a7 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -74,6 +74,7 @@ cleanCase() cleanDynamicCode rm -rf processor* > /dev/null 2>&1 + rm -rf postProcessing > /dev/null 2>&1 rm -rf probes* > /dev/null 2>&1 rm -rf forces* > /dev/null 2>&1 rm -rf graphs* > /dev/null 2>&1 @@ -101,7 +102,7 @@ cleanCase() rm -rf constant/tetDualMesh > /dev/null 2>&1 rm -rf VTK > /dev/null 2>&1 - rm -f 0/cellLevel 0/pointLevel + rm -f 0/cellLevel 0/pointLevel 0/cellDist constant/cellDecomposition if [ -e constant/polyMesh/blockMeshDict.m4 ] then diff --git a/bin/tools/MakefileDirs b/bin/tools/MakefileDirs index b6cd30092d003479858521863b3c1bf3461c6d58..1a0c45ba2d9985cdc78c2b1f7fd90d76b8da41f8 100644 --- a/bin/tools/MakefileDirs +++ b/bin/tools/MakefileDirs @@ -36,7 +36,7 @@ application: $(FOAM_TARGETS) $(FOAM_TARGETS): - +@(cd $@ && $(FOAM_APP)) + +@(cd $@ && $(FOAM_APP) $(FOAM_ARGS)) #------------------------------------------------------------------------------ diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions index 093c6ed037cd74083b5154b5c3377ebf3e968508..3632a62d761bef571488d35d3fd7ccd1d1083cf7 100644 --- a/bin/tools/RunFunctions +++ b/bin/tools/RunFunctions @@ -28,6 +28,11 @@ # Miscellaneous functions for running tutorial cases #------------------------------------------------------------------------------ +getNumberOfProcessors() +{ + sed -ne 's/^numberOfSubdomains *\(.*\);/\1/p' system/decomposeParDict +} + getApplication() { sed -ne 's/^ *application *\([a-zA-Z]*\) *;.*$/\1/p' system/controlDict diff --git a/etc/bashrc b/etc/bashrc index 0e7c7c62a4b1ff4882b55b14ce339f7ecfc52244..f077631ac890c00e43ef0ee89126b2b35f831516 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -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 @@ -213,6 +213,7 @@ _foamSource $WM_PROJECT_DIR/etc/config/aliases.sh # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh` _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.sh` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/gperftools.sh` # Clean environment paths again. Only remove duplicates diff --git a/etc/config/gperftools.sh b/etc/config/gperftools.sh new file mode 100644 index 0000000000000000000000000000000000000000..f71a6cf2afe7e2dab5f3d33a5166cb13569fdd5c --- /dev/null +++ b/etc/config/gperftools.sh @@ -0,0 +1,41 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. +# +# File +# config/gperftools.sh +# +# Description +# Setup file for gperftools binaries libraries. +# +#------------------------------------------------------------------------------ + +version=svn +gperftools_install=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER + +GPERFTOOLS_VERSION=gperftools-$version +GPERFTOOLS_ARCH_PATH=$gperftools_install/$GPERFTOOLS_VERSION + +export PATH=$GPERFTOOLS_ARCH_PATH/bin:$PATH +export LD_LIBRARY_PATH=$GPERFTOOLS_ARCH_PATH/lib:$LD_LIBRARY_PATH + +# ----------------------------------------------------------------------------- diff --git a/etc/config/scotch.sh b/etc/config/scotch.sh index df1dce8256a37aa91cda4cd3d4e0488b9beda4a9..1ee06e80b87b298f1b7bea4497422d42d7ed32d6 100644 --- a/etc/config/scotch.sh +++ b/etc/config/scotch.sh @@ -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 @@ -33,7 +33,7 @@ # during the wmake process #------------------------------------------------------------------------------ -export SCOTCH_VERSION=scotch_5.1.11 +export SCOTCH_VERSION=scotch_6.0.0 export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION # ----------------------------------------------------------------------------- diff --git a/etc/controlDict b/etc/controlDict index d5c1fdb7550ab76543aa8968befec02ad8d8a19a..a0b999f35b70faf1b6eb5d269a61858e499972e6 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -112,7 +112,7 @@ DebugSwitches ConeInjection 0; Constant 0; ConstantRateDevolatilisation 0; - CrankNicholson 0; + CrankNicolson 0; CrossPowerLaw 0; Cs 0; DIC 0; @@ -630,7 +630,7 @@ DebugSwitches muSgsSpalartAllmarasWallFunction 0; multiDirRefinement 0; multiHoleInjector 0; - multiLevel 1; + multiLevel 0; multivariateSelection 0; mutRoughWallFunction 0; mutSpalartAllmarasStandardRoughWallFunction 0; @@ -994,7 +994,7 @@ DimensionSets acceleration acceleration [ m s^-2 ] 1.0; kinematicPressure kinematicPressure [ Pa density^-1 ] 1.0; - // Scaled units. Only allowed in dymensionedType (dimensionedScalar, + // Scaled units. Only allowed in dimensionedType (dimensionedScalar, // dimensionedVector etc.) and UniformDimensionedField, not // in DimensionedField or GeometricField cm cm [ m ] 1e-2; diff --git a/src/ODE/ODESolvers/KRR4/KRR4.C b/src/ODE/ODESolvers/KRR4/KRR4.C index bdfca457df06bdf093e89e86e7d2530d84829de8..9246605b51ded2be40c90280f81eb3538bded533 100644 --- a/src/ODE/ODESolvers/KRR4/KRR4.C +++ b/src/ODE/ODESolvers/KRR4/KRR4.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 @@ -28,10 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::KRR4, 0); - namespace Foam { + defineTypeNameAndDebug(KRR4, 0); + addToRunTimeSelectionTable(ODESolver, KRR4, ODE); const scalar diff --git a/src/ODE/ODESolvers/ODESolver/ODESolver.C b/src/ODE/ODESolvers/ODESolver/ODESolver.C index 1d7bebc32a063919523ca629d38c2b4238097749..7a981dfd1611a249fb35395a37760ef84fe41282 100644 --- a/src/ODE/ODESolvers/ODESolver/ODESolver.C +++ b/src/ODE/ODESolvers/ODESolver/ODESolver.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 @@ -27,9 +27,9 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::ODESolver, 0); namespace Foam { + defineTypeNameAndDebug(ODESolver, 0); defineRunTimeSelectionTable(ODESolver, ODE); } diff --git a/src/ODE/ODESolvers/RK/RK.C b/src/ODE/ODESolvers/RK/RK.C index 03a3405355e9b99604bf609ec64eb1e48398d23b..6ae5036078219974bb8eb2ebf7ba597e7c029259 100644 --- a/src/ODE/ODESolvers/RK/RK.C +++ b/src/ODE/ODESolvers/RK/RK.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 @@ -30,7 +30,7 @@ License namespace Foam { - defineTypeNameAndDebug(Foam::RK, 0); + defineTypeNameAndDebug(RK, 0); addToRunTimeSelectionTable(ODESolver, RK, ODE); const scalar diff --git a/src/ODE/ODESolvers/SIBS/SIBS.C b/src/ODE/ODESolvers/SIBS/SIBS.C index 5d6a58f9ae80c55cd95192ecb9965feed7526be5..d86f60d5c9c4d920059ec1a73fd918e6a5f32f85 100644 --- a/src/ODE/ODESolvers/SIBS/SIBS.C +++ b/src/ODE/ODESolvers/SIBS/SIBS.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 @@ -28,10 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::SIBS, 0); - namespace Foam { + defineTypeNameAndDebug(SIBS, 0); + addToRunTimeSelectionTable(ODESolver, SIBS, ODE); const label SIBS::nSeq_[iMaxX_] = {2, 6, 10, 14, 22, 34, 50, 70}; diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 34290315c7636b19e11b67a2509c664cf3f5040f..920778116e850657db57fa126cbbf311b2c41d5f 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.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 @@ -67,7 +67,11 @@ Description // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::POSIX, 0); +namespace Foam +{ + defineTypeNameAndDebug(POSIX, 0); +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OSspecific/POSIX/fileMonitor.C b/src/OSspecific/POSIX/fileMonitor.C index f17e7b1dc973d58a756cdd0e422ad9ffe9a9fb80..a960ac39fed81ed7f715d34fed111a5d74a2698b 100644 --- a/src/OSspecific/POSIX/fileMonitor.C +++ b/src/OSspecific/POSIX/fileMonitor.C @@ -45,13 +45,13 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fileMonitor, 0); - const Foam::NamedEnum<Foam::fileMonitor::fileState, 3> Foam::fileMonitor::fileStateNames_; namespace Foam { + defineTypeNameAndDebug(fileMonitor, 0); + template<> const char* Foam::NamedEnum < diff --git a/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C b/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C index e973bc1bd8fc90039bb43542cf5b3a7dce8000b3..94759bfe330b655d4846c9910f1d0a5773cc3ade 100644 --- a/src/OSspecific/POSIX/signals/sigStopAtWriteNow.C +++ b/src/OSspecific/POSIX/signals/sigStopAtWriteNow.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 @@ -31,11 +31,41 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +namespace Foam +{ // Signal number to catch -int Foam::sigStopAtWriteNow::signal_ +int sigStopAtWriteNow::signal_ ( debug::optimisationSwitch("stopAtWriteNowSignal", -1) ); +// Register re-reader +class addstopAtWriteNowSignalToOpt +: + public ::Foam::simpleRegIOobject +{ +public: + addstopAtWriteNowSignalToOpt(const char* name) + : + ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) + {} + virtual ~addstopAtWriteNowSignalToOpt() + {} + virtual void readData(Foam::Istream& is) + { + sigStopAtWriteNow::signal_ = readLabel(is); + sigStopAtWriteNow::set(true); + } + virtual void writeData(Foam::Ostream& os) const + { + os << sigStopAtWriteNow::signal_; + } +}; +addstopAtWriteNowSignalToOpt addstopAtWriteNowSignalToOpt_ +( + "stopAtWriteNowSignal" +); +} + static Foam::Time const* runTimePtr_ = NULL; @@ -80,6 +110,36 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow const bool verbose, const Time& runTime ) +{ + // Store runTime + runTimePtr_ = &runTime; + + set(verbose); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::sigStopAtWriteNow::~sigStopAtWriteNow() +{ + // Reset old handling + if (signal_ > 0) + { + if (sigaction(signal_, &oldAction_, NULL) < 0) + { + FatalErrorIn + ( + "Foam::sigStopAtWriteNow::~sigStopAtWriteNow()" + ) << "Cannot reset " << signal_ << " trapping" + << abort(FatalError); + } + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::sigStopAtWriteNow::set(const bool verbose) { if (signal_ > 0) { @@ -98,9 +158,6 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow } - // Store runTime - runTimePtr_ = &runTime; - struct sigaction newAction; newAction.sa_handler = sigHandler; newAction.sa_flags = SA_NODEFER; @@ -125,27 +182,6 @@ Foam::sigStopAtWriteNow::sigStopAtWriteNow } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::sigStopAtWriteNow::~sigStopAtWriteNow() -{ - // Reset old handling - if (signal_ > 0) - { - if (sigaction(signal_, &oldAction_, NULL) < 0) - { - FatalErrorIn - ( - "Foam::sigStopAtWriteNow::~sigStopAtWriteNow()" - ) << "Cannot reset " << signal_ << " trapping" - << abort(FatalError); - } - } -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - bool Foam::sigStopAtWriteNow::active() const { return signal_ > 0; diff --git a/src/OSspecific/POSIX/signals/sigStopAtWriteNow.H b/src/OSspecific/POSIX/signals/sigStopAtWriteNow.H index 4c07248eb21be8c29325914f1dcbc99bb72c86d0..d7d9d113b08b5d13de705193f7249a1efbbeddb0 100644 --- a/src/OSspecific/POSIX/signals/sigStopAtWriteNow.H +++ b/src/OSspecific/POSIX/signals/sigStopAtWriteNow.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 @@ -68,6 +68,9 @@ class sigStopAtWriteNow public: + //- wip. Have setter have access to signal_ + friend class addstopAtWriteNowSignalToOpt; + // Constructors //- Construct null @@ -83,6 +86,9 @@ public: // Member functions + //- (re)set signal catcher + static void set(const bool verbose); + //- Is active? bool active() const; }; diff --git a/src/OSspecific/POSIX/signals/sigWriteNow.C b/src/OSspecific/POSIX/signals/sigWriteNow.C index 6ad98a6190d88bac2a87ad29edf3416da049d917..29381368a2d8ab168f32591d6d59890908c284e5 100644 --- a/src/OSspecific/POSIX/signals/sigWriteNow.C +++ b/src/OSspecific/POSIX/signals/sigWriteNow.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 @@ -31,11 +31,39 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +namespace Foam +{ // Signal number to catch -int Foam::sigWriteNow::signal_ +int sigWriteNow::signal_ ( debug::optimisationSwitch("writeNowSignal", -1) ); +// Register re-reader +class addwriteNowSignalToOpt +: + public ::Foam::simpleRegIOobject +{ +public: + addwriteNowSignalToOpt(const char* name) + : + ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) + {} + virtual ~addwriteNowSignalToOpt() + {} + virtual void readData(Foam::Istream& is) + { + sigWriteNow::signal_ = readLabel(is); + sigWriteNow::set(true); + } + virtual void writeData(Foam::Ostream& os) const + { + os << sigWriteNow::signal_; + } +}; +addwriteNowSignalToOpt addwriteNowSignalToOpt_("writeNowSignal"); + +} + static Foam::Time* runTimePtr_ = NULL; @@ -64,31 +92,10 @@ Foam::sigWriteNow::sigWriteNow() Foam::sigWriteNow::sigWriteNow(const bool verbose, Time& runTime) { - if (signal_ >= 0) - { - // Store runTime - runTimePtr_ = &runTime; + // Store runTime + runTimePtr_ = &runTime; - struct sigaction newAction; - newAction.sa_handler = sigHandler; - newAction.sa_flags = SA_NODEFER; - sigemptyset(&newAction.sa_mask); - if (sigaction(signal_, &newAction, &oldAction_) < 0) - { - FatalErrorIn - ( - "Foam::sigWriteNow::sigWriteNow(const bool, const Time&)" - ) << "Cannot set " << signal_ << " trapping" - << abort(FatalError); - } - - if (verbose) - { - Info<< "sigWriteNow :" - << " Enabling writing upon signal " << signal_ - << endl; - } - } + set(verbose); } @@ -113,6 +120,33 @@ Foam::sigWriteNow::~sigWriteNow() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::sigWriteNow::set(const bool verbose) +{ + if (signal_ >= 0) + { + struct sigaction newAction; + newAction.sa_handler = sigHandler; + newAction.sa_flags = SA_NODEFER; + sigemptyset(&newAction.sa_mask); + if (sigaction(signal_, &newAction, &oldAction_) < 0) + { + FatalErrorIn + ( + "Foam::sigWriteNow::sigWriteNow(const bool, const Time&)" + ) << "Cannot set " << signal_ << " trapping" + << abort(FatalError); + } + + if (verbose) + { + Info<< "sigWriteNow :" + << " Enabling writing upon signal " << signal_ + << endl; + } + } +} + + bool Foam::sigWriteNow::active() const { return signal_ > 0; diff --git a/src/OSspecific/POSIX/signals/sigWriteNow.H b/src/OSspecific/POSIX/signals/sigWriteNow.H index 477bae825f4b2a48ffd06d3b9203b7af57f40896..f89933721f20509d3b9e5365cd4d79b45aad56cc 100644 --- a/src/OSspecific/POSIX/signals/sigWriteNow.H +++ b/src/OSspecific/POSIX/signals/sigWriteNow.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 @@ -69,6 +69,9 @@ public: friend class sigStopAtWriteNow; + //- wip. Have setter have access to signal_ + friend class addwriteNowSignalToOpt; + // Constructors //- Construct null @@ -84,6 +87,9 @@ public: // Member functions + //- (re)set signal catcher + static void set(const bool verbose); + //- Is active? bool active() const; diff --git a/src/OSspecific/POSIX/timer.C b/src/OSspecific/POSIX/timer.C index f7a2b211aa7d4536a2b216cd03165d5b3a838f85..8b175332d8b0db37843d66620c6825e731fb9679 100644 --- a/src/OSspecific/POSIX/timer.C +++ b/src/OSspecific/POSIX/timer.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 @@ -30,13 +30,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::timer, 0); +namespace Foam +{ +defineTypeNameAndDebug(timer, 0); + +jmp_buf timer::envAlarm; -jmp_buf Foam::timer::envAlarm; +struct sigaction timer::oldAction_; -struct sigaction Foam::timer::oldAction_; +unsigned int timer::oldTimeOut_ = 0; +} -unsigned int Foam::timer::oldTimeOut_ = 0; // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 2fb7c7dfe2238ac1f47e5ce80b1760c11a842900..03072a6f02c42326d9209f6e33baebb7691c7dae 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -63,6 +63,7 @@ primitives/globalIndexAndTransform/globalIndexAndTransform.C primitives/globalIndexAndTransform/vectorTensorTransform/vectorTensorTransform.C primitives/quaternion/quaternion.C primitives/septernion/septernion.C +primitives/triad/triad.C /* functions, data entries */ primitives/functions/DataEntry/makeDataEntries.C @@ -254,8 +255,10 @@ $(lduMatrix)/solvers/ICCG/ICCG.C $(lduMatrix)/solvers/BICCG/BICCG.C $(lduMatrix)/smoothers/GaussSeidel/GaussSeidelSmoother.C +$(lduMatrix)/smoothers/symGaussSeidel/symGaussSeidelSmoother.C $(lduMatrix)/smoothers/nonBlockingGaussSeidel/nonBlockingGaussSeidelSmoother.C $(lduMatrix)/smoothers/DIC/DICSmoother.C +$(lduMatrix)/smoothers/FDIC/FDICSmoother.C $(lduMatrix)/smoothers/DICGaussSeidel/DICGaussSeidelSmoother.C $(lduMatrix)/smoothers/DILU/DILUSmoother.C $(lduMatrix)/smoothers/DILUGaussSeidel/DILUGaussSeidelSmoother.C @@ -424,6 +427,10 @@ $(polyMesh)/polyMeshInitMesh.C $(polyMesh)/polyMeshClear.C $(polyMesh)/polyMeshUpdate.C +polyMeshCheck = $(polyMesh)/polyMeshCheck +$(polyMeshCheck)/polyMeshCheck.C +$(polyMeshCheck)/polyMeshTools.C + primitiveMesh = meshes/primitiveMesh $(primitiveMesh)/primitiveMesh.C $(primitiveMesh)/primitiveMeshCellCells.C @@ -444,9 +451,9 @@ $(primitiveMesh)/primitiveMeshCalcCellShapes.C primitiveMeshCheck = $(primitiveMesh)/primitiveMeshCheck $(primitiveMeshCheck)/primitiveMeshCheck.C -$(primitiveMeshCheck)/primitiveMeshCheckMotion.C $(primitiveMeshCheck)/primitiveMeshCheckPointNearness.C $(primitiveMeshCheck)/primitiveMeshCheckEdgeLength.C +$(primitiveMeshCheck)/primitiveMeshTools.C primitivePatch = $(primitiveMesh)/primitivePatch $(primitivePatch)/patchZones.C @@ -524,9 +531,10 @@ $(Fields)/sphericalTensorField/sphericalTensorField.C $(Fields)/diagTensorField/diagTensorField.C $(Fields)/symmTensorField/symmTensorField.C $(Fields)/tensorField/tensorField.C +$(Fields)/triadField/triadField.C $(Fields)/complexFields/complexFields.C -$(Fields)/labelField/labelIOField. +$(Fields)/labelField/labelIOField.C $(Fields)/labelField/labelFieldIOField.C $(Fields)/scalarField/scalarIOField.C $(Fields)/scalarField/scalarFieldIOField.C @@ -542,6 +550,7 @@ $(Fields)/symmTensorField/symmTensorIOField.C $(Fields)/symmTensorField/symmTensorFieldIOField.C $(Fields)/tensorField/tensorIOField.C $(Fields)/tensorField/tensorFieldIOField.C +$(Fields)/triadField/triadIOField.C $(Fields)/transformField/transformField.C pointPatchFields = fields/pointPatchFields diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C index 4e842cb28fa03d0bef3973cab873bbb0d193d360..29bc6634aa0340dc335d174dc1b5fd64c7d40a26 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::dynamicIndexedOctreeName, 0); +namespace Foam +{ +defineTypeNameAndDebug(dynamicIndexedOctreeName, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C index 05b37e2f76047d869fb71536761c8b95995c6864..ebc93a63c7b5820efe1353835a1fb6fd567a5a1a 100644 --- a/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.C +++ b/src/OpenFOAM/algorithms/dynamicIndexedOctree/dynamicTreeDataPoint.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::dynamicTreeDataPoint, 0); +namespace Foam +{ +defineTypeNameAndDebug(dynamicTreeDataPoint, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index f16dd2595c523183104a52a8330d62588e8f2758..df8fc2aec14ab378d81e1e8c16fbbe57bb8f5461 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.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 @@ -47,36 +47,9 @@ bool Foam::indexedOctree<Type>::overlaps const point& sample ) { - // Find out where sample is in relation to bb. - // Find nearest point on bb. - scalar distSqr = 0; + boundBox bb(p0, p1); - for (direction dir = 0; dir < vector::nComponents; dir++) - { - scalar d0 = p0[dir] - sample[dir]; - scalar d1 = p1[dir] - sample[dir]; - - if ((d0 > 0) != (d1 > 0)) - { - // sample inside both extrema. This component does not add any - // distance. - } - else if (mag(d0) < mag(d1)) - { - distSqr += d0*d0; - } - else - { - distSqr += d1*d1; - } - - if (distSqr > nearestDistSqr) - { - return false; - } - } - - return true; + return bb.overlaps(sample, nearestDistSqr); } @@ -379,124 +352,6 @@ Foam::label Foam::indexedOctree<Type>::compactContents } -template <class Type> -bool Foam::indexedOctree<Type>::quickCircumsphereRejection -( - const label nodeI, - const point& cc, - const scalar crSqr, - const List<scalar>& nearestDistances -) const -{ - const node& nod = nodes_[nodeI]; - - volumeType nodeType = volumeType(nodeTypes_.get(nodeI<<3)); - - //scalar boxDist = nearestDistances[nodeI] + 0.5*nod.bb_.mag(); - scalar boxDist = crSqr + magSqr(cc - nod.bb_.midpoint()); - - if - ( - nodeType == INSIDE - //&& (crSqr < sqr(boxDist)) - && (boxDist < sqr(nearestDistances[nodeI])) - ) - { - return true; - } - else - { - direction octant = nod.bb_.subOctant(cc); - - labelBits index = nod.subNodes_[octant]; - - if (isNode(index)) - { - return quickCircumsphereRejection - ( - getNode(index), - cc, - crSqr, - nearestDistances - ); - } - else - { - return false; - } - } -} - - -template <class Type> -bool Foam::indexedOctree<Type>::quickCircumsphereRejection -( - const point& cc, - const scalar crSqr, - const List<scalar>& nearestDistances -) const -{ - if (nodes_.size()) - { - return quickCircumsphereRejection - ( - 0, - cc, - crSqr, - nearestDistances - ); - } - - return false; -} - - -template <class Type> -Foam::scalar -Foam::indexedOctree<Type>::calcNearestDistance -( - const label nodeI -) const -{ - const node& nod = nodes_[nodeI]; - - const point& nodeCentre = nod.bb_.midpoint(); - - scalar nearestDistance = 0.0; - - pointIndexHit pHit = findNearest(nodeCentre, sqr(GREAT)); - - if (pHit.hit()) - { - nearestDistance = mag(pHit.hitPoint() - nodeCentre); - } - else - { - WarningIn("Foam::indexedOctree<Type>::calcNearestDistance(const label)") - << "Cannot calculate distance of nearest point on surface from " - << "the midpoint of the octree node. Returning distance of zero." - << endl; - } - - return nearestDistance; -} - - -template <class Type> -Foam::List<Foam::scalar> -Foam::indexedOctree<Type>::calcNearestDistance() const -{ - List<scalar> nearestDistances(nodes_.size()); - - forAll(nearestDistances, nodeI) - { - nearestDistances[nodeI] = calcNearestDistance(nodeI); - } - - return nearestDistances; -} - - // Pre-calculates wherever possible the volume status per node/subnode. // Recurses to determine status of lowest level boxes. Level above is // combination of octants below. diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H index 40ee7a8a32cf54d0403a53fd477c4046cecf5cbc..e945d5d7663359a736bfb60ff9e58316538235c7 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.H +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.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 @@ -201,16 +201,6 @@ private: label& compactI ); - scalar calcNearestDistance(const label nodeI) const; - - bool quickCircumsphereRejection - ( - const label nodeI, - const point& cc, - const scalar crSqr, - const List<scalar>& nearestDistances - ) const; - //- Determine inside/outside per node (mixed if cannot be // determined). Only valid for closed shapes. volumeType calcVolumeType(const label nodeI) const; @@ -658,16 +648,6 @@ public: CompareOp& cop ) const; - //- Return a list containing the nearest distance of nodes to any - // shapes - List<scalar> calcNearestDistance() const; - - bool quickCircumsphereRejection - ( - const point& cc, - const scalar crSqr, - const List<scalar>& nearestDistances - ) const; // Write diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctreeName.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctreeName.C index 26574b0089e2db584a56ec6011d004b690fbea29..1f1ce408d39016a320986f49d1b5ff0c4612867f 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctreeName.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctreeName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::indexedOctreeName, 0); +namespace Foam +{ +defineTypeNameAndDebug(indexedOctreeName, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C b/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C index 1bb57a44d7502fadbdb993184c2c1cbf09820c8f..e4d78fc83d6d5e22bbad3598446f546dc28f391c 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.C +++ b/src/OpenFOAM/algorithms/indexedOctree/treeDataCell.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::treeDataCell, 0); +namespace Foam +{ +defineTypeNameAndDebug(treeDataCell, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/algorithms/subCycle/subCycle.H b/src/OpenFOAM/algorithms/subCycle/subCycle.H index a4a1ea1844c506b86ebeeba260e9895005405d70..f0c8958dd0cba5169de526d3582a6290a5df264d 100644 --- a/src/OpenFOAM/algorithms/subCycle/subCycle.H +++ b/src/OpenFOAM/algorithms/subCycle/subCycle.H @@ -51,8 +51,13 @@ class subCycleField //- Reference to the field being sub-cycled GeometricField& gf_; + //- Reference to the field old-time field being sub-cycled + // Needed to avoid calls to oldTime() which may cause + // unexpected updates of the old-time field + GeometricField& gf0_; + //- Copy of the "real" old-time value of the field - GeometricField gf0_; + GeometricField gf_0_; public: @@ -63,19 +68,33 @@ public: subCycleField(GeometricField& gf) : gf_(gf), - gf0_(gf.oldTime()) + gf0_(gf.oldTime()), + gf_0_(gf0_.name() + "_", gf0_) {} //- Destructor ~subCycleField() { + // Reset the old-time field + gf0_ = gf_0_; + // Correct the time index of the field to correspond to the global time gf_.timeIndex() = gf_.time().timeIndex(); + gf0_.timeIndex() = gf_.time().timeIndex(); + } + - // Reset the old-time field value - gf_.oldTime() = gf0_; - gf_.oldTime().timeIndex() = gf0_.timeIndex(); + //- Correct the time index of the field to correspond to + // the sub-cycling time. + // + // The time index is incremented to protect the old-time value from + // being updated at the beginning of the time-loop in the case of + // outer iteration + void updateTimeIndex() + { + gf_.timeIndex() = gf_.time().timeIndex() + 1; + gf0_.timeIndex() = gf_.time().timeIndex() + 1; } }; @@ -106,16 +125,18 @@ public: //- Construct field and number of sub-cycles subCycle(GeometricField& gf, const label nSubCycles) : - subCycleField<GeometricField>(gf), subCycleTime(const_cast<Time&>(gf.time()), nSubCycles) - {} + { + // Update the field time index to correspond to the sub-cycle time + this->updateTimeIndex(); + } //- Destructor + // End the subCycleTime, which restores the time state ~subCycle() { - // End the subCycleTime, which restores the time state endSubCycle(); } }; diff --git a/src/OpenFOAM/containers/Circulators/CirculatorBase/CirculatorBase.H b/src/OpenFOAM/containers/Circulators/CirculatorBase/CirculatorBase.H new file mode 100644 index 0000000000000000000000000000000000000000..d1ab166bab32a4414308cf06057d80d8196ceb24 --- /dev/null +++ b/src/OpenFOAM/containers/Circulators/CirculatorBase/CirculatorBase.H @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::CirculatorBase + +Description + Base class for circulators + +\*---------------------------------------------------------------------------*/ + +#ifndef CirculatorBase_H +#define CirculatorBase_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class CirculatorBase Declaration +\*---------------------------------------------------------------------------*/ + +class CirculatorBase +{ +public: + + // Public data + + //- Direction type enumeration + enum direction + { + NONE, + CLOCKWISE, + ANTICLOCKWISE + }; + + + // Constructors + + //- Construct null + CirculatorBase(){}; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/Circulators/circulator/circulator.H b/src/OpenFOAM/containers/Circulators/circulator/circulator.H new file mode 100644 index 0000000000000000000000000000000000000000..15188df98278a5f932f3befef5c4dac6eee5f147 --- /dev/null +++ b/src/OpenFOAM/containers/Circulators/circulator/circulator.H @@ -0,0 +1,227 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::circulator + +Description + Walks over a container as if it were circular. The container must have the + following members defined: + - value_type + - size_type + - difference_type + - iterator + - reference + + Examples + + \code + face f(identity(5)); + + // Construct circulator from the face + circulator<face> circ(f); + + // First check that the circulator has a size to iterate over. + // Then circulate around the list starting and finishing at the fulcrum. + if (circ.size()) do + { + circ() += 1; + + Info<< "Iterate forwards over face : " << circ() << endl; + + } while (circ.circulate(CirculatorBase::CLOCKWISE)); + \endcode + +SourceFiles + circulatorI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef circulator_H +#define circulator_H + +#include "CirculatorBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class circulator Declaration +\*---------------------------------------------------------------------------*/ + +template<class ContainerType> +class circulator +: + public CirculatorBase +{ + +protected: + + // Protected data + + //- Iterator pointing to the beginning of the container + typename ContainerType::iterator begin_; + + //- Iterator pointing to the end of the container + typename ContainerType::iterator end_; + + //- Random access iterator for traversing ContainerType. + typename ContainerType::iterator iter_; + + //- Iterator holding the location of the fulcrum (start and end) of + // the container. Used to decide when the iterator should stop + // circulating over the container + typename ContainerType::iterator fulcrum_; + + +public: + + // STL type definitions + + //- Type of values ContainerType contains. + typedef typename ContainerType::value_type value_type; + + //- The type that can represent the size of ContainerType + typedef typename ContainerType::size_type size_type; + + //- The type that can represent the difference between any two + // iterator objects. + typedef typename ContainerType::difference_type difference_type; + + //- Random access iterator for traversing ContainerType. + typedef typename ContainerType::iterator iterator; + + //- Type that can be used for storing into + // ContainerType::value_type objects. + typedef typename ContainerType::reference reference; + + + // Constructors + + //- Construct null + inline circulator(); + + //- Construct from a container. + inline explicit circulator(ContainerType& container); + + //- Construct from two iterators + inline circulator(const iterator& begin, const iterator& end); + + //- Construct as copy + inline circulator(const circulator<ContainerType>&); + + + //- Destructor + ~circulator(); + + + // Member Functions + + //- Return the range of the iterator + inline size_type size() const; + + //- Circulate around the list in the given direction + inline bool circulate(const CirculatorBase::direction dir = NONE); + + //- Set the fulcrum to the current position of the iterator + inline void setFulcrumToIterator(); + + //- Set the iterator to the current position of the fulcrum + inline void setIteratorToFulcrum(); + + //- Return the distance between the iterator and the fulcrum. This is + // equivalent to the number of rotations of the circulator. + inline difference_type nRotations() const; + + //- Dereference the next iterator and return + inline reference next() const; + + //- Dereference the previous iterator and return + inline reference prev() const; + + + // Member Operators + + //- Assignment operator for circulators that operate on the same + // container type + inline void operator=(const circulator<ContainerType>&); + + //- Prefix increment. Increments the iterator. + // Sets the iterator to the beginning of the container if it reaches + // the end + inline circulator<ContainerType>& operator++(); + + //- Postfix increment. Increments the iterator. + // Sets the iterator to the beginning of the container if it reaches + // the end + inline circulator<ContainerType> operator++(int); + + //- Prefix decrement. Decrements the iterator. + // Sets the iterator to the end of the container if it reaches + // the beginning + inline circulator<ContainerType>& operator--(); + + //- Postfix decrement. Decrements the iterator. + // Sets the iterator to the end of the container if it reaches + // the beginning + inline circulator<ContainerType> operator--(int); + + //- Check for equality of this iterator with another iterator that + // operate on the same container type + inline bool operator==(const circulator<ContainerType>& c) const; + + //- Check for inequality of this iterator with another iterator that + // operate on the same container type + inline bool operator!=(const circulator<ContainerType>& c) const; + + //- Dereference the iterator and return + inline reference operator*() const; + + //- Dereference the iterator and return + inline reference operator()() const; + + //- Return the difference between this iterator and another iterator + // that operate on the same container type + inline difference_type operator- + ( + const circulator<ContainerType>& c + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "circulatorI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/Circulators/circulator/circulatorI.H b/src/OpenFOAM/containers/Circulators/circulator/circulatorI.H new file mode 100644 index 0000000000000000000000000000000000000000..e39f1fa27d1a7471bb0522f4c08a8ee7c45fb735 --- /dev/null +++ b/src/OpenFOAM/containers/Circulators/circulator/circulatorI.H @@ -0,0 +1,290 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class ContainerType> +Foam::circulator<ContainerType>::circulator() +: + CirculatorBase(), + begin_(0), + end_(0), + iter_(0), + fulcrum_(0) +{} + + +template<class ContainerType> +Foam::circulator<ContainerType>::circulator(ContainerType& container) +: + CirculatorBase(), + begin_(container.begin()), + end_(container.end()), + iter_(begin_), + fulcrum_(begin_) +{} + + +template<class ContainerType> +Foam::circulator<ContainerType>::circulator +( + const iterator& begin, + const iterator& end +) +: + CirculatorBase(), + begin_(begin), + end_(end), + iter_(begin), + fulcrum_(begin) +{} + + +template<class ContainerType> +Foam::circulator<ContainerType>::circulator +( + const circulator<ContainerType>& rhs +) +: + CirculatorBase(), + begin_(rhs.begin_), + end_(rhs.end_), + iter_(rhs.iter_), + fulcrum_(rhs.fulcrum_) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template<class ContainerType> +Foam::circulator<ContainerType>::~circulator() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class ContainerType> +typename Foam::circulator<ContainerType>::size_type +Foam::circulator<ContainerType>::size() const +{ + return end_ - begin_; +} + + +template<class ContainerType> +bool Foam::circulator<ContainerType>::circulate +( + const CirculatorBase::direction dir +) +{ + if (dir == CirculatorBase::CLOCKWISE) + { + operator++(); + } + else if (dir == CirculatorBase::ANTICLOCKWISE) + { + operator--(); + } + + return !(iter_ == fulcrum_); +} + + +template<class ContainerType> +void Foam::circulator<ContainerType>::setFulcrumToIterator() +{ + fulcrum_ = iter_; +} + + +template<class ContainerType> +void Foam::circulator<ContainerType>::setIteratorToFulcrum() +{ + iter_ = fulcrum_; +} + + +template<class ContainerType> +typename Foam::circulator<ContainerType>::difference_type +Foam::circulator<ContainerType>::nRotations() const +{ + return (iter_ - fulcrum_); +} + + +template<class ContainerType> +typename Foam::circulator<ContainerType>::reference +Foam::circulator<ContainerType>::next() const +{ + if (iter_ == end_ - 1) + { + return *begin_; + } + + return *(iter_ + 1); +} + + +template<class ContainerType> +typename Foam::circulator<ContainerType>::reference +Foam::circulator<ContainerType>::prev() const +{ + if (iter_ == begin_) + { + return *(end_ - 1); + } + + return *(iter_ - 1); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template<class ContainerType> +void Foam::circulator<ContainerType>::operator= +( + const circulator<ContainerType>& rhs +) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn + ( + "Foam::circulator<ContainerType>::operator=" + "(const Foam::circulator<ContainerType>&)" + ) << "Attempted assignment to self" + << abort(FatalError); + } + + begin_ = rhs.begin_; + end_ = rhs.end_; + iter_ = rhs.iter_; + fulcrum_ = rhs.fulcrum_; +} + + +template<class ContainerType> +Foam::circulator<ContainerType>& +Foam::circulator<ContainerType>::operator++() +{ + ++iter_; + if (iter_ == end_) + { + iter_ = begin_; + } + + return *this; +} + + +template<class ContainerType> +Foam::circulator<ContainerType> +Foam::circulator<ContainerType>::operator++(int) +{ + circulator<ContainerType> tmp = *this; + ++(*this); + return tmp; +} + + +template<class ContainerType> +Foam::circulator<ContainerType>& +Foam::circulator<ContainerType>::operator--() +{ + if (iter_ == begin_) + { + iter_ = end_; + } + --iter_; + + return *this; +} + + +template<class ContainerType> +Foam::circulator<ContainerType> +Foam::circulator<ContainerType>::operator--(int) +{ + circulator<ContainerType> tmp = *this; + --(*this); + return tmp; +} + + +template<class ContainerType> +bool Foam::circulator<ContainerType>::operator== +( + const circulator<ContainerType>& c +) const +{ + return + ( + begin_ == c.begin_ + && end_ == c.end_ + && iter_ == c.iter_ + && fulcrum_ == c.fulcrum_ + ); +} + + +template<class ContainerType> +bool Foam::circulator<ContainerType>::operator!= +( + const circulator<ContainerType>& c +) const +{ + return !(*this == c); +} + + +template<class ContainerType> +typename Foam::circulator<ContainerType>::reference +Foam::circulator<ContainerType>::operator*() const +{ + return *iter_; +} + + +template<class ContainerType> +typename Foam::circulator<ContainerType>::reference +Foam::circulator<ContainerType>::operator()() const +{ + return operator*(); +} + + +template<class ContainerType> +typename Foam::circulator<ContainerType>::difference_type +Foam::circulator<ContainerType>::operator- +( + const circulator<ContainerType>& c +) const +{ + return iter_ - c.iter_; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/Circulators/const_circulator/const_circulator.H b/src/OpenFOAM/containers/Circulators/const_circulator/const_circulator.H new file mode 100644 index 0000000000000000000000000000000000000000..fc8ba633aa412debf657fb5ffc76b40af8708695 --- /dev/null +++ b/src/OpenFOAM/containers/Circulators/const_circulator/const_circulator.H @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::const_circulator + +Description + Walks over a container as if it were circular. The container must have the + following members defined: + - value_type + - size_type + - difference_type + - const_iterator + - const_reference + + Examples: + + \code + face f(identity(5)); + + // Construct circulator from the face + const_circulator<face> circ(f); + + // First check that the circulator has a size to iterate over. + // Then circulate around the list starting and finishing at the fulcrum. + if (circ.size()) do + { + Info<< "Iterate forwards over face : " << circ() << endl; + + } while (circ.circulate(CirculatorBase::CLOCKWISE)); + \endcode + + \code + face f(identity(5)); + + const_circulator<face> circClockwise(f); + const_circulator<face> circAnticlockwise(f); + + if (circClockwise.size() && circAnticlockwise.size()) do + { + Info<< "Iterate forward over face :" << circClockwise() << endl; + Info<< "Iterate backward over face:" << circAnticlockwise() << endl; + } + while + ( + circClockwise.circulate(CirculatorBase::CLOCKWISE), + circAnticlockwise.circulate(CirculatorBase::ANTICLOCKWISE) + ); + \endcode + +SourceFiles + const_circulatorI.H + +\*---------------------------------------------------------------------------*/ + +#ifndef const_circulator_H +#define const_circulator_H + +#include "CirculatorBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +/*---------------------------------------------------------------------------*\ + Class const_circulator Declaration +\*---------------------------------------------------------------------------*/ + +template<class ContainerType> +class const_circulator +: + public CirculatorBase +{ + +protected: + + // Protected data + + //- Iterator pointing to the beginning of the container + typename ContainerType::const_iterator begin_; + + //- Iterator pointing to the end of the container + typename ContainerType::const_iterator end_; + + //- Iterator + typename ContainerType::const_iterator iter_; + + //- Iterator holding the location of the fulcrum (start and end) of + // the container. Used to decide when the iterator should stop + // circulating over the container + typename ContainerType::const_iterator fulcrum_; + + +public: + + // STL type definitions + + //- Type of values ContainerType contains. + typedef typename ContainerType::value_type value_type; + + //- The type that can represent the size of ContainerType + typedef typename ContainerType::size_type size_type; + + //- The type that can represent the difference between any two + // iterator objects. + typedef typename ContainerType::difference_type difference_type; + + //- Random access iterator for traversing ContainerType. + typedef typename ContainerType::const_iterator const_iterator; + + //- Type that can be used for storing into + // const ContainerType::value_type objects. + typedef typename ContainerType::const_reference const_reference; + + + // Constructors + + //- Construct null + inline const_circulator(); + + //- Construct from a container. + inline explicit const_circulator(const ContainerType& container); + + //- Construct from two iterators + inline const_circulator + ( + const const_iterator& begin, + const const_iterator& end + ); + + //- Construct as copy + inline const_circulator(const const_circulator<ContainerType>&); + + + //- Destructor + ~const_circulator(); + + + // Member Functions + + //- Return the range of the iterator + inline size_type size() const; + + //- Circulate around the list in the given direction + inline bool circulate(const CirculatorBase::direction dir = NONE); + + //- Set the fulcrum to the current position of the iterator + inline void setFulcrumToIterator(); + + //- Set the iterator to the current position of the fulcrum + inline void setIteratorToFulcrum(); + + //- Return the distance between the iterator and the fulcrum. This is + // equivalent to the number of rotations of the circulator. + inline difference_type nRotations() const; + + //- Dereference the next iterator and return + inline const_reference next() const; + + //- Dereference the previous iterator and return + inline const_reference prev() const; + + + // Member Operators + + //- Assignment operator for circulators that operate on the same + // container type + inline void operator=(const const_circulator<ContainerType>&); + + //- Prefix increment. Increments the iterator. + // Sets the iterator to the beginning of the container if it reaches + // the end + inline const_circulator<ContainerType>& operator++(); + + //- Postfix increment. Increments the iterator. + // Sets the iterator to the beginning of the container if it reaches + // the end + inline const_circulator<ContainerType> operator++(int); + + //- Prefix decrement. Decrements the iterator. + // Sets the iterator to the end of the container if it reaches + // the beginning + inline const_circulator<ContainerType>& operator--(); + + //- Postfix decrement. Decrements the iterator. + // Sets the iterator to the end of the container if it reaches + // the beginning + inline const_circulator<ContainerType> operator--(int); + + //- Check for equality of this iterator with another iterator that + // operate on the same container type + inline bool operator==(const const_circulator<ContainerType>& c) const; + + //- Check for inequality of this iterator with another iterator that + // operate on the same container type + inline bool operator!=(const const_circulator<ContainerType>& c) const; + + //- Dereference the iterator and return + inline const_reference operator*() const; + + //- Dereference the iterator and return + inline const_reference operator()() const; + + //- Return the difference between this iterator and another iterator + // that operate on the same container type + inline difference_type operator- + ( + const const_circulator<ContainerType>& c + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "const_circulatorI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/Circulators/const_circulator/const_circulatorI.H b/src/OpenFOAM/containers/Circulators/const_circulator/const_circulatorI.H new file mode 100644 index 0000000000000000000000000000000000000000..47cdb69f06b9627028534022b97c45af2c7530b1 --- /dev/null +++ b/src/OpenFOAM/containers/Circulators/const_circulator/const_circulatorI.H @@ -0,0 +1,293 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class ContainerType> +Foam::const_circulator<ContainerType>::const_circulator() +: + CirculatorBase(), + begin_(0), + end_(0), + iter_(0), + fulcrum_(0) +{} + + +template<class ContainerType> +Foam::const_circulator<ContainerType>::const_circulator +( + const ContainerType& container +) +: + CirculatorBase(), + begin_(container.begin()), + end_(container.end()), + iter_(begin_), + fulcrum_(begin_) +{} + + +template<class ContainerType> +Foam::const_circulator<ContainerType>::const_circulator +( + const const_iterator& begin, + const const_iterator& end +) +: + CirculatorBase(), + begin_(begin), + end_(end), + iter_(begin), + fulcrum_(begin) +{} + + +template<class ContainerType> +Foam::const_circulator<ContainerType>::const_circulator +( + const const_circulator<ContainerType>& rhs +) +: + CirculatorBase(), + begin_(rhs.begin_), + end_(rhs.end_), + iter_(rhs.iter_), + fulcrum_(rhs.fulcrum_) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template<class ContainerType> +Foam::const_circulator<ContainerType>::~const_circulator() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::size_type +Foam::const_circulator<ContainerType>::size() const +{ + return end_ - begin_; +} + + +template<class ContainerType> +bool Foam::const_circulator<ContainerType>::circulate +( + const CirculatorBase::direction dir +) +{ + if (dir == CirculatorBase::CLOCKWISE) + { + operator++(); + } + else if (dir == CirculatorBase::ANTICLOCKWISE) + { + operator--(); + } + + return !(iter_ == fulcrum_); +} + + +template<class ContainerType> +void Foam::const_circulator<ContainerType>::setFulcrumToIterator() +{ + fulcrum_ = iter_; +} + + +template<class ContainerType> +void Foam::const_circulator<ContainerType>::setIteratorToFulcrum() +{ + iter_ = fulcrum_; +} + + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::difference_type +Foam::const_circulator<ContainerType>::nRotations() const +{ + return (iter_ - fulcrum_); +} + + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::const_reference +Foam::const_circulator<ContainerType>::next() const +{ + if (iter_ == end_ - 1) + { + return *begin_; + } + + return *(iter_ + 1); +} + + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::const_reference +Foam::const_circulator<ContainerType>::prev() const +{ + if (iter_ == begin_) + { + return *(end_ - 1); + } + + return *(iter_ - 1); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template<class ContainerType> +void Foam::const_circulator<ContainerType>::operator= +( + const const_circulator<ContainerType>& rhs +) +{ + // Check for assignment to self + if (this == &rhs) + { + FatalErrorIn + ( + "Foam::const_circulator<ContainerType>::operator=" + "(const Foam::const_circulator<ContainerType>&)" + ) << "Attempted assignment to self" + << abort(FatalError); + } + + begin_ = rhs.begin_; + end_ = rhs.end_; + iter_ = rhs.iter_; + fulcrum_ = rhs.fulcrum_; +} + + +template<class ContainerType> +Foam::const_circulator<ContainerType>& +Foam::const_circulator<ContainerType>::operator++() +{ + ++iter_; + if (iter_ == end_) + { + iter_ = begin_; + } + + return *this; +} + + +template<class ContainerType> +Foam::const_circulator<ContainerType> +Foam::const_circulator<ContainerType>::operator++(int) +{ + const_circulator<ContainerType> tmp = *this; + ++(*this); + return tmp; +} + + +template<class ContainerType> +Foam::const_circulator<ContainerType>& +Foam::const_circulator<ContainerType>::operator--() +{ + if (iter_ == begin_) + { + iter_ = end_; + } + --iter_; + + return *this; +} + + +template<class ContainerType> +Foam::const_circulator<ContainerType> +Foam::const_circulator<ContainerType>::operator--(int) +{ + const_circulator<ContainerType> tmp = *this; + --(*this); + return tmp; +} + + +template<class ContainerType> +bool Foam::const_circulator<ContainerType>::operator== +( + const const_circulator<ContainerType>& c +) const +{ + return + ( + begin_ == c.begin_ + && end_ == c.end_ + && iter_ == c.iter_ + && fulcrum_ == c.fulcrum_ + ); +} + + +template<class ContainerType> +bool Foam::const_circulator<ContainerType>::operator!= +( + const const_circulator<ContainerType>& c +) const +{ + return !(*this == c); +} + + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::const_reference +Foam::const_circulator<ContainerType>::operator*() const +{ + return *iter_; +} + + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::const_reference +Foam::const_circulator<ContainerType>::operator()() const +{ + return operator*(); +} + + +template<class ContainerType> +typename Foam::const_circulator<ContainerType>::difference_type +Foam::const_circulator<ContainerType>::operator- +( + const const_circulator<ContainerType>& c +) const +{ + return iter_ - c.iter_; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C index 7058ac6139a743f21275146b44df4aa149113a7b..58fcdf27b1c9d0146891edf4a16b9f1503897ad5 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::HashTableCore, 0); +namespace Foam +{ +defineTypeNameAndDebug(HashTableCore, 0); +} const Foam::label Foam::HashTableCore::maxTableSize ( @@ -38,6 +41,7 @@ const Foam::label Foam::HashTableCore::maxTableSize ) ); + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::label Foam::HashTableCore::canonicalSize(const label size) diff --git a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableCore.C b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableCore.C index 380317fdc137592ee383a75dbbf047a79d2da0c7..760839b0c683207050f2abd5b4a88782f01d25e4 100644 --- a/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableCore.C +++ b/src/OpenFOAM/containers/HashTables/StaticHashTable/StaticHashTableCore.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::StaticHashTableCore, 0); +namespace Foam +{ +defineTypeNameAndDebug(StaticHashTableCore, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index d0689b0eb1955f82bb2ffee45f8d72e846a49fa0..8da376020d4c38e602582c47ab539562ec318fdb 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -245,6 +245,36 @@ template<class Container, class T, int nRows, int nColumns> List<Container> initListList(const T[nRows][nColumns]); +//- Helper class for list to append y onto the end of x +template<class T> +class ListAppendEqOp +{ +public: + void operator()(List<T>& x, const List<T>& y) const; +}; + + +//- Reverse a list. First element becomes last element etc. +template <class ListType> +ListType reverseList(const ListType& list); + + +//- Inplace reversal of a list using Swap. +template <class ListType> +void inplaceReverseList(ListType& list); + + +//- Rotate a list by n places. If n is positive rotate clockwise/right/down. +// If n is negative rotate anti-clockwise/left/up. +template <class ListType> +ListType rotateList(const ListType& list, const label n); + + +//- Inplace reversal of a list using the Reversal Block Swapping algorithm. +template <template <typename> class ListType, class DataType> +void inplaceRotateList(ListType<DataType>& list, label n); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C index be6337a4283e6e5f039ba9a8fc5e6ee9cb52fb87..d55e3fd982abd8176162b66e40b72a118a8387c1 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C @@ -684,4 +684,105 @@ Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns]) } +template<class T> +void Foam::ListAppendEqOp<T>::operator()(List<T>& x, const List<T>& y) const +{ + if (y.size()) + { + if (x.size()) + { + label sz = x.size(); + x.setSize(sz + y.size()); + forAll(y, i) + { + x[sz++] = y[i]; + } + } + else + { + x = y; + } + } +} + + +template <class ListType> +ListType Foam::reverseList(const ListType& list) +{ + const label listSize = list.size(); + const label lastIndex = listSize - 1; + + ListType tmpList(listSize); + + forAll(tmpList, elemI) + { + tmpList[elemI] = list[lastIndex - elemI]; + } + + return tmpList; +} + + +template <class ListType> +void Foam::inplaceReverseList(ListType& list) +{ + const label listSize = list.size(); + const label lastIndex = listSize - 1; + const label nIterations = listSize >> 1; + + label elemI = 0; + while (elemI < nIterations) + { + Swap(list[elemI], list[lastIndex - elemI]); + + elemI++; + } +} + + +template <class ListType> +ListType Foam::rotateList(const ListType& list, const label n) +{ + const label listSize = list.size(); + + ListType tmpList(listSize); + + forAll(tmpList, elemI) + { + label index = (elemI - n) % listSize; + + if (index < 0) + { + index += listSize; + } + + tmpList[elemI] = list[index]; + } + + return tmpList; +} + + +template <template <typename> class ListType, class DataType> +void Foam::inplaceRotateList(ListType<DataType>& list, label n) +{ + const label listSize = list.size(); + + n = (listSize - n) % listSize; + + if (n < 0) + { + n += listSize; + } + + SubList<DataType> firstHalf(list, n, 0); + SubList<DataType> secondHalf(list, listSize - n, n); + + inplaceReverseList(firstHalf); + inplaceReverseList(secondHalf); + + inplaceReverseList(list); +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedListCore.C b/src/OpenFOAM/containers/Lists/PackedList/PackedListCore.C index 9b69437698fd233b4249b75fe69696965230c81a..92f3b3603d187e189af9b0091c3059d14f0aeee8 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedListCore.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedListCore.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::PackedListCore, 0); +namespace Foam +{ +defineTypeNameAndDebug(PackedListCore, 0); +} // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/SortableList/ParSortableListName.C b/src/OpenFOAM/containers/Lists/SortableList/ParSortableListName.C index 654633f7cc228833d7c2172d3ca3cf7d3c3e0670..8818406b151ac179a90421b926a49008f4a526ba 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/ParSortableListName.C +++ b/src/OpenFOAM/containers/Lists/SortableList/ParSortableListName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::ParSortableListName, 0); +namespace Foam +{ +defineTypeNameAndDebug(ParSortableListName, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/db/CallbackRegistry/CallbackRegistryName.C b/src/OpenFOAM/db/CallbackRegistry/CallbackRegistryName.C index 313dafb4917deefb277bf0db0714d1587075f1a9..6251032e8bd2602b47a478e5e5e08898f5293a32 100644 --- a/src/OpenFOAM/db/CallbackRegistry/CallbackRegistryName.C +++ b/src/OpenFOAM/db/CallbackRegistry/CallbackRegistryName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::CallbackRegistryName, 0); +namespace Foam +{ +defineTypeNameAndDebug(CallbackRegistryName, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C index e9e48e95540f87158fa7aa56c5923bdd41b1a9f3..a603a76dd9258bacffdc956cfec05c1acb08aab9 100644 --- a/src/OpenFOAM/db/IOobject/IOobject.C +++ b/src/OpenFOAM/db/IOobject/IOobject.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 @@ -29,7 +29,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::IOobject, 0); +namespace Foam +{ +defineTypeNameAndDebug(IOobject, 0); +} + // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // @@ -40,7 +44,7 @@ defineTypeNameAndDebug(Foam::IOobject, 0); // ----- ------ // "foo" ("", "", "foo") // "foo/bar" ("foo", "", "bar") -// "/XXX" ERROR - no absolute path +// "/XXX/bar" ("/XXX", "", "bar") // "foo/bar/" ERROR - no name // "foo/xxx/bar" ("foo", "xxx", "bar") // "foo/xxx/yyy/bar" ("foo", "xxx/yyy", "bar") @@ -64,14 +68,6 @@ bool Foam::IOobject::IOobject::fileNameComponents return false; } - if (path.isAbsolute()) - { - // called with absolute path - WarningIn("IOobject::fileNameComponents(const fileName&, ...)") - << "called with absolute path: " << path << "\n"; - return false; - } - string::size_type first = path.find('/'); if (first == string::npos) @@ -81,6 +77,15 @@ bool Foam::IOobject::IOobject::fileNameComponents // check afterwards name.string::operator=(path); } + else if (first == 0) + { + // Leading '/'. Absolute fileName + string::size_type last = path.rfind('/'); + instance = path.substr(0, last); + + // check afterwards + name.string::operator=(path.substr(last+1)); + } else { instance = path.substr(0, first); @@ -246,7 +251,14 @@ const Foam::fileName& Foam::IOobject::rootPath() const Foam::fileName Foam::IOobject::path() const { - return rootPath()/caseName()/instance()/db_.dbDir()/local(); + if (instance().isAbsolute()) + { + return instance(); + } + else + { + return rootPath()/caseName()/instance()/db_.dbDir()/local(); + } } @@ -256,61 +268,80 @@ Foam::fileName Foam::IOobject::path const fileName& local ) const { + //Note: can only be called with relative instance since is word type return rootPath()/caseName()/instance/db_.dbDir()/local; } Foam::fileName Foam::IOobject::filePath() const { - fileName path = this->path(); - fileName objectPath = path/name(); - - if (isFile(objectPath)) + if (instance().isAbsolute()) { - return objectPath; + fileName objectPath = instance()/name(); + if (isFile(objectPath)) + { + return objectPath; + } + else + { + return fileName::null; + } } else { - if - ( - time().processorCase() - && ( - instance() == time().system() - || instance() == time().constant() - ) - ) - { - fileName parentObjectPath = - rootPath()/caseName() - /".."/instance()/db_.dbDir()/local()/name(); + fileName path = this->path(); + fileName objectPath = path/name(); - if (isFile(parentObjectPath)) - { - return parentObjectPath; - } + if (isFile(objectPath)) + { + return objectPath; } - - if (!isDir(path)) + else { - word newInstancePath = time().findInstancePath(instant(instance())); + if + ( + time().processorCase() + && ( + instance() == time().system() + || instance() == time().constant() + ) + ) + { + fileName parentObjectPath = + rootPath()/caseName() + /".."/instance()/db_.dbDir()/local()/name(); - if (newInstancePath.size()) + if (isFile(parentObjectPath)) + { + return parentObjectPath; + } + } + + if (!isDir(path)) { - fileName fName + word newInstancePath = time().findInstancePath ( - rootPath()/caseName() - /newInstancePath/db_.dbDir()/local()/name() + instant(instance()) ); - if (isFile(fName)) + if (newInstancePath.size()) { - return fName; + fileName fName + ( + rootPath()/caseName() + /newInstancePath/db_.dbDir()/local()/name() + ); + + if (isFile(fName)) + { + return fName; + } } } } - } - return fileName::null; + return fileName::null; + } } diff --git a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C index a21be89f8a6f3d1efe86356ae5d7e81443b83596..75dbaa8dd43e18f9c54a0170a3e49e02e2214f70 100644 --- a/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.C +++ b/src/OpenFOAM/db/IOobjects/IOdictionary/IOdictionary.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 @@ -29,12 +29,15 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::IOdictionary, 0); +namespace Foam +{ +defineTypeNameAndDebug(IOdictionary, 0); -bool Foam::IOdictionary::writeDictionaries +bool IOdictionary::writeDictionaries ( - Foam::debug::infoSwitch("writeDictionaries", 0) + debug::infoSwitch("writeDictionaries", 0) ); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C index fb2480f41385ec0c152ea6663c2b922a66e072bb..3c62255d97ad085fe60a91de6d131122e4df52c7 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::IFstream, 0); +namespace Foam +{ +defineTypeNameAndDebug(IFstream, 0); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C index da9fc290a2b5201c4e409e9d97ce20a3809e3c00..3feefdaf40a4cf74e0d11b2b21da741509712ed5 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::OFstream, 0); +namespace Foam +{ +defineTypeNameAndDebug(OFstream, 0); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C index 7a1ebeb9ac98fb8669e3ae080d07302f45037cf9..314651c629697eab2ec1c1cb9f27ce420af975da 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/Pstream.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 @@ -27,13 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::Pstream, 0); - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +namespace Foam +{ +defineTypeNameAndDebug(Pstream, 0); +} // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index d0a3d87276c3a23580db3ac8d13d9886f4fa7bf3..9cc6d9d6f5de5deef4f24e41cee80db0d8b043d0 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -30,10 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::UPstream, 0); - namespace Foam { + defineTypeNameAndDebug(UPstream, 0); + template<> const char* Foam::NamedEnum < @@ -240,6 +240,12 @@ bool Foam::UPstream::floatTransfer ( debug::optimisationSwitch("floatTransfer", 0) ); +registerOptSwitchWithName +( + Foam::UPstream::floatTransfer, + floatTransfer, + "floatTransfer" +); // Number of processors at which the reduce algorithm changes from linear to // tree @@ -247,18 +253,55 @@ int Foam::UPstream::nProcsSimpleSum ( debug::optimisationSwitch("nProcsSimpleSum", 16) ); +registerOptSwitchWithName +( + Foam::UPstream::nProcsSimpleSum, + nProcsSimpleSum, + "nProcsSimpleSum" +); // Default commsType Foam::UPstream::commsTypes Foam::UPstream::defaultCommsType ( commsTypeNames.read(debug::optimisationSwitches().lookup("commsType")) ); +// Register re-reader +class addcommsTypeToOpt +: + public ::Foam::simpleRegIOobject +{ +public: + addcommsTypeToOpt(const char* name) + : + ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) + {} + virtual ~addcommsTypeToOpt() + {} + virtual void readData(Foam::Istream& is) + { + Foam::UPstream::defaultCommsType = Foam::UPstream::commsTypeNames.read + ( + is + ); + } + virtual void writeData(Foam::Ostream& os) const + { + os << Foam::UPstream::commsTypeNames[Foam::UPstream::defaultCommsType]; + } +}; +addcommsTypeToOpt addcommsTypeToOpt_("commsType"); + // Number of polling cycles in processor updates int Foam::UPstream::nPollProcInterfaces ( debug::optimisationSwitch("nPollProcInterfaces", 0) ); - +registerOptSwitchWithName +( + Foam::UPstream::nPollProcInterfaces, + nPollProcInterfaces, + "nPollProcInterfaces" +); // ************************************************************************* // diff --git a/src/OpenFOAM/db/IOstreams/token/token.C b/src/OpenFOAM/db/IOstreams/token/token.C index 53eadb70ede7b15b29d9e8d111bb97b6b8e371a3..83b5542c64a1b0a87573d01a8effa205c96322ce 100644 --- a/src/OpenFOAM/db/IOstreams/token/token.C +++ b/src/OpenFOAM/db/IOstreams/token/token.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 @@ -27,11 +27,15 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const char* const Foam::token::typeName = "token"; -Foam::token Foam::token::undefinedToken; +namespace Foam +{ +const char* const token::typeName = "token"; +token token::undefinedToken; -defineTypeNameAndDebug(Foam::token::compound, 0); -defineRunTimeSelectionTable(Foam::token::compound, Istream); +typedef token::compound tokenCompound; +defineTypeNameAndDebug(tokenCompound, 0); +defineRunTimeSelectionTable(tokenCompound, Istream); +} // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 155c4c2eb48456ef366aa43b7de061321f16dca6..1bcf42e5dcf7da150e804e99954d104aedfde001 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -31,10 +31,10 @@ License // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::Time, 0); - namespace Foam { + defineTypeNameAndDebug(Time, 0); + template<> const char* Foam::NamedEnum < @@ -148,7 +148,7 @@ void Foam::Time::setControls() else { // Search directory for valid time directories - instantList timeDirs = findTimes(path()); + instantList timeDirs = findTimes(path(), constant()); if (startFrom == "firstTime") { @@ -324,6 +324,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), // bit less to allow calculations purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), sigWriteNow_(true, *this), @@ -416,6 +417,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), sigWriteNow_(true, *this), @@ -511,6 +513,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), sigWriteNow_(true, *this), @@ -608,6 +611,7 @@ Foam::Time::Time secondaryWriteControl_(wcTimeStep), secondaryWriteInterval_(labelMax/10.0), purgeWrite_(0), + secondaryPurgeWrite_(0), writeOnce_(false), subCycling_(false), @@ -690,13 +694,13 @@ Foam::word Foam::Time::timeName() const // Search the construction path for times Foam::instantList Foam::Time::times() const { - return findTimes(path()); + return findTimes(path(), constant()); } Foam::word Foam::Time::findInstancePath(const instant& t) const { - instantList timeDirs = findTimes(path()); + instantList timeDirs = findTimes(path(), constant()); forAllReverse(timeDirs, timeI) { @@ -712,7 +716,7 @@ Foam::word Foam::Time::findInstancePath(const instant& t) const Foam::instant Foam::Time::findClosestTime(const scalar t) const { - instantList timeDirs = findTimes(path()); + instantList timeDirs = findTimes(path(), constant()); // there is only one time (likely "constant") so return it if (timeDirs.size() == 1) @@ -751,15 +755,16 @@ Foam::instant Foam::Time::findClosestTime(const scalar t) const // // Foam::instant Foam::Time::findClosestTime(const scalar t) const // { -// instantList timeDirs = findTimes(path()); -// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0); +// instantList timeDirs = findTimes(path(), constant()); +// label timeIndex = min(findClosestTimeIndex(timeDirs, t), 0, constant()); // return timeDirs[timeIndex]; // } Foam::label Foam::Time::findClosestTimeIndex ( const instantList& timeDirs, - const scalar t + const scalar t, + const word& constantName ) { label nearestIndex = -1; @@ -767,7 +772,7 @@ Foam::label Foam::Time::findClosestTimeIndex forAll(timeDirs, timeI) { - if (timeDirs[timeI].name() == "constant") continue; + if (timeDirs[timeI].name() == constantName) continue; scalar diff = mag(timeDirs[timeI].value() - t); if (diff < deltaT) @@ -1070,11 +1075,13 @@ Foam::Time& Foam::Time::operator++() outputTime_ = false; + primaryOutputTime_ = false; + secondaryOutputTime_ = false; switch (writeControl_) { case wcTimeStep: - outputTime_ = !(timeIndex_ % label(writeInterval_)); + primaryOutputTime_ = !(timeIndex_ % label(writeInterval_)); break; case wcRunTime: @@ -1088,7 +1095,7 @@ Foam::Time& Foam::Time::operator++() if (outputIndex > outputTimeIndex_) { - outputTime_ = true; + primaryOutputTime_ = true; outputTimeIndex_ = outputIndex; } } @@ -1103,7 +1110,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > outputTimeIndex_) { - outputTime_ = true; + primaryOutputTime_ = true; outputTimeIndex_ = outputIndex; } } @@ -1118,7 +1125,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > outputTimeIndex_) { - outputTime_ = true; + primaryOutputTime_ = true; outputTimeIndex_ = outputIndex; } } @@ -1130,9 +1137,8 @@ Foam::Time& Foam::Time::operator++() switch (secondaryWriteControl_) { case wcTimeStep: - outputTime_ = - outputTime_ - || !(timeIndex_ % label(secondaryWriteInterval_)); + secondaryOutputTime_ = + !(timeIndex_ % label(secondaryWriteInterval_)); break; case wcRunTime: @@ -1146,7 +1152,7 @@ Foam::Time& Foam::Time::operator++() if (outputIndex > secondaryOutputTimeIndex_) { - outputTime_ = true; + secondaryOutputTime_ = true; secondaryOutputTimeIndex_ = outputIndex; } } @@ -1161,7 +1167,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > secondaryOutputTimeIndex_) { - outputTime_ = true; + secondaryOutputTime_ = true; secondaryOutputTimeIndex_ = outputIndex; } } @@ -1176,7 +1182,7 @@ Foam::Time& Foam::Time::operator++() ); if (outputIndex > secondaryOutputTimeIndex_) { - outputTime_ = true; + secondaryOutputTime_ = true; secondaryOutputTimeIndex_ = outputIndex; } } @@ -1184,6 +1190,9 @@ Foam::Time& Foam::Time::operator++() } + outputTime_ = primaryOutputTime_ || secondaryOutputTime_; + + // see if endTime needs adjustment to stop at the next run()/end() check if (!end()) { @@ -1195,6 +1204,7 @@ Foam::Time& Foam::Time::operator++() { endTime_ = value(); outputTime_ = true; + primaryOutputTime_ = true; } else if (stopAt_ == saNextWrite && outputTime_ == true) { @@ -1205,6 +1215,7 @@ Foam::Time& Foam::Time::operator++() // Override outputTime if one-shot writing if (writeOnce_) { + primaryOutputTime_ = true; outputTime_ = true; writeOnce_ = false; } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 26e6b21bc7bbeef91186169940c056d17dc68153..695f666c2e9d08e8a5b3f84023547ef39faee052 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.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 @@ -138,10 +138,15 @@ protected: scalar secondaryWriteInterval_; - label purgeWrite_; mutable FIFOStack<word> previousOutputTimes_; + // Additional purging + + label secondaryPurgeWrite_; + mutable FIFOStack<word> previousSecondaryOutputTimes_; + + // One-shot writing bool writeOnce_; @@ -369,7 +374,12 @@ public: instant findClosestTime(const scalar) const; //- Search instantList for the time index closest to the given time - static label findClosestTimeIndex(const instantList&, const scalar); + static label findClosestTimeIndex + ( + const instantList&, + const scalar, + const word& constantName = "constant" + ); //- Write using given format, version and compression virtual bool writeObject @@ -399,7 +409,11 @@ public: virtual word timeName() const; //- Search a given directory for valid time directories - static instantList findTimes(const fileName&); + static instantList findTimes + ( + const fileName&, + const word& constantName = "constant" + ); //- Return start time index virtual label startTimeIndex() const; diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index 6a80618404ef323e9b9a2d1cfa79fed6fd1e75ae..fc6ac5d723eb46811781aa23c3ace56726644563 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -25,6 +25,7 @@ License #include "Time.H" #include "Pstream.H" +#include "simpleObjectRegistry.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -37,6 +38,92 @@ void Foam::Time::readDict() setEnv("FOAM_APPLICATION", application, false); } + + // Check for local switches and settings + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Debug switches + if (controlDict_.found("DebugSwitches")) + { + simpleObjectRegistry& objects = debug::debugObjects(); + const dictionary& localSettings = controlDict_.subDict("DebugSwitches"); + forAllConstIter(dictionary, localSettings, iter) + { + const word& name = iter().keyword(); + simpleObjectRegistry::iterator fnd = objects.find(name); + if (fnd != objects.end()) + { + Info<< controlDict_.name() << " : overriding debug switch : " + << iter() << endl; + + if (iter().isDict()) + { + OStringStream os(IOstream::ASCII); + os << iter().dict(); + IStringStream is(os.str()); + fnd()->readData(is); + } + else + { + fnd()->readData(iter().stream()); + } + } + } + } + + // Dimension sets + if (controlDict_.found("DimensionSets")) + { + dictionary dict(Foam::dimensionSystems()); + dict.merge(controlDict_.subDict("DimensionSets")); + + simpleObjectRegistry& objects = debug::dimensionSetObjects(); + simpleObjectRegistry::iterator fnd = objects.find("DimensionSets"); + if (fnd != objects.end()) + { + Info<< controlDict_.name() << " : overriding DimensionSets" << endl; + + OStringStream os(IOstream::ASCII); + os << dict; + IStringStream is(os.str()); + fnd()->readData(is); + } + } + + // Optimisation Switches + if (controlDict_.found("OptimisationSwitches")) + { + simpleObjectRegistry& objects = debug::optimisationObjects(); + const dictionary& localSettings = controlDict_.subDict + ( + "OptimisationSwitches" + ); + forAllConstIter(dictionary, localSettings, iter) + { + const word& name = iter().keyword(); + simpleObjectRegistry::iterator fnd = objects.find(name); + if (fnd != objects.end()) + { + Info<< controlDict_.name() + << " : overriding optimisation switch : " << iter() << endl; + + if (iter().isDict()) + { + OStringStream os(IOstream::ASCII); + os << iter().dict(); + IStringStream is(os.str()); + fnd()->readData(is); + } + else + { + fnd()->readData(iter().stream()); + } + } + } + } + + + if (!deltaTchanged_) { deltaT_ = readScalar(controlDict_.lookup("deltaT")); @@ -160,6 +247,20 @@ void Foam::Time::readDict() } } + if (controlDict_.readIfPresent("secondaryPurgeWrite", secondaryPurgeWrite_)) + { + if (secondaryPurgeWrite_ < 0) + { + WarningIn("Time::readDict()") + << "invalid value for secondaryPurgeWrite " + << secondaryPurgeWrite_ + << ", should be >= 0, setting to 0" + << endl; + + secondaryPurgeWrite_ = 0; + } + } + if (controlDict_.found("timeFormat")) { const word formatName(controlDict_.lookup("timeFormat")); @@ -347,13 +448,45 @@ bool Foam::Time::writeObject timeDict.regIOobject::writeObject(fmt, ver, cmp); bool writeOK = objectRegistry::writeObject(fmt, ver, cmp); - if (writeOK && purgeWrite_) + if (writeOK) { - previousOutputTimes_.push(tmName); + // Does primary or secondary time trigger purging? + // Note that primary times can only be purged by primary + // purging. Secondary times can be purged by either primary + // or secondary purging. + if (primaryOutputTime_ && purgeWrite_) + { + previousOutputTimes_.push(tmName); - while (previousOutputTimes_.size() > purgeWrite_) + while (previousOutputTimes_.size() > purgeWrite_) + { + rmDir(objectRegistry::path(previousOutputTimes_.pop())); + } + } + if + ( + !primaryOutputTime_ + && secondaryOutputTime_ + && secondaryPurgeWrite_ + ) { - rmDir(objectRegistry::path(previousOutputTimes_.pop())); + // Writing due to secondary + previousSecondaryOutputTimes_.push(tmName); + + while + ( + previousSecondaryOutputTimes_.size() + > secondaryPurgeWrite_ + ) + { + rmDir + ( + objectRegistry::path + ( + previousSecondaryOutputTimes_.pop() + ) + ); + } } } @@ -368,6 +501,7 @@ bool Foam::Time::writeObject bool Foam::Time::writeNow() { + primaryOutputTime_ = true; outputTime_ = true; return write(); } diff --git a/src/OpenFOAM/db/Time/TimeState.C b/src/OpenFOAM/db/Time/TimeState.C index 500ca47d43ffb35c6d761886b1741dfd8dc6bf6e..f3e37401076380ceea06cc3220d24e25115f1a18 100644 --- a/src/OpenFOAM/db/Time/TimeState.C +++ b/src/OpenFOAM/db/Time/TimeState.C @@ -37,7 +37,9 @@ Foam::TimeState::TimeState() deltaT0_(0), deltaTchanged_(false), outputTimeIndex_(0), + primaryOutputTime_(false), secondaryOutputTimeIndex_(0), + secondaryOutputTime_(false), outputTime_(false) {} diff --git a/src/OpenFOAM/db/Time/TimeState.H b/src/OpenFOAM/db/Time/TimeState.H index d721529480ea79ce2de2b9f4cca74875ea11502b..b055d439f0f8389c8f4183d84e7259ef4040f2f1 100644 --- a/src/OpenFOAM/db/Time/TimeState.H +++ b/src/OpenFOAM/db/Time/TimeState.H @@ -61,8 +61,14 @@ protected: bool deltaTchanged_; label outputTimeIndex_; + //- Is outputTime because of primary? + bool primaryOutputTime_; + label secondaryOutputTimeIndex_; - bool outputTime_; + //- Is outputTime because of secondary? + bool secondaryOutputTime_; + + bool outputTime_; public: @@ -112,7 +118,7 @@ public: // Check - //- Return true if this is an output time + //- Return true if this is an output time (primary or secondary) bool outputTime() const; }; diff --git a/src/OpenFOAM/db/Time/findInstance.C b/src/OpenFOAM/db/Time/findInstance.C index 54d64fcf4c95167acbf7fab8e7edfb6694064160..556de4c98b52e8262a44b9cfec691b10b0b103d3 100644 --- a/src/OpenFOAM/db/Time/findInstance.C +++ b/src/OpenFOAM/db/Time/findInstance.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 @@ -132,15 +132,30 @@ Foam::word Foam::Time::findInstance || rOpt == IOobject::MUST_READ_IF_MODIFIED ) { - FatalErrorIn - ( - "Time::findInstance" - "(const fileName&, const word&" - ", const IOobject::readOption, const word&)" - ) << "Cannot find file \"" << name << "\" in directory " - << dir << " in times " << timeName() - << " down to " << stopInstance - << exit(FatalError); + if (name.empty()) + { + FatalErrorIn + ( + "Time::findInstance" + "(const fileName&, const word&" + ", const IOobject::readOption, const word&)" + ) << "Cannot find directory " + << dir << " in times " << timeName() + << " down to " << stopInstance + << exit(FatalError); + } + else + { + FatalErrorIn + ( + "Time::findInstance" + "(const fileName&, const word&" + ", const IOobject::readOption, const word&)" + ) << "Cannot find file \"" << name << "\" in directory " + << dir << " in times " << timeName() + << " down to " << stopInstance + << exit(FatalError); + } } return ts[instanceI].name(); diff --git a/src/OpenFOAM/db/Time/findTimes.C b/src/OpenFOAM/db/Time/findTimes.C index 87b3669fd6bd89ed0107995fd4133ea40f2dda9d..3384916737a8374d012ad20c9c529ac3742cb570 100644 --- a/src/OpenFOAM/db/Time/findTimes.C +++ b/src/OpenFOAM/db/Time/findTimes.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 @@ -34,7 +34,11 @@ Description // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::instantList Foam::Time::findTimes(const fileName& directory) +Foam::instantList Foam::Time::findTimes +( + const fileName& directory, + const word& constantName +) { if (debug) { @@ -53,7 +57,7 @@ Foam::instantList Foam::Time::findTimes(const fileName& directory) bool haveConstant = false; forAll(dirEntries, i) { - if (dirEntries[i] == "constant") + if (dirEntries[i] == constantName) { Times[nTimes].value() = 0; Times[nTimes].name() = dirEntries[i]; diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C index 60b589a347478408fc08fbb026f468da0e6db971..7a8bcc5eb4efecceee540aeec5e597c4d5c27a7e 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -155,7 +155,8 @@ void Foam::timeSelector::addOptions Foam::List<Foam::instant> Foam::timeSelector::select ( const instantList& timeDirs, - const argList& args + const argList& args, + const word& constantName ) { if (timeDirs.size()) @@ -168,7 +169,7 @@ Foam::List<Foam::instant> Foam::timeSelector::select forAll(timeDirs, timeI) { - if (timeDirs[timeI].name() == "constant") + if (timeDirs[timeI].name() == constantName) { constantIdx = timeI; } @@ -250,7 +251,12 @@ Foam::List<Foam::instant> Foam::timeSelector::select0 const argList& args ) { - instantList timeDirs = timeSelector::select(runTime.times(), args); + instantList timeDirs = timeSelector::select + ( + runTime.times(), + args, + runTime.constant() + ); if (timeDirs.empty()) { diff --git a/src/OpenFOAM/db/Time/timeSelector.H b/src/OpenFOAM/db/Time/timeSelector.H index 88255cac0695c27523474e01399bf09587d1772c..ce22d83fcea5f3e1328370658ebfe22481683a32 100644 --- a/src/OpenFOAM/db/Time/timeSelector.H +++ b/src/OpenFOAM/db/Time/timeSelector.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 @@ -138,7 +138,8 @@ public: static instantList select ( const instantList&, - const argList& args + const argList& args, + const word& constantName = "constant" ); //- Return the set of times selected based on the argList options diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 295749ea4c87ace3910dd5cfa1d11b5c650cfcd0..e6f7c6c7db97f12fdda697c04890cf4f1b684f59 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -31,9 +31,11 @@ License /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ -defineTypeNameAndDebug(Foam::dictionary, 0); - -const Foam::dictionary Foam::dictionary::null; +namespace Foam +{ +defineTypeNameAndDebug(dictionary, 0); +const dictionary dictionary::null; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -424,38 +426,87 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr bool patternMatch ) const { - string::size_type dotPos = keyword.find('.'); - - if (dotPos == string::npos) + if (keyword[0] == ':') { - return lookupEntryPtr(keyword, recursive, patternMatch); + // Go up to top level + const dictionary* dictPtr = this; + while (&dictPtr->parent_ != &dictionary::null) + { + dictPtr = &dictPtr->parent_; + } + + // At top. Recurse to find entries + return dictPtr->lookupScopedEntryPtr + ( + keyword.substr(1, keyword.size()-1), + false, + patternMatch + ); } else { - if (dotPos == 0) - { - const dictionary* dictPtr = this; - while (&dictPtr->parent_ != &dictionary::null) - { - dictPtr = &dictPtr->parent_; - } + string::size_type dotPos = keyword.find('.'); - // At top - return dictPtr->lookupScopedEntryPtr - ( - keyword.substr(1, keyword.size()-1), - false, - patternMatch - ); + if (dotPos == string::npos) + { + // Non-scoped lookup + return lookupEntryPtr(keyword, recursive, patternMatch); } else { - wordList entryNames(fileName(keyword).components('.')); + if (dotPos == 0) + { + // Starting with a '.'. Go up for every 2nd '.' found + + const dictionary* dictPtr = this; - const entry* entPtr = lookupEntryPtr(entryNames[0], false, true); + string::size_type begVar = dotPos + 1; + string::const_iterator iter = keyword.begin() + begVar; + string::size_type endVar = begVar; + while + ( + iter != keyword.end() + && *iter == '.' + ) + { + ++iter; + ++endVar; + + // Go to parent + if (&dictPtr->parent_ == &dictionary::null) + { + FatalIOErrorIn + ( + "dictionary::lookupScopedEntryPtr" + "(const word&, bool, bool)", + *this + ) << "No parent of current dictionary" + << " when searching for " + << keyword.substr(begVar, keyword.size()-begVar) + << exit(FatalIOError); + } + dictPtr = &dictPtr->parent_; + } - for (int i=1; i<entryNames.size(); ++i) + return dictPtr->lookupScopedEntryPtr + ( + keyword.substr(endVar), + false, + patternMatch + ); + } + else { + // Extract the first word + word firstWord = keyword.substr(0, dotPos); + + const entry* entPtr = lookupScopedEntryPtr + ( + firstWord, + false, //recursive + patternMatch + ); + if (!entPtr) { FatalIOErrorIn @@ -463,46 +514,27 @@ const Foam::entry* Foam::dictionary::lookupScopedEntryPtr "dictionary::lookupScopedEntryPtr" "(const word&, bool, bool)", *this - ) << "keyword " << keyword + ) << "keyword " << firstWord << " is undefined in dictionary " << name() << endl << "Valid keywords are " << keys() << exit(FatalIOError); } - if (!entPtr->isDict()) + + if (entPtr->isDict()) { - FatalIOErrorIn + return entPtr->dict().lookupScopedEntryPtr ( - "dictionary::lookupScopedEntryPtr" - "(const word&, bool, bool)", - *this - ) << "Entry " << entPtr->name() - << " is not a dictionary so cannot lookup sub entry " - << entryNames[i] - << exit(FatalIOError); + keyword.substr(dotPos, keyword.size()-dotPos), + false, + patternMatch + ); + } + else + { + return NULL; } - - entPtr = entPtr->dict().lookupEntryPtr - ( - entryNames[i], - false, - true - ); - } - - if (!entPtr) - { - FatalIOErrorIn - ( - "dictionary::lookupScopedEntryPtr" - "(const word&, bool, bool)", - *this - ) << "keyword " << keyword - << " is not a valid scoped entry in dictionary " - << name() - << exit(FatalIOError); } - return entPtr; } } } diff --git a/src/OpenFOAM/db/dictionary/entry/entryIO.C b/src/OpenFOAM/db/dictionary/entry/entryIO.C index c958b8f94961999611ed53e64edc63395107c1e0..bc0ffb9c09bbb0cc068072180ee72282bac25b1a 100644 --- a/src/OpenFOAM/db/dictionary/entry/entryIO.C +++ b/src/OpenFOAM/db/dictionary/entry/entryIO.C @@ -117,11 +117,12 @@ bool Foam::entry::New(dictionary& parentDict, Istream& is) if (keyword.size() > 2 && keyword[1] == token::BEGIN_BLOCK) { // Recursive substitution mode. Replace between {} with - // expansion. + // expansion and then let standard variable expansion deal + // with rest. string s(keyword(2, keyword.size()-3)); - // Substitute dictionary and environment variables. Allow + // Substitute dictionary and environment variables. Do not allow // empty substitutions. - stringOps::inplaceExpand(s, parentDict, true, true); + stringOps::inplaceExpand(s, parentDict, true, false); keyword.std::string::replace(1, keyword.size()-1, s); } parentDict.substituteScopedKeyword(keyword); diff --git a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C index 0566b8f350463d8cf0873f8c3c831a5156f10aad..779709e4a06b326abd2bc549e05045e79615adbc 100644 --- a/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C +++ b/src/OpenFOAM/db/dictionary/primitiveEntry/primitiveEntry.C @@ -47,13 +47,11 @@ bool Foam::primitiveEntry::expandVariable { if (w.size() > 2 && w[0] == '$' && w[1] == token::BEGIN_BLOCK) { - // Recursive substitution mode. Replace between {} with - // expansion. + // Recursive substitution mode. Replace between {} with expansion. string s(w(2, w.size()-3)); - // Substitute dictionary and environment variables. Allow + // Substitute dictionary and environment variables. Do not allow // empty substitutions. - stringOps::inplaceExpand(s, dict, true, true); - + stringOps::inplaceExpand(s, dict, true, false); string newW(w); newW.std::string::replace(1, newW.size()-1, s); @@ -83,6 +81,15 @@ bool Foam::primitiveEntry::expandVariable if (envStr.empty()) { + FatalIOErrorIn + ( + "primitiveEntry::expandVariable" + "(const string&, const dictionary&", + dict + ) << "Illegal dictionary entry or environment variable name " + << varName << endl << "Valid dictionary entries are " + << dict.toc() << exit(FatalIOError); + return false; } append(tokenList(IStringStream('(' + envStr + ')')())); diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index 48bc178ac6a3749157d7bc35c925ba02ffaa45fa..43229b18fd2ffe9b6eb92f9efa063b882e43dd42 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::dlLibraryTable, 0); +namespace Foam +{ +defineTypeNameAndDebug(dlLibraryTable, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.C b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.C index 92991b1b1d0b9378b1026608d4fc149e27c731df..18b46f29af8e445d94ac97faf68c950e9f305792 100644 --- a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.C +++ b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.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 @@ -46,7 +46,7 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter ( const word& outputFilterName, const objectRegistry& obr, - const fileName& dictName, + const word& dictName, const IOobject::readOption rOpt, const bool readFromFiles ) @@ -66,6 +66,30 @@ Foam::IOOutputFilter<OutputFilter>::IOOutputFilter {} +template<class OutputFilter> +Foam::IOOutputFilter<OutputFilter>::IOOutputFilter +( + const word& outputFilterName, + const objectRegistry& obr, + const fileName& dictName, + const IOobject::readOption rOpt, + const bool readFromFiles +) +: + IOdictionary + ( + IOobject + ( + dictName, + obr, + rOpt, + IOobject::NO_WRITE + ) + ), + OutputFilter(outputFilterName, obr, *this, readFromFiles) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class OutputFilter> diff --git a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H index ebddc142cb2fb17d4422e5d8e7b785ea328a922a..ab8872798af9cff3aa94b9caec2741fe1fd3afbc 100644 --- a/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.H +++ b/src/OpenFOAM/db/functionObjects/IOOutputFilter/IOOutputFilter.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 @@ -89,7 +89,19 @@ public: ( const word& outputFilterName, const objectRegistry&, - const fileName& dictName = OutputFilter::typeName() + "Dict", + const word& dictName = OutputFilter::typeName() + "Dict", + const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED, + const bool loadFromFile = false + ); + + //- Construct for given objectRegistry and dictionary + // Dictionary read from full path. + // Allow the possibility to load fields from files + IOOutputFilter + ( + const word& outputFilterName, + const objectRegistry&, + const fileName& dictName, const IOobject::readOption rOpt = IOobject::MUST_READ_IF_MODIFIED, const bool loadFromFile = false ); @@ -121,10 +133,10 @@ public: } //- Update for changes of mesh - virtual void movePoints(const pointField& points) + virtual void movePoints(const polyMesh& mesh) { read(); - OutputFilter::movePoints(points); + OutputFilter::movePoints(mesh); } }; diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index 86a28677778d1ae1da2cfaae27fe8f510791474e..bd4d0b3d618931ffb4b2acfb0910084dac79858a 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.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 "OutputFilterFunctionObject.H" #include "IOOutputFilter.H" #include "polyMesh.H" +#include "mapPolyMesh.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * Private Members * * * * * * * * * * * * * * // @@ -221,4 +222,30 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::read } +template<class OutputFilter> +void Foam::OutputFilterFunctionObject<OutputFilter>::updateMesh +( + const mapPolyMesh& mpm +) +{ + if (active() && mpm.mesh().name() == regionName_) + { + ptr_->updateMesh(mpm); + } +} + + +template<class OutputFilter> +void Foam::OutputFilterFunctionObject<OutputFilter>::movePoints +( + const polyMesh& mesh +) +{ + if (active() && mesh.name() == regionName_) + { + ptr_->movePoints(mesh); + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index 0b264cb80602e7ba5877a9b973b9d7972a385c3a..87ade4b2824afbe9d366f03c9b51c115a38a59d9 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.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 @@ -204,6 +204,12 @@ public: //- Read and set the function object if its data have changed virtual bool read(const dictionary&); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh& mpm); + + //- Update for changes of mesh + virtual void movePoints(const polyMesh& mesh); }; diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index c67b51ce8224e014ab6e8aa8f285249d8ed96e9e..2e67818359d979413f71b50e8be58be676787579 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.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 @@ -30,8 +30,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineRunTimeSelectionTable(Foam::functionObject, dictionary); -int Foam::functionObject::debug(Foam::debug::debugSwitch("functionObject", 0)); +namespace Foam +{ +defineDebugSwitchWithName(functionObject, "functionObject", 0); +defineRunTimeSelectionTable(functionObject, dictionary); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index a9a026ea885e7a1f54a92b7af5737c3a830043a8..a7c027b5b3b617c23d3e2a090fcfb48dfb371064 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.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 @@ -49,6 +49,8 @@ namespace Foam // Forward declaration of classes class Time; +class polyMesh; +class mapPolyMesh; /*---------------------------------------------------------------------------*\ Class functionObject Declaration @@ -157,6 +159,12 @@ public: //- Read and set the function object if its data have changed virtual bool read(const dictionary&) = 0; + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh& mpm) = 0; + + //- Update for changes of mesh + virtual void movePoints(const polyMesh& mesh) = 0; }; diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C index 19fb67d4e38917a6579109e2dda04e0a38d9abc8..ffad0cc4e6b2e39f7ef494c79ff22aec139fee9a 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.C @@ -168,7 +168,7 @@ Foam::functionObjectFile::functionObjectFile names_.insert(name); filePtrs_.clear(); - filePtrs_.setSize(names_.toc().size()); + filePtrs_.setSize(1); // cannot create files - need to access virtual function } @@ -193,7 +193,7 @@ Foam::functionObjectFile::functionObjectFile names_.insert(names); filePtrs_.clear(); - filePtrs_.setSize(names_.toc().size()); + filePtrs_.setSize(names_.size()); // cannot create files - need to access virtual function } diff --git a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H index 8710b92b7ae2ceb9ff019721e11875517e5a6a73..f4c0ab11782e45dad3424bac6f13e14d77db7efa 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectFile/functionObjectFile.H @@ -64,7 +64,7 @@ private: const objectRegistry& obr_; //- Prefix - const word& prefix_; + const word prefix_; //- File names wordHashSet names_; diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 22d6d4609708abebd77a26d0e135cee386b180ce..799e4b626ebb9fca4903238db7d8de119401ccd7 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.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,11 +25,15 @@ License #include "functionObjectList.H" #include "Time.H" +#include "mapPolyMesh.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // -Foam::functionObject* -Foam::functionObjectList::remove(const word& key, label& oldIndex) +Foam::functionObject* Foam::functionObjectList::remove +( + const word& key, + label& oldIndex +) { functionObject* ptr = 0; @@ -319,4 +323,28 @@ bool Foam::functionObjectList::read() } +void Foam::functionObjectList::updateMesh(const mapPolyMesh& mpm) +{ + if (execution_) + { + forAll(*this, objectI) + { + operator[](objectI).updateMesh(mpm); + } + } +} + + +void Foam::functionObjectList::movePoints(const polyMesh& mesh) +{ + if (execution_) + { + forAll(*this, objectI) + { + operator[](objectI).movePoints(mesh); + } + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H index 2f6e0a9f938197cf64cb1b9b2f6d9d25c7b217d9..923e8501a4290314527f8ed267826229f66e790e 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.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 @@ -49,6 +49,8 @@ SourceFiles namespace Foam { +class mapPolyMesh; + /*---------------------------------------------------------------------------*\ Class functionObjectList Declaration \*---------------------------------------------------------------------------*/ @@ -163,6 +165,12 @@ public: //- Read and set the function objects if their data have changed virtual bool read(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh& mpm); + + //- Update for changes of mesh + virtual void movePoints(const polyMesh& mesh); }; diff --git a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C index 34b9da0da1b77341e41ee5e77413466a26a5e774..e282ff8c21575d56d3e1f40c219e1652a98380c2 100644 --- a/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.C +++ b/src/OpenFOAM/db/functionObjects/outputFilterOutputControl/outputFilterOutputControl.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 @@ -30,11 +30,8 @@ License namespace Foam { template<> - const char* Foam::NamedEnum - < - Foam::outputFilterOutputControl::outputControls, - 2 - >::names[] = + const char* NamedEnum<outputFilterOutputControl::outputControls, 2>:: + names[] = { "timeStep", "outputTime" diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.C b/src/OpenFOAM/db/objectRegistry/objectRegistry.C index 09307c3a5ce20194f5822e604829133d65748826..4903ca4e285148524d81c69fd9e8fe637a7ccc51 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.C @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::objectRegistry, 0); +namespace Foam +{ +defineTypeNameAndDebug(objectRegistry, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/regIOobject/regIOobject.C b/src/OpenFOAM/db/regIOobject/regIOobject.C index 5d8d9972e2900ed844d32e23428b3b67f5a8f09d..3522f1aebd7944a28a68e3dac82f3a2f7acd51fc 100644 --- a/src/OpenFOAM/db/regIOobject/regIOobject.C +++ b/src/OpenFOAM/db/regIOobject/regIOobject.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 @@ -29,19 +29,26 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::regIOobject, 0); - -int Foam::regIOobject::fileModificationSkew -( - Foam::debug::optimisationSwitch("fileModificationSkew", 30) -); - namespace Foam { + defineTypeNameAndDebug(regIOobject, 0); + + int regIOobject::fileModificationSkew + ( + debug::optimisationSwitch("fileModificationSkew", 30) + ); + registerOptSwitchWithName + ( + Foam::regIOobject::fileModificationSkew, + fileModificationSkew, + "fileModificationSkew" + ); + + template<> - const char* Foam::NamedEnum + const char* NamedEnum < - Foam::regIOobject::fileCheckTypes, + regIOobject::fileCheckTypes, 4 >::names[] = { @@ -67,6 +74,35 @@ Foam::regIOobject::fileCheckTypes Foam::regIOobject::fileModificationChecking ) ) ); +// Register re-reader +class addfileModificationCheckingToOpt +: + public ::Foam::simpleRegIOobject +{ +public: + addfileModificationCheckingToOpt(const char* name) + : + ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject, name) + {} + virtual ~addfileModificationCheckingToOpt() + {} + virtual void readData(Foam::Istream& is) + { + Foam::regIOobject::fileModificationChecking = + Foam::regIOobject::fileCheckTypesNames.read(is); + } + virtual void writeData(Foam::Ostream& os) const + { + os << Foam::regIOobject::fileCheckTypesNames + [ + Foam::regIOobject::fileModificationChecking + ]; + } +}; +addfileModificationCheckingToOpt addfileModificationCheckingToOpt_ +( + "fileModificationChecking" +); bool Foam::regIOobject::masterOnlyReading = false; diff --git a/src/OpenFOAM/db/typeInfo/className.H b/src/OpenFOAM/db/typeInfo/className.H index fa1f4bfdb65aae8cf92d2b07ae2716abf7d82526..cc0342e15d7a6310db7b68cf1da3ae6df89e1f2f 100644 --- a/src/OpenFOAM/db/typeInfo/className.H +++ b/src/OpenFOAM/db/typeInfo/className.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 @@ -31,6 +31,7 @@ Description #include "word.H" #include "debug.H" +#include "debugName.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -133,60 +134,6 @@ public: \ -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// definitions (debug information only) -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - -//- Define the debug information, lookup as \a Name -#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \ - int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch)) - -//- Define the debug information -#define defineDebugSwitch(Type, DebugSwitch) \ - defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch) - -#ifdef __INTEL_COMPILER -//- Define the debug information for templates, lookup as \a Name -# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ - defineDebugSwitchWithName(Type, Name, DebugSwitch) -//- Define the debug information for templates sub-classes, lookup as \a Name -# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ - defineDebugSwitchWithName(Type, Name, DebugSwitch) -#else -//- Define the debug information for templates, lookup as \a Name -# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ - template<> \ - defineDebugSwitchWithName(Type, Name, DebugSwitch) -//- Define the debug information for templates sub-classes, lookup as \a Name -# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ - template<> \ - defineDebugSwitchWithName(Type, Name, DebugSwitch) -#endif - -//- Define the debug information for templates -// Useful with typedefs -#define defineTemplateDebugSwitch(Type, DebugSwitch) \ - defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch) - -//- Define the debug information directly for templates -#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \ - defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch) - - -// for templated sub-classes - -//- Define the debug information for templates -// Useful with typedefs -#define defineTemplate2DebugSwitch(Type, DebugSwitch) \ - defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch) - -//- Define the debug information directly for templates -#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \ - defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch) - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // definitions (with debug information) // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/OpenFOAM/db/typeInfo/debugName.H b/src/OpenFOAM/db/typeInfo/debugName.H new file mode 100644 index 0000000000000000000000000000000000000000..2277945ed4dcb2eb9eca8e984d03c064846806e7 --- /dev/null +++ b/src/OpenFOAM/db/typeInfo/debugName.H @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Description + Macro definitions for debug symbols etc. + +\*---------------------------------------------------------------------------*/ + +#ifndef debugName_H +#define debugName_H + +#include "simpleRegIOobject.H" +#include "word.H" +#include "debug.H" +#include "label.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// definitions (debug information only) +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +//- Define the debug information, lookup as \a Name +#define registerDebugSwitchWithName(Type,Tag,Name) \ + class add##Tag##ToDebug \ + : \ + public ::Foam::simpleRegIOobject \ + { \ + public: \ + add##Tag##ToDebug(const char* name) \ + : \ + ::Foam::simpleRegIOobject(Foam::debug::addDebugObject, name) \ + {} \ + virtual ~add##Tag##ToDebug() \ + {} \ + virtual void readData(Foam::Istream& is) \ + { \ + Type::debug = readLabel(is); \ + } \ + virtual void writeData(Foam::Ostream& os) const \ + { \ + os << Type::debug; \ + } \ + }; \ + add##Tag##ToDebug add##Tag##ToDebug_(Name) + + +//- Register info switch (if int), lookup as \a Name +#define registerInfoSwitchWithName(Switch,Tag,Name) \ + class add##Tag##ToInfo \ + : \ + public ::Foam::simpleRegIOobject \ + { \ + public: \ + add##Tag##ToInfo(const char* name) \ + : \ + ::Foam::simpleRegIOobject(Foam::debug::addInfoObject, name) \ + {} \ + virtual ~add##Tag##ToInfo() \ + {} \ + virtual void readData(Foam::Istream& is) \ + { \ + Switch = readLabel(is); \ + } \ + virtual void writeData(Foam::Ostream& os) const \ + { \ + os << Switch; \ + } \ + }; \ + add##Tag##ToInfo add##Tag##ToInfo_(Name) + + +//- Register optimisation switch (if int), lookup as \a Name +#define registerOptSwitchWithName(Switch,Tag,Name) \ + class add##Tag##ToOpt \ + : \ + public ::Foam::simpleRegIOobject \ + { \ + public: \ + add##Tag##ToOpt(const char* name) \ + : \ + ::Foam::simpleRegIOobject(Foam::debug::addOptimisationObject,name)\ + {} \ + virtual ~add##Tag##ToOpt() \ + {} \ + virtual void readData(Foam::Istream& is) \ + { \ + Switch = readLabel(is); \ + } \ + virtual void writeData(Foam::Ostream& os) const \ + { \ + os << Switch; \ + } \ + }; \ + add##Tag##ToOpt add##Tag##ToOpt_(Name) + + +//- Define the debug information, lookup as \a Name +#define defineDebugSwitchWithName(Type, Name, DebugSwitch) \ + int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch)) + +//- Define the debug information +#define defineDebugSwitch(Type, DebugSwitch) \ + defineDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch); \ + registerDebugSwitchWithName(Type, Type, Type::typeName_()) + +#ifdef __INTEL_COMPILER +//- Define the debug information for templates, lookup as \a Name +# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ + defineDebugSwitchWithName(Type, Name, DebugSwitch) +//- Define the debug information for templates sub-classes, lookup as \a Name +# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ + defineDebugSwitchWithName(Type, Name, DebugSwitch) +#else +//- Define the debug information for templates, lookup as \a Name +# define defineTemplateDebugSwitchWithName(Type, Name, DebugSwitch) \ + template<> \ + defineDebugSwitchWithName(Type, Name, DebugSwitch) +//- Define the debug information for templates sub-classes, lookup as \a Name +# define defineTemplate2DebugSwitchWithName(Type, Name, DebugSwitch) \ + template<> \ + defineDebugSwitchWithName(Type, Name, DebugSwitch) +#endif + +//- Define the debug information for templates +// Useful with typedefs +#define defineTemplateDebugSwitch(Type, DebugSwitch) \ + defineTemplateDebugSwitchWithName(Type, #Type, DebugSwitch) + +//- Define the debug information directly for templates +#define defineNamedTemplateDebugSwitch(Type, DebugSwitch) \ + defineTemplateDebugSwitchWithName(Type, Type::typeName_(), DebugSwitch) + + +// for templated sub-classes + +//- Define the debug information for templates +// Useful with typedefs +#define defineTemplate2DebugSwitch(Type, DebugSwitch) \ + defineTemplate2DebugSwitchWithName(Type, #Type, DebugSwitch) + +//- Define the debug information directly for templates +#define defineNamedTemplate2DebugSwitch(Type, DebugSwitch) \ + defineTemplate2DebugSwitchWithName(Type, Type::typeName_(), DebugSwitch) + + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.C b/src/OpenFOAM/dimensionSet/dimensionSet.C index c0da41236e90a9d9dfc3448a52e64dc4bc4679f7..eb13cdf60b124dc91725a328e5162a014754f300 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.C +++ b/src/OpenFOAM/dimensionSet/dimensionSet.C @@ -29,8 +29,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::dimensionSet, 1); -const Foam::scalar Foam::dimensionSet::smallExponent = SMALL; +namespace Foam +{ +defineTypeNameAndDebug(dimensionSet, 1); +const scalar dimensionSet::smallExponent = SMALL; +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -372,6 +375,12 @@ Foam::dimensionSet Foam::sqrt(const dimensionSet& ds) } +Foam::dimensionSet Foam::cbrt(const dimensionSet& ds) +{ + return pow(ds, 1.0/3.0); +} + + Foam::dimensionSet Foam::magSqr(const dimensionSet& ds) { return pow(ds, 2); diff --git a/src/OpenFOAM/dimensionSet/dimensionSet.H b/src/OpenFOAM/dimensionSet/dimensionSet.H index ca4c3ed2d156a42d3e1f0e725be7dee345dd1610..6dc1219562576df112bed64f8f1788068311448e 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSet.H +++ b/src/OpenFOAM/dimensionSet/dimensionSet.H @@ -76,6 +76,7 @@ dimensionSet pow6(const dimensionSet&); dimensionSet pow025(const dimensionSet&); dimensionSet sqrt(const dimensionSet&); +dimensionSet cbrt(const dimensionSet&); dimensionSet magSqr(const dimensionSet&); dimensionSet mag(const dimensionSet&); dimensionSet sign(const dimensionSet&); diff --git a/src/OpenFOAM/dimensionSet/dimensionSets.C b/src/OpenFOAM/dimensionSet/dimensionSets.C index 474be101814c2bf0e8a10fdebde9403246529011..7486781df8a08ee5a0cfe30cdf8f1af628b9ac69 100644 --- a/src/OpenFOAM/dimensionSet/dimensionSets.C +++ b/src/OpenFOAM/dimensionSet/dimensionSets.C @@ -25,13 +25,15 @@ License #include "dimensionSet.H" #include "dimensionedScalar.H" +#include "simpleRegIOobject.H" +#include "demandDrivenData.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ dictionary* dimensionSystemsPtr_(NULL); @@ -45,11 +47,35 @@ dictionary& dimensionSystems() } -/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ - autoPtr<HashTable<dimensionedScalar> > unitSetPtr_; autoPtr<dimensionSets> writeUnitSetPtr_; +class addDimensionSetsToDebug +: + public ::Foam::simpleRegIOobject +{ +public: + addDimensionSetsToDebug(const char* name) + : + ::Foam::simpleRegIOobject(Foam::debug::addDimensionSetObject, name) + {} + virtual ~addDimensionSetsToDebug() + {} + virtual void readData(Foam::Istream& is) + { + deleteDemandDrivenData(dimensionSystemsPtr_); + unitSetPtr_.clear(); + writeUnitSetPtr_.clear(); + dimensionSystemsPtr_ = new dictionary(is); + } + virtual void writeData(Foam::Ostream& os) const + { + os << dimensionSystems(); + } +}; +addDimensionSetsToDebug addDimensionSetsToDebug_("DimensionSets"); + + const HashTable<dimensionedScalar>& unitSet() { diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C index 14e1030b4bbade6f76bf7d7b08b8d952d41a489d..a4296ff91b648c2a412bd8c6224b731af47b6466 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.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 @@ -377,6 +377,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.H index 5c4a2b217a26e57b5d5e6601e7fcd8eb9b4c2008..b6e76631e0402b9e68996c61d75e30b8b2451105 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedScalarField/DimensionedScalarField.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 @@ -85,6 +85,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C index bf585298282a0d0058a18b766c2e42645375f24d..4132ba79f3c20d2e7ad4cc83dfbf4551b12015f3 100644 --- a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.C +++ b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.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 @@ -105,6 +105,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.H b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.H index f2c851c0cdf1bcb4c9f8ce2ad9129b02b3909b00..f6fcc4c901aab737f50e5465930bb587b209bbe6 100644 --- a/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.H +++ b/src/OpenFOAM/fields/FieldFields/scalarFieldField/scalarFieldField.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 @@ -98,6 +98,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/Fields/fieldTypes.H b/src/OpenFOAM/fields/Fields/fieldTypes.H index f0f27039dccd87ad1d551b9b67f3f1f34a5494f9..855093035793e29816d44c997e68f4655b6b02fc 100644 --- a/src/OpenFOAM/fields/Fields/fieldTypes.H +++ b/src/OpenFOAM/fields/Fields/fieldTypes.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 @@ -36,6 +36,7 @@ Description #include "sphericalTensor.H" #include "symmTensor.H" #include "tensor.H" +#include "triad.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C index cd1859226525d9a6fa2d51e15c370baf40d0962e..96e41d9571b52fa074b7761241c3ac2f1893f19c 100644 --- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.C +++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.C @@ -128,6 +128,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H index d5a3b7659bf1e20af4bf7e151187eebca3218190..ff322d3fe416d07ecfa4261f36c326bda25eed78 100644 --- a/src/OpenFOAM/fields/Fields/scalarField/scalarField.H +++ b/src/OpenFOAM/fields/Fields/scalarField/scalarField.H @@ -103,6 +103,7 @@ UNARY_FUNCTION(scalar, scalar, pow5) UNARY_FUNCTION(scalar, scalar, pow6) UNARY_FUNCTION(scalar, scalar, pow025) UNARY_FUNCTION(scalar, scalar, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt) UNARY_FUNCTION(scalar, scalar, sign) UNARY_FUNCTION(scalar, scalar, pos) UNARY_FUNCTION(scalar, scalar, neg) diff --git a/src/OpenFOAM/fields/Fields/triadField/triadField.C b/src/OpenFOAM/fields/Fields/triadField/triadField.C new file mode 100644 index 0000000000000000000000000000000000000000..87fa7d8dd29adb60515c2b9985ef95154d6542ac --- /dev/null +++ b/src/OpenFOAM/fields/Fields/triadField/triadField.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "triadField.H" +#include "transformField.H" + +#define TEMPLATE +#include "FieldFunctionsM.C" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "undefFieldFunctionsM.H" + +// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.H b/src/OpenFOAM/fields/Fields/triadField/triadField.H similarity index 74% rename from applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.H rename to src/OpenFOAM/fields/Fields/triadField/triadField.H index cf8a13d48032a5d6e93e85b90f2db03ab031db07..53ba1f37d3405b2580b93098584c0827f5c29f4d 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/SetPatchFields.H +++ b/src/OpenFOAM/fields/Fields/triadField/triadField.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 @@ -21,43 +21,40 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Global - Foam::SetPatchFields +Typedef + Foam::triadField Description - Helper routine to initialise a patch field to a constant value + Specialisation of Field\<T\> for triad. SourceFiles - SetPatchFields.C + triadField.C \*---------------------------------------------------------------------------*/ -#ifndef SetPatchFields_H -#define SetPatchFields_H +#ifndef triadField_H +#define triadField_H -#include "PtrList.H" +#include "Field.H" +#include "triad.H" + +#define TEMPLATE +#include "FieldFunctionsM.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -//- Helper routine to read fields -template<class GeoField> -void SetPatchFields -( - PtrList<GeoField>& fields, - const label patchI, - const typename GeoField::value_type& initVal -); +typedef Field<triad> triadField; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "SetPatchFields.C" -#endif +#include "undefFieldFunctionsM.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/fields/Fields/triadField/triadIOField.C b/src/OpenFOAM/fields/Fields/triadField/triadIOField.C new file mode 100644 index 0000000000000000000000000000000000000000..01b2e526c6a2c1e21959f709072cf7f7ff569c64 --- /dev/null +++ b/src/OpenFOAM/fields/Fields/triadField/triadIOField.C @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Description + triadField with IO. + +\*---------------------------------------------------------------------------*/ + +#include "triadIOField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTemplateTypeNameAndDebugWithName(triadIOField, "triadField", 0); +} + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/Fields/triadField/triadIOField.H b/src/OpenFOAM/fields/Fields/triadField/triadIOField.H new file mode 100644 index 0000000000000000000000000000000000000000..ff1057cb24fddd1c63f97280fbad0857a7c6a9e0 --- /dev/null +++ b/src/OpenFOAM/fields/Fields/triadField/triadIOField.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::triadIOField + +Description + triadField with IO. + +\*---------------------------------------------------------------------------*/ + +#ifndef triadIOField_H +#define triadIOField_H + +#include "triadField.H" +#include "IOField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOField<triad> triadIOField; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index 5117f8cb23f5112aca4351c7ce8223ecde894c45..c1b516e97cefb1319594da61f0c0838c010f48b7 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -28,8 +28,151 @@ License #include "globalMeshData.H" #include "cyclicPolyPatch.H" +template<class Type, template<class> class PatchField, class GeoMesh> +void Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField:: +readField +( + const DimensionedField<Type, GeoMesh>& field, + const dictionary& dict +) +{ + this->setSize(bmesh_.size()); + + if (debug) + { + Info<< "GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField::readField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const dictionary&" + ")" + << endl; + } + + // Patch or patch-groups. (using non-wild card entries of dictionaries) + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict() && !iter().keyword().isPattern()) + { + const labelList patchIDs = bmesh_.findIndices + ( + iter().keyword(), + true + ); + + forAll(patchIDs, i) + { + label patchi = patchIDs[i]; + + this->set + ( + patchi, + PatchField<Type>::New + ( + bmesh_[patchi], + field, + iter().dict() + ) + ); + } + } + } + + // Check for wildcard patch overrides + forAll(bmesh_, patchi) + { + if (!this->set(patchi)) + { + if (bmesh_[patchi].type() == emptyPolyPatch::typeName) + { + this->set + ( + patchi, + PatchField<Type>::New + ( + emptyPolyPatch::typeName, + bmesh_[patchi], + field + ) + ); + } + else + { + bool found = dict.found(bmesh_[patchi].name()); + + if (found) + { + this->set + ( + patchi, + PatchField<Type>::New + ( + bmesh_[patchi], + field, + dict.subDict(bmesh_[patchi].name()) + ) + ); + } + } + } + } + + + // Check for any unset patches + forAll(bmesh_, patchi) + { + if (!this->set(patchi)) + { + if (bmesh_[patchi].type() == cyclicPolyPatch::typeName) + { + FatalIOErrorIn + ( + "GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField::readField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const dictionary&" + ")", + dict + ) << "Cannot find patchField entry for cyclic " + << bmesh_[patchi].name() << endl + << "Is your field uptodate with split cyclics?" << endl + << "Run foamUpgradeCyclics to convert mesh and fields" + << " to split cyclics." << exit(FatalIOError); + } + else + { + FatalIOErrorIn + ( + "GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField::readField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const dictionary&" + ")", + dict + ) << "Cannot find patchField entry for " + << bmesh_[patchi].name() << exit(FatalIOError); + } + } + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +template<class Type, template<class> class PatchField, class GeoMesh> +Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField:: +GeometricBoundaryField +( + const BoundaryMesh& bmesh +) +: + FieldField<PatchField, Type>(bmesh.size()), + bmesh_(bmesh) +{} + + template<class Type, template<class> class PatchField, class GeoMesh> Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricBoundaryField:: GeometricBoundaryField @@ -47,7 +190,7 @@ GeometricBoundaryField Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const word&)" + "const DimensionedField<Type>&, const word&)" << endl; } @@ -84,8 +227,13 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const wordList&, const wordList&)" + "GeometricBoundaryField" + "(" + "const BoundaryMesh&, " + "const DimensionedField<Type>&, " + "const wordList&, " + "const wordList&" + ")" << endl; } @@ -99,8 +247,13 @@ GeometricBoundaryField ( "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const wordList&, const wordList&)" + "GeometricBoundaryField" + "(" + "const BoundaryMesh&, " + "const DimensionedField<Type>&, " + "const wordList&, " + "const wordList&" + ")" ) << "Incorrect number of patch type specifications given" << nl << " Number of patches in mesh = " << bmesh.size() << " number of patch type specifications = " @@ -160,8 +313,12 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const BoundaryMesh&, " - "const Field<Type>&, const PatchField<Type>List&)" + "GeometricBoundaryField" + "(" + "const BoundaryMesh&, " + "const DimensionedField<Type, GeoMesh>&, " + "const PtrLIst<PatchField<Type> >&" + ")" << endl; } @@ -188,8 +345,12 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const GeometricBoundaryField<Type, " - "PatchField, BoundaryMesh>&)" + "GeometricBoundaryField" + "(" + "const DimensionedField<Type, GeoMesh>&, " + "const typename GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField&" + ")" << endl; } @@ -220,8 +381,11 @@ GeometricBoundaryField { Info<< "GeometricField<Type, PatchField, GeoMesh>::" "GeometricBoundaryField::" - "GeometricBoundaryField(const GeometricBoundaryField<Type, " - "PatchField, BoundaryMesh>&)" + "GeometricBoundaryField" + "(" + "const GeometricField<Type, PatchField, GeoMesh>::" + "GeometricBoundaryField&" + ")" << endl; } } @@ -239,124 +403,7 @@ GeometricBoundaryField FieldField<PatchField, Type>(bmesh.size()), bmesh_(bmesh) { - if (debug) - { - Info<< "GeometricField<Type, PatchField, GeoMesh>::" - "GeometricBoundaryField::" - "GeometricBoundaryField" - "(const BoundaryMesh&, const Field<Type>&, const dictionary&)" - << endl; - } - - - // Patch or patch-groups. (using non-wild card entries of dictionaries) - forAllConstIter(dictionary, dict, iter) - { - if (iter().isDict() && !iter().keyword().isPattern()) - { - const labelList patchIDs = bmesh_.findIndices - ( - iter().keyword(), - true - ); - - forAll(patchIDs, i) - { - label patchi = patchIDs[i]; - this->set - ( - patchi, - PatchField<Type>::New - ( - bmesh_[patchi], - field, - iter().dict() - ) - ); - } - } - } - - // Check for wildcard patch overrides - forAll(bmesh_, patchi) - { - if (!this->set(patchi)) - { - if (bmesh_[patchi].type() == emptyPolyPatch::typeName) - { - this->set - ( - patchi, - PatchField<Type>::New - ( - emptyPolyPatch::typeName, - bmesh_[patchi], - field - ) - ); - } - else - { - bool found = dict.found(bmesh_[patchi].name()); - - if (found) - { - this->set - ( - patchi, - PatchField<Type>::New - ( - bmesh_[patchi], - field, - dict.subDict(bmesh_[patchi].name()) - ) - ); - } - } - } - } - - - // Check for any unset patches - forAll(bmesh_, patchi) - { - if (!this->set(patchi)) - { - if (bmesh_[patchi].type() == cyclicPolyPatch::typeName) - { - FatalIOErrorIn - ( - "GeometricField<Type, PatchField, GeoMesh>::\n" - "GeometricBoundaryField::GeometricBoundaryField\n" - "(\n" - " const BoundaryMesh&,\n" - " const DimensionedField<Type, GeoMesh>&,\n" - " const dictionary&\n" - ")", - dict - ) << "Cannot find patchField entry for cyclic " - << bmesh_[patchi].name() << endl - << "Is your field uptodate with split cyclics?" << endl - << "Run foamUpgradeCyclics to convert mesh and fields" - << " to split cyclics." << exit(FatalIOError); - } - else - { - FatalIOErrorIn - ( - "GeometricField<Type, PatchField, GeoMesh>::\n" - "GeometricBoundaryField::GeometricBoundaryField\n" - "(\n" - " const BoundaryMesh&,\n" - " const DimensionedField<Type, GeoMesh>&,\n" - " const dictionary&\n" - ")", - dict - ) << "Cannot find patchField entry for " - << bmesh_[patchi].name() << exit(FatalIOError); - } - } - } + readField(field, dict); } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 8898b162f44dbe436538ed9dddb951cf7d42d3f7..2b8216956161bb4aad0998c80d3b16c4c21cb634 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.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 @@ -47,70 +47,49 @@ if ((gf1).mesh() != (gf2).mesh()) \ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template<class Type, template<class> class PatchField, class GeoMesh> -Foam::tmp -< - typename Foam::GeometricField<Type, PatchField, GeoMesh>:: - GeometricBoundaryField -> -Foam::GeometricField<Type, PatchField, GeoMesh>::readField +void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields ( - const dictionary& fieldDict + const dictionary& dict ) { - DimensionedField<Type, GeoMesh>::readField(fieldDict, "internalField"); + DimensionedField<Type, GeoMesh>::readField(dict, "internalField"); - tmp<GeometricBoundaryField> tboundaryField - ( - new GeometricBoundaryField - ( - this->mesh().boundary(), - *this, - fieldDict.subDict("boundaryField") - ) - ); + boundaryField_.readField(*this, dict.subDict("boundaryField")); - if (fieldDict.found("referenceLevel")) + if (dict.found("referenceLevel")) { - Type fieldAverage(pTraits<Type>(fieldDict.lookup("referenceLevel"))); + Type fieldAverage(pTraits<Type>(dict.lookup("referenceLevel"))); Field<Type>::operator+=(fieldAverage); - GeometricBoundaryField& boundaryField = tboundaryField(); - - forAll(boundaryField, patchi) + forAll(boundaryField_, patchi) { - boundaryField[patchi] == boundaryField[patchi] + fieldAverage; + boundaryField_[patchi] == boundaryField_[patchi] + fieldAverage; } } - - return tboundaryField; } template<class Type, template<class> class PatchField, class GeoMesh> -Foam::tmp -< - typename Foam::GeometricField<Type, PatchField, GeoMesh>:: - GeometricBoundaryField -> -Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is) +void Foam::GeometricField<Type, PatchField, GeoMesh>::readFields() { - return readField + const IOdictionary dict ( - IOdictionary + IOobject ( - IOobject - ( - this->name(), - this->time().timeName(), - this->db(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), - is - ) + this->name(), + this->time().timeName(), + this->db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + this->readStream(typeName) ); + + this->close(); + + readFields(dict); } @@ -132,8 +111,7 @@ bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent() } else if (this->readOpt() == IOobject::READ_IF_PRESENT && this->headerOk()) { - boundaryField_.transfer(readField(this->readStream(typeName))()); - this->close(); + readFields(); // Check compatibility between field and mesh if (this->size() != GeoMesh::size(this->mesh())) @@ -360,9 +338,9 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(NULL), fieldPrevIterPtr_(NULL), - boundaryField_(*this, readField(this->readStream(typeName))) + boundaryField_(mesh.boundary()) { - this->close(); + readFields(); // Check compatibility between field and mesh @@ -401,8 +379,10 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField timeIndex_(this->time().timeIndex()), field0Ptr_(NULL), fieldPrevIterPtr_(NULL), - boundaryField_(*this, readField(dict)) + boundaryField_(mesh.boundary()) { + readFields(dict); + // Check compatibility between field and mesh if (this->size() != GeoMesh::size(this->mesh())) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 5aef9e0fb819c61bf75c7e5122b3f30d35dc6733..ba510d77e86f5109fed052770affe935315d5ecf 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -117,6 +117,9 @@ public: // Constructors + //- Construct from a BoundaryMesh + GeometricBoundaryField(const BoundaryMesh&); + //- Construct from a BoundaryMesh, // reference to the internal field // and a patch type @@ -177,6 +180,13 @@ public: // Member functions + //- Read the boundary field + void readField + ( + const DimensionedField<Type, GeoMesh>& field, + const dictionary& dict + ); + //- Update the boundary condition coefficients void updateCoeffs(); @@ -247,10 +257,10 @@ private: // Private Member Functions //- Read the field from the dictionary - tmp<GeometricBoundaryField> readField(const dictionary&); + void readFields(const dictionary&); - //- Read the field from the given stream - tmp<GeometricBoundaryField> readField(Istream& is); + //- Read the field - create the field dictionary on-the-fly + void readFields(); public: diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C index 43b2f1c7f59ccef336e42e43d74565b941bb6925..ce78313efb2884b09d65bb0cc51852be380ec0e5 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.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 @@ -448,6 +448,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.H b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.H index fa3280ce74f22a7933077aff8377a802ea904e47..fd20e171c9c0e28f346381a51b9d0d92f214bb87 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricScalarField/GeometricScalarField.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 @@ -93,6 +93,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5) UNARY_FUNCTION(scalar, scalar, pow6, pow6) UNARY_FUNCTION(scalar, scalar, pow025, pow025) UNARY_FUNCTION(scalar, scalar, sqrt, sqrt) +UNARY_FUNCTION(scalar, scalar, cbrt, cbrt) UNARY_FUNCTION(scalar, scalar, sign, sign) UNARY_FUNCTION(scalar, scalar, pos, pos) UNARY_FUNCTION(scalar, scalar, neg, neg) diff --git a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C index 43d14a57405600060bb8f59618ba725851be44f1..1ea9ae6e115ebf9d28fd9a502001f450ffd4c9aa 100644 --- a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.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 @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "SlicedGeometricField.H" +#include "processorFvPatch.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // @@ -40,7 +41,8 @@ slicedBoundaryField ( const Mesh& mesh, const Field<Type>& completeField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly ) { tmp<FieldField<PatchField, Type> > tbf @@ -52,7 +54,15 @@ slicedBoundaryField forAll(mesh.boundary(), patchi) { - if (preserveCouples && mesh.boundary()[patchi].coupled()) + if + ( + preserveCouples + && mesh.boundary()[patchi].coupled() + && ( + !preserveProcessorOnly + || isA<processorFvPatch>(mesh.boundary()[patchi]) + ) + ) { // For coupled patched construct the correct patch field type bf.set @@ -243,7 +253,8 @@ SlicedGeometricField const dimensionSet& ds, const Field<Type>& completeIField, const Field<Type>& completeBField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly ) : GeometricField<Type, PatchField, GeoMesh> @@ -252,7 +263,13 @@ SlicedGeometricField mesh, ds, Field<Type>(), - slicedBoundaryField(mesh, completeBField, preserveCouples) + slicedBoundaryField + ( + mesh, + completeBField, + preserveCouples, + preserveProcessorOnly + ) ) { // Set the internalField to the slice of the complete field diff --git a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H index e04690e042c325908c542cacaaab293f4173378a..dd23712e6748586c8a919e384c628b301c6d58ba 100644 --- a/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/SlicedGeometricField/SlicedGeometricField.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 @@ -83,7 +83,8 @@ private: ( const Mesh& mesh, const Field<Type>& completeField, - const bool preserveCouples + const bool preserveCouples, + const bool preserveProcessorOnly = false ); //- Slice the given field and a create a PtrList of SlicedPatchField @@ -133,7 +134,8 @@ public: const dimensionSet&, const Field<Type>& completeIField, const Field<Type>& completeBField, - const bool preserveCouples=true + const bool preserveCouples=true, + const bool preserveProcessorOnly = false ); //- Construct from GeometricField. Reuses full internal and diff --git a/src/OpenFOAM/fields/cloud/cloud.C b/src/OpenFOAM/fields/cloud/cloud.C index 74f296fa0d078414c2230ecd212b61a835f9517f..cae1cce299185c2486dc0dd7b7b4bce27031d117 100644 --- a/src/OpenFOAM/fields/cloud/cloud.C +++ b/src/OpenFOAM/fields/cloud/cloud.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 @@ -28,10 +28,14 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cloud, 0); +namespace Foam +{ +defineTypeNameAndDebug(cloud, 0); + +const word cloud::prefix("lagrangian"); +word cloud::defaultName("defaultCloud"); +} -const Foam::word Foam::cloud::prefix("lagrangian"); -Foam::word Foam::cloud::defaultName("defaultCloud"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/debug/debug.C b/src/OpenFOAM/global/debug/debug.C index cd2a0b2486c557dace472cd64531c8f603f36f5b..e704361970a344fa14a677c394041da530aebd1b 100644 --- a/src/OpenFOAM/global/debug/debug.C +++ b/src/OpenFOAM/global/debug/debug.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 @@ -30,6 +30,9 @@ Description #include "dictionary.H" #include "IFstream.H" #include "OSspecific.H" +#include "Ostream.H" +#include "demandDrivenData.H" +#include "simpleObjectRegistry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,15 +57,35 @@ public: ~deleteControlDictPtr() { - if (controlDictPtr_) - { - delete controlDictPtr_; - controlDictPtr_ = 0; - } + deleteDemandDrivenData(controlDictPtr_); } }; deleteControlDictPtr deleteControlDictPtr_; + + +// Debug switch read and write callback tables. +simpleObjectRegistry* debugObjectsPtr_(NULL); +simpleObjectRegistry* infoObjectsPtr_(NULL); +simpleObjectRegistry* optimisationObjectsPtr_(NULL); +simpleObjectRegistry* dimensionSetObjectsPtr_(NULL); +class deleteDebugSwitchPtr +{ +public: + + deleteDebugSwitchPtr() + {} + + ~deleteDebugSwitchPtr() + { + deleteDemandDrivenData(debugObjectsPtr_); + deleteDemandDrivenData(infoObjectsPtr_); + deleteDemandDrivenData(optimisationObjectsPtr_); + deleteDemandDrivenData(dimensionSetObjectsPtr_); + } +}; + +deleteDebugSwitchPtr deleteDebugSwitchPtr_; //! \endcond @@ -165,6 +188,106 @@ int Foam::debug::optimisationSwitch(const char* name, const int defaultValue) } +void Foam::debug::addDebugObject(const char* name, simpleRegIOobject* obj) +{ + if (!debugObjects().insert(name, obj)) + { + //std::cerr<< "debug::addDebugObject : Duplicate entry " << name + // << " in runtime selection table" + // << std::endl; + //error::safePrintStack(std::cerr); + } +} + + +void Foam::debug::addInfoObject(const char* name, simpleRegIOobject* obj) +{ + if (!infoObjects().insert(name, obj)) + { + //std::cerr<< "debug::addInfoObject : Duplicate entry " << name + // << " in runtime selection table" + // << std::endl; + //error::safePrintStack(std::cerr); + } +} + + +void Foam::debug::addOptimisationObject +( + const char* name, + simpleRegIOobject* obj +) +{ + if (!optimisationObjects().insert(name, obj)) + { + //std::cerr<< "debug::addOptimisationObject : Duplicate entry " << name + // << " in runtime selection table" + // << std::endl; + //error::safePrintStack(std::cerr); + } +} + + +void Foam::debug::addDimensionSetObject +( + const char* name, + simpleRegIOobject* obj +) +{ + if (!dimensionSetObjects().insert(name, obj)) + { + //std::cerr<< "debug::addDimensionSetObject : Duplicate entry " << name + // << " in runtime selection table" + // << std::endl; + //error::safePrintStack(std::cerr); + } +} + + +Foam::simpleObjectRegistry& Foam::debug::debugObjects() +{ + if (!debugObjectsPtr_) + { + debugObjectsPtr_ = new simpleObjectRegistry(1000); + } + + return *debugObjectsPtr_; +} + + +Foam::simpleObjectRegistry& Foam::debug::infoObjects() +{ + if (!infoObjectsPtr_) + { + infoObjectsPtr_ = new simpleObjectRegistry(1000); + } + + return *infoObjectsPtr_; +} + + +Foam::simpleObjectRegistry& Foam::debug::optimisationObjects() +{ + if (!optimisationObjectsPtr_) + { + optimisationObjectsPtr_ = new simpleObjectRegistry(1000); + } + + return *optimisationObjectsPtr_; +} + + +Foam::simpleObjectRegistry& Foam::debug::dimensionSetObjects() +{ + if (!dimensionSetObjectsPtr_) + { + dimensionSetObjectsPtr_ = new simpleObjectRegistry(1000); + } + + return *dimensionSetObjectsPtr_; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/debug/debug.H b/src/OpenFOAM/global/debug/debug.H index b941fcbb7eaee5eee0cec2baa0ca03aec314134c..09697c57a7f3b8f945a6d1095982238e97e16ae0 100644 --- a/src/OpenFOAM/global/debug/debug.H +++ b/src/OpenFOAM/global/debug/debug.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 @@ -42,6 +42,10 @@ namespace Foam // Forward declaration of classes class dictionary; +class Istream; +class Ostream; +class simpleRegIOobject; +class simpleObjectRegistry; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,6 +77,36 @@ namespace debug //- Internal function to lookup a sub-dictionary from controlDict. dictionary& switchSet(const char* subDictName, dictionary*& subDictPtr); + + + // Registered debug switches + + //- Register debug switch read/write object + void addDebugObject(const char* name, simpleRegIOobject* obj); + + //- Register info switch read/write object + void addInfoObject(const char* name, simpleRegIOobject* obj); + + //- Register optimisation switch read/write object + void addOptimisationObject(const char* name, simpleRegIOobject* obj); + + //- Register DimensionSets read/write object + void addDimensionSetObject(const char* name, simpleRegIOobject* obj); + + + //- Get access to registered debug switch objects + simpleObjectRegistry& debugObjects(); + + //- Get access to registered info switch objects + simpleObjectRegistry& infoObjects(); + + //- Get access to registered optimisation switch objects + simpleObjectRegistry& optimisationObjects(); + + //- Get access to registered dimensionSets switch objects + simpleObjectRegistry& dimensionSetObjects(); + + } // End namespace debug diff --git a/src/OpenFOAM/global/debug/simpleObjectRegistry.H b/src/OpenFOAM/global/debug/simpleObjectRegistry.H new file mode 100644 index 0000000000000000000000000000000000000000..61d0931f49cbd59353bab096b9264648fff6c235 --- /dev/null +++ b/src/OpenFOAM/global/debug/simpleObjectRegistry.H @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::simpleObjectRegistry + +Description + Object registry for simpleRegIOobject + +SourceFiles + +\*---------------------------------------------------------------------------*/ + +#ifndef simpleObjectRegistry_H +#define simpleObjectRegistry_H + +#include "HashTable.H" +#include "simpleRegIOobject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class simpleObjectRegistry Declaration +\*---------------------------------------------------------------------------*/ + +class simpleObjectRegistry +: + public HashTable<simpleRegIOobject*> +{ +public: + + // Constructors + + //- Construct from initial estimate + simpleObjectRegistry(const label nIoObjects = 128) + : + HashTable<simpleRegIOobject*>(nIoObjects) + {} + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C b/src/OpenFOAM/global/debug/simpleRegIOobject.H similarity index 51% rename from applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C rename to src/OpenFOAM/global/debug/simpleRegIOobject.H index 0916d852ef7b0a1da4d586b775ef1f7a7e33d4dc..c7ede5e8183de983e7e23d9775b45da67ffca474 100644 --- a/applications/solvers/incompressible/simpleFoam/MRFSimpleFoam/MRFSimpleFoam.C +++ b/src/OpenFOAM/global/debug/simpleRegIOobject.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,65 +21,72 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Application - MRFSimpleFoam +Class + Foam::simpleRegIOobject Description - Steady-state solver for incompressible, turbulent flow of non-Newtonian - fluids with MRF regions. + Abstract base class for registered object with I/O. Used in debug symbol + registration. + +SourceFiles \*---------------------------------------------------------------------------*/ -#include "fvCFD.H" -#include "singlePhaseTransportModel.H" -#include "RASModel.H" -#include "MRFZones.H" -#include "simpleControl.H" -#include "IObasicSourceList.H" +#ifndef simpleRegIOobject_H +#define simpleRegIOobject_H // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -int main(int argc, char *argv[]) +namespace Foam { - #include "setRootCase.H" - - #include "createTime.H" - #include "createMesh.H" - #include "createFields.H" - #include "initContinuityErrs.H" - MRFZones mrfZones(mesh); - mrfZones.correctBoundaryVelocity(U); +// Forward declaration of classes +class Istream; +class Ostream; - simpleControl simple(mesh); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +/*---------------------------------------------------------------------------*\ + Class simpleRegIOobject Declaration +\*---------------------------------------------------------------------------*/ - Info<< "\nStarting time loop\n" << endl; +class simpleRegIOobject +{ +public: - while (simple.loop()) - { - Info<< "Time = " << runTime.timeName() << nl << endl; + // Constructors - // --- Pressure-velocity SIMPLE corrector + //- Construct from objectregistry inserter and name + simpleRegIOobject + ( + void (*fn)(const char* name, simpleRegIOobject*), + const char* name + ) { - #include "UEqn.H" - #include "pEqn.H" + (*fn)(name, this); } - turbulence->correct(); - runTime.write(); + //- Destructor + virtual ~simpleRegIOobject() + {}; + - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } + // Member Functions - Info<< "End\n" << endl; + //- Read + virtual void readData(Istream&) = 0; - return 0; -} + //- Write + virtual void writeData(Ostream&) const = 0; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#endif // ************************************************************************* // diff --git a/src/OpenFOAM/graph/graph.C b/src/OpenFOAM/graph/graph.C index 7c12295edbb14dd603b6aa86e7bac155c53d9433..7c59cfc2f692ce68dccd07bab5b4cfd75f51c827 100644 --- a/src/OpenFOAM/graph/graph.C +++ b/src/OpenFOAM/graph/graph.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 @@ -33,8 +33,9 @@ License namespace Foam { - defineTypeNameAndDebug(graph::writer, 0); - defineRunTimeSelectionTable(graph::writer, word); + typedef graph::writer graphWriter; + defineTypeNameAndDebug(graphWriter, 0); + defineRunTimeSelectionTable(graphWriter, word); } diff --git a/src/OpenFOAM/graph/writers/gnuplotGraph/gnuplotGraph.C b/src/OpenFOAM/graph/writers/gnuplotGraph/gnuplotGraph.C index ef2a2ddf71fc5eaf8082b7e83f5a8eac7793c28f..1b00ef40b9bcfb7e6c58e2d2ed96a98f67dcab36 100644 --- a/src/OpenFOAM/graph/writers/gnuplotGraph/gnuplotGraph.C +++ b/src/OpenFOAM/graph/writers/gnuplotGraph/gnuplotGraph.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 @@ -28,11 +28,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::gnuplotGraph, 0); -const Foam::word Foam::gnuplotGraph::ext_("gplt"); - namespace Foam { + defineTypeNameAndDebug(gnuplotGraph, 0); + const word gnuplotGraph::ext_("gplt"); + typedef graph::writer graphWriter; addToRunTimeSelectionTable(graphWriter, gnuplotGraph, word); } diff --git a/src/OpenFOAM/graph/writers/jplotGraph/jplotGraph.C b/src/OpenFOAM/graph/writers/jplotGraph/jplotGraph.C index e41939eed15cb787cd3c954a82bca5787d590112..1352498cf56a63ac7a7e467d327b7a6d6051c1f5 100644 --- a/src/OpenFOAM/graph/writers/jplotGraph/jplotGraph.C +++ b/src/OpenFOAM/graph/writers/jplotGraph/jplotGraph.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 @@ -28,15 +28,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::jplotGraph, 0); -const Foam::word Foam::jplotGraph::ext_("dat"); - namespace Foam { + defineTypeNameAndDebug(jplotGraph, 0); + const word jplotGraph::ext_("dat"); + typedef graph::writer graphWriter; addToRunTimeSelectionTable(graphWriter, jplotGraph, word); } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::jplotGraph::write(const graph& g, Ostream& os) const diff --git a/src/OpenFOAM/graph/writers/rawGraph/rawGraph.C b/src/OpenFOAM/graph/writers/rawGraph/rawGraph.C index b791975db06752bcaf254840dc7e13b303717b63..8f2a1938bf3b828bc4ded903ada016b2f9a95f57 100644 --- a/src/OpenFOAM/graph/writers/rawGraph/rawGraph.C +++ b/src/OpenFOAM/graph/writers/rawGraph/rawGraph.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 @@ -28,15 +28,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::rawGraph, 0); -const Foam::word Foam::rawGraph::ext_("xy"); - namespace Foam { + defineTypeNameAndDebug(rawGraph, 0); + const word rawGraph::ext_("xy"); + typedef graph::writer graphWriter; addToRunTimeSelectionTable(graphWriter, rawGraph, word); } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::rawGraph::write(const graph& g, Ostream& os) const diff --git a/src/OpenFOAM/graph/writers/xmgrGraph/xmgrGraph.C b/src/OpenFOAM/graph/writers/xmgrGraph/xmgrGraph.C index db3d4657d5a287f7892913418b3f88c497cf6650..806ba183a86b99cd1379eb73fcae18aafec96a2b 100644 --- a/src/OpenFOAM/graph/writers/xmgrGraph/xmgrGraph.C +++ b/src/OpenFOAM/graph/writers/xmgrGraph/xmgrGraph.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 @@ -28,11 +28,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::xmgrGraph, 0); -const Foam::word Foam::xmgrGraph::ext_("agr"); - namespace Foam { + defineTypeNameAndDebug(xmgrGraph, 0); + const word xmgrGraph::ext_("agr"); + typedef graph::writer graphWriter; addToRunTimeSelectionTable(graphWriter, xmgrGraph, word); } diff --git a/src/OpenFOAM/include/addDictOption.H b/src/OpenFOAM/include/addDictOption.H new file mode 100644 index 0000000000000000000000000000000000000000..f538e572948c95a5e9e47f85f08bfcd4ab66b366 --- /dev/null +++ b/src/OpenFOAM/include/addDictOption.H @@ -0,0 +1,10 @@ +// +// addDictOption.H +// ~~~~~~~~~~~~~~~~~ + + Foam::argList::addOption + ( + "dict", + "file", + "read control dictionary from specified location" + ); diff --git a/src/OpenFOAM/include/setConstantMeshDictionaryIO.H b/src/OpenFOAM/include/setConstantMeshDictionaryIO.H new file mode 100644 index 0000000000000000000000000000000000000000..4f97cf16940800ddfcf6168f5584496e342edb64 --- /dev/null +++ b/src/OpenFOAM/include/setConstantMeshDictionaryIO.H @@ -0,0 +1,33 @@ +// +// setConstantMeshDictionaryIO.H +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + fileName dictPath = ""; + if (args.optionFound("dict")) + { + dictPath = args["dict"]; + if (isDir(dictPath)) + { + dictPath = dictPath / dictName; + } + } + + IOobject dictIO + ( + dictName, + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ); + + if (dictPath.size()) + { + dictIO = IOobject + ( + dictPath, + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ); + } diff --git a/src/OpenFOAM/include/setSystemMeshDictionaryIO.H b/src/OpenFOAM/include/setSystemMeshDictionaryIO.H new file mode 100644 index 0000000000000000000000000000000000000000..6e89f94c33fb2b1ec344d3c47a8bfcfc84369d87 --- /dev/null +++ b/src/OpenFOAM/include/setSystemMeshDictionaryIO.H @@ -0,0 +1,33 @@ +// +// setSystemMeshDictionaryIO.H +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + fileName dictPath = ""; + if (args.optionFound("dict")) + { + dictPath = args["dict"]; + if (isDir(dictPath)) + { + dictPath = dictPath / dictName; + } + } + + IOobject dictIO + ( + dictName, + runTime.system(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ); + + if (dictPath.size()) + { + dictIO = IOobject + ( + dictPath, + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ); + } diff --git a/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H b/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H new file mode 100644 index 0000000000000000000000000000000000000000..e594e83d960110735ddf042462655c2d46318756 --- /dev/null +++ b/src/OpenFOAM/include/setSystemRunTimeDictionaryIO.H @@ -0,0 +1,33 @@ +// +// setSystemRunTimeDictionaryIO.H +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + fileName dictPath = ""; + if (args.optionFound("dict")) + { + dictPath = args["dict"]; + if (isDir(dictPath)) + { + dictPath = dictPath / dictName; + } + } + + IOobject dictIO + ( + dictName, + runTime.system(), + runTime, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ); + + if (dictPath.size()) + { + dictIO = IOobject + ( + dictPath, + runTime, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ); + } diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.C index 97221f73ce4eb0c5f1e3f10b6fa11056e6668fbb..c93e41f6ead5e3f74070b97494caf9debef942a3 100644 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.C +++ b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::PatchToPatchInterpolationName, 0); +namespace Foam +{ +defineTypeNameAndDebug(PatchToPatchInterpolationName, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C index 6bba442cda2c031f9c9417ce5440fc4eb63a5bd6..d6bc7f7b71a29f939ba50dbdc382368f91e590e3 100644 --- a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C +++ b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.C @@ -27,6 +27,13 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +template<class Type> +inline Foam::DiagonalMatrix<Type>::DiagonalMatrix() +: + List<Type>() +{} + + template<class Type> template<class Form> Foam::DiagonalMatrix<Type>::DiagonalMatrix(const Matrix<Form, Type>& a) diff --git a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H index c89f915578e92b5dcd75f67973c0ed1c2339d6bc..031320a457962367c1882c87cf4a26cd4d85653a 100644 --- a/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H +++ b/src/OpenFOAM/matrices/DiagonalMatrix/DiagonalMatrix.H @@ -60,6 +60,9 @@ public: // Constructors + //- Null constructor. + DiagonalMatrix<Type>(); + //- Construct from diagonal component of a Matrix template<class Form> DiagonalMatrix<Type>(const Matrix<Form, Type>&); diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.C b/src/OpenFOAM/matrices/Matrix/Matrix.C index c7dbb073e471715f206300578c5cd59971509d67..861a20dfaf2dd4feb1c1d067d60a08821cabfa5e 100644 --- a/src/OpenFOAM/matrices/Matrix/Matrix.C +++ b/src/OpenFOAM/matrices/Matrix/Matrix.C @@ -421,6 +421,40 @@ Form Foam::operator*(const scalar s, const Matrix<Form, Type>& a) } +template<class Form, class Type> +Form Foam::operator*(const Matrix<Form, Type>& a, const Matrix<Form, Type>& b) +{ + if (a.m() != b.n()) + { + FatalErrorIn + ( + "Matrix<Form, Type>::operator*" + "(const Matrix<Form, Type>&, const Matrix<Form, Type>&)" + ) << "attempted to multiply incompatible matrices:" << nl + << "Matrix A : " << a.n() << " rows, " << a.m() << " columns" << nl + << "Matrix B : " << b.n() << " rows, " << b.m() << " columns" << nl + << "In order to multiply matrices, columns of A must equal " + << "rows of B" + << abort(FatalError); + } + + Form ab(a.n(), b.m(), scalar(0)); + + for (register label i = 0; i < ab.n(); i++) + { + for (register label j = 0; j < ab.m(); j++) + { + for (register label l = 0; l < b.n(); l++) + { + ab[i][j] += a[i][l]*b[l][j]; + } + } + } + + return ab; +} + + // * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * // #include "MatrixIO.C" diff --git a/src/OpenFOAM/matrices/Matrix/Matrix.H b/src/OpenFOAM/matrices/Matrix/Matrix.H index 89554d4cad4370d3123863d2a247a62e1b931a26..dd55db770cb1abc5d79b7154e88f185495171f5f 100644 --- a/src/OpenFOAM/matrices/Matrix/Matrix.H +++ b/src/OpenFOAM/matrices/Matrix/Matrix.H @@ -215,6 +215,12 @@ template<class Form, class Type> Form operator* const Matrix<Form, Type>& ); +template<class Form, class Type> Form operator* +( + const Matrix<Form, Type>&, + const Matrix<Form, Type>& +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.C index 65854c5e62295169aaf0ab25c6815a56987379d7..83203c1b39d20c9fd9b9ddc0a845ad19392bf8ff 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/cyclicLduInterface.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cyclicLduInterface, 0); +namespace Foam +{ +defineTypeNameAndDebug(cyclicLduInterface, 0); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.C index fccc40c35d1f5aa86d9adfc8a33e5c0db423ef77..ee0779ddeada5a441e1de5c04cf484b304d84c51 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/lduInterface.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::lduInterface, 0); +namespace Foam +{ +defineTypeNameAndDebug(lduInterface, 0); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C index e7f824ab60271c5e41d81f1ac76e62f8edb6a891..769f7b41600b51d8bc8d4c068ff1b2a6f2f923e1 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterface/processorLduInterface.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::processorLduInterface, 0); +namespace Foam +{ +defineTypeNameAndDebug(processorLduInterface, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C index b6ccfe754b676eaf45eb627170e84cd0d282738a..1cb4968df52741de46a5f53cafaa1c14b989990c 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/cyclicLduInterfaceField/cyclicLduInterfaceField.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cyclicLduInterfaceField, 0); +namespace Foam +{ +defineTypeNameAndDebug(cyclicLduInterfaceField, 0); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.C index 25834cc4307cfb80547dd8b4c08afe848a6dcb72..57a5c10345e9a0deceed9ca8c48517fb671d2d3a 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/lduInterfaceField/lduInterfaceField.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 @@ -27,7 +27,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::lduInterfaceField, 0); +namespace Foam +{ +defineTypeNameAndDebug(lduInterfaceField, 0); +} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C index 060f197e9c33bc398d210d24e7f8b6454d0ac2f7..18a9bd1d11b8172891d1e233b62939d904f7c977 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduInterfaceFields/processorLduInterfaceField/processorLduInterfaceField.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::processorLduInterfaceField, 0); +namespace Foam +{ +defineTypeNameAndDebug(processorLduInterfaceField, 0); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C index 16dd1a41881b1473634a842772148519571abbe2..1e4e5b8c42df67996d45fe703f669a0f2a46951c 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.C @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::lduMatrix, 1); +namespace Foam +{ +defineTypeNameAndDebug(lduMatrix, 1); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.C index cd3effd77da20aefd10daa30d005f22dc6a4e204..66dbcce3df7e2ec2f4b9ca450174320a772236e6 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/DIC/DICSmoother.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 @@ -98,17 +98,17 @@ void Foam::DICSmoother::smooth rA *= rD_; register label nFaces = matrix_.upper().size(); - for (register label face=0; face<nFaces; face++) + for (register label facei=0; facei<nFaces; facei++) { - register label u = uPtr[face]; - rAPtr[u] -= rDPtr[u]*upperPtr[face]*rAPtr[lPtr[face]]; + register label u = uPtr[facei]; + rAPtr[u] -= rDPtr[u]*upperPtr[facei]*rAPtr[lPtr[facei]]; } register label nFacesM1 = nFaces - 1; - for (register label face=nFacesM1; face>=0; face--) + for (register label facei=nFacesM1; facei>=0; facei--) { - register label l = lPtr[face]; - rAPtr[l] -= rDPtr[l]*upperPtr[face]*rAPtr[uPtr[face]]; + register label l = lPtr[facei]; + rAPtr[l] -= rDPtr[l]*upperPtr[facei]*rAPtr[uPtr[facei]]; } psi += rA; diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/FDIC/FDICSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/FDIC/FDICSmoother.C new file mode 100644 index 0000000000000000000000000000000000000000..0896d013075a1776a351faa850728f92e7d31cf3 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/FDIC/FDICSmoother.C @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "FDICSmoother.H" +#include "FDICPreconditioner.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(FDICSmoother, 0); + + lduMatrix::smoother::addsymMatrixConstructorToTable<FDICSmoother> + addFDICSmootherSymMatrixConstructorToTable_; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::FDICSmoother::FDICSmoother +( + const word& fieldName, + const lduMatrix& matrix, + const FieldField<Field, scalar>& interfaceBouCoeffs, + const FieldField<Field, scalar>& interfaceIntCoeffs, + const lduInterfaceFieldPtrsList& interfaces +) +: + lduMatrix::smoother + ( + fieldName, + matrix, + interfaceBouCoeffs, + interfaceIntCoeffs, + interfaces + ), + rD_(matrix_.diag()), + rDuUpper_(matrix_.upper().size()), + rDlUpper_(matrix_.upper().size()) +{ + scalar* __restrict__ rDPtr = rD_.begin(); + scalar* __restrict__ rDuUpperPtr = rDuUpper_.begin(); + scalar* __restrict__ rDlUpperPtr = rDlUpper_.begin(); + + const label* const __restrict__ uPtr = + matrix_.lduAddr().upperAddr().begin(); + const label* const __restrict__ lPtr = + matrix_.lduAddr().lowerAddr().begin(); + const scalar* const __restrict__ upperPtr = + matrix_.upper().begin(); + + register label nCells = rD_.size(); + register label nFaces = matrix_.upper().size(); + + for (register label face=0; face<nFaces; face++) + { + rDPtr[uPtr[face]] -= sqr(upperPtr[face])/rDPtr[lPtr[face]]; + } + + // Generate reciprocal FDIC + for (register label cell=0; cell<nCells; cell++) + { + rDPtr[cell] = 1.0/rDPtr[cell]; + } + + for (register label face=0; face<nFaces; face++) + { + rDuUpperPtr[face] = rDPtr[uPtr[face]]*upperPtr[face]; + rDlUpperPtr[face] = rDPtr[lPtr[face]]*upperPtr[face]; + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::FDICSmoother::smooth +( + scalarField& psi, + const scalarField& source, + const direction cmpt, + const label nSweeps +) const +{ + const scalar* const __restrict__ rDuUpperPtr = rDuUpper_.begin(); + const scalar* const __restrict__ rDlUpperPtr = rDlUpper_.begin(); + + const label* const __restrict__ uPtr = + matrix_.lduAddr().upperAddr().begin(); + const label* const __restrict__ lPtr = + matrix_.lduAddr().lowerAddr().begin(); + + // Temporary storage for the residual + scalarField rA(rD_.size()); + scalar* __restrict__ rAPtr = rA.begin(); + + for (label sweep=0; sweep<nSweeps; sweep++) + { + matrix_.residual + ( + rA, + psi, + source, + interfaceBouCoeffs_, + interfaces_, + cmpt + ); + + rA *= rD_; + + register label nFaces = matrix_.upper().size(); + for (register label face=0; face<nFaces; face++) + { + rAPtr[uPtr[face]] -= rDuUpperPtr[face]*rAPtr[lPtr[face]]; + } + + register label nFacesM1 = nFaces - 1; + for (register label face=nFacesM1; face>=0; face--) + { + rAPtr[lPtr[face]] -= rDlUpperPtr[face]*rAPtr[uPtr[face]]; + } + + psi += rA; + } +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/FDIC/FDICSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/FDIC/FDICSmoother.H new file mode 100644 index 0000000000000000000000000000000000000000..674f4963ccb6de3cee1d6ba44e5574b8658605a2 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/FDIC/FDICSmoother.H @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::FDICSmoother + +Description + Simplified diagonal-based incomplete Cholesky smoother for symmetric + matrices. + + To improve efficiency, the residual is evaluated after every nSweeps + sweeps. + +SourceFiles + FDICSmoother.C + +\*---------------------------------------------------------------------------*/ + +#ifndef FDICSmoother_H +#define FDICSmoother_H + +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class FDICSmoother Declaration +\*---------------------------------------------------------------------------*/ + +class FDICSmoother +: + public lduMatrix::smoother +{ + // Private data + + //- The reciprocal preconditioned diagonal + scalarField rD_; + scalarField rDuUpper_; + scalarField rDlUpper_; + + +public: + + //- Runtime type information + TypeName("FDIC"); + + + // Constructors + + //- Construct from matrix components + FDICSmoother + ( + const word& fieldName, + const lduMatrix& matrix, + const FieldField<Field, scalar>& interfaceBouCoeffs, + const FieldField<Field, scalar>& interfaceIntCoeffs, + const lduInterfaceFieldPtrsList& interfaces + ); + + + // Member Functions + + //- Smooth the solution for a given number of sweeps + void smooth + ( + scalarField& psi, + const scalarField& source, + const direction cmpt, + const label nSweeps + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C index b0cb88ed6eb00338428fb3e841c86a5eba452f55..42bbea8c9cf74c3b5f3ae9b0413936a6848e6eca 100644 --- a/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/GaussSeidel/GaussSeidelSmoother.C @@ -107,20 +107,12 @@ void Foam::GaussSeidelSmoother::smooth // To compensate for this, it is necessary to turn the // sign of the contribution. - //FieldField<Field, scalar> mBouCoeffs(interfaceBouCoeffs_.size()); - // - //forAll(mBouCoeffs, patchi) - //{ - // if (interfaces_.set(patchi)) - // { - // mBouCoeffs.set(patchi, -interfaceBouCoeffs_[patchi]); - // } - //} FieldField<Field, scalar>& mBouCoeffs = const_cast<FieldField<Field, scalar>&> ( interfaceBouCoeffs_ ); + forAll(mBouCoeffs, patchi) { if (interfaces_.set(patchi)) @@ -152,35 +144,35 @@ void Foam::GaussSeidelSmoother::smooth cmpt ); - register scalar curPsi; + register scalar psii; register label fStart; register label fEnd = ownStartPtr[0]; - for (register label cellI=0; cellI<nCells; cellI++) + for (register label celli=0; celli<nCells; celli++) { // Start and end of this row fStart = fEnd; - fEnd = ownStartPtr[cellI + 1]; + fEnd = ownStartPtr[celli + 1]; // Get the accumulated neighbour side - curPsi = bPrimePtr[cellI]; + psii = bPrimePtr[celli]; // Accumulate the owner product side - for (register label curFace=fStart; curFace<fEnd; curFace++) + for (register label facei=fStart; facei<fEnd; facei++) { - curPsi -= upperPtr[curFace]*psiPtr[uPtr[curFace]]; + psii -= upperPtr[facei]*psiPtr[uPtr[facei]]; } - // Finish current psi - curPsi /= diagPtr[cellI]; + // Finish psi for this cell + psii /= diagPtr[celli]; - // Distribute the neighbour side using current psi - for (register label curFace=fStart; curFace<fEnd; curFace++) + // Distribute the neighbour side using psi for this cell + for (register label facei=fStart; facei<fEnd; facei++) { - bPrimePtr[uPtr[curFace]] -= lowerPtr[curFace]*curPsi; + bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii; } - psiPtr[cellI] = curPsi; + psiPtr[celli] = psii; } } diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C new file mode 100644 index 0000000000000000000000000000000000000000..c8794ba5d6bba74c7d7a4c94f6b0066bd140f1e8 --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.C @@ -0,0 +1,241 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "symGaussSeidelSmoother.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(symGaussSeidelSmoother, 0); + + lduMatrix::smoother::addsymMatrixConstructorToTable<symGaussSeidelSmoother> + addsymGaussSeidelSmootherSymMatrixConstructorToTable_; + + lduMatrix::smoother::addasymMatrixConstructorToTable<symGaussSeidelSmoother> + addsymGaussSeidelSmootherAsymMatrixConstructorToTable_; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::symGaussSeidelSmoother::symGaussSeidelSmoother +( + const word& fieldName, + const lduMatrix& matrix, + const FieldField<Field, scalar>& interfaceBouCoeffs, + const FieldField<Field, scalar>& interfaceIntCoeffs, + const lduInterfaceFieldPtrsList& interfaces +) +: + lduMatrix::smoother + ( + fieldName, + matrix, + interfaceBouCoeffs, + interfaceIntCoeffs, + interfaces + ) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::symGaussSeidelSmoother::smooth +( + const word& fieldName_, + scalarField& psi, + const lduMatrix& matrix_, + const scalarField& source, + const FieldField<Field, scalar>& interfaceBouCoeffs_, + const lduInterfaceFieldPtrsList& interfaces_, + const direction cmpt, + const label nSweeps +) +{ + register scalar* __restrict__ psiPtr = psi.begin(); + + register const label nCells = psi.size(); + + scalarField bPrime(nCells); + register scalar* __restrict__ bPrimePtr = bPrime.begin(); + + register const scalar* const __restrict__ diagPtr = matrix_.diag().begin(); + register const scalar* const __restrict__ upperPtr = + matrix_.upper().begin(); + register const scalar* const __restrict__ lowerPtr = + matrix_.lower().begin(); + + register const label* const __restrict__ uPtr = + matrix_.lduAddr().upperAddr().begin(); + + register const label* const __restrict__ ownStartPtr = + matrix_.lduAddr().ownerStartAddr().begin(); + + + // Parallel boundary initialisation. The parallel boundary is treated + // as an effective jacobi interface in the boundary. + // Note: there is a change of sign in the coupled + // interface update. The reason for this is that the + // internal coefficients are all located at the l.h.s. of + // the matrix whereas the "implicit" coefficients on the + // coupled boundaries are all created as if the + // coefficient contribution is of a source-kind (i.e. they + // have a sign as if they are on the r.h.s. of the matrix. + // To compensate for this, it is necessary to turn the + // sign of the contribution. + + FieldField<Field, scalar>& mBouCoeffs = + const_cast<FieldField<Field, scalar>&> + ( + interfaceBouCoeffs_ + ); + + forAll(mBouCoeffs, patchi) + { + if (interfaces_.set(patchi)) + { + mBouCoeffs[patchi].negate(); + } + } + + + for (label sweep=0; sweep<nSweeps; sweep++) + { + bPrime = source; + + matrix_.initMatrixInterfaces + ( + mBouCoeffs, + interfaces_, + psi, + bPrime, + cmpt + ); + + matrix_.updateMatrixInterfaces + ( + mBouCoeffs, + interfaces_, + psi, + bPrime, + cmpt + ); + + register scalar psii; + register label fStart; + register label fEnd = ownStartPtr[0]; + + for (register label celli=0; celli<nCells; celli++) + { + // Start and end of this row + fStart = fEnd; + fEnd = ownStartPtr[celli + 1]; + + // Get the accumulated neighbour side + psii = bPrimePtr[celli]; + + // Accumulate the owner product side + for (register label facei=fStart; facei<fEnd; facei++) + { + psii -= upperPtr[facei]*psiPtr[uPtr[facei]]; + } + + // Finish current psi + psii /= diagPtr[celli]; + + // Distribute the neighbour side using current psi + for (register label facei=fStart; facei<fEnd; facei++) + { + bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii; + } + + psiPtr[celli] = psii; + } + + fStart = ownStartPtr[nCells]; + + for (register label celli=nCells-1; celli>=0; celli--) + { + // Start and end of this row + fEnd = fStart; + fStart = ownStartPtr[celli]; + + // Get the accumulated neighbour side + psii = bPrimePtr[celli]; + + // Accumulate the owner product side + for (register label facei=fStart; facei<fEnd; facei++) + { + psii -= upperPtr[facei]*psiPtr[uPtr[facei]]; + } + + // Finish psi for this cell + psii /= diagPtr[celli]; + + // Distribute the neighbour side using psi for this cell + for (register label facei=fStart; facei<fEnd; facei++) + { + bPrimePtr[uPtr[facei]] -= lowerPtr[facei]*psii; + } + + psiPtr[celli] = psii; + } + } + + // Restore interfaceBouCoeffs_ + forAll(mBouCoeffs, patchi) + { + if (interfaces_.set(patchi)) + { + mBouCoeffs[patchi].negate(); + } + } +} + + +void Foam::symGaussSeidelSmoother::smooth +( + scalarField& psi, + const scalarField& source, + const direction cmpt, + const label nSweeps +) const +{ + smooth + ( + fieldName_, + psi, + matrix_, + source, + interfaceBouCoeffs_, + interfaces_, + cmpt, + nSweeps + ); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H new file mode 100644 index 0000000000000000000000000000000000000000..a9a25e651fb1ac3d0e742600242f44069778f59d --- /dev/null +++ b/src/OpenFOAM/matrices/lduMatrix/smoothers/symGaussSeidel/symGaussSeidelSmoother.H @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::symGaussSeidelSmoother + +Description + A lduMatrix::smoother for symmetric Gauss-Seidel + +SourceFiles + symGaussSeidelSmoother.C + +\*---------------------------------------------------------------------------*/ + +#ifndef symGaussSeidelSmoother_H +#define symGaussSeidelSmoother_H + +#include "lduMatrix.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class symGaussSeidelSmoother Declaration +\*---------------------------------------------------------------------------*/ + +class symGaussSeidelSmoother +: + public lduMatrix::smoother +{ + +public: + + //- Runtime type information + TypeName("symGaussSeidel"); + + + // Constructors + + //- Construct from components + symGaussSeidelSmoother + ( + const word& fieldName, + const lduMatrix& matrix, + const FieldField<Field, scalar>& interfaceBouCoeffs, + const FieldField<Field, scalar>& interfaceIntCoeffs, + const lduInterfaceFieldPtrsList& interfaces + ); + + + // Member Functions + + //- Smooth for the given number of sweeps + static void smooth + ( + const word& fieldName, + scalarField& psi, + const lduMatrix& matrix, + const scalarField& source, + const FieldField<Field, scalar>& interfaceBouCoeffs, + const lduInterfaceFieldPtrsList& interfaces, + const direction cmpt, + const label nSweeps + ); + + + //- Smooth the solution for a given number of sweeps + virtual void smooth + ( + scalarField& psi, + const scalarField& Source, + const direction cmpt, + const label nSweeps + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomeration.C index b152ca2821cf296bc449b42ec503dfde83079b5a..1c4cbfcd7f6fcbbcc6387508cc516274bfa4d8b0 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/pairGAMGAgglomeration/pairGAMGAgglomeration.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::pairGAMGAgglomeration, 0); +namespace Foam +{ +defineTypeNameAndDebug(pairGAMGAgglomeration, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C b/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C index 73e386f5eddbf34cdafc8cd4b35be1ef7e539c87..2170c1b90ea017edecd1ecec66f310fbe22129f9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/diagonalSolver/diagonalSolver.C @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::diagonalSolver, 0); +namespace Foam +{ +defineTypeNameAndDebug(diagonalSolver, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C b/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C index c3b701c8f9b6a827a46ba5f693b93ffaa962da47..58b196da091399339655c4e1b20b26a99420a833 100644 --- a/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C +++ b/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.C @@ -136,41 +136,6 @@ void Foam::LUDecompose // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // -void Foam::multiply -( - scalarRectangularMatrix& ans, // value changed in return - const scalarRectangularMatrix& A, - const scalarRectangularMatrix& B -) -{ - if (A.m() != B.n()) - { - FatalErrorIn - ( - "multiply(" - "scalarRectangularMatrix& answer " - "const scalarRectangularMatrix& A, " - "const scalarRectangularMatrix& B)" - ) << "A and B must have identical inner dimensions but A.m = " - << A.m() << " and B.n = " << B.n() - << abort(FatalError); - } - - ans = scalarRectangularMatrix(A.n(), B.m(), scalar(0)); - - for (register label i = 0; i < A.n(); i++) - { - for (register label j = 0; j < B.m(); j++) - { - for (register label l = 0; l < B.n(); l++) - { - ans[i][j] += A[i][l]*B[l][j]; - } - } - } -} - - void Foam::multiply ( scalarRectangularMatrix& ans, // value changed in return diff --git a/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.H b/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.H index d3818cfc235bc1d8e0d1d66ad66f11b646ca3f7a..0830b33ae67f49ff0b44d587db8cb66daa4f7061 100644 --- a/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.H +++ b/src/OpenFOAM/matrices/scalarMatrices/scalarMatrices.H @@ -88,11 +88,12 @@ void LUBacksubstitute template<class Type> void LUsolve(scalarSquareMatrix& matrix, Field<Type>& source); +template<class Form, class Type> void multiply ( - scalarRectangularMatrix& answer, // value changed in return - const scalarRectangularMatrix& A, - const scalarRectangularMatrix& B + Matrix<Form, Type>& answer, // value changed in return + const Matrix<Form, Type>& A, + const Matrix<Form, Type>& B ); void multiply diff --git a/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C b/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C index f1ca94018bb68ff4b16c1538030d90f230787481..0489ed012d00f3dce16f9378e98209e4d6e98657 100644 --- a/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C +++ b/src/OpenFOAM/matrices/scalarMatrices/scalarMatricesTemplates.C @@ -176,4 +176,40 @@ void Foam::LUsolve } +template<class Form, class Type> +void Foam::multiply +( + Matrix<Form, Type>& ans, // value changed in return + const Matrix<Form, Type>& A, + const Matrix<Form, Type>& B +) +{ + if (A.m() != B.n()) + { + FatalErrorIn + ( + "multiply(" + "Matrix<Form, Type>& answer " + "const Matrix<Form, Type>& A, " + "const Matrix<Form, Type>& B)" + ) << "A and B must have identical inner dimensions but A.m = " + << A.m() << " and B.n = " << B.n() + << abort(FatalError); + } + + ans = Matrix<Form, Type>(A.n(), B.m(), scalar(0)); + + for (register label i = 0; i < A.n(); i++) + { + for (register label j = 0; j < B.m(); j++) + { + for (register label l = 0; l < B.n(); l++) + { + ans[i][j] += A[i][l]*B[l][j]; + } + } + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/solution/solution.C b/src/OpenFOAM/matrices/solution/solution.C index 0b770b7daa3d1cd9e2c61665a5dbd552d9f3944e..1a1c215444f78e026d8aa5eb40034d58562c582d 100644 --- a/src/OpenFOAM/matrices/solution/solution.C +++ b/src/OpenFOAM/matrices/solution/solution.C @@ -33,7 +33,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -int Foam::solution::debug(::Foam::debug::debugSwitch("solution", 0)); +namespace Foam +{ +defineDebugSwitchWithName(solution, "solution", 0); +} // List of sub-dictionaries to rewrite //! \cond localScope diff --git a/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C b/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C index 53d4e8985a9fba5c55ae9ae913089f330a91ddce..d285ca5ae4e9915aed445aea9d46acfb7c711be5 100644 --- a/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.C +++ b/src/OpenFOAM/meshes/ProcessorTopology/commSchedule.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 @@ -33,7 +33,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::commSchedule, 0); +namespace Foam +{ +defineTypeNameAndDebug(commSchedule, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.C b/src/OpenFOAM/meshes/boundBox/boundBox.C index f1c297837d5c25211b47944ac50c532645a35f20..168d43c3422b989d17313c5d27715b26defe4c73 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.C +++ b/src/OpenFOAM/meshes/boundBox/boundBox.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 @@ -66,6 +66,7 @@ void Foam::boundBox::calculate(const UList<point>& points, const bool doReduce) min_ = points[0]; max_ = points[0]; + for (label i = 1; i < points.size(); i++) { min_ = ::Foam::min(min_, points[i]); @@ -299,6 +300,17 @@ bool Foam::boundBox::containsAny } +Foam::point Foam::boundBox::nearest(const point& pt) const +{ + // Clip the point to the range of the bounding box + const scalar surfPtx = Foam::max(Foam::min(pt.x(), max_.x()), min_.x()); + const scalar surfPty = Foam::max(Foam::min(pt.y(), max_.y()), min_.y()); + const scalar surfPtz = Foam::max(Foam::min(pt.z(), max_.z()), min_.z()); + + return point(surfPtx, surfPty, surfPtz); +} + + // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<(Ostream& os, const boundBox& bb) diff --git a/src/OpenFOAM/meshes/boundBox/boundBox.H b/src/OpenFOAM/meshes/boundBox/boundBox.H index c59281bdf022b05d17ec9d05c1ff2b627c1b78b5..9a9821b5337034313782e808b98ed550a31bf5b9 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBox.H +++ b/src/OpenFOAM/meshes/boundBox/boundBox.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 @@ -176,6 +176,9 @@ public: //- Overlaps/touches boundingBox? inline bool overlaps(const boundBox&) const; + //- Overlaps boundingSphere (centre + sqr(radius))? + inline bool overlaps(const point&, const scalar radiusSqr) const; + //- Contains point? (inside or on edge) inline bool contains(const point&) const; @@ -222,6 +225,11 @@ public: const FixedList<label, Size>& indices ) const; + //- Return the nearest point on the boundBox to the supplied point. + // If point is inside the boundBox then the point is returned + // unchanged. + point nearest(const point&) const; + // Friend Operators diff --git a/src/OpenFOAM/meshes/boundBox/boundBoxI.H b/src/OpenFOAM/meshes/boundBox/boundBoxI.H index efb8d3d9d0cfb76080cd15240ef4210f16a820e0..4c3fc062035f158c78892ab4714cd18bc9cdfd04 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBoxI.H +++ b/src/OpenFOAM/meshes/boundBox/boundBoxI.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 @@ -128,6 +128,45 @@ inline bool Foam::boundBox::overlaps(const boundBox& bb) const } +inline bool Foam::boundBox::overlaps +( + const point& centre, + const scalar radiusSqr +) const +{ + // Find out where centre is in relation to bb. + // Find nearest point on bb. + scalar distSqr = 0; + + for (direction dir = 0; dir < vector::nComponents; dir++) + { + scalar d0 = min_[dir] - centre[dir]; + scalar d1 = max_[dir] - centre[dir]; + + if ((d0 > 0) != (d1 > 0)) + { + // centre inside both extrema. This component does not add any + // distance. + } + else if (Foam::mag(d0) < Foam::mag(d1)) + { + distSqr += d0*d0; + } + else + { + distSqr += d1*d1; + } + + if (distSqr > radiusSqr) + { + return false; + } + } + + return true; +} + + inline bool Foam::boundBox::contains(const point& pt) const { return diff --git a/src/OpenFOAM/meshes/lduMesh/lduMesh.C b/src/OpenFOAM/meshes/lduMesh/lduMesh.C index 44330226b199385ddc334c8dcae58c750e973961..2ab4cfe04650c6a2989aba9f33450eaa966d44e5 100644 --- a/src/OpenFOAM/meshes/lduMesh/lduMesh.C +++ b/src/OpenFOAM/meshes/lduMesh/lduMesh.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::lduMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(lduMesh, 0); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H index b623b641f9001d0579d7c9f2e278fcb28c4127d3..36e6b45a1b238fc54c3d52bbd7799d44855ba683 100644 --- a/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.H +++ b/src/OpenFOAM/meshes/meshShapes/cellMatcher/cellMatcher.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 @@ -55,10 +55,10 @@ Description - find most unique face shape (e.g. triangle for prism) - walk (following either vertices in face or jumping from face to other face) to other faces and checking face sizes. - - if nessecary try other rotations of this face - (only nessecary for wedge, tet-wedge) - - if nessecary try other faces which most unique face shape - (never nessecary for hex degenerates) + - if necessary try other rotations of this face + (only necessary for wedge, tet-wedge) + - if necessary try other faces which most unique face shape + (never necessary for hex degenerates) The whole calculation is done such that no lists are allocated during cell checking. E.g. localFaces_ are always sized to hold max. number @@ -94,7 +94,7 @@ class cellShape; class cellModel; /*---------------------------------------------------------------------------*\ - Class cellMatcher Declaration + Class cellMatcher Declaration \*---------------------------------------------------------------------------*/ class cellMatcher diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index 17948c2b24a9c4239e1ecbd267262b4ea1c9b6e9..1d7ee06c2e99551f44e3f192216886d36a9cb5ce 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -28,6 +28,7 @@ License #include "triPointRef.H" #include "mathematicalConstants.H" #include "Swap.H" +#include "const_circulator.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -299,7 +300,6 @@ Foam::face::face(const triFace& f) // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - // return // 0: no match // +1: identical @@ -314,144 +314,89 @@ int Foam::face::compare(const face& a, const face& b) label sizeA = a.size(); label sizeB = b.size(); - if (sizeA != sizeB) + if (sizeA != sizeB || sizeA == 0) { return 0; } + const_circulator<face> aCirc(a); + const_circulator<face> bCirc(b); - // Full list comparison - const label firstA = a[0]; - label Bptr = -1; - - forAll(b, i) + // Rotate face b until its element matches the starting element of face a. + do { - if (b[i] == firstA) + if (aCirc() == bCirc()) { - Bptr = i; // 'found match' at element 'i' + // Set bCirc fulcrum to its iterator and increment the iterators + bCirc.setFulcrumToIterator(); + ++aCirc; + ++bCirc; + break; } - } + } while (bCirc.circulate(CirculatorBase::CLOCKWISE)); - // If no match was found, return 0 - if (Bptr < 0) + // If the circulator has stopped then faces a and b do not share a matching + // point + if (!bCirc.circulate()) { return 0; } - // Now we must look for the direction, if any - label secondA = a[1]; - - if (sizeA > 1 && (secondA == firstA || firstA == a[sizeA - 1])) + // Look forwards around the faces for a match + do { - face ca = a; - ca.collapse(); - - face cb = b; - cb.collapse(); - - return face::compare(ca, cb); - } - - int dir = 0; - - // Check whether at top of list - Bptr++; - if (Bptr == b.size()) - { - Bptr = 0; + if (aCirc() != bCirc()) + { + break; + } } + while + ( + aCirc.circulate(CirculatorBase::CLOCKWISE), + bCirc.circulate(CirculatorBase::CLOCKWISE) + ); - // Test whether upward label matches second A label - if (b[Bptr] == secondA) + // If the circulator has stopped then faces a and b matched. + if (!aCirc.circulate()) { - // Yes - direction is 'up' - dir = 1; + return 1; } else { - // No - so look downwards, checking whether at bottom of list - Bptr -= 2; - - if (Bptr < 0) - { - // wraparound - Bptr += b.size(); - } - - // Test whether downward label matches second A label - if (b[Bptr] == secondA) - { - // Yes - direction is 'down' - dir = -1; - } - } - - // Check whether a match was made at all, and exit 0 if not - if (dir == 0) - { - return 0; + // Reset the circulators back to their fulcrum + aCirc.setIteratorToFulcrum(); + bCirc.setIteratorToFulcrum(); + ++aCirc; + --bCirc; } - // Decrement size by 2 to account for first searches - sizeA -= 2; - - // We now have both direction of search and next element - // to search, so we can continue search until no more points. - label Aptr = 1; - if (dir > 0) + // Look backwards around the faces for a match + do { - while (sizeA--) + if (aCirc() != bCirc()) { - Aptr++; - if (Aptr >= a.size()) - { - Aptr = 0; - } - - Bptr++; - if (Bptr >= b.size()) - { - Bptr = 0; - } - - if (a[Aptr] != b[Bptr]) - { - return 0; - } + break; } } - else - { - while (sizeA--) - { - Aptr++; - if (Aptr >= a.size()) - { - Aptr = 0; - } - - Bptr--; - if (Bptr < 0) - { - Bptr = b.size() - 1; - } + while + ( + aCirc.circulate(CirculatorBase::CLOCKWISE), + bCirc.circulate(CirculatorBase::ANTICLOCKWISE) + ); - if (a[Aptr] != b[Bptr]) - { - return 0; - } - } + // If the circulator has stopped then faces a and b matched. + if (!aCirc.circulate()) + { + return -1; } - // They must be equal - return direction - return dir; + return 0; } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - Foam::label Foam::face::collapse() { if (size() > 1) @@ -633,27 +578,6 @@ Foam::face Foam::face::reverseFace() const } -Foam::face Foam::face::rotateFace(const label nPos) const -{ - const labelList& f = *this; - labelList newList(size()); - - forAll(f, fp) - { - label fp1 = (fp + nPos) % f.size(); - - if (fp1 < 0) - { - fp1 += f.size(); - } - - newList[fp1] = f[fp]; - } - - return face(xferMove(newList)); -} - - Foam::label Foam::face::which(const label globalIndex) const { const labelList& f = *this; diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index c9cd3724dcae999961d39a7d64200ca0152c2d1d..c481258a3cc2d1803cee7239354c32950eec1fc5 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -198,9 +198,6 @@ public: // The starting points of the original and reverse face are identical. face reverseFace() const; - //- Rotate face by number of positions - face rotateFace(const label nPos) const; - //- Navigation through face vertices //- Which vertex on face (face index given a global index) diff --git a/src/OpenFOAM/meshes/meshTools/matchPoints.C b/src/OpenFOAM/meshes/meshTools/matchPoints.C index 0dababace8ed2502856751f76324b42f412ad29a..d309e8e501f8c4bed7696984bcebb42997e82a02 100644 --- a/src/OpenFOAM/meshes/meshTools/matchPoints.C +++ b/src/OpenFOAM/meshes/meshTools/matchPoints.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 @@ -124,7 +124,8 @@ bool Foam::matchPoints { label faceI = pts1MagSqr.indices()[j]; - Pout<< " Compared coord:" << pts1[faceI] + Pout<< " Compared coord: " << pts1[faceI] + << " at index " << j << " with difference to point " << mag(pts1[faceI] - pts0[face0I]) << endl; } @@ -137,4 +138,133 @@ bool Foam::matchPoints return fullMatch; } + +bool Foam::matchPoints +( + const UList<point>& pts0, + const UList<point>& pts1, + const UList<point>& pts0Dir, + const UList<point>& pts1Dir, + const UList<scalar>& matchDistances, + const bool verbose, + labelList& from0To1, + const point& origin +) +{ + from0To1.setSize(pts0.size()); + from0To1 = -1; + + bool fullMatch = true; + + point compareOrigin = origin; + + if (origin == point(VGREAT, VGREAT, VGREAT)) + { + if (pts1.size()) + { + compareOrigin = sum(pts1)/pts1.size(); + } + } + + SortableList<scalar> pts0MagSqr(magSqr(pts0 - compareOrigin)); + + SortableList<scalar> pts1MagSqr(magSqr(pts1 - compareOrigin)); + + forAll(pts0MagSqr, i) + { + scalar dist0 = pts0MagSqr[i]; + + label face0I = pts0MagSqr.indices()[i]; + + scalar matchDist = matchDistances[face0I]; + + label startI = findLower(pts1MagSqr, 0.99999*dist0 - 2*matchDist); + + if (startI == -1) + { + startI = 0; + } + + // Go through range of equal mag and find nearest vector. + scalar minDistSqr = VGREAT; + scalar minDistNorm = 0; + label minFaceI = -1; + + for + ( + label j = startI; + ( + (j < pts1MagSqr.size()) + && (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist) + ); + j++ + ) + { + label faceI = pts1MagSqr.indices()[j]; + // Compare actual vectors + scalar distSqr = magSqr(pts0[face0I] - pts1[faceI]); + + scalar distNorm = (pts0Dir[face0I] & pts1Dir[faceI]); + + if + ( + magSqr(pts0Dir[face0I]) < sqr(SMALL) + && magSqr(pts1Dir[faceI]) < sqr(SMALL) + ) + { + distNorm = -1; + } + + if (distSqr <= sqr(matchDist) && distSqr < minDistSqr) + { + // Check that the normals point in equal and opposite directions + if (distNorm < minDistNorm) + { + minDistNorm = distNorm; + minDistSqr = distSqr; + minFaceI = faceI; + } + } + } + + if (minFaceI == -1) + { + fullMatch = false; + + if (verbose) + { + Pout<< "Cannot find point in pts1 matching point " << face0I + << " coord:" << pts0[face0I] + << " in pts0 when using tolerance " << matchDist << endl; + + // Go through range of equal mag and find equal vector. + Pout<< "Searching started from:" << startI << " in pts1" + << endl; + for + ( + label j = startI; + ( + (j < pts1MagSqr.size()) + && (pts1MagSqr[j] < 1.00001*dist0 + 2*matchDist) + ); + j++ + ) + { + label faceI = pts1MagSqr.indices()[j]; + + Pout<< " Compared coord: " << pts1[faceI] + << " at index " << j + << " with difference to point " + << mag(pts1[faceI] - pts0[face0I]) << endl; + } + } + } + + from0To1[face0I] = minFaceI; + } + + return fullMatch; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshTools/matchPoints.H b/src/OpenFOAM/meshes/meshTools/matchPoints.H index cf61c82d4dca589a94b28283c0347bb155d4c5ff..99dc18762a42c9037eac59bc318f9d097277b007 100644 --- a/src/OpenFOAM/meshes/meshTools/matchPoints.H +++ b/src/OpenFOAM/meshes/meshTools/matchPoints.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 @@ -59,6 +59,24 @@ bool matchPoints const point& origin = point::zero ); + +//- Supply pts0Dir and pts1Dir. They are directions associated with the points +// e.g., a face normal associated with each face centre. +// A match between similar points is only allowed if their directions are +// equal and opposite +bool matchPoints +( + const UList<point>& pts0, + const UList<point>& pts1, + const UList<point>& pts0Dir, + const UList<point>& pts1Dir, + const UList<scalar>& matchDistance, + const bool verbose, + labelList& from0To1, + const point& origin = point::zero +); + + } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C index e9a1382aad012ac1dcb68b64a118708045f1dce4..7e96f95087a24240ab7db8889f8436af46829b4d 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.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 @@ -30,7 +30,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::coupledPointPatch, 0); +namespace Foam +{ +defineTypeNameAndDebug(coupledPointPatch, 0); +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C index f537df68cd0faeed551a809a7b20467c4cdc8b10..3fb238c7186dc6756b8527c18d5fd0ab49f63591 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::coupledFacePointPatch, 0); +namespace Foam +{ +defineTypeNameAndDebug(coupledFacePointPatch, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C index e76e8b7a4c56be5e0a968fbb6ae8382a8a8858fd..c71d901678a36bc54d834a7e94533a9a42a452dd 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::pointPatch, 0); +namespace Foam +{ +defineTypeNameAndDebug(pointPatch, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 2122b282d7ff537630b9410f3c5bfcd22c2aa42c..2c0ae4c102b857fbbc9ef8c1b812f61b909cebdf 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -41,13 +41,13 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::globalMeshData, 0); +namespace Foam +{ +defineTypeNameAndDebug(globalMeshData, 0); // Geometric matching tolerance. Factor of mesh bounding box. -const Foam::scalar Foam::globalMeshData::matchTol_ = 1e-8; +const scalar globalMeshData::matchTol_ = 1e-8; -namespace Foam -{ template<> class minEqOp<labelPair> { @@ -881,7 +881,7 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const // the transformations. - // 1. collect point connectivity - basically recreating globalPoints ouput. + // 1. collect point connectivity - basically recreating globalPoints output. // All points will now have a string of points. The transforms are // in respect to the master. List<labelPairList> allPointConnectivity; diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H index 895daa91ab044b53ce4241d7f730a1b69220f43d..3d254c04ba3e2045101d070d379a6b603eb6fb63 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H @@ -51,7 +51,7 @@ Description The exchange needs - a field of data - a mapDistribute which does all parallel exchange and transformations - This appens remote data to the end of the field + This appends remote data to the end of the field. - a set of indices which indicate where to get untransformed data in the field - a set of indices which indicate where to get transformed data in the diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index b4333fc3a78f5bd236c11ac86e322772d86c3385..caad93731ceaeae68f0e87139d9864cb2ea006df 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -31,7 +31,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::globalPoints, 0); +namespace Foam +{ +defineTypeNameAndDebug(globalPoints, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C index 72d386d57b936ddba3be597c1cf0a3f1fa4fd626..a4ababac70b86497377234c18957b1c9f3fa86f2 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.C +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.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 @@ -33,7 +33,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::mapDistribute, 0); +namespace Foam +{ +defineTypeNameAndDebug(mapDistribute, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H index a6f388672a9df6d115d42e990c217b26380af524..2bad5824a133842c862c011dd024d5744fd6f0fe 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapPolyMesh.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,7 +47,7 @@ Description cell out of face, edge or point. - can be appended: added 'out of nothing'. - All this information is nessecary to correctly map fields. + All this information is necessary to correctly map fields. \par points @@ -153,7 +153,7 @@ namespace Foam class polyMesh; /*---------------------------------------------------------------------------*\ - Class mapPolyMesh Declaration + Class mapPolyMesh Declaration \*---------------------------------------------------------------------------*/ class mapPolyMesh diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index a54438f1051196d127671f8c5863285d8a25b7d4..c17e54be5365e9b2b41deeae1b18a6e6d8cec0dd 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -35,7 +35,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::polyBoundaryMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(polyBoundaryMesh, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -1078,7 +1081,11 @@ void Foam::polyBoundaryMesh::updateMesh() } -void Foam::polyBoundaryMesh::reorder(const labelUList& oldToNew) +void Foam::polyBoundaryMesh::reorder +( + const labelUList& oldToNew, + const bool validBoundary +) { // Change order of patches polyPatchList::reorder(oldToNew); @@ -1091,7 +1098,10 @@ void Foam::polyBoundaryMesh::reorder(const labelUList& oldToNew) patches[patchI].index() = patchI; } - updateMesh(); + if (validBoundary) + { + updateMesh(); + } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index 34f0a6d409b9751d98ac24e68a4b28acec14ff75..ad937a86fd4148826576907a85fac95d914dda06 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -219,9 +219,10 @@ public: //- Reorders patches. Ordering does not have to be done in // ascending or descending order. Reordering has to be unique. - // (is shuffle) Calls updateMesh() after reordering to recalculate - // data. - void reorder(const labelUList&); + // (is shuffle) If validBoundary calls updateMesh() + // after reordering to recalculate data (so call needs to be parallel + // sync in that case) + void reorder(const labelUList&, const bool validBoundary); //- writeData member function required by regIOobject bool writeData(Ostream&) const; diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C index c70b13211da097dc58292330c2270d11faa6dbfa..df0a21291d838572429ae60e52b14e54a6c5e6aa 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMeshEntries.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::polyBoundaryMeshEntries, 0); +namespace Foam +{ +defineTypeNameAndDebug(polyBoundaryMeshEntries, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 0f4f93f94003a164ab0f9b24fb220f678062d92d..8201254e0b3276e9945f652c854507042ff753ce 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -38,14 +38,19 @@ License #include "SubField.H" #include "pointMesh.H" +#include "Istream.H" +#include "Ostream.H" +#include "simpleRegIOobject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::polyMesh, 0); - +namespace Foam +{ +defineTypeNameAndDebug(polyMesh, 0); -Foam::word Foam::polyMesh::defaultRegion = "region0"; -Foam::word Foam::polyMesh::meshSubDir = "polyMesh"; +word polyMesh::defaultRegion = "region0"; +word polyMesh::meshSubDir = "polyMesh"; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -1118,7 +1123,7 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints if (debug) { // Check mesh motion - if (primitiveMesh::checkMeshMotion(points_, true)) + if (checkMeshMotion(points_, true)) { Info<< "tmp<scalarField> polyMesh::movePoints" << "(const pointField&) : " @@ -1173,6 +1178,8 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints ).movePoints(points_); } + const_cast<Time&>(time()).functionObjects().movePoints(*this); + return sweptVols; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index 09c046feb840f098c5a4fb80fd3533b13eb84987..e4c189767192ae87ddddc131ea0ea3e0d1068353 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -34,6 +34,7 @@ SourceFiles polyMeshFromShapeMesh.C polyMeshIO.C polyMeshUpdate.C + polyMeshCheck.C \*---------------------------------------------------------------------------*/ @@ -224,7 +225,45 @@ private: cellList& cells ); + // Geometry checks + //- Check non-orthogonality + bool checkFaceOrthogonality + ( + const vectorField& fAreas, + const vectorField& cellCtrs, + const bool report, + const bool detailedReport, + labelHashSet* setPtr + ) const; + + //- Check face skewness + bool checkFaceSkewness + ( + const pointField& points, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs, + const bool report, + const bool detailedReport, + labelHashSet* setPtr + ) const; + + bool checkEdgeAlignment + ( + const pointField& p, + const bool report, + const Vector<label>& directions, + labelHashSet* setPtr + ) const; + + bool checkCellDeterminant + ( + const vectorField& faceAreas, + const bool report, + labelHashSet* setPtr, + const Vector<label>& meshD + ) const; public: @@ -535,6 +574,48 @@ public: void removeFiles() const; + // Geometric checks. Selectively override primitiveMesh functionality. + + //- Check boundary for closedness + virtual bool checkClosedBoundary(const bool report = false) const; + + //- Check non-orthogonality + virtual bool checkFaceOrthogonality + ( + const bool report = false, + labelHashSet* setPtr = NULL + ) const; + + //- Check face skewness + virtual bool checkFaceSkewness + ( + const bool report = false, + labelHashSet* setPtr = NULL + ) const; + + //- Check edge alignment for 1D/2D cases + virtual bool checkEdgeAlignment + ( + const bool report, + const Vector<label>& directions, + labelHashSet* setPtr + ) const; + + virtual bool checkCellDeterminant + ( + const bool report, + labelHashSet* setPtr + ) const; + + //- Check mesh motion for correctness given motion points + virtual bool checkMeshMotion + ( + const pointField& newPoints, + const bool report = false, + const bool detailedReport = false + ) const; + + // Helper functions //- Find the cell, tetFaceI and tetPtI for the given position diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C new file mode 100644 index 0000000000000000000000000000000000000000..748c7da21a63f0b9d25acb21f34d5df839415ee0 --- /dev/null +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshCheck.C @@ -0,0 +1,679 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "polyMesh.H" +#include "polyMeshTools.H" +#include "unitConversion.H" +#include "syncTools.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::polyMesh::checkFaceOrthogonality +( + const vectorField& fAreas, + const vectorField& cellCtrs, + const bool report, + const bool detailedReport, + labelHashSet* setPtr +) const +{ + if (debug) + { + Info<< "bool polyMesh::checkFaceOrthogonality(" + << "const bool, labelHashSet*) const: " + << "checking mesh non-orthogonality" << endl; + } + + const labelList& own = faceOwner(); + const labelList& nei = faceNeighbour(); + + // Calculate orthogonality for all internal and coupled boundary faces + // (1 for uncoupled boundary faces) + tmp<scalarField> tortho = polyMeshTools::faceOrthogonality + ( + *this, + fAreas, + cellCtrs + ); + const scalarField& ortho = tortho(); + + // Severe nonorthogonality threshold + const scalar severeNonorthogonalityThreshold = + ::cos(degToRad(primitiveMesh::nonOrthThreshold_)); + + + scalar minDDotS = GREAT; + scalar sumDDotS = 0.0; + label nSummed = 0; + label severeNonOrth = 0; + label errorNonOrth = 0; + + + // Statistics only for internal and masters of coupled faces + PackedBoolList isMasterFace(syncTools::getInternalOrMasterFaces(*this)); + + forAll(ortho, faceI) + { + if (ortho[faceI] < severeNonorthogonalityThreshold) + { + if (ortho[faceI] > SMALL) + { + if (setPtr) + { + setPtr->insert(faceI); + } + + severeNonOrth++; + } + else + { + // Error : non-ortho too large + if (setPtr) + { + setPtr->insert(faceI); + } + if (detailedReport && errorNonOrth == 0) + { + // Non-orthogonality greater than 90 deg + WarningIn + ( + "polyMesh::checkFaceOrthogonality" + "(const pointField&, const bool) const" + ) << "Severe non-orthogonality for face " + << faceI + << " between cells " << own[faceI] + << " and " << nei[faceI] + << ": Angle = " << radToDeg(::acos(ortho[faceI])) + << " deg." << endl; + } + + errorNonOrth++; + } + } + + if (isMasterFace[faceI]) + { + minDDotS = min(minDDotS, ortho[faceI]); + sumDDotS += ortho[faceI]; + nSummed++; + } + } + + reduce(minDDotS, minOp<scalar>()); + reduce(sumDDotS, sumOp<scalar>()); + reduce(nSummed, sumOp<label>()); + reduce(severeNonOrth, sumOp<label>()); + reduce(errorNonOrth, sumOp<label>()); + + if (debug || report) + { + if (nSummed > 0) + { + if (debug || report) + { + Info<< " Mesh non-orthogonality Max: " + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/nSummed)) + << endl; + } + } + + if (severeNonOrth > 0) + { + Info<< " *Number of severely non-orthogonal faces: " + << severeNonOrth << "." << endl; + } + } + + if (errorNonOrth > 0) + { + if (debug || report) + { + Info<< " ***Number of non-orthogonality errors: " + << errorNonOrth << "." << endl; + } + + return true; + } + else + { + if (debug || report) + { + Info<< " Non-orthogonality check OK." << endl; + } + + return false; + } +} + + +bool Foam::polyMesh::checkFaceSkewness +( + const pointField& points, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs, + const bool report, + const bool detailedReport, + labelHashSet* setPtr +) const +{ + if (debug) + { + Info<< "bool polyMesh::checkFaceSkewnesss(" + << "const bool, labelHashSet*) const: " + << "checking face skewness" << endl; + } + + const labelList& own = faceOwner(); + const labelList& nei = faceNeighbour(); + + // Warn if the skew correction vector is more than skewWarning times + // larger than the face area vector + + tmp<scalarField> tskew = polyMeshTools::faceSkewness + ( + *this, + points, + fCtrs, + fAreas, + cellCtrs + ); + const scalarField& skew = tskew(); + + scalar maxSkew = max(skew); + label nWarnSkew = 0; + + // Statistics only for all faces except slave coupled faces + PackedBoolList isMasterFace(syncTools::getMasterFaces(*this)); + + forAll(skew, faceI) + { + // Check if the skewness vector is greater than the PN vector. + // This does not cause trouble but is a good indication of a poor mesh. + if (skew[faceI] > skewThreshold_) + { + if (setPtr) + { + setPtr->insert(faceI); + } + if (detailedReport && nWarnSkew == 0) + { + // Non-orthogonality greater than 90 deg + if (isInternalFace(faceI)) + { + WarningIn + ( + "polyMesh::checkFaceSkewnesss" + "(const pointField&, const bool) const" + ) << "Severe skewness " << skew[faceI] + << " for face " << faceI + << " between cells " << own[faceI] + << " and " << nei[faceI]; + } + else + { + WarningIn + ( + "polyMesh::checkFaceSkewnesss" + "(const pointField&, const bool) const" + ) << "Severe skewness " << skew[faceI] + << " for boundary face " << faceI + << " on cell " << own[faceI]; + } + } + + if (isMasterFace[faceI]) + { + nWarnSkew++; + } + } + } + + reduce(maxSkew, maxOp<scalar>()); + reduce(nWarnSkew, sumOp<label>()); + + if (nWarnSkew > 0) + { + if (debug || report) + { + Info<< " ***Max skewness = " << maxSkew + << ", " << nWarnSkew << " highly skew faces detected" + " which may impair the quality of the results" + << endl; + } + + return true; + } + else + { + if (debug || report) + { + Info<< " Max skewness = " << maxSkew << " OK." << endl; + } + + return false; + } +} + + +// Check 1D/2Dness of edges. Gets passed the non-empty directions and +// checks all edges in the mesh whether they: +// - have no component in a non-empty direction or +// - are only in a singe non-empty direction. +// Empty direction info is passed in as a vector of labels (synchronised) +// which are 1 if the direction is non-empty, 0 if it is. +bool Foam::polyMesh::checkEdgeAlignment +( + const pointField& p, + const bool report, + const Vector<label>& directions, + labelHashSet* setPtr +) const +{ + if (debug) + { + Info<< "bool polyMesh::checkEdgeAlignment(" + << "const bool, const Vector<label>&, labelHashSet*) const: " + << "checking edge alignment" << endl; + } + + label nDirs = 0; + for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) + { + if (directions[cmpt] == 1) + { + nDirs++; + } + else if (directions[cmpt] != 0) + { + FatalErrorIn + ( + "polyMesh::checkEdgeAlignment" + "(const bool, const Vector<label>&, labelHashSet*)" + ) << "directions should contain 0 or 1 but is now " << directions + << exit(FatalError); + } + } + + if (nDirs == vector::nComponents) + { + return false; + } + + + const faceList& fcs = faces(); + + EdgeMap<label> edgesInError; + + forAll(fcs, faceI) + { + const face& f = fcs[faceI]; + + forAll(f, fp) + { + label p0 = f[fp]; + label p1 = f.nextLabel(fp); + if (p0 < p1) + { + vector d(p[p1]-p[p0]); + scalar magD = mag(d); + + if (magD > ROOTVSMALL) + { + d /= magD; + + // Check how many empty directions are used by the edge. + label nEmptyDirs = 0; + label nNonEmptyDirs = 0; + for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) + { + if (mag(d[cmpt]) > 1e-6) + { + if (directions[cmpt] == 0) + { + nEmptyDirs++; + } + else + { + nNonEmptyDirs++; + } + } + } + + if (nEmptyDirs == 0) + { + // Purely in ok directions. + } + else if (nEmptyDirs == 1) + { + // Ok if purely in empty directions. + if (nNonEmptyDirs > 0) + { + edgesInError.insert(edge(p0, p1), faceI); + } + } + else if (nEmptyDirs > 1) + { + // Always an error + edgesInError.insert(edge(p0, p1), faceI); + } + } + } + } + } + + label nErrorEdges = returnReduce(edgesInError.size(), sumOp<label>()); + + if (nErrorEdges > 0) + { + if (debug || report) + { + Info<< " ***Number of edges not aligned with or perpendicular to " + << "non-empty directions: " << nErrorEdges << endl; + } + + if (setPtr) + { + setPtr->resize(2*edgesInError.size()); + forAllConstIter(EdgeMap<label>, edgesInError, iter) + { + setPtr->insert(iter.key()[0]); + setPtr->insert(iter.key()[1]); + } + } + + return true; + } + else + { + if (debug || report) + { + Info<< " All edges aligned with or perpendicular to " + << "non-empty directions." << endl; + } + return false; + } +} + + +bool Foam::polyMesh::checkCellDeterminant +( + const vectorField& faceAreas, + const bool report, + labelHashSet* setPtr, + const Vector<label>& meshD +) const +{ + if (debug) + { + Info<< "bool polyMesh::checkCellDeterminant(const bool" + << ", labelHashSet*) const: " + << "checking for under-determined cells" << endl; + } + + // Determine number of dimensions and (for 2D) missing dimension + label nDims = 0; + label twoD = -1; + for (direction dir = 0; dir < vector::nComponents; dir++) + { + if (meshD[dir] == 1) + { + nDims++; + } + else + { + twoD = dir; + } + } + + + tmp<scalarField> tcellDeterminant = primitiveMeshTools::cellDeterminant + ( + *this, + meshD, + faceAreas, + syncTools::getInternalOrCoupledFaces(*this) + ); + scalarField& cellDeterminant = tcellDeterminant(); + + + label nErrorCells = 0; + scalar minDet = min(cellDeterminant); + scalar sumDet = sum(cellDeterminant); + + forAll (cellDeterminant, cellI) + { + if (cellDeterminant[cellI] < 1e-3) + { + if (setPtr) + { + setPtr->insert(cellI); + } + + nErrorCells++; + } + } + + reduce(nErrorCells, sumOp<label>()); + reduce(minDet, minOp<scalar>()); + reduce(sumDet, sumOp<scalar>()); + label nSummed = returnReduce(cellDeterminant.size(), sumOp<label>()); + + if (debug || report) + { + if (nSummed > 0) + { + Info<< " Cell determinant (wellposedness) : minimum: " << minDet + << " average: " << sumDet/nSummed + << endl; + } + } + + if (nErrorCells > 0) + { + if (debug || report) + { + Info<< " ***Cells with small determinant found, number of cells: " + << nErrorCells << endl; + } + + return true; + } + else + { + if (debug || report) + { + Info<< " Cell determinant check OK." << endl; + } + + return false; + } + + return false; +} + + +bool Foam::polyMesh::checkClosedBoundary(const bool report) const +{ + return primitiveMesh::checkClosedBoundary + ( + faceAreas(), + report, + syncTools::getInternalOrCoupledFaces(*this) + ); +} + + +bool Foam::polyMesh::checkFaceOrthogonality +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkFaceOrthogonality + ( + faceAreas(), + cellCentres(), + report, + false, // detailedReport + setPtr + ); +} + + +bool Foam::polyMesh::checkFaceSkewness +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkFaceSkewness + ( + points(), + faceCentres(), + faceAreas(), + cellCentres(), + report, + false, // detailedReport + setPtr + ); +} + + +bool Foam::polyMesh::checkEdgeAlignment +( + const bool report, + const Vector<label>& directions, + labelHashSet* setPtr +) const +{ + return checkEdgeAlignment + ( + points(), + report, + directions, + setPtr + ); +} + + +bool Foam::polyMesh::checkCellDeterminant +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkCellDeterminant + ( + faceAreas(), + report, + setPtr, + geometricD() + ); +} + + +bool Foam::polyMesh::checkMeshMotion +( + const pointField& newPoints, + const bool report, + const bool detailedReport +) const +{ + if (debug || report) + { + Pout<< "bool polyMesh::checkMeshMotion(" + << "const pointField&, const bool, const bool) const: " + << "checking mesh motion" << endl; + } + + vectorField fCtrs(nFaces()); + vectorField fAreas(nFaces()); + + makeFaceCentresAndAreas(newPoints, fCtrs, fAreas); + + // Check cell volumes and calculate new cell centres + vectorField cellCtrs(nCells()); + scalarField cellVols(nCells()); + + makeCellCentresAndVols(fCtrs, fAreas, cellCtrs, cellVols); + + // Check cell volumes + bool error = checkCellVolumes + ( + cellVols, // vols + report, // report + detailedReport, // detailedReport + NULL // setPtr + ); + + + // Check face areas + bool areaError = checkFaceAreas + ( + faceAreas(), + report, // report + detailedReport, // detailedReport, + NULL // setPtr + ); + error = error || areaError; + + + // Check pyramid volumes + bool pyrVolError = checkFacePyramids + ( + newPoints, + cellCtrs, + report, // report, + detailedReport, // detailedReport, + -SMALL, // minPyrVol + NULL // setPtr + ); + error = error || pyrVolError; + + + // Check face non-orthogonality + bool nonOrthoError = checkFaceOrthogonality + ( + fAreas, + cellCtrs, + report, // report + detailedReport, // detailedReport + NULL // setPtr + ); + error = error || nonOrthoError; + + + if (!error && (debug || report)) + { + Pout<< "Mesh motion check OK." << endl; + } + + return error; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C new file mode 100644 index 0000000000000000000000000000000000000000..fc0739e79faf42d048b133d79b2a97f572b99388 --- /dev/null +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.C @@ -0,0 +1,190 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "polyMeshTools.H" +#include "syncTools.H" +#include "pyramidPointFaceRef.H" +#include "primitiveMeshTools.H" +#include "polyMeshTools.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceOrthogonality +( + const polyMesh& mesh, + const vectorField& areas, + const vectorField& cc +) +{ + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + tmp<scalarField> tortho(new scalarField(mesh.nFaces(), 1.0)); + scalarField& ortho = tortho(); + + // Internal faces + forAll(nei, faceI) + { + ortho[faceI] = primitiveMeshTools::faceOrthogonality + ( + cc[own[faceI]], + cc[nei[faceI]], + areas[faceI] + ); + } + + + // Coupled faces + + pointField neighbourCc; + syncTools::swapBoundaryCellList(mesh, cc, neighbourCc); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + if (pp.coupled()) + { + forAll(pp, i) + { + label faceI = pp.start() + i; + label bFaceI = faceI - mesh.nInternalFaces(); + + ortho[faceI] = primitiveMeshTools::faceOrthogonality + ( + cc[own[faceI]], + neighbourCc[bFaceI], + areas[faceI] + ); + } + } + } + + return tortho; +} + + +Foam::tmp<Foam::scalarField> Foam::polyMeshTools::faceSkewness +( + const polyMesh& mesh, + const pointField& p, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs +) +{ + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + const faceList& fcs = mesh.faces(); + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + tmp<scalarField> tskew(new scalarField(mesh.nFaces())); + scalarField& skew = tskew(); + + forAll(nei, faceI) + { + skew[faceI] = primitiveMeshTools::faceSkewness + ( + mesh, + p, + fCtrs, + fAreas, + + faceI, + cellCtrs[own[faceI]], + cellCtrs[nei[faceI]] + ); + } + + + // Boundary faces: consider them to have only skewness error. + // (i.e. treat as if mirror cell on other side) + + pointField neighbourCc; + syncTools::swapBoundaryCellList(mesh, cellCtrs, neighbourCc); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + if (pp.coupled()) + { + forAll(pp, i) + { + label faceI = pp.start() + i; + label bFaceI = faceI - mesh.nInternalFaces(); + + skew[faceI] = primitiveMeshTools::faceSkewness + ( + mesh, + p, + fCtrs, + fAreas, + + faceI, + cellCtrs[own[faceI]], + neighbourCc[bFaceI] + ); + } + } + else + { + forAll(pp, i) + { + label faceI = pp.start() + i; + + vector Cpf = fCtrs[faceI] - cellCtrs[own[faceI]]; + + vector normal = fAreas[faceI]; + normal /= mag(normal) + VSMALL; + vector d = normal*(normal & Cpf); + + + // Skewness vector + vector sv = + Cpf + - ((fAreas[faceI] & Cpf)/((fAreas[faceI] & d) + VSMALL))*d; + vector svHat = sv/(mag(sv) + VSMALL); + + // Normalisation distance calculated as the approximate distance + // from the face centre to the edge of the face in the direction + // of the skewness + scalar fd = 0.4*mag(d) + VSMALL; + const face& f = fcs[faceI]; + forAll(f, pi) + { + fd = max(fd, mag(svHat & (p[f[pi]] - fCtrs[faceI]))); + } + + // Normalised skewness + skew[faceI] = mag(sv)/fd; + } + } + } + + return tskew; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H new file mode 100644 index 0000000000000000000000000000000000000000..53c758c3be7967f5a914b39e7e0c12a50bbaf86c --- /dev/null +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshCheck/polyMeshTools.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Namespace + Foam::polyMeshTools + +Description + Collection of static functions operating on polyMesh (mainly checks) so + that need access to patch information. + +SourceFiles + polyMeshTools.C + +\*---------------------------------------------------------------------------*/ +#ifndef polyMeshTools_H +#define polyMeshTools_H + +#include "polyMesh.H" +#include "primitiveMeshTools.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Namespace polyMeshTools Declaration +\*---------------------------------------------------------------------------*/ + +class polyMeshTools +: + public primitiveMeshTools +{ + +public: + + //- Generate orthogonality field. (1 for fully orthogonal, < 1 for + // non-orthogonal) + static tmp<scalarField> faceOrthogonality + ( + const polyMesh& mesh, + const vectorField& fAreas, + const vectorField& cellCtrs + ); + +// static tmp<scalarField> faceOrthogonality(const polyMesh& mesh) +// { +// return faceOrthogonality +// ( +// mesh, +// mesh.faceAreas(), +// mesh.cellCentres() +// ); +// } + + //- Generate skewness field + static tmp<scalarField> faceSkewness + ( + const polyMesh& mesh, + const pointField& points, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs + ); + +// static tmp<scalarField> faceSkewness(const polyMesh& mesh) +// { +// return faceSkewness +// ( +// mesh, +// mesh.points(), +// mesh.faceCentres(), +// mesh.faceAreas(), +// mesh.cellCentres() +// ); +// } + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index 0fdce95e37a7945241119dc66d4590f03545b3f1..aa4d2bb4b5b1bf1614f99b77d3d20c7059dd41f0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -109,6 +109,8 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm) ) ).updateMesh(mpm); } + + const_cast<Time&>(time()).functionObjects().updateMesh(mpm); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index 4e433001344c7e53ff37432c552a839a12ade2d3..2ac3b52903d6241a8a8596b76e40eff4748b0f6f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -37,15 +37,16 @@ namespace Foam const scalar coupledPolyPatch::defaultMatchTol_ = 1e-4; template<> - const char* NamedEnum<coupledPolyPatch::transformType, 4>::names[] = + const char* NamedEnum<coupledPolyPatch::transformType, 5>::names[] = { "unknown", "rotational", "translational", + "coincidentFullMatch", "noOrdering" }; - const NamedEnum<coupledPolyPatch::transformType, 4> + const NamedEnum<coupledPolyPatch::transformType, 5> coupledPolyPatch::transformTypeNames; } @@ -129,14 +130,65 @@ void Foam::coupledPolyPatch::writeOBJ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints ( const UList<face>& faces, - const pointField& points + const pointField& points, + const transformType transform ) { pointField anchors(faces.size()); - forAll(faces, faceI) + if (transform == COINCIDENTFULLMATCH) { - anchors[faceI] = points[faces[faceI][0]]; + // Return the first point + forAll(faces, faceI) + { + anchors[faceI] = points[faces[faceI][0]]; + } + } + else + { + // Make anchor point unique + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + bool unique = true; + + forAll(f, fp1) + { + const point& p1 = points[f[fp1]]; + + unique = true; + + for (label fp2 = 0; fp2 < f.size(); ++fp2) + { + if (f[fp1] == f[fp2]) + { + continue; + } + + const point& p2 = points[f[fp2]]; + + // @todo Change to a tolerance and possibly select closest + // point to the origin + if (p1 == p2) + { + unique = false; + break; + } + } + + if (unique) + { + anchors[faceI] = p1; + break; + } + } + + if (!unique) + { + anchors[faceI] = points[faces[faceI][0]]; + } + } } return anchors; @@ -172,7 +224,12 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol maxLenSqr = max(maxLenSqr, magSqr(pt - cc)); maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt))); } - tols[faceI] = max(SMALL, max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr))); + + tols[faceI] = max + ( + SMALL, + max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr)) + ); } return tols; } @@ -230,7 +287,7 @@ Foam::label Foam::coupledPolyPatch::getRotation << Foam::sqrt(minDistSqr) << " to the anchor " << anchor << ". Continuing but results might be wrong." - << endl; + << nl << endl; } } @@ -292,7 +349,8 @@ void Foam::coupledPolyPatch::calcTransformTensors transform == ROTATIONAL || ( transform != TRANSLATIONAL - && (sum(mag(nf & nr)) < Cf.size()-error) + && transform != COINCIDENTFULLMATCH + && (sum(mag(nf & nr)) < Cf.size() - error) ) ) { @@ -427,11 +485,13 @@ Foam::coupledPolyPatch::coupledPolyPatch const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform ) : polyPatch(name, size, start, index, bm, patchType), - matchTolerance_(defaultMatchTol_) + matchTolerance_(defaultMatchTol_), + transform_(transform) {} @@ -445,7 +505,13 @@ Foam::coupledPolyPatch::coupledPolyPatch ) : polyPatch(name, dict, index, bm, patchType), - matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)) + matchTolerance_(dict.lookupOrDefault("matchTolerance", defaultMatchTol_)), + transform_ + ( + dict.found("transform") + ? transformTypeNames.read(dict.lookup("transform")) + : UNKNOWN + ) {} @@ -456,7 +522,8 @@ Foam::coupledPolyPatch::coupledPolyPatch ) : polyPatch(pp, bm), - matchTolerance_(pp.matchTolerance_) + matchTolerance_(pp.matchTolerance_), + transform_(pp.transform_) {} @@ -470,7 +537,8 @@ Foam::coupledPolyPatch::coupledPolyPatch ) : polyPatch(pp, bm, index, newSize, newStart), - matchTolerance_(pp.matchTolerance_) + matchTolerance_(pp.matchTolerance_), + transform_(pp.transform_) {} @@ -484,7 +552,8 @@ Foam::coupledPolyPatch::coupledPolyPatch ) : polyPatch(pp, bm, index, mapAddressing, newStart), - matchTolerance_(pp.matchTolerance_) + matchTolerance_(pp.matchTolerance_), + transform_(pp.transform_) {} @@ -503,6 +572,8 @@ void Foam::coupledPolyPatch::write(Ostream& os) const { os.writeKeyword("matchTolerance") << matchTolerance_ << token::END_STATEMENT << nl; + os.writeKeyword("transform") << transformTypeNames[transform_] + << token::END_STATEMENT << nl; } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 7cb56879c4499dd9ead77db3bd4c5c4aea85f393..0208dacb47811e393a7b43d9274ecc00d93b2e50 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -60,9 +60,12 @@ public: UNKNOWN, // unspecified; automatic ordering ROTATIONAL, // rotation along coordinate axis TRANSLATIONAL, // translation + COINCIDENTFULLMATCH,// assume no transforms + // and check the points in faces match NOORDERING // unspecified, no automatic ordering }; - static const NamedEnum<transformType, 4> transformTypeNames; + + static const NamedEnum<transformType, 5> transformTypeNames; private: @@ -75,6 +78,9 @@ private: //- local matching tolerance const scalar matchTolerance_; + //- Type of transformation + transformType transform_; + //- offset (distance) vector from one side of the couple to the other mutable vectorField separation_; @@ -150,11 +156,12 @@ protected: label& vertI ); - //- Get f[0] for all faces + //- Get a unique anchor point for all faces static pointField getAnchorPoints ( const UList<face>&, - const pointField& + const pointField&, + const transformType ); //- Get the number of vertices face f needs to be rotated such that @@ -184,7 +191,8 @@ public: const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform ); //- Construct from dictionary @@ -245,6 +253,20 @@ public: return !owner(); } + //- Type of transform + virtual transformType transform() const + { + return transform_; + } + + //- Type of transform + // This is currently only for use when collapsing generated + // meshes that can have zero area faces. + virtual transformType& transform() + { + return transform_; + } + //- Transform a patch-based position from other side to this side virtual void transformPosition(pointField&) const = 0; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index ce8f260382f7d980ac6068d84e26ee4f1cf2a6e9..730fa402490fc6f162329fc9a32c4eee82afcd4c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -164,16 +164,16 @@ void Foam::cyclicPolyPatch::calcTransforms << exit(FatalError); } - if (transform_ != neighbPatch().transform_) + if (transform() != neighbPatch().transform()) { FatalErrorIn ( "cyclicPolyPatch::calcTransforms()" ) << "Patch " << name() - << " has transform type " << transformTypeNames[transform_] + << " has transform type " << transformTypeNames[transform()] << ", neighbour patch " << neighbPatchName_ << " has transform type " - << neighbPatch().transformTypeNames[transform_] + << neighbPatch().transformTypeNames[neighbPatch().transform()] << exit(FatalError); } @@ -261,7 +261,7 @@ void Foam::cyclicPolyPatch::calcTransforms // Calculate transformation tensors - if (transform_ == ROTATIONAL) + if (transform() == ROTATIONAL) { // Calculate using the given rotation axis and centre. Do not // use calculated normals. @@ -320,11 +320,11 @@ void Foam::cyclicPolyPatch::calcTransforms half1Normals, half0Tols, matchTolerance(), - transform_ + transform() ); - if (transform_ == TRANSLATIONAL) + if (transform() == TRANSLATIONAL) { if (debug) { @@ -406,7 +406,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors { // Get geometric data on both halves. half0Ctrs = pp0.faceCentres(); - anchors0 = getAnchorPoints(pp0, pp0.points()); + anchors0 = getAnchorPoints(pp0, pp0.points(), transform()); half1Ctrs = pp1.faceCentres(); if (debug) @@ -421,7 +421,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors if (half0Ctrs.size()) { - switch (transform_) + switch (transform()) { case ROTATIONAL: { @@ -601,13 +601,13 @@ Foam::cyclicPolyPatch::cyclicPolyPatch const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform ) : - coupledPolyPatch(name, size, start, index, bm, patchType), + coupledPolyPatch(name, size, start, index, bm, patchType, transform), neighbPatchName_(word::null), neighbPatchID_(-1), - transform_(UNKNOWN), rotationAxis_(vector::zero), rotationCentre_(point::zero), separationVector_(vector::zero), @@ -633,10 +633,9 @@ Foam::cyclicPolyPatch::cyclicPolyPatch const vector& separationVector ) : - coupledPolyPatch(name, size, start, index, bm, typeName), + coupledPolyPatch(name, size, start, index, bm, typeName, transform), neighbPatchName_(neighbPatchName), neighbPatchID_(-1), - transform_(transform), rotationAxis_(rotationAxis), rotationCentre_(rotationCentre), separationVector_(separationVector), @@ -660,7 +659,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch coupledPolyPatch(name, dict, index, bm, patchType), neighbPatchName_(dict.lookupOrDefault("neighbourPatch", word::null)), neighbPatchID_(-1), - transform_(UNKNOWN), rotationAxis_(vector::zero), rotationCentre_(point::zero), separationVector_(vector::zero), @@ -693,37 +691,33 @@ Foam::cyclicPolyPatch::cyclicPolyPatch << exit(FatalIOError); } - if (dict.found("transform")) + switch (transform()) { - transform_ = transformTypeNames.read(dict.lookup("transform")); - switch (transform_) + case ROTATIONAL: { - case ROTATIONAL: - { - dict.lookup("rotationAxis") >> rotationAxis_; - dict.lookup("rotationCentre") >> rotationCentre_; - - scalar magRot = mag(rotationAxis_); - if (magRot < SMALL) - { - FatalIOErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)", dict) - << "Illegal rotationAxis " << rotationAxis_ << endl - << "Please supply a non-zero vector." - << exit(FatalIOError); - } - rotationAxis_ /= magRot; + dict.lookup("rotationAxis") >> rotationAxis_; + dict.lookup("rotationCentre") >> rotationCentre_; - break; - } - case TRANSLATIONAL: - { - dict.lookup("separationVector") >> separationVector_; - break; - } - default: + scalar magRot = mag(rotationAxis_); + if (magRot < SMALL) { - // no additional info required + FatalIOErrorIn("cyclicPolyPatch::cyclicPolyPatch(..)", dict) + << "Illegal rotationAxis " << rotationAxis_ << endl + << "Please supply a non-zero vector." + << exit(FatalIOError); } + rotationAxis_ /= magRot; + + break; + } + case TRANSLATIONAL: + { + dict.lookup("separationVector") >> separationVector_; + break; + } + default: + { + // no additional info required } } @@ -741,7 +735,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch coupledPolyPatch(pp, bm), neighbPatchName_(pp.neighbPatchName()), neighbPatchID_(-1), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_), @@ -766,7 +759,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch coupledPolyPatch(pp, bm, index, newSize, newStart), neighbPatchName_(neighbPatchName), neighbPatchID_(-1), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_), @@ -798,7 +790,6 @@ Foam::cyclicPolyPatch::cyclicPolyPatch coupledPolyPatch(pp, bm, index, mapAddressing, newStart), neighbPatchName_(pp.neighbPatchName_), neighbPatchID_(-1), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_), @@ -857,7 +848,7 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const { if (!parallel()) { - if (transform_ == ROTATIONAL) + if (transform() == ROTATIONAL) { l = Foam::transform(forwardT(), l-rotationCentre_) @@ -900,7 +891,7 @@ void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const : forwardT()[facei] ); - if (transform_ == ROTATIONAL) + if (transform() == ROTATIONAL) { l = Foam::transform(T, l-rotationCentre_) + rotationCentre_; } @@ -1274,7 +1265,7 @@ bool Foam::cyclicPolyPatch::order rotation.setSize(pp.size()); rotation = 0; - if (transform_ == NOORDERING) + if (transform() == NOORDERING) { // No faces, nothing to change. return false; @@ -1455,12 +1446,10 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const coupledPolyPatch::write(os); os.writeKeyword("neighbourPatch") << neighbPatchName_ << token::END_STATEMENT << nl; - switch (transform_) + switch (transform()) { case ROTATIONAL: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; os.writeKeyword("rotationAxis") << rotationAxis_ << token::END_STATEMENT << nl; os.writeKeyword("rotationCentre") << rotationCentre_ @@ -1469,16 +1458,12 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const } case TRANSLATIONAL: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; os.writeKeyword("separationVector") << separationVector_ << token::END_STATEMENT << nl; break; } case NOORDERING: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; break; } default: diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H index f2f1c49a870a925396740cb5336f7d11f516a88f..8f094da8cf9a5559dc4bdff15cec9ac9c3da56b4 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.H @@ -72,9 +72,6 @@ class cyclicPolyPatch //- Index of other half mutable label neighbPatchID_; - //- Type of transformation - rotational or translational - transformType transform_; - // For rotation //- Axis of rotation for rotational cyclics @@ -202,7 +199,8 @@ public: const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform = UNKNOWN ); //- Construct from components @@ -371,12 +369,6 @@ public: } } - //- Type of transform - transformType transform() const - { - return transform_; - } - //- Axis of rotation for rotational cyclics const vector& rotationAxis() const { diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicSlip/cyclicSlipPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicSlip/cyclicSlipPolyPatch.H index fc2de2d14f586e7b377bbf9a57f57aabc3266cd5..9eed97fafe60824c3a996e1fb3c586d10b04547d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicSlip/cyclicSlipPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclicSlip/cyclicSlipPolyPatch.H @@ -68,10 +68,11 @@ public: const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform = UNKNOWN ) : - cyclicPolyPatch(name, size, start, index, bm, patchType) + cyclicPolyPatch(name, size, start, index, bm, patchType, transform) {} //- Construct from dictionary diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H index 8ed56b38787cecb5e5b841f6292677c0ef45fdf7..75431fdaa8250d9dc83ef6aace600e2c346161e9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/nonuniformTransformCyclic/nonuniformTransformCyclicPolyPatch.H @@ -68,10 +68,11 @@ public: const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform = UNKNOWN ) : - cyclicPolyPatch(name, size, start, index, bm, patchType) + cyclicPolyPatch(name, size, start, index, bm, patchType, transform) {} //- Construct from dictionary diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C index 7dc587bbfe5ec7b1533ac501705558505f6a5d89..d9b95491154f5fd06c3c43b1816171beaa3fed6b 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C @@ -43,23 +43,8 @@ namespace Foam addToRunTimeSelectionTable(polyPatch, oldCyclicPolyPatch, word); addToRunTimeSelectionTable(polyPatch, oldCyclicPolyPatch, dictionary); - - template<> - const char* Foam::NamedEnum - < - Foam::oldCyclicPolyPatch::transformType, - 3 - >::names[] = - { - "unknown", - "rotational", - "translational" - }; } -const Foam::NamedEnum<Foam::oldCyclicPolyPatch::transformType, 3> - Foam::oldCyclicPolyPatch::transformTypeNames; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Foam::pointField Foam::oldCyclicPolyPatch::calcFaceCentres @@ -321,7 +306,7 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors anchors0 = getAnchorPoints(half0Faces, pp.points()); half1Ctrs = calcFaceCentres(half1Faces, pp.points()); - switch (transform_) + switch (transform()) { case ROTATIONAL: { @@ -588,12 +573,12 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform ) : - coupledPolyPatch(name, size, start, index, bm, patchType), + coupledPolyPatch(name, size, start, index, bm, patchType, transform), featureCos_(0.9), - transform_(UNKNOWN), rotationAxis_(vector::zero), rotationCentre_(point::zero), separationVector_(vector::zero) @@ -611,7 +596,6 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch : coupledPolyPatch(name, dict, index, bm, patchType), featureCos_(0.9), - transform_(UNKNOWN), rotationAxis_(vector::zero), rotationCentre_(point::zero), separationVector_(vector::zero) @@ -638,26 +622,22 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch dict.readIfPresent("featureCos", featureCos_); - if (dict.found("transform")) + switch (transform()) { - transform_ = transformTypeNames.read(dict.lookup("transform")); - switch (transform_) + case ROTATIONAL: { - case ROTATIONAL: - { - dict.lookup("rotationAxis") >> rotationAxis_; - dict.lookup("rotationCentre") >> rotationCentre_; - break; - } - case TRANSLATIONAL: - { - dict.lookup("separationVector") >> separationVector_; - break; - } - default: - { - // no additional info required - } + dict.lookup("rotationAxis") >> rotationAxis_; + dict.lookup("rotationCentre") >> rotationCentre_; + break; + } + case TRANSLATIONAL: + { + dict.lookup("separationVector") >> separationVector_; + break; + } + default: + { + // no additional info required } } } @@ -671,7 +651,6 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch : coupledPolyPatch(pp, bm), featureCos_(pp.featureCos_), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_) @@ -689,7 +668,6 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch : coupledPolyPatch(pp, bm, index, newSize, newStart), featureCos_(pp.featureCos_), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_) @@ -1269,12 +1247,10 @@ void Foam::oldCyclicPolyPatch::write(Ostream& os) const os.writeKeyword("featureCos") << featureCos_ << token::END_STATEMENT << nl; - switch (transform_) + switch (transform()) { case ROTATIONAL: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; os.writeKeyword("rotationAxis") << rotationAxis_ << token::END_STATEMENT << nl; os.writeKeyword("rotationCentre") << rotationCentre_ @@ -1283,8 +1259,6 @@ void Foam::oldCyclicPolyPatch::write(Ostream& os) const } case TRANSLATIONAL: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; os.writeKeyword("separationVector") << separationVector_ << token::END_STATEMENT << nl; break; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H index 5d996988c21ca2200a4774d3270597b2a4ed46a6..e238154f98d47f306f9475a941becaa33d6571a6 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.H @@ -54,27 +54,12 @@ class oldCyclicPolyPatch : public coupledPolyPatch { -public: - - enum transformType - { - UNKNOWN, - ROTATIONAL, - TRANSLATIONAL - }; - static const NamedEnum<transformType, 3> transformTypeNames; - - -private: - // Private data //- Morph:angle between normals of neighbouring faces. // Used to split cyclic into halves. scalar featureCos_; - //- Type of transformation - rotational or translational - transformType transform_; // For rotation @@ -199,7 +184,8 @@ public: const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform = UNKNOWN ); //- Construct from dictionary diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 05664dd6eaf3b29574df1a37d6539f8d273428fc..5da47a6ce4c0b8c1e64e22dff61d22f12e7b207d 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -34,6 +34,7 @@ License #include "Time.H" #include "transformList.H" #include "PstreamBuffers.H" +#include "const_circulator.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,10 +55,11 @@ Foam::processorPolyPatch::processorPolyPatch const label index, const polyBoundaryMesh& bm, const int myProcNo, - const int neighbProcNo + const int neighbProcNo, + const transformType transform ) : - coupledPolyPatch(name, size, start, index, bm, typeName), + coupledPolyPatch(name, size, start, index, bm, typeName, transform), myProcNo_(myProcNo), neighbProcNo_(neighbProcNo), neighbFaceCentres_(), @@ -173,7 +175,6 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) >> neighbFaceCellCentres_; } - // My normals vectorField faceNormals(size()); @@ -181,8 +182,7 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) vectorField nbrFaceNormals(neighbFaceAreas_.size()); // Face match tolerances - scalarField tols = - calcFaceTol(*this, points(), faceCentres()); + scalarField tols = calcFaceTol(*this, points(), faceCentres()); // Calculate normals from areas and check forAll(faceNormals, facei) @@ -191,13 +191,15 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) scalar nbrMagSf = mag(neighbFaceAreas_[facei]); scalar avSf = (magSf + nbrMagSf)/2.0; - if (magSf < ROOTVSMALL && nbrMagSf < ROOTVSMALL) + // For small face area calculation the results of the area + // calculation have been found to only be accurate to ~1e-20 + if (magSf < SMALL && nbrMagSf < SMALL) { // Undetermined normal. Use dummy normal to force separation - // check. (note use of sqrt(VSMALL) since that is how mag - // scales) + // check. faceNormals[facei] = point(1, 0, 0); - nbrFaceNormals[facei] = faceNormals[facei]; + nbrFaceNormals[facei] = -faceNormals[facei]; + tols[facei] = GREAT; } else if (mag(magSf - nbrMagSf) > matchTolerance()*sqr(tols[facei])) { @@ -271,7 +273,8 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) faceNormals, nbrFaceNormals, matchTolerance()*tols, - matchTolerance() + matchTolerance(), + transform() ); } } @@ -391,6 +394,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs) { // Find face and index in face on this side. const face& f = localFaces()[nbrPointFace[nbrPointI]]; + label index = (f.size() - nbrPointIndex[nbrPointI]) % f.size(); label patchPointI = f[index]; @@ -486,7 +490,11 @@ void Foam::processorPolyPatch::initOrder const primitivePatch& pp ) const { - if (!Pstream::parRun()) + if + ( + !Pstream::parRun() + || transform() == NOORDERING + ) { return; } @@ -522,15 +530,154 @@ void Foam::processorPolyPatch::initOrder if (owner()) { - pointField anchors(getAnchorPoints(pp, pp.points())); + if (transform() == COINCIDENTFULLMATCH) + { + // Pass the patch points and faces across + UOPstream toNeighbour(neighbProcNo(), pBufs); + toNeighbour << pp.localPoints() + << pp.localFaces(); + } + else + { + const pointField& ppPoints = pp.points(); + + pointField anchors(getAnchorPoints(pp, ppPoints, transform())); - // Now send all info over to the neighbour - UOPstream toNeighbour(neighbProcNo(), pBufs); - toNeighbour << pp.faceCentres() << anchors; + // Get the average of the points of each face. This is needed in + // case the face centroid calculation is incorrect due to the face + // having a very high aspect ratio. + pointField facePointAverages(pp.size(), point::zero); + forAll(pp, fI) + { + const labelList& facePoints = pp[fI]; + + forAll(facePoints, pI) + { + facePointAverages[fI] += ppPoints[facePoints[pI]]; + } + + facePointAverages[fI] /= facePoints.size(); + } + + // Now send all info over to the neighbour + UOPstream toNeighbour(neighbProcNo(), pBufs); + toNeighbour << pp.faceCentres() << pp.faceNormals() + << anchors << facePointAverages; + } } } +// Returns rotation. +// + -1 : no match +// + 0 : match +// + >0 : match if rotated clockwise by this amount +Foam::label Foam::processorPolyPatch::matchFace +( + const face& a, + const pointField& aPts, + const face& b, + const pointField& bPts, + const bool sameOrientation, + const scalar absTolSqr, + scalar& matchDistSqr +) +{ + if (a.size() != b.size()) + { + return -1; + } + + enum CirculatorBase::direction circulateDirection + = CirculatorBase::CLOCKWISE; + + if (!sameOrientation) + { + circulateDirection = CirculatorBase::ANTICLOCKWISE; + } + + label matchFp = -1; + + scalar closestMatchDistSqr = sqr(GREAT); + + const_circulator<face> aCirc(a); + const_circulator<face> bCirc(b); + + do + { + const scalar diffSqr = magSqr(aPts[aCirc()] - bPts[bCirc()]); + + if (diffSqr < absTolSqr) + { + // Found a matching point. Set the fulcrum of b to the iterator + const_circulator<face> bCirc2 = bCirc; + ++aCirc; + + bCirc2.setFulcrumToIterator(); + + if (!sameOrientation) + { + --bCirc2; + } + else + { + ++bCirc2; + } + + matchDistSqr = diffSqr; + + do + { + const scalar diffSqr2 = magSqr(aPts[aCirc()] - bPts[bCirc2()]); + + if (diffSqr2 > absTolSqr) + { + // No match. + break; + } + + matchDistSqr += diffSqr2; + } + while + ( + aCirc.circulate(CirculatorBase::CLOCKWISE), + bCirc2.circulate(circulateDirection) + ); + + if (!aCirc.circulate()) + { + if (matchDistSqr < closestMatchDistSqr) + { + closestMatchDistSqr = matchDistSqr; + + if (!sameOrientation) + { + matchFp = a.size() - bCirc.nRotations(); + } + else + { + matchFp = bCirc.nRotations(); + } + + if (closestMatchDistSqr == 0) + { + break; + } + } + } + + // Reset aCirc + aCirc.setIteratorToFulcrum(); + } + + } while (bCirc.circulate(circulateDirection)); + + matchDistSqr = closestMatchDistSqr; + + return matchFp; +} + + // Return new ordering. Ordering is -faceMap: for every face index // the new face -rotation:for every new face the clockwise shift // of the original face. Return false if nothing changes (faceMap @@ -545,7 +692,11 @@ bool Foam::processorPolyPatch::order { // Note: we only get the faces that originate from internal faces. - if (!Pstream::parRun()) + if + ( + !Pstream::parRun() + || transform() == NOORDERING + ) { return false; } @@ -556,6 +707,8 @@ bool Foam::processorPolyPatch::order rotation.setSize(pp.size()); rotation = 0; + bool change = false; + if (owner()) { // Do nothing (i.e. identical mapping, zero rotation). @@ -565,176 +718,363 @@ bool Foam::processorPolyPatch::order faceMap[patchFaceI] = patchFaceI; } - return false; - } - else - { - vectorField masterCtrs; - vectorField masterAnchors; - - // Receive data from neighbour + if (transform() != COINCIDENTFULLMATCH) { - UIPstream fromNeighbour(neighbProcNo(), pBufs); - fromNeighbour >> masterCtrs >> masterAnchors; - } + const pointField& ppPoints = pp.points(); - // Calculate typical distance from face centre - scalarField tols - ( - matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres()) - ); + pointField anchors(getAnchorPoints(pp, ppPoints, transform())); - if (debug || masterCtrs.size() != pp.size()) - { + // Calculate typical distance from face centre + scalarField tols + ( + matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres()) + ); + + forAll(faceMap, patchFaceI) { - OFstream nbrStr + const point& wantedAnchor = anchors[patchFaceI]; + + rotation[patchFaceI] = getRotation ( - boundaryMesh().mesh().time().path() - /name() + "_nbrFaceCentres.obj" + ppPoints, + pp[patchFaceI], + wantedAnchor, + tols[patchFaceI] ); - Pout<< "processorPolyPatch::order : " - << "Dumping neighbour faceCentres to " << nbrStr.name() - << endl; - forAll(masterCtrs, faceI) + + if (rotation[patchFaceI] > 0) { - writeOBJ(nbrStr, masterCtrs[faceI]); + change = true; } } + } + + return change; + } + else + { + if (transform() == COINCIDENTFULLMATCH) + { + vectorField masterPts; + faceList masterFaces; - if (masterCtrs.size() != pp.size()) { - FatalErrorIn - ( - "processorPolyPatch::order(const primitivePatch&" - ", labelList&, labelList&) const" - ) << "in patch:" << name() << " : " - << "Local size of patch is " << pp.size() << " (faces)." - << endl - << "Received from neighbour " << masterCtrs.size() - << " faceCentres!" - << abort(FatalError); + UIPstream fromNeighbour(neighbProcNo(), pBufs); + fromNeighbour >> masterPts >> masterFaces; } - } - // Geometric match of face centre vectors - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const pointField& localPts = pp.localPoints(); + const faceList& localFaces = pp.localFaces(); - // 1. Try existing ordering and transformation - bool matchedAll = matchPoints - ( - pp.faceCentres(), - masterCtrs, - tols, - true, - faceMap - ); + label nMatches = 0; + + forAll(pp, lFaceI) + { + const face& localFace = localFaces[lFaceI]; + label faceRotation = -1; + + const scalar absTolSqr = sqr(SMALL); + + scalar closestMatchDistSqr = sqr(GREAT); + scalar matchDistSqr = sqr(GREAT); + label closestFaceMatch = -1; + label closestFaceRotation = -1; + + forAll(masterFaces, mFaceI) + { + const face& masterFace = masterFaces[mFaceI]; + + faceRotation = matchFace + ( + localFace, + localPts, + masterFace, + masterPts, + false, + absTolSqr, + matchDistSqr + ); + + if + ( + faceRotation != -1 + && matchDistSqr < closestMatchDistSqr + ) + { + closestMatchDistSqr = matchDistSqr; + closestFaceMatch = mFaceI; + closestFaceRotation = faceRotation; + } + + if (closestMatchDistSqr == 0) + { + break; + } + } + + if (closestFaceRotation != -1 && closestMatchDistSqr == 0) + { + faceMap[lFaceI] = closestFaceMatch; + + rotation[lFaceI] = closestFaceRotation; + + if (lFaceI != closestFaceMatch || closestFaceRotation > 0) + { + change = true; + } - if (!matchedAll || debug) + nMatches++; + } + else + { + Pout<< "Number of matches = " << nMatches << " / " + << pp.size() << endl; + + pointField pts(localFace.size()); + forAll(localFace, pI) + { + const label localPtI = localFace[pI]; + pts[pI] = localPts[localPtI]; + } + + FatalErrorIn("Foam::processorPolyPatch::order(...) const") + << "No match for face " << localFace << nl << pts + << abort(FatalError); + } + } + + return change; + } + else { - // Dump faces - fileName str + vectorField masterCtrs; + vectorField masterNormals; + vectorField masterAnchors; + vectorField masterFacePointAverages; + + // Receive data from neighbour + { + UIPstream fromNeighbour(neighbProcNo(), pBufs); + fromNeighbour >> masterCtrs >> masterNormals + >> masterAnchors >> masterFacePointAverages; + } + + // Calculate typical distance from face centre + scalarField tols ( - boundaryMesh().mesh().time().path() - /name() + "_faces.obj" + matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres()) ); - Pout<< "processorPolyPatch::order :" - << " Writing faces to OBJ file " << str.name() << endl; - writeOBJ(str, pp, pp.points()); - OFstream ccStr + if (debug || masterCtrs.size() != pp.size()) + { + { + OFstream nbrStr + ( + boundaryMesh().mesh().time().path() + /name() + "_nbrFaceCentres.obj" + ); + Pout<< "processorPolyPatch::order : " + << "Dumping neighbour faceCentres to " << nbrStr.name() + << endl; + forAll(masterCtrs, faceI) + { + writeOBJ(nbrStr, masterCtrs[faceI]); + } + } + + if (masterCtrs.size() != pp.size()) + { + FatalErrorIn + ( + "processorPolyPatch::order(const primitivePatch&" + ", labelList&, labelList&) const" + ) << "in patch:" << name() << " : " + << "Local size of patch is " << pp.size() << " (faces)." + << endl + << "Received from neighbour " << masterCtrs.size() + << " faceCentres!" + << abort(FatalError); + } + } + + // Geometric match of face centre vectors + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // 1. Try existing ordering and transformation + bool matchedAll = matchPoints ( - boundaryMesh().mesh().time().path() - /name() + "_faceCentresConnections.obj" + pp.faceCentres(), + masterCtrs, + pp.faceNormals(), + masterNormals, + tols, + false, + faceMap ); - Pout<< "processorPolyPatch::order :" - << " Dumping newly found match as lines between" - << " corresponding face centres to OBJ file " << ccStr.name() - << endl; + // Try using face point average for matching + if (!matchedAll) + { + const pointField& ppPoints = pp.points(); - label vertI = 0; + pointField facePointAverages(pp.size(), point::zero); + forAll(pp, fI) + { + const labelList& facePoints = pp[fI]; - forAll(pp.faceCentres(), faceI) - { - label masterFaceI = faceMap[faceI]; + forAll(facePoints, pI) + { + facePointAverages[fI] += ppPoints[facePoints[pI]]; + } - if (masterFaceI != -1) + facePointAverages[fI] /= facePoints.size(); + } + + scalarField tols2 + ( + calcFaceTol(pp, pp.points(), facePointAverages) + ); + + labelList faceMap2(faceMap.size(), -1); + matchedAll = matchPoints + ( + facePointAverages, + masterFacePointAverages, + pp.faceNormals(), + masterNormals, + tols2, + true, + faceMap2 + ); + + forAll(faceMap, oldFaceI) { - const point& c0 = masterCtrs[masterFaceI]; - const point& c1 = pp.faceCentres()[faceI]; - writeOBJ(ccStr, c0, c1, vertI); + if (faceMap[oldFaceI] == -1) + { + faceMap[oldFaceI] = faceMap2[oldFaceI]; + } } - } - } - if (!matchedAll) - { - SeriousErrorIn - ( - "processorPolyPatch::order(const primitivePatch&" - ", labelList&, labelList&) const" - ) << "in patch:" << name() << " : " - << "Cannot match vectors to faces on both sides of patch" - << endl - << " masterCtrs[0]:" << masterCtrs[0] << endl - << " ctrs[0]:" << pp.faceCentres()[0] << endl - << " Please check your topology changes or maybe you have" - << " multiple separated (from cyclics) processor patches" - << endl - << " Continuing with incorrect face ordering from now on!" - << endl; + matchedAll = true; - return false; - } + forAll(faceMap, oldFaceI) + { + if (faceMap[oldFaceI] == -1) + { + matchedAll = false; + } + } + } - // Set rotation. - forAll(faceMap, oldFaceI) - { - // The face f will be at newFaceI (after morphing) and we want its - // anchorPoint (= f[0]) to align with the anchorpoint for the - // corresponding face on the other side. + if (!matchedAll || debug) + { + // Dump faces + fileName str + ( + boundaryMesh().mesh().time().path() + /name() + "_faces.obj" + ); + Pout<< "processorPolyPatch::order :" + << " Writing faces to OBJ file " << str.name() << endl; + writeOBJ(str, pp, pp.points()); - label newFaceI = faceMap[oldFaceI]; + OFstream ccStr + ( + boundaryMesh().mesh().time().path() + /name() + "_faceCentresConnections.obj" + ); - const point& wantedAnchor = masterAnchors[newFaceI]; + Pout<< "processorPolyPatch::order :" + << " Dumping newly found match as lines between" + << " corresponding face centres to OBJ file " + << ccStr.name() + << endl; - rotation[newFaceI] = getRotation - ( - pp.points(), - pp[oldFaceI], - wantedAnchor, - tols[oldFaceI] - ); + label vertI = 0; + + forAll(pp.faceCentres(), faceI) + { + label masterFaceI = faceMap[faceI]; + + if (masterFaceI != -1) + { + const point& c0 = masterCtrs[masterFaceI]; + const point& c1 = pp.faceCentres()[faceI]; + writeOBJ(ccStr, c0, c1, vertI); + } + } + } - if (rotation[newFaceI] == -1) + if (!matchedAll) { SeriousErrorIn ( "processorPolyPatch::order(const primitivePatch&" ", labelList&, labelList&) const" - ) << "in patch " << name() - << " : " - << "Cannot find point on face " << pp[oldFaceI] - << " with vertices " - << UIndirectList<point>(pp.points(), pp[oldFaceI])() - << " that matches point " << wantedAnchor - << " when matching the halves of processor patch " << name() - << "Continuing with incorrect face ordering from now on!" + ) << "in patch:" << name() << " : " + << "Cannot match vectors to faces on both sides of patch" + << endl + << " masterCtrs[0]:" << masterCtrs[0] << endl + << " ctrs[0]:" << pp.faceCentres()[0] << endl + << " Check your topology changes or maybe you have" + << " multiple separated (from cyclics) processor patches" + << endl + << " Continuing with incorrect face ordering from now on" << endl; return false; } - } - forAll(faceMap, faceI) - { - if (faceMap[faceI] != faceI || rotation[faceI] != 0) + // Set rotation. + forAll(faceMap, oldFaceI) + { + // The face f will be at newFaceI (after morphing) and we want + // its anchorPoint (= f[0]) to align with the anchorpoint for + // the corresponding face on the other side. + + label newFaceI = faceMap[oldFaceI]; + + const point& wantedAnchor = masterAnchors[newFaceI]; + + rotation[newFaceI] = getRotation + ( + pp.points(), + pp[oldFaceI], + wantedAnchor, + tols[oldFaceI] + ); + + if (rotation[newFaceI] == -1) + { + SeriousErrorIn + ( + "processorPolyPatch::order(const primitivePatch&" + ", labelList&, labelList&) const" + ) << "in patch " << name() + << " : " + << "Cannot find point on face " << pp[oldFaceI] + << " with vertices " + << UIndirectList<point>(pp.points(), pp[oldFaceI])() + << " that matches point " << wantedAnchor + << " when matching the halves of processor patch " + << name() + << "Continuing with incorrect face ordering from now on" + << endl; + + return false; + } + } + + forAll(faceMap, faceI) { - return true; + if (faceMap[faceI] != faceI || rotation[faceI] != 0) + { + return true; + } } - } - return false; + return false; + } } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index 2b39411ee51fa48043e08271946bb1619451dc2d..f40f97c94f218ee7be8bb258bb3dc0d97c51c6b9 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -134,7 +134,8 @@ public: const label index, const polyBoundaryMesh& bm, const int myProcNo, - const int neighbProcNo + const int neighbProcNo, + const transformType transform = UNKNOWN // transformation type ); //- Construct from dictionary @@ -309,6 +310,17 @@ public: // refer to *this (except for name() and type() etc.) virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; + static label matchFace + ( + const face& localFace, + const pointField& localPts, + const face& masterFace, + const pointField& masterPts, + const bool sameOrientation, + const scalar absTolSqr, + scalar& matchDistSqr + ); + //- Return new ordering for primitivePatch. // Ordering is -faceMap: for every face // index of the new face -rotation:for every new face the clockwise diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index eaa818b9fe2618d4ec452344e509fabb03ce4410..8988a06eb211dad9cf592dddbdec24def09fe970 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -51,10 +51,21 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch const polyBoundaryMesh& bm, const int myProcNo, const int neighbProcNo, - const word& referPatchName + const word& referPatchName, + const transformType transform ) : - processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo), + processorPolyPatch + ( + name, + size, + start, + index, + bm, + myProcNo, + neighbProcNo, + transform + ), tag_ ( Pstream::nProcs()*max(myProcNo, neighbProcNo) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index 8d94466543bc46fe57a873174eef2f538d6365bd..fa59414586b676ac17899a43c6a822d384b009aa 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -123,7 +123,8 @@ public: const polyBoundaryMesh& bm, const int myProcNo, const int neighbProcNo, - const word& referPatchName + const word& referPatchName, + const transformType transform = UNKNOWN ); //- Construct from dictionary @@ -274,6 +275,20 @@ public: return referPatch().owner(); } + //- Type of transform + virtual transformType transform() const + { + return referPatch().transform(); + } + + //- Type of transform + // This is currently only for use when collapsing generated + // meshes that can have zero area faces. + virtual transformType& transform() + { + return const_cast<coupledPolyPatch&>(referPatch()).transform(); + } + //- Transform a patch-based position from other side to this side virtual void transformPosition(pointField& l) const { diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C index 5abf8685ecd7a1449ceec99932450f03a51a97a1..670daa726c17fe5fa9749a516f8372b1b857c4cd 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.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 @@ -27,7 +27,6 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Determines for every point whether it is coupled and if so sets only one. Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh) { PackedBoolList isMasterPoint(mesh.nPoints()); @@ -72,7 +71,6 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh) } -// Determines for every edge whether it is coupled and if so sets only one. Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh) { PackedBoolList isMasterEdge(mesh.nEdges()); @@ -117,7 +115,6 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh) } -// Determines for every face whether it is coupled and if so sets only one. Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh) { PackedBoolList isMasterFace(mesh.nFaces(), 1); @@ -145,4 +142,66 @@ Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh) } +Foam::PackedBoolList Foam::syncTools::getInternalOrMasterFaces +( + const polyMesh& mesh +) +{ + PackedBoolList isMasterFace(mesh.nFaces(), 1); + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (pp.coupled()) + { + if (!refCast<const coupledPolyPatch>(pp).owner()) + { + forAll(pp, i) + { + isMasterFace.unset(pp.start()+i); + } + } + } + else + { + forAll(pp, i) + { + isMasterFace.unset(pp.start()+i); + } + } + } + + return isMasterFace; +} + + +Foam::PackedBoolList Foam::syncTools::getInternalOrCoupledFaces +( + const polyMesh& mesh +) +{ + PackedBoolList isMasterFace(mesh.nFaces(), 1); + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + + if (!pp.coupled()) + { + forAll(pp, i) + { + isMasterFace.unset(pp.start()+i); + } + } + } + + return isMasterFace; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H index ebc4ba60c3dda8edaf21b15b338ccf62e29e4597..26711f2d0b3b5c87ae4f79208c0da46c8b851a9a 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.H +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncTools.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 @@ -481,6 +481,15 @@ public: ); } + //- Swap to obtain neighbour cell values for all boundary faces + template <class T> + static void swapBoundaryCellList + ( + const polyMesh& mesh, + const UList<T>& cellData, + List<T>& neighbourCellData + ); + // Sparse versions //- Synchronize values on selected points. @@ -570,15 +579,25 @@ public: // Other - //- Get per point whether is it master (of a coupled set of points) + //- Get per point whether it is uncoupled or a master of a + // coupled set of points static PackedBoolList getMasterPoints(const polyMesh&); - //- Get per edge whether is it master (of a coupled set of edges) + //- Get per edge whether it is uncoupled or a master of a + // coupled set of edges static PackedBoolList getMasterEdges(const polyMesh&); - //- Get per face whether is it master (of a coupled set of faces) + //- Get per face whether it is uncoupled or a master of a + // coupled set of faces static PackedBoolList getMasterFaces(const polyMesh&); + //- Get per face whether it is internal or a master of a + // coupled set of faces + static PackedBoolList getInternalOrMasterFaces(const polyMesh&); + + //- Get per face whether it is internal or coupled + static PackedBoolList getInternalOrCoupledFaces(const polyMesh&); + }; diff --git a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C index 7db1a14178d6711248e8c022eabb1e9cd0ca46e6..5d6364a681602c6c0fcf3a7aaa575980dd32b757 100644 --- a/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/syncTools/syncToolsTemplates.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 @@ -673,7 +673,7 @@ void Foam::syncTools::syncEdgeMap // Now sharedEdgeValues will contain per potential sharedEdge the value. - // (potential since an edge having two shared points is not nessecary a + // (potential since an edge having two shared points is not necessary a // shared edge). // Reduce this on the master. @@ -1553,6 +1553,45 @@ void Foam::syncTools::syncFaceList } +template <class T> +void Foam::syncTools::swapBoundaryCellList +( + const polyMesh& mesh, + const UList<T>& cellData, + List<T>& neighbourCellData +) +{ + if (cellData.size() != mesh.nCells()) + { + FatalErrorIn + ( + "syncTools<class T>::swapBoundaryCellList" + "(const polyMesh&, const UList<T>&, List<T>&)" + ) << "Number of cell values " << cellData.size() + << " is not equal to the number of cells in the mesh " + << mesh.nCells() << abort(FatalError); + } + + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + label nBnd = mesh.nFaces()-mesh.nInternalFaces(); + + neighbourCellData.setSize(nBnd); + + forAll(patches, patchI) + { + const polyPatch& pp = patches[patchI]; + const labelUList& faceCells = pp.faceCells(); + forAll(faceCells, i) + { + label bFaceI = pp.start()+i-mesh.nInternalFaces(); + neighbourCellData[bFaceI] = cellData[faceCells[i]]; + } + } + syncTools::swapBoundaryFaceList(mesh, neighbourCellData); +} + + template <unsigned nBits> void Foam::syncTools::swapFaceList ( diff --git a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C index 9d1b6e1504ea9cdff84c2b2657e78da6a001aa51..23a7ab3d7f3ea873f510515b7ce0988f498e4093 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/zone/zone.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 @@ -30,7 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::zone, 0); +namespace Foam +{ +defineTypeNameAndDebug(zone, 0); +} // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchName.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchName.C index d561c20efa811d5dde28a18a795a1080909a55f4..79dd0e2de4b1c86dc92f01d42a63dda5bf7a20f6 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchName.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::PrimitivePatchName, 0); +namespace Foam +{ +defineTypeNameAndDebug(PrimitivePatchName, 0); +} + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C index 5782820c57cc172b8ef555df2cfd66ef290fe91c..36f78d8b1e38a3a7dce1ef81d275b5cb757480ad 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatchPointAddressing.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 @@ -28,6 +28,7 @@ Description #include "PrimitivePatch.H" #include "SLList.H" +#include "ListOps.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -62,34 +63,11 @@ calcPointEdges() const << abort(FatalError); } - const edgeList& e = edges(); - - // set up storage for pointEdges - List<SLList<label> > pointEdges(meshPoints().size()); - - forAll(e, edgeI) - { - pointEdges[e[edgeI].start()].append(edgeI); - pointEdges[e[edgeI].end()].append(edgeI); - } - - // sort out the list - pointEdgesPtr_ = new labelListList(pointEdges.size()); + pointEdgesPtr_ = new labelListList(meshPoints().size()); labelListList& pe = *pointEdgesPtr_; - forAll(pointEdges, pointI) - { - const SLList<label>& pEdge = pointEdges[pointI]; - - pe[pointI].setSize(pEdge.size()); - - label i = 0; - forAllConstIter(SLList<label>, pEdge, iter) - { - pe[pointI][i++] = iter(); - } - } + invertManyToMany(pe.size(), edges(), pe); if (debug) { @@ -97,6 +75,76 @@ calcPointEdges() const << "calcPointEdges() finished calculating pointEdges" << endl; } + + // Now order the edges of each point according to whether they share a + // face + +// DynamicList<label> newEdgeList; + +// forAll(pe, pointI) +// { +// const labelList& pEdges = pe[pointI]; + +// label edgeI = pEdges[0]; + +// label prevFaceI = edgeFaces()[edgeI][0]; + +// newEdgeList.clear(); +// newEdgeList.setCapacity(pEdges.size()); + +// do +// { +// newEdgeList.append(edgeI); + +// // Cross edge to next face +// const labelList& eFaces = edgeFaces()[edgeI]; + +// if (eFaces.size() != 2) +// { +// break; +// } + +// label faceI = eFaces[0]; +// if (faceI == prevFaceI) +// { +// faceI = eFaces[1]; +// } + +// // Cross face to next edge +// const labelList& fEdges = faceEdges()[faceI]; + +// forAll(fEdges, feI) +// { +// const label nextEdgeI = fEdges[feI]; +// const edge& nextEdge = edges()[nextEdgeI]; + +// if +// ( +// nextEdgeI != edgeI +// && (nextEdge.start() == pointI || nextEdge.end() == pointI) +// ) +// { +// edgeI = nextEdgeI; +// break; +// } +// } + +// prevFaceI = faceI; + +// } while (edgeI != pEdges[0]); + +// if (newEdgeList.size() == pEdges.size()) +// { +// pe[pointI] = newEdgeList; +// } +// } + +// if (debug) +// { +// Info<< "PrimitivePatch<Face, FaceList, PointField, PointType>::" +// << "calcPointEdges() finished ordering pointEdges" +// << endl; +// } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C index 6d7516d7ea4faf95850287f2cd7aaf0c0c33f1ac..595c286239172c2df82588afbdbcea46b3e4f2f4 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::primitiveMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(primitiveMesh, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H index 8c647d8454c565f2432ebb877f9c73a8c703c6ae..c4ab139ca3f99f4b8a9366e9ede3bc7444c76853 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.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 @@ -43,9 +43,6 @@ SourceFiles primitiveMeshEdges.C primitiveMeshCellCentresAndVols.C primitiveMeshFaceCentresAndAreas.C - primitiveMeshEdgeVectors.C - primitiveMeshCheck.C - primitiveMeshCheckMotion.C primitiveMeshFindCell.C \*---------------------------------------------------------------------------*/ @@ -69,6 +66,8 @@ SourceFiles namespace Foam { +class PackedBoolList; + /*---------------------------------------------------------------------------*\ Class primitiveMesh Declaration \*---------------------------------------------------------------------------*/ @@ -225,6 +224,28 @@ class primitiveMesh const labelList& ); +protected: + + // Static data members + + //- Static data to control mesh checking + + //- Cell closedness warning threshold + // set as the fraction of un-closed area to closed area + static scalar closedThreshold_; + + //- Aspect ratio warning threshold + static scalar aspectThreshold_; + + //- Non-orthogonality warning threshold in deg + static scalar nonOrthThreshold_; + + //- Skewness warning threshold + static scalar skewThreshold_; + + //- Threshold where faces are considered coplanar + static scalar planarCosAngle_; + // Geometrical calculations @@ -251,7 +272,7 @@ class primitiveMesh void calcEdgeVectors() const; - // Helper functions for mesh checking + // Mesh checking //- Check if all points on face are shared with another face. bool checkDuplicateFaces @@ -270,29 +291,104 @@ class primitiveMesh labelHashSet* ) const; + //- Check boundary for closedness + bool checkClosedBoundary + ( + const vectorField&, + const bool, + const PackedBoolList& + ) const; - // Static data members + //- Check cells for closedness + bool checkClosedCells + ( + const vectorField& faceAreas, + const scalarField& cellVolumes, + const bool report, + labelHashSet* setPtr, + labelHashSet* aspectSetPtr, + const Vector<label>& meshD + ) const; - //- Static data to control mesh checking + //- Check for negative face areas + bool checkFaceAreas + ( + const vectorField& faceAreas, + const bool report, + const bool detailedReport, + labelHashSet* setPtr + ) const; - //- Cell closedness warning threshold - // set as the fraction of un-closed area to closed area - static scalar closedThreshold_; + //- Check for negative cell volumes + bool checkCellVolumes + ( + const scalarField& vols, + const bool report, + const bool detailedReport, + labelHashSet* setPtr + ) const; - //- Aspect ratio warning threshold - static scalar aspectThreshold_; + //- Check for non-orthogonality + bool checkFaceOrthogonality + ( + const vectorField& fAreas, + const vectorField& cellCtrs, + const bool report, + labelHashSet* setPtr + ) const; - //- Non-orthogonality warning threshold in deg - static scalar nonOrthThreshold_; + //- Check face pyramid volume + bool checkFacePyramids + ( + const pointField& points, + const vectorField& ctrs, + const bool report, + const bool detailedReport, + const scalar minPyrVol, + labelHashSet* setPtr + ) const; - //- Skewness warning threshold - static scalar skewThreshold_; + //- Check face skewness + bool checkFaceSkewness + ( + const pointField& points, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs, + const bool report, + labelHashSet* setPtr + ) const; - //- Threshold where faces are considered coplanar - static scalar planarCosAngle_; + //- Check face angles + bool checkFaceAngles + ( + const pointField& points, + const vectorField& faceAreas, + const bool report, + const scalar maxDeg, + labelHashSet* setPtr + ) const; + //- Check face warpage + bool checkFaceFlatness + ( + const pointField& points, + const vectorField& faceCentres, + const vectorField& faceAreas, + const bool report, + const scalar warnFlatness, + labelHashSet* setPtr + ) const; + + //- Check for concave cells by the planes of faces + bool checkConcaveCells + ( + const vectorField& fAreas, + const pointField& fCentres, + const bool report, + labelHashSet* setPtr + ) const; -protected: //- Construct null primitiveMesh(); @@ -502,29 +598,36 @@ public: // Topological checks + //- Check face ordering + virtual bool checkUpperTriangular + ( + const bool report = false, + labelHashSet* setPtr = NULL + ) const; + //- Check cell zip-up - bool checkCellsZipUp + virtual bool checkCellsZipUp ( const bool report = false, labelHashSet* setPtr = NULL ) const; //- Check uniqueness of face vertices - bool checkFaceVertices + virtual bool checkFaceVertices ( const bool report = false, labelHashSet* setPtr = NULL ) const; - //- Check face-face connectivity - bool checkFaceFaces + //- Check for unused points + virtual bool checkPoints ( const bool report = false, labelHashSet* setPtr = NULL ) const; - //- Check face ordering - bool checkUpperTriangular + //- Check face-face connectivity + virtual bool checkFaceFaces ( const bool report = false, labelHashSet* setPtr = NULL @@ -534,10 +637,11 @@ public: // Geometric checks //- Check boundary for closedness - bool checkClosedBoundary(const bool report = false) const; + virtual bool checkClosedBoundary(const bool report = false) + const; //- Check cells for closedness - bool checkClosedCells + virtual bool checkClosedCells ( const bool report = false, labelHashSet* setPtr = NULL, @@ -546,28 +650,28 @@ public: ) const; //- Check for negative face areas - bool checkFaceAreas + virtual bool checkFaceAreas ( const bool report = false, labelHashSet* setPtr = NULL ) const; //- Check for negative cell volumes - bool checkCellVolumes + virtual bool checkCellVolumes ( const bool report = false, labelHashSet* setPtr = NULL ) const; //- Check for non-orthogonality - bool checkFaceOrthogonality + virtual bool checkFaceOrthogonality ( const bool report = false, labelHashSet* setPtr = NULL ) const; //- Check face pyramid volume - bool checkFacePyramids + virtual bool checkFacePyramids ( const bool report = false, const scalar minPyrVol = -SMALL, @@ -575,14 +679,14 @@ public: ) const; //- Check face skewness - bool checkFaceSkewness + virtual bool checkFaceSkewness ( const bool report = false, labelHashSet* setPtr = NULL ) const; //- Check face angles - bool checkFaceAngles + virtual bool checkFaceAngles ( const bool report = false, const scalar maxSin = 10, // In degrees @@ -592,31 +696,16 @@ public: //- Check face warpage: decompose face and check ratio between // magnitude of sum of triangle areas and sum of magnitude of // triangle areas. - bool checkFaceFlatness + virtual bool checkFaceFlatness ( const bool report, const scalar warnFlatness, // When to include in set. labelHashSet* setPtr ) const; - //- Check edge alignment for 1D/2D cases - bool checkEdgeAlignment - ( - const bool report, - const Vector<label>& directions, - labelHashSet* setPtr = NULL - ) const; - - //- Check for unused points - bool checkPoints - ( - const bool report = false, - labelHashSet* setPtr = NULL - ) const; - //- Check for point-point-nearness, // e.g. colocated points which may be part of baffles. - bool checkPointNearness + virtual bool checkPointNearness ( const bool report, const scalar reportDistSqr, @@ -624,23 +713,15 @@ public: ) const; //- Check edge length - bool checkEdgeLength + virtual bool checkEdgeLength ( const bool report, const scalar minLenSqr, labelHashSet* setPtr = NULL ) const; - //- Check cell determinant - bool checkCellDeterminant - ( - const bool report = false, - labelHashSet* setPtr = NULL, - const Vector<label>& solutionD = Vector<label>::one - ) const; - //- Check for concave cells by the planes of faces - bool checkConcaveCells + virtual bool checkConcaveCells ( const bool report = false, labelHashSet* setPtr = NULL @@ -649,22 +730,14 @@ public: //- Check mesh topology for correctness. // Returns false for no error. - bool checkTopology(const bool report = false) const; + virtual bool checkTopology(const bool report = false) const; //- Check mesh geometry (& implicitly topology) for correctness. // Returns false for no error. - bool checkGeometry(const bool report = false) const; + virtual bool checkGeometry(const bool report = false) const; //- Check mesh for correctness. Returns false for no error. - bool checkMesh(const bool report = false) const; - - //- Check mesh motion for correctness given motion points - bool checkMeshMotion - ( - const pointField& newPoints, - const bool report = false - ) const; - + virtual bool checkMesh(const bool report = false) const; //- Set the closedness ratio warning threshold static scalar setClosedThreshold(const scalar); diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 76fa1aa5d1d38f2c3840c7975fbcc9f03293f206..d805608e4480c11a75c1605a6d5a7b2fe2fb3877 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -29,6 +29,7 @@ License #include "unitConversion.H" #include "SortableList.H" #include "EdgeMap.H" +#include "primitiveMeshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -41,7 +42,12 @@ Foam::scalar Foam::primitiveMesh::planarCosAngle_ = 1.0e-6; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const +bool Foam::primitiveMesh::checkClosedBoundary +( + const vectorField& areas, + const bool report, + const PackedBoolList& internalOrCoupledFaces +) const { if (debug) { @@ -56,12 +62,13 @@ bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const vector sumClosed(vector::zero); scalar sumMagClosedBoundary = 0; - const vectorField& areas = faceAreas(); - for (label faceI = nInternalFaces(); faceI < areas.size(); faceI++) { - sumClosed += areas[faceI]; - sumMagClosedBoundary += mag(areas[faceI]); + if (internalOrCoupledFaces.size() && !internalOrCoupledFaces[faceI]) + { + sumClosed += areas[faceI]; + sumMagClosedBoundary += mag(areas[faceI]); + } } reduce(sumClosed, sumOp<vector>()); @@ -95,6 +102,8 @@ bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const bool Foam::primitiveMesh::checkClosedCells ( + const vectorField& faceAreas, + const scalarField& cellVolumes, const bool report, labelHashSet* setPtr, labelHashSet* aspectSetPtr, @@ -140,66 +149,28 @@ bool Foam::primitiveMesh::checkClosedCells return true; } - // Loop through cell faces and sum up the face area vectors for each cell. - // This should be zero in all vector components - - vectorField sumClosed(nCells(), vector::zero); - vectorField sumMagClosed(nCells(), vector::zero); - const labelList& own = faceOwner(); - const labelList& nei = faceNeighbour(); - const vectorField& areas = faceAreas(); - - forAll(own, faceI) - { - // Add to owner - sumClosed[own[faceI]] += areas[faceI]; - sumMagClosed[own[faceI]] += cmptMag(areas[faceI]); - } - - forAll(nei, faceI) - { - // Subtract from neighbour - sumClosed[nei[faceI]] -= areas[faceI]; - sumMagClosed[nei[faceI]] += cmptMag(areas[faceI]); - } + scalarField openness; + scalarField aspectRatio; + primitiveMeshTools::cellClosedness + ( + *this, + meshD, + faceAreas, + cellVolumes, + openness, + aspectRatio + ); label nOpen = 0; - scalar maxOpennessCell = 0; - + scalar maxOpennessCell = max(openness); label nAspect = 0; - scalar maxAspectRatio = 0; - - const scalarField& vols = cellVolumes(); - - label nDims = 0; - for (direction dir = 0; dir < vector::nComponents; dir++) - { - if (meshD[dir] == 1) - { - nDims++; - } - } - + scalar maxAspectRatio = max(aspectRatio); // Check the sums - forAll(sumClosed, cellI) + forAll(openness, cellI) { - scalar maxOpenness = 0; - - for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) - { - maxOpenness = max - ( - maxOpenness, - mag(sumClosed[cellI][cmpt]) - /(sumMagClosed[cellI][cmpt] + VSMALL) - ); - } - - maxOpennessCell = max(maxOpennessCell, maxOpenness); - - if (maxOpenness > closedThreshold_) + if (openness[cellI] > closedThreshold_) { if (setPtr) { @@ -209,32 +180,7 @@ bool Foam::primitiveMesh::checkClosedCells nOpen++; } - // Calculate the aspect ration as the maximum of Cartesian component - // aspect ratio to the total area hydraulic area aspect ratio - scalar minCmpt = VGREAT; - scalar maxCmpt = -VGREAT; - for (direction dir = 0; dir < vector::nComponents; dir++) - { - if (meshD[dir] == 1) - { - minCmpt = min(minCmpt, sumMagClosed[cellI][dir]); - maxCmpt = max(maxCmpt, sumMagClosed[cellI][dir]); - } - } - - scalar aspectRatio = maxCmpt/(minCmpt + VSMALL); - if (nDims == 3) - { - aspectRatio = max - ( - aspectRatio, - 1.0/6.0*cmptSum(sumMagClosed[cellI])/pow(vols[cellI], 2.0/3.0) - ); - } - - maxAspectRatio = max(maxAspectRatio, aspectRatio); - - if (aspectRatio > aspectThreshold_) + if (aspectRatio[cellI] > aspectThreshold_) { if (aspectSetPtr) { @@ -290,7 +236,9 @@ bool Foam::primitiveMesh::checkClosedCells bool Foam::primitiveMesh::checkFaceAreas ( + const vectorField& faceAreas, const bool report, + const bool detailedReport, labelHashSet* setPtr ) const { @@ -301,7 +249,7 @@ bool Foam::primitiveMesh::checkFaceAreas << "checking face area magnitudes" << endl; } - const scalarField magFaceAreas(mag(faceAreas())); + const scalarField magFaceAreas(mag(faceAreas)); scalar minArea = GREAT; scalar maxArea = -GREAT; @@ -314,6 +262,25 @@ bool Foam::primitiveMesh::checkFaceAreas { setPtr->insert(faceI); } + if (detailedReport) + { + if (isInternalFace(faceI)) + { + Pout<< "Zero or negative face area detected for " + << "internal face "<< faceI << " between cells " + << faceOwner()[faceI] << " and " + << faceNeighbour()[faceI] + << ". Face area magnitude = " << magFaceAreas[faceI] + << endl; + } + else + { + Pout<< "Zero or negative face area detected for " + << "boundary face " << faceI << " next to cell " + << faceOwner()[faceI] << ". Face area magnitude = " + << magFaceAreas[faceI] << endl; + } + } } minArea = min(minArea, magFaceAreas[faceI]); @@ -349,7 +316,9 @@ bool Foam::primitiveMesh::checkFaceAreas bool Foam::primitiveMesh::checkCellVolumes ( + const scalarField& vols, const bool report, + const bool detailedReport, labelHashSet* setPtr ) const { @@ -360,8 +329,6 @@ bool Foam::primitiveMesh::checkCellVolumes << "checking cell volumes" << endl; } - const scalarField& vols = cellVolumes(); - scalar minVolume = GREAT; scalar maxVolume = -GREAT; @@ -375,6 +342,11 @@ bool Foam::primitiveMesh::checkCellVolumes { setPtr->insert(cellI); } + if (detailedReport) + { + Pout<< "Zero or negative cell volume detected for cell " + << cellI << ". Volume = " << vols[cellI] << endl; + } nNegVolCells++; } @@ -416,6 +388,8 @@ bool Foam::primitiveMesh::checkCellVolumes bool Foam::primitiveMesh::checkFaceOrthogonality ( + const vectorField& fAreas, + const vectorField& cellCtrs, const bool report, labelHashSet* setPtr ) const @@ -427,35 +401,33 @@ bool Foam::primitiveMesh::checkFaceOrthogonality << "checking mesh non-orthogonality" << endl; } - // for all internal faces check that the d dot S product is positive - const vectorField& centres = cellCentres(); - const vectorField& areas = faceAreas(); - const labelList& own = faceOwner(); - const labelList& nei = faceNeighbour(); + tmp<scalarField> tortho = primitiveMeshTools::faceOrthogonality + ( + *this, + fAreas, + cellCtrs + ); + const scalarField& ortho = tortho(); // Severe nonorthogonality threshold const scalar severeNonorthogonalityThreshold = ::cos(degToRad(nonOrthThreshold_)); - scalar minDDotS = GREAT; + scalar minDDotS = min(ortho); - scalar sumDDotS = 0; + scalar sumDDotS = sum(ortho); label severeNonOrth = 0; label errorNonOrth = 0; - forAll(nei, faceI) - { - vector d = centres[nei[faceI]] - centres[own[faceI]]; - const vector& s = areas[faceI]; - - scalar dDotS = (d & s)/(mag(d)*mag(s) + VSMALL); - if (dDotS < severeNonorthogonalityThreshold) + forAll(ortho, faceI) + { + if (ortho[faceI] < severeNonorthogonalityThreshold) { - if (dDotS > SMALL) + if (ortho[faceI] > SMALL) { if (setPtr) { @@ -474,13 +446,6 @@ bool Foam::primitiveMesh::checkFaceOrthogonality errorNonOrth++; } } - - if (dDotS < minDDotS) - { - minDDotS = dDotS; - } - - sumDDotS += dDotS; } reduce(minDDotS, minOp<scalar>()); @@ -490,7 +455,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality if (debug || report) { - label neiSize = nei.size(); + label neiSize = ortho.size(); reduce(neiSize, sumOp<label>()); if (neiSize > 0) @@ -535,7 +500,10 @@ bool Foam::primitiveMesh::checkFaceOrthogonality bool Foam::primitiveMesh::checkFacePyramids ( + const pointField& points, + const vectorField& ctrs, const bool report, + const bool detailedReport, const scalar minPyrVol, labelHashSet* setPtr ) const @@ -547,46 +515,63 @@ bool Foam::primitiveMesh::checkFacePyramids << "checking face orientation" << endl; } - // check whether face area vector points to the cell with higher label - const vectorField& ctrs = cellCentres(); - const labelList& own = faceOwner(); const labelList& nei = faceNeighbour(); - const faceList& f = faces(); - const pointField& p = points(); + + scalarField ownPyrVol; + scalarField neiPyrVol; + primitiveMeshTools::facePyramidVolume + ( + *this, + points, + ctrs, + ownPyrVol, + neiPyrVol + ); + label nErrorPyrs = 0; - forAll(f, faceI) + forAll(ownPyrVol, faceI) { - // Create the owner pyramid - it will have negative volume - scalar pyrVol = pyramidPointFaceRef(f[faceI], ctrs[own[faceI]]).mag(p); - - if (pyrVol > -minPyrVol) + if (ownPyrVol[faceI] < minPyrVol) { if (setPtr) { setPtr->insert(faceI); } + if (detailedReport) + { + Pout<< "Negative pyramid volume: " << ownPyrVol[faceI] + << " for face " << faceI << " " << f[faceI] + << " and owner cell: " << own[faceI] << endl + << "Owner cell vertex labels: " + << cells()[own[faceI]].labels(faces()) + << endl; + } nErrorPyrs++; } if (isInternalFace(faceI)) { - // Create the neighbour pyramid - it will have positive volume - scalar pyrVol = - pyramidPointFaceRef(f[faceI], ctrs[nei[faceI]]).mag(p); - - if (pyrVol < minPyrVol) + if (neiPyrVol[faceI] < minPyrVol) { if (setPtr) { setPtr->insert(faceI); } - + if (detailedReport) + { + Pout<< "Negative pyramid volume: " << neiPyrVol[faceI] + << " for face " << faceI << " " << f[faceI] + << " and neighbour cell: " << nei[faceI] << nl + << "Neighbour cell vertex labels: " + << cells()[nei[faceI]].labels(faces()) + << endl; + } nErrorPyrs++; } } @@ -619,6 +604,10 @@ bool Foam::primitiveMesh::checkFacePyramids bool Foam::primitiveMesh::checkFaceSkewness ( + const pointField& points, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs, const bool report, labelHashSet* setPtr ) const @@ -633,93 +622,24 @@ bool Foam::primitiveMesh::checkFaceSkewness // Warn if the skew correction vector is more than skewWarning times // larger than the face area vector - const pointField& p = points(); - const faceList& fcs = faces(); - - const labelList& own = faceOwner(); - const labelList& nei = faceNeighbour(); - const vectorField& cellCtrs = cellCentres(); - const vectorField& faceCtrs = faceCentres(); - const vectorField& fAreas = faceAreas(); - - scalar maxSkew = 0; + tmp<scalarField> tskewness = primitiveMeshTools::faceSkewness + ( + *this, + points, + fCtrs, + fAreas, + cellCtrs + ); + const scalarField& skewness = tskewness(); + + scalar maxSkew = max(skewness); label nWarnSkew = 0; - forAll(nei, faceI) - { - vector Cpf = faceCtrs[faceI] - cellCtrs[own[faceI]]; - vector d = cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]; - - // Skewness vector - vector sv = - Cpf - ((fAreas[faceI] & Cpf)/((fAreas[faceI] & d) + SMALL))*d; - vector svHat = sv/(mag(sv) + VSMALL); - - // Normalisation distance calculated as the approximate distance - // from the face centre to the edge of the face in the direction of - // the skewness - scalar fd = 0.2*mag(d) + VSMALL; - const face& f = fcs[faceI]; - forAll(f, pi) - { - fd = max(fd, mag(svHat & (p[f[pi]] - faceCtrs[faceI]))); - } - - // Normalised skewness - scalar skewness = mag(sv)/fd; - - // Check if the skewness vector is greater than the PN vector. - // This does not cause trouble but is a good indication of a poor mesh. - if (skewness > skewThreshold_) - { - if (setPtr) - { - setPtr->insert(faceI); - } - - nWarnSkew++; - } - - if (skewness > maxSkew) - { - maxSkew = skewness; - } - } - - - // Boundary faces: consider them to have only skewness error. - // (i.e. treat as if mirror cell on other side) - - for (label faceI = nInternalFaces(); faceI < nFaces(); faceI++) + forAll(skewness, faceI) { - vector Cpf = faceCtrs[faceI] - cellCtrs[own[faceI]]; - - vector normal = fAreas[faceI]; - normal /= mag(normal) + VSMALL; - vector d = normal*(normal & Cpf); - - - // Skewness vector - vector sv = - Cpf - ((fAreas[faceI] & Cpf)/((fAreas[faceI] & d) + VSMALL))*d; - vector svHat = sv/(mag(sv) + VSMALL); - - // Normalisation distance calculated as the approximate distance - // from the face centre to the edge of the face in the direction of - // the skewness - scalar fd = 0.4*mag(d) + VSMALL; - const face& f = fcs[faceI]; - forAll(f, pi) - { - fd = max(fd, mag(svHat & (p[f[pi]] - faceCtrs[faceI]))); - } - - // Normalised skewness - scalar skewness = mag(sv)/fd; - // Check if the skewness vector is greater than the PN vector. // This does not cause trouble but is a good indication of a poor mesh. - if (skewness > skewThreshold_) + if (skewness[faceI] > skewThreshold_) { if (setPtr) { @@ -728,14 +648,8 @@ bool Foam::primitiveMesh::checkFaceSkewness nWarnSkew++; } - - if (skewness > maxSkew) - { - maxSkew = skewness; - } } - reduce(maxSkew, maxOp<scalar>()); reduce(nWarnSkew, sumOp<label>()); @@ -763,86 +677,14 @@ bool Foam::primitiveMesh::checkFaceSkewness } -bool Foam::primitiveMesh::checkPoints -( - const bool report, - labelHashSet* setPtr -) const -{ - if (debug) - { - Info<< "bool primitiveMesh::checkPoints" - << "(const bool, labelHashSet*) const: " - << "checking points" << endl; - } - - label nFaceErrors = 0; - label nCellErrors = 0; - - const labelListList& pf = pointFaces(); - - forAll(pf, pointI) - { - if (pf[pointI].empty()) - { - if (setPtr) - { - setPtr->insert(pointI); - } - - nFaceErrors++; - } - } - - - forAll(pf, pointI) - { - const labelList& pc = pointCells(pointI); - - if (pc.empty()) - { - if (setPtr) - { - setPtr->insert(pointI); - } - - nCellErrors++; - } - } - - reduce(nFaceErrors, sumOp<label>()); - reduce(nCellErrors, sumOp<label>()); - - if (nFaceErrors > 0 || nCellErrors > 0) - { - if (debug || report) - { - Info<< " ***Unused points found in the mesh, " - "number unused by faces: " << nFaceErrors - << " number unused by cells: " << nCellErrors - << endl; - } - - return true; - } - else - { - if (debug || report) - { - Info<< " Point usage OK." << endl; - } - - return false; - } -} - - // Check convexity of angles in a face. Allow a slight non-convexity. // E.g. maxDeg = 10 allows for angles < 190 (or 10 degrees concavity) // (if truly concave and points not visible from face centre the face-pyramid // check in checkMesh will fail) bool Foam::primitiveMesh::checkFaceAngles ( + const pointField& points, + const vectorField& faceAreas, const bool report, const scalar maxDeg, labelHashSet* setPtr @@ -867,71 +709,30 @@ bool Foam::primitiveMesh::checkFaceAngles const scalar maxSin = Foam::sin(degToRad(maxDeg)); - const pointField& p = points(); - const faceList& fcs = faces(); - vectorField faceNormals(faceAreas()); - faceNormals /= mag(faceNormals) + VSMALL; - scalar maxEdgeSin = 0.0; + tmp<scalarField> tfaceAngles = primitiveMeshTools::faceConcavity + ( + maxSin, + *this, + points, + faceAreas + ); + const scalarField& faceAngles = tfaceAngles(); - label nConcave = 0; + scalar maxEdgeSin = max(faceAngles); - label errorFaceI = -1; + label nConcave = 0; - forAll(fcs, faceI) + forAll(faceAngles, faceI) { - const face& f = fcs[faceI]; - - // Get edge from f[0] to f[size-1]; - vector ePrev(p[f.first()] - p[f.last()]); - scalar magEPrev = mag(ePrev); - ePrev /= magEPrev + VSMALL; - - forAll(f, fp0) + if (faceAngles[faceI] > SMALL) { - // Get vertex after fp - label fp1 = f.fcIndex(fp0); - - // Normalized vector between two consecutive points - vector e10(p[f[fp1]] - p[f[fp0]]); - scalar magE10 = mag(e10); - e10 /= magE10 + VSMALL; + nConcave++; - if (magEPrev > SMALL && magE10 > SMALL) + if (setPtr) { - vector edgeNormal = ePrev ^ e10; - scalar magEdgeNormal = mag(edgeNormal); - - if (magEdgeNormal < maxSin) - { - // Edges (almost) aligned -> face is ok. - } - else - { - // Check normal - edgeNormal /= magEdgeNormal; - - if ((edgeNormal & faceNormals[faceI]) < SMALL) - { - if (faceI != errorFaceI) - { - // Count only one error per face. - errorFaceI = faceI; - nConcave++; - } - - if (setPtr) - { - setPtr->insert(faceI); - } - - maxEdgeSin = max(maxEdgeSin, magEdgeNormal); - } - } + setPtr->insert(faceI); } - - ePrev = e10; - magEPrev = magE10; } } @@ -965,11 +766,11 @@ bool Foam::primitiveMesh::checkFaceAngles } -// Check warpage of faces. Is calculated as the difference between areas of -// individual triangles and the overall area of the face (which ifself is -// is the average of the areas of the individual triangles). bool Foam::primitiveMesh::checkFaceFlatness ( + const pointField& points, + const vectorField& faceCentres, + const vectorField& faceAreas, const bool report, const scalar warnFlatness, labelHashSet* setPtr @@ -992,52 +793,34 @@ bool Foam::primitiveMesh::checkFaceFlatness << exit(FatalError); } - - const pointField& p = points(); const faceList& fcs = faces(); - const pointField& fctrs = faceCentres(); - // Areas are calculated as the sum of areas. (see - // primitiveMeshFaceCentresAndAreas.C) - scalarField magAreas(mag(faceAreas())); + tmp<scalarField> tfaceFlatness = primitiveMeshTools::faceFlatness + ( + *this, + points, + faceCentres, + faceAreas + ); + const scalarField& faceFlatness = tfaceFlatness(); - label nWarped = 0; + scalarField magAreas(mag(faceAreas)); scalar minFlatness = GREAT; scalar sumFlatness = 0; label nSummed = 0; + label nWarped = 0; - forAll(fcs, faceI) + forAll(faceFlatness, faceI) { - const face& f = fcs[faceI]; - - if (f.size() > 3 && magAreas[faceI] > VSMALL) + if (fcs[faceI].size() > 3 && magAreas[faceI] > VSMALL) { - const point& fc = fctrs[faceI]; - - // Calculate the sum of magnitude of areas and compare to magnitude - // of sum of areas. - - scalar sumA = 0.0; - - forAll(f, fp) - { - const point& thisPoint = p[f[fp]]; - const point& nextPoint = p[f.nextLabel(fp)]; - - // Triangle around fc. - vector n = 0.5*((nextPoint - thisPoint)^(fc - thisPoint)); - sumA += mag(n); - } - - scalar flatness = magAreas[faceI] / (sumA+VSMALL); - - sumFlatness += flatness; + sumFlatness += faceFlatness[faceI]; nSummed++; - minFlatness = min(minFlatness, flatness); + minFlatness = min(minFlatness, faceFlatness[faceI]); - if (flatness < warnFlatness) + if (faceFlatness[faceI] < warnFlatness) { nWarped++; @@ -1092,131 +875,103 @@ bool Foam::primitiveMesh::checkFaceFlatness } -// Check 1D/2Dness of edges. Gets passed the non-empty directions and -// checks all edges in the mesh whether they: -// - have no component in a non-empty direction or -// - are only in a singe non-empty direction. -// Empty direction info is passed in as a vector of labels (synchronised) -// which are 1 if the direction is non-empty, 0 if it is. -bool Foam::primitiveMesh::checkEdgeAlignment +bool Foam::primitiveMesh::checkConcaveCells ( + const vectorField& fAreas, + const pointField& fCentres, const bool report, - const Vector<label>& directions, labelHashSet* setPtr ) const { if (debug) { - Info<< "bool primitiveMesh::checkEdgeAlignment(" - << "const bool, const Vector<label>&, labelHashSet*) const: " - << "checking edge alignment" << endl; + Info<< "bool primitiveMesh::checkConcaveCells(const bool" + << ", labelHashSet*) const: " + << "checking for concave cells" << endl; } - label nDirs = 0; - for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) - { - if (directions[cmpt] == 1) - { - nDirs++; - } - else if (directions[cmpt] != 0) - { - FatalErrorIn - ( - "primitiveMesh::checkEdgeAlignment" - "(const bool, const Vector<label>&, labelHashSet*)" - ) << "directions should contain 0 or 1 but is now " << directions - << exit(FatalError); - } - } + const cellList& c = cells(); + const labelList& fOwner = faceOwner(); - if (nDirs == vector::nComponents) - { - return false; - } + label nConcaveCells = 0; + forAll(c, cellI) + { + const cell& cFaces = c[cellI]; + bool concave = false; - const pointField& p = points(); - const faceList& fcs = faces(); + forAll(cFaces, i) + { + if (concave) + { + break; + } - EdgeMap<label> edgesInError; + label fI = cFaces[i]; - forAll(fcs, faceI) - { - const face& f = fcs[faceI]; + const point& fC = fCentres[fI]; - forAll(f, fp) - { - label p0 = f[fp]; - label p1 = f.nextLabel(fp); - if (p0 < p1) - { - vector d(p[p1]-p[p0]); - scalar magD = mag(d); + vector fN = fAreas[fI]; - if (magD > ROOTVSMALL) - { - d /= magD; + fN /= max(mag(fN), VSMALL); - // Check how many empty directions are used by the edge. - label nEmptyDirs = 0; - label nNonEmptyDirs = 0; - for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) - { - if (mag(d[cmpt]) > 1e-6) - { - if (directions[cmpt] == 0) - { - nEmptyDirs++; - } - else - { - nNonEmptyDirs++; - } - } - } + // Flip normal if required so that it is always pointing out of + // the cell + if (fOwner[fI] != cellI) + { + fN *= -1; + } - if (nEmptyDirs == 0) - { - // Purely in ok directions. - } - else if (nEmptyDirs == 1) + // Is the centre of any other face of the cell on the + // wrong side of the plane of this face? + + forAll(cFaces, j) + { + if (j != i) + { + label fJ = cFaces[j]; + + const point& pt = fCentres[fJ]; + + // If the cell is concave, the point will be on the + // positive normal side of the plane of f, defined by + // its centre and normal, and the angle between (pt - + // fC) and fN will be less than 90 degrees, so the dot + // product will be positive. + + vector pC = (pt - fC); + + pC /= max(mag(pC), VSMALL); + + if ((pC & fN) > -planarCosAngle_) { - // Ok if purely in empty directions. - if (nNonEmptyDirs > 0) + // Concave or planar face + + concave = true; + + if (setPtr) { - edgesInError.insert(edge(p0, p1), faceI); + setPtr->insert(cellI); } - } - else if (nEmptyDirs > 1) - { - // Always an error - edgesInError.insert(edge(p0, p1), faceI); + + nConcaveCells++; + + break; } } } } } - label nErrorEdges = returnReduce(edgesInError.size(), sumOp<label>()); + reduce(nConcaveCells, sumOp<label>()); - if (nErrorEdges > 0) + if (nConcaveCells > 0) { if (debug || report) { - Info<< " ***Number of edges not aligned with or perpendicular to " - << "non-empty directions: " << nErrorEdges << endl; - } - - if (setPtr) - { - setPtr->resize(2*edgesInError.size()); - forAllConstIter(EdgeMap<label>, edgesInError, iter) - { - setPtr->insert(iter.key()[0]); - setPtr->insert(iter.key()[1]); - } + Info<< " ***Concave cells (using face planes) found," + << " number of cells: " << nConcaveCells << endl; } return true; @@ -1225,14 +980,18 @@ bool Foam::primitiveMesh::checkEdgeAlignment { if (debug || report) { - Info<< " All edges aligned with or perpendicular to " - << "non-empty directions." << endl; + Info<< " Concave cell check OK." << endl; } + return false; } + + return false; } +// Topological tests + bool Foam::primitiveMesh::checkUpperTriangular ( const bool report, @@ -1574,6 +1333,80 @@ bool Foam::primitiveMesh::checkFaceVertices } +bool Foam::primitiveMesh::checkPoints +( + const bool report, + labelHashSet* setPtr +) const +{ + if (debug) + { + Info<< "bool primitiveMesh::checkPoints" + << "(const bool, labelHashSet*) const: " + << "checking points" << endl; + } + + label nFaceErrors = 0; + label nCellErrors = 0; + + const labelListList& pf = pointFaces(); + + forAll(pf, pointI) + { + if (pf[pointI].empty()) + { + if (setPtr) + { + setPtr->insert(pointI); + } + + nFaceErrors++; + } + } + + + forAll(pf, pointI) + { + const labelList& pc = pointCells(pointI); + + if (pc.empty()) + { + if (setPtr) + { + setPtr->insert(pointI); + } + + nCellErrors++; + } + } + + reduce(nFaceErrors, sumOp<label>()); + reduce(nCellErrors, sumOp<label>()); + + if (nFaceErrors > 0 || nCellErrors > 0) + { + if (debug || report) + { + Info<< " ***Unused points found in the mesh, " + "number unused by faces: " << nFaceErrors + << " number unused by cells: " << nCellErrors + << endl; + } + + return true; + } + else + { + if (debug || report) + { + Info<< " Point usage OK." << endl; + } + + return false; + } +} + + // Check if all points on face are shared between faces. bool Foam::primitiveMesh::checkDuplicateFaces ( @@ -1891,168 +1724,153 @@ bool Foam::primitiveMesh::checkFaceFaces } -// Checks cells with 1 or less internal faces. Give numerical problems. -bool Foam::primitiveMesh::checkCellDeterminant -( - const bool report, // report, - labelHashSet* setPtr, // setPtr - const Vector<label>& meshD -) const -{ - if (debug) - { - Info<< "bool primitiveMesh::checkCellDeterminant(const bool" - << ", labelHashSet*) const: " - << "checking for under-determined cells" << endl; - } - - // Determine number of dimensions and (for 2D) missing dimension - label nDims = 0; - label twoD = -1; - for (direction dir = 0; dir < vector::nComponents; dir++) - { - if (meshD[dir] == 1) - { - nDims++; - } - else - { - twoD = dir; - } - } - - - const cellList& c = cells(); - - label nErrorCells = 0; - - scalar minDet = GREAT; - scalar sumDet = 0; - label nSummed = 0; - - if (nDims == 1) - { - minDet = 1; - sumDet = c.size()*minDet; - nSummed = c.size(); - } - else - { - forAll (c, cellI) - { - const labelList& curFaces = c[cellI]; - - // Calculate local normalization factor - scalar avgArea = 0; - - label nInternalFaces = 0; +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - forAll(curFaces, i) - { - if (isInternalFace(curFaces[i])) - { - avgArea += mag(faceAreas()[curFaces[i]]); +bool Foam::primitiveMesh::checkClosedBoundary(const bool report) const +{ + return checkClosedBoundary(faceAreas(), report, PackedBoolList(0)); +} - nInternalFaces++; - } - } - if (nInternalFaces == 0) - { - if (setPtr) - { - setPtr->insert(cellI); - } +bool Foam::primitiveMesh::checkClosedCells +( + const bool report, + labelHashSet* setPtr, + labelHashSet* aspectSetPtr, + const Vector<label>& solutionD +) const +{ + return checkClosedCells + ( + faceAreas(), + cellVolumes(), + report, + setPtr, + aspectSetPtr, + solutionD + ); +} - nErrorCells++; - } - else - { - avgArea /= nInternalFaces; - symmTensor areaTensor(symmTensor::zero); +bool Foam::primitiveMesh::checkFaceAreas +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkFaceAreas + ( + faceAreas(), + report, + false, // detailedReport, + setPtr + ); +} - forAll(curFaces, i) - { - if (isInternalFace(curFaces[i])) - { - areaTensor += sqr(faceAreas()[curFaces[i]]/avgArea); - } - } - if (nDims == 2) - { - // Add the missing eigenvector (such that it does not - // affect the determinant) - if (twoD == 0) - { - areaTensor.xx() = 1; - } - else if (twoD == 1) - { - areaTensor.yy() = 1; - } - else - { - areaTensor.zz() = 1; - } - } +bool Foam::primitiveMesh::checkCellVolumes +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkCellVolumes + ( + cellVolumes(), + report, + false, // detailedReport, + setPtr + ); +} - scalar determinant = mag(det(areaTensor)); - minDet = min(determinant, minDet); - sumDet += determinant; - nSummed++; +bool Foam::primitiveMesh::checkFaceOrthogonality +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkFaceOrthogonality + ( + faceAreas(), + cellCentres(), + report, + setPtr + ); +} - if (determinant < 1e-3) - { - if (setPtr) - { - setPtr->insert(cellI); - } - nErrorCells++; - } - } - } - } +bool Foam::primitiveMesh::checkFacePyramids +( + const bool report, + const scalar minPyrVol, + labelHashSet* setPtr +) const +{ + return checkFacePyramids + ( + points(), + cellCentres(), + report, + false, // detailedReport, + minPyrVol, + setPtr + ); +} - reduce(nErrorCells, sumOp<label>()); - reduce(minDet, minOp<scalar>()); - reduce(sumDet, sumOp<scalar>()); - reduce(nSummed, sumOp<label>()); - if (debug || report) - { - if (nSummed > 0) - { - Info<< " Cell determinant (wellposedness) : minimum: " << minDet - << " average: " << sumDet/nSummed - << endl; - } - } +bool Foam::primitiveMesh::checkFaceSkewness +( + const bool report, + labelHashSet* setPtr +) const +{ + return checkFaceSkewness + ( + points(), + faceCentres(), + faceAreas(), + cellCentres(), + report, + setPtr + ); +} - if (nErrorCells > 0) - { - if (debug || report) - { - Info<< " ***Cells with small determinant found, number of cells: " - << nErrorCells << endl; - } - return true; - } - else - { - if (debug || report) - { - Info<< " Cell determinant check OK." << endl; - } +bool Foam::primitiveMesh::checkFaceAngles +( + const bool report, + const scalar maxDeg, + labelHashSet* setPtr +) const +{ + return checkFaceAngles + ( + points(), + faceAreas(), + report, + maxDeg, + setPtr + ); +} - return false; - } - return false; +bool Foam::primitiveMesh::checkFaceFlatness +( + const bool report, + const scalar warnFlatness, + labelHashSet* setPtr +) const +{ + return checkFaceFlatness + ( + points(), + faceCentres(), + faceAreas(), + report, + warnFlatness, + setPtr + ); } @@ -2062,117 +1880,16 @@ bool Foam::primitiveMesh::checkConcaveCells labelHashSet* setPtr ) const { - if (debug) - { - Info<< "bool primitiveMesh::checkConcaveCells(const bool" - << ", labelHashSet*) const: " - << "checking for concave cells" << endl; - } - - const cellList& c = cells(); - const labelList& fOwner = faceOwner(); - const vectorField& fAreas = faceAreas(); - const pointField& fCentres = faceCentres(); - - label nConcaveCells = 0; - - forAll(c, cellI) - { - const cell& cFaces = c[cellI]; - - bool concave = false; - - forAll(cFaces, i) - { - if (concave) - { - break; - } - - label fI = cFaces[i]; - - const point& fC = fCentres[fI]; - - vector fN = fAreas[fI]; - - fN /= max(mag(fN), VSMALL); - - // Flip normal if required so that it is always pointing out of - // the cell - if (fOwner[fI] != cellI) - { - fN *= -1; - } - - // Is the centre of any other face of the cell on the - // wrong side of the plane of this face? - - forAll(cFaces, j) - { - if (j != i) - { - label fJ = cFaces[j]; - - const point& pt = fCentres[fJ]; - - // If the cell is concave, the point will be on the - // positive normal side of the plane of f, defined by - // its centre and normal, and the angle between (pt - - // fC) and fN will be less than 90 degrees, so the dot - // product will be positive. - - vector pC = (pt - fC); - - pC /= max(mag(pC), VSMALL); - - if ((pC & fN) > -planarCosAngle_) - { - // Concave or planar face - - concave = true; - - if (setPtr) - { - setPtr->insert(cellI); - } - - nConcaveCells++; - - break; - } - } - } - } - } - - reduce(nConcaveCells, sumOp<label>()); - - if (nConcaveCells > 0) - { - if (debug || report) - { - Info<< " ***Concave cells (using face planes) found," - << " number of cells: " << nConcaveCells << endl; - } - - return true; - } - else - { - if (debug || report) - { - Info<< " Concave cell check OK." << endl; - } - - return false; - } - - return false; + return checkConcaveCells + ( + faceAreas(), + faceCentres(), + report, + setPtr + ); } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - bool Foam::primitiveMesh::checkTopology(const bool report) const { label noFailedChecks = 0; @@ -2182,7 +1899,6 @@ bool Foam::primitiveMesh::checkTopology(const bool report) const if (checkCellsZipUp(report)) noFailedChecks++; if (checkFaceVertices(report)) noFailedChecks++; if (checkFaceFaces(report)) noFailedChecks++; - //if (checkCellDeterminant(report)) noFailedChecks++; if (noFailedChecks == 0) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C deleted file mode 100644 index 4b0d2da63aa25fb48475dca70dca108eea3d0354..0000000000000000000000000000000000000000 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C +++ /dev/null @@ -1,266 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -Description - Given a set of points, find out if the mesh resulting from point motion will - be valid without actually changing the mesh. - -\*---------------------------------------------------------------------------*/ - -#include "primitiveMesh.H" -#include "pyramidPointFaceRef.H" -#include "cell.H" -#include "unitConversion.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -bool Foam::primitiveMesh::checkMeshMotion -( - const pointField& newPoints, - const bool report -) const -{ - if (debug || report) - { - Pout<< "bool primitiveMesh::checkMeshMotion(" - << "const pointField& newPoints, const bool report) const: " - << "checking mesh motion" << endl; - } - - bool error = false; - - const faceList& f = faces(); - - const labelList& own = faceOwner(); - const labelList& nei = faceNeighbour(); - - vectorField fCtrs(nFaces()); - vectorField fAreas(nFaces()); - - makeFaceCentresAndAreas(newPoints, fCtrs, fAreas); - - // Check cell volumes and calculate new cell centres - vectorField cellCtrs(nCells()); - scalarField cellVols(nCells()); - - makeCellCentresAndVols(fCtrs, fAreas, cellCtrs, cellVols); - - scalar minVolume = GREAT; - label nNegVols = 0; - - forAll(cellVols, cellI) - { - if (cellVols[cellI] < VSMALL) - { - if (debug || report) - { - Pout<< "Zero or negative cell volume detected for cell " - << cellI << ". Volume = " << cellVols[cellI] << endl; - } - - nNegVols++; - } - - minVolume = min(minVolume, cellVols[cellI]); - } - - if (nNegVols > 0) - { - error = true; - - Pout<< "Zero or negative cell volume in mesh motion in " << nNegVols - << " cells. Min volume: " << minVolume << endl; - } - else - { - if (debug || report) - { - Pout<< "Min volume = " << minVolume - << ". Total volume = " << sum(cellVols) - << ". Cell volumes OK." << endl; - } - } - - // Check face areas - - scalar minArea = GREAT; - label nNegAreas = 0; - label nPyrErrors = 0; - label nDotProductErrors = 0; - - forAll(f, faceI) - { - const scalar a = Foam::mag(fAreas[faceI]); - - if (a < VSMALL) - { - if (debug || report) - { - if (isInternalFace(faceI)) - { - Pout<< "Zero or negative face area detected for " - << "internal face "<< faceI << " between cells " - << own[faceI] << " and " << nei[faceI] - << ". Face area magnitude = " << a << endl; - } - else - { - Pout<< "Zero or negative face area detected for " - << "boundary face " << faceI << " next to cell " - << own[faceI] << ". Face area magnitude = " - << a << endl; - } - } - - nNegAreas++; - } - - minArea = min(minArea, a); - - // Create the owner pyramid - it will have negative volume - scalar pyrVol = - pyramidPointFaceRef(f[faceI], cellCtrs[own[faceI]]).mag(newPoints); - - if (pyrVol > SMALL) - { - if (debug || report) - { - Pout<< "Negative pyramid volume: " << -pyrVol - << " for face " << faceI << " " << f[faceI] - << " and owner cell: " << own[faceI] << endl - << "Owner cell vertex labels: " - << cells()[own[faceI]].labels(f) - << endl; - } - - nPyrErrors++; - } - - if (isInternalFace(faceI)) - { - // Create the neighbour pyramid - it will have positive volume - scalar pyrVol = - pyramidPointFaceRef - ( - f[faceI], - cellCtrs[nei[faceI]] - ).mag(newPoints); - - if (pyrVol < -SMALL) - { - if (debug || report) - { - Pout<< "Negative pyramid volume: " << pyrVol - << " for face " << faceI << " " << f[faceI] - << " and neighbour cell: " << nei[faceI] << nl - << "Neighbour cell vertex labels: " - << cells()[nei[faceI]].labels(f) - << endl; - } - - nPyrErrors++; - } - - const vector d = cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]; - const vector& s = fAreas[faceI]; - scalar dDotS = (d & s)/(mag(d)*mag(s) + VSMALL); - - // Only write full message the first time - if (dDotS < SMALL && nDotProductErrors == 0) - { - // Non-orthogonality greater than 90 deg - WarningIn - ( - "primitiveMesh::checkMeshMotion" - "(const pointField& newPoints, const bool report) const" - ) << "Severe non-orthogonality in mesh motion for face " - << faceI - << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " << radToDeg(::acos(dDotS)) - << " deg." << endl; - - nDotProductErrors++; - } - } - } - - if (nNegAreas > 0) - { - error = true; - - WarningIn - ( - "primitiveMesh::checkMeshMotion" - "(const pointField& newPoints, const bool report) const" - ) << "Zero or negative face area in mesh motion in " << nNegAreas - << " faces. Min area: " << minArea << endl; - } - else - { - if (debug || report) - { - Pout<< "Min area = " << minArea - << ". Face areas OK." << endl; - } - } - - if (nPyrErrors > 0) - { - Pout<< "Detected " << nPyrErrors - << " negative pyramid volume in mesh motion" << endl; - - error = true; - } - else - { - if (debug || report) - { - Pout<< "Pyramid volumes OK." << endl; - } - } - - if (nDotProductErrors > 0) - { - Pout<< "Detected " << nDotProductErrors - << " in non-orthogonality in mesh motion." << endl; - - error = true; - } - else - { - if (debug || report) - { - Pout<< "Non-orthogonality check OK." << endl; - } - } - - if (!error && (debug || report)) - { - Pout<< "Mesh motion check OK." << endl; - } - - return error; -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.C new file mode 100644 index 0000000000000000000000000000000000000000..e94c8edbf77a1709d63377a11c6fb98e5765e067 --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.C @@ -0,0 +1,638 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "primitiveMeshTools.H" +#include "syncTools.H" +#include "pyramidPointFaceRef.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::scalar Foam::primitiveMeshTools::faceSkewness +( + const primitiveMesh& mesh, + const pointField& p, + const vectorField& fCtrs, + const vectorField& fAreas, + + const label faceI, + const point& ownCc, + const point& neiCc +) +{ + vector Cpf = fCtrs[faceI] - ownCc; + vector d = neiCc - ownCc; + + // Skewness vector + vector sv = + Cpf + - ((fAreas[faceI] & Cpf)/((fAreas[faceI] & d) + SMALL))*d; + vector svHat = sv/(mag(sv) + VSMALL); + + // Normalisation distance calculated as the approximate distance + // from the face centre to the edge of the face in the direction + // of the skewness + scalar fd = 0.2*mag(d) + VSMALL; + const face& f = mesh.faces()[faceI]; + forAll(f, pi) + { + fd = max(fd, mag(svHat & (p[f[pi]] - fCtrs[faceI]))); + } + + // Normalised skewness + return mag(sv)/fd; +} + + +Foam::scalar Foam::primitiveMeshTools::faceOrthogonality +( + const point& ownCc, + const point& neiCc, + const vector& s +) +{ + vector d = neiCc - ownCc; + + return (d & s)/(mag(d)*mag(s) + VSMALL); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::faceOrthogonality +( + const primitiveMesh& mesh, + const vectorField& areas, + const vectorField& cc +) +{ + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + + tmp<scalarField> tortho(new scalarField(mesh.nInternalFaces())); + scalarField& ortho = tortho(); + + // Internal faces + forAll(nei, faceI) + { + ortho[faceI] = faceOrthogonality + ( + cc[own[faceI]], + cc[nei[faceI]], + areas[faceI] + ); + } + + return tortho; +} + + +Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::faceSkewness +( + const primitiveMesh& mesh, + const pointField& p, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs +) +{ + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + const faceList& fcs = mesh.faces(); + + tmp<scalarField> tskew(new scalarField(mesh.nFaces())); + scalarField& skew = tskew(); + + forAll(nei, faceI) + { + skew[faceI] = faceSkewness + ( + mesh, + p, + fCtrs, + fAreas, + + faceI, + cellCtrs[own[faceI]], + cellCtrs[nei[faceI]] + ); + } + + + // Boundary faces: consider them to have only skewness error. + // (i.e. treat as if mirror cell on other side) + + for (label faceI = mesh.nInternalFaces(); faceI < mesh.nFaces(); faceI++) + { + vector Cpf = fCtrs[faceI] - cellCtrs[own[faceI]]; + + vector normal = fAreas[faceI]; + normal /= mag(normal) + VSMALL; + vector d = normal*(normal & Cpf); + + + // Skewness vector + vector sv = + Cpf + - ((fAreas[faceI] & Cpf)/((fAreas[faceI] & d) + VSMALL))*d; + vector svHat = sv/(mag(sv) + VSMALL); + + // Normalisation distance calculated as the approximate distance + // from the face centre to the edge of the face in the direction + // of the skewness + scalar fd = 0.4*mag(d) + VSMALL; + const face& f = fcs[faceI]; + forAll(f, pi) + { + fd = max(fd, mag(svHat & (p[f[pi]] - fCtrs[faceI]))); + } + + // Normalised skewness + skew[faceI] = mag(sv)/fd; + } + + return tskew; +} + +void Foam::primitiveMeshTools::facePyramidVolume +( + const primitiveMesh& mesh, + const pointField& points, + const vectorField& ctrs, + + scalarField& ownPyrVol, + scalarField& neiPyrVol +) +{ + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + const faceList& f = mesh.faces(); + + ownPyrVol.setSize(mesh.nFaces()); + neiPyrVol.setSize(mesh.nInternalFaces()); + + forAll(f, faceI) + { + // Create the owner pyramid + ownPyrVol[faceI] = -pyramidPointFaceRef + ( + f[faceI], + ctrs[own[faceI]] + ).mag(points); + + if (mesh.isInternalFace(faceI)) + { + // Create the neighbour pyramid - it will have positive volume + neiPyrVol[faceI] = pyramidPointFaceRef + ( + f[faceI], + ctrs[nei[faceI]] + ).mag(points); + } + } +} + + +void Foam::primitiveMeshTools::cellClosedness +( + const primitiveMesh& mesh, + const Vector<label>& meshD, + const vectorField& areas, + const scalarField& vols, + + scalarField& openness, + scalarField& aratio +) +{ + const labelList& own = mesh.faceOwner(); + const labelList& nei = mesh.faceNeighbour(); + + // Loop through cell faces and sum up the face area vectors for each cell. + // This should be zero in all vector components + + vectorField sumClosed(mesh.nCells(), vector::zero); + vectorField sumMagClosed(mesh.nCells(), vector::zero); + + forAll(own, faceI) + { + // Add to owner + sumClosed[own[faceI]] += areas[faceI]; + sumMagClosed[own[faceI]] += cmptMag(areas[faceI]); + } + + forAll(nei, faceI) + { + // Subtract from neighbour + sumClosed[nei[faceI]] -= areas[faceI]; + sumMagClosed[nei[faceI]] += cmptMag(areas[faceI]); + } + + + label nDims = 0; + for (direction dir = 0; dir < vector::nComponents; dir++) + { + if (meshD[dir] == 1) + { + nDims++; + } + } + + + // Check the sums + openness.setSize(mesh.nCells()); + aratio.setSize(mesh.nCells()); + + forAll(sumClosed, cellI) + { + scalar maxOpenness = 0; + + for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) + { + maxOpenness = max + ( + maxOpenness, + mag(sumClosed[cellI][cmpt]) + /(sumMagClosed[cellI][cmpt] + VSMALL) + ); + } + openness[cellI] = maxOpenness; + + // Calculate the aspect ration as the maximum of Cartesian component + // aspect ratio to the total area hydraulic area aspect ratio + scalar minCmpt = VGREAT; + scalar maxCmpt = -VGREAT; + for (direction dir = 0; dir < vector::nComponents; dir++) + { + if (meshD[dir] == 1) + { + minCmpt = min(minCmpt, sumMagClosed[cellI][dir]); + maxCmpt = max(maxCmpt, sumMagClosed[cellI][dir]); + } + } + + scalar aspectRatio = maxCmpt/(minCmpt + VSMALL); + if (nDims == 3) + { + aspectRatio = max + ( + aspectRatio, + 1.0/6.0*cmptSum(sumMagClosed[cellI])/pow(vols[cellI], 2.0/3.0) + ); + } + + aratio[cellI] = aspectRatio; + } +} + + +Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::faceConcavity +( + const scalar maxSin, + const primitiveMesh& mesh, + const pointField& p, + const vectorField& faceAreas +) +{ + const faceList& fcs = mesh.faces(); + + vectorField faceNormals(faceAreas); + faceNormals /= mag(faceNormals) + VSMALL; + + tmp<scalarField> tfaceAngles(new scalarField(mesh.nFaces())); + scalarField& faceAngles = tfaceAngles(); + + + forAll(fcs, faceI) + { + const face& f = fcs[faceI]; + + // Get edge from f[0] to f[size-1]; + vector ePrev(p[f.first()] - p[f.last()]); + scalar magEPrev = mag(ePrev); + ePrev /= magEPrev + VSMALL; + + scalar maxEdgeSin = 0.0; + + forAll(f, fp0) + { + // Get vertex after fp + label fp1 = f.fcIndex(fp0); + + // Normalized vector between two consecutive points + vector e10(p[f[fp1]] - p[f[fp0]]); + scalar magE10 = mag(e10); + e10 /= magE10 + VSMALL; + + if (magEPrev > SMALL && magE10 > SMALL) + { + vector edgeNormal = ePrev ^ e10; + scalar magEdgeNormal = mag(edgeNormal); + + if (magEdgeNormal < maxSin) + { + // Edges (almost) aligned -> face is ok. + } + else + { + // Check normal + edgeNormal /= magEdgeNormal; + + if ((edgeNormal & faceNormals[faceI]) < SMALL) + { + maxEdgeSin = max(maxEdgeSin, magEdgeNormal); + } + } + } + + ePrev = e10; + magEPrev = magE10; + } + + faceAngles[faceI] = maxEdgeSin; + } + + return tfaceAngles; +} + + +Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::faceFlatness +( + const primitiveMesh& mesh, + const pointField& p, + const vectorField& fCtrs, + const vectorField& faceAreas +) +{ + const faceList& fcs = mesh.faces(); + + // Areas are calculated as the sum of areas. (see + // primitiveMeshFaceCentresAndAreas.C) + scalarField magAreas(mag(faceAreas)); + + tmp<scalarField> tfaceFlatness(new scalarField(mesh.nFaces(), 1.0)); + scalarField& faceFlatness = tfaceFlatness(); + + + forAll(fcs, faceI) + { + const face& f = fcs[faceI]; + + if (f.size() > 3 && magAreas[faceI] > VSMALL) + { + const point& fc = fCtrs[faceI]; + + // Calculate the sum of magnitude of areas and compare to magnitude + // of sum of areas. + + scalar sumA = 0.0; + + forAll(f, fp) + { + const point& thisPoint = p[f[fp]]; + const point& nextPoint = p[f.nextLabel(fp)]; + + // Triangle around fc. + vector n = 0.5*((nextPoint - thisPoint)^(fc - thisPoint)); + sumA += mag(n); + } + + faceFlatness[faceI] = magAreas[faceI] / (sumA+VSMALL); + } + } + + return tfaceFlatness; +} + + +//Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::edgeAlignment +//( +// const primitiveMesh& mesh, +// const Vector<label>& meshD, +// const pointField& p +//) +//{ +// label nDirs = 0; +// for (direction cmpt=0; cmpt<vector::nComponents; cmpt++) +// { +// if (meshD[cmpt] == 1) +// { +// nDirs++; +// } +// else if (meshD[cmpt] != 0) +// { +// FatalErrorIn +// ( +// "primitiveMeshTools::edgeAlignment" +// "(const primitiveMesh&, const Vector<label>&" +// ", const pointField&)" +// ) << "directions should contain 0 or 1 but is now " << meshD +// << exit(FatalError); +// } +// } +// +// tmp<scalarField> tedgeAlignment(new scalarField(mesh.nFaces(), 0.0)); +// scalarField& edgeAlignment = tedgeAlignment(); +// +// if (nDirs != vector::nComponents) +// { +// const faceList& fcs = mesh.faces(); +// +// forAll(fcs, faceI) +// { +// const face& f = fcs[faceI]; +// +// forAll(f, fp) +// { +// label p0 = f[fp]; +// label p1 = f.nextLabel(fp); +// if (p0 < p1) +// { +// vector d(p[p1]-p[p0]); +// scalar magD = mag(d); +// +// if (magD > ROOTVSMALL) +// { +// d /= magD; +// +// // Check how many empty directions are used by the +// // edge. +// label nEmptyDirs = 0; +// label nNonEmptyDirs = 0; +// for +// ( +// direction cmpt=0; +// cmpt<vector::nComponents; +// cmpt++ +// ) +// { +// if (mag(d[cmpt]) > 1e-6) +// { +// if (meshD[cmpt] == 0) +// { +// nEmptyDirs++; +// } +// else +// { +// nNonEmptyDirs++; +// } +// } +// } +// +// if (nEmptyDirs == 0) +// { +// // Purely in ok directions. +// } +// else if (nEmptyDirs == 1) +// { +// // Ok if purely in empty directions. +// if (nNonEmptyDirs > 0) +// { +// edgeAlignment[faceI] = max +// ( +// edgeAlignment[faceI], +// 1 +// ); +// } +// } +// else if (nEmptyDirs > 1) +// { +// // Always an error +// edgeAlignment[faceI] = max +// ( +// edgeAlignment[faceI], +// 2 +// ); +// } +// } +// } +// } +// } +// } +// +// return tedgeAlignment; +//} + + +// Checks cells with 1 or less internal faces. Give numerical problems. +Foam::tmp<Foam::scalarField> Foam::primitiveMeshTools::cellDeterminant +( + const primitiveMesh& mesh, + const Vector<label>& meshD, + const vectorField& faceAreas, + const PackedBoolList& internalOrCoupledFace +) +{ + // Determine number of dimensions and (for 2D) missing dimension + label nDims = 0; + label twoD = -1; + for (direction dir = 0; dir < vector::nComponents; dir++) + { + if (meshD[dir] == 1) + { + nDims++; + } + else + { + twoD = dir; + } + } + + + + tmp<scalarField> tcellDeterminant(new scalarField(mesh.nCells())); + scalarField& cellDeterminant = tcellDeterminant(); + + const cellList& c = mesh.cells(); + + if (nDims == 1) + { + cellDeterminant = 1.0; + } + else + { + forAll (c, cellI) + { + const labelList& curFaces = c[cellI]; + + // Calculate local normalization factor + scalar avgArea = 0; + + label nInternalFaces = 0; + + forAll(curFaces, i) + { + if (internalOrCoupledFace[curFaces[i]]) + { + avgArea += mag(faceAreas[curFaces[i]]); + + nInternalFaces++; + } + } + + if (nInternalFaces == 0) + { + cellDeterminant[cellI] = 0; + } + else + { + avgArea /= nInternalFaces; + + symmTensor areaTensor(symmTensor::zero); + + forAll(curFaces, i) + { + if (internalOrCoupledFace[curFaces[i]]) + { + areaTensor += sqr(faceAreas[curFaces[i]]/avgArea); + } + } + + if (nDims == 2) + { + // Add the missing eigenvector (such that it does not + // affect the determinant) + if (twoD == 0) + { + areaTensor.xx() = 1; + } + else if (twoD == 1) + { + areaTensor.yy() = 1; + } + else + { + areaTensor.zz() = 1; + } + } + + cellDeterminant[cellI] = mag(det(areaTensor)); + } + } + } + + return tcellDeterminant; +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H new file mode 100644 index 0000000000000000000000000000000000000000..5e3b2c07fd4b03aaacab2f82fca09c83187e74c9 --- /dev/null +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshTools.H @@ -0,0 +1,168 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Namespace + Foam::primitiveMeshTools + +Description + Collection of static functions operating on primitiveMesh (mainly checks). + +SourceFiles + primitiveMeshTools.C + +\*---------------------------------------------------------------------------*/ +#ifndef primitiveMeshTools_H +#define primitiveMeshTools_H + +#include "primitiveMesh.H" +#include "PackedBoolList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Namespace primitiveMeshTools Declaration +\*---------------------------------------------------------------------------*/ + +class primitiveMeshTools +{ + +protected: + + // Protected Member Functions + + //- Skewness of single face + static scalar faceSkewness + ( + const primitiveMesh& mesh, + const pointField& p, + const vectorField& fCtrs, + const vectorField& fAreas, + + const label faceI, + const point& ownCc, + const point& neiCc + ); + + //- Orthogonality of single face + static scalar faceOrthogonality + ( + const point& ownCc, + const point& neiCc, + const vector& s + ); + +public: + + //- Generate non-orthogonality field (internal faces only) + static tmp<scalarField> faceOrthogonality + ( + const primitiveMesh& mesh, + const vectorField& fAreas, + const vectorField& cellCtrs + ); + + //- Generate face pyramid volume fields + static void facePyramidVolume + ( + const primitiveMesh& mesh, + const pointField& points, + const vectorField& cellCtrs, + scalarField& ownPyrVol, + scalarField& neiPyrVol + ); + + //- Generate skewness field + static tmp<scalarField> faceSkewness + ( + const primitiveMesh& mesh, + const pointField& points, + const vectorField& fCtrs, + const vectorField& fAreas, + const vectorField& cellCtrs + ); + + //- Generate cell openness and cell ascpect ratio field + static void cellClosedness + ( + const primitiveMesh& mesh, + const Vector<label>& meshD, + const vectorField& areas, + const scalarField& vols, + scalarField& openness, + scalarField& aratio + ); + + //- Generate face concavity field. Returns per face the (sin of the) + // most concave angle between two consecutive edges + static tmp<scalarField> faceConcavity + ( + const scalar maxSin, + const primitiveMesh& mesh, + const pointField& p, + const vectorField& faceAreas + ); + + //- Generate face flatness field. Compares the individual triangles' + // normals against the face average normal. Between 0 (fully warped) + // and 1 (fully flat) + static tmp<scalarField> faceFlatness + ( + const primitiveMesh& mesh, + const pointField& p, + const vectorField& fCtrs, + const vectorField& faceAreas + ); + + //- Generate edge alignment field. Is per face the minimum aligned edge + // (does not use edge addressing) + static tmp<scalarField> edgeAlignment + ( + const primitiveMesh& mesh, + const Vector<label>& directions, + const pointField& p + ); + + //- Generate cell determinant field + static tmp<scalarField> cellDeterminant + ( + const primitiveMesh& mesh, + const Vector<label>& directions, + const vectorField& faceAreas, + const PackedBoolList& internalOrCoupledFace + ); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFaceCentresAndAreas.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFaceCentresAndAreas.C index 8de907660322f8e278b7b315918a3c4e0b17c675..589ff7a98bc4c1f9b1ce0e61ae4cd76711bd0a97 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFaceCentresAndAreas.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshFaceCentresAndAreas.C @@ -118,13 +118,12 @@ void Foam::primitiveMesh::makeFaceCentresAndAreas sumAc += a*c; } - + // This is to deal with zero-area faces. Mark very small faces + // to be detected in e.g., processorPolyPatch. if (sumA < ROOTVSMALL) { - // Sum of area too small. No chance of reliably calculating - // centroid so fallback to average. fCtrs[facei] = fCentre; - fAreas[facei] = 0.5*sumN; + fAreas[facei] = vector::zero; } else { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C index 5b754a43e24db789805256d0fcedc33be12bc1f3..fe5a09b19f1d09d944721058420b9317838aa3c7 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/patchZones.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,10 +25,12 @@ License #include "patchZones.H" - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::patchZones, 0); +namespace Foam +{ +defineTypeNameAndDebug(patchZones, 0); +} // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C index e7015a1f5b812980b004fcedddaad5698b14ce37..9e1455874b2378ca4a9ede7e332a441ecd795ac9 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitivePatch/walkPatch.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 @@ -28,7 +28,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::walkPatch, 0); +namespace Foam +{ +defineTypeNameAndDebug(walkPatch, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C index 956997974feea2a7e9fae9f1cdbe4aeb9f91bfcf..0968c71ca387f47a8ba98110468fc1d33ffbebea 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.C +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.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 @@ -238,45 +238,6 @@ Foam::treeBoundBox Foam::treeBoundBox::subBbox } -bool Foam::treeBoundBox::overlaps -( - const point& centre, - const scalar radiusSqr -) const -{ - // Find out where centre is in relation to bb. - // Find nearest point on bb. - scalar distSqr = 0; - - for (direction dir = 0; dir < vector::nComponents; dir++) - { - scalar d0 = min()[dir] - centre[dir]; - scalar d1 = max()[dir] - centre[dir]; - - if ((d0 > 0) != (d1 > 0)) - { - // centre inside both extrema. This component does not add any - // distance. - } - else if (Foam::mag(d0) < Foam::mag(d1)) - { - distSqr += d0*d0; - } - else - { - distSqr += d1*d1; - } - - if (distSqr > radiusSqr) - { - return false; - } - } - - return true; -} - - // line intersection. Returns true if line (start to end) inside // bb or intersects bb. Sets pt to intersection. // diff --git a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H index aecdd905b342678c22f6878e70283eb71a78c1b3..15528c02ba73cd170658d4f73c47f3a71b1a7cb1 100644 --- a/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.H +++ b/src/OpenFOAM/meshes/treeBoundBox/treeBoundBox.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 @@ -272,9 +272,6 @@ public: //- Overlaps other bounding box? using boundBox::overlaps; - //- Overlaps boundingSphere (centre + sqr(radius))? - bool overlaps(const point&, const scalar radiusSqr) const; - //- Intersects segment; set point to intersection position and face, // return true if intersection found. // (pt argument used during calculation even if not intersecting). diff --git a/src/OpenFOAM/primitives/Pair/Pair.H b/src/OpenFOAM/primitives/Pair/Pair.H index 3cd37f4d7bb4436714cf9a987c5c37472d7eaf03..3f2de6d09095d2559329b1f03383fcfc531ea957 100644 --- a/src/OpenFOAM/primitives/Pair/Pair.H +++ b/src/OpenFOAM/primitives/Pair/Pair.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 @@ -167,6 +167,19 @@ public: { return !(a == b); } + + friend bool operator<(const Pair<Type>& a, const Pair<Type>& b) + { + return + ( + a.first() < b.first() + || + ( + !(b.first() < a.first()) + && a.second() < b.second() + ) + ); + } }; diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H index 8d82711e15478fe5166069ea042fdf2da8f7a55b..07eaba880da82dd0c7b158ce971c1227a497aa6f 100644 --- a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H +++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.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 @@ -79,6 +79,7 @@ public: static const SymmTensor one; static const SymmTensor max; static const SymmTensor min; + static const SymmTensor I; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C b/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C index a70e14c19726615247152f10793d95c1a11ac739..22f2b9eb8dbf0c9e50ca0c41ca4ad4e4fe311a88 100644 --- a/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.C +++ b/src/OpenFOAM/primitives/SymmTensor/symmTensor/symmTensor.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 @@ -75,6 +75,14 @@ const symmTensor symmTensor::min -VGREAT ); +template<> +const symmTensor symmTensor::I +( + 1, 0, 0, + 1, 0, + 1 +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H index a1554dc916cfc7ea8225ce5788d09cd67ece0f99..8b3c1d9a9d87ecc5a104d2d566454ebce491fc28 100644 --- a/src/OpenFOAM/primitives/Tensor/Tensor.H +++ b/src/OpenFOAM/primitives/Tensor/Tensor.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 @@ -82,6 +82,7 @@ public: static const Tensor one; static const Tensor max; static const Tensor min; + static const Tensor I; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C index 57ecd897b3d0fc5f27ae986e5c9ffa6c5b3b892b..a62eeff5e40190bcd270be4be417ae3d8c007efe 100644 --- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C +++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C @@ -76,6 +76,14 @@ const tensor tensor::min -VGREAT, -VGREAT, -VGREAT ); +template<> +const tensor tensor::I +( + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H index ea3bca9d39c0ea3165ac8e54f5eca7c367bf09e7..a354bd038c1e2633e19966057f979db8e2cd8342 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.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 @@ -75,6 +75,7 @@ public: static const Tensor2D one; static const Tensor2D max; static const Tensor2D min; + static const Tensor2D I; //- Component labeling enumeration diff --git a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C index 08bc334e6d87a52d49c1803542eee595950bb9e6..3d86f738f0c7bac14e764d9e2c1f0ae525edc149 100644 --- a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C +++ b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C @@ -70,6 +70,13 @@ const tensor2D tensor2D::min -VGREAT, -VGREAT ); +template<> +const tensor2D tensor2D::I +( + 1, 0, + 0, 1 +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C index 66b556e27b58dc147ec21b3bc8a41ffa1f2ed994..ec1e8efddaf95cf58eae8656bb084dbff77357ce 100644 --- a/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.C +++ b/src/OpenFOAM/primitives/globalIndexAndTransform/globalIndexAndTransform.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 @@ -28,9 +28,11 @@ License // * * * * * * * * * * * * Private Static Data Members * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::globalIndexAndTransform, 0); - -const Foam::label Foam::globalIndexAndTransform::base_ = 32; +namespace Foam +{ +defineTypeNameAndDebug(globalIndexAndTransform, 0); +const label globalIndexAndTransform::base_ = 32; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/ops/ops.H b/src/OpenFOAM/primitives/ops/ops.H index 66d793084962f6706f6bf5eb20abc7c3a64f215a..cab91fcfb5eee81d71a4cb8280b8d21e0c25e1a0 100644 --- a/src/OpenFOAM/primitives/ops/ops.H +++ b/src/OpenFOAM/primitives/ops/ops.H @@ -90,40 +90,68 @@ EqOp(nopEq, (void)x) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define Op(opName, op) \ - \ -template<class T, class T1, class T2> \ -class opName##Op3 \ -{ \ -public: \ - \ - T operator()(const T1& x, const T2& y) const \ - { \ - return op; \ - } \ -}; \ - \ -template<class T1, class T2> \ -class opName##Op2 \ -{ \ -public: \ - \ - T1 operator()(const T1& x, const T2& y) const \ - { \ - return op; \ - } \ -}; \ - \ -template<class T> \ -class opName##Op \ -{ \ -public: \ - \ - T operator()(const T& x, const T& y) const \ - { \ - return op; \ - } \ -}; +#define Op(opName, op) \ + \ + template<class T, class T1, class T2> \ + class opName##Op3 \ + { \ + public: \ + \ + T operator()(const T1& x, const T2& y) const \ + { \ + return op; \ + } \ + }; \ + \ + template<class T1, class T2> \ + class opName##Op2 \ + { \ + public: \ + \ + T1 operator()(const T1& x, const T2& y) const \ + { \ + return op; \ + } \ + }; \ + \ + template<class T> \ + class opName##Op \ + { \ + public: \ + \ + T operator()(const T& x, const T& y) const \ + { \ + return op; \ + } \ + }; + + +#define weightedOp(opName, op) \ + \ + template<class Type, class CombineOp> \ + class opName##WeightedOp \ + { \ + const CombineOp& cop_; \ + \ + public: \ + \ + opName##WeightedOp(const CombineOp& cop) \ + : \ + cop_(cop) \ + {} \ + \ + void operator() \ + ( \ + Type& x, \ + const label index, \ + const Type& y, \ + const scalar weight \ + ) const \ + { \ + cop_(x, op); \ + } \ + }; \ + Op(sum, x + y) @@ -147,6 +175,8 @@ Op(lessEq, x <= y) Op(greater, x > y) Op(greaterEq, x >= y) +weightedOp(multiply, weight * y) + #undef Op diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C index b7e11d644fed2cc622e40beeb174e453c05c0d48..feabf361096502db97ae9d189d2487b81ce9571e 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C +++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C @@ -312,7 +312,7 @@ Foam::string Foam::stringOps::getVariable " const bool\n" ")\n", dict - ) << "Cannot find environment variable " + ) << "Cannot find dictionary variable " << name << exit(FatalIOError); } diff --git a/src/OpenFOAM/primitives/triad/triad.C b/src/OpenFOAM/primitives/triad/triad.C new file mode 100644 index 0000000000000000000000000000000000000000..80218dc77693978836f7b1ebc918dc0ea41eee4e --- /dev/null +++ b/src/OpenFOAM/primitives/triad/triad.C @@ -0,0 +1,338 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "triad.H" +#include "transform.H" +#include "tensor.H" +#include "quaternion.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<> +const char* const triad::Vector<vector>::typeName = "triad"; + +template<> +const char* triad::Vector<vector>::componentNames[] = {"x", "y", "z"}; + +const triad triad::zero(vector::zero, vector::zero, vector::zero); + +const triad triad::one(vector::one, vector::one, vector::one); + +const triad triad::max(vector::max, vector::max, vector::max); + +const triad triad::min(vector::min, vector::min, vector::min); + +const triad triad::unset(triad::max); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::triad::triad(const quaternion& q) +{ + tensor Rt(q.R().T()); + x() = Rt.x(); + y() = Rt.y(); + z() = Rt.z(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::triad::orthogonalize() +{ + // Hack for 2D z-slab cases + // if (!set(2)) + // { + // operator[](2) = vector(0, 0, 1); + // } + + // If only two of the axes are set, set the third + if (set(0) && set(1) && !set(2)) + { + operator[](2) = orthogonal(operator[](0), operator[](1)); + } + else if (set(0) && set(2) && !set(1)) + { + operator[](1) = orthogonal(operator[](0), operator[](2)); + } + else if (set(1) && set(2) && !set(0)) + { + operator[](0) = orthogonal(operator[](1), operator[](2)); + } + + // If all the axes are set + if (set()) + { + for (int i=0; i<2; i++) + { + scalar o01 = mag(operator[](0) & operator[](1)); + scalar o02 = mag(operator[](0) & operator[](2)); + scalar o12 = mag(operator[](1) & operator[](2)); + + if (o01 < o02 && o01 < o12) + { + operator[](2) = orthogonal(operator[](0), operator[](1)); + + // if (o02 < o12) + // { + // operator[](1) = orthogonal(operator[](0), operator[](2)); + // } + // else + // { + // operator[](0) = orthogonal(operator[](1), operator[](2)); + // } + } + else if (o02 < o12) + { + operator[](1) = orthogonal(operator[](0), operator[](2)); + + // if (o01 < o12) + // { + // operator[](2) = orthogonal(operator[](0), operator[](1)); + // } + // else + // { + // operator[](0) = orthogonal(operator[](1), operator[](2)); + // } + } + else + { + operator[](0) = orthogonal(operator[](1), operator[](2)); + + // if (o02 < o01) + // { + // operator[](1) = orthogonal(operator[](0), operator[](2)); + // } + // else + // { + // operator[](2) = orthogonal(operator[](0), operator[](1)); + // } + } + } + } +} + + +void Foam::triad::operator+=(const triad& t2) +{ + if (t2.set(0) && !set(0)) + { + operator[](0) = t2.operator[](0); + } + + if (t2.set(1) && !set(1)) + { + operator[](1) = t2.operator[](1); + } + + if (t2.set(2) && !set(2)) + { + operator[](2) = t2.operator[](2); + } + + if (set() && t2.set()) + { + direction correspondance[3]; + short signd[3]; + + for (direction i=0; i<3; i++) + { + scalar mostAligned = -1; + for (direction j=0; j<3; j++) + { + bool set = false; + for (direction k=0; k<i; k++) + { + if (correspondance[k] == j) + { + set = true; + break; + } + } + + if (!set) + { + scalar a = operator[](i) & t2.operator[](j); + scalar maga = mag(a); + + if (maga > mostAligned) + { + correspondance[i] = j; + mostAligned = maga; + signd[i] = sign(a); + } + } + } + } + + for (direction i=0; i<3; i++) + { + operator[](i) += signd[i]*t2.operator[](correspondance[i]); + } + } +} + + +void Foam::triad::align(const vector& v) +{ + if (set()) + { + vector mostAligned + ( + mag(v & operator[](0)), + mag(v & operator[](1)), + mag(v & operator[](2)) + ); + + scalar mav; + + if + ( + mostAligned.x() > mostAligned.y() + && mostAligned.x() > mostAligned.z() + ) + { + mav = mostAligned.x(); + mostAligned = operator[](0); + } + else if (mostAligned.y() > mostAligned.z()) + { + mav = mostAligned.y(); + mostAligned = operator[](1); + } + else + { + mav = mostAligned.z(); + mostAligned = operator[](2); + } + + if (mav < 0.99) + { + tensor R(rotationTensor(mostAligned, v)); + + operator[](0) = transform(R, operator[](0)); + operator[](1) = transform(R, operator[](1)); + operator[](2) = transform(R, operator[](2)); + } + } +} + + +Foam::triad Foam::triad::sortxyz() const +{ + triad t; + + if + ( + mag(operator[](0).x()) > mag(operator[](1).x()) + && mag(operator[](0).x()) > mag(operator[](2).x()) + ) + { + t[0] = operator[](0); + + if (mag(operator[](1).y()) > mag(operator[](2).y())) + { + t[1] = operator[](1); + t[2] = operator[](2); + } + else + { + t[1] = operator[](2); + t[2] = operator[](1); + } + } + else if + ( + mag(operator[](1).x()) > mag(operator[](2).x()) + ) + { + t[0] = operator[](1); + + if (mag(operator[](0).y()) > mag(operator[](2).y())) + { + t[1] = operator[](0); + t[2] = operator[](2); + } + else + { + t[1] = operator[](2); + t[2] = operator[](0); + } + } + else + { + t[0] = operator[](2); + + if (mag(operator[](0).y()) > mag(operator[](1).y())) + { + t[1] = operator[](0); + t[2] = operator[](1); + } + else + { + t[1] = operator[](1); + t[2] = operator[](0); + } + } + + if (t[0].x() < 0) t[0] *= -1; + if (t[1].y() < 0) t[1] *= -1; + if (t[2].z() < 0) t[2] *= -1; + + return t; +} + + + +Foam::triad::operator quaternion() const +{ + tensor R; + + R.xx() = x().x(); + R.xy() = y().x(); + R.xz() = z().x(); + + R.yx() = x().y(); + R.yy() = y().y(); + R.yz() = z().y(); + + R.zx() = x().z(); + R.zy() = y().z(); + R.zz() = z().z(); + + return quaternion(R); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/triad/triad.H b/src/OpenFOAM/primitives/triad/triad.H new file mode 100644 index 0000000000000000000000000000000000000000..624116602e1330f71eb5674e8a53621c95495632 --- /dev/null +++ b/src/OpenFOAM/primitives/triad/triad.H @@ -0,0 +1,169 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::triad + +Description + Representation of a 3D Cartesian coordinate system as a Vector of vectors. + +See Also + Foam::quaternion + +SourceFiles + triadI.H + triad.C + +\*---------------------------------------------------------------------------*/ + +#ifndef triad_H +#define triad_H + +#include "vector.H" +#include "contiguous.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class Istream; +class Ostream; + +// Forward declaration of friend functions and operators +class triad; +Istream& operator>>(Istream&, triad&); +Ostream& operator<<(Ostream&, const triad&); + +class quaternion; + + +/*---------------------------------------------------------------------------*\ + Class triad Declaration +\*---------------------------------------------------------------------------*/ + +class triad +: + public Vector<vector> +{ + +public: + + // Constructors + + //- Construct null + inline triad(); + + //- Construct from components + inline triad(const Vector<vector>& vv); + + //- Construct from coordinate axes + inline triad(const vector& x, const vector& y, const vector& z); + + //- Construct from a primary axis with the other two unset + inline triad(const vector& pa); + + //- Construct from a quaternion + triad(const quaternion& q); + + //- Construct from Istream + inline triad(Istream&); + + + // Static data members + + static const triad zero; + static const triad one; + static const triad max; + static const triad min; + static const triad unset; + + + // Member Functions + + //- Is the vector in the direction d set + inline bool set(const direction d) const; + + //- Are all the vector set + inline bool set() const; + + //- Return the primary direction of the vector v + static inline direction primaryDirection(const vector& v); + + //- Return the vector orthogonal to the two provided + static inline vector orthogonal(const vector& v1, const vector& v2); + + //- Orthogonalize this triad so that it is ortho-normal + void orthogonalize(); + + //- Normalize each set axis vector to have a unit magnitude + void normalize(); + + //- Align this triad with the given vector v + // by rotating the most aligned axis to be coincident with v + void align(const vector& v); + + //- Sort the axes such that they are closest to the x, y and z axes + triad sortxyz() const; + + //- convert to a quaternion + operator quaternion() const; + + + // Member Operators + + inline void operator=(const Vector<vector>&); + + //- Add the triad t2 to this triad + // without normalizing or orthogonalizing + void operator+=(const triad& t2); + + + // IOstream Operators + + inline friend Istream& operator>>(Istream&, triad&); + inline friend Ostream& operator<<(Ostream&, const triad&); +}; + + +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +//- Data associated with quaternion type are contiguous +template<> +inline bool contiguous<triad>() {return true;} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "triadI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/triad/triadI.H b/src/OpenFOAM/primitives/triad/triadI.H new file mode 100644 index 0000000000000000000000000000000000000000..2025dd6dd72f7e09c5321b2c22a44d148b6399b2 --- /dev/null +++ b/src/OpenFOAM/primitives/triad/triadI.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +inline Foam::triad::triad() +: + Vector<vector>(triad::unset) +{} + + +inline Foam::triad::triad(const Vector<vector>& vv) +: + Vector<vector>(vv) +{} + + +inline Foam::triad::triad(const vector& x, const vector& y, const vector& z) +: + Vector<vector>(x, y, z) +{} + + +inline Foam::triad::triad(const vector& pa) +{ + operator=(triad::unset); + operator[](primaryDirection(pa)) = pa; +} + + +inline Foam::triad::triad(Istream& is) +: + Vector<vector>(is) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline bool Foam::triad::set(const direction d) const +{ + return operator[](d)[0] < GREAT; // vector::zero; +} + + +inline bool Foam::triad::set() const +{ + return set(0) && set(1) && set(2); +} + + +inline Foam::direction Foam::triad::primaryDirection(const vector& v) +{ + if (mag(v.x()) > mag(v.y()) && mag(v.x()) > mag(v.z())) + { + return triad::X; + } + else if (mag(v.y()) > mag(v.z())) + { + return triad::Y; + } + else + { + return triad::Z; + } +} + + +inline Foam::vector Foam::triad::orthogonal +( + const vector& v1, + const vector& v2 +) +{ + vector v3 = v1 ^ v2; + + scalar magV3 = mag(v3); + + if (magV3 > 0.5) + { + return v3/magV3; + } + else + { + return triad::unset[0]; + } +} + + +inline void Foam::triad::normalize() +{ + if (set(0)) operator[](0) /= mag(operator[](0)); + if (set(1)) operator[](1) /= mag(operator[](1)); + if (set(2)) operator[](2) /= mag(operator[](2)); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +inline void Foam::triad::operator=(const Vector<vector>& vv) +{ + Vector<vector>::operator=(vv); +} + + +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // + +inline Foam::Istream& Foam::operator>>(Istream& is, triad& t) +{ + is >> static_cast<Vector<vector>&>(t); + return is; +} + + +inline Foam::Ostream& Foam::operator<<(Ostream& os, const triad& t) +{ + os << static_cast<const Vector<vector>&>(t); + return os; +} + + +// ************************************************************************* // diff --git a/src/Pstream/gamma/Pstream.C b/src/Pstream/gamma/Pstream.C index 4994fe7884c5ea8f8db5a23d770149ba931deb87..8113e2b1fcd1b9eb2f33dc394fef35ee5c14a875 100644 --- a/src/Pstream/gamma/Pstream.C +++ b/src/Pstream/gamma/Pstream.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 @@ -151,7 +151,7 @@ static void handler(void) // Save the pointer (that gamma knows about) so we can safely // gamma_switch_to_buffer with a valid pointer. - // Not sure if nessecary but do anyway. + // Not sure if necessary but do anyway. savedBuf.transfer(buf); // Resize all the buffers diff --git a/src/combustionModels/Make/options b/src/combustionModels/Make/options index 77f96e3a4a6ae84658800f7543df20b954f4a8f1..29d5e7e6a55c726a536866827d92294c26fb6ab2 100644 --- a/src/combustionModels/Make/options +++ b/src/combustionModels/Make/options @@ -12,4 +12,5 @@ EXE_INC = \ LIB_LIBS = \ -lfiniteVolume \ + -lcompressibleLESModels \ -lchemistryModel diff --git a/src/conversion/meshReader/createPolyBoundary.C b/src/conversion/meshReader/createPolyBoundary.C index e0c898156abef7178a6349eb3fe0d1273902df2b..47fb2008f7b5cdf5da24ce27f72298d8050fe6c7 100644 --- a/src/conversion/meshReader/createPolyBoundary.C +++ b/src/conversion/meshReader/createPolyBoundary.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 @@ -303,14 +303,12 @@ void Foam::meshReader::createPolyBoundary() Info<< "Added " << nMissingFaces << " unmatched faces" << endl; + // Add missing faces to last patch ('Default_Empty' etc.) if (nMissingFaces > 0) { patchSizes_.last() = nMissingFaces; } - else - { - patchStarts_.setSize(patchStarts_.size() - 1); - } + // reset the size of the face list meshFaces_.setSize(nCreatedFaces); diff --git a/src/conversion/meshReader/meshReader.C b/src/conversion/meshReader/meshReader.C index b6f50c24525da948890767078f08283e2406bb49..851492229dd4730e4ebfa1a0461f11a2587871d0 100644 --- a/src/conversion/meshReader/meshReader.C +++ b/src/conversion/meshReader/meshReader.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 @@ -138,7 +138,7 @@ Foam::autoPtr<Foam::polyMesh> Foam::meshReader::mesh IOobject ( polyMesh::defaultRegion, - "constant", + registry.time().constant(), registry ), xferMove(points_), diff --git a/src/conversion/meshReader/meshReaderAux.C b/src/conversion/meshReader/meshReaderAux.C index 91708d8055734358c7823121d9fd59743b4081de..95360dba1e71965d77dd330fd367cb57a6c45e40 100644 --- a/src/conversion/meshReader/meshReaderAux.C +++ b/src/conversion/meshReader/meshReaderAux.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,7 +26,7 @@ License #include "meshReader.H" #include "IOMap.H" #include "OFstream.H" - +#include "Time.H" // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * // @@ -80,7 +80,7 @@ void Foam::meshReader::writeInterfaces(const objectRegistry& registry) const IOobject ( "interfaces", - "constant", + registry.time().constant(), polyMesh::meshSubDir, registry, IOobject::NO_READ, @@ -115,7 +115,7 @@ void Foam::meshReader::writeMeshLabelList IOobject ( propertyName, - "constant", + registry.time().constant(), polyMesh::meshSubDir, registry, IOobject::NO_READ, diff --git a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C b/src/conversion/meshWriter/starcd/STARCDMeshWriter.C index 2df70059e2ae8224989b88d148b823d5d8f49752..08383060e144ff41ccf1d526f079ee186ba36ef1 100644 --- a/src/conversion/meshWriter/starcd/STARCDMeshWriter.C +++ b/src/conversion/meshWriter/starcd/STARCDMeshWriter.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 @@ -72,7 +72,7 @@ void Foam::meshWriters::STARCD::getCellTable() IOobject ( "cellTableId", - "constant", + mesh_.time().constant(), polyMesh::meshSubDir, mesh_, IOobject::READ_IF_PRESENT, @@ -506,7 +506,7 @@ bool Foam::meshWriters::STARCD::write(const fileName& meshName) const if ( mesh_.time().timeName() != "0" - && mesh_.time().timeName() != "constant" + && mesh_.time().timeName() != mesh_.time().constant() ) { baseName += "_" + mesh_.time().timeName(); diff --git a/src/conversion/polyDualMesh/polyDualMesh.C b/src/conversion/polyDualMesh/polyDualMesh.C index 3e72254d38dda9509df49e678e0af6ab1b04e858..9ed6be4c8ffc07e0881c47ad1bdb7f21acc4ecb6 100644 --- a/src/conversion/polyDualMesh/polyDualMesh.C +++ b/src/conversion/polyDualMesh/polyDualMesh.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 @@ -424,7 +424,7 @@ void Foam::polyDualMesh::collectPatchInternalFace { featEdgeIndices2[i] = dualFace2.size() -1 - featEdgeIndices2[i]; } - // Reverse indices (might not be nessecary but do anyway) + // Reverse indices (might not be necessary but do anyway) reverse(featEdgeIndices2); } } diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C index 6cf51363b1daa36596ca816a3c187e1b4f1328ed..f2d3a7f4ecd63806e6b0083d73bd067bf797970f 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.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 @@ -27,9 +27,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::dynamicFvMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(dynamicFvMesh, 0); -defineRunTimeSelectionTable(Foam::dynamicFvMesh, IOobject); +defineRunTimeSelectionTable(dynamicFvMesh, IOobject); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index b0f22f5f7ee0df3488cad38356329b60e97814f0..c8819904ea461809cb4ce1e4a6d400dddea04801 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.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 @@ -299,8 +299,7 @@ Foam::dynamicRefineFvMesh::refine } if (debug) { - Info<< "Found " << returnReduce(masterFaces.size(), sumOp<label>()) - << " split faces " << endl; + Pout<< "Found " << masterFaces.size() << " split faces " << endl; } HashTable<const surfaceScalarField*> fluxes @@ -332,7 +331,7 @@ Foam::dynamicRefineFvMesh::refine if (debug) { - Info<< "Mapping flux " << iter.key() + Pout<< "Mapping flux " << iter.key() << " using interpolated flux " << UName << endl; } diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.C index 815361bec07e5306c51cd38c3786a10790278d8c..10a3bb079965bcb6902d0922d6b08c3f52ae459d 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.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 @@ -27,9 +27,13 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::solidBodyMotionFunction, 0); +namespace Foam +{ +defineTypeNameAndDebug(solidBodyMotionFunction, 0); + +defineRunTimeSelectionTable(solidBodyMotionFunction, dictionary); +} -defineRunTimeSelectionTable(Foam::solidBodyMotionFunction, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/Make/files b/src/dynamicMesh/Make/files index 21dcc7239828316acbf60f577c4c8c125b2156ec..4bc6aa0c5296df46c038941b251200a5b1a0fa34 100644 --- a/src/dynamicMesh/Make/files +++ b/src/dynamicMesh/Make/files @@ -25,6 +25,7 @@ polyTopoChange/polyTopoChange/topoAction/topoActions.C polyTopoChange/polyTopoChanger/polyTopoChanger.C polyTopoChange/polyTopoChange/polyTopoChange.C polyTopoChange/polyTopoChange/addPatchCellLayer.C +polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C polyTopoChange/polyTopoChange/edgeCollapser.C polyTopoChange/polyTopoChange/faceCollapser.C polyTopoChange/polyTopoChange/hexRef8.C @@ -81,9 +82,13 @@ fvMeshDistribute/fvMeshDistribute.C polyMeshAdder/faceCoupleInfo.C polyMeshAdder/polyMeshAdder.C +fvMeshTools/fvMeshTools.C + motionSmoother/motionSmoother.C motionSmoother/motionSmootherCheck.C motionSmoother/polyMeshGeometry/polyMeshGeometry.C +motionSmoother/badQualityToCell/badQualityToCell.C +motionSmoother/badQualityToFace/badQualityToFace.C motionSolver/motionSolver/motionSolver.C motionSolver/displacement/displacementMotionSolver.C @@ -95,5 +100,6 @@ createShellMesh/createShellMesh.C extrudePatchMesh/extrudePatchMesh.C +polyMeshFilter/polyMeshFilter.C LIB = $(FOAM_LIBBIN)/libdynamicMesh diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.C b/src/dynamicMesh/boundaryMesh/boundaryMesh.C index 4a705acead25c92bca38130fd1b0c0189dd173b4..1abf219dfb58dfd1306c8835ce0333c16952fb45 100644 --- a/src/dynamicMesh/boundaryMesh/boundaryMesh.C +++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.C @@ -37,13 +37,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::boundaryMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(boundaryMesh, 0); // Normal along which to divide faces into categories (used in getNearest) -const Foam::vector Foam::boundaryMesh::splitNormal_(3, 2, 1); +const vector boundaryMesh::splitNormal_(3, 2, 1); // Distance to face tolerance for getNearest -const Foam::scalar Foam::boundaryMesh::distanceTol_ = 1e-2; +const scalar boundaryMesh::distanceTol_ = 1e-2; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/createShellMesh/createShellMesh.C b/src/dynamicMesh/createShellMesh/createShellMesh.C index 7da1a844b7ff94e7cb859879bf93406d59409ab0..e6356ff66fc4d97550e43d32f8fc5adc23e1f892 100644 --- a/src/dynamicMesh/createShellMesh/createShellMesh.C +++ b/src/dynamicMesh/createShellMesh/createShellMesh.C @@ -40,10 +40,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::createShellMesh, 0); - namespace Foam { +defineTypeNameAndDebug(createShellMesh, 0); + template<> class minEqOp<labelPair> { diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 33058afaf4a06de831ad370727bd684751b563c1..a21cfb6300a642e8dfb035a2da225e2c018014ee 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -31,7 +31,6 @@ License #include "processorFvsPatchField.H" #include "processorCyclicPolyPatch.H" #include "processorCyclicFvPatchField.H" -#include "processorCyclicFvsPatchField.H" #include "polyTopoChange.H" #include "removeCells.H" #include "polyModifyFace.H" @@ -40,10 +39,14 @@ License #include "surfaceFields.H" #include "syncTools.H" #include "CompactListList.H" +#include "fvMeshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fvMeshDistribute, 0); +namespace Foam +{ +defineTypeNameAndDebug(fvMeshDistribute, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -274,156 +277,6 @@ Foam::label Foam::fvMeshDistribute::findNonEmptyPatch() const } -//// Appends processorPolyPatch. Returns patchID. -//Foam::label Foam::fvMeshDistribute::addProcPatch -//( -// const word& patchName, -// const label nbrProc -//) -//{ -// // Clear local fields and e.g. polyMesh globalMeshData. -// mesh_.clearOut(); -// -// -// polyBoundaryMesh& polyPatches = -// const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh()); -// fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh_.boundary()); -// -// if (polyPatches.findPatchID(patchName) != -1) -// { -// FatalErrorIn -// ( -// "fvMeshDistribute::addProcPatch(const word&, const label)" -// ) -// << "Cannot create patch " << patchName << " since already exists." -// << nl -// << "Current patch names:" << polyPatches.names() -// << exit(FatalError); -// } -// -// -// -// // Add the patch -// // ~~~~~~~~~~~~~ -// -// label sz = polyPatches.size(); -// -// // Add polyPatch -// polyPatches.setSize(sz+1); -// polyPatches.set -// ( -// sz, -// new processorPolyPatch -// ( -// patchName, -// 0, // size -// mesh_.nFaces(), -// sz, -// mesh_.boundaryMesh(), -// Pstream::myProcNo(), -// nbrProc -// ) -// ); -// fvPatches.setSize(sz+1); -// fvPatches.set -// ( -// sz, -// fvPatch::New -// ( -// polyPatches[sz], // point to newly added polyPatch -// mesh_.boundary() -// ) -// ); -// -// return sz; -//} - - -// Appends polyPatch. Returns patchID. -Foam::label Foam::fvMeshDistribute::addPatch(polyPatch* patchPtr) -{ - // Clear local fields and e.g. polyMesh globalMeshData. - mesh_.clearOut(); - - polyBoundaryMesh& polyPatches = - const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh()); - fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh_.boundary()); - - if (polyPatches.findPatchID(patchPtr->name()) != -1) - { - FatalErrorIn("fvMeshDistribute::addPatch(polyPatch*)") - << "Cannot create patch " << patchPtr->name() - << " since already exists." << nl - << "Current patch names:" << polyPatches.names() - << exit(FatalError); - } - - - // Add the patch - // ~~~~~~~~~~~~~ - - label sz = polyPatches.size(); - - // Add polyPatch - polyPatches.setSize(sz+1); - polyPatches.set(sz, patchPtr); - fvPatches.setSize(sz+1); - fvPatches.set - ( - sz, - fvPatch::New - ( - polyPatches[sz], // point to newly added polyPatch - mesh_.boundary() - ) - ); - - return sz; -} - - -// Deletes last patch -void Foam::fvMeshDistribute::deleteTrailingPatch() -{ - // Clear local fields and e.g. polyMesh globalMeshData. - mesh_.clearOut(); - - polyBoundaryMesh& polyPatches = - const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh()); - fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh_.boundary()); - - if (polyPatches.empty()) - { - FatalErrorIn("fvMeshDistribute::deleteTrailingPatch(fvMesh&)") - << "No patches in mesh" - << abort(FatalError); - } - - label sz = polyPatches.size(); - - label nFaces = polyPatches[sz-1].size(); - - // Remove last polyPatch - if (debug) - { - Pout<< "deleteTrailingPatch : Removing patch " << sz-1 - << " : " << polyPatches[sz-1].name() << " size:" << nFaces << endl; - } - - if (nFaces) - { - FatalErrorIn("fvMeshDistribute::deleteTrailingPatch()") - << "There are still " << nFaces << " faces in patch to be deleted " - << sz-1 << ' ' << polyPatches[sz-1].name() - << abort(FatalError); - } - - // Remove actual patch - polyPatches.setSize(sz-1); - fvPatches.setSize(sz-1); -} - - // Delete all processor patches. Move any processor faces into the last // non-processor patch. Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::deleteProcPatches @@ -469,25 +322,28 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::deleteProcPatches // Delete (now empty) processor patches. - forAllReverse(mesh_.boundaryMesh(), patchI) { - const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + labelList oldToNew(identity(mesh_.boundaryMesh().size())); + label newI = 0; + // Non processor patches first + forAll(mesh_.boundaryMesh(), patchI) + { + if (!isA<processorPolyPatch>(mesh_.boundaryMesh()[patchI])) + { + oldToNew[patchI] = newI++; + } + } + label nNonProcPatches = newI; - if (isA<processorPolyPatch>(pp)) + // Processor patches as last + forAll(mesh_.boundaryMesh(), patchI) { - deleteTrailingPatch(); - deleteTrailingPatchFields<volScalarField>(); - deleteTrailingPatchFields<volVectorField>(); - deleteTrailingPatchFields<volSphericalTensorField>(); - deleteTrailingPatchFields<volSymmTensorField>(); - deleteTrailingPatchFields<volTensorField>(); - - deleteTrailingPatchFields<surfaceScalarField>(); - deleteTrailingPatchFields<surfaceVectorField>(); - deleteTrailingPatchFields<surfaceSphericalTensorField>(); - deleteTrailingPatchFields<surfaceSymmTensorField>(); - deleteTrailingPatchFields<surfaceTensorField>(); + if (isA<processorPolyPatch>(mesh_.boundaryMesh()[patchI])) + { + oldToNew[patchI] = newI++; + } } + fvMeshTools::reorderPatches(mesh_, oldToNew, nNonProcPatches, false); } return map; @@ -1082,73 +938,40 @@ void Foam::fvMeshDistribute::addProcPatches + "to" + name(procI); + processorPolyPatch pp + ( + patchName, + 0, // size + mesh_.nFaces(), + mesh_.boundaryMesh().size(), + mesh_.boundaryMesh(), + Pstream::myProcNo(), + nbrProc[bFaceI] + ); + procPatchID[procI].insert ( referPatchID[bFaceI], - addPatch + fvMeshTools::addPatch ( - new processorPolyPatch - ( - patchName, - 0, // size - mesh_.nFaces(), - mesh_.boundaryMesh().size(), - mesh_.boundaryMesh(), - Pstream::myProcNo(), - nbrProc[bFaceI] - ) + mesh_, + pp, + dictionary(), // optional per field patchField + processorFvPatchField<scalar>::typeName, + false // not parallel sync ) ); - - addPatchFields<volScalarField> - ( - processorFvPatchField<scalar>::typeName - ); - addPatchFields<volVectorField> - ( - processorFvPatchField<vector>::typeName - ); - addPatchFields<volSphericalTensorField> - ( - processorFvPatchField<sphericalTensor>::typeName - ); - addPatchFields<volSymmTensorField> - ( - processorFvPatchField<symmTensor>::typeName - ); - addPatchFields<volTensorField> - ( - processorFvPatchField<tensor>::typeName - ); - - addPatchFields<surfaceScalarField> - ( - processorFvPatchField<scalar>::typeName - ); - addPatchFields<surfaceVectorField> - ( - processorFvPatchField<vector>::typeName - ); - addPatchFields<surfaceSphericalTensorField> - ( - processorFvPatchField<sphericalTensor>::typeName - ); - addPatchFields<surfaceSymmTensorField> - ( - processorFvPatchField<symmTensor>::typeName - ); - addPatchFields<surfaceTensorField> - ( - processorFvPatchField<tensor>::typeName - ); } else { + const coupledPolyPatch& pcPatch + = refCast<const coupledPolyPatch> + ( + mesh_.boundaryMesh()[referPatchID[bFaceI]] + ); + // Processor boundary originating from cyclic - const word& cycName = mesh_.boundaryMesh() - [ - referPatchID[bFaceI] - ].name(); + const word& cycName = pcPatch.name(); const word patchName = "procBoundary" @@ -1158,66 +981,31 @@ void Foam::fvMeshDistribute::addProcPatches + "through" + cycName; + processorCyclicPolyPatch pp + ( + patchName, + 0, // size + mesh_.nFaces(), + mesh_.boundaryMesh().size(), + mesh_.boundaryMesh(), + Pstream::myProcNo(), + nbrProc[bFaceI], + cycName, + pcPatch.transform() + ); + procPatchID[procI].insert ( referPatchID[bFaceI], - addPatch + fvMeshTools::addPatch ( - new processorCyclicPolyPatch - ( - patchName, - 0, // size - mesh_.nFaces(), - mesh_.boundaryMesh().size(), - mesh_.boundaryMesh(), - Pstream::myProcNo(), - nbrProc[bFaceI], - cycName - ) + mesh_, + pp, + dictionary(), // optional per field patchField + processorCyclicFvPatchField<scalar>::typeName, + false // not parallel sync ) ); - - addPatchFields<volScalarField> - ( - processorCyclicFvPatchField<scalar>::typeName - ); - addPatchFields<volVectorField> - ( - processorCyclicFvPatchField<vector>::typeName - ); - addPatchFields<volSphericalTensorField> - ( - processorCyclicFvPatchField<sphericalTensor>::typeName - ); - addPatchFields<volSymmTensorField> - ( - processorCyclicFvPatchField<symmTensor>::typeName - ); - addPatchFields<volTensorField> - ( - processorCyclicFvPatchField<tensor>::typeName - ); - - addPatchFields<surfaceScalarField> - ( - processorCyclicFvPatchField<scalar>::typeName - ); - addPatchFields<surfaceVectorField> - ( - processorCyclicFvPatchField<vector>::typeName - ); - addPatchFields<surfaceSphericalTensorField> - ( - processorCyclicFvPatchField<sphericalTensor>::typeName - ); - addPatchFields<surfaceSymmTensorField> - ( - processorCyclicFvPatchField<symmTensor>::typeName - ); - addPatchFields<surfaceTensorField> - ( - processorCyclicFvPatchField<tensor>::typeName - ); } } } @@ -2445,68 +2233,32 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute // parallel comms. After this points and edges should again be consistent. mergeSharedPoints(constructPointMap); -// // Bit of hack: processorFvPatchField does not get reset since created -// // from nothing so explicitly reset. -// initPatchFields<volScalarField, processorFvPatchField<scalar> > -// ( -// pTraits<scalar>::zero -// ); -// initPatchFields<volVectorField, processorFvPatchField<vector> > -// ( -// pTraits<vector>::zero -// ); -// initPatchFields -// < -// volSphericalTensorField, -// processorFvPatchField<sphericalTensor> -// > -// ( -// pTraits<sphericalTensor>::zero -// ); -// initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> > -// ( -// pTraits<symmTensor>::zero -// ); -// initPatchFields<volTensorField, processorFvPatchField<tensor> > -// ( -// pTraits<tensor>::zero -// ); -// initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> > -// ( -// pTraits<scalar>::zero -// ); -// initPatchFields<surfaceVectorField, processorFvsPatchField<vector> > -// ( -// pTraits<vector>::zero -// ); -// initPatchFields -// < -// surfaceSphericalTensorField, -// processorFvsPatchField<sphericalTensor> -// > -// ( -// pTraits<sphericalTensor>::zero -// ); -// initPatchFields -// < -// surfaceSymmTensorField, -// processorFvsPatchField<symmTensor> -// > -// ( -// pTraits<symmTensor>::zero -// ); -// initPatchFields<surfaceTensorField, processorFvsPatchField<tensor> > -// ( -// pTraits<tensor>::zero -// ); -//XXXXX // Bit of hack: processorFvPatchField does not get reset since created // from nothing so explicitly reset. - correctBoundaryConditions<volScalarField>(); - correctBoundaryConditions<volVectorField>(); - correctBoundaryConditions<volSphericalTensorField>(); - correctBoundaryConditions<volSymmTensorField>(); - correctBoundaryConditions<volTensorField>(); + initPatchFields<volScalarField, processorFvPatchField<scalar> > + ( + pTraits<scalar>::zero + ); + initPatchFields<volVectorField, processorFvPatchField<vector> > + ( + pTraits<vector>::zero + ); + initPatchFields + < + volSphericalTensorField, + processorFvPatchField<sphericalTensor> + > + ( + pTraits<sphericalTensor>::zero + ); + initPatchFields<volSymmTensorField, processorFvPatchField<symmTensor> > + ( + pTraits<symmTensor>::zero + ); + initPatchFields<volTensorField, processorFvPatchField<tensor> > + ( + pTraits<tensor>::zero + ); initPatchFields<surfaceScalarField, processorFvsPatchField<scalar> > ( @@ -2536,7 +2288,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute ( pTraits<tensor>::zero ); -//XXXXX + mesh_.setInstance(mesh_.time().timeName()); diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H index eb771003a0c9674cc5ae4ae3bef6568e1437af92..ae9d512529b037937086aa067ae12b03cb592dca 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.H @@ -65,7 +65,7 @@ class mapAddedPolyMesh; class mapDistributePolyMesh; /*---------------------------------------------------------------------------*\ - Class fvMeshDistribute Declaration + Class fvMeshDistribute Declaration \*---------------------------------------------------------------------------*/ class fvMeshDistribute @@ -102,20 +102,6 @@ class fvMeshDistribute //- Find patch to put exposed faces into. label findNonEmptyPatch() const; - //- Appends polyPatch. Returns patchID. - label addPatch(polyPatch*); - - //- Add patch field - template<class GeoField> - void addPatchFields(const word& patchFieldType); - - //- Deletes last patch. - void deleteTrailingPatch(); - - // Delete trailing patch fields - template<class GeoField> - void deleteTrailingPatchFields(); - //- Save boundary fields template <class T, class Mesh> void saveBoundaryFields @@ -146,7 +132,7 @@ class fvMeshDistribute // patchI. autoPtr<mapPolyMesh> deleteProcPatches(const label patchI); - //- Repatch the mesh. This is only nessecary for the proc + //- Repatch the mesh. This is only necessary for the proc // boundary faces. newPatchID is over all boundary faces: -1 or // new patchID. constructFaceMap is being adapted for the // possible new face position (since proc faces get automatically diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index 00364a81add063129d25d828ba2ed7a113890953..a09d538083c93c41a032d55aeace7536b6c890d4 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -55,65 +55,6 @@ void Foam::fvMeshDistribute::printFieldInfo(const fvMesh& mesh) } -template<class GeoField> -void Foam::fvMeshDistribute::addPatchFields(const word& patchFieldType) -{ - HashTable<const GeoField*> flds - ( - mesh_.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); - - label sz = bfld.size(); - bfld.setSize(sz + 1); - bfld.set - ( - sz, - GeoField::PatchFieldType::New - ( - patchFieldType, - mesh_.boundary()[sz], - fld.dimensionedInternalField() - ) - ); - } -} - - -// Delete trailing patch fields -template<class GeoField> -void Foam::fvMeshDistribute::deleteTrailingPatchFields() -{ - HashTable<const GeoField*> flds - ( - mesh_.objectRegistry::lookupClass<GeoField>() - ); - - forAllConstIter(typename HashTable<const GeoField*>, flds, iter) - { - const GeoField& fld = *iter(); - - typename GeoField::GeometricBoundaryField& bfld = - const_cast<typename GeoField::GeometricBoundaryField&> - ( - fld.boundaryField() - ); - - // Shrink patchFields - bfld.setSize(bfld.size() - 1); - } -} - - // Save whole boundary field template <class T, class Mesh> void Foam::fvMeshDistribute::saveBoundaryFields diff --git a/src/dynamicMesh/fvMeshTools/fvMeshTools.C b/src/dynamicMesh/fvMeshTools/fvMeshTools.C new file mode 100644 index 0000000000000000000000000000000000000000..682a96422e731eeb70ed7d4c1b8f6e9a3041c5ec --- /dev/null +++ b/src/dynamicMesh/fvMeshTools/fvMeshTools.C @@ -0,0 +1,355 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshTools.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Adds patch if not yet there. Returns patchID. +Foam::label Foam::fvMeshTools::addPatch +( + fvMesh& mesh, + const polyPatch& patch, + const dictionary& patchFieldDict, + const word& defaultPatchFieldType, + const bool validBoundary +) +{ + polyBoundaryMesh& polyPatches = + const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); + + label patchI = polyPatches.findPatchID(patch.name()); + if (patchI != -1) + { + // Already there + return patchI; + } + + + // Append at end unless there are processor patches + label insertPatchI = polyPatches.size(); + label startFaceI = mesh.nFaces(); + + if (!isA<processorPolyPatch>(patch)) + { + forAll(polyPatches, patchI) + { + const polyPatch& pp = polyPatches[patchI]; + + if (isA<processorPolyPatch>(pp)) + { + insertPatchI = patchI; + startFaceI = pp.start(); + break; + } + } + } + + + // Below is all quite a hack. Feel free to change once there is a better + // mechanism to insert and reorder patches. + + // Clear local fields and e.g. polyMesh parallelInfo. + mesh.clearOut(); + + label sz = polyPatches.size(); + + fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); + + // Add polyPatch at the end + polyPatches.setSize(sz+1); + polyPatches.set + ( + sz, + patch.clone + ( + polyPatches, + insertPatchI, //index + 0, //size + startFaceI //start + ) + ); + fvPatches.setSize(sz+1); + fvPatches.set + ( + sz, + fvPatch::New + ( + polyPatches[sz], // point to newly added polyPatch + mesh.boundary() + ) + ); + + addPatchFields<volScalarField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<scalar>::zero + ); + addPatchFields<volVectorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<vector>::zero + ); + addPatchFields<volSphericalTensorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<sphericalTensor>::zero + ); + addPatchFields<volSymmTensorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<symmTensor>::zero + ); + addPatchFields<volTensorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<tensor>::zero + ); + + // Surface fields + + addPatchFields<surfaceScalarField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<scalar>::zero + ); + addPatchFields<surfaceVectorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<vector>::zero + ); + addPatchFields<surfaceSphericalTensorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<sphericalTensor>::zero + ); + addPatchFields<surfaceSymmTensorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<symmTensor>::zero + ); + addPatchFields<surfaceTensorField> + ( + mesh, + patchFieldDict, + defaultPatchFieldType, + pTraits<tensor>::zero + ); + + // Create reordering list + // patches before insert position stay as is + labelList oldToNew(sz+1); + for (label i = 0; i < insertPatchI; i++) + { + oldToNew[i] = i; + } + // patches after insert position move one up + for (label i = insertPatchI; i < sz; i++) + { + oldToNew[i] = i+1; + } + // appended patch gets moved to insert position + oldToNew[sz] = insertPatchI; + + // Shuffle into place + polyPatches.reorder(oldToNew, validBoundary); + fvPatches.reorder(oldToNew); + + reorderPatchFields<volScalarField>(mesh, oldToNew); + reorderPatchFields<volVectorField>(mesh, oldToNew); + reorderPatchFields<volSphericalTensorField>(mesh, oldToNew); + reorderPatchFields<volSymmTensorField>(mesh, oldToNew); + reorderPatchFields<volTensorField>(mesh, oldToNew); + reorderPatchFields<surfaceScalarField>(mesh, oldToNew); + reorderPatchFields<surfaceVectorField>(mesh, oldToNew); + reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew); + reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew); + reorderPatchFields<surfaceTensorField>(mesh, oldToNew); + + return insertPatchI; +} + + +void Foam::fvMeshTools::setPatchFields +( + fvMesh& mesh, + const label patchI, + const dictionary& patchFieldDict +) +{ + setPatchFields<volScalarField>(mesh, patchI, patchFieldDict); + setPatchFields<volVectorField>(mesh, patchI, patchFieldDict); + setPatchFields<volSphericalTensorField>(mesh, patchI, patchFieldDict); + setPatchFields<volSymmTensorField>(mesh, patchI, patchFieldDict); + setPatchFields<volTensorField>(mesh, patchI, patchFieldDict); + setPatchFields<surfaceScalarField>(mesh, patchI, patchFieldDict); + setPatchFields<surfaceVectorField>(mesh, patchI, patchFieldDict); + setPatchFields<surfaceSphericalTensorField> + ( + mesh, + patchI, + patchFieldDict + ); + setPatchFields<surfaceSymmTensorField>(mesh, patchI, patchFieldDict); + setPatchFields<surfaceTensorField>(mesh, patchI, patchFieldDict); +} + + +void Foam::fvMeshTools::zeroPatchFields(fvMesh& mesh, const label patchI) +{ + setPatchFields<volScalarField>(mesh, patchI, pTraits<scalar>::zero); + setPatchFields<volVectorField>(mesh, patchI, pTraits<vector>::zero); + setPatchFields<volSphericalTensorField> + ( + mesh, + patchI, + pTraits<sphericalTensor>::zero + ); + setPatchFields<volSymmTensorField> + ( + mesh, + patchI, + pTraits<symmTensor>::zero + ); + setPatchFields<volTensorField>(mesh, patchI, pTraits<tensor>::zero); + setPatchFields<surfaceScalarField>(mesh, patchI, pTraits<scalar>::zero); + setPatchFields<surfaceVectorField>(mesh, patchI, pTraits<vector>::zero); + setPatchFields<surfaceSphericalTensorField> + ( + mesh, + patchI, + pTraits<sphericalTensor>::zero + ); + setPatchFields<surfaceSymmTensorField> + ( + mesh, + patchI, + pTraits<symmTensor>::zero + ); + setPatchFields<surfaceTensorField>(mesh, patchI, pTraits<tensor>::zero); +} + + +// Deletes last patch +void Foam::fvMeshTools::trimPatches(fvMesh& mesh, const label nPatches) +{ + // Clear local fields and e.g. polyMesh globalMeshData. + mesh.clearOut(); + + polyBoundaryMesh& polyPatches = + const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); + fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); + + if (polyPatches.empty()) + { + FatalErrorIn("fvMeshTools::trimPatches(fvMesh&, const label)") + << "No patches in mesh" + << abort(FatalError); + } + + label nFaces = 0; + for (label patchI = nPatches; patchI < polyPatches.size(); patchI++) + { + nFaces += polyPatches[patchI].size(); + } + reduce(nFaces, sumOp<label>()); + + if (nFaces) + { + FatalErrorIn("fvMeshTools::trimPatches(fvMesh&, const label)") + << "There are still " << nFaces + << " faces in " << polyPatches.size()-nPatches + << " patches to be deleted" << abort(FatalError); + } + + // Remove actual patches + polyPatches.setSize(nPatches); + fvPatches.setSize(nPatches); + + trimPatchFields<volScalarField>(mesh, nPatches); + trimPatchFields<volVectorField>(mesh, nPatches); + trimPatchFields<volSphericalTensorField>(mesh, nPatches); + trimPatchFields<volSymmTensorField>(mesh, nPatches); + trimPatchFields<volTensorField>(mesh, nPatches); + + trimPatchFields<surfaceScalarField>(mesh, nPatches); + trimPatchFields<surfaceVectorField>(mesh, nPatches); + trimPatchFields<surfaceSphericalTensorField>(mesh, nPatches); + trimPatchFields<surfaceSymmTensorField>(mesh, nPatches); + trimPatchFields<surfaceTensorField>(mesh, nPatches); +} + + +void Foam::fvMeshTools::reorderPatches +( + fvMesh& mesh, + const labelList& oldToNew, + const label nNewPatches, + const bool validBoundary +) +{ + polyBoundaryMesh& polyPatches = + const_cast<polyBoundaryMesh&>(mesh.boundaryMesh()); + fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh.boundary()); + + // Shuffle into place + polyPatches.reorder(oldToNew, validBoundary); + fvPatches.reorder(oldToNew); + + reorderPatchFields<volScalarField>(mesh, oldToNew); + reorderPatchFields<volVectorField>(mesh, oldToNew); + reorderPatchFields<volSphericalTensorField>(mesh, oldToNew); + reorderPatchFields<volSymmTensorField>(mesh, oldToNew); + reorderPatchFields<volTensorField>(mesh, oldToNew); + reorderPatchFields<surfaceScalarField>(mesh, oldToNew); + reorderPatchFields<surfaceVectorField>(mesh, oldToNew); + reorderPatchFields<surfaceSphericalTensorField>(mesh, oldToNew); + reorderPatchFields<surfaceSymmTensorField>(mesh, oldToNew); + reorderPatchFields<surfaceTensorField>(mesh, oldToNew); + + // Remove last. + trimPatches(mesh, nNewPatches); +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/fvMeshTools/fvMeshTools.H b/src/dynamicMesh/fvMeshTools/fvMeshTools.H new file mode 100644 index 0000000000000000000000000000000000000000..0e7e132d9c182df1ab76a0c67b663ad1babb3b63 --- /dev/null +++ b/src/dynamicMesh/fvMeshTools/fvMeshTools.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::fvMeshTools + +Description + A collection of tools for operating on an fvMesh. + +SourceFiles + fvMeshTools.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvMeshTools_H +#define fvMeshTools_H + +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fvMeshTools Declaration +\*---------------------------------------------------------------------------*/ + +class fvMeshTools +{ + template<class GeoField> + static void addPatchFields + ( + fvMesh&, + const dictionary& patchFieldDict, + const word& defaultPatchFieldType, + const typename GeoField::value_type& defaultPatchValue + ); + + //- Set patchFields according to dictionary + template<class GeoField> + static void setPatchFields + ( + fvMesh& mesh, + const label patchI, + const dictionary& patchFieldDict + ); + + //- Set patchFields to value + template<class GeoField> + static void setPatchFields + ( + fvMesh& mesh, + const label patchI, + const typename GeoField::value_type& value + ); + + // Remove last patch fields + template<class GeoField> + static void trimPatchFields(fvMesh&, const label nPatches); + + template<class GeoField> + static void reorderPatchFields(fvMesh&, const labelList& oldToNew); + + // Remove trialing patches + static void trimPatches(fvMesh&, const label nPatches); + + +public: + + //- Add patch. Inserts patch before all processor patches. + // Supply per field the new patchField per field as a + // subdictionary or a default type. If validBoundary call is parallel + // synced and all add the same patch with same settings. + static label addPatch + ( + fvMesh& mesh, + const polyPatch& patch, + const dictionary& patchFieldDict, + const word& defaultPatchFieldType, + const bool validBoundary + ); + + //- Change patchField on registered fields according to dictionary + static void setPatchFields + ( + fvMesh& mesh, + const label patchI, + const dictionary& patchFieldDict + ); + + //- Change patchField to zero on registered fields + static void zeroPatchFields(fvMesh& mesh, const label patchI); + + // -Reorder and remove trailing patches. If validBoundary call is parallel + // synced and all add the same patch with same settings + static void reorderPatches + ( + fvMesh&, + const labelList& oldToNew, + const label nPatches, + const bool validBoundary + ); + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "fvMeshToolsTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..3e9ca9d0887e61a5b554a8b5073205c483ce102b --- /dev/null +++ b/src/dynamicMesh/fvMeshTools/fvMeshToolsTemplates.C @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshTools.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class GeoField> +void Foam::fvMeshTools::addPatchFields +( + fvMesh& mesh, + const dictionary& patchFieldDict, + const word& defaultPatchFieldType, + const typename GeoField::value_type& defaultPatchValue +) +{ + HashTable<const GeoField*> flds + ( + mesh.objectRegistry::lookupClass<GeoField>() + ); + + forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + { + const GeoField& fld = *iter(); + + typename GeoField::GeometricBoundaryField& bfld = + const_cast<typename GeoField::GeometricBoundaryField&> + ( + fld.boundaryField() + ); + + label sz = bfld.size(); + bfld.setSize(sz+1); + + if (patchFieldDict.found(fld.name())) + { + bfld.set + ( + sz, + GeoField::PatchFieldType::New + ( + mesh.boundary()[sz], + fld.dimensionedInternalField(), + patchFieldDict.subDict(fld.name()) + ) + ); + } + else + { + bfld.set + ( + sz, + GeoField::PatchFieldType::New + ( + defaultPatchFieldType, + mesh.boundary()[sz], + fld.dimensionedInternalField() + ) + ); + bfld[sz] == defaultPatchValue; + } + } +} + + +template<class GeoField> +void Foam::fvMeshTools::setPatchFields +( + fvMesh& mesh, + const label patchI, + const dictionary& patchFieldDict +) +{ + HashTable<const GeoField*> flds + ( + mesh.objectRegistry::lookupClass<GeoField>() + ); + + forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + { + const GeoField& fld = *iter(); + + typename GeoField::GeometricBoundaryField& bfld = + const_cast<typename GeoField::GeometricBoundaryField&> + ( + fld.boundaryField() + ); + + if (patchFieldDict.found(fld.name())) + { + bfld.set + ( + patchI, + GeoField::PatchFieldType::New + ( + mesh.boundary()[patchI], + fld.dimensionedInternalField(), + patchFieldDict.subDict(fld.name()) + ) + ); + } + } +} + + + + +template<class GeoField> +void Foam::fvMeshTools::setPatchFields +( + fvMesh& mesh, + const label patchI, + const typename GeoField::value_type& value +) +{ + HashTable<const GeoField*> flds + ( + mesh.objectRegistry::lookupClass<GeoField>() + ); + + forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + { + const GeoField& fld = *iter(); + + typename GeoField::GeometricBoundaryField& bfld = + const_cast<typename GeoField::GeometricBoundaryField&> + ( + fld.boundaryField() + ); + + bfld[patchI] == value; + } +} + + +// Remove last patch field +template<class GeoField> +void Foam::fvMeshTools::trimPatchFields(fvMesh& mesh, const label nPatches) +{ + HashTable<const GeoField*> flds + ( + mesh.objectRegistry::lookupClass<GeoField>() + ); + + forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + { + const GeoField& fld = *iter(); + + const_cast<typename GeoField::GeometricBoundaryField&> + ( + fld.boundaryField() + ).setSize(nPatches); + } +} + + +// Reorder patch field +template<class GeoField> +void Foam::fvMeshTools::reorderPatchFields +( + fvMesh& mesh, + const labelList& oldToNew +) +{ + HashTable<const GeoField*> flds + ( + mesh.objectRegistry::lookupClass<GeoField>() + ); + + forAllConstIter(typename HashTable<const GeoField*>, flds, iter) + { + const GeoField& fld = *iter(); + + typename GeoField::GeometricBoundaryField& bfld = + const_cast<typename GeoField::GeometricBoundaryField&> + ( + fld.boundaryField() + ); + bfld.reorder(oldToNew); + } +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/meshCut/cellCuts/cellCuts.C b/src/dynamicMesh/meshCut/cellCuts/cellCuts.C index 7bb9964b586f9a2f02725bda0ac54515d175151a..6861186e39440cd0d192197931a395c9c31accc4 100644 --- a/src/dynamicMesh/meshCut/cellCuts/cellCuts.C +++ b/src/dynamicMesh/meshCut/cellCuts/cellCuts.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cellCuts, 0); +namespace Foam +{ +defineTypeNameAndDebug(cellCuts, 0); +} // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // @@ -2720,7 +2723,7 @@ Foam::cellCuts::cellCuts calcLoopsAndAddressing(cutCells); - // Calculate planes and flip cellLoops if nessecary + // Calculate planes and flip cellLoops if necessary orientPlanesAndLoops(); if (debug) @@ -2765,7 +2768,7 @@ Foam::cellCuts::cellCuts calcLoopsAndAddressing(identity(mesh.nCells())); - // Calculate planes and flip cellLoops if nessecary + // Calculate planes and flip cellLoops if necessary orientPlanesAndLoops(); if (debug) @@ -2811,7 +2814,7 @@ Foam::cellCuts::cellCuts // Makes sure cuts are consistent setFromCellLoops(cellLabels, cellLoops, cellEdgeWeights); - // Calculate planes and flip cellLoops if nessecary + // Calculate planes and flip cellLoops if necessary orientPlanesAndLoops(); if (debug) @@ -2855,7 +2858,7 @@ Foam::cellCuts::cellCuts // Makes sure cuts are consistent setFromCellCutter(cellCutter, refCells); - // Calculate planes and flip cellLoops if nessecary + // Calculate planes and flip cellLoops if necessary orientPlanesAndLoops(); if (debug) @@ -2901,7 +2904,7 @@ Foam::cellCuts::cellCuts // Makes sure cuts are consistent setFromCellCutter(cellCutter, cellLabels, cutPlanes); - // Calculate planes and flip cellLoops if nessecary + // Calculate planes and flip cellLoops if necessary orientPlanesAndLoops(); if (debug) diff --git a/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C b/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C index 529f8f6ccc6296c09686a498716e0db58d28be73..654b47a254559b6f8710c3606fb92d132c2472e1 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::boundaryCutter, 0); +namespace Foam +{ +defineTypeNameAndDebug(boundaryCutter, 0); +} // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.H b/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.H index 4f9371fdd3a796554ba3e10929746527150b9798..6f45ad5dc8deee0fa8c656a4788524b345bdba8f 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.H +++ b/src/dynamicMesh/meshCut/meshModifiers/boundaryCutter/boundaryCutter.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 @@ -29,7 +29,7 @@ Description Does - move boundary points - - split boundary edges (multiple per edge if nessecary) + - split boundary edges (multiple per edge if necessary) - face-centre decomposes boundary faces - diagonal split of boundary faces @@ -60,7 +60,7 @@ class polyMesh; class face; /*---------------------------------------------------------------------------*\ - Class boundaryCutter Declaration + Class boundaryCutter Declaration \*---------------------------------------------------------------------------*/ class boundaryCutter diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C b/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C index e9eb291083346b1b45e558d89e5b3f8155e292ed..4999757132fb47b0f39e321c0c88a08be31eb574 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.C +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.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 @@ -37,7 +37,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::meshCutAndRemove, 0); +namespace Foam +{ +defineTypeNameAndDebug(meshCutAndRemove, 0); +} + // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C index 7239b6aebdbafde7150dd4bb9b5c3fe88e826cd6..15ab11076424450b56eb8627fba1eac54e4cef82 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::meshCutter, 0); +namespace Foam +{ +defineTypeNameAndDebug(meshCutter, 0); +} // * * * * * * * * * * * * * Private Static Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H index cc869460f808dd9b00a093d2f234abfef650ce51..72119572f687efe9d5726c269a7c5373cbd73fee 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.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 @@ -28,7 +28,7 @@ Description Cuts (splits) cells. Description of cut is given as a loop of 'cuts' per cell (see cellCuts). - setRefinement() takes this cut description and inserts the nessecary + setRefinement() takes this cut description and inserts the necessary topoActions (add points/faces/cells) into the polyTopoChange. Stores added cells/faces/points. @@ -129,7 +129,7 @@ class polyMesh; class face; /*---------------------------------------------------------------------------*\ - Class meshCutter Declaration + Class meshCutter Declaration \*---------------------------------------------------------------------------*/ class meshCutter diff --git a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C index d19664663a779a0b0c7d17f4e452d9ff9dba655b..3668134cc492cb27c3c8ff47917baedd6fadcf20 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.C +++ b/src/dynamicMesh/meshCut/meshModifiers/multiDirRefinement/multiDirRefinement.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 @@ -40,7 +40,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::multiDirRefinement, 0); +namespace Foam +{ +defineTypeNameAndDebug(multiDirRefinement, 0); +} // * * * * * * * * * * * * * Private Statc Functions * * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C b/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C index e694d0c34d36b80b882ee8225c1920e940108dc7..30e32a44afdf1eff03601cb2ceee7a61f045e825 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C +++ b/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::refinementIterator, 0); +namespace Foam +{ +defineTypeNameAndDebug(refinementIterator, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C index a8867eb60572466cf32f17ec73d3cb37f141a052..7782b9bb3ac13ca8d496bb97d1b54f0185b5c5b7 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::undoableMeshCutter, 0); +namespace Foam +{ +defineTypeNameAndDebug(undoableMeshCutter, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.H b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.H index 229d9d6d258b993ecd02c842803dee1c18f1d0cd..d9b5ca2f1546f1d0d414bbc9f1cdb57cf3d4d53c 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.H +++ b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.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 @@ -88,7 +88,7 @@ class refineCell; class splitCell; /*---------------------------------------------------------------------------*\ - Class undoableMeshCutter Declaration + Class undoableMeshCutter Declaration \*---------------------------------------------------------------------------*/ class undoableMeshCutter @@ -192,7 +192,7 @@ public: //- Remove some refinement. Needs to be supplied subset of // getSplitFaces() output. Returns list of faces removed // (can be more or equal but never less than splitFaces - since - // removeFaces might decide to take down unnessecary faces) + // removeFaces might decide to take down unnecessary faces) // Only call if undoable set. labelList removeSplitFaces ( diff --git a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C new file mode 100644 index 0000000000000000000000000000000000000000..80f15127affd9468fa794dfd5a4e68b5b2965929 --- /dev/null +++ b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.C @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "badQualityToCell.H" +#include "polyMesh.H" +#include "motionSmoother.H" +#include "addToRunTimeSelectionTable.H" +#include "faceSet.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(badQualityToCell, 0); + +addToRunTimeSelectionTable(topoSetSource, badQualityToCell, word); + +addToRunTimeSelectionTable(topoSetSource, badQualityToCell, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::badQualityToCell::usage_ +( + badQualityToCell::typeName, + "\n Usage: badQualityToCell mesh-quality-dictionary\n\n" + " Select all cells that do not satisfy the selection criterion\n\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::badQualityToCell::combine(topoSet& set, const bool add) const +{ + faceSet faces(mesh_, "meshQualityFaces", mesh_.nFaces()/100+1); + motionSmoother::checkMesh(false, mesh_, dict_, faces); + faces.sync(mesh_); + + forAllConstIter(faceSet, faces, iter) + { + label faceI = iter.key(); + addOrDelete(set, mesh_.faceOwner()[faceI], add); + if (mesh_.isInternalFace(faceI)) + { + addOrDelete(set, mesh_.faceNeighbour()[faceI], add); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::badQualityToCell::badQualityToCell +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + dict_(dict) +{} + + +// Construct from Istream +Foam::badQualityToCell::badQualityToCell +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + dict_(is) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::badQualityToCell::~badQualityToCell() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::badQualityToCell::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding bad-quality cells" << endl; + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing bad-quality cells" << endl; + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H new file mode 100644 index 0000000000000000000000000000000000000000..4b52b0ff1708821124a407fbfccd49a4f64c9000 --- /dev/null +++ b/src/dynamicMesh/motionSmoother/badQualityToCell/badQualityToCell.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::badQualityToCell + +Description + Selects bad quality cells (using snappyHexMesh/cvMesh mesh quality selector) + +SourceFiles + badQualityToCell.C + +\*---------------------------------------------------------------------------*/ + +#ifndef badQualityToCell_H +#define badQualityToCell_H + +#include "topoSetSource.H" +#include "PackedBoolList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class badQualityToCell Declaration +\*---------------------------------------------------------------------------*/ + +class badQualityToCell +: + public topoSetSource +{ + + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Mesh quality dictionary + const dictionary dict_; + + + // Private Member Functions + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("badQualityToCell"); + + // Constructors + + //- Construct from dictionary + badQualityToCell + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + badQualityToCell + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~badQualityToCell(); + + + // Member Functions + + virtual sourceType setType() const + { + return CELLSETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C new file mode 100644 index 0000000000000000000000000000000000000000..a692c61569eeceb5d7e0c19872e63cf866496e3e --- /dev/null +++ b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.C @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "badQualityToFace.H" +#include "polyMesh.H" +#include "motionSmoother.H" +#include "addToRunTimeSelectionTable.H" +#include "faceSet.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + +defineTypeNameAndDebug(badQualityToFace, 0); + +addToRunTimeSelectionTable(topoSetSource, badQualityToFace, word); + +addToRunTimeSelectionTable(topoSetSource, badQualityToFace, istream); + +} + + +Foam::topoSetSource::addToUsageTable Foam::badQualityToFace::usage_ +( + badQualityToFace::typeName, + "\n Usage: badQualityToFace mesh-quality-dictionary\n\n" + " Select all faces that do not satisfy the selection criterion\n\n" +); + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::badQualityToFace::combine(topoSet& set, const bool add) const +{ + faceSet faces(mesh_, "meshQualityFaces", mesh_.nFaces()/100+1); + motionSmoother::checkMesh(false, mesh_, dict_, faces); + faces.sync(mesh_); + + forAllConstIter(faceSet, faces, iter) + { + label faceI = iter.key(); + addOrDelete(set, faceI, add); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::badQualityToFace::badQualityToFace +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + dict_(dict) +{} + + +// Construct from Istream +Foam::badQualityToFace::badQualityToFace +( + const polyMesh& mesh, + Istream& is +) +: + topoSetSource(mesh), + dict_(is) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::badQualityToFace::~badQualityToFace() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::badQualityToFace::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding bad-quality faces" << endl; + combine(set, true); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing bad-quality faces" << endl; + combine(set, false); + } +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H new file mode 100644 index 0000000000000000000000000000000000000000..d59964bad82751fe82d5c84db9946b4814d579da --- /dev/null +++ b/src/dynamicMesh/motionSmoother/badQualityToFace/badQualityToFace.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::badQualityToFace + +Description + Selects bad quality faces (using snappyHexMesh/cvMesh mesh quality selector) + +SourceFiles + badQualityToFace.C + +\*---------------------------------------------------------------------------*/ + +#ifndef badQualityToFace_H +#define badQualityToFace_H + +#include "topoSetSource.H" +#include "PackedBoolList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class badQualityToFace Declaration +\*---------------------------------------------------------------------------*/ + +class badQualityToFace +: + public topoSetSource +{ + + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Mesh quality dictionary + const dictionary dict_; + + + // Private Member Functions + + void combine(topoSet& set, const bool add) const; + + +public: + + //- Runtime type information + TypeName("badQualityToFace"); + + // Constructors + + //- Construct from dictionary + badQualityToFace + ( + const polyMesh& mesh, + const dictionary& dict + ); + + //- Construct from Istream + badQualityToFace + ( + const polyMesh& mesh, + Istream& + ); + + + //- Destructor + virtual ~badQualityToFace(); + + + // Member Functions + + virtual sourceType setType() const + { + return CELLSETSOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C index 0359c1845729b2357425ef60c39f7cb341e048cb..a89d1cf60fd1fa503884def286feb4463dcbc258 100644 --- a/src/dynamicMesh/motionSmoother/motionSmoother.C +++ b/src/dynamicMesh/motionSmoother/motionSmoother.C @@ -35,7 +35,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::motionSmoother, 0); +namespace Foam +{ +defineTypeNameAndDebug(motionSmoother, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C b/src/dynamicMesh/motionSmoother/motionSmootherCheck.C index da20ea741e306333f00f793828f6e25f991a1f6a..77ce89ca71e2a7d238d973b5af6c13a766a59b37 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherCheck.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherCheck.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 @@ -104,6 +104,8 @@ bool Foam::motionSmoother::checkMesh ( readScalar(dict.lookup("minTriangleTwist", true)) ); + scalar minFaceFlatness = -1.0; + dict.readIfPresent("minFaceFlatness", minFaceFlatness, true); const scalar minDet ( readScalar(dict.lookup("minDeterminant", true)) @@ -356,6 +358,30 @@ bool Foam::motionSmoother::checkMesh nWrongFaces = nNewWrongFaces; } + if (minFaceFlatness > -SMALL) + { + polyMeshGeometry::checkFaceFlatness + ( + report, + minFaceFlatness, + mesh, + mesh.faceAreas(), + mesh.faceCentres(), + mesh.points(), + checkFaces, + &wrongFaces + ); + + label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>()); + + Info<< " faces with flatness < " + << setw(5) << minFaceFlatness + << " : " + << nNewWrongFaces-nWrongFaces << endl; + + nWrongFaces = nNewWrongFaces; + } + if (minDet > -1) { polyMeshGeometry::checkCellDeterminant @@ -479,6 +505,8 @@ bool Foam::motionSmoother::checkMesh ( readScalar(dict.lookup("minTriangleTwist", true)) ); + scalar minFaceFlatness = -1.0; + dict.readIfPresent("minFaceFlatness", minFaceFlatness, true); const scalar minDet ( readScalar(dict.lookup("minDeterminant", true)) @@ -697,6 +725,27 @@ bool Foam::motionSmoother::checkMesh nWrongFaces = nNewWrongFaces; } + if (minFaceFlatness > -1) + { + meshGeom.checkFaceFlatness + ( + report, + minFaceFlatness, + meshGeom.mesh().points(), + checkFaces, + &wrongFaces + ); + + label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>()); + + Info<< " faces with flatness < " + << setw(5) << minFaceFlatness + << " : " + << nNewWrongFaces-nWrongFaces << endl; + + nWrongFaces = nNewWrongFaces; + } + if (minDet > -1) { meshGeom.checkCellDeterminant diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C index 1670de1c9237f194b283ce13e4d636fa554fb40c..13786a1c1cb901c07d9925f7aa1e8cbed99d2f04 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C @@ -341,8 +341,8 @@ bool Foam::polyMeshGeometry::checkFaceTet { Pout<< "bool polyMeshGeometry::checkFaceTets(" << "const bool, const scalar, const pointField&" - << ", const pointField&, const labelList&," - << " labelHashSet*): " + << ", const pointField&" + << ", const labelList&, labelHashSet*) : " << "face " << faceI << " has a triangle that points the wrong way." << endl @@ -373,9 +373,6 @@ Foam::polyMeshGeometry::polyMeshGeometry(const polyMesh& mesh) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // //- Take over properties from mesh @@ -2014,6 +2011,113 @@ bool Foam::polyMeshGeometry::checkTriangleTwist } +bool Foam::polyMeshGeometry::checkFaceFlatness +( + const bool report, + const scalar minFlatness, + const polyMesh& mesh, + const vectorField& faceAreas, + const vectorField& faceCentres, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr +) +{ + if (minFlatness < -SMALL || minFlatness > 1+SMALL) + { + FatalErrorIn + ( + "polyMeshGeometry::checkFaceFlatness" + "(const bool, const scalar, const polyMesh&, const pointField&" + ", const pointField&, const labelList&, labelHashSet*)" + ) << "minFlatness should be [0..1] but is now " << minFlatness + << abort(FatalError); + } + + const faceList& fcs = mesh.faces(); + + label nWarped = 0; + + forAll(checkFaces, i) + { + label faceI = checkFaces[i]; + + const face& f = fcs[faceI]; + + if (f.size() > 3) + { + const point& fc = faceCentres[faceI]; + + // Sum triangle areas + scalar sumArea = 0.0; + + forAll(f, fp) + { + sumArea += triPointRef + ( + p[f[fp]], + p[f.nextLabel(fp)], + fc + ).mag(); + } + + if (sumArea/mag(faceAreas[faceI]) < minFlatness) + { + nWarped++; + + if (setPtr) + { + setPtr->insert(faceI); + } + } + } + } + + reduce(nWarped, sumOp<label>()); + + if (report) + { + if (nWarped> 0) + { + Info<< "There are " << nWarped + << " faces with area of invidual triangles" + << " compared to overall area less than " + << minFlatness << nl << endl; + } + else + { + Info<< "All faces are flat in that the area of invidual triangles" + << " compared to overall area is less than " + << minFlatness << nl << endl; + } + } + + if (nWarped > 0) + { + if (report) + { + WarningIn + ( + "polyMeshGeometry::checkFaceFlatness" + "(const bool, const scalar, const polyMesh&" + ", const pointField&, const pointField&, const labelList&" + ", labelHashSet*)" + ) << nWarped << " non-flat faces " + << "(area of invidual triangles" + << " compared to overall area" + << " < " << minFlatness << ") found.\n" + << endl; + } + + return true; + } + else + { + return false; + } +} + + bool Foam::polyMeshGeometry::checkFaceArea ( const bool report, @@ -2398,6 +2502,29 @@ bool Foam::polyMeshGeometry::checkTriangleTwist } +bool Foam::polyMeshGeometry::checkFaceFlatness +( + const bool report, + const scalar minFlatness, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr +) const +{ + return checkFaceFlatness + ( + report, + minFlatness, + mesh_, + faceAreas_, + faceCentres_, + p, + checkFaces, + setPtr + ); +} + + bool Foam::polyMeshGeometry::checkFaceArea ( const bool report, diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H index 149fca822a79c8acc072bb9d856b6478440475e7..2ef8604cac8714a45711323d82f2cbc4f475d574 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.H +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.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 @@ -303,6 +303,19 @@ public: labelHashSet* setPtr ); + //- Area of faces v.s. sum of triangle areas + static bool checkFaceFlatness + ( + const bool report, + const scalar minFlatness, + const polyMesh&, + const vectorField& faceAreas, + const vectorField& faceCentres, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr + ); + //- Small faces static bool checkFaceArea ( @@ -314,6 +327,7 @@ public: labelHashSet* setPtr ); + //- Area of internal faces v.s. boundary faces static bool checkCellDeterminant ( const bool report, @@ -413,6 +427,15 @@ public: labelHashSet* setPtr ) const; + bool checkFaceFlatness + ( + const bool report, + const scalar minFlatness, + const pointField& p, + const labelList& checkFaces, + labelHashSet* setPtr + ) const; + bool checkFaceArea ( const bool report, diff --git a/src/dynamicMesh/perfectInterface/perfectInterface.C b/src/dynamicMesh/perfectInterface/perfectInterface.C index 36df8808912381503dbe2804671d09a0f2a4b5bd..56fc14cdc723ea181f47b4ecc59cc8796cb959fe 100644 --- a/src/dynamicMesh/perfectInterface/perfectInterface.C +++ b/src/dynamicMesh/perfectInterface/perfectInterface.C @@ -278,7 +278,7 @@ void Foam::perfectInterface::setRefinement { affectedFaces.erase(pp1.addressing()[i]); } - // Remove patch0 from renumbered faces. Should not be nessecary since + // Remove patch0 from renumbered faces. Should not be necessary since // patch0 and 1 should not share any point (if created by mergeMeshing) // so affectedFaces should not contain any patch0 faces but you can // never be sure what the user is doing. @@ -373,7 +373,7 @@ void Foam::perfectInterface::setRefinement } - // 5. Modify patch0 faces for new points (not really nessecary; see + // 5. Modify patch0 faces for new points (not really necessary; see // comment above about patch1 and patch0 never sharing points) and // becoming internal. const boolList& mfFlip = diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C index 8de21e2f0857e45672a341838908334e47b9e3bf..e8e7b52721da4e438b0f1d69370f92389c13cb1f 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C @@ -34,9 +34,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::faceCoupleInfo, 0); +namespace Foam +{ +defineTypeNameAndDebug(faceCoupleInfo, 0); -const Foam::scalar Foam::faceCoupleInfo::angleTol_ = 1e-3; +const scalar faceCoupleInfo::angleTol_ = 1e-3; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C index 3a9773ce23d9e77ef13c171913635720e226f724..dfcc6a545eeacdc1692c53c2fc5304445e0cff25 100644 --- a/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C +++ b/src/dynamicMesh/polyMeshAdder/polyMeshAdder.C @@ -713,7 +713,7 @@ void Foam::polyMeshAdder::mergePrimitives } // Copy cut face (since cutPoints are copied first no renumbering - // nessecary) + // necessary) allFaces[allFaceI] = cutFaces[i]; allOwner[allFaceI] = mesh0.faceOwner()[mesh0FaceI]; allNeighbour[allFaceI] = mesh1.faceOwner()[mesh1FaceI] + mesh0.nCells(); diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C new file mode 100644 index 0000000000000000000000000000000000000000..0aebc63a0da4ed892686d530e655c3ef859ee0e5 --- /dev/null +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C @@ -0,0 +1,1096 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "polyMeshFilter.H" +#include "polyMesh.H" +#include "fvMesh.H" +#include "unitConversion.H" +#include "edgeCollapser.H" +#include "syncTools.H" +#include "polyTopoChange.H" +#include "globalIndex.H" +#include "PackedBoolList.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::autoPtr<Foam::fvMesh> Foam::polyMeshFilter::copyMesh(const fvMesh& mesh) +{ + polyTopoChange originalMeshToNewMesh(mesh); + + autoPtr<fvMesh> meshCopy; + autoPtr<mapPolyMesh> mapPtr = originalMeshToNewMesh.makeMesh + ( + meshCopy, + IOobject + ( + mesh.name(), + mesh.polyMesh::instance(), + mesh.time(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + true // parallel sync + ); + + const mapPolyMesh& map = mapPtr(); + + // Update fields + meshCopy().updateMesh(map); + if (map.hasMotionPoints()) + { + meshCopy().movePoints(map.preMotionPoints()); + } + + return meshCopy; +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::polyMeshFilter::updatePointErrorCount +( + const PackedBoolList& isErrorPoint, + const labelList& oldToNewMesh, + labelList& pointErrorCount +) const +{ + forAll(mesh_.points(), pI) + { + if (isErrorPoint[oldToNewMesh[pI]]) + { + pointErrorCount[pI]++; + } + } +} + + +void Foam::polyMeshFilter::checkMeshEdgesAndRelaxEdges +( + const polyMesh& newMesh, + const labelList& oldToNewMesh, + const PackedBoolList& isErrorPoint, + const labelList& pointErrorCount +) +{ + const edgeList& edges = mesh_.edges(); + + forAll(edges, edgeI) + { + const edge& e = edges[edgeI]; + label newStart = oldToNewMesh[e[0]]; + label newEnd = oldToNewMesh[e[1]]; + + if + ( + pointErrorCount[e[0]] >= maxPointErrorCount_ + || pointErrorCount[e[1]] >= maxPointErrorCount_ + ) + { + minEdgeLen_[edgeI] = 0; + } + + if + ( + (newStart >= 0 && isErrorPoint[newStart]) + || (newEnd >= 0 && isErrorPoint[newEnd]) + ) + { + minEdgeLen_[edgeI] *= edgeReductionFactor_; + } + } + + syncTools::syncEdgeList(mesh_, minEdgeLen_, minEqOp<scalar>(), scalar(0.0)); + + for (label smoothIter = 0; smoothIter < maxSmoothIters_; ++smoothIter) + { + // Smooth minEdgeLen + forAll(mesh_.edges(), edgeI) + { + const edge& e = mesh_.edges()[edgeI]; + + scalar sumMinEdgeLen = 0; + label nEdges = 0; + + forAll(e, pointI) + { + const labelList& pEdges = mesh_.pointEdges()[e[pointI]]; + + forAll(pEdges, pEdgeI) + { + const label pEdge = pEdges[pEdgeI]; + sumMinEdgeLen += minEdgeLen_[pEdge]; + nEdges++; + } + } + + minEdgeLen_[edgeI] = min + ( + minEdgeLen_[edgeI], + sumMinEdgeLen/nEdges + ); + } + + syncTools::syncEdgeList + ( + mesh_, + minEdgeLen_, + minEqOp<scalar>(), + scalar(0.0) + ); + } +} + + +void Foam::polyMeshFilter::checkMeshFacesAndRelaxEdges +( + const polyMesh& newMesh, + const labelList& oldToNewMesh, + const PackedBoolList& isErrorPoint, + const labelList& pointErrorCount +) +{ + const faceList& faces = mesh_.faces(); + + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + forAll(f, fpI) + { + const label ptIndex = oldToNewMesh[f[fpI]]; + + if (pointErrorCount[f[fpI]] >= maxPointErrorCount_) + { + faceFilterFactor_[faceI] = 0; + } + + if (isErrorPoint[ptIndex]) + { + faceFilterFactor_[faceI] *= faceReductionFactor_; + + break; + } + } + } + + syncTools::syncFaceList(mesh_, faceFilterFactor_, minEqOp<scalar>()); + + for (label smoothIter = 0; smoothIter < maxSmoothIters_; ++smoothIter) + { + // Smooth faceFilterFactor + forAll(faces, faceI) + { + const labelList& fEdges = mesh_.faceEdges()[faceI]; + + scalar sumFaceFilterFactors = 0; + label nFaces = 0; + + // This is important: Only smooth around faces that share an + // edge with a bad face + bool skipFace = true; + + forAll(fEdges, fEdgeI) + { + const labelList& eFaces = mesh_.edgeFaces()[fEdges[fEdgeI]]; + + forAll(eFaces, eFaceI) + { + const label eFace = eFaces[eFaceI]; + + const face& f = faces[eFace]; + + forAll(f, fpI) + { + const label ptIndex = oldToNewMesh[f[fpI]]; + + if (isErrorPoint[ptIndex]) + { + skipFace = false; + break; + } + } + + if (eFace != faceI) + { + sumFaceFilterFactors += faceFilterFactor_[eFace]; + nFaces++; + } + } + } + + if (skipFace) + { + continue; + } + + faceFilterFactor_[faceI] = min + ( + faceFilterFactor_[faceI], + sumFaceFilterFactors/nFaces + ); + } + + // Face filter factor needs to be synchronised! + syncTools::syncFaceList(mesh_, faceFilterFactor_, minEqOp<scalar>()); + } +} + + +Foam::labelList Foam::polyMeshFilter::findBoundaryPoints +( + const polyMesh& mesh//, +// labelIOList& boundaryIOPts +) const +{ + const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); + + labelList boundaryPoint(mesh.nPoints(), -1); + + // Get all processor boundary points and the processor patch label + // that they are on. + forAll(bMesh, patchI) + { + const polyPatch& patch = bMesh[patchI]; + + if (!isA<coupledPolyPatch>(patch)) + { + forAll(patch, fI) + { + const face& f = patch[fI]; + + forAll(f, fp) + { + boundaryPoint[f[fp]] = 0; //boundaryIOPts[f[fp]]; + } + } + } + } + + syncTools::syncPointList + ( + mesh, + boundaryPoint, + maxEqOp<label>(), + labelMin + ); + + return boundaryPoint; +} + + +void Foam::polyMeshFilter::printScalarFieldStats +( + const string desc, + const scalarField& fld +) const +{ + Info<< incrIndent << indent << desc + << ": min = " << returnReduce(min(fld), minOp<scalar>()) + << " av = " + << returnReduce(sum(fld), sumOp<scalar>()) + /returnReduce(fld.size(), sumOp<label>()) + << " max = " << returnReduce(max(fld), maxOp<scalar>()) + << decrIndent << endl; +} + + +void Foam::polyMeshFilter::mapOldMeshEdgeFieldToNewMesh +( + const polyMesh& newMesh, + const labelList& pointMap, + scalarField& newMeshMinEdgeLen +) const +{ + scalarField tmp(newMesh.nEdges()); + + const edgeList& newEdges = newMesh.edges(); + + forAll(newEdges, newEdgeI) + { + const edge& newEdge = newEdges[newEdgeI]; + const label pStart = newEdge.start(); + const label pEnd = newEdge.end(); + + tmp[newEdgeI] = min + ( + newMeshMinEdgeLen[pointMap[pStart]], + newMeshMinEdgeLen[pointMap[pEnd]] + ); + } + + newMeshMinEdgeLen.transfer(tmp); + + syncTools::syncEdgeList + ( + newMesh, + newMeshMinEdgeLen, + maxEqOp<scalar>(), + scalar(0.0) + ); +} + + +void Foam::polyMeshFilter::mapOldMeshFaceFieldToNewMesh +( + const polyMesh& newMesh, + const labelList& faceMap, + scalarField& newMeshFaceFilterFactor +) const +{ + scalarField tmp(newMesh.nFaces()); + + forAll(faceMap, newFaceI) + { + const label oldFaceI = faceMap[newFaceI]; + + tmp[newFaceI] = newMeshFaceFilterFactor[oldFaceI]; + } + + newMeshFaceFilterFactor.transfer(tmp); + + syncTools::syncFaceList + ( + newMesh, + newMeshFaceFilterFactor, + maxEqOp<scalar>() + ); +} + + +void Foam::polyMeshFilter::updateOldToNewPointMap +( + const labelList& currToNew, + labelList& origToCurrentPointMap +) const +{ + forAll(origToCurrentPointMap, origPointI) + { + label oldPointI = origToCurrentPointMap[origPointI]; + + if (oldPointI < currToNew.size()) + { + label newPointI = currToNew[oldPointI]; + + if (newPointI != -1) + { + origToCurrentPointMap[origPointI] = newPointI; + } + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::polyMeshFilter::polyMeshFilter(const fvMesh& mesh) +: + mesh_(mesh), + newMeshPtr_(), + dict_ + ( + IOobject + ( + "collapseDict", + mesh.time().system(), + mesh.time(), + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + collapseEdgesCoeffDict_(dict_.subDict("collapseEdgesCoeffs")), + collapseFacesCoeffDict_(dict_.subDict("collapseFacesCoeffs")), + meshQualityCoeffDict_(dict_.subDict("meshQualityCoeffs")), + minLen_(readScalar(collapseEdgesCoeffDict_.lookup("minimumEdgeLength"))), + maxCos_ + ( + ::cos + ( + degToRad + ( + readScalar(collapseEdgesCoeffDict_.lookup("maximumMergeAngle")) + ) + ) + ), + edgeReductionFactor_ + ( + readScalar(collapseEdgesCoeffDict_.lookup("reductionFactor")) + ), + maxIterations_ + ( + readLabel(meshQualityCoeffDict_.lookup("maximumIterations")) + ), + maxSmoothIters_ + ( + readLabel(meshQualityCoeffDict_.lookup("maximumSmoothingIterations")) + ), + initialFaceLengthFactor_ + ( + readScalar(collapseFacesCoeffDict_.lookup("initialFaceLengthFactor")) + ), + faceReductionFactor_ + ( + readScalar(collapseFacesCoeffDict_.lookup("reductionFactor")) + ), + maxPointErrorCount_ + ( + readLabel(meshQualityCoeffDict_.lookup("maxPointErrorCount")) + ), + minEdgeLen_(), + faceFilterFactor_() +{ + Info<< "Merging:" << nl + << " edges with length less than " << minLen_ << " meters" << nl + << " edges split by a point with edges in line to within " + << radToDeg(::acos(maxCos_)) << " degrees" << nl + << " Minimum edge length reduction factor = " + << edgeReductionFactor_ << nl + << endl; + + Info<< "Collapse faces with reduction factor = " << faceReductionFactor_ + << endl; + + Info<< "Selectively disabling wanted collapses until resulting quality" + << " satisfies constraints in system/meshQualityDict" << nl + << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::polyMeshFilter::~polyMeshFilter() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::label Foam::polyMeshFilter::filter(const label nOriginalBadFaces) +{ + label nBadFaces = labelMax; + label nOuterIterations = 0; + + minEdgeLen_.resize(mesh_.nEdges(), minLen_); + faceFilterFactor_.resize(mesh_.nFaces(), initialFaceLengthFactor_); + + // Maintain the number of times a point has been part of a bad face + // + labelList pointErrorCount(mesh_.nPoints(), 0); + + // Main loop + // ~~~~~~~~~ + // It tries and do some collapses, checks the resulting mesh and + // 'freezes' some edges (by marking in minEdgeLen) and tries again. + // This will iterate ultimately to the situation where every edge is + // frozen and nothing gets collapsed. + while + ( + nOuterIterations < maxIterations_ + && nBadFaces > nOriginalBadFaces + ) + { + Info<< nl << "Outer Iteration = " << nOuterIterations++ << nl + << endl; + + printScalarFieldStats("Edge Filter Factor", minEdgeLen_); + printScalarFieldStats("Face Filter Factor", faceFilterFactor_); + + // Reset the new mesh to the old mesh + newMeshPtr_ = copyMesh(mesh_); + fvMesh& newMesh = newMeshPtr_(); + + scalarField newMeshFaceFilterFactor = faceFilterFactor_; + + labelList origToCurrentPointMap(identity(newMesh.nPoints())); + { + + label nInnerIterations = 0; + label nPrevLocalCollapse = labelMax; + + Info<< incrIndent; + + while (true) + { + Info<< nl << indent << "Inner iteration = " + << nInnerIterations++ << nl << incrIndent << endl; + + // Per edge collapse status + PackedBoolList collapseEdge(newMesh.nEdges()); + + Map<point> collapsePointToLocation(newMesh.nPoints()); + + // Mark points on boundary + const labelList boundaryPoint = findBoundaryPoints + ( + newMesh//, + // boundaryIOPts + ); + + edgeCollapser collapser(newMesh, collapseFacesCoeffDict_); + + // Per face collapse status: + // -1 : not collapsed + // >= 0 : index of point in face to collapse to + List<Map<point> > faceCollapseToPoints + ( + newMesh.nFaces(), + Map<point>() + ); + + { + // Collapse faces + labelPair nCollapsedPtEdge = collapser.markSmallSliverFaces + ( + newMeshFaceFilterFactor, + boundaryPoint, + collapseEdge, + collapsePointToLocation + ); + + label nCollapsed = 0; + forAll(nCollapsedPtEdge, collapseTypeI) + { + nCollapsed += nCollapsedPtEdge[collapseTypeI]; + } + + reduce(nCollapsed, sumOp<label>()); + + Info<< indent + << "Collapsing " << nCollapsed << " faces" + << " (to point = " + << returnReduce + ( + nCollapsedPtEdge.first(), + sumOp<label>() + ) + << ", to edge = " + << returnReduce + ( + nCollapsedPtEdge.second(), + sumOp<label>() + ) + << ")" << endl; + + if (nCollapsed == 0) + { + Info<< decrIndent; + Info<< decrIndent; + break; + } + } + + // Merge edge collapses into consistent collapse-network. + // Make sure no cells get collapsed. + List<pointEdgeCollapse> allPointInfo; + const globalIndex globalPoints(newMesh.nPoints()); + + collapser.consistentCollapse + ( + globalPoints, + boundaryPoint, + collapsePointToLocation, + collapseEdge, + allPointInfo + ); + + label nLocalCollapse = collapseEdge.count(); + + reduce(nLocalCollapse, sumOp<label>()); + Info<< nl << indent << "Collapsing " << nLocalCollapse + << " edges after synchronisation and PointEdgeWave" << endl; + + if (nLocalCollapse >= nPrevLocalCollapse) + { + Info<< decrIndent; + Info<< decrIndent; + break; + } + else + { + nPrevLocalCollapse = nLocalCollapse; + } + + { + // Apply collapses to current mesh + polyTopoChange newMeshMod(newMesh); + + // Insert mesh refinement into polyTopoChange. + collapser.setRefinement(allPointInfo, newMeshMod); + + Info<< indent << "Apply changes to the current mesh" + << decrIndent << endl; + + // Apply changes to current mesh + autoPtr<mapPolyMesh> newMapPtr = newMeshMod.changeMesh + ( + newMesh, + false + ); + const mapPolyMesh& newMap = newMapPtr(); + + // Update fields + newMesh.updateMesh(newMap); + if (newMap.hasMotionPoints()) + { + newMesh.movePoints(newMap.preMotionPoints()); + } + + // Relabel the boundary points + // labelList newBoundaryPoints(newMesh.nPoints(), -1); + // forAll(newBoundaryPoints, pI) + // { + // const label newToOldptI= map.pointMap()[pI]; + // newBoundaryPoints[pI] = boundaryIOPts[newToOldptI]; + // } + // boundaryIOPts = newBoundaryPoints; + + + mapOldMeshFaceFieldToNewMesh + ( + newMesh, + newMap.faceMap(), + newMeshFaceFilterFactor + ); + + updateOldToNewPointMap + ( + newMap.reversePointMap(), + origToCurrentPointMap + ); + } + } + } + + + scalarField newMeshMinEdgeLen = minEdgeLen_; + + label nInnerIterations = 0; + label nPrevLocalCollapse = labelMax; + + while (true) + { + Info<< nl << indent << "Inner iteration = " + << nInnerIterations++ << nl << incrIndent << endl; + + // Per edge collapse status + PackedBoolList collapseEdge(newMesh.nEdges()); + + Map<point> collapsePointToLocation(newMesh.nPoints()); + + // Mark points on boundary + const labelList boundaryPoint = findBoundaryPoints + ( + newMesh//, +// boundaryIOPts + ); + + edgeCollapser collapser(newMesh, collapseFacesCoeffDict_); + + // Work out which edges to collapse + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // This is by looking at minEdgeLen (to avoid frozen edges) + // and marking in collapseEdge. + label nSmallCollapsed = collapser.markSmallEdges + ( + newMeshMinEdgeLen, + boundaryPoint, + collapseEdge, + collapsePointToLocation + ); + + reduce(nSmallCollapsed, sumOp<label>()); + Info<< indent << "Collapsing " << nSmallCollapsed + << " small edges" << endl; + + // Merge inline edges + label nMerged = collapser.markMergeEdges + ( + maxCos_, + boundaryPoint, + collapseEdge, + collapsePointToLocation + ); + + reduce(nMerged, sumOp<label>()); + Info<< indent << "Collapsing " << nMerged << " in line edges" + << endl; + + if (nMerged + nSmallCollapsed == 0) + { + Info<< decrIndent; + break; + } + + // Merge edge collapses into consistent collapse-network. + // Make sure no cells get collapsed. + List<pointEdgeCollapse> allPointInfo; + const globalIndex globalPoints(newMesh.nPoints()); + + collapser.consistentCollapse + ( + globalPoints, + boundaryPoint, + collapsePointToLocation, + collapseEdge, + allPointInfo + ); + + label nLocalCollapse = collapseEdge.count(); + + reduce(nLocalCollapse, sumOp<label>()); + Info<< nl << indent << "Collapsing " << nLocalCollapse + << " edges after synchronisation and PointEdgeWave" << endl; + + if (nLocalCollapse >= nPrevLocalCollapse) + { + Info<< decrIndent; + break; + } + else + { + nPrevLocalCollapse = nLocalCollapse; + } + + // Apply collapses to current mesh + polyTopoChange newMeshMod(newMesh); + + // Insert mesh refinement into polyTopoChange. + collapser.setRefinement(allPointInfo, newMeshMod); + + Info<< indent << "Apply changes to the current mesh" + << decrIndent << endl; + + // Apply changes to current mesh + autoPtr<mapPolyMesh> newMapPtr = newMeshMod.changeMesh + ( + newMesh, + false + ); + const mapPolyMesh& newMap = newMapPtr(); + + // Update fields + newMesh.updateMesh(newMap); + if (newMap.hasMotionPoints()) + { + newMesh.movePoints(newMap.preMotionPoints()); + } + + // Relabel the boundary points +// labelList newBoundaryPoints(newMesh.nPoints(), -1); +// forAll(newBoundaryPoints, pI) +// { +// const label newToOldptI= map.pointMap()[pI]; +// newBoundaryPoints[pI] = boundaryIOPts[newToOldptI]; +// } +// boundaryIOPts = newBoundaryPoints; + + // Synchronise the factors + mapOldMeshEdgeFieldToNewMesh + ( + newMesh, + newMap.pointMap(), + newMeshMinEdgeLen + ); + + updateOldToNewPointMap + ( + newMap.reversePointMap(), + origToCurrentPointMap + ); + } + + + // Mesh check + // ~~~~~~~~~~~~~~~~~~ + // Do not allow collapses in regions of error. + // Updates minEdgeLen, nRelaxedEdges + + PackedBoolList isErrorPoint(newMesh.nPoints()); + nBadFaces = edgeCollapser::checkMeshQuality + ( + newMesh, + meshQualityCoeffDict_, + isErrorPoint + ); + + Info<< nl << " Number of bad faces : " << nBadFaces << nl + << " Number of marked points : " + << returnReduce(isErrorPoint.count(), sumOp<unsigned int>()) + << endl; + + updatePointErrorCount + ( + isErrorPoint, + origToCurrentPointMap, + pointErrorCount + ); + + checkMeshEdgesAndRelaxEdges + ( + newMesh, + origToCurrentPointMap, + isErrorPoint, + pointErrorCount + ); + + checkMeshFacesAndRelaxEdges + ( + newMesh, + origToCurrentPointMap, + isErrorPoint, + pointErrorCount + ); + } + + return nBadFaces; +} + + +Foam::label Foam::polyMeshFilter::filterEdges +( + const label nOriginalBadFaces +) +{ + label nBadFaces = labelMax/2; + label nPreviousBadFaces = labelMax; + label nOuterIterations = 0; + + minEdgeLen_.resize(mesh_.nEdges(), minLen_); + faceFilterFactor_.resize(0); + + labelList pointErrorCount(mesh_.nPoints(), 0); + + // Main loop + // ~~~~~~~~~ + // It tries and do some collapses, checks the resulting mesh and + // 'freezes' some edges (by marking in minEdgeLen) and tries again. + // This will iterate ultimately to the situation where every edge is + // frozen and nothing gets collapsed. + while + ( + nOuterIterations < maxIterations_ + && nBadFaces > nOriginalBadFaces + && nBadFaces < nPreviousBadFaces + ) + { + Info<< nl << "Outer Iteration = " << nOuterIterations++ << nl + << endl; + + printScalarFieldStats("Edge Filter Factor", minEdgeLen_); + + nPreviousBadFaces = nBadFaces; + + // Reset the new mesh to the old mesh + newMeshPtr_ = copyMesh(mesh_); + fvMesh& newMesh = newMeshPtr_(); + + scalarField newMeshMinEdgeLen = minEdgeLen_; + + labelList origToCurrentPointMap(identity(newMesh.nPoints())); + + label nInnerIterations = 0; + label nPrevLocalCollapse = labelMax; + + Info<< incrIndent; + + while (true) + { + Info<< nl << indent << "Inner iteration = " + << nInnerIterations++ << nl << incrIndent << endl; + + // Per edge collapse status + PackedBoolList collapseEdge(newMesh.nEdges()); + + Map<point> collapsePointToLocation(newMesh.nPoints()); + + // Mark points on boundary + const labelList boundaryPoint = findBoundaryPoints + ( + newMesh//, +// boundaryIOPts + ); + + edgeCollapser collapser(newMesh, collapseFacesCoeffDict_); + + // Work out which edges to collapse + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // This is by looking at minEdgeLen (to avoid frozen edges) + // and marking in collapseEdge. + label nSmallCollapsed = collapser.markSmallEdges + ( + newMeshMinEdgeLen, + boundaryPoint, + collapseEdge, + collapsePointToLocation + ); + + reduce(nSmallCollapsed, sumOp<label>()); + Info<< indent << "Collapsing " << nSmallCollapsed + << " small edges" << endl; + + // Merge inline edges + label nMerged = collapser.markMergeEdges + ( + maxCos_, + boundaryPoint, + collapseEdge, + collapsePointToLocation + ); + + reduce(nMerged, sumOp<label>()); + Info<< indent << "Collapsing " << nMerged << " in line edges" + << endl; + + if (nMerged + nSmallCollapsed == 0) + { + Info<< decrIndent; + Info<< decrIndent; + break; + } + + // Merge edge collapses into consistent collapse-network. + // Make sure no cells get collapsed. + List<pointEdgeCollapse> allPointInfo; + const globalIndex globalPoints(newMesh.nPoints()); + + collapser.consistentCollapse + ( + globalPoints, + boundaryPoint, + collapsePointToLocation, + collapseEdge, + allPointInfo + ); + + label nLocalCollapse = collapseEdge.count(); + + reduce(nLocalCollapse, sumOp<label>()); + Info<< nl << indent << "Collapsing " << nLocalCollapse + << " edges after synchronisation and PointEdgeWave" << endl; + + if (nLocalCollapse >= nPrevLocalCollapse) + { + Info<< decrIndent; + Info<< decrIndent; + break; + } + else + { + nPrevLocalCollapse = nLocalCollapse; + } + + // Apply collapses to current mesh + polyTopoChange newMeshMod(newMesh); + + // Insert mesh refinement into polyTopoChange. + collapser.setRefinement(allPointInfo, newMeshMod); + + Info<< indent << "Apply changes to the current mesh" + << decrIndent << endl; + + // Apply changes to current mesh + autoPtr<mapPolyMesh> newMapPtr = newMeshMod.changeMesh + ( + newMesh, + false + ); + const mapPolyMesh& newMap = newMapPtr(); + + // Update fields + newMesh.updateMesh(newMap); + if (newMap.hasMotionPoints()) + { + newMesh.movePoints(newMap.preMotionPoints()); + } + + // Relabel the boundary points +// labelList newBoundaryPoints(newMesh.nPoints(), -1); +// forAll(newBoundaryPoints, pI) +// { +// const label newToOldptI= map.pointMap()[pI]; +// newBoundaryPoints[pI] = boundaryIOPts[newToOldptI]; +// } +// boundaryIOPts = newBoundaryPoints; + + // Synchronise the factors + mapOldMeshEdgeFieldToNewMesh + ( + newMesh, + newMap.pointMap(), + newMeshMinEdgeLen + ); + + updateOldToNewPointMap + ( + newMap.reversePointMap(), + origToCurrentPointMap + ); + } + + // Mesh check + // ~~~~~~~~~~~~~~~~~~ + // Do not allow collapses in regions of error. + // Updates minEdgeLen, nRelaxedEdges + + PackedBoolList isErrorPoint(newMesh.nPoints()); + nBadFaces = edgeCollapser::checkMeshQuality + ( + newMesh, + meshQualityCoeffDict_, + isErrorPoint + ); + + Info<< nl << " Number of bad faces : " << nBadFaces << nl + << " Number of marked points : " + << returnReduce(isErrorPoint.count(), sumOp<unsigned int>()) + << endl; + + updatePointErrorCount + ( + isErrorPoint, + origToCurrentPointMap, + pointErrorCount + ); + + checkMeshEdgesAndRelaxEdges + ( + newMesh, + origToCurrentPointMap, + isErrorPoint, + pointErrorCount + ); + } + + return nBadFaces; +} + + +const Foam::autoPtr<Foam::fvMesh>& Foam::polyMeshFilter::filteredMesh() const +{ + return newMeshPtr_; +} + + +// ************************************************************************* // diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H new file mode 100644 index 0000000000000000000000000000000000000000..e00877a8c178fc532e530b4261c930b7801f3eb9 --- /dev/null +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.H @@ -0,0 +1,238 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::polyMeshFilter + +Description + +SourceFiles + polyMeshFilter.C + +\*---------------------------------------------------------------------------*/ + +#ifndef polyMeshFilter_H +#define polyMeshFilter_H + +#include "IOdictionary.H" +#include "Time.H" +#include "List.H" +#include "autoPtr.H" +#include "scalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class polyMesh; +class fvMesh; +class PackedBoolList; + +/*---------------------------------------------------------------------------*\ + Class polyMeshFilter Declaration +\*---------------------------------------------------------------------------*/ + +class polyMeshFilter +{ + // Private data + + //- Reference to the original mesh + const fvMesh& mesh_; + + //- Copy of the original mesh to perform the filtering on + autoPtr<fvMesh> newMeshPtr_; + + //- Dictionary containing the coefficient sub-dictionaries + const IOdictionary dict_; + + //- Coefficients for collapsing edges + const dictionary& collapseEdgesCoeffDict_; + + //- Coefficients for collapsing faces + const dictionary& collapseFacesCoeffDict_; + + //- Coefficients for controlling the mesh quality + const dictionary& meshQualityCoeffDict_; + + //- Remove edges shorter than this length + const scalar minLen_; + + //- Merge points that are only attached to two edges and have an angle + // between the edge greater than this value + const scalar maxCos_; + + //- The amount that the local minimum edge length will be reduced by if + // the edge is part of a collapse string that generates poor quality + // faces + const scalar edgeReductionFactor_; + + //- Maximum number of outer iterations + const label maxIterations_; + + //- Maximum number of smoothing iterations of minEdgeLen_ and + // faceFilterFactor_ + const label maxSmoothIters_; + + //- Initialisation value of faceFilterFactor_ + const scalar initialFaceLengthFactor_; + + //- The amount that the local face size factor will be reduced by if + // the face is part of a collapse string that generates poor quality + // faces + const scalar faceReductionFactor_; + + //- + const label maxPointErrorCount_; + + + //- The minimum edge length for each edge + scalarField minEdgeLen_; + + //- The face filter factor for each face + scalarField faceFilterFactor_; + + + // Private Member Functions + + //- Increment pointErrorCount for points attached to a bad face + void updatePointErrorCount + ( + const PackedBoolList& isErrorPoint, + const labelList& oldToNewMesh, + labelList& pointErrorCount + ) const; + + + //- Given the new points that are part of bad faces, and a map from the + // old mesh points to the new mesh points, relax minEdgeLen_ + void checkMeshEdgesAndRelaxEdges + ( + const polyMesh& newMesh, + const labelList& oldToNewMesh, + const PackedBoolList& isErrorPoint, + const labelList& pointErrorCount + ); + + //- Given the new points that are part of bad faces, and a map from the + // old mesh points to the new mesh points, relax faceFilterFactor_ + void checkMeshFacesAndRelaxEdges + ( + const polyMesh& newMesh, + const labelList& oldToNewMesh, + const PackedBoolList& isErrorPoint, + const labelList& pointErrorCount + ); + + // Mark boundary points + // boundaryPoint: + // + -1 : point not on boundary + // + 0 : point on a real boundary + // + >0 : point on a processor patch with that ID + // @todo Need to mark boundaryEdges as well, as an edge may have two + // boundary points but not itself lie on a boundary + labelList findBoundaryPoints(const polyMesh& mesh) const; + + //- Print min/mean/max data for a field + void printScalarFieldStats + ( + const string desc, + const scalarField& fld + ) const; + + //- Update minEdgeLen_ for the new mesh based upon the movement of the + // old points to the new points + void mapOldMeshEdgeFieldToNewMesh + ( + const polyMesh& newMesh, + const labelList& pointMap, + scalarField& newMeshMinEdgeLen + ) const; + + //- Update faceFilterFactor_ for the new mesh based upon the movement + // of the old faces to the new faces + void mapOldMeshFaceFieldToNewMesh + ( + const polyMesh& newMesh, + const labelList& faceMap, + scalarField& newMeshFaceFilterFactor + ) const; + + //- Maintain a map of the original mesh points to the latest version of + // the filtered mesh. + void updateOldToNewPointMap + ( + const labelList& currToNew, + labelList& origToCurrentPointMap + ) const; + + //- Disallow default bitwise copy construct + polyMeshFilter(const polyMeshFilter&); + + //- Disallow default bitwise assignment + void operator=(const polyMeshFilter&); + + +public: + + // Constructors + + //- Construct from fvMesh + explicit polyMeshFilter(const fvMesh& mesh); + + + //- Destructor + ~polyMeshFilter(); + + + // Member Functions + + // Access + + //- Return reference to the filtered mesh. Does not check if the + // mesh has actually been filtered. + const autoPtr<fvMesh>& filteredMesh() const; + + + // Edit + + //- Return a copy of an fvMesh + static autoPtr<fvMesh> copyMesh(const fvMesh& mesh); + + //- Filter edges and faces + label filter(const label nOriginalBadFaces); + + //- Filter edges only. + label filterEdges(const label nOriginalBadFaces); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C index 7f11fb638d1dfcea7b7181169a528bb557c73e3c..bc9b292aabf1fc2252132bd580b4e63e395b2188 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.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 @@ -37,7 +37,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::addPatchCellLayer, 0); +namespace Foam +{ +defineTypeNameAndDebug(addPatchCellLayer, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H index bc3624548e99343dfae6b59af5ec976fb2af84af..9e8269df937c45c5c350e0505412b835731e1c70 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/addPatchCellLayer.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 @@ -66,8 +66,8 @@ Description - added faces get same patchID as face they are extruded from - - 'side' faces (i.e. on the edge of pp) get the patchID of the - other patch they are connected to. + - 'side' faces (i.e. on the edge of pp) get the patchID/zoneID of the + other patch/zone they are connected to (hopefully only 1) E.g. 3 boundary faces on patches a,b. b gets extruded, a doesn't. diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C index 8a772ac888ac8070c1fbec681255f35b26786dc3..e74e8783c4f6439742d67fd30d430a7d7bc258cd 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/combineFaces.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 @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::combineFaces, 0); +namespace Foam +{ +defineTypeNameAndDebug(combineFaces, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C index 9cc4349803a3bada66253405f3075fde6ab3f8ae..8290308a50ebaf8531de0a019597c1b16dae8ee2 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -26,441 +26,1278 @@ License #include "edgeCollapser.H" #include "polyMesh.H" #include "polyTopoChange.H" -#include "ListOps.H" #include "globalMeshData.H" -#include "OFstream.H" -#include "meshTools.H" #include "syncTools.H" +#include "PointEdgeWave.H" +#include "globalIndex.H" +#include "removePoints.H" +#include "motionSmoother.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -Foam::label Foam::edgeCollapser::findIndex +Foam::label Foam::edgeCollapser::longestEdge ( - const labelList& elems, - const label start, - const label size, - const label val + const face& f, + const pointField& pts ) { - for (label i = start; i < size; i++) + const edgeList& eds = f.edges(); + + label longestEdgeI = -1; + scalar longestEdgeLength = -SMALL; + + forAll(eds, edI) { - if (elems[i] == val) + scalar edgeLength = eds[edI].mag(pts); + + if (edgeLength > longestEdgeLength) { - return i; + longestEdgeI = edI; + longestEdgeLength = edgeLength; } } - return -1; + + return longestEdgeI; } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +Foam::HashSet<Foam::label> Foam::edgeCollapser::checkBadFaces +( + const polyMesh& mesh, + const dictionary& meshQualityDict +) +{ + labelHashSet badFaces(mesh.nFaces()/100); + DynamicList<label> checkFaces(mesh.nFaces()); + + const vectorField& fAreas = mesh.faceAreas(); + + scalar faceAreaLimit = SMALL; + + forAll(fAreas, fI) + { + if (mag(fAreas[fI]) > faceAreaLimit) + { + checkFaces.append(fI); + } + } + + Info<< endl; -// Changes region of connected set of points -Foam::label Foam::edgeCollapser::changePointRegion + motionSmoother::checkMesh + ( + false, + mesh, + meshQualityDict, + checkFaces, + badFaces + ); + + return badFaces; +} + + +Foam::label Foam::edgeCollapser::checkMeshQuality ( - const label pointI, - const label oldRegion, - const label newRegion + const polyMesh& mesh, + const dictionary& meshQualityDict, + PackedBoolList& isErrorPoint ) { - label nChanged = 0; + labelHashSet badFaces = edgeCollapser::checkBadFaces + ( + mesh, + meshQualityDict + ); + + label nBadFaces = returnReduce(badFaces.size(), sumOp<label>()); - if (pointRegion_[pointI] == oldRegion) + forAllConstIter(labelHashSet, badFaces, iter) { - pointRegion_[pointI] = newRegion; - nChanged++; + const face& f = mesh.faces()[iter.key()]; + + forAll(f, pI) + { + isErrorPoint[f[pI]] = true; + } + } + + syncTools::syncPointList + ( + mesh, + isErrorPoint, + orEqOp<unsigned int>(), + 0 + ); + + return nBadFaces; +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::labelList Foam::edgeCollapser::edgesFromPoints +( + const label& faceI, + const labelList& pointLabels +) const +{ + labelList edgeLabels(pointLabels.size() - 1, -1); + + const labelList& faceEdges = mesh_.faceEdges()[faceI]; + const edgeList& edges = mesh_.edges(); + + label count = 0; - // Step to neighbouring point across edges with same region number + forAll(faceEdges, eI) + { + const label edgeI = faceEdges[eI]; + const edge& e = edges[edgeI]; - const labelList& pEdges = mesh_.pointEdges()[pointI]; + label match = 0; - forAll(pEdges, i) + forAll(pointLabels, pI) { - label otherPointI = mesh_.edges()[pEdges[i]].otherVertex(pointI); + if (e[0] == pointLabels[pI]) + { + match++; + } - nChanged += changePointRegion(otherPointI, oldRegion, newRegion); + if (e[1] == pointLabels[pI]) + { + match++; + } + } + + if (match == 2) + { + // Edge found + edgeLabels[count++] = edgeI; } } - return nChanged; + + if (count != edgeLabels.size()) + { + edgeLabels.setSize(count); + } + + return edgeLabels; } -bool Foam::edgeCollapser::pointRemoved(const label pointI) const +void Foam::edgeCollapser::collapseToEdge +( + const label faceI, + const pointField& pts, + const labelList& pointPriority, + const vector& collapseAxis, + const point& fC, + const labelList& facePtsNeg, + const labelList& facePtsPos, + const scalarList& dNeg, + const scalarList& dPos, + const scalar dShift, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation +) const { - label region = pointRegion_[pointI]; + const face& f = mesh_.faces()[faceI]; + + // Negative half + + Foam::point collapseToPtA = + collapseAxis*(sum(dNeg)/dNeg.size() - dShift) + fC; - if (region == -1 || pointRegionMaster_[region] == pointI) + DynamicList<label> faceBoundaryPts(f.size()); + DynamicList<label> faceFeaturePts(f.size()); + + forAll(facePtsNeg, fPtI) { - return false; + if (pointPriority[facePtsNeg[fPtI]] == 1) + { + faceFeaturePts.append(facePtsNeg[fPtI]); + } + else if (pointPriority[facePtsNeg[fPtI]] == 0) + { + faceBoundaryPts.append(facePtsNeg[fPtI]); + } + } + + if (!faceBoundaryPts.empty() || !faceFeaturePts.empty()) + { + if (!faceFeaturePts.empty()) + { + collapseToPtA = pts[faceFeaturePts.first()]; + } + else if (faceBoundaryPts.size() == 2) + { + collapseToPtA = + 0.5 + *( + pts[faceBoundaryPts[0]] + + pts[faceBoundaryPts[1]] + ); + } + else if (faceBoundaryPts.size() <= f.size()) + { + face bFace(faceBoundaryPts); + + collapseToPtA = bFace.centre(pts); + } + } + + faceFeaturePts.clear(); + faceBoundaryPts.clear(); + + labelList faceEdgesNeg = edgesFromPoints(faceI, facePtsNeg); + + forAll(faceEdgesNeg, edgeI) + { + collapseEdge[faceEdgesNeg[edgeI]] = true; + } + + forAll(facePtsNeg, pI) + { + collapsePointToLocation.set(facePtsNeg[pI], collapseToPtA); + } + + + // Positive half + + Foam::point collapseToPtB + = collapseAxis*(sum(dPos)/dPos.size() - dShift) + fC; + + forAll(facePtsPos, fPtI) + { + if (pointPriority[facePtsPos[fPtI]] == 1) + { + faceFeaturePts.append(facePtsPos[fPtI]); + } + else if (pointPriority[facePtsPos[fPtI]] == 0) + { + // If there is a point which is on the boundary, + // use it as the point to collapse others to, will + // use the first boundary point encountered if + // there are multiple boundary points. + faceBoundaryPts.append(facePtsPos[fPtI]); + } + } + + if (!faceBoundaryPts.empty() || !faceFeaturePts.empty()) + { + if (!faceFeaturePts.empty()) + { + collapseToPtB = pts[faceFeaturePts.first()]; + } + else if (faceBoundaryPts.size() == 2) + { + collapseToPtB = + 0.5 + *( + pts[faceBoundaryPts[0]] + + pts[faceBoundaryPts[1]] + ); + } + else if (faceBoundaryPts.size() <= f.size()) + { + face bFace(faceBoundaryPts); + + collapseToPtB = bFace.centre(pts); + } + } + + labelList faceEdgesPos = edgesFromPoints(faceI, facePtsPos); + + forAll(faceEdgesPos, edgeI) + { + collapseEdge[faceEdgesPos[edgeI]] = true; + } + + forAll(facePtsPos, pI) + { + collapsePointToLocation.set(facePtsPos[pI], collapseToPtB); + } +} + + +void Foam::edgeCollapser::collapseToPoint +( + const label& faceI, + const pointField& pts, + const labelList& pointPriority, + const point& fC, + const labelList& facePts, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation +) const +{ + const face& f = mesh_.faces()[faceI]; + + Foam::point collapseToPt = fC; + + DynamicList<label> faceBoundaryPts(f.size()); + DynamicList<label> faceFeaturePts(f.size()); + + forAll(facePts, fPtI) + { + if (pointPriority[facePts[fPtI]] == 1) + { + faceFeaturePts.append(facePts[fPtI]); + } + else if (pointPriority[facePts[fPtI]] == 0) + { + faceBoundaryPts.append(facePts[fPtI]); + } + } + + if (!faceBoundaryPts.empty() || !faceFeaturePts.empty()) + { + if (!faceFeaturePts.empty()) + { + collapseToPt = pts[faceFeaturePts.first()]; + } + else if (faceBoundaryPts.size() == 2) + { + collapseToPt = + 0.5 + *( + pts[faceBoundaryPts[0]] + + pts[faceBoundaryPts[1]] + ); + } + else if (faceBoundaryPts.size() <= f.size()) + { + face bFace(faceBoundaryPts); + + collapseToPt = bFace.centre(pts); + } + } + + const labelList faceEdges = mesh_.faceEdges()[faceI]; + + forAll(faceEdges, eI) + { + const label edgeI = faceEdges[eI]; + collapseEdge[edgeI] = true; + } + + forAll(f, pI) + { + collapsePointToLocation.set(f[pI], collapseToPt); + } +} + + +void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio +( + const face& f, + const point& fC, + vector& collapseAxis, + scalar& aspectRatio +) const +{ + const pointField& pts = mesh_.points(); + + tensor J = f.inertia(pts, fC); + + // Find the dominant collapse direction by finding the eigenvector + // that corresponds to the normal direction, discarding it. The + // eigenvector corresponding to the smaller of the two remaining + // eigenvalues is the dominant axis in a high aspect ratio face. + + scalar magJ = mag(J); + + scalar detJ = SMALL; + + if (magJ > VSMALL) + { + // Normalise inertia tensor to remove problems with small values + + J /= mag(J); + // J /= cmptMax(J); + // J /= max(eigenValues(J).x(), SMALL); + + // Calculating determinant, including stabilisation for zero or + // small negative values + + detJ = max(det(J), SMALL); + } + + if (detJ < 1e-5) + { + collapseAxis = f.edges()[longestEdge(f, pts)].vec(pts); + + // It is possible that all the points of a face are the same + if (magSqr(collapseAxis) > VSMALL) + { + collapseAxis /= mag(collapseAxis); + } + + // Empirical correlation for high aspect ratio faces + + aspectRatio = Foam::sqrt(0.35/detJ); } else { - return true; + vector eVals = eigenValues(J); + + if (mag(eVals.y() - eVals.x()) < 100*SMALL) + { + // First two eigenvalues are the same: i.e. a square face + + // Cannot necessarily determine linearly independent + // eigenvectors, or any at all, use longest edge direction. + + collapseAxis = f.edges()[longestEdge(f, pts)].vec(pts); + + collapseAxis /= mag(collapseAxis); + + aspectRatio = 1.0; + } + else + { + // The maximum eigenvalue (z()) must be the direction of the + // normal, as it has the greatest value. The minimum eigenvalue + // is the dominant collapse axis for high aspect ratio faces. + + collapseAxis = eigenVector(J, eVals.x()); + + // The inertia calculation describes the mass distribution as a + // function of distance squared to the axis, so the square root of + // the ratio of face-plane moments gives a good indication of the + // aspect ratio. + + aspectRatio = Foam::sqrt(eVals.y()/max(eVals.x(), SMALL)); + } } } -void Foam::edgeCollapser::filterFace(const label faceI, face& f) const +Foam::scalarField Foam::edgeCollapser::calcTargetFaceSizes() const { - label newFp = 0; + scalarField targetFaceSizes(mesh_.nFaces(), -1); - forAll(f, fp) + const scalarField& cellVolumes = mesh_.cellVolumes(); + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + + const labelList& cellOwner = mesh_.faceOwner(); + const labelList& cellNeighbour = mesh_.faceNeighbour(); + + const label nBoundaryFaces = mesh_.nFaces() - mesh_.nInternalFaces(); + + // Calculate face size from cell volumes for internal faces + for (label intFaceI = 0; intFaceI < mesh_.nInternalFaces(); ++intFaceI) { - label pointI = f[fp]; + const scalar cellOwnerVol = cellVolumes[cellOwner[intFaceI]]; + const scalar cellNeighbourVol = cellVolumes[cellNeighbour[intFaceI]]; + + scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0); + scalar targetFaceSizeB = Foam::pow(cellNeighbourVol, 1.0/3.0); + + targetFaceSizes[intFaceI] = 0.5*(targetFaceSizeA + targetFaceSizeB); + } + + scalarField neiCellVolumes(nBoundaryFaces, -1); + + // Now do boundary faces + forAll(patches, patchI) + { + const polyPatch& patch = patches[patchI]; - label region = pointRegion_[pointI]; + label bFaceI = patch.start() - mesh_.nInternalFaces(); - if (region == -1) + if (patch.coupled()) { - f[newFp++] = pointI; + // Processor boundary face: Need to get the cell volume on the other + // processor + const labelUList& faceCells = patch.faceCells(); + + forAll(faceCells, facei) + { + neiCellVolumes[bFaceI++] = cellVolumes[faceCells[facei]]; + } } else { - label master = pointRegionMaster_[region]; + // Normal boundary face: Just use owner cell volume to calculate + // the target face size + forAll(patch, patchFaceI) + { + const label extFaceI = patchFaceI + patch.start(); + const scalar cellOwnerVol = cellVolumes[cellOwner[extFaceI]]; + + targetFaceSizes[extFaceI] = Foam::pow(cellOwnerVol, 1.0/3.0); + } + } + } + + syncTools::swapBoundaryFaceList(mesh_, neiCellVolumes); + + forAll(patches, patchI) + { + const polyPatch& patch = patches[patchI]; - if (findIndex(f, 0, newFp, master) == -1) + label bFaceI = patch.start() - mesh_.nInternalFaces(); + + if (patch.coupled()) + { + forAll(patch, patchFaceI) { - f[newFp++] = master; + const label localFaceI = patchFaceI + patch.start(); + const scalar cellOwnerVol = cellVolumes[cellOwner[localFaceI]]; + const scalar cellNeighbourVol = neiCellVolumes[bFaceI++]; + + scalar targetFaceSizeA = Foam::pow(cellOwnerVol, 1.0/3.0); + scalar targetFaceSizeB = Foam::pow(cellNeighbourVol, 1.0/3.0); + + targetFaceSizes[localFaceI] + = 0.5*(targetFaceSizeA + targetFaceSizeB); } } } + // Returns a characteristic length, not an area + return targetFaceSizes; +} - // Check for pinched face. Tries to correct - // - consecutive duplicate vertex. Removes duplicate vertex. - // - duplicate vertex with one other vertex in between (spike). - // Both of these should not really occur! and should be checked before - // collapsing edges. - const label size = newFp; +Foam::edgeCollapser::collapseType Foam::edgeCollapser::collapseFace +( + const labelList& pointPriority, + const face& f, + const label faceI, + const scalar targetFaceSize, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation, + const scalarField& faceFilterFactor +) const +{ + const scalar collapseSizeLimitCoeff = faceFilterFactor[faceI]; - newFp = 2; + const pointField& pts = mesh_.points(); - for (label fp = 2; fp < size; fp++) + labelList facePts(f); + + const Foam::point fC = f.centre(pts); + + const scalar fA = f.mag(pts); + + vector collapseAxis = vector::zero; + scalar aspectRatio = 1.0; + + faceCollapseAxisAndAspectRatio(f, fC, collapseAxis, aspectRatio); + + // The signed distance along the collapse axis passing through the + // face centre that each vertex projects to. + + scalarField d(f.size()); + + forAll(f, fPtI) { - label fp1 = fp-1; - label fp2 = fp-2; + const Foam::point& pt = pts[f[fPtI]]; - label pointI = f[fp]; + d[fPtI] = (collapseAxis & (pt - fC)); + } - // Search for previous occurrence. - label index = findIndex(f, 0, fp, pointI); + // Sort the projected distances and the corresponding vertex + // indices along the collapse axis - if (index == fp1) + labelList oldToNew; + + sortedOrder(d, oldToNew); + + oldToNew = invert(oldToNew.size(), oldToNew); + + inplaceReorder(oldToNew, d); + + inplaceReorder(oldToNew, facePts); + + // Shift the points so that they are relative to the centre of the + // collapse line. + + scalar dShift = -0.5*(d.first() + d.last()); + + d += dShift; + + // Form two lists, one for each half of the set of points + // projected along the collapse axis. + + // Middle value, index of first entry in the second half + label middle = -1; + + forAll(d, dI) + { + if (d[dI] > 0) { - WarningIn - ( - "Foam::edgeCollapser::filterFace(const label faceI, " - "face& f) const" - ) << "Removing consecutive duplicate vertex in face " - << f << endl; - // Don't store current pointI + middle = dI; + + break; } - else if (index == fp2) + } + + if (middle == -1) + { +// SeriousErrorIn("collapseFace") +// << "middle == -1, " << f << " " << d +// << endl;//abort(FatalError); + + return noCollapse; + } + + // Negative half + SubList<scalar> dNeg(d, middle, 0); + SubList<label> facePtsNeg(facePts, middle, 0); + + // Positive half + SubList<scalar> dPos(d, d.size() - middle, middle); + SubList<label> facePtsPos(facePts, d.size() - middle, middle); + + // Defining how close to the midpoint (M) of the projected + // vertices line a projected vertex (X) can be before making this + // an invalid edge collapse + // + // X---X-g----------------M----X-----------g----X--X + // + // Only allow a collapse if all projected vertices are outwith + // guardFraction (g) of the distance form the face centre to the + // furthest vertex in the considered direction + + if (dNeg.size() == 0 || dPos.size() == 0) + { + WarningIn + ( + "Foam::conformalVoronoiMesh::collapseFace" + ) + << "All points on one side of face centre, not collapsing." + << endl; + } + +// Info<< "Face : " << f << nl +// << " Collapse Axis: " << collapseAxis << nl +// << " Aspect Ratio : " << aspectRatio << endl; + + collapseType typeOfCollapse = noCollapse; + + if (magSqr(collapseAxis) < VSMALL) + { + typeOfCollapse = toPoint; + } + else if (fA < aspectRatio*sqr(targetFaceSize*collapseSizeLimitCoeff)) + { + if + ( + allowEarlyCollapseToPoint_ + && (d.last() - d.first()) + < targetFaceSize + *allowEarlyCollapseCoeff_*maxCollapseFaceToPointSideLengthCoeff_ + ) { - WarningIn - ( - "Foam::edgeCollapser::filterFace(const label faceI, " - "face& f) const" - ) << "Removing non-consecutive duplicate vertex in face " - << f << endl; - // Don't store current pointI and remove previous - newFp--; + typeOfCollapse = toPoint; } - else if (index != -1) + else if + ( + (dNeg.last() < guardFraction_*dNeg.first()) + && (dPos.first() > guardFraction_*dPos.last()) + ) { - WarningIn - ( - "Foam::edgeCollapser::filterFace(const label faceI, " - "face& f) const" - ) << "Pinched face " << f << endl; - f[newFp++] = pointI; + typeOfCollapse = toEdge; } - else + else if + ( + (d.last() - d.first()) + < targetFaceSize + *maxCollapseFaceToPointSideLengthCoeff_ + ) { - f[newFp++] = pointI; + // If the face can't be collapsed to an edge, and it has a + // small enough span, collapse it to a point. + typeOfCollapse = toPoint; } } - f.setSize(newFp); + if (typeOfCollapse == toPoint) + { + collapseToPoint + ( + faceI, + pts, + pointPriority, + fC, + facePts, + collapseEdge, + collapsePointToLocation + ); + } + else if (typeOfCollapse == toEdge) + { + collapseToEdge + ( + faceI, + pts, + pointPriority, + collapseAxis, + fC, + facePtsNeg, + facePtsPos, + dNeg, + dPos, + dShift, + collapseEdge, + collapsePointToLocation + ); + } + + return typeOfCollapse; } -// Debugging. -void Foam::edgeCollapser::printRegions() const +Foam::label Foam::edgeCollapser::edgeMaster +( + const labelList& pointPriority, + const edge& e +) const { - forAll(pointRegionMaster_, regionI) + label masterPoint = -1; + + label e0 = e.start(); + label e1 = e.end(); + + // Collapse edge to point with higher priority. + if (pointPriority[e0] >= 0) + { + if (pointPriority[e1] >= 0) + { + // Both points have high priority. Choose one to collapse to. + // Note: should look at feature edges/points! + masterPoint = e0; + } + else + { + masterPoint = e0; + } + } + else { - label master = pointRegionMaster_[regionI]; + if (pointPriority[e1] >= 0) + { + masterPoint = e1; + } + else + { + // None on boundary. Neither is a master. + return -1; + } + } + + return masterPoint; +} + + +void Foam::edgeCollapser::checkBoundaryPointMergeEdges +( + const label pointI, + const label otherPointI, + const labelList& pointPriority, + Map<point>& collapsePointToLocation +) const +{ + const pointField& points = mesh_.points(); + + if + ( + pointPriority[pointI] == 0 + && pointPriority[otherPointI] < 0 + ) + { + collapsePointToLocation.set + ( + otherPointI, + points[pointI] + ); + } + else + { + collapsePointToLocation.set + ( + pointI, + points[otherPointI] + ); + } +} + + +Foam::label Foam::edgeCollapser::breakStringsAtEdges +( + const PackedBoolList& markedEdges, + PackedBoolList& collapseEdge, + List<pointEdgeCollapse>& allPointInfo +) const +{ + const edgeList& edges = mesh_.edges(); + const labelListList& pointEdges = mesh_.pointEdges(); - if (master != -1) + label nUncollapsed = 0; + + forAll(edges, eI) + { + if (markedEdges[eI]) { - Pout<< "Region:" << regionI << nl - << " master:" << master - << ' ' << pointRegionMasterLocation_[regionI] << nl; + const edge& e = edges[eI]; - forAll(pointRegion_, pointI) + const label startCollapseIndex + = allPointInfo[e.start()].collapseIndex(); + + if (startCollapseIndex != -1 && startCollapseIndex != -2) { - if (pointRegion_[pointI] == regionI && pointI != master) + const label endCollapseIndex + = allPointInfo[e.end()].collapseIndex(); + + if + ( + !collapseEdge[eI] + && startCollapseIndex == endCollapseIndex + ) { - Pout<< " slave:" << pointI - << ' ' << mesh_.points()[pointI] << nl; + const labelList& ptEdgesStart = pointEdges[e.start()]; + + forAll(ptEdgesStart, ptEdgeI) + { + const label edgeI = ptEdgesStart[ptEdgeI]; + + const label nbrPointI + = edges[edgeI].otherVertex(e.start()); + const label nbrIndex + = allPointInfo[nbrPointI].collapseIndex(); + + if + ( + collapseEdge[edgeI] + && nbrIndex == startCollapseIndex + ) + { + collapseEdge[edgeI] = false; + nUncollapsed++; + } + } } } } } -} + return nUncollapsed; +} -// Collapse list of edges -void Foam::edgeCollapser::collapseEdges(const labelList& edgeLabels) +void Foam::edgeCollapser::determineDuplicatePointsOnFace +( + const face& f, + PackedBoolList& markedPoints, + labelHashSet& uniqueCollapses, + labelHashSet& duplicateCollapses, + List<pointEdgeCollapse>& allPointInfo +) const { - const edgeList& edges = mesh_.edges(); + uniqueCollapses.clear(); + duplicateCollapses.clear(); - forAll(edgeLabels, i) + forAll(f, fpI) { - label edgeI = edgeLabels[i]; - const edge& e = edges[edgeI]; - - label region0 = pointRegion_[e[0]]; - label region1 = pointRegion_[e[1]]; + label index = allPointInfo[f[fpI]].collapseIndex(); - if (region0 == -1) + // Check for consecutive duplicate + if (index != allPointInfo[f.prevLabel(fpI)].collapseIndex()) { - if (region1 == -1) + if (!uniqueCollapses.insert(index)) { - // Both unaffected. Choose ad lib. - collapseEdge(edgeI, e[0]); - } - else - { - // Collapse to whatever e[1] collapses - collapseEdge(edgeI, e[1]); + // Failed inserting so duplicate + duplicateCollapses.insert(index); } } - else + } + + // Now duplicateCollapses contains duplicate collapse indices. + // Convert to points. + forAll(f, fpI) + { + label index = allPointInfo[f[fpI]].collapseIndex(); + if (duplicateCollapses.found(index)) { - if (region1 == -1) - { - // Collapse to whatever e[0] collapses - collapseEdge(edgeI, e[0]); - } - else - { - // Both collapsed. - if (pointRegionMaster_[region0] == e[0]) - { - // e[0] is a master - collapseEdge(edgeI, e[0]); - } - else if (pointRegionMaster_[region1] == e[1]) - { - // e[1] is a master - collapseEdge(edgeI, e[1]); - } - else - { - // Dont know - collapseEdge(edgeI, e[0]); - } - } + markedPoints[f[fpI]] = true; } } } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::label Foam::edgeCollapser::countEdgesOnFace +( + const face& f, + List<pointEdgeCollapse>& allPointInfo +) const +{ + label nEdges = 0; -// Construct from mesh -Foam::edgeCollapser::edgeCollapser(const polyMesh& mesh) -: - mesh_(mesh), - pointRegion_(mesh.nPoints(), -1), - pointRegionMasterLocation_(mesh.nPoints() / 100), - pointRegionMaster_(mesh.nPoints() / 100), - freeRegions_() -{} + forAll(f, fpI) + { + const label pointI = f[fpI]; + const label newPointI = allPointInfo[pointI].collapseIndex(); + if (newPointI == -2) + { + nEdges++; + } + else + { + const label prevPointI = f[f.fcIndex(fpI)]; + const label prevNewPointI + = allPointInfo[prevPointI].collapseIndex(); + + if (newPointI != prevNewPointI) + { + nEdges++; + } + } + } + + return nEdges; +} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::edgeCollapser::unaffectedEdge(const label edgeI) const +bool Foam::edgeCollapser::isFaceCollapsed +( + const face& f, + List<pointEdgeCollapse>& allPointInfo +) const { - const edge& e = mesh_.edges()[edgeI]; + label nEdges = countEdgesOnFace(f, allPointInfo); + + // Polygons must have 3 or more edges to be valid + if (nEdges < 3) + { + return true; + } - return (pointRegion_[e[0]] == -1) && (pointRegion_[e[1]] == -1); + return false; } -bool Foam::edgeCollapser::collapseEdge(const label edgeI, const label master) +// Create consistent set of collapses. +// collapseEdge : per edge: +// -1 : do not collapse +// 0 : collapse to start +// 1 : collapse to end +// Note: collapseEdge has to be parallel consistent (in orientation) +Foam::label Foam::edgeCollapser::syncCollapse +( + const globalIndex& globalPoints, + const labelList& pointPriority, + const PackedBoolList& collapseEdge, + const Map<point>& collapsePointToLocation, + List<pointEdgeCollapse>& allPointInfo +) const { - const pointField& points = mesh_.points(); + const edgeList& edges = mesh_.edges(); - const edge& e = mesh_.edges()[edgeI]; + label nCollapsed = 0; - label pointRegion0 = pointRegion_[e[0]]; - label pointRegion1 = pointRegion_[e[1]]; + DynamicList<label> initPoints(mesh_.nPoints()); + DynamicList<pointEdgeCollapse> initPointInfo(mesh_.nPoints()); + + allPointInfo.clear(); + allPointInfo.setSize(mesh_.nPoints()); + + // Initialise edges to no collapse + List<pointEdgeCollapse> allEdgeInfo + ( + mesh_.nEdges(), + pointEdgeCollapse(vector::zero, -1, -1) + ); - if (pointRegion0 == -1) + // Mark selected edges for collapse + forAll(edges, edgeI) { - if (pointRegion1 == -1) + if (collapseEdge[edgeI]) { - // Both endpoints not collapsed. Create new region. + const edge& e = edges[edgeI]; - label freeRegion = -1; + label masterPointI = e.start(); - if (freeRegions_.size()) + // Choose the point on the edge with the highest priority. + if (pointPriority[e.end()] > pointPriority[e.start()]) { - freeRegion = freeRegions_.removeHead(); + masterPointI = e.end(); + } + + label masterPointPriority = pointPriority[masterPointI]; + + label index = globalPoints.toGlobal(masterPointI); + + if (!collapsePointToLocation.found(masterPointI)) + { + const label otherVertex = e.otherVertex(masterPointI); - if (pointRegionMaster_[freeRegion] != -1) + if (!collapsePointToLocation.found(otherVertex)) { FatalErrorIn - ("edgeCollapser::collapseEdge(const label, const label)") - << "Problem : freed region :" << freeRegion - << " has already master " - << pointRegionMaster_[freeRegion] + ( + "syncCollapse\n" + "(\n" + " const polyMesh&,\n" + " const globalIndex&,\n" + " const labelList&,\n" + " const PackedBoolList&,\n" + " Map<point>&,\n" + " List<pointEdgeCollapse>&\n" + ")\n" + ) << masterPointI << " on edge " << edgeI << " " << e + << " is not marked for collapse." << abort(FatalError); } - } - else - { - // If no region found create one. This is the only place where - // new regions are created. - freeRegion = pointRegionMaster_.size(); + else + { + masterPointI = otherVertex; + masterPointPriority = pointPriority[masterPointI]; + index = globalPoints.toGlobal(masterPointI); + } } - pointRegion_[e[0]] = freeRegion; - pointRegion_[e[1]] = freeRegion; + const point& collapsePoint = collapsePointToLocation[masterPointI]; + + const pointEdgeCollapse pec + ( + collapsePoint, + index, + masterPointPriority + ); - pointRegionMaster_(freeRegion) = master; - pointRegionMasterLocation_(freeRegion) = points[master]; + // Mark as collapsable but with nonsense master so it gets + // overwritten and starts an update wave + allEdgeInfo[edgeI] = pointEdgeCollapse + ( + collapsePoint, + labelMax, + labelMin + ); + + initPointInfo.append(pec); + initPoints.append(e.start()); + + initPointInfo.append(pec); + initPoints.append(e.end()); + + nCollapsed++; } - else + } + + PointEdgeWave<pointEdgeCollapse> collapsePropagator + ( + mesh_, + initPoints, + initPointInfo, + allPointInfo, + allEdgeInfo, + mesh_.globalData().nTotalPoints() // Maximum number of iterations + ); + + return nCollapsed; +} + + +void Foam::edgeCollapser::filterFace +( + const Map<DynamicList<label> >& collapseStrings, + const List<pointEdgeCollapse>& allPointInfo, + face& f +) const +{ + label newFp = 0; + + face oldFace = f; + + forAll(f, fp) + { + label pointI = f[fp]; + + label collapseIndex = allPointInfo[pointI].collapseIndex(); + + // Do we have a local point for this index? + if (collapseStrings.found(collapseIndex)) { - // e[1] is part of collapse network, e[0] not. Add e0 to e1 region. - pointRegion_[e[0]] = pointRegion1; + label localPointI = collapseStrings[collapseIndex][0]; - if - ( - pointRegionMaster_[pointRegion1] == e[0] - || pointRegionMaster_[pointRegion1] == e[1] - ) + if (findIndex(SubList<label>(f, newFp), localPointI) == -1) { - pointRegionMaster_[pointRegion1] = master; - pointRegionMasterLocation_[pointRegion1] = points[master]; + f[newFp++] = localPointI; } } + else if (collapseIndex == -1) + { + WarningIn + ( + "filterFace" + "(const label, const Map<DynamicList<label> >&, face&)" + ) << "Point " << pointI << " was not visited by PointEdgeWave" + << endl; + } + else + { + f[newFp++] = pointI; + } } - else + + + // Check for pinched face. Tries to correct + // - consecutive duplicate vertex. Removes duplicate vertex. + // - duplicate vertex with one other vertex in between (spike). + // Both of these should not really occur! and should be checked before + // collapsing edges. + + const label size = newFp; + + newFp = 2; + + for (label fp = 2; fp < size; fp++) { - if (pointRegion1 == -1) - { - // e[0] is part of collapse network. Add e1 to e0 region - pointRegion_[e[1]] = pointRegion0; + label fp1 = fp-1; + label fp2 = fp-2; + + label pointI = f[fp]; + + // Search for previous occurrence. + label index = findIndex(SubList<label>(f, fp), pointI); - if + if (index == fp1) + { + WarningIn ( - pointRegionMaster_[pointRegion0] == e[0] - || pointRegionMaster_[pointRegion0] == e[1] - ) - { - pointRegionMaster_[pointRegion0] = master; - pointRegionMasterLocation_[pointRegion0] = points[master]; - } + "Foam::edgeCollapser::filterFace(const label faceI, " + "face& f) const" + ) << "Removing consecutive duplicate vertex in face " + << f << endl; + // Don't store current pointI + } + else if (index == fp2) + { + WarningIn + ( + "Foam::edgeCollapser::filterFace(const label faceI, " + "face& f) const" + ) << "Removing non-consecutive duplicate vertex in face " + << f << endl; + // Don't store current pointI and remove previous + newFp--; } - else if (pointRegion0 != pointRegion1) + else if (index != -1) { - // Both part of collapse network. Merge the two regions. + WarningIn + ( + "Foam::edgeCollapser::filterFace(const label faceI, " + "face& f) const" + ) << "Pinched face " << f << endl; + f[newFp++] = pointI; + } + else + { + f[newFp++] = pointI; + } + } - // Use the smaller region number for the whole network. - label minRegion = min(pointRegion0, pointRegion1); - label maxRegion = max(pointRegion0, pointRegion1); + f.setSize(newFp); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - // Use minRegion as region for combined net, free maxRegion. - pointRegionMaster_[minRegion] = master; - pointRegionMaster_[maxRegion] = -1; - pointRegionMasterLocation_[minRegion] = points[master]; - pointRegionMasterLocation_[maxRegion] = point(0, 0, 0); +Foam::edgeCollapser::edgeCollapser(const polyMesh& mesh) +: + mesh_(mesh), + guardFraction_(0), + maxCollapseFaceToPointSideLengthCoeff_(0), + allowEarlyCollapseToPoint_(false), + allowEarlyCollapseCoeff_(0) +{} - freeRegions_.insert(maxRegion); - if (minRegion != pointRegion0) - { - changePointRegion(e[0], pointRegion0, minRegion); - } - if (minRegion != pointRegion1) - { - changePointRegion(e[1], pointRegion1, minRegion); - } - } - } +Foam::edgeCollapser::edgeCollapser +( + const polyMesh& mesh, + const dictionary& dict +) +: + mesh_(mesh), + guardFraction_(readScalar(dict.lookup("guardFraction"))), + maxCollapseFaceToPointSideLengthCoeff_ + ( + readScalar(dict.lookup("maxCollapseFaceToPointSideLengthCoeff")) + ), + allowEarlyCollapseToPoint_ + ( + dict.lookupOrDefault<Switch>("allowEarlyCollapseToPoint", true) + ), + allowEarlyCollapseCoeff_ + ( + readScalar(dict.lookup("allowEarlyCollapseCoeff")) + ) +{} - return true; -} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) +bool Foam::edgeCollapser::setRefinement +( + const List<pointEdgeCollapse>& allPointInfo, + polyTopoChange& meshMod +) const { const cellList& cells = mesh_.cells(); const labelList& faceOwner = mesh_.faceOwner(); const labelList& faceNeighbour = mesh_.faceNeighbour(); const labelListList& pointFaces = mesh_.pointFaces(); - const labelListList& cellEdges = mesh_.cellEdges(); const pointZoneMesh& pointZones = mesh_.pointZones(); - - bool meshChanged = false; - // Synchronise pointRegionMasterLocation_ - const globalMeshData& globalData = mesh_.globalData(); - const mapDistribute& map = globalData.globalPointSlavesMap(); - const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch(); - const labelList& meshPoints = coupledPatch.meshPoints(); - const Map<label>& meshPointMap = coupledPatch.meshPointMap(); - + PackedBoolList removedPoints(mesh_.nPoints()); - List<point> newPoints = coupledPatch.localPoints(); - - for (label pI = 0; pI < coupledPatch.nPoints(); ++pI) + // Create strings of edges. + // Map from collapseIndex(=global master point) to set of points + Map<DynamicList<label> > collapseStrings; { - const label pointRegionMaster = pointRegion_[meshPoints[pI]]; - - if (pointRegionMaster != -1) + // 1. Count elements per collapseIndex + Map<label> nPerIndex(mesh_.nPoints()/10); + forAll(allPointInfo, pointI) { - newPoints[pI] - = pointRegionMasterLocation_[pointRegionMaster]; - } - } + label collapseIndex = allPointInfo[pointI].collapseIndex(); - globalData.syncData - ( - newPoints, - globalData.globalPointSlaves(), - globalData.globalPointTransformedSlaves(), - map, - minMagSqrEqOp<point>() - ); - - OFstream str1("newPoints_" + name(Pstream::myProcNo()) + ".obj"); - forAll(pointRegion_, pI) - { - if (meshPointMap.found(pI)) + if (collapseIndex != -1 && collapseIndex != -2) { - meshTools::writeOBJ(str1, newPoints[meshPointMap[pI]]); + Map<label>::iterator fnd = nPerIndex.find(collapseIndex); + if (fnd != nPerIndex.end()) + { + fnd()++; + } + else + { + nPerIndex.insert(collapseIndex, 1); + } } } - for (label pI = 0; pI < coupledPatch.nPoints(); ++pI) - { - const label pointRegionMaster = pointRegion_[meshPoints[pI]]; + // 2. Size + collapseStrings.resize(2*nPerIndex.size()); + forAllConstIter(Map<label>, nPerIndex, iter) + { + collapseStrings.insert(iter.key(), DynamicList<label>(iter())); + } - if (pointRegionMaster != -1) + // 3. Fill + forAll(allPointInfo, pointI) { - pointRegionMasterLocation_[pointRegionMaster] - = newPoints[pI]; + const label collapseIndex = allPointInfo[pointI].collapseIndex(); + + if (collapseIndex != -1 && collapseIndex != -2) + { + collapseStrings[collapseIndex].append(pointI); + } } } @@ -470,12 +1307,49 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) // Current cellCollapse status boolList cellRemoved(mesh_.nCells(), false); + label nUnvisited = 0; + label nUncollapsed = 0; + label nCollapsed = 0; + + forAll(allPointInfo, pI) + { + const pointEdgeCollapse& pec = allPointInfo[pI]; + + if (pec.collapseIndex() == -1) + { + nUnvisited++; + } + else if (pec.collapseIndex() == -2) + { + nUncollapsed++; + } + else + { + nCollapsed++; + } + } + + label nPoints = allPointInfo.size(); + + reduce(nPoints, sumOp<label>()); + reduce(nUnvisited, sumOp<label>()); + reduce(nUncollapsed, sumOp<label>()); + reduce(nCollapsed, sumOp<label>()); + + Info<< incrIndent; + Info<< indent << "Number of points : " << nPoints << nl + << indent << "Not visited : " << nUnvisited << nl + << indent << "Not collapsed : " << nUncollapsed << nl + << indent << "Collapsed : " << nCollapsed << nl + << endl; + Info<< decrIndent; + do { // Update face collapse from edge collapses forAll(newFaces, faceI) { - filterFace(faceI, newFaces[faceI]); + filterFace(collapseStrings, allPointInfo, newFaces[faceI]); } // Check if faces to be collapsed cause cells to become collapsed. @@ -504,6 +1378,8 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) << " of which too many are marked for removal:" << endl << " "; + + forAll(cFaces, j) { if (newFaces[cFaces[j]].size() < 3) @@ -516,7 +1392,7 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) cellRemoved[cellI] = true; // Collapse all edges of cell to nothing - collapseEdges(cellEdges[cellI]); +// collapseEdges(cellEdges[cellI]); nCellCollapsed++; @@ -527,10 +1403,14 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) } } + reduce(nCellCollapsed, sumOp<label>()); + Info<< indent << "Collapsing " << nCellCollapsed << " cells" << endl; + if (nCellCollapsed == 0) { break; } + } while (true); @@ -541,7 +1421,6 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) // Mark points used. boolList usedPoint(mesh_.nPoints(), false); - forAll(cellRemoved, cellI) { if (cellRemoved[cellI]) @@ -550,7 +1429,6 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) } } - // Remove faces forAll(newFaces, faceI) { @@ -577,55 +1455,28 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) // Remove unused vertices that have not been marked for removal already forAll(usedPoint, pointI) { - if (!usedPoint[pointI] && !pointRemoved(pointI)) + if (!usedPoint[pointI]) { + removedPoints[pointI] = true; meshMod.removePoint(pointI, -1); meshChanged = true; } } } - - - // Remove points. - forAll(pointRegion_, pointI) - { - if (pointRemoved(pointI)) - { - meshMod.removePoint(pointI, -1); - meshChanged = true; - } - } - // Modify the point location of the remaining points - forAll(pointRegion_, pointI) + forAll(allPointInfo, pointI) { - const label pointRegion = pointRegion_[pointI]; + const label collapseIndex = allPointInfo[pointI].collapseIndex(); + const point& collapsePoint = allPointInfo[pointI].collapsePoint(); if ( - !pointRemoved(pointI) - && meshPointMap.found(pointI) - ) - { - meshMod.modifyPoint - ( - pointI, - newPoints[meshPointMap[pointI]], - pointZones.whichZone(pointI), - false - ); - } - else if - ( - pointRegion != -1 - && !pointRemoved(pointI) - && !meshPointMap.found(pointI) + removedPoints[pointI] == false + && collapseIndex != -1 + && collapseIndex != -2 ) { - const point& collapsePoint - = pointRegionMasterLocation_[pointRegion]; - meshMod.modifyPoint ( pointI, @@ -641,9 +1492,9 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) const faceZoneMesh& faceZones = mesh_.faceZones(); // Renumber faces that use points - forAll(pointRegion_, pointI) + forAll(allPointInfo, pointI) { - if (pointRemoved(pointI)) + if (removedPoints[pointI] == true) { const labelList& changedFaces = pointFaces[pointI]; @@ -692,28 +1543,451 @@ bool Foam::edgeCollapser::setRefinement(polyTopoChange& meshMod) zoneID, zoneFlip ); + meshChanged = true; } } } } - // Print regions: -// printRegions(); - return meshChanged; } -void Foam::edgeCollapser::updateMesh(const mapPolyMesh& map) +void Foam::edgeCollapser::consistentCollapse +( + const globalIndex& globalPoints, + const labelList& pointPriority, + const Map<point>& collapsePointToLocation, + PackedBoolList& collapseEdge, + List<pointEdgeCollapse>& allPointInfo, + const bool allowCellCollapse +) const +{ + // Make sure we don't collapse cells + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const faceList faces = mesh_.faces(); + const edgeList& edges = mesh_.edges(); + const labelListList& faceEdges = mesh_.faceEdges(); + const labelListList& pointEdges = mesh_.pointEdges(); + const cellList& cells = mesh_.cells(); + + labelHashSet uniqueCollapses; + labelHashSet duplicateCollapses; + + while (true) + { + label nUncollapsed = 0; + + syncTools::syncEdgeList + ( + mesh_, + collapseEdge, + minEqOp<unsigned int>(), + 0 + ); + + // Create consistent set of collapses + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Note: requires collapseEdge to be synchronised. + syncCollapse + ( + globalPoints, + pointPriority, + collapseEdge, + collapsePointToLocation, + allPointInfo + ); + + // Get collapsed faces + + PackedBoolList isCollapsedFace(mesh_.nFaces()); + PackedBoolList markedPoints(mesh_.nPoints()); + + forAll(faces, faceI) + { + const face& f = faces[faceI]; + + isCollapsedFace[faceI] = isFaceCollapsed(f, allPointInfo); + + if (isCollapsedFace[faceI] < 1) + { + determineDuplicatePointsOnFace + ( + f, + markedPoints, + uniqueCollapses, + duplicateCollapses, + allPointInfo + ); + } + } + + // Synchronise the marked points + syncTools::syncPointList + ( + mesh_, + markedPoints, + orEqOp<unsigned int>(), + 0 + ); + + // Mark all edges attached to the point for collapse + forAll(markedPoints, pointI) + { + if (markedPoints[pointI]) + { + const label index = allPointInfo[pointI].collapseIndex(); + + const labelList& ptEdges = pointEdges[pointI]; + + forAll(ptEdges, ptEdgeI) + { + const label edgeI = ptEdges[ptEdgeI]; + const label nbrPointI = edges[edgeI].otherVertex(pointI); + const label nbrIndex + = allPointInfo[nbrPointI].collapseIndex(); + + if (collapseEdge[edgeI] && nbrIndex == index) + { + collapseEdge[edgeI] = false; + nUncollapsed++; + } + } + } + } + + PackedBoolList markedEdges(mesh_.nEdges()); + + if (!allowCellCollapse) + { + // Check collapsed cells + forAll(cells, cellI) + { + const cell& cFaces = cells[cellI]; + + label nFaces = cFaces.size(); + + forAll(cFaces, fI) + { + label faceI = cFaces[fI]; + + if (isCollapsedFace[faceI]) + { + nFaces--; + } + } + + if (nFaces < 4) + { + forAll(cFaces, fI) + { + label faceI = cFaces[fI]; + + const labelList& fEdges = faceEdges[faceI]; + + // Unmark this face for collapse + forAll(fEdges, fEdgeI) + { + label edgeI = fEdges[fEdgeI]; + + if (collapseEdge[edgeI]) + { + collapseEdge[edgeI] = false; + nUncollapsed++; + } + + markedEdges[edgeI] = true; + } + + // Uncollapsed this face. + isCollapsedFace[faceI] = false; + nFaces++; + } + } + + if (nFaces < 4) + { + FatalErrorIn + ( + "consistentCollapse\n" + "(\n" + " labelList&,\n" + " Map<point>&,\n" + " bool&,\n" + ")" + ) << "Cell " << cellI << " " << cFaces << nl + << "is " << nFaces << ", " + << "but cell collapse has been disabled." + << abort(FatalError); + } + } + } + + syncTools::syncEdgeList + ( + mesh_, + markedEdges, + orEqOp<unsigned int>(), + 0 + ); + + nUncollapsed += breakStringsAtEdges + ( + markedEdges, + collapseEdge, + allPointInfo + ); + + reduce(nUncollapsed, sumOp<label>()); + + Info<< " Uncollapsed edges = " << nUncollapsed << " / " + << returnReduce(mesh_.nEdges(), sumOp<label>()) << endl; + + if (nUncollapsed == 0) + { + break; + } + } +} + + +Foam::label Foam::edgeCollapser::markSmallEdges +( + const scalarField& minEdgeLen, + const labelList& pointPriority, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation +) const +{ + // Work out which edges to collapse + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + const pointField& points = mesh_.points(); + const edgeList& edges = mesh_.edges(); + + label nCollapsed = 0; + + forAll(edges, edgeI) + { + const edge& e = edges[edgeI]; + + if (!collapseEdge[edgeI]) + { + if (e.mag(points) < minEdgeLen[edgeI]) + { + collapseEdge[edgeI] = true; + + label masterPointI = edgeMaster(pointPriority, e); + + if (masterPointI == -1) + { + const point average + = 0.5*(points[e.start()] + points[e.end()]); + + collapsePointToLocation.set(e.start(), average); + } + else + { + const point& collapsePt = points[masterPointI]; + + collapsePointToLocation.set(masterPointI, collapsePt); + } + + + nCollapsed++; + } + } + } + + return nCollapsed; +} + + +Foam::label Foam::edgeCollapser::markMergeEdges +( + const scalar maxCos, + const labelList& pointPriority, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation +) const +{ + const edgeList& edges = mesh_.edges(); + const pointField& points = mesh_.points(); + const labelListList& pointEdges = mesh_.pointEdges(); + + // Point removal engine + removePoints pointRemover(mesh_, false); + + // Find out points that can be deleted + boolList pointCanBeDeleted; + label nTotRemove = pointRemover.countPointUsage(maxCos, pointCanBeDeleted); + + // Rework point-to-remove into edge-to-collapse. + + label nCollapsed = 0; + + if (nTotRemove > 0) + { + forAll(pointEdges, pointI) + { + if (pointCanBeDeleted[pointI]) + { + const labelList& pEdges = pointEdges[pointI]; + + if (pEdges.size() == 2) + { + // Always the case? + + label e0 = pEdges[0]; + label e1 = pEdges[1]; + + if (!collapseEdge[e0] && !collapseEdge[e1]) + { + // Get lengths of both edges and choose the smallest + scalar e0length = mag + ( + points[edges[e0][0]] - points[edges[e0][1]] + ); + + scalar e1length = mag + ( + points[edges[e1][0]] - points[edges[e1][1]] + ); + + if (e0length <= e1length) + { + if (edges[e0].start() == pointI) + { + collapseEdge[e0] = true; + + checkBoundaryPointMergeEdges + ( + pointI, + edges[e0].end(), + pointPriority, + collapsePointToLocation + ); + } + else + { + collapseEdge[e0] = true; + + checkBoundaryPointMergeEdges + ( + pointI, + edges[e0].start(), + pointPriority, + collapsePointToLocation + ); + } + } + else + { + if (edges[e1].start() == pointI) + { + collapseEdge[e1] = true; + + checkBoundaryPointMergeEdges + ( + pointI, + edges[e1].end(), + pointPriority, + collapsePointToLocation + ); + } + else + { + collapseEdge[e1] = true; + + checkBoundaryPointMergeEdges + ( + pointI, + edges[e1].start(), + pointPriority, + collapsePointToLocation + ); + } + } + +// if (boundaryPoint[leftV] == -1) +// { +// collapseEdge[e0] = findIndex(edges[e0], leftV); +// } +// else +// { +// collapseEdge[e1] = findIndex(edges[e1], rightV); +// } + + nCollapsed++; + } + } + } + } + } + + return nCollapsed; +} + + +Foam::labelPair Foam::edgeCollapser::markSmallSliverFaces +( + const scalarField& faceFilterFactor, + const labelList& pointPriority, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation +) const { - pointRegion_.setSize(mesh_.nPoints()); - pointRegion_ = -1; + const faceList& faces = mesh_.faces(); + + const scalarField targetFaceSizes = calcTargetFaceSizes(); + + // Calculate number of faces that will be collapsed to a point or an edge + label nCollapseToPoint = 0; + label nCollapseToEdge = 0; + + forAll(faces, fI) + { + const face& f = faces[fI]; + + if (faceFilterFactor[fI] == 0) + { + continue; + } + + collapseType flagCollapseFace = collapseFace + ( + pointPriority, + f, + fI, + targetFaceSizes[fI], + collapseEdge, + collapsePointToLocation, + faceFilterFactor + ); + + if (flagCollapseFace == noCollapse) + { + continue; + } + else if (flagCollapseFace == toPoint) + { + nCollapseToPoint++; + } + else if (flagCollapseFace == toEdge) + { + nCollapseToEdge++; + } + else + { + FatalErrorIn("collapseFaces(const polyMesh&, List<labelPair>&)") + << "Face is marked to be collapsed to " << flagCollapseFace + << ". Currently can only collapse to point/edge." + << abort(FatalError); + } + } - // Reset count, do not remove underlying storage - pointRegionMaster_.clear(); - pointRegionMasterLocation_.clear(); - freeRegions_.clear(); + return labelPair(nCollapseToPoint, nCollapseToEdge); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H index 3a10a9319749081af5960967cb6eaf09ec3e17d4..946ee2a72c7126442737ed226465d4700b37a474 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.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) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,10 +37,15 @@ SourceFiles #ifndef edgeCollapser_H #define edgeCollapser_H -#include "labelList.H" +#include "pointEdgeCollapse.H" #include "DynamicList.H" -#include "point.H" +#include "Field.H" +#include "pointFieldFwd.H" +#include "Map.H" +#include "labelPair.H" +#include "HashSet.H" #include "typeInfo.H" +#include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,9 +54,11 @@ namespace Foam // Forward declaration of classes class polyMesh; +class PackedBoolList; class polyTopoChange; +class globalIndex; class face; -class mapPolyMesh; +class edge; /*---------------------------------------------------------------------------*\ Class edgeCollapser Declaration @@ -59,59 +66,169 @@ class mapPolyMesh; class edgeCollapser { +public: + + // The type of collapse of a face + enum collapseType + { + noCollapse = 0, + toPoint = 1, + toEdge = 2 + }; + + +private: + // Private data //- Reference to mesh const polyMesh& mesh_; - //- For every point -1 or region number - labelList pointRegion_; + const scalar guardFraction_; - //- Actual location of the point to collapse to for every region master - // point. This will be forced to be consistent across processors - DynamicList<point> pointRegionMasterLocation_; + const scalar maxCollapseFaceToPointSideLengthCoeff_; - //- -1 or master vertex for region number - DynamicList<label> pointRegionMaster_; + const Switch allowEarlyCollapseToPoint_; - //- Stack of free region numbers. Corresponds to -1 in pointRegionMaster - SLList<label> freeRegions_; + const scalar allowEarlyCollapseCoeff_; - // Static Functions + // Private Member Functions - //- Find val in list. Search starts at start, continues to size-1. - static label findIndex + //- Create an edgeList of edges in faceI which have both their points + // in pointLabels + labelList edgesFromPoints ( - const labelList&, - const label start, - const label size, - const label val - ); + const label& faceI, + const labelList& pointLabels + ) const; - - // Private Member Functions - - //- Determine points connected through edgesToRemove_. - // Note: Only routine that uses edgesToRemove! - label changePointRegion + //- Collapse a face to an edge, marking the collapsed edges and new + // locations for points that will move as a result of the collapse + void collapseToEdge + ( + const label faceI, + const pointField& pts, + const labelList& pointPriority, + const vector& collapseAxis, + const point& fC, + const labelList& facePtsNeg, + const labelList& facePtsPos, + const scalarList& dNeg, + const scalarList& dPos, + const scalar dShift, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation + ) const; + + //- Collapse a face to a point, marking the collapsed edges and new + // locations for points that will move as a result of the collapse + void collapseToPoint + ( + const label& faceI, + const pointField& pts, + const labelList& pointPriority, + const point& fC, + const labelList& facePts, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation + ) const; + + //- Do an eigenvector analysis of the face to get its collapse axis + // and aspect ratio + void faceCollapseAxisAndAspectRatio + ( + const face& f, + const point& fC, + vector& collapseAxis, + scalar& aspectRatio + ) const; + + //- Return the target length scale for each face + scalarField calcTargetFaceSizes() const; + + //- Decides whether a face should be collapsed (and if so it it is to a + // point or an edge) + collapseType collapseFace + ( + const labelList& pointPriority, + const face& f, + const label faceI, + const scalar targetFaceSize, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation, + const scalarField& faceFilterFactor + ) const; + + //- Return label of point that has the highest priority. This will be + // the point on the edge that will be collapsed to. + label edgeMaster(const labelList& pointPriority, const edge& e) const; + + //- Decides which points in an edge to collapse, based on their priority + void checkBoundaryPointMergeEdges ( const label pointI, - const label oldRegion, - const label newRegion - ); - - //- Whether point is master of region or has been removed - bool pointRemoved(const label) const; - - //- Renumber f with new vertices. Removes duplicates. - void filterFace(const label faceI, face&) const; + const label otherPointI, + const labelList& pointPriority, + Map<point>& collapsePointToLocation + ) const; + + //- Helper function that breaks strings of collapses if an edge is not + // labelled to collapse, but its points both collapse to the same + // location + label breakStringsAtEdges + ( + const PackedBoolList& markedEdges, + PackedBoolList& collapseEdge, + List<pointEdgeCollapse>& allPointInfo + ) const; + + //- Prevent face pinching by finding points in a face that will be + // collapsed to the same location, but that are not ordered + // consecutively in the face + void determineDuplicatePointsOnFace + ( + const face& f, + PackedBoolList& markedPoints, + labelHashSet& uniqueCollapses, + labelHashSet& duplicateCollapses, + List<pointEdgeCollapse>& allPointInfo + ) const; + + //- Count the number of edges on the face that will exist as a result + // of the collapse + label countEdgesOnFace + ( + const face& f, + List<pointEdgeCollapse>& allPointInfo + ) const; - //- Some debugging printing - void printRegions() const; + //- Does the face have fewer than 3 edges as a result of the potential + // collapse + bool isFaceCollapsed + ( + const face& f, + List<pointEdgeCollapse>& allPointInfo + ) const; - //- Collapse list of edges. Tries to find master to collapse to. - void collapseEdges(const labelList& edgeLabels); + //- Given the collapse information, propagates the information using + // PointEdgeWave. Result is a list of new point locations and indices + label syncCollapse + ( + const globalIndex& globalPoints, + const labelList& boundaryPoint, + const PackedBoolList& collapseEdge, + const Map<point>& collapsePointToLocation, + List<pointEdgeCollapse>& allPointInfo + ) const; + + //- Renumber f with new vertices. Removes consecutive duplicates + void filterFace + ( + const Map<DynamicList<label> >& collapseStrings, + const List<pointEdgeCollapse>& allPointInfo, + face& f + ) const; //- Disallow default bitwise copy construct edgeCollapser(const edgeCollapser&); @@ -128,43 +245,92 @@ public: // Constructors - //- Construct from mesh. + //- Construct from mesh edgeCollapser(const polyMesh& mesh); + //- Construct from mesh and dict + edgeCollapser(const polyMesh& mesh, const dictionary& dict); - // Member Functions - - // Access - //- For every point the region it belongs to or -1. - const labelList& pointRegion() const - { - return pointRegion_; - } - - //- For every region the master (i.e. the point the region will - // be replaced by) - const DynamicList<label>& pointRegionMaster() const - { - return pointRegionMaster_; - } - - //- Check that edge is not marked for anything - bool unaffectedEdge(const label edgeI) const; - - - // Edit - - //- Set edge to collapse and point to collapse it to. - // Return true if collapse is valid. - // (always true at the moment) - bool collapseEdge(const label edgeI, const label master); - - //- Play commands into polyTopoChange to create mesh. Return true - // if anything changed. - bool setRefinement(polyTopoChange&); + // Member Functions - void updateMesh(const mapPolyMesh&); + // Check + + //- Find the longest edge in a face + static label longestEdge(const face& f, const pointField& pts); + + //- Calls motionSmoother::checkMesh and returns a set of bad faces + static HashSet<label> checkBadFaces + ( + const polyMesh& mesh, + const dictionary& meshQualityDict + ); + + // Check mesh and mark points on faces in error + // Returns boolList with points in error set + static label checkMeshQuality + ( + const polyMesh& mesh, + const dictionary& meshQualityDict, + PackedBoolList& isErrorPoint + ); + + //- Ensure that the collapse is parallel consistent and update + // allPointInfo. + // Returns a list of edge collapses that is consistent across + // coupled boundaries and a list of pointEdgeCollapses. + void consistentCollapse + ( + const globalIndex& globalPoints, + const labelList& pointPriority, + const Map<point>& collapsePointToLocation, + PackedBoolList& collapseEdge, + List<pointEdgeCollapse>& allPointInfo, + const bool allowCellCollapse = false + ) const; + + + // Query + + //- Play commands into polyTopoChange to create mesh. + // Return true if anything changed. + bool setRefinement + ( + const List<pointEdgeCollapse>& allPointInfo, + polyTopoChange& meshMod + ) const; + + // Mark (in collapseEdge) any edges to collapse + label markSmallEdges + ( + const scalarField& minEdgeLen, + const labelList& pointPriority, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation + ) const; + + // Mark (in collapseEdge) any edges to merge + label markMergeEdges + ( + const scalar maxCos, + const labelList& pointPriority, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation + ) const; + + //- Find small faces and sliver faces in the mesh and mark the + // edges that need to be collapsed in order to remove these faces. + // Also returns a map of new locations for points that will move + // as a result of the collapse. + // Use in conjuctions with edgeCollapser to synchronise the + // collapses and modify the mesh + labelPair markSmallSliverFaces + ( + const scalarField& faceFilterFactor, + const labelList& pointPriority, + PackedBoolList& collapseEdge, + Map<point>& collapsePointToLocation + ) const; }; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C index 7dbce8d7bdab0b7de73d78dc8c435a5db6d11e88..5a4deaa8ac0acf7c5465591a5a55d7d56da165fa 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.C @@ -1022,7 +1022,7 @@ Foam::label Foam::hexRef8::storeMidPointInfo } // Check if this call of storeMidPointInfo is the one that completed all - // the nessecary information. + // the necessary information. if (changed && haveTwoAnchors && haveTwoFaceMids) { diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H index 31e2a5587dda72626ce01d96ffaa7e1de70d6a78..f33ee706f9d4582f6e78c8b0cb4435943ecc08e3 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8.H @@ -114,7 +114,7 @@ class hexRef8 label& zoneFlip ) const; - //- Adds a face on top of existing faceI. Reverses if nessecary. + //- Adds a face on top of existing faceI. Reverses if necessary. label addFace ( polyTopoChange& meshMod, @@ -136,7 +136,7 @@ class hexRef8 ) const; //- Modifies existing faceI for either new owner/neighbour or new face - // points. Reverses if nessecary. + // points. Reverses if necessary. void modFace ( polyTopoChange& meshMod, diff --git a/applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapse.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C similarity index 88% rename from applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapse.C rename to src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C index 6830e1c8f56ed18c006241ffb16388012da4b042..15747ded56e0afbd3743daa72c52613d9e45b5e6 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapse.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C @@ -34,7 +34,9 @@ Foam::Ostream& Foam::operator<< ) { return os - << wDist.collapsePoint_ << wDist.collapseIndex_; + << wDist.collapsePoint_ + << wDist.collapseIndex_ + << wDist.collapsePriority_; } Foam::Istream& Foam::operator>> @@ -44,7 +46,9 @@ Foam::Istream& Foam::operator>> ) { return is - >> wDist.collapsePoint_ >> wDist.collapseIndex_; + >> wDist.collapsePoint_ + >> wDist.collapseIndex_ + >> wDist.collapsePriority_; } diff --git a/applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapse.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H similarity index 96% rename from applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapse.H rename to src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H index cd8383b8b33b6ed6ddb0b03a172aa632205f3cee..83ac672b33a66130730c9fb61f3216e31cc78c05 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapse.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.H @@ -62,6 +62,9 @@ class pointEdgeCollapse //- Collapse string index label collapseIndex_; + //- Priority of the collapse + label collapsePriority_; + // Private Member Functions @@ -89,7 +92,8 @@ public: inline pointEdgeCollapse ( const point& collapsePoint, - const label collapseIndex + const label collapseIndex, + const label collapsePriority ); @@ -101,6 +105,8 @@ public: inline label collapseIndex() const; + inline label collapsePriority() const; + // Needed by meshWave diff --git a/applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapseI.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H similarity index 85% rename from applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapseI.H rename to src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H index eeb4d6baf2563a930787d7553c6df34d1dec3d21..3b01268a9299dd5f246ae22aace2f6852e6ae3fc 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/pointEdgeCollapse/pointEdgeCollapseI.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapseI.H @@ -43,49 +43,59 @@ inline bool Foam::pointEdgeCollapse::update << "problem." << abort(FatalError); } + if (!valid(td)) + { + operator=(w2); + return true; + } + if (w2.collapseIndex_ == -1 || collapseIndex_ == -1) { // Not marked for collapse; only happens on edges. return false; } - if (!valid(td)) + if (w2.collapsePriority_ < collapsePriority_) + { + return false; + } + else if (w2.collapsePriority_ > collapsePriority_) { operator=(w2); return true; } - else + + // Get overwritten by w2 if it has a higher priority + if (w2.collapseIndex_ < collapseIndex_) + { + operator=(w2); + return true; + } + else if (w2.collapseIndex_ == collapseIndex_) { - // Take over w2 if it is 'better' + bool identicalPoint = samePoint(w2.collapsePoint_); - if (w2.collapseIndex_ < collapseIndex_) + bool nearer = magSqr(w2.collapsePoint_) + < magSqr(collapsePoint_); + + if (nearer) { - // Take over string index and coordinate from w2 operator=(w2); - return true; } - else if (w2.collapseIndex_ == collapseIndex_) + + if (identicalPoint) { - bool identicalPoint = samePoint(w2.collapsePoint_); - bool nearer = magSqr(w2.collapsePoint_) < magSqr(collapsePoint_); - if (nearer) - { - operator=(w2); - } - if (identicalPoint) - { - return false; - } - else - { - return nearer; - } + return false; } else { - return false; + return nearer; } } + else + { + return false; + } } @@ -95,7 +105,8 @@ inline bool Foam::pointEdgeCollapse::update inline Foam::pointEdgeCollapse::pointEdgeCollapse() : collapsePoint_(GREAT, GREAT, GREAT), - collapseIndex_(-2) + collapseIndex_(-2), + collapsePriority_(-2) {} @@ -103,11 +114,13 @@ inline Foam::pointEdgeCollapse::pointEdgeCollapse() inline Foam::pointEdgeCollapse::pointEdgeCollapse ( const point& collapsePoint, - const label collapseIndex + const label collapseIndex, + const label collapsePriority ) : collapsePoint_(collapsePoint), - collapseIndex_(collapseIndex) + collapseIndex_(collapseIndex), + collapsePriority_(collapsePriority) {} @@ -125,6 +138,12 @@ inline Foam::label Foam::pointEdgeCollapse::collapseIndex() const } +inline Foam::label Foam::pointEdgeCollapse::collapsePriority() const +{ + return collapsePriority_; +} + + inline bool Foam::pointEdgeCollapse::samePoint(const point& pt) const { bool isLegal1 = (cmptMin(collapsePoint_) < 0.5*GREAT); @@ -268,6 +287,7 @@ inline bool Foam::pointEdgeCollapse::operator== { return collapseIndex_ == rhs.collapseIndex_ + && collapsePriority_ == rhs.collapsePriority_ && samePoint(rhs.collapsePoint_); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C index 07618de976ce162e05ccad910db1f66ed026a93d..12e4ebb6eb99b59da4dcd6f82c1fcbbddca44e6f 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChange.C @@ -39,6 +39,7 @@ License #include "processorPolyPatch.H" #include "fvMesh.H" #include "CompactListList.H" +#include "ListOps.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -2051,17 +2052,17 @@ void Foam::polyTopoChange::reorderCoupledFaces if (anyChanged) { - // Reorder faces according to oldToNew. - reorderCompactFaces(oldToNew.size(), oldToNew); - // Rotate faces (rotation is already in new face indices). forAll(rotation, faceI) { if (rotation[faceI] != 0) { - faces_[faceI] = faces_[faceI].rotateFace(rotation[faceI]); + inplaceRotateList<List, label>(faces_[faceI], rotation[faceI]); } } + + // Reorder faces according to oldToNew. + reorderCompactFaces(oldToNew.size(), oldToNew); } } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.H index 94895c53fd7baabfde5fb31f3c692bb83163b34d..1eb9f40e77705bfc987720190b696721a831d0d0 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/refinementHistory.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 @@ -174,8 +174,6 @@ public: private: - TypeName("refinementHistory"); - // Private data //- Storage for splitCells @@ -230,6 +228,10 @@ private: public: + // Declare name of the class and its debug switch + TypeName("refinementHistory"); + + // Constructors //- Construct (read) given an IOobject diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C index bdbd851527f9ef90334029cb0b4e489c0c89482e..fd0057531bc285b56b32f469b457a94e64ca686f 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/tetDecomposer.C @@ -33,10 +33,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::tetDecomposer, 0); - namespace Foam { + defineTypeNameAndDebug(tetDecomposer, 0); + template<> const char* NamedEnum<tetDecomposer::decompositionType, 2>::names[] = { diff --git a/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C b/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C index f87d6f7d38f01cc6bbee45899027a72a1c21af5a..9cd5e35fda2cdaae80c1eddb04204f834b791643 100644 --- a/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C +++ b/src/edgeMesh/edgeMeshFormats/edgeMeshFormatsCore.C @@ -105,7 +105,7 @@ Foam::fileName Foam::fileFormats::edgeMeshFormatsCore::findMeshInstance } } - return "constant"; + return t.constant(); } @@ -148,7 +148,7 @@ Foam::fileName Foam::fileFormats::edgeMeshFormatsCore::findMeshFile } // fallback to "constant" - return t.path()/"constant"/localName; + return t.path()/t.constant()/localName; } #endif diff --git a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C index f94715922be548f2d270e33ee20317e40bbca744..7b1871cd9a6d92c955b31f42ebf714a2d1e950a6 100644 --- a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C +++ b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.C @@ -37,7 +37,44 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::extendedFeatureEdgeMesh, 0); +namespace Foam +{ + defineTypeNameAndDebug(extendedFeatureEdgeMesh, 0); + + template<> + const char* Foam::NamedEnum + < + Foam::extendedFeatureEdgeMesh::pointStatus, + 4 + >::names[] = + { + "convex", + "concave", + "mixed", + "nonFeature" + }; + + template<> + const char* Foam::NamedEnum + < + Foam::extendedFeatureEdgeMesh::edgeStatus, + 6 + >::names[] = + { + "external", + "internal", + "flat", + "open", + "multiple", + "none" + }; +} + +const Foam::NamedEnum<Foam::extendedFeatureEdgeMesh::pointStatus, 4> + Foam::extendedFeatureEdgeMesh::pointStatusNames_; + +const Foam::NamedEnum<Foam::extendedFeatureEdgeMesh::edgeStatus, 6> + Foam::extendedFeatureEdgeMesh::edgeStatusNames_; Foam::scalar Foam::extendedFeatureEdgeMesh::cosNormalAngleTol_ = Foam::cos(degToRad(0.1)); @@ -72,6 +109,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh(const IOobject& io) edgeDirections_(0), edgeNormals_(0), featurePointNormals_(0), + featurePointEdges_(0), regionEdges_(0), pointTree_(), edgeTree_(), @@ -108,6 +146,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh(const IOobject& io) >> normals_ >> edgeNormals_ >> featurePointNormals_ + >> featurePointEdges_ >> regionEdges_; close(); @@ -160,6 +199,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh edgeDirections_(fem.edgeDirections()), edgeNormals_(fem.edgeNormals()), featurePointNormals_(fem.featurePointNormals()), + featurePointEdges_(fem.featurePointEdges()), regionEdges_(fem.regionEdges()), pointTree_(), edgeTree_(), @@ -187,6 +227,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh edgeDirections_(0), edgeNormals_(0), featurePointNormals_(0), + featurePointEdges_(0), regionEdges_(0), pointTree_(), edgeTree_(), @@ -225,15 +266,13 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh edgeDirections_(0), edgeNormals_(0), featurePointNormals_(0), + featurePointEdges_(0), regionEdges_(0), pointTree_(), edgeTree_(), edgeTreesByType_() { // Extract and reorder the data from surfaceFeatures - - - const triSurface& surf = sFeat.surface(); const labelList& featureEdges = sFeat.featureEdges(); const labelList& featurePoints = sFeat.featurePoints(); @@ -273,6 +312,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh edgeDirections_(0), edgeNormals_(0), featurePointNormals_(0), + featurePointEdges_(0), regionEdges_(0), pointTree_(), edgeTree_(), @@ -304,6 +344,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh const vectorField& edgeDirections, const labelListList& edgeNormals, const labelListList& featurePointNormals, + const labelListList& featurePointEdges, const labelList& regionEdges ) : @@ -320,6 +361,7 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh edgeDirections_(edgeDirections), edgeNormals_(edgeNormals), featurePointNormals_(featurePointNormals), + featurePointEdges_(featurePointEdges), regionEdges_(regionEdges), pointTree_(), edgeTree_(), @@ -1268,6 +1310,8 @@ bool Foam::extendedFeatureEdgeMesh::writeData(Ostream& os) const << edgeNormals_ << nl << "// featurePointNormals" << nl << featurePointNormals_ << nl + << "// featurePointEdges" << nl + << featurePointEdges_ << nl << "// regionEdges" << nl << regionEdges_ << endl; diff --git a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H index 8406658882e44275a946252f68b83cb3944113c6..b090ad66b12fdbc62ae65b26563fca657e49975e 100644 --- a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H +++ b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMesh.H @@ -93,6 +93,8 @@ public: NONFEATURE // Not a feature point }; + static const Foam::NamedEnum<pointStatus, 4> pointStatusNames_; + enum edgeStatus { EXTERNAL, // "Convex" edge @@ -104,6 +106,9 @@ public: // surfaceFeatures) }; + static const Foam::NamedEnum<edgeStatus, 6> edgeStatusNames_; + + private: // Static data @@ -155,6 +160,10 @@ private: // (only valid for 0..nonFeatureStart_-1) labelListList featurePointNormals_; + //- Indices of feature edges attached to feature points. The edges are + // ordered so that they can be circulated. + labelListList featurePointEdges_; + //- Feature edges which are on the boundary between regions labelList regionEdges_; @@ -202,6 +211,7 @@ public: //- Number of possible feature edge types (i.e. number of slices) static label nEdgeTypes; + // Constructors //- Construct (read) given an IOobject @@ -260,6 +270,7 @@ public: const vectorField& edgeDirections, const labelListList& edgeNormals, const labelListList& featurePointNormals, + const labelListList& featurePointEdges, const labelList& regionEdges ); @@ -381,6 +392,11 @@ public: //- Return the normal vectors for a given feature point inline vectorField featurePointNormals(label ptI) const; + //- Return the edge labels for a given feature point. Edges are + // ordered by the faces that they share. The edge labels + // correspond to the entry in edges(). + inline const labelListList& featurePointEdges() const; + //- Return the feature edges which are on the boundary between // regions inline const labelList& regionEdges() const; diff --git a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshI.H b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshI.H index 62b0cc08ca8f3445143c9ac3f461be4733c1d4f6..cad297e7d5cf7921951feb57a896d5246781092d 100644 --- a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshI.H +++ b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshI.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 @@ -115,7 +115,7 @@ inline Foam::vector Foam::extendedFeatureEdgeMesh::edgeDirection } else { - FatalErrorIn("Foam::extendedFeatureEdgeMesh::edgedirection") + FatalErrorIn("Foam::extendedFeatureEdgeMesh::edgeDirection") << "Requested ptI " << ptI << " is not a point on the requested " << "edgeI " << edgeI << ". edgeI start and end: " << e.start() << " " << e.end() @@ -191,6 +191,13 @@ inline Foam::vectorField Foam::extendedFeatureEdgeMesh::featurePointNormals } +inline const Foam::labelListList& +Foam::extendedFeatureEdgeMesh::featurePointEdges() const +{ + return featurePointEdges_; +} + + inline const Foam::labelList& Foam::extendedFeatureEdgeMesh::regionEdges() const { return regionEdges_; diff --git a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C index ac7eb3ef111ab7cb8f57823ddb93e9129b2a8de1..63cef912b1302db4e27671622fe8b37f557f685a 100644 --- a/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C +++ b/src/edgeMesh/extendedFeatureEdgeMesh/extendedFeatureEdgeMeshTemplates.C @@ -43,6 +43,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges const edgeList& sFeatEds(surf.edges()); const labelListList& edgeFaces = surf.edgeFaces(); const vectorField& faceNormals = surf.faceNormals(); + const labelListList& pointEdges = surf.pointEdges(); // Extract and reorder the data from surfaceFeatures @@ -51,6 +52,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges // Filling the extendedFeatureEdgeMesh with the raw geometrical data. label nFeatEds = featureEdges.size(); + label nFeatPts = featurePoints.size(); DynamicList<point> tmpPts; edgeList eds(nFeatEds); @@ -59,6 +61,14 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges labelListList edgeNormals(nFeatEds); DynamicList<label> regionEdges; + // Keep track of the ordered feature point feature edges + labelListList featurePointFeatureEdges(nFeatPts); + forAll(featurePointFeatureEdges, pI) + { + featurePointFeatureEdges[pI] = + labelList(pointEdges[featurePoints[pI]].size(), -1); + } + // Mapping between old and new indices, there is entry in the map for each // of surf.localPoints, -1 means that this point hasn't been used (yet), // >= 0 corresponds to the index @@ -82,7 +92,6 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges // All feature points have been added nonFeatureStart_ = tmpPts.size(); - PackedBoolList isRegionFeatureEdge(regionFeatureEdges); forAll(featureEdges, i) @@ -147,8 +156,43 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges { regionEdges.append(i); } + + forAll(featurePointFeatureEdges, pI) + { + const labelList& fpfEdges = pointEdges[featurePoints[pI]]; + + labelList& fpfe = featurePointFeatureEdges[pI]; + + forAll(fpfEdges, eI) + { + if (sFEI == fpfEdges[eI]) + { + fpfe[eI] = i; + } + } + } } + forAll(featurePointFeatureEdges, pI) + { + const labelList& fpfe = featurePointFeatureEdges[pI]; + + DynamicList<label> newFeatureEdges(fpfe.size()); + + forAll(fpfe, eI) + { + const label edgeIndex = fpfe[eI]; + + if (edgeIndex != -1) + { + newFeatureEdges.append(edgeIndex); + } + } + + featurePointFeatureEdges[pI] = newFeatureEdges; + } + + // Reorder the edges by classification List<DynamicList<label> > allEds(nEdgeTypes); @@ -222,6 +266,11 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges inplaceReorder(edMap, edgeNormals); inplaceRenumber(edMap, regionEdges); + forAll(featurePointFeatureEdges, pI) + { + inplaceRenumber(edMap, featurePointFeatureEdges[pI]); + } + pointField pts(tmpPts); // Initialise the edgeMesh @@ -301,6 +350,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges } inplaceReorder(ptMap, pts); + inplaceReorder(ptMap, featurePointFeatureEdges); forAll(eds, i) { @@ -311,6 +361,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges // renumbered edges reset(xferMove(pts), xferMove(eds)); + // Generate the featurePointNormals labelListList featurePointNormals(nonFeatureStart_); @@ -319,7 +370,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges { DynamicList<label> tmpFtPtNorms; - const labelList& ptEds = pointEdges()[i]; + const labelList& ptEds = edgeMesh::pointEdges()[i]; forAll(ptEds, j) { @@ -359,6 +410,7 @@ void Foam::extendedFeatureEdgeMesh::sortPointsAndEdges } featurePointNormals_ = featurePointNormals; + featurePointEdges_ = featurePointFeatureEdges; } diff --git a/src/engine/Make/options b/src/engine/Make/options index 6862a106f683621de8c2e3b57f566c6e27cd1714..0929e2bc8f16444baec5e7d3b051594b0a20e031 100644 --- a/src/engine/Make/options +++ b/src/engine/Make/options @@ -2,12 +2,10 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/fvMotionSolver/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/fvMotionSolver/lnInclude LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -ldynamicMesh \ - -lfvMotionSolvers \ - -lsampling + -lfvMotionSolvers diff --git a/src/engine/engineMesh/engineMesh/engineMesh.C b/src/engine/engineMesh/engineMesh/engineMesh.C index 8dac21fed4ca2905354b159c71c16b5bde64aeff..d3a80edeeae61d1c390e41ba23e7333af72212a2 100644 --- a/src/engine/engineMesh/engineMesh/engineMesh.C +++ b/src/engine/engineMesh/engineMesh/engineMesh.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 @@ -28,9 +28,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::engineMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(engineMesh, 0); +defineRunTimeSelectionTable(engineMesh, IOobject); +} -defineRunTimeSelectionTable(Foam::engineMesh, IOobject); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/fieldSources/Make/files b/src/fieldSources/Make/files index 11f91ff58ad4e2d3a5429e9ac793043e6de4726c..5d7aa03a43706b735bc0aed31af3cb9d4dd64678 100644 --- a/src/fieldSources/Make/files +++ b/src/fieldSources/Make/files @@ -3,33 +3,46 @@ basicSource/basicSourceIO.C basicSource/basicSourceList.C basicSource/IObasicSourceList.C -general/semiImplicitSource/semiImplicitSource.C -general/explicitSetValue/explicitSetValue.C -general/codedSource/codedSource.C - -derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C -derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C - -derived/rotorDiskSource/rotorDiskSource.C -derived/rotorDiskSource/bladeModel/bladeModel.C -derived/rotorDiskSource/profileModel/profileModel.C -derived/rotorDiskSource/profileModel/profileModelList.C -derived/rotorDiskSource/profileModel/lookup/lookupProfile.C -derived/rotorDiskSource/profileModel/series/seriesProfile.C -derived/rotorDiskSource/trimModel/trimModel/trimModel.C -derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C -derived/rotorDiskSource/trimModel/fixed/fixedTrim.C -derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C - -derived/actuationDiskSource/actuationDiskSource.C -derived/radialActuationDiskSource/radialActuationDiskSource.C - -interRegion = derived/interRegionHeatTransferModel -$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C + +/* sources */ + +generalSources=sources/general +$(generalSources)/codedSource/codedSource.C +$(generalSources)/semiImplicitSource/semiImplicitSource.C + +derivedSources=sources/derived +$(derivedSources)/actuationDiskSource/actuationDiskSource.C +$(derivedSources)/explicitPorositySource/explicitPorositySource.C +$(derivedSources)/MRFSource/MRFSource.C +$(derivedSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C +$(derivedSources)/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C +$(derivedSources)/radialActuationDiskSource/radialActuationDiskSource.C +$(derivedSources)/rotorDiskSource/rotorDiskSource.C +$(derivedSources)/rotorDiskSource/bladeModel/bladeModel.C +$(derivedSources)/rotorDiskSource/profileModel/profileModel.C +$(derivedSources)/rotorDiskSource/profileModel/profileModelList.C +$(derivedSources)/rotorDiskSource/profileModel/lookup/lookupProfile.C +$(derivedSources)/rotorDiskSource/profileModel/series/seriesProfile.C +$(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModel.C +$(derivedSources)/rotorDiskSource/trimModel/trimModel/trimModelNew.C +$(derivedSources)/rotorDiskSource/trimModel/fixed/fixedTrim.C +$(derivedSources)/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C + +interRegion = $(derivedSources)/interRegionHeatTransferModel $(interRegion)/constantHeatTransfer/constantHeatTransfer.C +$(interRegion)/interRegionHeatTransferModel/interRegionHeatTransferModel.C $(interRegion)/tabulatedHeatTransfer/tabulatedHeatTransfer.C $(interRegion)/variableHeatTransfer/variableHeatTransfer.C -derived/fixedTemperatureSource/fixedTemperatureSource.C + +/* constraints */ + +generalConstraints=constraints/general +$(generalConstraints)/explicitSetValue/explicitSetValue.C + +derivedConstraints=constraints/derived +$(derivedConstraints)/fixedTemperatureConstraint/fixedTemperatureConstraint.C +$(derivedConstraints)/temperatureLimitsConstraint/temperatureLimitsConstraint.C + LIB = $(FOAM_LIBBIN)/libfieldSources diff --git a/src/fieldSources/Make/options b/src/fieldSources/Make/options index 5927956469b56f90a17b9136d289915458f1b01f..a98e673d2587eba4c58652e63ccf0b3015ba6651 100644 --- a/src/fieldSources/Make/options +++ b/src/fieldSources/Make/options @@ -13,5 +13,5 @@ LIB_LIBS = \ -lfiniteVolume \ -lsampling \ -lmeshTools \ - -lsolidThermo \ + /*-lsolidThermo*/ \ -lcompressibleTurbulenceModel diff --git a/src/fieldSources/basicSource/basicSource.C b/src/fieldSources/basicSource/basicSource.C index 9ebcdc5834f30cf42cab164395a404db33206693..64be60fa84e8adf9b81f2e67b630992c587fa9f9 100644 --- a/src/fieldSources/basicSource/basicSource.C +++ b/src/fieldSources/basicSource/basicSource.C @@ -481,4 +481,36 @@ void Foam::basicSource::setValue(fvMatrix<tensor>& eqn, const label fieldI) } +void Foam::basicSource::relativeFlux(surfaceScalarField& phi) const +{ + // do nothing +} + + +void Foam::basicSource::relativeFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + // do nothing +} + + +void Foam::basicSource::absoluteFlux(surfaceScalarField& phi) const +{ + // do nothing +} + + +void Foam::basicSource::absoluteFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + // do nothing +} + + // ************************************************************************* // diff --git a/src/fieldSources/basicSource/basicSource.H b/src/fieldSources/basicSource/basicSource.H index 69e9dcf408b9588b8ef24eea9007afca51bb7e42..3e4740cead022cd494f98923cb7afc88b7af399e 100644 --- a/src/fieldSources/basicSource/basicSource.H +++ b/src/fieldSources/basicSource/basicSource.H @@ -427,6 +427,29 @@ public: ); + // Flux manipulations + + //- Make the given absolute flux relative + virtual void relativeFlux(surfaceScalarField& phi) const; + + //- Make the given absolute mass-flux relative + virtual void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Make the given relative flux absolute + virtual void absoluteFlux(surfaceScalarField& phi) const; + + //- Make the given relative mass-flux absolute + virtual void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + // I-O //- Write the source header information diff --git a/src/fieldSources/basicSource/basicSourceList.C b/src/fieldSources/basicSource/basicSourceList.C index 2d484868a44c969dd66d9539e07fa08d206c0b40..51396de122409bb94fe09dbd7e48cea0ac22a297 100644 --- a/src/fieldSources/basicSource/basicSourceList.C +++ b/src/fieldSources/basicSource/basicSourceList.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 @@ -108,6 +108,50 @@ void Foam::basicSourceList::reset(const dictionary& dict) } +void Foam::basicSourceList::relativeFlux(surfaceScalarField& phi) const +{ + forAll(*this, i) + { + this->operator[](i).relativeFlux(phi); + } +} + + +void Foam::basicSourceList::relativeFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + forAll(*this, i) + { + this->operator[](i).relativeFlux(rho, phi); + } +} + + +void Foam::basicSourceList::absoluteFlux(surfaceScalarField& phi) const +{ + forAll(*this, i) + { + this->operator[](i).absoluteFlux(phi); + } +} + + +void Foam::basicSourceList::absoluteFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + forAll(*this, i) + { + this->operator[](i).absoluteFlux(rho, phi); + } +} + + bool Foam::basicSourceList::read(const dictionary& dict) { checkTimeIndex_ = mesh_.time().timeIndex() + 2; diff --git a/src/fieldSources/basicSource/basicSourceList.H b/src/fieldSources/basicSource/basicSourceList.H index 5f5e053a942ece384be0b04617e7ccec75a042e0..002d23b1fb37ee0ae3dfa981465a48fb82295bdf 100644 --- a/src/fieldSources/basicSource/basicSourceList.H +++ b/src/fieldSources/basicSource/basicSourceList.H @@ -152,6 +152,29 @@ public: void constrain(fvMatrix<Type>& eqn, const word& fieldName); + // Flux manipulations + + //- Make the given absolute flux relative + void relativeFlux(surfaceScalarField& phi) const; + + //- Make the given absolute mass-flux relative + void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Make the given relative flux absolute + void absoluteFlux(surfaceScalarField& phi) const; + + //- Make the given relative mass-flux absolute + void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + // I-O //- Read dictionary diff --git a/src/fieldSources/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C b/src/fieldSources/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C new file mode 100644 index 0000000000000000000000000000000000000000..9f26a261edcb9615c6f2884968ad8f703f2ad882 --- /dev/null +++ b/src/fieldSources/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.C @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "fixedTemperatureConstraint.H" +#include "fvMesh.H" +#include "fvMatrices.H" +#include "basicThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(fixedTemperatureConstraint, 0); + addToRunTimeSelectionTable + ( + basicSource, + fixedTemperatureConstraint, + dictionary + ); + + template<> + const char* NamedEnum<fixedTemperatureConstraint::temperatureMode, 2>:: + names[] = + { + "uniform", + "lookup" + }; +} + +const Foam::NamedEnum<Foam::fixedTemperatureConstraint::temperatureMode, 2> + Foam::fixedTemperatureConstraint::temperatureModeNames_; + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fixedTemperatureConstraint::fixedTemperatureConstraint +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + basicSource(name, modelType, dict, mesh), + mode_(temperatureModeNames_.read(coeffs_.lookup("mode"))), + Tuniform_(NULL), + TName_("T") +{ + switch (mode_) + { + case tmUniform: + { + Tuniform_.reset + ( + DataEntry<scalar>::New("temperature", coeffs_).ptr() + ); + break; + } + case tmLookup: + { + TName_ = coeffs_.lookupOrDefault<word>("TName", "T"); + break; + } + default: + { + // error handling done by NamedEnum + } + } + + + fieldNames_.setSize(1, "energy"); + applied_.setSize(1, false); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::fixedTemperatureConstraint::alwaysApply() const +{ + return true; +} + + +void Foam::fixedTemperatureConstraint::setValue +( + fvMatrix<scalar>& eqn, + const label +) +{ + const basicThermo& thermo = + mesh_.lookupObject<basicThermo>("thermophysicalProperties"); + + if (eqn.psi().name() == thermo.he().name()) + { + switch (mode_) + { + case tmUniform: + { + const scalar t = mesh_.time().value(); + scalarField Tuni(cells_.size(), Tuniform_->value(t)); + eqn.setValues(cells_, thermo.he(thermo.p(), Tuni, cells_)); + + break; + } + case tmLookup: + { + const volScalarField& T = + mesh().lookupObject<volScalarField>(TName_); + + scalarField Tlkp(T, cells_); + eqn.setValues(cells_, thermo.he(thermo.p(), Tlkp, cells_)); + + break; + } + default: + { + // error handling done by NamedEnum + } + } + + } +} + + +void Foam::fixedTemperatureConstraint::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +bool Foam::fixedTemperatureConstraint::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + if (coeffs_.found(Tuniform_->name())) + { + Tuniform_.reset + ( + DataEntry<scalar>::New(Tuniform_->name(), dict).ptr() + ); + } + + coeffs_.readIfPresent("TName", TName_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fieldSources/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H b/src/fieldSources/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H new file mode 100644 index 0000000000000000000000000000000000000000..33066b61df1f4365a328ce892e5aac4860482c61 --- /dev/null +++ b/src/fieldSources/constraints/derived/fixedTemperatureConstraint/fixedTemperatureConstraint.H @@ -0,0 +1,165 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::fixedTemperatureConstraint + +Description + Fixed temperature equation constraint + + Sources described by: + + fixedTemperatureConstraintCoeffs + { + mode uniform; // uniform or lookup + + // uniform option + temperature constant 500; // fixed temperature with time [K] + + // lookup option + // TName T; // optional temperature field name + } + +Note: + The 'uniform' option allows the use of a time-varying uniform temperature + by means of the DataEntry type. + +SourceFiles + basicSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fixedTemperatureConstraint_H +#define fixedTemperatureConstraint_H + +#include "basicSource.H" +#include "NamedEnum.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fixedTemperatureConstraint Declaration +\*---------------------------------------------------------------------------*/ + +class fixedTemperatureConstraint +: + public basicSource +{ + +public: + + //- Temperature mode + enum temperatureMode + { + tmUniform, + tmLookup + }; + + + //- String representation of temperatureMode enums + static const NamedEnum<temperatureMode, 2> temperatureModeNames_; + + +protected: + + // Protected data + + //- Operation mode + temperatureMode mode_; + + //- Uniform temperature [K] + autoPtr<DataEntry<scalar> > Tuniform_; + + //- Temperature field name + word TName_; + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + fixedTemperatureConstraint(const fixedTemperatureConstraint&); + + //- Disallow default bitwise assignment + void operator=(const fixedTemperatureConstraint&); + + +public: + + //- Runtime type information + TypeName("fixedTemperatureConstraint"); + + + // Constructors + + //- Construct from components + fixedTemperatureConstraint + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~fixedTemperatureConstraint() + {} + + + // Member Functions + + virtual bool alwaysApply() const; + + + // Set values directly + + //- Scalar + virtual void setValue(fvMatrix<scalar>& eqn, const label fieldI); + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fieldSources/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C b/src/fieldSources/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C new file mode 100644 index 0000000000000000000000000000000000000000..5f4723702130bb41f1135dc007af1aa087020074 --- /dev/null +++ b/src/fieldSources/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.C @@ -0,0 +1,149 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "temperatureLimitsConstraint.H" +#include "fvMesh.H" +#include "basicThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(temperatureLimitsConstraint, 0); + addToRunTimeSelectionTable + ( + basicSource, + temperatureLimitsConstraint, + dictionary + ); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::temperatureLimitsConstraint::temperatureLimitsConstraint +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + basicSource(name, modelType, dict, mesh), + Tmin_(readScalar(coeffs_.lookup("Tmin"))), + Tmax_(readScalar(coeffs_.lookup("Tmax"))) +{ + fieldNames_.setSize(1, "energy"); + applied_.setSize(1, false); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::temperatureLimitsConstraint::alwaysApply() const +{ + return true; +} + + +void Foam::temperatureLimitsConstraint::correct(volScalarField& he) +{ + const basicThermo& thermo = + mesh_.lookupObject<basicThermo>("thermophysicalProperties"); + + if (he.name() == thermo.he().name()) + { + scalarField Tmin(cells_.size(), Tmin_); + scalarField Tmax(cells_.size(), Tmax_); + + scalarField heMin(thermo.he(thermo.p(), Tmin, cells_)); + scalarField heMax(thermo.he(thermo.p(), Tmax, cells_)); + + scalarField& hec = he.internalField(); + + forAll(cells_, i) + { + label cellI = cells_[i]; + hec[cellI]= max(min(hec[cellI], heMax[i]), heMin[i]); + } + + // handle boundaries in the case of 'all' + if (selectionMode_ == smAll) + { + volScalarField::GeometricBoundaryField& bf = he.boundaryField(); + + forAll(bf, patchI) + { + fvPatchScalarField& hep = bf[patchI]; + if (hep.fixesValue()) + { + // not over-riding fixed conditions + continue; + } + + const scalarField& pp = thermo.p().boundaryField()[patchI]; + + scalarField Tminp(pp.size(), Tmin_); + scalarField Tmaxp(pp.size(), Tmax_); + + scalarField heMinp(thermo.he(pp, Tminp, patchI)); + scalarField heMaxp(thermo.he(pp, Tmaxp, patchI)); + + forAll(hep, faceI) + { + hep[faceI] = + max(min(hep[faceI], heMaxp[faceI]), heMinp[faceI]); + } + } + } + } +} + + +void Foam::temperatureLimitsConstraint::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +bool Foam::temperatureLimitsConstraint::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + coeffs_.readIfPresent("Tmin", Tmin_); + coeffs_.readIfPresent("Tmax", Tmax_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H b/src/fieldSources/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H similarity index 73% rename from src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H rename to src/fieldSources/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H index 4281a38e2ccc5990db25be28b7b447c0e120889f..52a25564f471dd886471aaadce23a52243f511bc 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.H +++ b/src/fieldSources/constraints/derived/temperatureLimitsConstraint/temperatureLimitsConstraint.H @@ -23,17 +23,18 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::fixedTemperatureSource + Foam::temperatureLimitsConstraint Description - Fixed temperature equation constraint + Constraint for temperature to apply limits between minimum and maximum + values - Sources described by: + Constraint described by: - fixedTemperatureSourceCoeffs + temperatureLimitsConstraintCoeffs { - fieldNames (h e hs); // names of fields to apply source - temperature 500; // fixed temperature [K] + minimum 200; + maximum 500; } @@ -42,8 +43,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef fixedTemperatureSource_H -#define fixedTemperatureSource_H +#ifndef temperatureLimitsConstraint_H +#define temperatureLimitsConstraint_H #include "basicSource.H" @@ -53,10 +54,10 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class fixedTemperatureSource Declaration + Class temperatureLimitsConstraint Declaration \*---------------------------------------------------------------------------*/ -class fixedTemperatureSource +class temperatureLimitsConstraint : public basicSource { @@ -65,8 +66,11 @@ protected: // Protected data - //- Fixed temperature [K] - scalar T_; + //- Minimum temperature limit [K] + scalar Tmin_; + + //- Maximum temperature limit [K] + scalar Tmax_; private: @@ -74,22 +78,22 @@ private: // Private Member Functions //- Disallow default bitwise copy construct - fixedTemperatureSource(const fixedTemperatureSource&); + temperatureLimitsConstraint(const temperatureLimitsConstraint&); //- Disallow default bitwise assignment - void operator=(const fixedTemperatureSource&); + void operator=(const temperatureLimitsConstraint&); public: //- Runtime type information - TypeName("fixedTemperatureSource"); + TypeName("temperatureLimitsConstraint"); // Constructors //- Construct from components - fixedTemperatureSource + temperatureLimitsConstraint ( const word& name, const word& modelType, @@ -99,7 +103,7 @@ public: //- Destructor - virtual ~fixedTemperatureSource() + virtual ~temperatureLimitsConstraint() {} @@ -108,10 +112,10 @@ public: virtual bool alwaysApply() const; - // Set values directly + // Evaluate - //- Scalar - virtual void setValue(fvMatrix<scalar>& eqn, const label fieldI); + //- Correct the energy field + virtual void correct(volScalarField& he); // I-O diff --git a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C b/src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValue.C similarity index 93% rename from src/fieldSources/general/explicitSetValue/ExplicitSetValue.C rename to src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValue.C index de957994d27c86c8c1d8cc01e81c522fa256db32..eb67c707e35bcca66f9cde25fc4b689958f40f65 100644 --- a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.C +++ b/src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValue.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 @@ -81,9 +81,7 @@ void Foam::ExplicitSetValue<Type>::setValue << ">::setValue for source " << name_ << endl; } - List<Type> values(cells_.size()); - - UIndirectList<Type>(values, cells_) = injectionRate_[fieldI]; + List<Type> values(cells_.size(), injectionRate_[fieldI]); eqn.setValues(cells_, values); } diff --git a/src/fieldSources/general/explicitSetValue/ExplicitSetValue.H b/src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValue.H similarity index 100% rename from src/fieldSources/general/explicitSetValue/ExplicitSetValue.H rename to src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValue.H diff --git a/src/fieldSources/general/explicitSetValue/ExplicitSetValueIO.C b/src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValueIO.C similarity index 95% rename from src/fieldSources/general/explicitSetValue/ExplicitSetValueIO.C rename to src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValueIO.C index a27190ea49cb7de06d7637a5fc83fc1d1a69bfdd..f5c14c2fcc9301165f57506ab0bb6ea739acd35d 100644 --- a/src/fieldSources/general/explicitSetValue/ExplicitSetValueIO.C +++ b/src/fieldSources/constraints/general/explicitSetValue/ExplicitSetValueIO.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 diff --git a/src/fieldSources/general/explicitSetValue/explicitSetValue.C b/src/fieldSources/constraints/general/explicitSetValue/explicitSetValue.C similarity index 95% rename from src/fieldSources/general/explicitSetValue/explicitSetValue.C rename to src/fieldSources/constraints/general/explicitSetValue/explicitSetValue.C index 78bb54bcb3489d44312914342f1c679abcf90fa3..e968c127ef768ba49692c719992af70b09776c2d 100644 --- a/src/fieldSources/general/explicitSetValue/explicitSetValue.C +++ b/src/fieldSources/constraints/general/explicitSetValue/explicitSetValue.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 diff --git a/src/fieldSources/include/createSources.H b/src/fieldSources/include/createSources.H new file mode 100644 index 0000000000000000000000000000000000000000..53bac8179731219a372e14acedef25820744c62f --- /dev/null +++ b/src/fieldSources/include/createSources.H @@ -0,0 +1,2 @@ +Info<< "Creating sources" << endl; +IObasicSourceList sources(mesh); diff --git a/src/fieldSources/sources/derived/MRFSource/MRFSource.C b/src/fieldSources/sources/derived/MRFSource/MRFSource.C new file mode 100644 index 0000000000000000000000000000000000000000..3b0582a2327f881a08174e07d429cd06bf18d238 --- /dev/null +++ b/src/fieldSources/sources/derived/MRFSource/MRFSource.C @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "MRFSource.H" +#include "fvMesh.H" +#include "fvMatrices.H" +#include "MRFZone.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(MRFSource, 0); + addToRunTimeSelectionTable + ( + basicSource, + MRFSource, + dictionary + ); +} + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::MRFSource::initialise() +{ + if (selectionMode_ != smCellZone) + { + FatalErrorIn("void Foam::MRFSource::initialise()") + << "The porosity region must be specified as a cellZone. Current " + << "selection mode is " << selectionModeTypeNames_[selectionMode_] + << exit(FatalError); + } + + mrfPtr_.reset + ( + new MRFZone + ( + name_, + mesh_, + coeffs_, + cellSetName_ + ) + ); + + const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_); + + mrfPtr_->correctBoundaryVelocity(const_cast<volVectorField&>(U)); + + fieldNames_.setSize(1, UName_); + applied_.setSize(1, false); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::MRFSource::MRFSource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + basicSource(name, modelType, dict, mesh), + mrfPtr_(NULL), + UName_(coeffs_.lookupOrDefault<word>("UName", "U")), + rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho")) +{ + initialise(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::MRFSource::addSup +( + fvMatrix<vector>& eqn, + const label fieldI +) +{ + if (eqn.dimensions() == dimForce) + { + const volScalarField& rho = + mesh_.lookupObject<volScalarField>(rhoName_); + + // use 'true' flag to add to rhs of equation + mrfPtr_->addCoriolis(rho, eqn, true); + } + else + { + // use 'true' flag to add to rhs of equation + mrfPtr_->addCoriolis(eqn, true); + } +} + + +void Foam::MRFSource::relativeFlux(surfaceScalarField& phi) const +{ + mrfPtr_->relativeFlux(phi); +} + + +void Foam::MRFSource::relativeFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + mrfPtr_->relativeFlux(rho, phi); +} + + +void Foam::MRFSource::absoluteFlux(surfaceScalarField& phi) const +{ + mrfPtr_->absoluteFlux(phi); +} + + +void Foam::MRFSource::absoluteFlux +( + const surfaceScalarField& rho, + surfaceScalarField& phi +) const +{ + mrfPtr_->absoluteFlux(rho, phi); +} + + +void Foam::MRFSource::writeData(Ostream& os) const +{ + os << indent << name_ << endl; + dict_.write(os); +} + + +bool Foam::MRFSource::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + coeffs_.readIfPresent("UName", UName_); + coeffs_.readIfPresent("rhoName", rhoName_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/fieldSources/sources/derived/MRFSource/MRFSource.H b/src/fieldSources/sources/derived/MRFSource/MRFSource.H new file mode 100644 index 0000000000000000000000000000000000000000..1742ac301104e65ce5343b3733fb538715f2ea76 --- /dev/null +++ b/src/fieldSources/sources/derived/MRFSource/MRFSource.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::MRFSource + +Description + Multiple Reference Frame (MRF) source + + Example usage: + + MRFSourceCoeffs + { + origin (0 0 0); + axis (0 0 1); + omega 104.72; + } + +SourceFiles + MRFSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef MRFSource_H +#define MRFSource_H + +#include "basicSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class MRFZone; + +/*---------------------------------------------------------------------------*\ + Class MRFSource Declaration +\*---------------------------------------------------------------------------*/ + +class MRFSource +: + public basicSource +{ + +protected: + + // Protected data + + //- Run-time selectable porosity model + autoPtr<MRFZone> mrfPtr_; + + //- Velocity field name, default = U + word UName_; + + //- Density field name, default = rho + word rhoName_; + + + // Protected Member Functions + + //- Initialise + void initialise(); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + MRFSource(const MRFSource&); + + //- Disallow default bitwise assignment + void operator=(const MRFSource&); + + +public: + + //- Runtime type information + TypeName("MRFSource"); + + + // Constructors + + //- Construct from components + MRFSource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~MRFSource() + {} + + + // Member Functions + + // Add explicit and implicit contributions + + //- Vector + virtual void addSup + ( + fvMatrix<vector>& eqn, + const label fieldI + ); + + + // Flux manipulations + + //- Make the given absolute flux relative + virtual void relativeFlux(surfaceScalarField& phi) const; + + //- Make the given absolute mass-flux relative + virtual void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Make the given relative flux absolute + virtual void absoluteFlux(surfaceScalarField& phi) const; + + //- Make the given relative mass-flux absolute + virtual void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fieldSources/derived/actuationDiskSource/actuationDiskSource.C b/src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSource.C similarity index 98% rename from src/fieldSources/derived/actuationDiskSource/actuationDiskSource.C rename to src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSource.C index 878398220ef20ce73d72a8a7c823a6d71b2c525b..d20266d7cc3592267049efc919720105af9655c8 100644 --- a/src/fieldSources/derived/actuationDiskSource/actuationDiskSource.C +++ b/src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSource.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 diff --git a/src/fieldSources/derived/actuationDiskSource/actuationDiskSource.H b/src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSource.H similarity index 98% rename from src/fieldSources/derived/actuationDiskSource/actuationDiskSource.H rename to src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSource.H index 80cd7bd54a88c2da40b4580de14b90308cdf3b48..d7609fa093106a743b5f8336943956068fe98ce2 100644 --- a/src/fieldSources/derived/actuationDiskSource/actuationDiskSource.H +++ b/src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSource.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 diff --git a/src/fieldSources/derived/actuationDiskSource/actuationDiskSourceTemplates.C b/src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C similarity index 96% rename from src/fieldSources/derived/actuationDiskSource/actuationDiskSourceTemplates.C rename to src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.C index 959e86f5b3fedf05088ef1ee7bcb739e13605add..1efb261c68d9354ad7f0d3d67f87323719330cfa 100644 --- a/src/fieldSources/derived/actuationDiskSource/actuationDiskSourceTemplates.C +++ b/src/fieldSources/sources/derived/actuationDiskSource/actuationDiskSourceTemplates.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 diff --git a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C b/src/fieldSources/sources/derived/explicitPorositySource/explicitPorositySource.C similarity index 53% rename from src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C rename to src/fieldSources/sources/derived/explicitPorositySource/explicitPorositySource.C index bef68f3c4e927ddba13685181a863bd26f66c3bd..9c5eeb17ca6d63d2a0fd2a442fca9d5d9b39968c 100644 --- a/src/fieldSources/derived/fixedTemperatureSource/fixedTemperatureSource.C +++ b/src/fieldSources/sources/derived/explicitPorositySource/explicitPorositySource.C @@ -24,29 +24,56 @@ License \*----------------------------------------------------------------------------*/ -#include "fixedTemperatureSource.H" +#include "explicitPorositySource.H" #include "fvMesh.H" #include "fvMatrices.H" -#include "basicThermo.H" +#include "porosityModel.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(fixedTemperatureSource, 0); + defineTypeNameAndDebug(explicitPorositySource, 0); addToRunTimeSelectionTable ( basicSource, - fixedTemperatureSource, + explicitPorositySource, dictionary ); } +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::explicitPorositySource::initialise() +{ + if (selectionMode_ != smCellZone) + { + FatalErrorIn("void Foam::explicitPorositySource::initialise()") + << "The porosity region must be specified as a cellZone. Current " + << "selection mode is " << selectionModeTypeNames_[selectionMode_] + << exit(FatalError); + } + + porosityPtr_.reset + ( + porosityModel::New + ( + name_, + mesh_, + coeffs_, + cellSetName_ + ).ptr() + ), + + fieldNames_.setSize(1, UName_); + applied_.setSize(1, false); +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fixedTemperatureSource::fixedTemperatureSource +Foam::explicitPorositySource::explicitPorositySource ( const word& name, const word& modelType, @@ -55,50 +82,56 @@ Foam::fixedTemperatureSource::fixedTemperatureSource ) : basicSource(name, modelType, dict, mesh), - T_(readScalar(coeffs_.lookup("temperature"))) + porosityPtr_(NULL), + UName_(coeffs_.lookupOrDefault<word>("UName", "U")), + rhoName_(coeffs_.lookupOrDefault<word>("rhoName", "rho")), + muName_(coeffs_.lookupOrDefault<word>("muName", "thermo:mu")) { - fieldNames_.setSize(1, "energy"); - applied_.setSize(1, false); + initialise(); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::fixedTemperatureSource::alwaysApply() const -{ - return true; -} - - -void Foam::fixedTemperatureSource::setValue +void Foam::explicitPorositySource::addSup ( - fvMatrix<scalar>& eqn, - const label + fvMatrix<vector>& eqn, + const label fieldI ) { - const basicThermo& thermo = - mesh_.lookupObject<basicThermo>("thermophysicalProperties"); + fvMatrix<vector> porosityEqn(eqn.psi(), eqn.dimensions()); - if (eqn.psi().name() == thermo.he().name()) + if (eqn.dimensions() == dimForce) { - const scalarField Tfield(cells_.size(), T_); - eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_)); + const volScalarField& rho = + mesh_.lookupObject<volScalarField>(rhoName_); + const volScalarField& mu = mesh_.lookupObject<volScalarField>(muName_); + + porosityPtr_->addResistance(porosityEqn, rho, mu); } + else + { + porosityPtr_->addResistance(porosityEqn); + } + + eqn -= porosityEqn; } -void Foam::fixedTemperatureSource::writeData(Ostream& os) const +void Foam::explicitPorositySource::writeData(Ostream& os) const { os << indent << name_ << endl; dict_.write(os); } -bool Foam::fixedTemperatureSource::read(const dictionary& dict) +bool Foam::explicitPorositySource::read(const dictionary& dict) { if (basicSource::read(dict)) { - coeffs_.readIfPresent("T", T_); + coeffs_.readIfPresent("UName", UName_); + coeffs_.readIfPresent("rhoName", rhoName_); + coeffs_.readIfPresent("muName", muName_); return true; } diff --git a/src/fieldSources/sources/derived/explicitPorositySource/explicitPorositySource.H b/src/fieldSources/sources/derived/explicitPorositySource/explicitPorositySource.H new file mode 100644 index 0000000000000000000000000000000000000000..30fc6c90da7bf0757fc4387201969bb90a5ead6a --- /dev/null +++ b/src/fieldSources/sources/derived/explicitPorositySource/explicitPorositySource.H @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::explicitPorositySource + +Description + Explicit porosity source + + Sources described by, for example using the DarcyForchheimer model: + + explicitPorositySourceCoeffs + { + type DarcyForchheimer; + DarcyForchheimerCoeffs + { + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + + coordinateSystem + { + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } + } + } + +Note: + The porous region must be selected as a cellZone. + +SourceFiles + explicitPorositySource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef explicitPorositySource_H +#define explicitPorositySource_H + +#include "basicSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class porosityModel; + +/*---------------------------------------------------------------------------*\ + Class explicitPorositySource Declaration +\*---------------------------------------------------------------------------*/ + +class explicitPorositySource +: + public basicSource +{ + +protected: + + // Protected data + + //- Run-time selectable porosity model + autoPtr<porosityModel> porosityPtr_; + + //- Velocity field name, default = U + word UName_; + + //- Density field name (compressible case only), default = rho + word rhoName_; + + //- Dynamic viscosity field name (compressible case only) + // default = thermo:mu + word muName_; + + + // Protected Member Functions + + //- Initialise + void initialise(); + + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + explicitPorositySource(const explicitPorositySource&); + + //- Disallow default bitwise assignment + void operator=(const explicitPorositySource&); + + +public: + + //- Runtime type information + TypeName("explicitPorositySource"); + + + // Constructors + + //- Construct from components + explicitPorositySource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~explicitPorositySource() + {} + + + // Member Functions + + // Add explicit and implicit contributions + + //- Vector + virtual void addSup + ( + fvMatrix<vector>& eqn, + const label fieldI + ); + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C b/src/fieldSources/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C similarity index 97% rename from src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C index eb49266305cc4e51b2aa6bee8b424210657eb607..d81e32adbe958e1b6b0433575fd903c9db469bf4 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.C +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.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 diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H b/src/fieldSources/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H similarity index 97% rename from src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H index 375d00ae8b205773f18036affbca85bce19e0216..d2383496b21d4a35a08864d88c6171e1b86f5847 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.H +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/constantHeatTransfer/constantHeatTransfer.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 diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C b/src/fieldSources/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C similarity index 99% rename from src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C index 1cd4178faf342efd4aa6af9ee46e0642fc989fc5..fd3f1b4475a351023afb57d93f0324f7e47a948b 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.C @@ -127,7 +127,6 @@ Foam::interRegionHeatTransferModel::~interRegionHeatTransferModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::interRegionHeatTransferModel::addSup ( fvMatrix<scalar>& eEqn, diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H b/src/fieldSources/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H similarity index 96% rename from src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H index 9a521f459d33d85f7b29e4899c27762cdf92791f..ae843d9ab9323a44cdd255b1afd09318e7e7acbe 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/interRegionHeatTransferModel/interRegionHeatTransferModel.H @@ -27,7 +27,6 @@ Class Description Base class for inter region heat exchange. The derived classes must provide the heat transfer coefficient (htc) - NOTE: mapToMap does to work in paralell \*---------------------------------------------------------------------------*/ @@ -44,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interRegionHeatTransferModel Declaration + Class interRegionHeatTransferModel Declaration \*---------------------------------------------------------------------------*/ class interRegionHeatTransferModel diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C b/src/fieldSources/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C similarity index 98% rename from src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C index 5a6a22d295b24bf7d735fde573ca7cdc1a9477f1..b06ff1aaabb92cabbbeb47135e34617561228384 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.C +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.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 diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H b/src/fieldSources/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H similarity index 97% rename from src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H index e5c37fdf3b94629bc911f952b240ae2b93f6e112..b792a2f4bf2cb805ffa55420a7e671fd79c15c07 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.H +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/tabulatedHeatTransfer/tabulatedHeatTransfer.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 diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C b/src/fieldSources/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C similarity index 100% rename from src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.C diff --git a/src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H b/src/fieldSources/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H similarity index 97% rename from src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H rename to src/fieldSources/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H index 1d8f25caadca2518bed348a1675bc31619396bf6..491264155696b7d802095ca490d31ffe14d9308c 100644 --- a/src/fieldSources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.H +++ b/src/fieldSources/sources/derived/interRegionHeatTransferModel/variableHeatTransfer/variableHeatTransfer.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 diff --git a/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C b/src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C similarity index 88% rename from src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C rename to src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C index 790fac2c8bf91838b34235fc70b469a3db006995..d506bdb19ee391d1bc253262c6ecbf3778579e15 100644 --- a/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C +++ b/src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.C @@ -46,7 +46,7 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::pressureGradientExplicitSource::writeGradP() const +void Foam::pressureGradientExplicitSource::writeProps(const scalar gradP) const { // Only write on output time if (mesh_.time().outputTime()) @@ -63,7 +63,7 @@ void Foam::pressureGradientExplicitSource::writeGradP() const IOobject::NO_WRITE ) ); - propsDict.add("gradient", gradP_); + propsDict.add("gradient", gradP); propsDict.regIOobject::write(); } } @@ -81,8 +81,8 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource : basicSource(sourceName, modelType, dict, mesh), Ubar_(coeffs_.lookup("Ubar")), - gradPini_(coeffs_.lookup("gradPini")), - gradP_(gradPini_), + gradP0_(0.0), + dGradP_(0.0), flowDir_(Ubar_/mag(Ubar_)), invAPtr_(NULL) { @@ -95,7 +95,7 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource "Foam::pressureGradientExplicitSource::" "pressureGradientExplicitSource" "(" - "onst word&, " + "const word&, " "const word&, " "const dictionary&, " "const fvMesh&" @@ -116,10 +116,10 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource { Info<< " Reading pressure gradient from file" << endl; dictionary propsDict(dictionary::null, propsFile); - propsDict.lookup("gradient") >> gradP_; + propsDict.lookup("gradient") >> gradP0_; } - Info<< " Initial pressure gradient = " << gradP_ << nl << endl; + Info<< " Initial pressure gradient = " << gradP0_ << nl << endl; } @@ -151,22 +151,21 @@ void Foam::pressureGradientExplicitSource::correct(volVectorField& U) // Calculate the pressure gradient increment needed to adjust the average // flow-rate to the desired value - scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave; + dGradP_ = (mag(Ubar_) - magUbarAve)/rAUave; // Apply correction to velocity field forAll(cells_, i) { label cellI = cells_[i]; - U[cellI] += flowDir_*rAU[cellI]*gradPplus; + U[cellI] += flowDir_*rAU[cellI]*dGradP_; } - // Update pressure gradient - gradP_.value() += gradPplus; + scalar gradP = gradP0_ + dGradP_; Info<< "Pressure gradient source: uncorrected Ubar = " << magUbarAve - << ", pressure gradient = " << gradP_.value() << endl; + << ", pressure gradient = " << gradP << endl; - writeGradP(); + writeProps(gradP); } @@ -187,10 +186,12 @@ void Foam::pressureGradientExplicitSource::addSup IOobject::NO_WRITE ), mesh_, - dimensionedVector("zero", gradP_.dimensions(), vector::zero) + dimensionedVector("zero", eqn.dimensions()/dimVolume, vector::zero) ); - UIndirectList<vector>(Su, cells_) = flowDir_*gradP_.value(); + scalar gradP = gradP0_ + dGradP_; + + UIndirectList<vector>(Su, cells_) = flowDir_*gradP; eqn += Su; } @@ -224,6 +225,9 @@ void Foam::pressureGradientExplicitSource::setValue { invAPtr_() = 1.0/eqn.A(); } + + gradP0_ += dGradP_; + dGradP_ = 0.0; } diff --git a/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H b/src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H similarity index 95% rename from src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H rename to src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H index a45a7927de90e9267a0c534d53783ed4d7405ad5..72ed2d7cf5635d34256fcc6ec9a4c9af14ba0e7b 100644 --- a/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H +++ b/src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSource.H @@ -73,11 +73,11 @@ class pressureGradientExplicitSource //- Average velocity vector Ubar_; - //- Initial pressure gradient - dimensionedScalar gradPini_; + //- Pressure gradient before correction + scalar gradP0_; - //- Pressure gradient - dimensionedScalar gradP_; + //- Change in pressure gradient + scalar dGradP_; //- Flow direction vector flowDir_; @@ -89,7 +89,7 @@ class pressureGradientExplicitSource // Private Member Functions //- Write the pressure gradient to file (for restarts etc) - void writeGradP() const; + void writeProps(const scalar gradP) const; //- Correct driving force for a constant mass flow rate void update(fvMatrix<vector>& eqn); diff --git a/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C b/src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C similarity index 95% rename from src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C rename to src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C index b6d1b2d1cf2ba38daf88a33e30d56bee1602f83c..96a6257042d28d19b3d1f038d9effeb6b02f3bc3 100644 --- a/src/fieldSources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C +++ b/src/fieldSources/sources/derived/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.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 diff --git a/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.C b/src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C similarity index 97% rename from src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.C rename to src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSource.C index 4a5631270ab514929e82b30c64ac153ea156b092..3564cbfe101601d049008d13257233278ef2335f 100644 --- a/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.C +++ b/src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSource.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 diff --git a/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.H b/src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H similarity index 98% rename from src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.H rename to src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSource.H index 134e93b5eae64116d38e0e8048a29980598a8f27..9b05c7141a06d0620a69b005954670a0d1af7591 100644 --- a/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSource.H +++ b/src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSource.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 diff --git a/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C similarity index 97% rename from src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C rename to src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C index adea6154550cf1642d52834d7af47b26efe18d64..086d8472fecc35ff7190dc2d0a539930824d00a8 100644 --- a/src/fieldSources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.C +++ b/src/fieldSources/sources/derived/radialActuationDiskSource/radialActuationDiskSourceTemplates.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 diff --git a/src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.C b/src/fieldSources/sources/derived/rotorDiskSource/bladeModel/bladeModel.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.C rename to src/fieldSources/sources/derived/rotorDiskSource/bladeModel/bladeModel.C diff --git a/src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.H b/src/fieldSources/sources/derived/rotorDiskSource/bladeModel/bladeModel.H similarity index 98% rename from src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.H rename to src/fieldSources/sources/derived/rotorDiskSource/bladeModel/bladeModel.H index df26e7bd401a5b1bdf617ec0620dc25ccac1ba4c..dcb3d5dd213433c575c49cb31a76bbf517953a2c 100644 --- a/src/fieldSources/derived/rotorDiskSource/bladeModel/bladeModel.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/bladeModel/bladeModel.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 diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.C diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H similarity index 97% rename from src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H index deb5c1f725ab8096c9a0471e09d8784fba7e6061..bee45e4f22c7645328b8b7425e3e61fa92124a23 100644 --- a/src/fieldSources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/lookup/lookupProfile.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 diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.C b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModel.C similarity index 97% rename from src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.C rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModel.C index c9008d276c644533d6a446f453eb20b3d709fafe..edb509b9cdf5d8bc5276343644f414d723c1bdef 100644 --- a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.C +++ b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModel.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 diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.H b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModel.H similarity index 97% rename from src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.H rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModel.H index 5c850ec1bb30a214b71b35586e0c09b8af57039f..d419fe8f8b568d6d8d95e9df10c287ce511d3d78 100644 --- a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModel.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModel.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 diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.C b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModelList.C similarity index 97% rename from src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.C rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModelList.C index 904b01372b540aadf146c3e345744ba0d41298ad..e1c3dffb2d34ebb9f53e2caaccf0378703b050b6 100644 --- a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.C +++ b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModelList.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 diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.H b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModelList.H similarity index 96% rename from src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.H rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModelList.H index 0a6c12528844dc52ae2d7d0d9377f18b164fbfde..ff794b2be2d35e48f88790ccbc4c2506329aaace 100644 --- a/src/fieldSources/derived/rotorDiskSource/profileModel/profileModelList.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/profileModelList.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 diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.C b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.C rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.C diff --git a/src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.H b/src/fieldSources/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.H similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/profileModel/series/seriesProfile.H rename to src/fieldSources/sources/derived/rotorDiskSource/profileModel/series/seriesProfile.H diff --git a/src/fieldSources/derived/rotorDiskSource/rotorDiskSource.C b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSource.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/rotorDiskSource.C rename to src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSource.C diff --git a/src/fieldSources/derived/rotorDiskSource/rotorDiskSource.H b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSource.H similarity index 99% rename from src/fieldSources/derived/rotorDiskSource/rotorDiskSource.H rename to src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSource.H index 17deb44816be960353e83e5b8ee118ab68adb92d..d28bc6171398a7e522bbec5fa65b9b0cb76965bc 100644 --- a/src/fieldSources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -322,4 +322,3 @@ public: #endif // ************************************************************************* // - diff --git a/src/fieldSources/derived/rotorDiskSource/rotorDiskSourceI.H b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSourceI.H similarity index 99% rename from src/fieldSources/derived/rotorDiskSource/rotorDiskSourceI.H rename to src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSourceI.H index 9d095e846b9d3343bcef811a3301de304ac034fa..3db904fb9de3576b3c1cb7e612291a10460fd160 100644 --- a/src/fieldSources/derived/rotorDiskSource/rotorDiskSourceI.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSourceI.H @@ -70,4 +70,3 @@ Foam::tmp<Foam::volScalarField> Foam::rotorDiskSource::rho() const } // ************************************************************************* // - diff --git a/src/fieldSources/derived/rotorDiskSource/rotorDiskSourceTemplates.C b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C similarity index 96% rename from src/fieldSources/derived/rotorDiskSource/rotorDiskSourceTemplates.C rename to src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C index ae574946a6444ddbf9452acf0b521aaf661739b7..f8e0113308cb1e8c89da5b06b0053bf54b3e1a00 100644 --- a/src/fieldSources/derived/rotorDiskSource/rotorDiskSourceTemplates.C +++ b/src/fieldSources/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.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 diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.C diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/fixed/fixedTrim.H diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C similarity index 99% rename from src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C index 4ed3f7712019026712f3ed91c07e5dc42d0e8605..d2f91614d4e31bfbea46b2f1027e85d712bb3c57 100644 --- a/src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C +++ b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C @@ -46,7 +46,7 @@ Foam::vector Foam::targetCoeffTrim::calcCoeffs ( const vectorField& U, const scalarField& thetag, - vectorField& force + vectorField& force ) const { rotor_.calculate(U, thetag, force, false, false); diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H similarity index 98% rename from src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H index 24d5732e99f719c5053f0dbdac6063259d665022..4425d55772a3e096349b7964d570475e34789e52 100644 --- a/src/fieldSources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H +++ b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.H @@ -62,7 +62,7 @@ Description rho = desity omega = rotor angulr velocity pi = mathematical pi - + SourceFiles targetCoeffTrim.C @@ -129,7 +129,7 @@ protected: ( const vectorField& U, const scalarField& alphag, - vectorField& force + vectorField& force ) const; diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.C diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/trimModel/trimModel.H diff --git a/src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C b/src/fieldSources/sources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C similarity index 100% rename from src/fieldSources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C rename to src/fieldSources/sources/derived/rotorDiskSource/trimModel/trimModel/trimModelNew.C diff --git a/src/fieldSources/general/codedSource/CodedSource.C b/src/fieldSources/sources/general/codedSource/CodedSource.C similarity index 100% rename from src/fieldSources/general/codedSource/CodedSource.C rename to src/fieldSources/sources/general/codedSource/CodedSource.C diff --git a/src/fieldSources/general/codedSource/CodedSource.H b/src/fieldSources/sources/general/codedSource/CodedSource.H similarity index 100% rename from src/fieldSources/general/codedSource/CodedSource.H rename to src/fieldSources/sources/general/codedSource/CodedSource.H diff --git a/src/fieldSources/general/codedSource/CodedSourceIO.C b/src/fieldSources/sources/general/codedSource/CodedSourceIO.C similarity index 100% rename from src/fieldSources/general/codedSource/CodedSourceIO.C rename to src/fieldSources/sources/general/codedSource/CodedSourceIO.C diff --git a/src/fieldSources/general/codedSource/codedSource.C b/src/fieldSources/sources/general/codedSource/codedSource.C similarity index 100% rename from src/fieldSources/general/codedSource/codedSource.C rename to src/fieldSources/sources/general/codedSource/codedSource.C diff --git a/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.C b/src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSource.C similarity index 100% rename from src/fieldSources/general/semiImplicitSource/SemiImplicitSource.C rename to src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSource.C diff --git a/src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H b/src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSource.H similarity index 100% rename from src/fieldSources/general/semiImplicitSource/SemiImplicitSource.H rename to src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSource.H diff --git a/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H b/src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSourceI.H similarity index 100% rename from src/fieldSources/general/semiImplicitSource/SemiImplicitSourceI.H rename to src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSourceI.H diff --git a/src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.C b/src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSourceIO.C similarity index 100% rename from src/fieldSources/general/semiImplicitSource/SemiImplicitSourceIO.C rename to src/fieldSources/sources/general/semiImplicitSource/SemiImplicitSourceIO.C diff --git a/src/fieldSources/general/semiImplicitSource/semiImplicitSource.C b/src/fieldSources/sources/general/semiImplicitSource/semiImplicitSource.C similarity index 100% rename from src/fieldSources/general/semiImplicitSource/semiImplicitSource.C rename to src/fieldSources/sources/general/semiImplicitSource/semiImplicitSource.C diff --git a/src/fileFormats/Make/files b/src/fileFormats/Make/files index 7845ac93129e2050a0e8ffef4d61625bc1e96a85..37f3bc00985d82b0917bf2d4c607a57f438851b9 100644 --- a/src/fileFormats/Make/files +++ b/src/fileFormats/Make/files @@ -2,4 +2,17 @@ vtk/vtkUnstructuredReader.C nas/NASCore.C starcd/STARCDCore.C +coordSet/coordSet.C + +setWriters = sampledSetWriters + +$(setWriters)/writers.C +$(setWriters)/ensight/ensightSetWriterRunTime.C +$(setWriters)/gnuplot/gnuplotSetWriterRunTime.C +$(setWriters)/jplot/jplotSetWriterRunTime.C +$(setWriters)/raw/rawSetWriterRunTime.C +$(setWriters)/vtk/vtkSetWriterRunTime.C +$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C +$(setWriters)/csv/csvSetWriterRunTime.C + LIB = $(FOAM_LIBBIN)/libfileFormats diff --git a/src/sampling/sampledSet/coordSet/coordSet.C b/src/fileFormats/coordSet/coordSet.C similarity index 97% rename from src/sampling/sampledSet/coordSet/coordSet.C rename to src/fileFormats/coordSet/coordSet.C index fed58fc86fc66536f581c28d5dd217224b36d342..d8b37c5fdd81b864fd0622c3e6f0371db329e4ab 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.C +++ b/src/fileFormats/coordSet/coordSet.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 diff --git a/src/sampling/sampledSet/coordSet/coordSet.H b/src/fileFormats/coordSet/coordSet.H similarity index 97% rename from src/sampling/sampledSet/coordSet/coordSet.H rename to src/fileFormats/coordSet/coordSet.H index 8629f78bbe46fac480ba3f7bc3c033eead6c8116..5492f37b4351f98bbb1395118d2efd836f44a11d 100644 --- a/src/sampling/sampledSet/coordSet/coordSet.H +++ b/src/fileFormats/coordSet/coordSet.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 diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriter.C b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C similarity index 98% rename from src/sampling/sampledSet/writers/csv/csvSetWriter.C rename to src/fileFormats/sampledSetWriters/csv/csvSetWriter.C index 4cbb51a597881f58f707d55c0e0863e8b0da3ddd..c1ed54b1cd84d8e05b19fdc425f04883d55f857b 100644 --- a/src/sampling/sampledSet/writers/csv/csvSetWriter.C +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.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 diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriter.H b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/csv/csvSetWriter.H rename to src/fileFormats/sampledSetWriters/csv/csvSetWriter.H index 9c494320cb8abfc48fd6c07e08d371670df90458..8e4b9c7d70beb9bc5d159fcb49da7fdaffc37563 100644 --- a/src/sampling/sampledSet/writers/csv/csvSetWriter.H +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.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 diff --git a/src/sampling/sampledSet/writers/csv/csvSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/csv/csvSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/csv/csvSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/csv/csvSetWriterRunTime.C index 2d326f8efaee4f14b363a265a0ef19302102d0f2..ac588e395722133f986b3c75cbacd87fe4b9eaf2 100644 --- a/src/sampling/sampledSet/writers/csv/csvSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriterRunTime.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 diff --git a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C similarity index 99% rename from src/sampling/sampledSet/writers/ensight/ensightSetWriter.C rename to src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C index d481a4153206f9bdbcba3bb35bd360474e1d8fa7..4b874e201dfcc3e991f838780211a9551a5a2983 100644 --- a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.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 diff --git a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.H b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/ensight/ensightSetWriter.H rename to src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H index 5118c85faa79fbc268592aa0b37efb7c614d5608..14a735b2edc1595223369854b20204eff5895438 100644 --- a/src/sampling/sampledSet/writers/ensight/ensightSetWriter.H +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.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 diff --git a/src/sampling/sampledSet/writers/ensight/ensightSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/ensight/ensightSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/ensight/ensightSetWriterRunTime.C index b987035b332e4c01e1cb1d33f391956ff6ccb392..c529cb02e48546e2b4a12166e91ced81e87086e2 100644 --- a/src/sampling/sampledSet/writers/ensight/ensightSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriterRunTime.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 diff --git a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.C b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C similarity index 97% rename from src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.C rename to src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C index f6198d3f5ab4b49d44a9090dff2f96e8c8f49922..2679e1e70231f7b826fc7dabd229660499216a06 100644 --- a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.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 @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "gnuplotSetWriter.H" -#include "clock.H" #include "coordSet.H" #include "fileName.H" #include "OFstream.H" diff --git a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.H b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.H rename to src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H index 88e9414c85553374020cbda538433fa62425b839..74688771e87b568fe90efe6b8ffc98118c48d04f 100644 --- a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriter.H +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.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 diff --git a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriterRunTime.C index 90ee2198887d5fc9e6771fdf375c654d9344632f..4e57426359ce2dedae771297aae63ba674dfa3e9 100644 --- a/src/sampling/sampledSet/writers/gnuplot/gnuplotSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriterRunTime.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 diff --git a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.C b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C similarity index 97% rename from src/sampling/sampledSet/writers/jplot/jplotSetWriter.C rename to src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C index 98dc34bad93c55de2324cb5b0b1c4aab0d5d0f49..d71d860a26b74275ff2f35db5476602e44c8b9d8 100644 --- a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.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 diff --git a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.H b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/jplot/jplotSetWriter.H rename to src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H index bd7bc8c7834f8efd0220a35c38653e42b6c778ba..5b0945664293b4df69920a58ea913e1626e5f3f5 100644 --- a/src/sampling/sampledSet/writers/jplot/jplotSetWriter.H +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.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 diff --git a/src/sampling/sampledSet/writers/jplot/jplotSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/jplot/jplotSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/jplot/jplotSetWriterRunTime.C index e0e9ac2b5267b870de516e1ee5a9e5d263887517..7e54146fe7f7f661a0ae472ca870c1c81e57eacb 100644 --- a/src/sampling/sampledSet/writers/jplot/jplotSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriterRunTime.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 diff --git a/src/sampling/sampledSet/writers/raw/rawSetWriter.C b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C similarity index 97% rename from src/sampling/sampledSet/writers/raw/rawSetWriter.C rename to src/fileFormats/sampledSetWriters/raw/rawSetWriter.C index e259c78eaae1794e5919e6bac66478a0ec30f7e2..403b9e71116c884ba5331acc0f9806b8b9c93340 100644 --- a/src/sampling/sampledSet/writers/raw/rawSetWriter.C +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.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 diff --git a/src/sampling/sampledSet/writers/raw/rawSetWriter.H b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/raw/rawSetWriter.H rename to src/fileFormats/sampledSetWriters/raw/rawSetWriter.H index 418549d01b6a2a42727d18314badb0d89aa83db0..89c857d779c979a76fcebf24a7198f4a844fe474 100644 --- a/src/sampling/sampledSet/writers/raw/rawSetWriter.H +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.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 diff --git a/src/sampling/sampledSet/writers/raw/rawSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/raw/rawSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/raw/rawSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/raw/rawSetWriterRunTime.C index c4376c9140c1f294dc4fee32b0f75d7ee68b59f6..92a8a83354dd3d194f36d1141cea1f1f91f51f4f 100644 --- a/src/sampling/sampledSet/writers/raw/rawSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriterRunTime.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 diff --git a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.C b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C similarity index 98% rename from src/sampling/sampledSet/writers/vtk/vtkSetWriter.C rename to src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C index b865e704d496dda72bb67ef8ec24b9771ac42fea..3ab273617500d74d57bea3b7d7f677e9ce00cc7c 100644 --- a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.C +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.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 diff --git a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.H b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/vtk/vtkSetWriter.H rename to src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H index 9507fd1dc78f59618c20489cfccc480fc98a4a43..21bd80ef1e7dad0c5c49c911cdf9a09152b1e684 100644 --- a/src/sampling/sampledSet/writers/vtk/vtkSetWriter.H +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.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 diff --git a/src/sampling/sampledSet/writers/vtk/vtkSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/vtk/vtkSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/vtk/vtkSetWriterRunTime.C index 3c30764d86abf2bffd75745f2845ccc13cb1f533..e9320e5b5589bbeaee00f80c7f0b110214ee83cc 100644 --- a/src/sampling/sampledSet/writers/vtk/vtkSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriterRunTime.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 diff --git a/src/sampling/sampledSet/writers/writer.C b/src/fileFormats/sampledSetWriters/writer.C similarity index 99% rename from src/sampling/sampledSet/writers/writer.C rename to src/fileFormats/sampledSetWriters/writer.C index 69dbdec6fe7a14c5b7ec1c5834682b8f6396a316..e031615ff69acc407599b1917d1964cba6cd472a 100644 --- a/src/sampling/sampledSet/writers/writer.C +++ b/src/fileFormats/sampledSetWriters/writer.C @@ -166,7 +166,6 @@ void Foam::writer<Type>::write { valueSetPtrs[i] = &valueSets[i]; } - write(points, valueSetNames, valueSetPtrs, os); } diff --git a/src/sampling/sampledSet/writers/writer.H b/src/fileFormats/sampledSetWriters/writer.H similarity index 100% rename from src/sampling/sampledSet/writers/writer.H rename to src/fileFormats/sampledSetWriters/writer.H diff --git a/src/sampling/sampledSet/writers/writers.C b/src/fileFormats/sampledSetWriters/writers.C similarity index 96% rename from src/sampling/sampledSet/writers/writers.C rename to src/fileFormats/sampledSetWriters/writers.C index 2815bcda039f04011815a281b1d5561d244b3cd1..4bcc1b39b28b1911509a8d76a90caad28bb200c2 100644 --- a/src/sampling/sampledSet/writers/writers.C +++ b/src/fileFormats/sampledSetWriters/writers.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 diff --git a/src/sampling/sampledSet/writers/writers.H b/src/fileFormats/sampledSetWriters/writers.H similarity index 97% rename from src/sampling/sampledSet/writers/writers.H rename to src/fileFormats/sampledSetWriters/writers.H index 3adaab13fa028985d3a0552121aa6aa064a62df1..601e7bcd16108f6be6d2e74d9fb524dee6ea62b2 100644 --- a/src/sampling/sampledSet/writers/writers.H +++ b/src/fileFormats/sampledSetWriters/writers.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 diff --git a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.C b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C similarity index 98% rename from src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.C rename to src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C index 9cc44a10c38e15963fc5979711b33f0ab85bc80e..3825868196d4c6c7b256c541c3b5649b8daf5d56 100644 --- a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.C +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.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 diff --git a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.H b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H similarity index 97% rename from src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.H rename to src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H index 8e8dc67ead500e2859613b6cc9c57b1f0f96bfcc..47c36289366591a65af2a14bc0da1247c89a1e6c 100644 --- a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriter.H +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.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 diff --git a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriterRunTime.C b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriterRunTime.C similarity index 94% rename from src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriterRunTime.C rename to src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriterRunTime.C index 8e7ab61c8e2bc2b0ad489c22050c107a3c93b77a..583855fc8331b54844b07bf1bb069106e3ee11dd 100644 --- a/src/sampling/sampledSet/writers/xmgrace/xmgraceSetWriterRunTime.C +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriterRunTime.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 diff --git a/src/fileFormats/vtk/vtkUnstructuredReader.C b/src/fileFormats/vtk/vtkUnstructuredReader.C index 7efce8278bd49cfcc5653455790126fa1d95f663..f3acda065aaec4f5900ed67c8c9a23b20350c3f5 100644 --- a/src/fileFormats/vtk/vtkUnstructuredReader.C +++ b/src/fileFormats/vtk/vtkUnstructuredReader.C @@ -32,10 +32,10 @@ License /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ -defineTypeNameAndDebug(Foam::vtkUnstructuredReader, 0); - namespace Foam { + defineTypeNameAndDebug(vtkUnstructuredReader, 0); + template<> const char* NamedEnum<vtkUnstructuredReader::vtkDataType, 8>::names[] = diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 0c6e9fa2c7a14d23d7fd242892102e0d849a142d..3a82c7407beaedabb6d306bed77b1fdb6a8f0738 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -247,6 +247,7 @@ $(schemes)/harmonic/harmonic.C $(schemes)/fixedBlended/fixedBlended.C $(schemes)/localBlended/localBlended.C $(schemes)/limiterBlended/limiterBlended.C +$(schemes)/CoBlended/CoBlended.C $(schemes)/localMax/localMax.C $(schemes)/localMin/localMin.C @@ -314,7 +315,7 @@ $(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C $(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C $(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C -$(ddtSchemes)/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C +$(ddtSchemes)/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C $(ddtSchemes)/boundedDdtScheme/boundedDdtSchemes.C d2dt2Schemes = finiteVolume/d2dt2Schemes @@ -345,6 +346,7 @@ $(limitedGradSchemes)/cellMDLimitedGrad/cellMDLimitedGrads.C snGradSchemes = finiteVolume/snGradSchemes $(snGradSchemes)/snGradScheme/snGradSchemes.C $(snGradSchemes)/correctedSnGrad/correctedSnGrads.C +$(snGradSchemes)/faceCorrectedSnGrad/faceCorrectedSnGrads.C $(snGradSchemes)/limitedSnGrad/limitedSnGrads.C $(snGradSchemes)/uncorrectedSnGrad/uncorrectedSnGrads.C $(snGradSchemes)/orthogonalSnGrad/orthogonalSnGrads.C @@ -383,7 +385,8 @@ $(porosity)/fixedCoeff/fixedCoeff.C MRF = $(general)/MRF $(MRF)/MRFZone.C -$(MRF)/MRFZones.C +$(MRF)/MRFZoneList.C +$(MRF)/IOMRFZoneList.C SRF = $(general)/SRF $(SRF)/SRFModel/SRFModel/SRFModel.C diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C new file mode 100644 index 0000000000000000000000000000000000000000..c5ad7fc1040409bafa37febf262887b1bd66489c --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "IOMRFZoneList.H" +#include "fvMesh.H" +#include "Time.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +Foam::IOobject Foam::IOMRFZoneList::createIOobject +( + const fvMesh& mesh +) const +{ + IOobject io + ( + "MRFProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (io.headerOk()) + { + Info<< "Creating MRF zone list from " << io.name() << endl; + + io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + return io; + } + else + { + Info<< "No MRF models present" << nl << endl; + + io.readOpt() = IOobject::NO_READ; + return io; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::IOMRFZoneList::IOMRFZoneList +( + const fvMesh& mesh +) +: + IOdictionary(createIOobject(mesh)), + MRFZoneList(mesh, *this) +{} + + +bool Foam::IOMRFZoneList::read() +{ + if (regIOobject::read()) + { + MRFZoneList::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // + diff --git a/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H new file mode 100644 index 0000000000000000000000000000000000000000..09b6591313679bc710a84e01d22d530625f40a69 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/IOMRFZoneList.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::IOMRFZoneList + +Description + List of MRF zones with IO functionality. MRF zones are specified by a list + of dictionary entries, e.g. + + \verbatim + zone1 + { + cellZone rotor1; + active yes; + ... + } + + zone2 + { + cellZone rotor2; + active yes; + ... + } + \endverbatim + +SourceFiles + IOMRFZoneList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IOMRFZoneList_H +#define IOMRFZoneList_H + +#include "IOdictionary.H" +#include "MRFZoneList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IOMRFZoneList Declaration +\*---------------------------------------------------------------------------*/ + +class IOMRFZoneList +: + public IOdictionary, + public MRFZoneList +{ +private: + + // Private Member Functions + + //- Create IO object if dictionary is present + IOobject createIOobject(const fvMesh& mesh) const; + + //- Disallow default bitwise copy construct + IOMRFZoneList(const IOMRFZoneList&); + + //- Disallow default bitwise assignment + void operator=(const IOMRFZoneList&); + + +public: + + // Constructors + + //- Construct from mesh + IOMRFZoneList(const fvMesh& mesh); + + + //- Destructor + virtual ~IOMRFZoneList() + {} + + + // Member Functions + + //- Read dictionary + virtual bool read(); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C index 1aa6bdd0cd7bfc6048cc8aa5f1d7f7282cccc255..15c7e6cb0e68ff73070e53a77e9c74397ccd0ddc 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.C @@ -28,14 +28,15 @@ License #include "volFields.H" #include "surfaceFields.H" #include "fvMatrices.H" -#include "syncTools.H" #include "faceSet.H" #include "geometricOneField.H" - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::MRFZone, 0); +namespace Foam +{ +defineTypeNameAndDebug(MRFZone, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -144,7 +145,7 @@ void Foam::MRFZone::setMRFFaces() forAll(pp, patchFacei) { - label faceI = pp.start()+patchFacei; + label faceI = pp.start() + patchFacei; if (faceType[faceI] == 1) { @@ -173,7 +174,7 @@ void Foam::MRFZone::setMRFFaces() forAll(pp, patchFacei) { - label faceI = pp.start()+patchFacei; + label faceI = pp.start() + patchFacei; if (faceType[faceI] == 1) { @@ -228,69 +229,103 @@ void Foam::MRFZone::setMRFFaces() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is) +Foam::MRFZone::MRFZone +( + const word& name, + const fvMesh& mesh, + const dictionary& dict, + const word& cellZoneName +) : mesh_(mesh), - name_(is), - dict_(is), - cellZoneID_(mesh_.cellZones().findZoneID(name_)), + name_(name), + coeffs_(dict), + active_(true), + cellZoneName_(cellZoneName), + cellZoneID_(), excludedPatchNames_ ( - dict_.lookupOrDefault("nonRotatingPatches", wordList(0)) + coeffs_.lookupOrDefault("nonRotatingPatches", wordList(0)) ), - origin_(dict_.lookup("origin")), - axis_(dict_.lookup("axis")), - omega_(DataEntry<scalar>::New("omega", dict_)) + origin_(coeffs_.lookup("origin")), + axis_(coeffs_.lookup("axis")), + omega_(DataEntry<scalar>::New("omega", coeffs_)) { - if (dict_.found("patches")) + if (cellZoneName_ == word::null) { - WarningIn("MRFZone(const fvMesh&, Istream&)") - << "Ignoring entry 'patches'\n" - << " By default all patches within the rotating region rotate.\n" - << " Optionally supply excluded patches " - << "using 'nonRotatingPatches'." - << endl; + coeffs_.lookup("active") >> active_; + coeffs_.lookup("cellZone") >> cellZoneName_; } - const polyBoundaryMesh& patches = mesh_.boundaryMesh(); + if (!active_) + { + cellZoneID_ = -1; + } + else + { + cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); - axis_ = axis_/mag(axis_); + const polyBoundaryMesh& patches = mesh_.boundaryMesh(); - excludedPatchLabels_.setSize(excludedPatchNames_.size()); + axis_ = axis_/mag(axis_); - forAll(excludedPatchNames_, i) - { - excludedPatchLabels_[i] = patches.findPatchID(excludedPatchNames_[i]); + excludedPatchLabels_.setSize(excludedPatchNames_.size()); + + forAll(excludedPatchNames_, i) + { + excludedPatchLabels_[i] = + patches.findPatchID(excludedPatchNames_[i]); + + if (excludedPatchLabels_[i] == -1) + { + FatalErrorIn + ( + "MRFZone" + "(" + "const word&, " + "const fvMesh&, " + "const dictionary&, " + "const word&" + ")" + ) + << "cannot find MRF patch " << excludedPatchNames_[i] + << exit(FatalError); + } + } - if (excludedPatchLabels_[i] == -1) + bool cellZoneFound = (cellZoneID_ != -1); + + reduce(cellZoneFound, orOp<bool>()); + + if (!cellZoneFound) { FatalErrorIn ( - "Foam::MRFZone::MRFZone(const fvMesh&, Istream&)" - ) << "cannot find MRF patch " << excludedPatchNames_[i] + "MRFZone" + "(" + "const word&, " + "const fvMesh&, " + "const dictionary&, " + "const word&" + ")" + ) + << "cannot find MRF cellZone " << cellZoneName_ << exit(FatalError); } - } - bool cellZoneFound = (cellZoneID_ != -1); - - reduce(cellZoneFound, orOp<bool>()); - - if (!cellZoneFound) - { - FatalErrorIn - ( - "Foam::MRFZone::MRFZone(const fvMesh&, Istream&)" - ) << "cannot find MRF cellZone " << name_ - << exit(FatalError); + setMRFFaces(); } - - setMRFFaces(); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::vector Foam::MRFZone::Omega() const +{ + return omega_->value(mesh_.time().timeOutputValue())*axis_; +} + + void Foam::MRFZone::addCoriolis ( const volVectorField& U, @@ -307,7 +342,7 @@ void Foam::MRFZone::addCoriolis vectorField& ddtUc = ddtU.internalField(); const vectorField& Uc = U.internalField(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); forAll(cells, i) { @@ -317,7 +352,7 @@ void Foam::MRFZone::addCoriolis } -void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const +void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn, const bool rhs) const { if (cellZoneID_ == -1) { @@ -329,12 +364,23 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); - forAll(cells, i) + if (rhs) { - label celli = cells[i]; - Usource[celli] -= V[celli]*(Omega ^ U[celli]); + forAll(cells, i) + { + label celli = cells[i]; + Usource[celli] += V[celli]*(Omega ^ U[celli]); + } + } + else + { + forAll(cells, i) + { + label celli = cells[i]; + Usource[celli] -= V[celli]*(Omega ^ U[celli]); + } } } @@ -342,7 +388,8 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const void Foam::MRFZone::addCoriolis ( const volScalarField& rho, - fvVectorMatrix& UEqn + fvVectorMatrix& UEqn, + const bool rhs ) const { if (cellZoneID_ == -1) @@ -355,12 +402,23 @@ void Foam::MRFZone::addCoriolis vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); - forAll(cells, i) + if (rhs) { - label celli = cells[i]; - Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]); + forAll(cells, i) + { + label celli = cells[i]; + Usource[celli] += V[celli]*rho[celli]*(Omega ^ U[celli]); + } + } + else + { + forAll(cells, i) + { + label celli = cells[i]; + Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]); + } } } @@ -369,7 +427,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const { const volVectorField& C = mesh_.C(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); const labelList& cells = mesh_.cellZones()[cellZoneID_]; @@ -407,7 +465,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const { const volVectorField& C = mesh_.C(); - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); const labelList& cells = mesh_.cellZones()[cellZoneID_]; @@ -475,7 +533,7 @@ void Foam::MRFZone::absoluteFlux void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const { - const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_; + const vector Omega = this->Omega(); // Included patches @@ -497,24 +555,37 @@ void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const } -Foam::Ostream& Foam::operator<<(Ostream& os, const MRFZone& MRF) +void Foam::MRFZone::writeData(Ostream& os) const { - os << indent << nl; - os.write(MRF.name_) << nl; + os << nl; + os.write(name_) << nl; os << token::BEGIN_BLOCK << incrIndent << nl; - os.writeKeyword("origin") << MRF.origin_ << token::END_STATEMENT << nl; - os.writeKeyword("axis") << MRF.axis_ << token::END_STATEMENT << nl; - MRF.omega_->writeData(os); + os.writeKeyword("active") << active_ << token::END_STATEMENT << nl; + os.writeKeyword("cellZone") << cellZoneName_ << token::END_STATEMENT << nl; + os.writeKeyword("origin") << origin_ << token::END_STATEMENT << nl; + os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl; + omega_->writeData(os); - if (MRF.excludedPatchNames_.size()) + if (excludedPatchNames_.size()) { - os.writeKeyword("nonRotatingPatches") << MRF.excludedPatchNames_ + os.writeKeyword("nonRotatingPatches") << excludedPatchNames_ << token::END_STATEMENT << nl; } os << decrIndent << token::END_BLOCK << nl; +} + + +bool Foam::MRFZone::read(const dictionary& dict) +{ + coeffs_ = dict; + + active_ = readBool(coeffs_.lookup("active")); + coeffs_.lookup("cellZone") >> cellZoneName_; + cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_); - return os; + return true; } + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H index 46fb94c39aa16fb43c700e8fb9f4e19d0e87e9d6..5d379f2e40a8adb56fdd4613e6d9150d08d20b13 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZone.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZone.H @@ -47,7 +47,7 @@ SourceFiles #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" #include "fvMatricesFwd.H" -#include "fvMatrices.H" +#include "mapPolyMesh.H" #include "DataEntry.H" #include "autoPtr.H" @@ -67,12 +67,22 @@ class MRFZone { // Private data + //- Reference to the mesh database const fvMesh& mesh_; + //- Name of the MRF region const word name_; - const dictionary dict_; + //- Coefficients dictionary + dictionary coeffs_; + //- MRF region active flag + bool active_; + + //- Name of cell zone + word cellZoneName_; + + //- Cell zone ID label cellZoneID_; const wordList excludedPatchNames_; @@ -133,8 +143,14 @@ public: // Constructors - //- Construct from fvMesh and Istream - MRFZone(const fvMesh& mesh, Istream& is); + //- Construct from fvMesh + MRFZone + ( + const word& name, + const fvMesh& mesh, + const dictionary& dict, + const word& cellZoneName = word::null + ); //- Return clone autoPtr<MRFZone> clone() const @@ -143,79 +159,91 @@ public: return autoPtr<MRFZone>(NULL); } - //- Return a pointer to a new MRFZone created on freestore - // from Istream - class iNew - { - const fvMesh& mesh_; - - public: - - iNew(const fvMesh& mesh) - : - mesh_(mesh) - {} - - autoPtr<MRFZone> operator()(Istream& is) const - { - return autoPtr<MRFZone>(new MRFZone(mesh_, is)); - } - }; - // Member Functions - //- Update the mesh corresponding to given map - void updateMesh(const mapPolyMesh& mpm) - { - // Only updates face addressing - setMRFFaces(); - } - - //- Add the Coriolis force contribution to the acceleration field - void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; + // Access - //- Add the Coriolis force contribution to the momentum equation - void addCoriolis(fvVectorMatrix& UEqn) const; + //- Return const access to the MRF region name + inline const word& name() const; - //- Add the Coriolis force contribution to the momentum equation - void addCoriolis(const volScalarField& rho, fvVectorMatrix& UEqn) const; + //- Return const access to the MRF active flag + inline bool active() const; - //- Make the given absolute velocity relative within the MRF region - void relativeVelocity(volVectorField& U) const; + //- Return the current Omega vector + vector Omega() const; - //- Make the given relative velocity absolute within the MRF region - void absoluteVelocity(volVectorField& U) const; - //- Make the given absolute flux relative within the MRF region - void relativeFlux(surfaceScalarField& phi) const; - - //- Make the given absolute mass-flux relative within the MRF region - void relativeFlux - ( - const surfaceScalarField& rho, - surfaceScalarField& phi - ) const; - - //- Make the given relative flux absolute within the MRF region - void absoluteFlux(surfaceScalarField& phi) const; - - //- Make the given relative mass-flux absolute within the MRF region - void absoluteFlux - ( - const surfaceScalarField& rho, - surfaceScalarField& phi - ) const; - - //- Correct the boundary velocity for the roation of the MRF region - void correctBoundaryVelocity(volVectorField& U) const; - - - // IOstream operator - - friend Ostream& operator<<(Ostream& os, const MRFZone& MRF); + // Evaluation + //- Update the mesh corresponding to given map + void updateMesh(const mapPolyMesh& mpm) + { + // Only updates face addressing + setMRFFaces(); + } + //- Add the Coriolis force contribution to the acceleration field + void addCoriolis + ( + const volVectorField& U, + volVectorField& ddtU + ) const; + + //- Add the Coriolis force contribution to the momentum equation + // Adds to the lhs of the equation; optionally add to rhs + void addCoriolis + ( + fvVectorMatrix& UEqn, + const bool rhs = false + ) const; + + //- Add the Coriolis force contribution to the momentum equation + // Adds to the lhs of the equation; optionally add to rhs + void addCoriolis + ( + const volScalarField& rho, + fvVectorMatrix& UEqn, + const bool rhs = false + ) const; + + //- Make the given absolute velocity relative within the MRF region + void relativeVelocity(volVectorField& U) const; + + //- Make the given relative velocity absolute within the MRF region + void absoluteVelocity(volVectorField& U) const; + + //- Make the given absolute flux relative within the MRF region + void relativeFlux(surfaceScalarField& phi) const; + + //- Make the given absolute mass-flux relative within the MRF region + void relativeFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Make the given relative flux absolute within the MRF region + void absoluteFlux(surfaceScalarField& phi) const; + + //- Make the given relative mass-flux absolute within the MRF region + void absoluteFlux + ( + const surfaceScalarField& rho, + surfaceScalarField& phi + ) const; + + //- Correct the boundary velocity for the roation of the MRF region + void correctBoundaryVelocity(volVectorField& U) const; + + + // I-O + + //- Write + void writeData(Ostream& os) const; + + //- Read MRF dictionary + bool read(const dictionary& dict); }; @@ -231,6 +259,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "MRFZoneI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H b/src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H new file mode 100644 index 0000000000000000000000000000000000000000..705d11d0af2ebdc74fcba597f126b257a094e967 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneI.H @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +inline const Foam::word& Foam::MRFZone::name() const +{ + return name_; +} + + +inline bool Foam::MRFZone::active() const +{ + return active_; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C similarity index 50% rename from src/finiteVolume/cfdTools/general/MRF/MRFZones.C rename to src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C index fa35898f0e611b20448ba25ab1655f62e6c5c0c7..9d111be38073b67ea9110d9d0de5bad1161a2410 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,59 +23,109 @@ License \*---------------------------------------------------------------------------*/ -#include "MRFZones.H" -#include "Time.H" -#include "fvMesh.H" +#include "MRFZoneList.H" +#include "volFields.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -namespace Foam +Foam::MRFZoneList::MRFZoneList +( + const fvMesh& mesh, + const dictionary& dict +) +: + PtrList<MRFZone>(), + mesh_(mesh) { - defineTemplateTypeNameAndDebug(IOPtrList<MRFZone>, 0); + reset(dict); + + active(true); } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::MRFZones::MRFZones(const fvMesh& mesh) -: - IOPtrList<MRFZone> - ( - IOobject - ( - "MRFZones", - mesh.time().constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ), - MRFZone::iNew(mesh) - ), - mesh_(mesh) +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::MRFZoneList::~MRFZoneList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::MRFZoneList::active(const bool warn) const { - if - ( - Pstream::parRun() - && - ( - regIOobject::fileModificationChecking == timeStampMaster - || regIOobject::fileModificationChecking == inotifyMaster - ) - ) + bool a = false; + forAll(*this, i) + { + a = a || this->operator[](i).active(); + } + + if (warn && this->size() && !a) { - WarningIn("MRFZones(const fvMesh&)") - << "The MRFZones are not run time modifiable\n" - << " using 'timeStampMaster' or 'inotifyMaster'\n" - << " for the entry fileModificationChecking\n" - << " in the etc/controlDict.\n" - << " Use 'timeStamp' instead." - << endl; + Info<< " No MRF zones active" << endl; } + + return a; } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::MRFZoneList::reset(const dictionary& dict) +{ + label count = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + count++; + } + } -void Foam::MRFZones::addCoriolis + this->setSize(count); + label i = 0; + forAllConstIter(dictionary, dict, iter) + { + if (iter().isDict()) + { + const word& name = iter().keyword(); + const dictionary& modelDict = iter().dict(); + + Info<< " creating MRF zone: " << name << endl; + + this->set + ( + i++, + new MRFZone(name, mesh_, modelDict) + ); + } + } +} + + +bool Foam::MRFZoneList::read(const dictionary& dict) +{ + bool allOk = true; + forAll(*this, i) + { + MRFZone& pm = this->operator[](i); + bool ok = pm.read(dict.subDict(pm.name())); + allOk = (allOk && ok); + } + return allOk; +} + + +bool Foam::MRFZoneList::writeData(Ostream& os) const +{ + forAll(*this, i) + { + os << nl; + this->operator[](i).writeData(os); + } + + return os.good(); +} + + +void Foam::MRFZoneList::addCoriolis ( const volVectorField& U, volVectorField& ddtU @@ -88,7 +138,7 @@ void Foam::MRFZones::addCoriolis } -void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const +void Foam::MRFZoneList::addCoriolis(fvVectorMatrix& UEqn) const { forAll(*this, i) { @@ -97,7 +147,7 @@ void Foam::MRFZones::addCoriolis(fvVectorMatrix& UEqn) const } -void Foam::MRFZones::addCoriolis +void Foam::MRFZoneList::addCoriolis ( const volScalarField& rho, fvVectorMatrix& UEqn @@ -110,7 +160,7 @@ void Foam::MRFZones::addCoriolis } -void Foam::MRFZones::relativeVelocity(volVectorField& U) const +void Foam::MRFZoneList::relativeVelocity(volVectorField& U) const { forAll(*this, i) { @@ -119,7 +169,7 @@ void Foam::MRFZones::relativeVelocity(volVectorField& U) const } -void Foam::MRFZones::absoluteVelocity(volVectorField& U) const +void Foam::MRFZoneList::absoluteVelocity(volVectorField& U) const { forAll(*this, i) { @@ -128,7 +178,7 @@ void Foam::MRFZones::absoluteVelocity(volVectorField& U) const } -void Foam::MRFZones::relativeFlux(surfaceScalarField& phi) const +void Foam::MRFZoneList::relativeFlux(surfaceScalarField& phi) const { forAll(*this, i) { @@ -137,7 +187,7 @@ void Foam::MRFZones::relativeFlux(surfaceScalarField& phi) const } -void Foam::MRFZones::relativeFlux +void Foam::MRFZoneList::relativeFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -150,7 +200,7 @@ void Foam::MRFZones::relativeFlux } -void Foam::MRFZones::absoluteFlux(surfaceScalarField& phi) const +void Foam::MRFZoneList::absoluteFlux(surfaceScalarField& phi) const { forAll(*this, i) { @@ -159,7 +209,7 @@ void Foam::MRFZones::absoluteFlux(surfaceScalarField& phi) const } -void Foam::MRFZones::absoluteFlux +void Foam::MRFZoneList::absoluteFlux ( const surfaceScalarField& rho, surfaceScalarField& phi @@ -172,7 +222,7 @@ void Foam::MRFZones::absoluteFlux } -void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const +void Foam::MRFZoneList::correctBoundaryVelocity(volVectorField& U) const { forAll(*this, i) { @@ -181,10 +231,16 @@ void Foam::MRFZones::correctBoundaryVelocity(volVectorField& U) const } -bool Foam::MRFZones::readData(Istream& is) +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const MRFZoneList& models +) { - PtrList<MRFZone>::read(is, MRFZone::iNew(mesh_)); - return is.good(); + models.writeData(os); + return os; } diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H similarity index 72% rename from src/finiteVolume/cfdTools/general/MRF/MRFZones.H rename to src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H index f5b43bce290df8d1703d86698a5196325607b6c8..a2311c52c892686f445fdbbafc4efc919539c4fb 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZones.H +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,61 +22,77 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::MRFZones + Foam::MRFZoneList Description - Container class for a set of MRFZones with the MRFZone member functions - implemented to loop over the functions for each MRFZone. + List container for MRF zomes SourceFiles - MRFZones.C + MRFZoneList.C \*---------------------------------------------------------------------------*/ -#ifndef MRFZones_H -#define MRFZones_H +#ifndef MRFZoneList_H +#define MRFZoneList_H +#include "fvMesh.H" +#include "dictionary.H" +#include "fvMatricesFwd.H" #include "MRFZone.H" -#include "IOPtrList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward declaration of friend functions and operators +class MRFZoneList; +Ostream& operator<<(Ostream& os, const MRFZoneList& models); + /*---------------------------------------------------------------------------*\ - Class MRFZones Declaration + Class MRFZoneList Declaration \*---------------------------------------------------------------------------*/ -class MRFZones +class MRFZoneList : - public IOPtrList<MRFZone> + PtrList<MRFZone> { - // Private data - - //- Reference to mesh - const fvMesh& mesh_; - +private: // Private Member Functions //- Disallow default bitwise copy construct - MRFZones(const MRFZones&); + MRFZoneList(const MRFZoneList&); //- Disallow default bitwise assignment - void operator=(const MRFZones&); + void operator=(const MRFZoneList&); + + +protected: + + // Protected data + + //- Reference to the mesh database + const fvMesh& mesh_; public: - // Constructors + //- Constructor + MRFZoneList(const fvMesh& mesh, const dictionary& dict); - //- Construct from fvMesh - MRFZones(const fvMesh& mesh); + //- Destructor + ~MRFZoneList(); // Member Functions + //- Return active status + bool active(const bool warn = false) const; + + //- Reset the source list + void reset(const dictionary& dict); + //- Add the Coriolis force contribution to the acceleration field void addCoriolis(const volVectorField& U, volVectorField& ddtU) const; @@ -116,13 +132,21 @@ public: void correctBoundaryVelocity(volVectorField& U) const; - // I-O + // I-O - //- Read from Istream - virtual bool readData(Istream&); + //- Read dictionary + bool read(const dictionary& dict); -}; + //- Write data to Ostream + bool writeData(Ostream& os) const; + //- Ostream operator + friend Ostream& operator<< + ( + Ostream& os, + const MRFZoneList& models + ); +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C index f15aef2647cd48d54ba242547a95a436c6648d7f..bc0087826c9af18eef9cee6a1267e3019c1e3bad 100644 --- a/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C +++ b/src/finiteVolume/cfdTools/general/MRF/MRFZoneTemplates.C @@ -27,7 +27,7 @@ License #include "fvMesh.H" #include "volFields.H" #include "surfaceFields.H" -#include "geometricOneField.H" +#include "fvMatrices.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C index 36a9ba7ada0bccd2e0af5e6bceb534580278835e..b0857fa78ed849978a61a5133c035dedf5352296 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.C @@ -47,15 +47,16 @@ Foam::porosityModels::DarcyForchheimer::DarcyForchheimer const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ) : - porosityModel(name, modelType, mesh, dict), + porosityModel(name, modelType, mesh, dict, cellZoneName), coordSys_(coeffs_, mesh), D_("D", dimless/sqr(dimLength), tensor::zero), F_("F", dimless/dimLength, tensor::zero), rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")), - muName_(coeffs_.lookupOrDefault<word>("mu", "mu")), + muName_(coeffs_.lookupOrDefault<word>("mu", "thermo:mu")), nuName_(coeffs_.lookupOrDefault<word>("nu", "nu")) { // local-to-global transformation tensor diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H index a85fae7fc66af9352cc56867fdfe1de21b31c6fe..ab3007d204df0675ba4eb60e35a0b2d3540f2ad6 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H @@ -136,7 +136,8 @@ public: const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ); //- Destructor diff --git a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C index 55c4202d5a27c5466ce68593f4da8980cda39ae3..59cef7436869d4761b80f3a424b91db80c648da3 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C @@ -102,10 +102,11 @@ Foam::porosityModels::fixedCoeff::fixedCoeff const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ) : - porosityModel(name, modelType, mesh, dict), + porosityModel(name, modelType, mesh, dict, cellZoneName), coordSys_(coeffs_, mesh), alpha_("alpha", dimless/dimTime, tensor::zero), beta_("beta", dimless/dimLength, tensor::zero) diff --git a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H index c0e28ac87e31bec4a4ac20085b6562e2ae6e701d..61f4c36224db92adf8065daec6835f0703a0f424 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H @@ -113,7 +113,8 @@ public: const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ); //- Destructor diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C index f0997c822211a116787e1990364ad82955b952f0..77de5b1ffecd0ada7aa9ff1e50801b48f8d130e4 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -73,17 +73,26 @@ Foam::porosityModel::porosityModel const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ) : name_(name), mesh_(mesh), dict_(dict), coeffs_(dict.subDict(modelType + "Coeffs")), - active_(readBool(dict_.lookup("active"))), - zoneName_(dict_.lookup("cellZone")), - cellZoneIds_(mesh_.cellZones().findIndices(zoneName_)) + active_(true), + zoneName_(cellZoneName), + cellZoneIds_() { + if (zoneName_ == word::null) + { + dict.lookup("active") >> active_; + dict_.lookup("cellZone") >> zoneName_; + } + + cellZoneIds_ = mesh_.cellZones().findIndices(zoneName_); + Info<< " creating porous zone: " << zoneName_ << endl; bool foundZone = !cellZoneIds_.empty(); @@ -99,6 +108,7 @@ Foam::porosityModel::porosityModel "const word&, " "const fvMesh&, " "const dictionary&" + "const word&, " ")" ) << "cannot find porous cellZone " << zoneName_ << exit(FatalError); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H index 56131ba3dd97cd5c287f699acc9eb3f9fcce153c..1c61e29f1812f77ed002260ce8db43e43aecb9f0 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H @@ -127,9 +127,10 @@ public: const word& modelName, const word& name, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ), - (modelName, name, mesh, dict) + (modelName, name, mesh, dict, cellZoneName) ); //- Constructor @@ -138,7 +139,8 @@ public: const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName = word::null ); //- Return pointer to new porosityModel object created on the freestore @@ -182,7 +184,8 @@ public: ( const word& name, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName = word::null ); //- Destructor diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C index 14ab39d96436521ad20c9db8cdeef36972d4fc86..df3028547cb2c9e835cb4727af38cb90f6f7e24d 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C @@ -26,12 +26,6 @@ License #include "porosityModelList.H" #include "volFields.H" -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // -/* -void Foam::porosityModelList::XXX() -{} -*/ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::porosityModelList::porosityModelList @@ -44,6 +38,8 @@ Foam::porosityModelList::porosityModelList mesh_(mesh) { reset(dict); + + active(true); } @@ -55,7 +51,7 @@ Foam::porosityModelList::~porosityModelList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::porosityModelList::active() const +bool Foam::porosityModelList::active(const bool warn) const { bool a = false; forAll(*this, i) @@ -63,7 +59,7 @@ bool Foam::porosityModelList::active() const a = a || this->operator[](i).active(); } - if (!a) + if (warn && this->size() && !a) { Info<< "No porosity models active" << endl; } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H index e580a2d0fadd7c46a0df99d1acc83f4c00e203a0..3d0d015923957f2923eebed5e7625c74acb9bdab 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H @@ -88,7 +88,7 @@ public: // Member Functions //- Return active status - bool active() const; + bool active(const bool active = false) const; //- Reset the source list void reset(const dictionary& dict); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C index 1da8c91c4dfb583e022ce27059a0abaee880e63e..d0fe203537f3fe6ae7f79d61990ff35d49d8794d 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C @@ -31,7 +31,8 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New ( const word& name, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ) { const word modelType(dict.lookup("type")); @@ -48,9 +49,10 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New ( "porosityModel::New" "(" - "const word& name," + "const word&, " "const fvMesh&, " - "const dictionary&" + "const dictionary&, " + "const word&" ")" ) << "Unknown " << typeName << " type " << modelType << nl << nl @@ -59,7 +61,17 @@ Foam::autoPtr<Foam::porosityModel> Foam::porosityModel::New << exit(FatalError); } - return autoPtr<porosityModel>(cstrIter()(name, modelType, mesh, dict)); + return autoPtr<porosityModel> + ( + cstrIter() + ( + name, + modelType, + mesh, + dict, + cellZoneName + ) + ); } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C index 15fbae39dfb78486fe133002bb94ef1990956ec1..2516c8c6b2010ac599bbec1dfc6237992f1df862 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C @@ -47,10 +47,11 @@ Foam::porosityModels::powerLaw::powerLaw const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ) : - porosityModel(name, modelType, mesh, dict), + porosityModel(name, modelType, mesh, dict, cellZoneName), C0_(readScalar(coeffs_.lookup("C0"))), C1_(readScalar(coeffs_.lookup("C1"))), rhoName_(coeffs_.lookupOrDefault<word>("rho", "rho")) diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H index 2c26946265728b207391fc08149704e160e1ca7d..fb0797aaa733edbabeccecc710b368b0958c98b3 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H @@ -117,7 +117,8 @@ public: const word& name, const word& modelType, const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& cellZoneName ); //- Destructor diff --git a/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C index b612efbc1d93a888ca62e9f7434353effb64b6a8..4c40b1ef7cce4f2cce6da9186d83cac050ba508e 100644 --- a/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/basic/basicSymmetry/basicSymmetryFvPatchField.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 @@ -96,11 +96,11 @@ Foam::basicSymmetryFvPatchField<Type>::snGrad() const { tmp<vectorField> nHat = this->patch().nf(); + const Field<Type> iF(this->patchInternalField()); + return - ( - transform(I - 2.0*sqr(nHat), this->patchInternalField()) - - this->patchInternalField() - )*(this->patch().deltaCoeffs()/2.0); + (transform(I - 2.0*sqr(nHat), iF) - iF) + *(this->patch().deltaCoeffs()/2.0); } @@ -114,12 +114,11 @@ void Foam::basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes) tmp<vectorField> nHat = this->patch().nf(); + const Field<Type> iF(this->patchInternalField()); + Field<Type>::operator= ( - ( - this->patchInternalField() - + transform(I - 2.0*sqr(nHat), this->patchInternalField()) - )/2.0 + (iF + transform(I - 2.0*sqr(nHat), iF))/2.0 ); transformFvPatchField<Type>::evaluate(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C index 5764676b2a896686cbf4a85d6faf8605b1807608..86c7aaa146310fe6be44602c9ad9fe041e1ad52a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" @@ -229,7 +229,7 @@ void Foam::advectiveFvPatchField<Type>::updateCoeffs() if ( ddtScheme == fv::EulerDdtScheme<scalar>::typeName - || ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName + || ddtScheme == fv::CrankNicolsonDdtScheme<scalar>::typeName ) { this->refValue() = @@ -266,7 +266,7 @@ void Foam::advectiveFvPatchField<Type>::updateCoeffs() if ( ddtScheme == fv::EulerDdtScheme<scalar>::typeName - || ddtScheme == fv::CrankNicholsonDdtScheme<scalar>::typeName + || ddtScheme == fv::CrankNicolsonDdtScheme<scalar>::typeName ) { this->refValue() = field.oldTime().boundaryField()[patchi]; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H index 5c62df1049fee116021c0d744b2751ab70533425..3b4e0f1b5c2d8e686c2648d80450bdd2562ec3d2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/advective/advectiveFvPatchField.H @@ -31,7 +31,7 @@ Description This boundary condition provides an advective outflow condition, based on solving DDt(psi, U) = 0 at the boundary. - The standard (Euler, backward, CrankNicholson) time schemes are + The standard (Euler, backward, CrankNicolson) time schemes are supported. Additionally an optional mechanism to relax the value at the boundary to a specified far-field value is provided which is switched on by specifying the relaxation length-scale \c lInf and the diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C index 9ef4be21a407f055c7f5831627e1e14a4120e49f..c9d6e367cc8f9035481031807d2dc44510c37432 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C @@ -62,8 +62,25 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField ) : jumpCyclicFvPatchField<Type>(p, iF), - jump_("jump", dict, p.size()) -{} + jump_(p.size(), pTraits<Type>::zero) +{ + if (this->cyclicPatch().owner()) + { + jump_ = Field<Type>("jump", dict, p.size()); + } + + if (dict.found("value")) + { + fvPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::blocking); + } +} template<class Type> @@ -140,7 +157,12 @@ void Foam::fixedJumpFvPatchField<Type>::write(Ostream& os) const fvPatchField<Type>::write(os); os.writeKeyword("patchType") << this->interfaceFieldType() << token::END_STATEMENT << nl; - jump_.writeEntry("jump", os); + + if (this->cyclicPatch().owner()) + { + jump_.writeEntry("jump", os); + } + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C index 4c3290cf2d7e1d5a8b4c5006cd9c69601bab82fe..cc9717ffac9736ea2fcbebc77de604206835d2f6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C @@ -62,8 +62,25 @@ Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField ) : jumpCyclicAMIFvPatchField<Type>(p, iF), - jump_("jump", dict, p.size()) -{} + jump_(p.size(), pTraits<Type>::zero) +{ + if (this->cyclicAMIPatch().owner()) + { + jump_ = Field<Type>("jump", dict, p.size()); + } + + if (dict.found("value")) + { + fvPatchField<Type>::operator= + ( + Field<Type>("value", dict, p.size()) + ); + } + else + { + this->evaluate(Pstream::blocking); + } +} template<class Type> @@ -143,7 +160,12 @@ void Foam::fixedJumpAMIFvPatchField<Type>::write(Ostream& os) const fvPatchField<Type>::write(os); os.writeKeyword("patchType") << this->interfaceFieldType() << token::END_STATEMENT << nl; - jump_.writeEntry("jump", os); + + if (this->cyclicAMIPatch().owner()) + { + jump_.writeEntry("jump", os); + } + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C index 930a931206a754ebd5711cc16f3463ab6346e02f..77cc8d61a9d8dad64d7cf0935df71d716bf1d167 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.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 @@ -308,8 +308,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs() } case mappedPatchBase::NEARESTFACE: { - const mapDistribute& distMap = mpp.map(); - Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero); const fieldType& nbrField = sampleField(); @@ -326,7 +324,7 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs() } } - distMap.distribute(allValues); + mpp.distribute(allValues); newValues.transfer(allValues); break; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index cd94de26cabf8665aff06ae6227c967b9040ee65..11f811e4433bbad23b2372a5842fd1efaa4866f3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -105,32 +105,38 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs() return; } - const fvPatch& p = patch(); - const polyPatch& pp = p.patch(); const fvMesh& mesh = dimensionedInternalField().mesh(); - const pointField& oldPoints = mesh.oldPoints(); - vectorField oldFc(pp.size()); - - forAll(oldFc, i) + if (mesh.changing()) { - oldFc[i] = pp[i].centre(oldPoints); - } + const fvPatch& p = patch(); + const polyPatch& pp = p.patch(); + const pointField& oldPoints = mesh.oldPoints(); - const vectorField Up((pp.faceCentres() - oldFc)/mesh.time().deltaTValue()); + vectorField oldFc(pp.size()); - const volVectorField& U = db().lookupObject<volVectorField>(UName_); - scalarField phip - ( - p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)) - ); + forAll(oldFc, i) + { + oldFc[i] = pp[i].centre(oldPoints); + } - const vectorField n(p.nf()); - const scalarField& magSf = p.magSf(); - tmp<scalarField> Un = phip/(magSf + VSMALL); + const scalar deltaT = mesh.time().deltaTValue(); + const vectorField Up((pp.faceCentres() - oldFc)/deltaT); - vectorField::operator=(Up + n*(Un - (n & Up))); + const volVectorField& U = db().lookupObject<volVectorField>(UName_); + scalarField phip + ( + p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)) + ); + + const vectorField n(p.nf()); + const scalarField& magSf = p.magSf(); + tmp<scalarField> Un = phip/(magSf + VSMALL); + + + vectorField::operator=(Up + n*(Un - (n & Up))); + } fixedValueFvPatchVectorField::updateCoeffs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C index 2d0c3d4735908ebaa99bc81fba83a38d9f8aa449..9ce17a2025eb251598ac6600470859b15625bb54 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,7 +41,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho") + rhoName_("rho"), + UName_("U") { refValue() = *this; refGrad() = vector::zero; @@ -60,7 +61,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_) + rhoName_(ptf.rhoName_), + UName_(ptf.UName_) {} @@ -74,7 +76,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + UName_(dict.lookupOrDefault<word>("U", "U")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); refValue() = *this; @@ -91,7 +94,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_) + rhoName_(pivpvf.rhoName_), + UName_(pivpvf.UName_) {} @@ -104,7 +108,8 @@ pressureInletOutletParSlipVelocityFvPatchVectorField : mixedFvPatchVectorField(pivpvf, iF), phiName_(pivpvf.phiName_), - rhoName_(pivpvf.rhoName_) + rhoName_(pivpvf.rhoName_), + UName_(pivpvf.UName_) {} @@ -128,7 +133,7 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() tmp<vectorField> n = patch().nf(); const Field<scalar>& magS = patch().magSf(); - const volVectorField& U = db().lookupObject<volVectorField>("U"); + const volVectorField& U = db().lookupObject<volVectorField>(UName_); vectorField Uc(U.boundaryField()[patchI].patchInternalField()); Uc -= n()*(Uc & n()); @@ -169,8 +174,9 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::write ) const { fvPatchVectorField::write(os); - os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl; - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + writeEntryIfDifferent<word>(os, "U", "U", UName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H index f1f2f3a9d3325ad0bf989a056ec46999a0660756..5a485362d59ccef07936cb892b5fa6199c1fc10d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/pressureInletOutletParSlipVelocity/pressureInletOutletParSlipVelocityFvPatchVectorField.H @@ -41,6 +41,7 @@ Description Property | Description | Required | Default value phi | flux field name | no | phi rho | density field name | no | rho + U | velocity field name | no | U \endtable Example of the boundary condition specification: @@ -48,8 +49,6 @@ Description myPatch { type pressureInletOutletParSlipVelocity; - phi phi; - rho rho; value uniform 0; } \endverbatim @@ -96,6 +95,9 @@ class pressureInletOutletParSlipVelocityFvPatchVectorField //- Density field name word rhoName_; + //- Velocity field name + word UName_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C index 32c9fc4264f261d7432bca3461d905d9a6a55378..2f2195c8ff3863754a68d31180e94656fc96adbb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.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 @@ -38,6 +38,9 @@ supersonicFreestreamFvPatchVectorField ) : mixedFvPatchVectorField(p, iF), + TName_("T"), + pName_("p"), + psiName_("thermo:psi"), UInf_(vector::zero), pInf_(0), TInf_(0), @@ -59,6 +62,9 @@ supersonicFreestreamFvPatchVectorField ) : mixedFvPatchVectorField(ptf, p, iF, mapper), + TName_(ptf.TName_), + pName_(ptf.pName_), + psiName_(ptf.psiName_), UInf_(ptf.UInf_), pInf_(ptf.pInf_), TInf_(ptf.TInf_), @@ -75,6 +81,9 @@ supersonicFreestreamFvPatchVectorField ) : mixedFvPatchVectorField(p, iF), + TName_(dict.lookupOrDefault<word>("T", "T")), + pName_(dict.lookupOrDefault<word>("p", "p")), + psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), UInf_(dict.lookup("UInf")), pInf_(readScalar(dict.lookup("pInf"))), TInf_(readScalar(dict.lookup("TInf"))), @@ -120,6 +129,9 @@ supersonicFreestreamFvPatchVectorField ) : mixedFvPatchVectorField(sfspvf), + TName_(sfspvf.TName_), + pName_(sfspvf.pName_), + psiName_(sfspvf.psiName_), UInf_(sfspvf.UInf_), pInf_(sfspvf.pInf_), TInf_(sfspvf.TInf_), @@ -135,6 +147,9 @@ supersonicFreestreamFvPatchVectorField ) : mixedFvPatchVectorField(sfspvf, iF), + TName_(sfspvf.TName_), + pName_(sfspvf.pName_), + psiName_(sfspvf.psiName_), UInf_(sfspvf.UInf_), pInf_(sfspvf.pInf_), TInf_(sfspvf.TInf_), @@ -152,13 +167,13 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs() } const fvPatchField<scalar>& pT = - patch().lookupPatchField<volScalarField, scalar>("T"); + patch().lookupPatchField<volScalarField, scalar>(TName_); const fvPatchField<scalar>& pp = - patch().lookupPatchField<volScalarField, scalar>("p"); + patch().lookupPatchField<volScalarField, scalar>(pName_); const fvPatchField<scalar>& ppsi = - patch().lookupPatchField<volScalarField, scalar>("psi"); + patch().lookupPatchField<volScalarField, scalar>(psiName_); // Need R of the free-stream flow. Assume R is independent of location // along patch so use face 0 @@ -288,6 +303,9 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs() void Foam::supersonicFreestreamFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); + writeEntryIfDifferent<word>(os, "T", "T", TName_); + writeEntryIfDifferent<word>(os, "p", "p", pName_); + writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); os.writeKeyword("UInf") << UInf_ << token::END_STATEMENT << nl; os.writeKeyword("pInf") << pInf_ << token::END_STATEMENT << nl; os.writeKeyword("TInf") << TInf_ << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H index 402fc365f34fd746309db74c192931938c140603..6f6ea27bcb04d8ebaa379c8a22bae30404bf2705 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/supersonicFreestream/supersonicFreestreamFvPatchVectorField.H @@ -40,6 +40,9 @@ Description \table Property | Description | Required | Default value + TName | Temperature field name | no | T + pName | Pressure field name | no | p + psiName | Compressibility field name | no | thermo:psi UInf | free-stream velocity | yes | pInf | free-stream pressure | yes | TInf | free-stream temperature | yes | @@ -88,6 +91,15 @@ class supersonicFreestreamFvPatchVectorField { // Private data + //- Name of temperature field, default = "T" + word TName_; + + //- Name of pressure field, default = "p" + word pName_; + + //- Name of compressibility field field, default = "thermo:psi" + word psiName_; + //- Velocity of the free stream vector UInf_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C index 2d31d3802f1630eef14cb1310a29fde1e80c39f0..f613a7e6a2c13e47c86947d186d18bd5e3cbefe7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.C @@ -52,7 +52,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits<Type>::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits<Type>::zero) + endAverage_(pTraits<Type>::zero), + offset_() {} @@ -77,7 +78,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits<Type>::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits<Type>::zero) + endAverage_(pTraits<Type>::zero), + offset_(ptf.offset_().clone().ptr()) {} @@ -101,7 +103,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(pTraits<Type>::zero), endSampleTime_(-1), endSampledValues_(0), - endAverage_(pTraits<Type>::zero) + endAverage_(pTraits<Type>::zero), + offset_(DataEntry<Type>::New("offset", dict)) { dict.readIfPresent("fieldTableName", fieldTableName_); @@ -134,7 +137,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offset_(ptf.offset_().clone().ptr()) {} @@ -158,7 +162,8 @@ timeVaryingMappedFixedValueFvPatchField startAverage_(ptf.startAverage_), endSampleTime_(ptf.endSampleTime_), endSampledValues_(ptf.endSampledValues_), - endAverage_(ptf.endAverage_) + endAverage_(ptf.endAverage_), + offset_(ptf.offset_().clone().ptr()) {} @@ -276,7 +281,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() { FatalErrorIn ( - "timeVaryingMappedFixedValueFvPatchField<Type>::checkTable" + "timeVaryingMappedFixedValueFvPatchField<Type>::checkTable()" ) << "Cannot find starting sampling values for current time " << this->db().time().value() << nl << "Have sampling values for times " @@ -366,6 +371,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() /sampleTimes_[endSampleTime_].name() << endl; } + // Reread values and interpolate AverageIOField<Type> vals ( @@ -392,7 +398,6 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::checkTable() template<class Type> void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() { - if (this->updated()) { return; @@ -423,7 +428,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() scalar start = sampleTimes_[startSampleTime_].value(); scalar end = sampleTimes_[endSampleTime_].value(); - scalar s = (this->db().time().value()-start)/(end-start); + scalar s = (this->db().time().value() - start)/(end - start); if (debug) { @@ -434,8 +439,8 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() << " with weight:" << s << endl; } - this->operator==((1-s)*startSampledValues_ + s*endSampledValues_); - wantedAverage = (1-s)*startAverage_ + s*endAverage_; + this->operator==((1 - s)*startSampledValues_ + s*endSampledValues_); + wantedAverage = (1 - s)*startAverage_ + s*endAverage_; } // Enforce average. Either by scaling (if scaling factor > 0.5) or by @@ -465,7 +470,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() Pout<< "updateCoeffs :" << " offsetting with:" << offset << endl; } - this->operator==(fld+offset); + this->operator==(fld + offset); } else { @@ -480,6 +485,10 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs() } } + // apply offset to mapped values + const scalar t = this->db().time().timeOutputValue(); + this->operator==(*this + offset_->value(t)); + if (debug) { Pout<< "updateCoeffs : set fixedValue to min:" << gMin(*this) @@ -503,6 +512,8 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::write(Ostream& os) const << token::END_STATEMENT << nl; } + offset_->writeData(os); + this->writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H index 61228fe07c4b06db225843de425bcda10710335a..aec6c322b982ab265adae64eaee149e9ec0b7b93 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/timeVaryingMappedFixedValue/timeVaryingMappedFixedValueFvPatchField.H @@ -80,6 +80,7 @@ SourceFiles #include "FixedList.H" #include "instantList.H" #include "pointToPointPlanarInterpolation.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,6 +131,9 @@ class timeVaryingMappedFixedValueFvPatchField //- If setAverage: end average value Type endAverage_; + //- Time varying offset values to interpolated data + autoPtr<DataEntry<Type> > offset_; + public: diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C index 55c7140f377428a9d1c25a88b34cd28011129ecd..7d14db67faef883415c9e061ac15be209d3177a3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.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 @@ -40,7 +40,7 @@ Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField fixedValueFvPatchScalarField(p, iF), UName_("U"), phiName_("phi"), - psiName_("psi"), + psiName_("thermo:psi"), gamma_(0.0), T0_(p.size(), 0.0) {} @@ -73,7 +73,7 @@ Foam::totalTemperatureFvPatchScalarField::totalTemperatureFvPatchScalarField fixedValueFvPatchScalarField(p, iF), UName_(dict.lookupOrDefault<word>("U", "U")), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - psiName_(dict.lookupOrDefault<word>("psi", "psi")), + psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), gamma_(readScalar(dict.lookup("gamma"))), T0_("T0", dict, p.size()) { @@ -179,7 +179,7 @@ void Foam::totalTemperatureFvPatchScalarField::write(Ostream& os) const fvPatchScalarField::write(os); writeEntryIfDifferent<word>(os, "U", "U", UName_); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); - writeEntryIfDifferent<word>(os, "psi", "psi", psiName_); + writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; T0_.writeEntry("T0", os); writeEntry("value", os); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H index d793696ade806c95a64d5c51c68eb10b85da952b..6a032dfee9547bf4bddd9e2b46aed246c1bcc27d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/totalTemperature/totalTemperatureFvPatchScalarField.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 @@ -36,7 +36,7 @@ Description Property | Description | Required | Default value U | Velocity field name | no | U phi | Flux field name | no | phi - psi | Compressibility field name | no | psi + psi | Compressibility field name | no | thermo:psi gamma | ratio of specific heats (Cp/Cv) | yes | T0 | reference temperature | yes | \endtable diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C index 06f4e3c13457a484a4d525cdb5e645818099d090..0670119ab0cee9d0cb147564ace121a063c39860 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformJumpAMI/uniformJumpAMIFvPatchField.C @@ -73,6 +73,10 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField { fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size())); } + else + { + this->evaluate(Pstream::blocking); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C index 81498552352f61f2f21f046d5c9cd5c886fc0743..9451e4bc269f97fc35a8be5b1eee7964a3e864e0 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.C @@ -30,7 +30,7 @@ License #include "surfaceFields.H" #include "uniformDimensionedFields.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -45,7 +45,7 @@ namespace Foam >::names[] = { fv::EulerDdtScheme<scalar>::typeName_(), - fv::CrankNicholsonDdtScheme<scalar>::typeName_(), + fv::CrankNicolsonDdtScheme<scalar>::typeName_(), fv::backwardDdtScheme<scalar>::typeName_() }; } @@ -183,7 +183,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs() switch (timeScheme) { case tsEuler: - case tsCrankNicholson: + case tsCrankNicolson: { zetap = zeta.oldTime().boundaryField()[patchI] + dZetap; @@ -197,7 +197,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs() scalar c00 = dt*dt/(dt0*(dt + dt0)); scalar c0 = c + c00; - zetap = + zetap = ( c0*zeta.oldTime().boundaryField()[patchI] - c00*zeta.oldTime().oldTime().boundaryField()[patchI] @@ -239,7 +239,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::write(Ostream& os) const fvPatchScalarField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "zeta", "zeta", zetaName_); - writeEntryIfDifferent<word>(os, "rho", "rho", zetaName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); writeEntry("value", os); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H index 3babe28eff8bf90ea5801cd5c5d9669aa1d9765f..858c6f690cf727ac4d624c84ca2253629e3a9d9e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveSurfacePressure/waveSurfacePressureFvPatchScalarField.H @@ -45,7 +45,7 @@ Description local volumetric flux. \heading Patch usage - + \table Property | Description | Required | Default value phi | flux field name | no | phi @@ -103,7 +103,7 @@ public: enum timeSchemeType { tsEuler, - tsCrankNicholson, + tsCrankNicolson, tsBackward }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C index 00bd7e339f46af087cf47f58c55fb2775265e9ed..eb80ace5c9cff330bc758cbe18a1bdb622c3b725 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/waveTransmissive/waveTransmissiveFvPatchField.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 @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "volFields.H" #include "EulerDdtScheme.H" -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "backwardDdtScheme.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -41,7 +41,7 @@ Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField ) : advectiveFvPatchField<Type>(p, iF), - psiName_("psi"), + psiName_("thermo:psi"), gamma_(0.0) {} @@ -70,7 +70,7 @@ Foam::waveTransmissiveFvPatchField<Type>::waveTransmissiveFvPatchField ) : advectiveFvPatchField<Type>(p, iF, dict), - psiName_(dict.lookupOrDefault<word>("psi", "psi")), + psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")), gamma_(readScalar(dict.lookup("gamma"))) {} @@ -108,27 +108,21 @@ Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const { // Lookup the velocity and compressibility of the patch const fvPatchField<scalar>& psip = - this->patch().template lookupPatchField<volScalarField, scalar> - ( - psiName_ - ); + this->patch().template + lookupPatchField<volScalarField, scalar>(psiName_); const surfaceScalarField& phi = this->db().template lookupObject<surfaceScalarField>(this->phiName_); fvsPatchField<scalar> phip = - this->patch().template lookupPatchField<surfaceScalarField, scalar> - ( - this->phiName_ - ); + this->patch().template + lookupPatchField<surfaceScalarField, scalar>(this->phiName_); if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchScalarField& rhop = - this->patch().template lookupPatchField<volScalarField, scalar> - ( - this->rhoName_ - ); + this->patch().template + lookupPatchField<volScalarField, scalar>(this->rhoName_); phip /= rhop; } @@ -145,18 +139,12 @@ void Foam::waveTransmissiveFvPatchField<Type>::write(Ostream& os) const { fvPatchField<Type>::write(os); - if (this->phiName_ != "phi") - { - os.writeKeyword("phi") << this->phiName_ << token::END_STATEMENT << nl; - } - if (this->rhoName_ != "rho") - { - os.writeKeyword("rho") << this->rhoName_ << token::END_STATEMENT << nl; - } - if (psiName_ != "psi") - { - os.writeKeyword("psi") << psiName_ << token::END_STATEMENT << nl; - } + this->template + writeEntryIfDifferent<word>(os, "phi", "phi", this->phiName_); + this->template + writeEntryIfDifferent<word>(os, "rho", "rho", this->rhoName_); + this->template + writeEntryIfDifferent<word>(os, "psi", "thermo:psi", psiName_); os.writeKeyword("gamma") << gamma_ << token::END_STATEMENT << nl; diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H index 867951946c94881c08901d74359efeccbff7ea86..52401609fab97c38f3aecba22b1ddb5b239df2e0 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CoEulerDdtScheme/CoEulerDdtScheme.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 @@ -31,7 +31,7 @@ Description does not exceed the specified value. This scheme should only be used for steady-state computations - using transient codes where local time-stepping is preferably to + using transient codes where local time-stepping is preferable to under-relaxation for transport consistency reasons. SourceFiles diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C similarity index 95% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C index dfd7c878ff8a445b581f91604c656cf4a5af9224..53d106a75d3896cc2e2563f1fb168edf7f7a2c7b 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "surfaceInterpolate.H" #include "fvcDiv.H" #include "fvMatrices.H" @@ -42,7 +42,7 @@ namespace fv template<class Type> template<class GeoField> -CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field +CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field ( const IOobject& io, const fvMesh& mesh @@ -60,7 +60,7 @@ CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field template<class Type> template<class GeoField> -CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field +CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field ( const IOobject& io, const fvMesh& mesh, @@ -74,7 +74,7 @@ CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>::DDt0Field template<class Type> template<class GeoField> -label CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>:: +label CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>:: startTimeIndex() const { return startTimeIndex_; @@ -83,7 +83,7 @@ startTimeIndex() const template<class Type> template<class GeoField> -GeoField& CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>:: +GeoField& CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>:: operator()() { return *this; @@ -92,7 +92,7 @@ operator()() template<class Type> template<class GeoField> -void CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>:: +void CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>:: operator=(const GeoField& gf) { GeoField::operator=(gf); @@ -101,8 +101,8 @@ operator=(const GeoField& gf) template<class Type> template<class GeoField> -CrankNicholsonDdtScheme<Type>::DDt0Field<GeoField>& -CrankNicholsonDdtScheme<Type>::ddt0_ +CrankNicolsonDdtScheme<Type>::DDt0Field<GeoField>& +CrankNicolsonDdtScheme<Type>::ddt0_ ( const word& name, const dimensionSet& dims @@ -183,7 +183,7 @@ CrankNicholsonDdtScheme<Type>::ddt0_ template<class Type> template<class GeoField> -bool CrankNicholsonDdtScheme<Type>::evaluate +bool CrankNicolsonDdtScheme<Type>::evaluate ( const DDt0Field<GeoField>& ddt0 ) const @@ -193,7 +193,7 @@ bool CrankNicholsonDdtScheme<Type>::evaluate template<class Type> template<class GeoField> -scalar CrankNicholsonDdtScheme<Type>::coef_ +scalar CrankNicolsonDdtScheme<Type>::coef_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -211,7 +211,7 @@ scalar CrankNicholsonDdtScheme<Type>::coef_ template<class Type> template<class GeoField> -scalar CrankNicholsonDdtScheme<Type>::coef0_ +scalar CrankNicolsonDdtScheme<Type>::coef0_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -229,7 +229,7 @@ scalar CrankNicholsonDdtScheme<Type>::coef0_ template<class Type> template<class GeoField> -dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef_ +dimensionedScalar CrankNicolsonDdtScheme<Type>::rDtCoef_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -240,7 +240,7 @@ dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef_ template<class Type> template<class GeoField> -dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef0_ +dimensionedScalar CrankNicolsonDdtScheme<Type>::rDtCoef0_ ( const DDt0Field<GeoField>& ddt0 ) const @@ -251,7 +251,7 @@ dimensionedScalar CrankNicholsonDdtScheme<Type>::rDtCoef0_ template<class Type> template<class GeoField> -tmp<GeoField> CrankNicholsonDdtScheme<Type>::offCentre_ +tmp<GeoField> CrankNicolsonDdtScheme<Type>::offCentre_ ( const GeoField& ddt0 ) const @@ -281,7 +281,7 @@ const FieldField<fvPatchField, Type>& ff template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const dimensioned<Type>& dt ) @@ -343,7 +343,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const GeometricField<Type, fvPatchField, volMesh>& vf ) @@ -432,7 +432,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const dimensionedScalar& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -522,7 +522,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<GeometricField<Type, fvPatchField, volMesh> > -CrankNicholsonDdtScheme<Type>::fvcDdt +CrankNicolsonDdtScheme<Type>::fvcDdt ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -622,7 +622,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdt template<class Type> tmp<fvMatrix<Type> > -CrankNicholsonDdtScheme<Type>::fvmDdt +CrankNicolsonDdtScheme<Type>::fvmDdt ( const GeometricField<Type, fvPatchField, volMesh>& vf ) @@ -705,7 +705,7 @@ CrankNicholsonDdtScheme<Type>::fvmDdt template<class Type> tmp<fvMatrix<Type> > -CrankNicholsonDdtScheme<Type>::fvmDdt +CrankNicolsonDdtScheme<Type>::fvmDdt ( const dimensionedScalar& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -787,7 +787,7 @@ CrankNicholsonDdtScheme<Type>::fvmDdt template<class Type> tmp<fvMatrix<Type> > -CrankNicholsonDdtScheme<Type>::fvmDdt +CrankNicolsonDdtScheme<Type>::fvmDdt ( const volScalarField& rho, const GeometricField<Type, fvPatchField, volMesh>& vf @@ -877,8 +877,8 @@ CrankNicholsonDdtScheme<Type>::fvmDdt template<class Type> -tmp<typename CrankNicholsonDdtScheme<Type>::fluxFieldType> -CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr +tmp<typename CrankNicolsonDdtScheme<Type>::fluxFieldType> +CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr ( const volScalarField& rA, const GeometricField<Type, fvPatchField, volMesh>& U, @@ -964,8 +964,8 @@ CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr template<class Type> -tmp<typename CrankNicholsonDdtScheme<Type>::fluxFieldType> -CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr +tmp<typename CrankNicolsonDdtScheme<Type>::fluxFieldType> +CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, @@ -1158,7 +1158,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr { FatalErrorIn ( - "CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr" + "CrankNicolsonDdtScheme<Type>::fvcDdtPhiCorr" ) << "dimensions of phi are not correct" << abort(FatalError); @@ -1169,7 +1169,7 @@ CrankNicholsonDdtScheme<Type>::fvcDdtPhiCorr template<class Type> -tmp<surfaceScalarField> CrankNicholsonDdtScheme<Type>::meshPhi +tmp<surfaceScalarField> CrankNicolsonDdtScheme<Type>::meshPhi ( const GeometricField<Type, fvPatchField, volMesh>& vf ) diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H similarity index 90% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H index 7c994364015e5e8f0a3717c93ebd9405ec4ead0a..315072306c7c16539c405c1f4ad812f0f0354c6c 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtScheme.H +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtScheme.H @@ -22,19 +22,19 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::fv::CrankNicholsonDdtScheme + Foam::fv::CrankNicolsonDdtScheme Description - Second-oder CrankNicholson implicit ddt using the current and + Second-oder CrankNicolson implicit ddt using the current and previous time-step fields as well as the previous time-step ddt. SourceFiles - CrankNicholsonDdtScheme.C + CrankNicolsonDdtScheme.C \*---------------------------------------------------------------------------*/ -#ifndef CrankNicholsonDdtScheme_H -#define CrankNicholsonDdtScheme_H +#ifndef CrankNicolsonDdtScheme_H +#define CrankNicolsonDdtScheme_H #include "ddtScheme.H" @@ -49,11 +49,11 @@ namespace fv { /*---------------------------------------------------------------------------*\ - Class CrankNicholsonDdtScheme Declaration + Class CrankNicolsonDdtScheme Declaration \*---------------------------------------------------------------------------*/ template<class Type> -class CrankNicholsonDdtScheme +class CrankNicolsonDdtScheme : public fv::ddtScheme<Type> { @@ -105,10 +105,10 @@ class CrankNicholsonDdtScheme // Private Member Functions //- Disallow default bitwise copy construct - CrankNicholsonDdtScheme(const CrankNicholsonDdtScheme&); + CrankNicolsonDdtScheme(const CrankNicolsonDdtScheme&); //- Disallow default bitwise assignment - void operator=(const CrankNicholsonDdtScheme&); + void operator=(const CrankNicolsonDdtScheme&); template<class GeoField> DDt0Field<GeoField>& ddt0_ @@ -149,20 +149,20 @@ class CrankNicholsonDdtScheme public: //- Runtime type information - TypeName("CrankNicholson"); + TypeName("CrankNicolson"); // Constructors //- Construct from mesh - CrankNicholsonDdtScheme(const fvMesh& mesh) + CrankNicolsonDdtScheme(const fvMesh& mesh) : ddtScheme<Type>(mesh), ocCoeff_(1.0) {} //- Construct from mesh and Istream - CrankNicholsonDdtScheme(const fvMesh& mesh, Istream& is) + CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is) : ddtScheme<Type>(mesh, is), ocCoeff_(readScalar(is)) @@ -171,7 +171,7 @@ public: { FatalIOErrorIn ( - "CrankNicholsonDdtScheme(const fvMesh& mesh, Istream& is)", + "CrankNicolsonDdtScheme(const fvMesh& mesh, Istream& is)", is ) << "coefficient = " << ocCoeff_ << " should be >= 0 and <= 1" @@ -253,7 +253,7 @@ public: template<> -tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr +tmp<surfaceScalarField> CrankNicolsonDdtScheme<scalar>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& U, @@ -262,7 +262,7 @@ tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr template<> -tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr +tmp<surfaceScalarField> CrankNicolsonDdtScheme<scalar>::fvcDdtPhiCorr ( const volScalarField& rA, const volScalarField& rho, @@ -282,7 +282,7 @@ tmp<surfaceScalarField> CrankNicholsonDdtScheme<scalar>::fvcDdtPhiCorr // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "CrankNicholsonDdtScheme.C" +# include "CrankNicolsonDdtScheme.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C similarity index 94% rename from src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C rename to src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C index 2b101831a33b5d2368afaa22c7b46c78ed9004da..3166243a9cc8a4053b803c06760f9959d87d21d2 100644 --- a/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicholsonDdtScheme/CrankNicholsonDdtSchemes.C +++ b/src/finiteVolume/finiteVolume/ddtSchemes/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "CrankNicholsonDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" #include "fvMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -32,7 +32,7 @@ namespace Foam { namespace fv { - makeFvDdtScheme(CrankNicholsonDdtScheme) + makeFvDdtScheme(CrankNicolsonDdtScheme) } } diff --git a/src/finiteVolume/finiteVolume/fv/fv.C b/src/finiteVolume/finiteVolume/fv/fv.C index 1dac0f235c27cebddab7e5659f2b06fc0f46ea4d..2f4e26d44fe3feeba80db426f901f2dac0b619b3 100644 --- a/src/finiteVolume/finiteVolume/fv/fv.C +++ b/src/finiteVolume/finiteVolume/fv/fv.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fv, 0); +namespace Foam +{ +defineTypeNameAndDebug(fv, 0); +} + // ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/fvm/fvm.H b/src/finiteVolume/finiteVolume/fvm/fvm.H index 2f7ba08f03e9443b0694ac73a5a7ce2663020dd1..b1363a11aeb0775b20f5015780e5006e003fabab 100644 --- a/src/finiteVolume/finiteVolume/fvm/fvm.H +++ b/src/finiteVolume/finiteVolume/fvm/fvm.H @@ -29,7 +29,7 @@ Description matrix. Temporal derivatives are calculated using Euler-implicit, backward - differencing or Crank-Nicholson. Spatial derivatives are calculated + differencing or Crank-Nicolson. Spatial derivatives are calculated using Gauss' Theorem. diff --git a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C index 254038b3fa5dcd999de33a42c31bdf44465d9400..b0ec820d69693fd970a18141181fbb72adad0d23 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/extendedLeastSquaresGrad/extendedLeastSquaresVectors.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::extendedLeastSquaresVectors, 0); +namespace Foam +{ +defineTypeNameAndDebug(extendedLeastSquaresVectors, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C index 7df3d5488b5e97b8e7954598847fe82ebfcb19f0..95db626d720fef9a9b4409e2d4d0d88f7fdb8d44 100644 --- a/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C +++ b/src/finiteVolume/finiteVolume/gradSchemes/leastSquaresGrad/leastSquaresVectors.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::leastSquaresVectors, 0); +namespace Foam +{ +defineTypeNameAndDebug(leastSquaresVectors, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C index 4913c16457700d9b4892b00080d548dc24e42eb8..dd9f68ec669c161758b2a0ef0c49a0f9c16a9702 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.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 @@ -46,13 +46,10 @@ tmp<fvMatrix<Type> > gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected ( const surfaceScalarField& gammaMagSf, + const surfaceScalarField& deltaCoeffs, const GeometricField<Type, fvPatchField, volMesh>& vf ) { - tmp<surfaceScalarField> tdeltaCoeffs = - this->tsnGradScheme_().deltaCoeffs(vf); - const surfaceScalarField& deltaCoeffs = tdeltaCoeffs(); - tmp<fvMatrix<Type> > tfvm ( new fvMatrix<Type> @@ -66,14 +63,14 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacianUncorrected fvm.upper() = deltaCoeffs.internalField()*gammaMagSf.internalField(); fvm.negSumDiag(); - forAll(vf.boundaryField(), patchI) + forAll(vf.boundaryField(), patchi) { - const fvPatchField<Type>& psf = vf.boundaryField()[patchI]; + const fvPatchField<Type>& psf = vf.boundaryField()[patchi]; const fvsPatchScalarField& patchGamma = - gammaMagSf.boundaryField()[patchI]; + gammaMagSf.boundaryField()[patchi]; - fvm.internalCoeffs()[patchI] = patchGamma*psf.gradientInternalCoeffs(); - fvm.boundaryCoeffs()[patchI] = -patchGamma*psf.gradientBoundaryCoeffs(); + fvm.internalCoeffs()[patchi] = patchGamma*psf.gradientInternalCoeffs(); + fvm.boundaryCoeffs()[patchi] = -patchGamma*psf.gradientBoundaryCoeffs(); } return tfvm; @@ -162,7 +159,12 @@ gaussLaplacianScheme<Type, GType>::fvmLaplacian ); const surfaceVectorField SfGammaCorr(SfGamma - SfGammaSn*Sn); - tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(SfGammaSn, vf); + tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected + ( + SfGammaSn, + this->tsnGradScheme_().deltaCoeffs(vf), + vf + ); fvMatrix<Type>& fvm = tfvm(); tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tfaceFluxCorrection diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H index dfd35f6f862350b2aa9b0e09f148165a3a028e83..1ff2a71843acd374681072a3ca7e7f99fc9f5b5a 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.H +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.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 @@ -58,12 +58,6 @@ class gaussLaplacianScheme { // Private Member Functions - tmp<fvMatrix<Type> > fvmLaplacianUncorrected - ( - const surfaceScalarField& gammaMagSf, - const GeometricField<Type, fvPatchField, volMesh>& - ); - tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > gammaSnGradCorr ( const surfaceVectorField& SfGammaCorr, @@ -116,6 +110,13 @@ public: // Member Functions + static tmp<fvMatrix<Type> > fvmLaplacianUncorrected + ( + const surfaceScalarField& gammaMagSf, + const surfaceScalarField& deltaCoeffs, + const GeometricField<Type, fvPatchField, volMesh>& + ); + tmp<GeometricField<Type, fvPatchField, volMesh> > fvcLaplacian ( const GeometricField<Type, fvPatchField, volMesh>& diff --git a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C index 74f9a66b371d183a8e3c8b930f0d0435571e6181..fd983f3751e77d06b0364e74cbcaaf4d2bc6abaf 100644 --- a/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C +++ b/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.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 @@ -53,7 +53,12 @@ Foam::fv::gaussLaplacianScheme<Foam::Type, Foam::scalar>::fvmLaplacian \ gamma*mesh.magSf() \ ); \ \ - tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected(gammaMagSf, vf); \ + tmp<fvMatrix<Type> > tfvm = fvmLaplacianUncorrected \ + ( \ + gammaMagSf, \ + this->tsnGradScheme_().deltaCoeffs(vf), \ + vf \ + ); \ fvMatrix<Type>& fvm = tfvm(); \ \ if (this->tsnGradScheme_().corrected()) \ diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C new file mode 100644 index 0000000000000000000000000000000000000000..6b04bb2efb4be28927c3b500fd98b2ee4837f615 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.C @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "faceCorrectedSnGrad.H" +#include "volPointInterpolation.H" +#include "triangle.H" + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class Type> +Foam::fv::faceCorrectedSnGrad<Type>::~faceCorrectedSnGrad() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > +Foam::fv::faceCorrectedSnGrad<Type>::fullGradCorrection +( + const GeometricField<Type, fvPatchField, volMesh>& vf +) const +{ + const fvMesh& mesh = this->mesh(); + + GeometricField<Type, pointPatchField, pointMesh> pvf + ( + volPointInterpolation::New(mesh).interpolate(vf) + ); + + // construct GeometricField<Type, fvsPatchField, surfaceMesh> + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr + ( + new GeometricField<Type, fvsPatchField, surfaceMesh> + ( + IOobject + ( + "snGradCorr("+vf.name()+')', + vf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + vf.dimensions()*mesh.nonOrthDeltaCoeffs().dimensions() + ) + ); + + Field<Type>& sfCorr = tsfCorr().internalField(); + + const pointField& points = mesh.points(); + const faceList& faces = mesh.faces(); + const vectorField& Sf = mesh.Sf().internalField(); + const vectorField& C = mesh.C().internalField(); + const scalarField& magSf = mesh.magSf().internalField(); + const labelList& owner = mesh.owner(); + const labelList& neighbour = mesh.neighbour(); + + forAll(sfCorr, facei) + { + typename outerProduct<vector, Type>::type fgrad + ( + outerProduct<vector, Type>::type::zero + ); + + const face& fi = faces[facei]; + + vector nf(Sf[facei]/magSf[facei]); + + for (label pi=0; pi<fi.size(); pi++) + { + // Next point index + label pj = (pi+1)%fi.size(); + + // Edge normal in plane of face + vector edgen(nf^(points[fi[pj]] - points[fi[pi]])); + + // Edge centre field value + Type pvfe(0.5*(pvf[fi[pj]] + pvf[fi[pi]])); + + // Integrate face gradient + fgrad += edgen*pvfe; + } + + // Finalize face-gradient by dividing by face area + fgrad /= magSf[facei]; + + // Calculate correction vector + vector dCorr(C[neighbour[facei]] - C[owner[facei]]); + dCorr /= (nf & dCorr); + + // if (mag(dCorr) > 2) dCorr *= 2/mag(dCorr); + + sfCorr[facei] = dCorr&fgrad; + } + + tsfCorr().boundaryField() = pTraits<Type>::zero; + + return tsfCorr; +} + + +template<class Type> +Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> > +Foam::fv::faceCorrectedSnGrad<Type>::correction +( + const GeometricField<Type, fvPatchField, volMesh>& vf +) const +{ + const fvMesh& mesh = this->mesh(); + + // construct GeometricField<Type, fvsPatchField, surfaceMesh> + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf + ( + new GeometricField<Type, fvsPatchField, surfaceMesh> + ( + IOobject + ( + "snGradCorr("+vf.name()+')', + vf.instance(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + vf.dimensions()*mesh.nonOrthDeltaCoeffs().dimensions() + ) + ); + GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf(); + + for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++) + { + ssf.replace + ( + cmpt, + faceCorrectedSnGrad<typename pTraits<Type>::cmptType>(mesh) + .fullGradCorrection(vf.component(cmpt)) + ); + } + + return tssf; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H new file mode 100644 index 0000000000000000000000000000000000000000..a13dd62d18e2c6ccb775d549ea1d98542ec21981 --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrad.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::fv::faceCorrectedSnGrad + +Description + Simple central-difference snGrad scheme with non-orthogonal correction. + +SourceFiles + faceCorrectedSnGrad.C + +\*---------------------------------------------------------------------------*/ + +#ifndef faceCorrectedSnGrad_H +#define faceCorrectedSnGrad_H + +#include "snGradScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class faceCorrectedSnGrad Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class faceCorrectedSnGrad +: + public snGradScheme<Type> +{ + // Private Member Functions + + //- Disallow default bitwise assignment + void operator=(const faceCorrectedSnGrad&); + + +public: + + //- Runtime type information + TypeName("faceCorrected"); + + + // Constructors + + //- Construct from mesh + faceCorrectedSnGrad(const fvMesh& mesh) + : + snGradScheme<Type>(mesh) + {} + + + //- Construct from mesh and data stream + faceCorrectedSnGrad(const fvMesh& mesh, Istream&) + : + snGradScheme<Type>(mesh) + {} + + + //- Destructor + virtual ~faceCorrectedSnGrad(); + + + // Member Functions + + //- Return the interpolation weighting factors for the given field + virtual tmp<surfaceScalarField> deltaCoeffs + ( + const GeometricField<Type, fvPatchField, volMesh>& + ) const + { + return this->mesh().nonOrthDeltaCoeffs(); + } + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return true; + } + + //- Return the explicit correction to the faceCorrectedSnGrad + // for the given field using the gradient of the field + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + fullGradCorrection + ( + const GeometricField<Type, fvPatchField, volMesh>& + ) const; + + //- Return the explicit correction to the faceCorrectedSnGrad + // for the given field using the gradients of the field components + virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + correction(const GeometricField<Type, fvPatchField, volMesh>&) const; +}; + + +// * * * * * * * * Template Member Function Specialisations * * * * * * * * // + +template<> +tmp<surfaceScalarField> faceCorrectedSnGrad<scalar>::correction +( + const volScalarField& vsf +) const; + + +template<> +tmp<surfaceVectorField> faceCorrectedSnGrad<vector>::correction +( + const volVectorField& vvf +) const; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "faceCorrectedSnGrad.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrads.C b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrads.C new file mode 100644 index 0000000000000000000000000000000000000000..ba6d83542eb2cb3c70a152c99d457764382cb0de --- /dev/null +++ b/src/finiteVolume/finiteVolume/snGradSchemes/faceCorrectedSnGrad/faceCorrectedSnGrads.C @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "faceCorrectedSnGrad.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + makeSnGradScheme(faceCorrectedSnGrad) +} +} + + +template<> +Foam::tmp<Foam::surfaceScalarField> +Foam::fv::faceCorrectedSnGrad<Foam::scalar>::correction +( + const volScalarField& vsf +) const +{ + return fullGradCorrection(vsf); +} + + +template<> +Foam::tmp<Foam::surfaceVectorField> +Foam::fv::faceCorrectedSnGrad<Foam::vector>::correction +( + const volVectorField& vvf +) const +{ + return fullGradCorrection(vvf); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C index a5def7bcc12eeb73a9b3fc50aad7edaf5ed8c729..63d81a996fd67637df168092f9d30de8f3c82db7 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.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 @@ -21,23 +21,12 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. -Description - snGrad scheme with limited non-orthogonal correction. - - The limiter is controlled by a coefficient with a value between 0 and 1 - which when 0 switches the correction off and the scheme behaves as - uncorrectedSnGrad, when set to 1 the full correction is applied and the - scheme behaves as correctedSnGrad and when set to 0.5 the limiter is - calculated such that the non-orthogonal contribution does not exceed the - orthogonal part. - \*---------------------------------------------------------------------------*/ #include "fv.H" #include "limitedSnGrad.H" #include "volFields.H" #include "surfaceFields.H" -#include "correctedSnGrad.H" #include "localMax.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,7 +57,7 @@ limitedSnGrad<Type>::correction { const GeometricField<Type, fvsPatchField, surfaceMesh> corr ( - correctedSnGrad<Type>(this->mesh()).correction(vf) + correctedScheme_().correction(vf) ); const surfaceScalarField limiter @@ -76,7 +65,7 @@ limitedSnGrad<Type>::correction min ( limitCoeff_ - *mag(snGradScheme<Type>::snGrad(vf, deltaCoeffs(vf), "orthSnGrad")) + *mag(snGradScheme<Type>::snGrad(vf, deltaCoeffs(vf), "SndGrad")) /( (1 - limitCoeff_)*mag(corr) + dimensionedScalar("small", corr.dimensions(), SMALL) diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H index 9dbe0f01143ec668280c78d189c7d3ed133c512e..5d1ffd2b9408d44fffadc895b26990ef0fdeb2e3 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/limitedSnGrad/limitedSnGrad.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 @@ -25,14 +25,20 @@ Class Foam::fv::limitedSnGrad Description - Central-difference snGrad scheme with limited non-orthogonal correction. + Run-time selected snGrad scheme with limited non-orthogonal correction. The limiter is controlled by a coefficient with a value between 0 and 1 which when 0 switches the correction off and the scheme behaves as - uncorrectedSnGrad, when set to 1 the full correction is applied and the - scheme behaves as correctedSnGrad and when set to 0.5 the limiter is - calculated such that the non-orthogonal contribution does not exceed the - orthogonal part. + uncorrectedSnGrad, when set to 1 the full correction of the selected scheme + is used and when set to 0.5 the limiter is calculated such that the + non-orthogonal contribution does not exceed the orthogonal part. + + Format: + limited <corrected scheme> <coefficient>; + + or + + limited <coefficient>; // Backward compatibility SourceFiles limitedSnGrad.C @@ -42,7 +48,7 @@ SourceFiles #ifndef limitedSnGrad_H #define limitedSnGrad_H -#include "snGradScheme.H" +#include "correctedSnGrad.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -65,6 +71,8 @@ class limitedSnGrad { // Private data + tmp<snGradScheme<Type> > correctedScheme_; + scalar limitCoeff_; @@ -73,6 +81,34 @@ class limitedSnGrad //- Disallow default bitwise assignment void operator=(const limitedSnGrad&); + //- Lookup function for the corrected to support backward compatibility + // of dictionary specification + tmp<snGradScheme<Type> > lookupCorrectedScheme(Istream& schemeData) + { + token nextToken(schemeData); + + if (nextToken.isNumber()) + { + limitCoeff_ = nextToken.number(); + return tmp<snGradScheme<Type> > + ( + new correctedSnGrad<Type>(this->mesh()) + ); + } + else + { + schemeData.putBack(nextToken); + tmp<snGradScheme<Type> > tcorrectedScheme + ( + fv::snGradScheme<Type>::New(this->mesh(), schemeData) + ); + + schemeData >> limitCoeff_; + + return tcorrectedScheme; + } + } + public: @@ -85,22 +121,24 @@ public: //- Construct from mesh limitedSnGrad(const fvMesh& mesh) : - snGradScheme<Type>(mesh) + snGradScheme<Type>(mesh), + correctedScheme_(new correctedSnGrad<Type>(this->mesh())), + limitCoeff_(1) {} //- Construct from mesh and data stream - limitedSnGrad(const fvMesh& mesh, Istream& is) + limitedSnGrad(const fvMesh& mesh, Istream& schemeData) : snGradScheme<Type>(mesh), - limitCoeff_(readScalar(is)) + correctedScheme_(lookupCorrectedScheme(schemeData)) { if (limitCoeff_ < 0 || limitCoeff_ > 1) { FatalIOErrorIn ( - "limitedSnGrad(const fvMesh& mesh, Istream& is) : ", - is + "limitedSnGrad(const fvMesh& mesh, Istream& schemeData) : ", + schemeData ) << "limitCoeff is specified as " << limitCoeff_ << " but should be >= 0 && <= 1" << exit(FatalIOError); diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C index f7e513cfffdf4f9cf1d7792471ef169b8cc8c0af..a88ca9dad7cc3b0e502b45ae268d60524314dd06 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.C +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.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 @@ -111,7 +111,7 @@ snGradScheme<Type>::snGrad const fvMesh& mesh = vf.mesh(); // construct GeometricField<Type, fvsPatchField, surfaceMesh> - tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tssf + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf ( new GeometricField<Type, fvsPatchField, surfaceMesh> ( @@ -127,7 +127,7 @@ snGradScheme<Type>::snGrad vf.dimensions()*tdeltaCoeffs().dimensions() ) ); - GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tssf(); + GeometricField<Type, fvsPatchField, surfaceMesh>& ssf = tsf(); // set reference to difference factors array const scalarField& deltaCoeffs = tdeltaCoeffs().internalField(); @@ -136,18 +136,30 @@ snGradScheme<Type>::snGrad const labelUList& owner = mesh.owner(); const labelUList& neighbour = mesh.neighbour(); - forAll(owner, faceI) + forAll(owner, facei) { - ssf[faceI] = - deltaCoeffs[faceI]*(vf[neighbour[faceI]] - vf[owner[faceI]]); + ssf[facei] = + deltaCoeffs[facei]*(vf[neighbour[facei]] - vf[owner[facei]]); } - forAll(vf.boundaryField(), patchI) + forAll(vf.boundaryField(), patchi) { - ssf.boundaryField()[patchI] = vf.boundaryField()[patchI].snGrad(); + ssf.boundaryField()[patchi] = vf.boundaryField()[patchi].snGrad(); } - return tssf; + return tsf; +} + + +template<class Type> +tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > +snGradScheme<Type>::sndGrad +( + const GeometricField<Type, fvPatchField, volMesh>& vf, + const word& sndGradName +) +{ + return snGrad(vf, vf.mesh().nonOrthDeltaCoeffs(), sndGradName); } @@ -161,7 +173,9 @@ snGradScheme<Type>::snGrad ) const { tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf - = snGrad(vf, deltaCoeffs(vf)); + ( + snGrad(vf, deltaCoeffs(vf)) + ); if (corrected()) { @@ -181,10 +195,13 @@ snGradScheme<Type>::snGrad const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf ) const { - tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tinterpVf - = snGrad(tvf()); - tvf.clear(); - return tinterpVf; + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsf + ( + snGrad(tvf()) + ); + + tsf.clear(); + return tsf; } diff --git a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H index 9003ebc775dafb572abe2d150fa9d34739a61d26..8452a907acecbd520f94d8ee83da1d162e958ec7 100644 --- a/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.H +++ b/src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme/snGradScheme.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 @@ -133,6 +133,14 @@ public: const word& snGradName = "snGrad" ); + //- Return the sndGrad of the given cell field + static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + sndGrad + ( + const GeometricField<Type, fvPatchField, volMesh>&, + const word& snGradName = "sndGrad" + ); + //- Return the interpolation weighting factors for the given field virtual tmp<surfaceScalarField> deltaCoeffs ( diff --git a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C index 021241fa270d2dc7b14695891d771f4a14a7b6cb..a960f5a85156063ba2dfe22fac9ea6c4fce495ab 100644 --- a/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.C +++ b/src/finiteVolume/fvMesh/extendedStencil/cellToFace/extendedCellToFaceStencil.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 @@ -30,7 +30,10 @@ License /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ -defineTypeNameAndDebug(Foam::extendedCellToFaceStencil, 0); +namespace Foam +{ +defineTypeNameAndDebug(extendedCellToFaceStencil, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index e40d0a8a227c1c35d6cc55d98755bef728cabe0b..b32cc11ce0536b8ba2b3d3e674d0f449a5cb3d4b 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -64,7 +64,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fvMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(fvMesh, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 97c1b0db589b4305f568d1a34a798dd8c53c820f..7cb9d97a00b0b8105d0f2331a6047dd3034d5c27 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -312,6 +312,9 @@ public: //- Return face centres as surfaceVectorField const surfaceVectorField& Cf() const; + //- Return face deltas as surfaceVectorField + tmp<surfaceVectorField> delta() const; + // Edit diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index 0a06ef7364e0edbbf862fdd7040dc9a3a645e9fe..ddd395a722966801a068f41e6306b64bb9148621 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -133,6 +133,8 @@ void fvMesh::makeC() const << abort(FatalError); } + // Construct as slices. Only preserve processor (not e.g. cyclic) + CPtr_ = new slicedVolVectorField ( IOobject @@ -148,33 +150,10 @@ void fvMesh::makeC() const *this, dimLength, cellCentres(), - faceCentres() + faceCentres(), + true, //preserveCouples + true //preserveProcOnly ); - - - // Need to correct for cyclics transformation since absolute quantity. - // Ok on processor patches since hold opposite cell centre (no - // transformation) - slicedVolVectorField& C = *CPtr_; - - forAll(C.boundaryField(), patchi) - { - if - ( - isA<cyclicFvPatchVectorField>(C.boundaryField()[patchi]) - || isA<cyclicAMIFvPatchVectorField>(C.boundaryField()[patchi]) - ) - { - // Note: cyclic is not slice but proper field - C.boundaryField()[patchi] == static_cast<const vectorField&> - ( - static_cast<const List<vector>&> - ( - boundary_[patchi].patchSlice(faceCentres()) - ) - ); - } - } } @@ -393,6 +372,53 @@ const surfaceVectorField& fvMesh::Cf() const } +tmp<surfaceVectorField> fvMesh::delta() const +{ + if (debug) + { + Info<< "void fvMesh::delta() : " + << "calculating face deltas" + << endl; + } + + tmp<surfaceVectorField> tdelta + ( + new surfaceVectorField + ( + IOobject + ( + "delta", + pointsInstance(), + meshSubDir, + *this, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + *this, + dimLength + ) + ); + surfaceVectorField& delta = tdelta(); + + const volVectorField& C = this->C(); + const labelUList& owner = this->owner(); + const labelUList& neighbour = this->neighbour(); + + forAll(owner, facei) + { + delta[facei] = C[neighbour[facei]] - C[owner[facei]]; + } + + forAll(delta.boundaryField(), patchi) + { + delta.boundaryField()[patchi] = boundary()[patchi].delta(); + } + + return tdelta; +} + + const surfaceScalarField& fvMesh::phi() const { if (!phiPtr_) diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C index 59dbc40a8a65a5a9a26b65cc8a3602d176d378bc..d78bee63c16aaef3d3ca0e19b04e994b3a17ea0f 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.C @@ -825,7 +825,7 @@ void Foam::fvMeshSubset::setLargeCellSubset // 3: face coupled and used by one cell only (so should become normal, // non-coupled patch face) // - // Note that this is not really nessecary - but means we can size things + // Note that this is not really necessary - but means we can size things // correctly. Also makes handling coupled faces much easier. labelList nCellsUsingFace(oldFaces.size(), 0); diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H index 350d961115bc3d4361c89ec3721b6c95c360a2fd..9d8461f179be91346d7bdf11e8d2a7b3d71e1c6f 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.H +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubset.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 @@ -241,7 +241,7 @@ public: //- Set the subset from all cells with region == currentRegion. // Create "oldInternalFaces" patch for exposed // internal faces (patchID==-1) or use supplied patch. - // Handles coupled patches by if nessecary making coupled patch + // Handles coupled patches by if necessary making coupled patch // face part of patchID (so uncoupled) void setLargeCellSubset ( diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index 4739309c24c06835dd889654927f81bdc9d43bb4..7ee0d535779516c77bfc43bb4afdd041cdc32b3b 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.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 @@ -233,7 +233,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > fvMeshSubset::interpolate } - // Map exposed internal faces. Note: Only nessecary if exposed faces added + // Map exposed internal faces. Note: Only necessary if exposed faces added // into existing patch but since we don't know that at this point... forAll(patchFields, patchI) { diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C index 39ea30b0c3311733ca91f60cb2f5846dd5a468dd..3891ef4dc6071fea6c0e7665a7633a52d7d42f09 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.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 @@ -28,10 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -int Foam::pointMVCWeight::debug -( - debug::debugSwitch("pointMVCWeight", 0) -); +namespace Foam +{ +defineDebugSwitchWithName(pointMVCWeight, "pointMVCWeight", 0); +} Foam::scalar Foam::pointMVCWeight::tol(SMALL); diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.C b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.C new file mode 100644 index 0000000000000000000000000000000000000000..93a5405206dcfeba0dccc51bf150bd8fdb535aed --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "CoBlended.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceInterpolationScheme(CoBlended); +} + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H new file mode 100644 index 0000000000000000000000000000000000000000..9be5cd0420a0f5af886c23d8b7997c455ea62606 --- /dev/null +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/CoBlended/CoBlended.H @@ -0,0 +1,275 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::CoBlended + +Description + Two-scheme Courant number based blending differencing scheme. + + Similar to localBlended but uses a blending factor computed from the + face-based Courant number and the alpha factor supplied: + + weight = 1 - Co/alpha + + The weight applies to the first scheme and 1-factor to the second scheme. + +SourceFiles + CoBlended.C + +\*---------------------------------------------------------------------------*/ + +#ifndef CoBlended_H +#define CoBlended_H + +#include "surfaceInterpolationScheme.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class CoBlended Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class CoBlended +: + public surfaceInterpolationScheme<Type> +{ + // Private data + + const scalar alpha_; + + // Private Member Functions + + //- Scheme 1 + tmp<surfaceInterpolationScheme<Type> > tScheme1_; + + //- Scheme 2 + tmp<surfaceInterpolationScheme<Type> > tScheme2_; + + //- The face-flux used to compute the face Courant number + const surfaceScalarField& faceFlux_; + + + //- Disallow default bitwise copy construct + CoBlended(const CoBlended&); + + //- Disallow default bitwise assignment + void operator=(const CoBlended&); + + +public: + + //- Runtime type information + TypeName("CoBlended"); + + + // Constructors + + //- Construct from mesh and Istream. + // The name of the flux field is read from the Istream and looked-up + // from the mesh objectRegistry + CoBlended + ( + const fvMesh& mesh, + Istream& is + ) + : + surfaceInterpolationScheme<Type>(mesh), + alpha_(readScalar(is)), + tScheme1_ + ( + surfaceInterpolationScheme<Type>::New(mesh, is) + ), + tScheme2_ + ( + surfaceInterpolationScheme<Type>::New(mesh, is) + ), + faceFlux_ + ( + mesh.lookupObject<surfaceScalarField> + ( + word(is) + ) + ) + { + if (alpha_ <= 0 ) + { + FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is) + << "coefficient = " << alpha_ + << " should be > 0" + << exit(FatalIOError); + } + } + + + //- Construct from mesh, faceFlux and Istream + CoBlended + ( + const fvMesh& mesh, + const surfaceScalarField& faceFlux, + Istream& is + ) + : + surfaceInterpolationScheme<Type>(mesh), + alpha_(readScalar(is)), + tScheme1_ + ( + surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is) + ), + tScheme2_ + ( + surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is) + ), + faceFlux_(faceFlux) + { + if (alpha_ <= 0) + { + FatalIOErrorIn("CoBlended(const fvMesh&, Istream&)", is) + << "coefficient = " << alpha_ + << " should be > 0" + << exit(FatalIOError); + } + } + + + // Member Functions + + //- Return the face-based Courant number blending factor + tmp<surfaceScalarField> blendingFactor() const + { + const fvMesh& mesh = faceFlux_.mesh(); + + return + ( + max + ( + scalar(1) + - mesh.time().deltaT()*mesh.deltaCoeffs()*mag(faceFlux_) + /(mesh.magSf()*alpha_), + scalar(0) + ) + ); + } + + + //- Return the interpolation weighting factors + tmp<surfaceScalarField> + weights + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + surfaceScalarField bf(blendingFactor()); + + return + bf*tScheme1_().weights(vf) + + (scalar(1.0) - bf)*tScheme2_().weights(vf); + } + + + //- Return the face-interpolate of the given cell field + // with explicit correction + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + interpolate + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + surfaceScalarField bf(blendingFactor()); + + return + bf*tScheme1_().interpolate(vf) + + (scalar(1.0) - bf)*tScheme2_().interpolate(vf); + } + + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return tScheme1_().corrected() || tScheme2_().corrected(); + } + + + //- Return the explicit correction to the face-interpolate + // for the given field + virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + correction + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + surfaceScalarField bf(blendingFactor()); + + if (tScheme1_().corrected()) + { + if (tScheme2_().corrected()) + { + return + ( + bf + * tScheme1_().correction(vf) + + (scalar(1.0) - bf) + * tScheme2_().correction(vf) + ); + } + else + { + return + ( + bf + * tScheme1_().correction(vf) + ); + } + } + else if (tScheme2_().corrected()) + { + return + ( + (scalar(1.0) - bf) + * tScheme2_().correction(vf) + ); + } + else + { + return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + ( + NULL + ); + } + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index 2d9cadc47ac3a4074e78cc2863fa2e2b3e5a7a67..4386716a17e892ff308de387ba5b9fc021cf6792 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -34,7 +34,10 @@ Description // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfaceInterpolation, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfaceInterpolation, 0); +} // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 7c440dd78fcfee40befe27a4b976b0a5d0d1943e..29e4469610118cb4f0468cba7f80f5aacbf7a1fd 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ LIB_LIBS = \ @@ -10,4 +11,5 @@ LIB_LIBS = \ -lmeshTools \ -ldynamicMesh \ -lfiniteVolume \ + -lfileFormats /*-lforces include in controlDict if needed */ diff --git a/src/lagrangian/coalCombustion/Make/options b/src/lagrangian/coalCombustion/Make/options index 34a2babd735d8e8a6b2e69c447755c3660058595..0d7eb0e13ba648b92847e780c1bed3fa70b8e7c2 100644 --- a/src/lagrangian/coalCombustion/Make/options +++ b/src/lagrangian/coalCombustion/Make/options @@ -17,8 +17,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -42,5 +41,4 @@ LIB_LIBS = \ -lincompressibleTransportModels \ -lregionModels \ -lsurfaceFilmModels \ - -ldynamicFvMesh \ - -lsampling + -ldynamicFvMesh diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index 58217adbf55b736182d6c5942ae348426bb147ef..7ec52b1ee8ad96fb81cd43dd8093ebe4f8b6f63f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -326,7 +326,7 @@ bool Foam::KinematicParcel<ParcelType>::move p.age() += dt; - td.cloud().functions().postMove(p, cellI, dt); + td.cloud().functions().postMove(p, cellI, dt, td.keepParticle); } return td.keepParticle; @@ -340,7 +340,7 @@ void Foam::KinematicParcel<ParcelType>::hitFace(TrackData& td) typename TrackData::cloudType::parcelType& p = static_cast<typename TrackData::cloudType::parcelType&>(*this); - td.cloud().functions().postFace(p, p.face()); + td.cloud().functions().postFace(p, p.face(), td.keepParticle); } @@ -364,7 +364,14 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch static_cast<typename TrackData::cloudType::parcelType&>(*this); // Invoke post-processing model - td.cloud().functions().postPatch(p, pp, trackFraction, tetIs); + td.cloud().functions().postPatch + ( + p, + pp, + trackFraction, + tetIs, + td.keepParticle + ); // Invoke surface film model if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle)) diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H index 9e19beae3498a11eba4646ae707fbfe1b6083001..783878f4800683e15a785d2dddc3b2f69ff4b6ba 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelCloudFunctionObjects.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 @@ -29,6 +29,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "FacePostProcessing.H" +#include "ParticleCollector.H" #include "ParticleErosion.H" #include "ParticleTracks.H" #include "ParticleTrap.H" @@ -42,6 +43,7 @@ License makeCloudFunctionObject(CloudType); \ \ makeCloudFunctionObjectType(FacePostProcessing, CloudType); \ + makeCloudFunctionObjectType(ParticleCollector, CloudType); \ makeCloudFunctionObjectType(ParticleErosion, CloudType); \ makeCloudFunctionObjectType(ParticleTracks, CloudType); \ makeCloudFunctionObjectType(ParticleTrap, CloudType); \ diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C index dbc359ae9a582ddee6d43be0c4efb5ad1f46431e..5a208a4ca86e388a99284e8b3848c72569ad8996 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C @@ -96,7 +96,8 @@ void Foam::CloudFunctionObject<CloudType>::postMove ( const typename CloudType::parcelType&, const label, - const scalar + const scalar, + bool& ) { // do nothing @@ -109,7 +110,8 @@ void Foam::CloudFunctionObject<CloudType>::postPatch const typename CloudType::parcelType&, const polyPatch&, const scalar, - const tetIndices& + const tetIndices&, + bool& ) { // do nothing @@ -120,7 +122,8 @@ template<class CloudType> void Foam::CloudFunctionObject<CloudType>::postFace ( const typename CloudType::parcelType&, - const label + const label, + bool& ) { // do nothing diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H index 5baf0f7ae95fd82cfcc635db6c84e47633c162b1..976fd3867fff2efadf98f5b144a4df23b1899f48 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.H @@ -46,6 +46,9 @@ SourceFiles namespace Foam { +class polyPatch; +class tetIndices; + /*---------------------------------------------------------------------------*\ Class CloudFunctionObject Declaration \*---------------------------------------------------------------------------*/ @@ -134,7 +137,8 @@ public: ( const typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); //- Post-patch hook @@ -143,14 +147,16 @@ public: const typename CloudType::parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& testIs + const tetIndices& testIs, + bool& keepParticle ); //- Post-face hook virtual void postFace ( const typename CloudType::parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C index 2f97468e36c15e6e191228c9b288b711049915f9..e0d57b60570e1cf923f2f3050fbf056d571c166f 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.C @@ -132,12 +132,18 @@ void Foam::CloudFunctionObjectList<CloudType>::postMove ( const typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ) { forAll(*this, i) { - this->operator[](i).postMove(p, cellI, dt); + this->operator[](i).postMove(p, cellI, dt, keepParticle); + + if (!keepParticle) + { + return; + } } } @@ -148,12 +154,25 @@ void Foam::CloudFunctionObjectList<CloudType>::postPatch const typename CloudType::parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ) { forAll(*this, i) { - this->operator[](i).postPatch(p, pp, trackFraction, tetIs); + this->operator[](i).postPatch + ( + p, + pp, + trackFraction, + tetIs, + keepParticle + ); + + if (!keepParticle) + { + return; + } } } @@ -162,12 +181,18 @@ template<class CloudType> void Foam::CloudFunctionObjectList<CloudType>::postFace ( const typename CloudType::parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ) { forAll(*this, i) { - this->operator[](i).postFace(p, faceI); + this->operator[](i).postFace(p, faceI, keepParticle); + + if (!keepParticle) + { + return; + } } } diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H index 5daeab9f297249b120877c75594c01555c659725..de9c3afc025a28e9b0bf945bdffe3cfc9058b601 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObjectList/CloudFunctionObjectList.H @@ -114,7 +114,8 @@ public: ( const typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); //- Post-patch hook @@ -123,14 +124,16 @@ public: const typename CloudType::parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ); //- Post-face hook virtual void postFace ( const typename CloudType::parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C index ae02927bbdba1e53fd8f51eec3245f3640170103..8c64e1b62fef66bfaed86e6f48f2c0ede8c40dcb 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.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 @@ -133,7 +133,7 @@ void Foam::FacePostProcessing<CloudType>::write() { OFstream& os = outputFilePtr_[zoneI]; os << time.timeName() << token::TAB << sumMassTotal << token::TAB - << sumMassFlowRate<< endl; + << sumMassFlowRate<< endl; } } @@ -376,7 +376,8 @@ template<class CloudType> void Foam::FacePostProcessing<CloudType>::postFace ( const parcelType& p, - const label faceI + const label faceI, + bool& ) { if diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H index 06387d234b26d1a99bb2b29262b8704af877fc28..3195b9fc575df39227da5c6a226edc4727d3007a 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/FacePostProcessing/FacePostProcessing.H @@ -160,7 +160,8 @@ public: virtual void postFace ( const parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C new file mode 100644 index 0000000000000000000000000000000000000000..f1dc7c4ba06db92b2feaa5aeddc402bfea0d1f2f --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -0,0 +1,677 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "ParticleCollector.H" +#include "Pstream.H" +#include "surfaceWriter.H" +#include "unitConversion.H" +#include "Random.H" +#include "triangle.H" +#include "cloud.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::makeLogFile +( + const faceList& faces, + const Field<point>& points, + const Field<scalar>& area +) +{ + // Create the output file if not already created + if (log_) + { + if (debug) + { + Info<< "Creating output file" << endl; + } + + if (Pstream::master()) + { + const fileName logDir = outputDir_/this->owner().time().timeName(); + + // Create directory if does not exist + mkDir(logDir); + + // Open new file at start up + outputFilePtr_.reset + ( + new OFstream(logDir/(type() + ".dat")) + ); + + outputFilePtr_() + << "# Source : " << type() << nl + << "# Total area : " << sum(area) << nl + << "# Time"; + + forAll(faces, i) + { + word id = Foam::name(i); + + outputFilePtr_() + << tab << "area[" << id << "]" + << tab << "mass[" << id << "]" + << tab << "massFlowRate[" << id << "]" + << endl; + } + } + } +} + + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::initPolygons() +{ + mode_ = mtPolygon; + + List<Field<point> > polygons(this->coeffDict().lookup("polygons")); + label nPoints = 0; + forAll(polygons, polyI) + { + label np = polygons[polyI].size(); + if (np < 3) + { + FatalIOErrorIn + ( + "Foam::ParticleCollector<CloudType>::initPolygons()", + this->coeffDict() + ) + << "polygons must consist of at least 3 points" + << exit(FatalIOError); + } + + nPoints += np; + } + + label pointOffset = 0; + points_.setSize(nPoints); + faces_.setSize(polygons.size()); + faceTris_.setSize(polygons.size()); + area_.setSize(polygons.size()); + forAll(faces_, faceI) + { + const Field<point>& polyPoints = polygons[faceI]; + face f(identity(polyPoints.size()) + pointOffset); + UIndirectList<point>(points_, f) = polyPoints; + area_[faceI] = f.mag(points_); + + DynamicList<face> tris; + f.triangles(points_, tris); + faceTris_[faceI].transfer(tris); + + faces_[faceI].transfer(f); + + pointOffset += polyPoints.size(); + } +} + + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::initConcentricCircles() +{ + mode_ = mtConcentricCircle; + + vector origin(this->coeffDict().lookup("origin")); + + radius_ = this->coeffDict().lookup("radius"); + nSector_ = readLabel(this->coeffDict().lookup("nSector")); + + label nS = nSector_; + + vector refDir; + if (nSector_ > 1) + { + refDir = this->coeffDict().lookup("refDir"); + refDir -= normal_*(normal_ & refDir); + refDir /= mag(refDir); + } + else + { + // set 4 quadrants for single sector cases + nS = 4; + + vector tangent = vector::zero; + scalar magTangent = 0.0; + + Random rnd(1234); + while (magTangent < SMALL) + { + vector v = rnd.vector01(); + + tangent = v - (v & normal_)*normal_; + magTangent = mag(tangent); + } + + refDir = tangent/magTangent; + } + + scalar dTheta = 5.0; + scalar dThetaSector = 360.0/scalar(nS); + label intervalPerSector = max(1, ceil(dThetaSector/dTheta)); + dTheta = dThetaSector/scalar(intervalPerSector); + + label nPointPerSector = intervalPerSector + 1; + + label nPointPerRadius = nS*(nPointPerSector - 1); + label nPoint = radius_.size()*nPointPerRadius; + label nFace = radius_.size()*nS; + + // add origin + nPoint++; + + points_.setSize(nPoint); + faces_.setSize(nFace); + area_.setSize(nFace); + + coordSys_ = cylindricalCS("coordSys", origin, normal_, refDir, false); + + List<label> ptIDs(identity(nPointPerRadius)); + + points_[0] = origin; + + // points + forAll(radius_, radI) + { + label pointOffset = radI*nPointPerRadius + 1; + + for (label i = 0; i < nPointPerRadius; i++) + { + label pI = i + pointOffset; + point pCyl(radius_[radI], degToRad(i*dTheta), 0.0); + points_[pI] = coordSys_.globalPosition(pCyl); + } + } + + // faces + DynamicList<label> facePts(2*nPointPerSector); + forAll(radius_, radI) + { + if (radI == 0) + { + for (label secI = 0; secI < nS; secI++) + { + facePts.clear(); + + // append origin point + facePts.append(0); + + for (label ptI = 0; ptI < nPointPerSector; ptI++) + { + label i = ptI + secI*(nPointPerSector - 1); + label id = ptIDs.fcIndex(i - 1) + 1; + facePts.append(id); + } + + label faceI = secI + radI*nS; + + faces_[faceI] = face(facePts); + area_[faceI] = faces_[faceI].mag(points_); + } + } + else + { + for (label secI = 0; secI < nS; secI++) + { + facePts.clear(); + + label offset = (radI - 1)*nPointPerRadius + 1; + + for (label ptI = 0; ptI < nPointPerSector; ptI++) + { + label i = ptI + secI*(nPointPerSector - 1); + label id = offset + ptIDs.fcIndex(i - 1); + facePts.append(id); + } + for (label ptI = nPointPerSector-1; ptI >= 0; ptI--) + { + label i = ptI + secI*(nPointPerSector - 1); + label id = offset + nPointPerRadius + ptIDs.fcIndex(i - 1); + facePts.append(id); + } + + label faceI = secI + radI*nS; + + faces_[faceI] = face(facePts); + area_[faceI] = faces_[faceI].mag(points_); + } + } + } +} + + +template<class CloudType> +Foam::label Foam::ParticleCollector<CloudType>::collectParcelPolygon +( + const point& position, + const vector& U +) const +{ + scalar dt = this->owner().db().time().deltaTValue(); + + point end(position + dt*U); + + label dummyNearType = -1; + label dummyNearLabel = -1; + + forAll(faces_, faceI) + { + const label facePoint0 = faces_[faceI][0]; + + const point p0 = points_[facePoint0]; + + const scalar d1 = normal_ & (position - p0); + const scalar d2 = normal_ & (end - p0); + + if (sign(d1) == sign(d2)) + { + // did not cross polygon plane + continue; + } + + // intersection point + point pIntersect = position + (d1/(d1 - d2))*dt*U; + + const List<face>& tris = faceTris_[faceI]; + + // identify if point is within poly bounds + forAll(tris, triI) + { + const face& tri = tris[triI]; + triPointRef t + ( + points_[tri[0]], + points_[tri[1]], + points_[tri[2]] + ); + + if (t.classify(pIntersect, dummyNearType, dummyNearLabel)) + { + return faceI; + } + } + } + + return -1; +} + + +template<class CloudType> +Foam::label Foam::ParticleCollector<CloudType>::collectParcelConcentricCircles +( + const point& position, + const vector& U +) const +{ + label secI = -1; + + scalar dt = this->owner().db().time().deltaTValue(); + + point end(position + dt*U); + + const scalar d1 = normal_ & (position - coordSys_.origin()); + const scalar d2 = normal_ & (end - coordSys_.origin()); + + if (sign(d1) == sign(d2)) + { + // did not cross plane + return secI; + } + + // intersection point in cylindrical co-ordinate system + point pCyl = coordSys_.localPosition(position + (d1/(d1 - d2))*dt*U); + + scalar r = pCyl[0]; + + if (r < radius_.last()) + { + label radI = 0; + while (r > radius_[radI]) + { + radI++; + } + + if (nSector_ == 1) + { + secI = 4*radI; + } + else + { + scalar theta = pCyl[1] + constant::mathematical::pi; + + secI = + nSector_*radI + + floor + ( + scalar(nSector_)*theta/constant::mathematical::twoPi + ); + } + } + + return secI; +} + + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::write() +{ + const fvMesh& mesh = this->owner().mesh(); + const Time& time = mesh.time(); + scalar timeNew = time.value(); + scalar timeElapsed = timeNew - timeOld_; + + totalTime_ += timeElapsed; + + const scalar alpha = (totalTime_ - timeElapsed)/totalTime_; + const scalar beta = timeElapsed/totalTime_; + + forAll(faces_, faceI) + { + massFlowRate_[faceI] = + alpha*massFlowRate_[faceI] + beta*mass_[faceI]/timeElapsed; + massTotal_[faceI] += mass_[faceI]; + } + + const label procI = Pstream::myProcNo(); + + Info<< type() << " output:" << nl; + + if (outputFilePtr_.valid()) + { + outputFilePtr_() << time.timeName(); + } + + + Field<scalar> faceMassTotal(mass_.size()); + Field<scalar> faceMassFlowRate(massFlowRate_.size()); + + forAll(faces_, faceI) + { + scalarList allProcMass(Pstream::nProcs()); + allProcMass[procI] = massTotal_[faceI]; + Pstream::gatherList(allProcMass); + faceMassTotal[faceI] = sum(allProcMass); + + scalarList allProcMassFlowRate(Pstream::nProcs()); + allProcMassFlowRate[procI] = massFlowRate_[faceI]; + Pstream::gatherList(allProcMassFlowRate); + faceMassFlowRate[faceI] = sum(allProcMassFlowRate); + + Info<< " face " << faceI + << ": total mass = " << faceMassTotal[faceI] + << "; average mass flow rate = " << faceMassFlowRate[faceI] + << nl; + + if (outputFilePtr_.valid()) + { + outputFilePtr_() + << tab << area_[faceI] + << tab << faceMassTotal[faceI] + << tab << faceMassFlowRate[faceI] + << endl; + } + } + + Info<< endl; + + + if (surfaceFormat_ != "none") + { + if (Pstream::master()) + { + autoPtr<surfaceWriter> writer(surfaceWriter::New(surfaceFormat_)); + + writer->write + ( + outputDir_/time.timeName(), + "collector", + points_, + faces_, + "massTotal", + faceMassTotal, + false + ); + + writer->write + ( + outputDir_/time.timeName(), + "collector", + points_, + faces_, + "massFlowRate", + faceMassFlowRate, + false + ); + } + } + + + if (resetOnWrite_) + { + forAll(faces_, faceI) + { + massFlowRate_[faceI] = 0.0; + } + timeOld_ = timeNew; + totalTime_ = 0.0; + } + + forAll(faces_, faceI) + { + mass_[faceI] = 0.0; + } + + // writeProperties(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ParticleCollector<CloudType>::ParticleCollector +( + const dictionary& dict, + CloudType& owner +) +: + CloudFunctionObject<CloudType>(dict, owner, typeName), + mode_(mtUnknown), + parcelType_(this->coeffDict().lookupOrDefault("parcelType", -1)), + removeCollected_(this->coeffDict().lookup("removeCollected")), + points_(), + faces_(), + faceTris_(), + nSector_(0), + radius_(), + coordSys_(false), + normal_(this->coeffDict().lookup("normal")), + negateParcelsOppositeNormal_ + ( + readBool(this->coeffDict().lookup("negateParcelsOppositeNormal")) + ), + surfaceFormat_(this->coeffDict().lookup("surfaceFormat")), + resetOnWrite_(this->coeffDict().lookup("resetOnWrite")), + totalTime_(0.0), + mass_(), + massTotal_(), + massFlowRate_(), + log_(this->coeffDict().lookup("log")), + outputFilePtr_(), + outputDir_(owner.mesh().time().path()), + timeOld_(owner.mesh().time().value()) +{ + if (Pstream::parRun()) + { + // Put in undecomposed case (Note: gives problems for + // distributed data running) + outputDir_ = + outputDir_/".."/"postProcessing"/cloud::prefix/owner.name(); + } + else + { + outputDir_ = + outputDir_/"postProcessing"/cloud::prefix/owner.name(); + } + + normal_ /= mag(normal_); + + word mode(this->coeffDict().lookup("mode")); + if (mode == "polygon") + { + initPolygons(); + } + else if (mode == "concentricCircle") + { + initConcentricCircles(); + } + else + { + FatalErrorIn + ( + "Foam::ParticleCollector<CloudType>::ParticleCollector" + "(" + "const dictionary& dict," + "CloudType& owner" + ")" + ) + << "Unknown mode " << mode << ". Available options are " + << "polygon and concentricCircle" << exit(FatalError); + } + + mass_.setSize(faces_.size(), 0.0); + massTotal_.setSize(faces_.size(), 0.0); + massFlowRate_.setSize(faces_.size(), 0.0); + + makeLogFile(faces_, points_, area_); + + // readProperties(); AND initialise mass... fields +} + + +template<class CloudType> +Foam::ParticleCollector<CloudType>::ParticleCollector +( + const ParticleCollector<CloudType>& pc +) +: + CloudFunctionObject<CloudType>(pc), + mode_(pc.mode_), + parcelType_(pc.parcelType_), + points_(pc.points_), + faces_(pc.faces_), + faceTris_(pc.faceTris_), + nSector_(pc.nSector_), + radius_(pc.radius_), + coordSys_(pc.coordSys_), + normal_(pc.normal_), + negateParcelsOppositeNormal_(pc.negateParcelsOppositeNormal_), + surfaceFormat_(pc.surfaceFormat_), + resetOnWrite_(pc.resetOnWrite_), + totalTime_(pc.totalTime_), + mass_(pc.mass_), + massTotal_(pc.massTotal_), + massFlowRate_(pc.massFlowRate_), + log_(pc.log_), + outputFilePtr_(), + outputDir_(pc.outputDir_), + timeOld_(0.0) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class CloudType> +Foam::ParticleCollector<CloudType>::~ParticleCollector() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class CloudType> +void Foam::ParticleCollector<CloudType>::postMove +( + const parcelType& p, + const label cellI, + const scalar dt, + bool& keepParticle +) +{ + if ((parcelType_ != -1) && (parcelType_ != p.typeId())) + { + return; + } + + label faceI = -1; + + switch (mode_) + { + case mtPolygon: + { + faceI = collectParcelPolygon(p.position(), p.U()); + break; + } + case mtConcentricCircle: + { + faceI = collectParcelConcentricCircles(p.position(), p.U()); + break; + } + default: + { + } + } + + if (faceI != -1) + { + scalar m = p.nParticle()*p.mass(); + + if (negateParcelsOppositeNormal_) + { + vector Uhat = p.U(); + Uhat /= mag(Uhat) + ROOTVSMALL; + if ((Uhat & normal_) < 0) + { + m *= -1.0; + } + } + + // add mass contribution + mass_[faceI] += m; + + if (nSector_ == 1) + { + mass_[faceI + 1] += m; + mass_[faceI + 2] += m; + mass_[faceI + 3] += m; + } + + if (removeCollected_) + { + keepParticle = false; + } + } +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H new file mode 100644 index 0000000000000000000000000000000000000000..29bb8ff95bda3c0d86a187305f563359b1f9c803 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.H @@ -0,0 +1,259 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::ParticleCollector + +Description + Function object to collect the parcel mass- and mass flow rate over a + set of polygons. The polygons are defined as lists of points. If a + parcel is 'collected', it is subsequently flagged to be removed from the + domain. + +SourceFiles + ParticleCollector.C + +\*---------------------------------------------------------------------------*/ + +#ifndef ParticleCollector_H +#define ParticleCollector_H + +#include "CloudFunctionObject.H" +#include "cylindricalCS.H" +#include "face.H" +#include "Switch.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class ParticleCollector Declaration +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +class ParticleCollector +: + public CloudFunctionObject<CloudType> +{ +public: + + enum modeType + { + mtPolygon, + mtConcentricCircle, + mtUnknown + }; + + +private: + + // Private Data + + // Typedefs + + //- Convenience typedef for parcel type + typedef typename CloudType::parcelType parcelType; + + //- Collector mode type + modeType mode_; + + //- Index of parcel types to collect (-1 by default = all particles) + const label parcelType_; + + //- Flag to remove collected particles + Switch removeCollected_; + + //- List of points + Field<point> points_; + + //- List of faces + List<face> faces_; + + + // Polygon collector + + //- Triangulation of faces + List<List<face> > faceTris_; + + // Concentric circles collector + + //- Number of sectors per circle + label nSector_; + + //- List of radii + List<scalar> radius_; + + //- Cylindrical co-ordinate system + cylindricalCS coordSys_; + + + //- Face areas + Field<scalar> area_; + + //- Polygon normal vector + vector normal_; + + //- Remove mass of parcel travelling in opposite direction to normal_ + bool negateParcelsOppositeNormal_; + + //- Surface output format + const word surfaceFormat_; + + //- Flag to indicate whether data should be reset/cleared on writing + Switch resetOnWrite_; + + //- Total time + scalar totalTime_; + + //- Mass storage + List<scalar> mass_; + + //- Mass total storage + List<scalar> massTotal_; + + //- Mass flow rate storage + List<scalar> massFlowRate_; + + //- Flag to indicate whether data should be written to file + Switch log_; + + //- Output file pointer + autoPtr<OFstream> outputFilePtr_; + + //- Output directory + fileName outputDir_; + + //- Last calculation time + scalar timeOld_; + + + // Private Member Functions + + //- Helper function to create log files + void makeLogFile + ( + const faceList& faces, + const Field<point>& points, + const Field<scalar>& area + ); + + //- Initialise polygon collectors + void initPolygons(); + + //- Initialise concentric circle collectors + void initConcentricCircles(); + + //- Collect parcels in polygon collectors + label collectParcelPolygon + ( + const point& position, + const vector& U + ) const; + + //- Collect parcels in concentric circle collectors + label collectParcelConcentricCircles + ( + const point& position, + const vector& U + ) const; + + +protected: + + // Protected Member Functions + + //- Write post-processing info + void write(); + + +public: + + //- Runtime type information + TypeName("particleCollector"); + + + // Constructors + + //- Construct from dictionary + ParticleCollector(const dictionary& dict, CloudType& owner); + + //- Construct copy + ParticleCollector(const ParticleCollector<CloudType>& pc); + + //- Construct and return a clone + virtual autoPtr<CloudFunctionObject<CloudType> > clone() const + { + return autoPtr<CloudFunctionObject<CloudType> > + ( + new ParticleCollector<CloudType>(*this) + ); + } + + + //- Destructor + virtual ~ParticleCollector(); + + + // Member Functions + + // Access + + //- Return const access to the reset on write flag + inline const Switch& resetOnWrite() const; + + + // Evaluation + + //- Post-move hook + virtual void postMove + ( + const parcelType& p, + const label cellI, + const scalar dt, + bool& keepParticle + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "ParticleCollectorI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "ParticleCollector.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H new file mode 100644 index 0000000000000000000000000000000000000000..019deba51a6a9a918c716e33949247a5eae2202f --- /dev/null +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollectorI.H @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +template<class CloudType> +inline const Foam::Switch& +Foam::ParticleCollector<CloudType>::resetOnWrite() const +{ + return resetOnWrite_; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C index 81772debfe22e2bf8722a5b9cbf465901ee383d3..c0683d0dbfe0d7e8e82541c2e9bccbf1b13da075 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.C @@ -168,7 +168,8 @@ void Foam::ParticleErosion<CloudType>::postPatch const parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& ) { const label patchI = pp.index(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H index c741bd40044b8df1a7a42537984b8ae321eb4f6c..bedc447188af470d5fb6ada346eb9a693fb969b1 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleErosion/ParticleErosion.H @@ -128,7 +128,8 @@ public: const parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C index 9721a5a55d400106bf9c17d87224f188ac3b99c4..69f48bf5e039f3c0b898493095d9e17ad2a194ec 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.C @@ -112,7 +112,8 @@ template<class CloudType> void Foam::ParticleTracks<CloudType>::postFace ( const parcelType& p, - const label + const label, + bool& ) { if diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H index 9a9939dbb25e5ac5474f2a57371e228cde979985..1eeda7bcb82facb7b37483ec488498d03a04da8c 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTracks/ParticleTracks.H @@ -143,7 +143,8 @@ public: virtual void postFace ( const parcelType& p, - const label faceI + const label faceI, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C index f1b19bde59132264d37d9527387e16944a35de6c..0a5ff091230d3935666e3a8205a3cb645c23e8c4 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.C @@ -104,7 +104,8 @@ void Foam::ParticleTrap<CloudType>::postMove ( parcelType& p, const label cellI, - const scalar + const scalar, + bool& ) { if (alphaPtr_->internalField()[cellI] < threshold_) diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H index 39321af3c0886a409936aaa6d0556eaf93d0d4e9..43fac16c583cd40f19de0927f9513774ccf9ac2f 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleTrap/ParticleTrap.H @@ -125,7 +125,8 @@ public: ( typename CloudType::parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C index f66a872cfcf5d6ee735ba6a24cbf4b987f7af0a9..a267b86266ce4252837b10daffa9f88d561fa4ed 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.C @@ -220,7 +220,8 @@ void Foam::PatchPostProcessing<CloudType>::postPatch const parcelType& p, const polyPatch& pp, const scalar, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& ) { const label patchI = pp.index(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H index f7d618e6ce8b1a448c22f502ceee137a2257f845..cb4605e666adbe8de4439409e2e1433a960062c7 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/PatchPostProcessing/PatchPostProcessing.H @@ -129,7 +129,8 @@ public: const parcelType& p, const polyPatch& pp, const scalar trackFraction, - const tetIndices& tetIs + const tetIndices& tetIs, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C index dfef9f4835e4e5fe82104216139940aade8b9b33..e5b64f65caa9d94eee3c388c62680bda395ac70e 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.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 @@ -125,7 +125,8 @@ void Foam::VoidFraction<CloudType>::postMove ( const parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& ) { volScalarField& theta = thetaPtr_(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H index 26f0f65018cdf63c876d3f7f0fb25b73d2e57e1e..e8ed507f7dfefecca188deafa084b6940ed070b8 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/VoidFraction/VoidFraction.H @@ -115,7 +115,8 @@ public: ( const parcelType& p, const label cellI, - const scalar dt + const scalar dt, + bool& keepParticle ); }; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C index 6315eac8278c977f6a4a8f16e79f6f169929c137..47c952db9e48d9eaa0886cf13c42e06dca560550 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/CollisionModel/PairCollision/PairCollision.C @@ -302,13 +302,15 @@ void Foam::PairCollision<CloudType>::wallInteraction() if (particleHit) { - this->owner().functions().postFace(p, realFaceI); + bool keep = true; + this->owner().functions().postFace(p, realFaceI, keep); this->owner().functions().postPatch ( p, mesh.boundaryMesh()[patchI], 1.0, - p.currentTetIndices() + p.currentTetIndices(), + keep ); } } @@ -662,10 +664,10 @@ void Foam::PairCollision<CloudType>::collide() { preInteraction(); - wallInteraction(); - parcelInteraction(); + wallInteraction(); + postInteraction(); } diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C index 4eee7d990c5a6020f7298877c962e90268c9a49a..3e1a29e988a3fd7dee54e634acba0bee5c94f08a 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/SurfaceFilmModel/ThermoSurfaceFilm/ThermoSurfaceFilm.C @@ -398,13 +398,15 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction // surface energy of secondary parcels [J] scalar ESigmaSec = 0; - // sample splash distribution to detrmine secondary parcel diameters + // sample splash distribution to determine secondary parcel diameters scalarList dNew(parcelsPerSplash_); + scalarList npNew(parcelsPerSplash_); forAll(dNew, i) { const scalar y = rndGen_.sample01<scalar>(); dNew[i] = -dBarSplash*log(exp(-dMin/dBarSplash) - y*K); - ESigmaSec += sigma*p.areaS(dNew[i]); + npNew[i] = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]); } // incident kinetic energy [J] @@ -459,7 +461,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction // perturb new parcels towards the owner cell centre pPtr->position() += 0.5*rndGen_.sample01<scalar>()*(posC - posCf); - pPtr->nParticle() = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + pPtr->nParticle() = npNew[i]; pPtr->d() = dNew[i]; diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C index 27a050a3d5656c2b487dd2bc45b3fbd525613d7c..bf418468bd9d7ec3190c6f2e69683a50d09a323d 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C @@ -344,11 +344,13 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td) i++; } - // remove coalesced particles (diameter set to 0) + // remove coalesced parcels that fall below minimum mass threshold forAllIter(typename SprayCloud<CloudType>, *this, iter) { parcelType& p = iter(); - if (p.mass() < VSMALL) + scalar mass = p.nParticle()*p.mass(); + + if (mass < td.cloud().constProps().minParticleMass()) { this->deleteParticle(p); } diff --git a/src/mesh/autoMesh/Make/options b/src/mesh/autoMesh/Make/options index ca8cb9e2e44d51cc79d846a27a48e1731738e775..d37a26a9dd460742d9203623e4ddf6f69a4c99de 100644 --- a/src/mesh/autoMesh/Make/options +++ b/src/mesh/autoMesh/Make/options @@ -4,6 +4,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude @@ -13,6 +14,7 @@ LIB_LIBS = \ -lfiniteVolume \ -llagrangian \ -lmeshTools \ + -lfileFormats \ -ledgeMesh \ -lsurfMesh \ -ltriSurface \ diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index b08cccbb85c77cc5ccded24f6617f607d82946fc..d0e43dbb10efff738504cdee3cfcb43839a497b6 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -637,7 +637,7 @@ void Foam::autoLayerDriver::setNumLayers Info<< nl << "Handling points with inconsistent layer specification ..." << endl; - // Get for every point (really only nessecary on patch external points) + // Get for every point (really only necessary on patch external points) // the max and min of any patch faces using it. labelList maxLayers(patchNLayers.size(), labelMin); labelList minLayers(patchNLayers.size(), labelMax); @@ -2372,11 +2372,13 @@ void Foam::autoLayerDriver::getLayerCellsFaces Foam::autoLayerDriver::autoLayerDriver ( meshRefinement& meshRefiner, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ) : meshRefiner_(meshRefiner), - globalToPatch_(globalToPatch) + globalToMasterPatch_(globalToMasterPatch), + globalToSlavePatch_(globalToSlavePatch) {} @@ -2435,7 +2437,12 @@ void Foam::autoLayerDriver::addLayers // Create baffles (pairs of faces that share the same points) // Baffles stored as owner and neighbour face that have been created. List<labelPair> baffles; - meshRefiner_.createZoneBaffles(globalToPatch_, baffles); + meshRefiner_.createZoneBaffles + ( + globalToMasterPatch_, + globalToSlavePatch_, + baffles + ); if (debug&meshRefinement::MESH) { diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H index 272f1af09e8fd06083b641412c5fd356377991af..416544a7199de145d4400e14b2d71c58b8d1d9a0 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H @@ -99,7 +99,10 @@ class autoLayerDriver meshRefinement& meshRefiner_; //- From surface region to patch - const labelList globalToPatch_; + const labelList globalToMasterPatch_; + + //- From surface region to patch + const labelList globalToSlavePatch_; @@ -518,7 +521,8 @@ public: autoLayerDriver ( meshRefinement& meshRefiner, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C index 73d09f449ffbbf6980326229cf30b4e6da480b97..8ffcaa5f57874ef0ee7eb702dbf18cf8f35e801f 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C @@ -1135,6 +1135,12 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo << " " << medialRatio.name() << " : ratio of medial distance to wall distance" << nl << endl; + meshRefiner_.mesh().setInstance(meshRefiner_.timeName()); + meshRefiner_.write + ( + debug, + mesh.time().path()/meshRefiner_.timeName() + ); dispVec.write(); medialDist.write(); medialVec.write(); @@ -1409,6 +1415,94 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance *dispVec[pointI]; } + + +//XXXXX +// // Smear displacement away from fixed values (medialRatio=0 or 1) +// { +// const edgeList& edges = mesh.edges(); +// scalarField edgeWeight(edges.size(), 0.0); +// forAll(edges, edgeI) +// { +// if (isMasterEdge[edgeI]) +// { +// scalar eMag = edges[edgeI].mag(mesh.points()); +// if (eMag > VSMALL) +// { +// edgeWeight[edgeI] = 1.0/eMag; +// } +// else +// { +// edgeWeight[edgeI] = GREAT; +// } +// } +// } +// scalarField invSumWeight(mesh.nPoints()); +// sumWeights(isMasterEdge, edgeWeight, invSumWeight); +// +// +// // Get smoothly varying patch field. +// Info<< "shrinkMeshDistance : Smoothing displacement ..." << endl; +// +// const scalar lambda = 0.33; +// const scalar mu = -0.34; +// +// pointField average(mesh.nPoints()); +// for (label iter = 0; iter < 90; iter++) +// { +// // Calculate average of field +// averageNeighbours +// ( +// mesh, +// edgeWeight, +// invSumWeight, +// displacement, +// average +// ); +// +// forAll(displacement, i) +// { +// if (medialRatio[i] > SMALL && medialRatio[i] < 1-SMALL) +// { +// displacement[i] = +// (1-lambda)*displacement[i] +// +lambda*average[i]; +// } +// } +// +// +// // Calculate average of field +// averageNeighbours +// ( +// mesh, +// edgeWeight, +// invSumWeight, +// displacement, +// average +// ); +// +// forAll(displacement, i) +// { +// if (medialRatio[i] > SMALL && medialRatio[i] < 1-SMALL) +// { +// displacement[i] = (1-mu)*displacement[i]+mu*average[i]; +// } +// } +// +// +// // Do residual calculation every so often. +// if ((iter % 10) == 0) +// { +// Info<< " Iteration " << iter << " residual " +// << gSum(mag(displacement-average)) +// /returnReduce(average.size(), sumOp<label>()) +// << endl; +// } +// } +// } +//XXXXX + + if (debug&meshRefinement::MESH || debug&meshRefinement::LAYERINFO) { const_cast<Time&>(mesh.time())++; diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index dfd769fd15002f3474084f4c40bcf11733593c88..3215e4b7e74e08dce463cea5b32c53498b602d33 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -57,13 +57,15 @@ Foam::autoRefineDriver::autoRefineDriver meshRefinement& meshRefiner, decompositionMethod& decomposer, fvMeshDistribute& distributor, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ) : meshRefiner_(meshRefiner), decomposer_(decomposer), distributor_(distributor), - globalToPatch_(globalToPatch) + globalToMasterPatch_(globalToMasterPatch), + globalToSlavePatch_(globalToSlavePatch) {} @@ -235,7 +237,7 @@ Foam::label Foam::autoRefineDriver::surfaceOnlyRefine << " cells (out of " << mesh.globalData().nTotalCells() << ')' << endl; - // Stop when no cells to refine or have done minimum nessecary + // Stop when no cells to refine or have done minimum necessary // iterations and not enough cells to refine. if ( @@ -313,7 +315,8 @@ void Foam::autoRefineDriver::removeInsideCells meshRefiner_.splitMesh ( nBufferLayers, // nBufferLayers - globalToPatch_, + globalToMasterPatch_, + globalToSlavePatch_, refineParams.keepPoints()[0] ); @@ -438,7 +441,7 @@ Foam::label Foam::autoRefineDriver::shellRefine << " cells (out of " << mesh.globalData().nTotalCells() << ')' << endl; - // Stop when no cells to refine or have done minimum nessecary + // Stop when no cells to refine or have done minimum necessary // iterations and not enough cells to refine. if ( @@ -521,7 +524,8 @@ void Foam::autoRefineDriver::baffleAndSplitMesh !handleSnapProblems, // merge free standing baffles? motionDict, const_cast<Time&>(mesh.time()), - globalToPatch_, + globalToMasterPatch_, + globalToSlavePatch_, refineParams.keepPoints()[0] ); } @@ -606,7 +610,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles //true, // merge free standing baffles? motionDict, const_cast<Time&>(mesh.time()), - globalToPatch_, + globalToMasterPatch_, + globalToSlavePatch_, refineParams.keepPoints()[0] ); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H index d75dd5daf5f840c5b22d6af6553465a72ba05422..37a0f6b10258fd7ed7a1d54b6a66c447720ee678 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.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 @@ -65,7 +65,10 @@ class autoRefineDriver fvMeshDistribute& distributor_; //- From surface region to patch - const labelList globalToPatch_; + const labelList globalToMasterPatch_; + + //- From surface region to patch + const labelList globalToSlavePatch_; // Private Member Functions @@ -146,7 +149,8 @@ public: meshRefinement& meshRefiner, decompositionMethod& decomposer, fvMeshDistribute& distributor, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 54a78f477c6a5e7170572da5c8867654c564c543..b7b79d715e3e71cd3ca2656d511ff86b46ac3282 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -573,11 +573,13 @@ bool Foam::autoSnapDriver::outwardsDisplacement Foam::autoSnapDriver::autoSnapDriver ( meshRefinement& meshRefiner, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ) : meshRefiner_(meshRefiner), - globalToPatch_(globalToPatch) + globalToMasterPatch_(globalToMasterPatch), + globalToSlavePatch_(globalToSlavePatch) {} @@ -1191,7 +1193,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface if (hitSurface[i] != -1 && !isZonedFace.get(faceI)) { - closestPatch[i] = globalToPatch_ + closestPatch[i] = globalToMasterPatch_ [ surfaces.globalRegion ( @@ -1265,7 +1267,12 @@ void Foam::autoSnapDriver::doSnap // Create baffles (pairs of faces that share the same points) // Baffles stored as owner and neighbour face that have been created. List<labelPair> baffles; - meshRefiner_.createZoneBaffles(globalToPatch_, baffles); + meshRefiner_.createZoneBaffles + ( + globalToMasterPatch_, + globalToSlavePatch_, + baffles + ); // Selectively 'forget' about the baffles, i.e. not check across them diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index 7cf1e79f6121a963dc5ccdf108ac05e0bd7f75d9..e6763bc084850a9150d726e7a880544093755f59 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -59,8 +59,11 @@ class autoSnapDriver //- Mesh+surface meshRefinement& meshRefiner_; - //- From surface region to patch - const labelList globalToPatch_; + //- From global surface region to master side patch + const labelList globalToMasterPatch_; + + //- From global surface region to slave side patch + const labelList globalToSlavePatch_; // Private Member Functions @@ -167,7 +170,7 @@ class autoSnapDriver void correctAttraction ( const DynamicList<point>& surfacePoints, - const DynamicList<label>& surfaceCount, + const DynamicList<label>& surfaceCounts, const point& edgePt, const vector& edgeNormal, // normalised normal const point& pt, @@ -213,7 +216,7 @@ class autoSnapDriver DynamicList<point>& surfacePoints, DynamicList<vector>& surfaceNormals, - DynamicList<label>& surfaceCount + DynamicList<label>& surfaceCounts ) const; void binFeatureFaces ( @@ -224,13 +227,13 @@ class autoSnapDriver const scalarField& snapDist, const label pointI, - const List<List<point> >& pointFaceNormals, + const List<List<point> >& pointFaceSurfNormals, const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceCentres, DynamicList<point>& surfacePoints, DynamicList<vector>& surfaceNormals, - DynamicList<label>& surfaceCount + DynamicList<label>& surfaceCounts ) const; @@ -259,7 +262,7 @@ class autoSnapDriver const indirectPrimitivePatch& pp, const scalarField& snapDist, - const List<List<point> >& pointFaceNormals, + const List<List<point> >& pointFaceSurfNormals, const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceCentres, const labelListList& pointFacePatchID, @@ -277,7 +280,7 @@ class autoSnapDriver const indirectPrimitivePatch&, const scalarField&, - const List<List<point> >& pointFaceNormals, + const List<List<point> >& pointFaceSurfNormals, const List<List<point> >& pointFaceDisp, const List<List<point> >& pointFaceCentres, const labelListList& pointFacePatchID, @@ -390,7 +393,8 @@ public: autoSnapDriver ( meshRefinement& meshRefiner, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C index f32d9ce4bd3a775e76bac478a361c1a96d6aab16..7285c1ed003b3a3de61b1c54c38bed4f8acc6b54 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C @@ -573,7 +573,7 @@ void Foam::autoSnapDriver::calcNearestFacePointProperties pFc[i] = pp.faceCentres()[faceI]; //label meshFaceI = pp.addressing()[faceI]; //pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI); - pFid[i] = globalToPatch_[faceSurfaceGlobalRegion[faceI]]; + pFid[i] = globalToMasterPatch_[faceSurfaceGlobalRegion[faceI]]; } } @@ -690,7 +690,7 @@ void Foam::autoSnapDriver::calcNearestFacePointProperties void Foam::autoSnapDriver::correctAttraction ( const DynamicList<point>& surfacePoints, - const DynamicList<label>& surfaceCount, + const DynamicList<label>& surfaceCounts, const point& edgePt, const vector& edgeNormal, // normalised normal const point& pt, @@ -702,7 +702,7 @@ void Foam::autoSnapDriver::correctAttraction scalar tang = ((pt-edgePt)&edgeNormal); labelList order; - Foam::sortedOrder(surfaceCount, order); + Foam::sortedOrder(surfaceCounts, order); if (order[0] < order[1]) { @@ -763,7 +763,7 @@ void Foam::autoSnapDriver::binFeatureFace DynamicList<point>& surfacePoints, DynamicList<vector>& surfaceNormals, - DynamicList<label>& surfaceCount + DynamicList<label>& surfaceCounts ) const { // What to do with very far attraction? For now just ignore the face @@ -783,7 +783,7 @@ void Foam::autoSnapDriver::binFeatureFace ) { same = true; - surfaceCount[j]++; + surfaceCounts[j]++; break; } } @@ -796,7 +796,7 @@ void Foam::autoSnapDriver::binFeatureFace { surfacePoints.append(pt); surfaceNormals.append(faceSurfaceNormal); - surfaceCount.append(1); + surfaceCounts.append(1); } else if (surfacePoints.size() == 2) { @@ -810,7 +810,7 @@ void Foam::autoSnapDriver::binFeatureFace // Definitely makes a feature point surfacePoints.append(pt); surfaceNormals.append(faceSurfaceNormal); - surfaceCount.append(1); + surfaceCounts.append(1); } } else if (surfacePoints.size() == 3) @@ -834,7 +834,7 @@ void Foam::autoSnapDriver::binFeatureFace // Different feature point surfacePoints.append(pt); surfaceNormals.append(faceSurfaceNormal); - surfaceCount.append(1); + surfaceCounts.append(1); } } } @@ -860,15 +860,15 @@ void Foam::autoSnapDriver::binFeatureFaces DynamicList<point>& surfacePoints, DynamicList<vector>& surfaceNormals, - DynamicList<label>& surfaceCount + DynamicList<label>& surfaceCounts ) const { - const List<point>& pfNormals = pointFaceSurfNormals[pointI]; + const List<point>& pfSurfNormals = pointFaceSurfNormals[pointI]; const List<point>& pfDisp = pointFaceDisp[pointI]; const List<point>& pfCentres = pointFaceCentres[pointI]; // Collect all different directions - forAll(pfNormals, i) + forAll(pfSurfNormals, i) { binFeatureFace ( @@ -879,12 +879,12 @@ void Foam::autoSnapDriver::binFeatureFaces snapDist[pointI], pfCentres[i], - pfNormals[i], + pfSurfNormals[i], pfDisp[i], surfacePoints, surfaceNormals, - surfaceCount + surfaceCounts ); } } @@ -914,7 +914,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction // Collect all different directions DynamicList<point> surfacePoints(4); DynamicList<vector> surfaceNormals(4); - DynamicList<label> surfaceCount(4); + DynamicList<label> surfaceCounts(4); binFeatureFaces ( @@ -931,7 +931,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction surfacePoints, surfaceNormals, - surfaceCount + surfaceCounts ); const point& pt = pp.localPoints()[pointI]; @@ -966,11 +966,13 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction vector d = r.refPoint()-pt; d -= (d&n)*n; + //- This does not help much but distorts a perfectly aligned mesh + // so disabled for now. //// Correct for attraction to non-dominant face //correctAttraction //( // surfacePoints, - // surfaceCount, + // surfaceCounts, // r.refPoint(), // n, // normalised normal // pt, @@ -1813,8 +1815,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges } // Reverse: from pp point to nearest feature - vectorField allPatchAttraction(pp.nPoints(), vector::zero); - List<pointConstraint> allPatchConstraints(pp.nPoints()); + vectorField rawPatchAttraction(pp.nPoints(), vector::zero); + List<pointConstraint> rawPatchConstraints(pp.nPoints()); determineFeatures ( @@ -1837,15 +1839,15 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges edgeAttractors, edgeConstraints, // pp point to nearest feature - allPatchAttraction, - allPatchConstraints + rawPatchAttraction, + rawPatchConstraints ); // Baffle handling // ~~~~~~~~~~~~~~~ - // Override pointAttractor, edgeAttractor, allPatchAttration etc. to + // Override pointAttractor, edgeAttractor, rawPatchAttration etc. to // implement 'baffle' handling. // Baffle: the mesh pp point originates from a loose standing // baffle. @@ -1983,8 +1985,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges featI, edgeAttractors, edgeConstraints, - allPatchAttraction, - allPatchConstraints + rawPatchAttraction, + rawPatchConstraints ); if (!nearInfo.hit()) @@ -2033,8 +2035,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges vector::zero; // Store for later use - allPatchAttraction[pointI] = featPt-pt; - allPatchConstraints[pointI] = + rawPatchAttraction[pointI] = featPt-pt; + rawPatchConstraints[pointI] = pointConstraints[featI][featPointI]; if (oldPointI != -1) @@ -2053,8 +2055,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges edgeFeatI, edgeAttractors, edgeConstraints, - allPatchAttraction, - allPatchConstraints + rawPatchAttraction, + rawPatchConstraints ); } } @@ -2084,8 +2086,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges featI, edgeAttractors, edgeConstraints, - allPatchAttraction, - allPatchConstraints + rawPatchAttraction, + rawPatchConstraints ); } } @@ -2296,11 +2298,11 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges if ( patchConstraints[pointI].first() <= 1 - && allPatchConstraints[pointI].first() > 1 + && rawPatchConstraints[pointI].first() > 1 ) { - patchAttraction[pointI] = allPatchAttraction[pointI]; - patchConstraints[pointI] = allPatchConstraints[pointI]; + patchAttraction[pointI] = rawPatchAttraction[pointI]; + patchConstraints[pointI] = rawPatchConstraints[pointI]; if (multiPatchStr.valid()) { @@ -2434,7 +2436,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges // Snap edges to feature edges // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Walk existing edges and snap remaining ones (that are marked as - // feature edges in allPatchConstraints) + // feature edges in rawPatchConstraints) stringFeatureEdges ( @@ -2444,8 +2446,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges pp, snapDist, - allPatchAttraction, - allPatchConstraints, + rawPatchAttraction, + rawPatchConstraints, patchAttraction, patchConstraints diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C index 2890577c24b01fc80a96fc092a785248966a5dba..69cdf234cdb41828140af5bc4553d348a05f2de9 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C @@ -55,6 +55,7 @@ License #include "searchableSurfaces.H" #include "treeBoundBox.H" #include "zeroGradientFvPatchFields.H" +#include "fvMeshTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -1700,7 +1701,7 @@ Foam::label Foam::meshRefinement::addPatch oldToNew[addedPatchI] = insertPatchI; // Shuffle into place - polyPatches.reorder(oldToNew); + polyPatches.reorder(oldToNew, true); fvPatches.reorder(oldToNew); reorderPatchFields<volScalarField>(mesh, oldToNew); @@ -1736,6 +1737,28 @@ Foam::label Foam::meshRefinement::addMeshedPatch // Add patch label patchI = addPatch(mesh_, name, patchInfo); +// dictionary patchDict(patchInfo); +// patchDict.set("nFaces", 0); +// patchDict.set("startFace", 0); +// autoPtr<polyPatch> ppPtr +// ( +// polyPatch::New +// ( +// name, +// patchDict, +// 0, +// mesh_.boundaryMesh() +// ) +// ); +// label patchI = fvMeshTools::addPatch +// ( +// mesh_, +// ppPtr(), +// dictionary(), // optional field values +// calculatedFvPatchField<scalar>::typeName, +// true +// ); + // Store label sz = meshedPatches_.size(); meshedPatches_.setSize(sz+1); @@ -2295,13 +2318,6 @@ void Foam::meshRefinement::dumpIntersections(const fileName& prefix) const } } - // Convert to vtk format - string cmd - ( - "objToVTK " + prefix + "_edges.obj " + prefix + "_edges.vtk > /dev/null" - ); - system(cmd.c_str()); - Pout<< endl; } diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index b98230e4122c925527c9158dbcc57b8bc8c8abc4..c265f05257568c8444f9562991ec6e6cf11c9c3a 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -330,10 +330,11 @@ private: // Baffle handling //- Get faces to repatch. Returns map from face to patch. - Map<label> getZoneBafflePatches + Map<labelPair> getZoneBafflePatches ( const bool allowBoundary, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ) const; //- Geometric test on see whether face needs to be baffled: @@ -349,7 +350,7 @@ private: //- Determine patches for baffles void getBafflePatches ( - const labelList& globalToPatch, + const labelList& globalToMasterPatch, const labelList& neiLevel, const pointField& neiCc, labelList& ownPatch, @@ -426,7 +427,7 @@ private: const dictionary& motionDict, const bool removeEdgeConnectedCells, const scalarField& perpendicularAngle, - const labelList& globalToPatch + const labelList& globalToMasterPatch ) const; @@ -707,7 +708,8 @@ public: const bool mergeFreeStanding, const dictionary& motionDict, Time& runTime, - const labelList& globalToPatch, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, const point& keepPoint ); @@ -716,7 +718,8 @@ public: autoPtr<mapPolyMesh> splitMesh ( const label nBufferLayers, - const labelList& globalToPatch, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, const point& keepPoint ); @@ -741,7 +744,8 @@ public: // baffles. autoPtr<mapPolyMesh> createZoneBaffles ( - const labelList& globalToPatch, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, List<labelPair>& ); diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index aeaa5ac4cb61387d684a2af31c148b4b975c161a..11dde360ebb20829b3bb2267be1246eb7d6a847b 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -259,7 +259,7 @@ bool Foam::meshRefinement::validBaffleTopology // Determine patches for baffles on all intersected unnamed faces void Foam::meshRefinement::getBafflePatches ( - const labelList& globalToPatch, + const labelList& globalToMasterPatch, const labelList& neiLevel, const pointField& neiCc, @@ -376,11 +376,11 @@ void Foam::meshRefinement::getBafflePatches } // Pick up the patches - ownPatch[faceI] = globalToPatch + ownPatch[faceI] = globalToMasterPatch [ surfaces_.globalRegion(surface1[i], region1[i]) ]; - neiPatch[faceI] = globalToPatch + neiPatch[faceI] = globalToMasterPatch [ surfaces_.globalRegion(surface2[i], region2[i]) ]; @@ -406,14 +406,14 @@ void Foam::meshRefinement::getBafflePatches } -// Get faces to repatch. Returns map from face to patch. -Foam::Map<Foam::label> Foam::meshRefinement::getZoneBafflePatches +Foam::Map<Foam::labelPair> Foam::meshRefinement::getZoneBafflePatches ( const bool allowBoundary, - const labelList& globalToPatch + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch ) const { - Map<label> bafflePatch(mesh_.nFaces()/1000); + Map<labelPair> bafflePatch(mesh_.nFaces()/1000); const wordList& faceZoneNames = surfaces_.faceZoneNames(); const faceZoneMesh& fZones = mesh_.faceZones(); @@ -427,40 +427,39 @@ Foam::Map<Foam::label> Foam::meshRefinement::getZoneBafflePatches const faceZone& fZone = fZones[zoneI]; - //// Get patch allocated for zone - //label patchI = surfaceToCyclicPatch_[surfI]; - // Get patch of (first region) of surface - label patchI = globalToPatch[surfaces_.globalRegion(surfI, 0)]; + // Get patch allocated for zone + label globalRegionI = surfaces_.globalRegion(surfI, 0); + labelPair zPatches + ( + globalToMasterPatch[globalRegionI], + globalToSlavePatch[globalRegionI] + ); - Info<< "For surface " - << surfaces_.names()[surfI] - << " found faceZone " << fZone.name() - << " and patch " << mesh_.boundaryMesh()[patchI].name() + Info<< "For zone " << fZone.name() << " found patches " + << mesh_.boundaryMesh()[zPatches[0]].name() << " and " + << mesh_.boundaryMesh()[zPatches[1]].name() << endl; - forAll(fZone, i) { label faceI = fZone[i]; if (allowBoundary || mesh_.isInternalFace(faceI)) { - if (!bafflePatch.insert(faceI, patchI)) + labelPair patches = zPatches; + if (fZone.flipMap()[i]) { - label oldPatchI = bafflePatch[faceI]; + patches = patches.reversePair(); + } - if (oldPatchI != patchI) - { - FatalErrorIn("getZoneBafflePatches(const bool)") - << "Face " << faceI - << " fc:" << mesh_.faceCentres()[faceI] - << " in zone " << fZone.name() - << " is in patch " - << mesh_.boundaryMesh()[oldPatchI].name() - << " and in patch " - << mesh_.boundaryMesh()[patchI].name() - << abort(FatalError); - } + if (!bafflePatch.insert(faceI, patches)) + { + FatalErrorIn("getZoneBafflePatches(..)") + << "Face " << faceI + << " fc:" << mesh_.faceCentres()[faceI] + << " in zone " << fZone.name() + << " is in multiple zones!" + << abort(FatalError); } } } @@ -698,7 +697,8 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::getDuplicateFaces Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles ( - const labelList& globalToPatch, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, List<labelPair>& baffles ) { @@ -714,20 +714,30 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles // Get faces (internal only) to be baffled. Map from face to patch // label. - Map<label> faceToPatch(getZoneBafflePatches(false, globalToPatch)); + Map<labelPair> faceToPatch + ( + getZoneBafflePatches + ( + false, + globalToMasterPatch, + globalToSlavePatch + ) + ); label nZoneFaces = returnReduce(faceToPatch.size(), sumOp<label>()); if (nZoneFaces > 0) { // Convert into labelLists labelList ownPatch(mesh_.nFaces(), -1); - forAllConstIter(Map<label>, faceToPatch, iter) + labelList neiPatch(mesh_.nFaces(), -1); + forAllConstIter(Map<labelPair>, faceToPatch, iter) { - ownPatch[iter.key()] = iter(); + ownPatch[iter.key()] = iter().first(); + neiPatch[iter.key()] = iter().second(); } // Create baffles. both sides same patch. - map = createBaffles(ownPatch, ownPatch); + map = createBaffles(ownPatch, neiPatch); // Get pairs of faces created. // Just loop over faceMap and store baffle if we encounter a slave @@ -744,7 +754,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles label oldFaceI = faceMap[faceI]; // Does face originate from face-to-patch - Map<label>::const_iterator iter = faceToPatch.find(oldFaceI); + Map<labelPair>::const_iterator iter = faceToPatch.find + ( + oldFaceI + ); if (iter != faceToPatch.end()) { @@ -1108,7 +1121,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles mesh_.setInstance(timeName()); // Update intersections. Recalculate intersections on merged faces since - // this seems to give problems? Note: should not be nessecary since + // this seems to give problems? Note: should not be necessary since // baffles preserve intersections from when they were created. labelList newExposedFaces(2*couples.size()); label newI = 0; @@ -1344,7 +1357,8 @@ void Foam::meshRefinement::findCellZoneGeometric // Sync syncTools::syncFaceList(mesh_, namedSurfaceIndex, maxEqOp<label>()); } -//XXXXXXXXX + + void Foam::meshRefinement::findCellZoneInsideWalk ( const labelList& locationSurfaces, // indices of surfaces with inside point @@ -1446,7 +1460,6 @@ void Foam::meshRefinement::findCellZoneInsideWalk } } } -//XXXXXXXXX bool Foam::meshRefinement::calcRegionToZone @@ -1827,7 +1840,8 @@ void Foam::meshRefinement::baffleAndSplitMesh const bool mergeFreeStanding, const dictionary& motionDict, Time& runTime, - const labelList& globalToPatch, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, const point& keepPoint ) { @@ -1849,7 +1863,7 @@ void Foam::meshRefinement::baffleAndSplitMesh labelList ownPatch, neiPatch; getBafflePatches ( - globalToPatch, + globalToMasterPatch, neiLevel, neiCc, @@ -1899,7 +1913,7 @@ void Foam::meshRefinement::baffleAndSplitMesh motionDict, removeEdgeConnectedCells, perpendicularAngle, - globalToPatch + globalToMasterPatch ) //markFacesOnProblemCellsGeometric(motionDict) ); @@ -1917,7 +1931,7 @@ void Foam::meshRefinement::baffleAndSplitMesh motionDict, removeEdgeConnectedCells, perpendicularAngle, - globalToPatch + globalToMasterPatch ) ); forAll(facePatchTopo, faceI) @@ -2051,7 +2065,8 @@ void Foam::meshRefinement::baffleAndSplitMesh Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh ( const label nBufferLayers, - const labelList& globalToPatch, + const labelList& globalToMasterPatch, + const labelList& globalToSlavePatch, const point& keepPoint ) { @@ -2066,7 +2081,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh labelList ownPatch, neiPatch; getBafflePatches ( - globalToPatch, + globalToMasterPatch, neiLevel, neiCc, @@ -2129,9 +2144,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh // Patch for exposed faces for lack of anything sensible. label defaultPatch = 0; - if (globalToPatch.size()) + if (globalToMasterPatch.size()) { - defaultPatch = globalToPatch[0]; + defaultPatch = globalToMasterPatch[0]; } for (label i = 0; i < nBufferLayers; i++) diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C index 38afad6fa2d70c30a5d4f644e952a8ba3ab84b0e..5dc9d062729146118134a501efb040bd783146bd 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.C @@ -515,7 +515,7 @@ void Foam::refinementSurfaces::setMinLevelFields if (geom.regions().size() > 1 && geom.globalSize() > 10) { // Representative local coordinates - const pointField ctrs = geom.coordinates(); + const pointField ctrs(geom.coordinates()); labelList minLevelField(ctrs.size(), -1); { diff --git a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H index 2f685ed4ff3c569ee95059e1ba87716d06c0b7ef..aed21821b5cb1ea994617490a919f694becc39c2 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H +++ b/src/mesh/autoMesh/autoHexMesh/refinementSurfaces/refinementSurfaces.H @@ -168,7 +168,8 @@ public: return names_; } - //- Per 'interface' surface : name of faceZone to put faces into + //- Per 'interface' surface : empty or name of faceZone to put + // faces into const wordList& faceZoneNames() const { return faceZoneNames_; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index 1f9f4c66ec68de7c06a16114e741bd9d5449a2f0..fc60cd2fbba5c8d30cac94380afff83e05c7a7c9 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -27,63 +27,6 @@ License #include "meshTools.H" #include "mapDistribute.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - //- Helper class for list - template<class T> - class ListPlusEqOp - { - public: - void operator()(List<T>& x, const List<T> y) const - { - if (y.size()) - { - if (x.size()) - { - label sz = x.size(); - x.setSize(sz + y.size()); - forAll(y, i) - { - x[sz++] = y[i]; - } - } - else - { - x = y; - } - } - } - }; - - //- Combine operator for interpolateToSource/Target - template<class Type, class CombineOp> - class combineBinaryOp - { - const CombineOp& cop_; - - public: - - combineBinaryOp(const CombineOp& cop) - : - cop_(cop) - {} - - void operator() - ( - Type& x, - const label faceI, - const Type& y, - const scalar weight - ) const - { - cop_(x, weight*y); - } - }; -} - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class SourcePatch, class TargetPatch> @@ -1550,7 +1493,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update } // send data back to originating procs. Note that contributions - // from different processors get added (ListPlusEqOp) + // from different processors get added (ListAppendEqOp) mapDistribute::distribute ( @@ -1560,7 +1503,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update map.constructMap(), map.subMap(), tgtAddress_, - ListPlusEqOp<label>(), + ListAppendEqOp<label>(), labelList() ); @@ -1572,7 +1515,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update map.constructMap(), map.subMap(), tgtWeights_, - ListPlusEqOp<scalar>(), + ListAppendEqOp<scalar>(), scalarList() ); @@ -1787,7 +1730,12 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource ) ); - interpolateToSource(fld, combineBinaryOp<Type, CombineOp>(cop), tresult()); + interpolateToSource + ( + fld, + multiplyWeightedOp<Type, CombineOp>(cop), + tresult() + ); return tresult; } @@ -1824,7 +1772,12 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget ) ); - interpolateToTarget(fld, combineBinaryOp<Type, CombineOp>(cop), tresult()); + interpolateToTarget + ( + fld, + multiplyWeightedOp<Type, CombineOp>(cop), + tresult() + ); return tresult; } diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index abf4523afde408d1ca22944f0ab248c6107c15f6..1ce855b3aec678896dc6eadbb216e66877bacdf2 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -453,7 +453,7 @@ public: void interpolateToSource ( const UList<Type>& fld, - const CombineOp& bop, + const CombineOp& cop, List<Type>& result ) const; @@ -463,7 +463,7 @@ public: void interpolateToTarget ( const UList<Type>& fld, - const CombineOp& bop, + const CombineOp& cop, List<Type>& result ) const; diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationName.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationName.C index d70d09184d4436a4619430d56ca84d54762d345d..cf2a38a788bb9e34ae000c205948b7eaa8421d61 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationName.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolationName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::AMIInterpolationName, 0); +namespace Foam +{ +defineTypeNameAndDebug(AMIInterpolationName, 0); +} + // ************************************************************************* // diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.C index 7d9a1a71e36d870f916be3dfef4a6ba542692cb5..863013080fb838682aea623694ec585ff774af35 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterface.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cyclicAMILduInterface, 0); +namespace Foam +{ +defineTypeNameAndDebug(cyclicAMILduInterface, 0); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C index 20cb7784daa182f47d08f39a67b3506cfd02821f..0752825b563b4c3c6f5d698c3feac94c570aa4e2 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMILduInterfaceField/cyclicAMILduInterfaceField.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cyclicAMILduInterfaceField, 0); +namespace Foam +{ +defineTypeNameAndDebug(cyclicAMILduInterfaceField, 0); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index cd8f992236e3a214761aebc3b77f613070dc8a22..49ba94fda2f1056ee02516d5bb985f7bba0778cf 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -120,21 +120,21 @@ void Foam::cyclicAMIPolyPatch::calcTransforms const vectorField& half1Areas ) { - if (transform_ != neighbPatch().transform_) + if (transform() != neighbPatch().transform()) { FatalErrorIn("cyclicAMIPolyPatch::calcTransforms()") << "Patch " << name() - << " has transform type " << transformTypeNames[transform_] + << " has transform type " << transformTypeNames[transform()] << ", neighbour patch " << nbrPatchName_ << " has transform type " - << neighbPatch().transformTypeNames[neighbPatch().transform_] + << neighbPatch().transformTypeNames[neighbPatch().transform()] << exit(FatalError); } // Calculate transformation tensors - switch (transform_) + switch (transform()) { case ROTATIONAL: { @@ -371,13 +371,13 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform ) : - coupledPolyPatch(name, size, start, index, bm, patchType), + coupledPolyPatch(name, size, start, index, bm, patchType, transform), nbrPatchName_(word::null), nbrPatchID_(-1), - transform_(UNKNOWN), rotationAxis_(vector::zero), rotationCentre_(point::zero), separationVector_(vector::zero), @@ -403,7 +403,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch coupledPolyPatch(name, dict, index, bm, patchType), nbrPatchName_(dict.lookup("neighbourPatch")), nbrPatchID_(-1), - transform_(UNKNOWN), rotationAxis_(vector::zero), rotationCentre_(point::zero), separationVector_(vector::zero), @@ -429,46 +428,42 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch << exit(FatalIOError); } - if (dict.found("transform")) + switch (transform()) { - transform_ = transformTypeNames.read(dict.lookup("transform")); - switch (transform_) + case ROTATIONAL: { - case ROTATIONAL: - { - dict.lookup("rotationAxis") >> rotationAxis_; - dict.lookup("rotationCentre") >> rotationCentre_; - - scalar magRot = mag(rotationAxis_); - if (magRot < SMALL) - { - FatalIOErrorIn - ( - "cyclicAMIPolyPatch::cyclicAMIPolyPatch" - "(" - "const word&, " - "const dictionary&, " - "const label, " - "const polyBoundaryMesh&" - ")", - dict - ) << "Illegal rotationAxis " << rotationAxis_ << endl - << "Please supply a non-zero vector." - << exit(FatalIOError); - } - rotationAxis_ /= magRot; - - break; - } - case TRANSLATIONAL: - { - dict.lookup("separationVector") >> separationVector_; - break; - } - default: + dict.lookup("rotationAxis") >> rotationAxis_; + dict.lookup("rotationCentre") >> rotationCentre_; + + scalar magRot = mag(rotationAxis_); + if (magRot < SMALL) { - // no additional info required + FatalIOErrorIn + ( + "cyclicAMIPolyPatch::cyclicAMIPolyPatch" + "(" + "const word&, " + "const dictionary&, " + "const label, " + "const polyBoundaryMesh&" + ")", + dict + ) << "Illegal rotationAxis " << rotationAxis_ << endl + << "Please supply a non-zero vector." + << exit(FatalIOError); } + rotationAxis_ /= magRot; + + break; + } + case TRANSLATIONAL: + { + dict.lookup("separationVector") >> separationVector_; + break; + } + default: + { + // no additional info required } } @@ -486,7 +481,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch coupledPolyPatch(pp, bm), nbrPatchName_(pp.nbrPatchName_), nbrPatchID_(-1), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_), @@ -513,7 +507,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch coupledPolyPatch(pp, bm, index, newSize, newStart), nbrPatchName_(nbrPatchName), nbrPatchID_(-1), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_), @@ -554,7 +547,6 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch coupledPolyPatch(pp, bm, index, mapAddressing, newStart), nbrPatchName_(pp.nbrPatchName_), nbrPatchID_(-1), - transform_(pp.transform_), rotationAxis_(pp.rotationAxis_), rotationCentre_(pp.rotationCentre_), separationVector_(pp.separationVector_), @@ -672,7 +664,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const { if (!parallel()) { - if (transform_ == ROTATIONAL) + if (transform() == ROTATIONAL) { l = Foam::transform(forwardT(), l - rotationCentre_) + rotationCentre_; @@ -718,7 +710,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition : forwardT()[faceI] ); - if (transform_ == ROTATIONAL) + if (transform() == ROTATIONAL) { l = Foam::transform(T, l - rotationCentre_) + rotationCentre_; } @@ -796,12 +788,10 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const os.writeKeyword("neighbourPatch") << nbrPatchName_ << token::END_STATEMENT << nl; - switch (transform_) + switch (transform()) { case ROTATIONAL: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; os.writeKeyword("rotationAxis") << rotationAxis_ << token::END_STATEMENT << nl; os.writeKeyword("rotationCentre") << rotationCentre_ @@ -810,16 +800,12 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const } case TRANSLATIONAL: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; os.writeKeyword("separationVector") << separationVector_ << token::END_STATEMENT << nl; break; } case NOORDERING: { - os.writeKeyword("transform") << transformTypeNames[transform_] - << token::END_STATEMENT << nl; break; } default: diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H index b1f420318eedfe839e23589bf7c40d653c2adff3..45aef519524ab8278e788771162f0f9399f21f26 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatch.H @@ -66,10 +66,6 @@ private: // Transformations - //- Type of transformation - rotational or translational - transformType transform_; - - // For rotation //- Axis of rotation for rotational cyclics @@ -161,7 +157,8 @@ public: const label start, const label index, const polyBoundaryMesh& bm, - const word& patchType + const word& patchType, + const transformType transform = UNKNOWN ); //- Construct from dictionary @@ -290,9 +287,6 @@ public: // Transformations - //- Type of transform - inline transformType transform() const; - //- Axis of rotation for rotational cyclic AMI inline const vector& rotationAxis() const; @@ -327,11 +321,11 @@ public: ) const; //- Low-level interpolate List - template<class Type, class BinaryOp> + template<class Type, class CombineOp> void interpolate ( const UList<Type>& fld, - const BinaryOp& bop, + const CombineOp& cop, List<Type>& result ) const; diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H index 3f3c2a475540dc0c421e88df9c4cc433dac504c7..6d726e9df7a679208168c58f3feb6683693bacf1 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.H +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchI.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 @@ -39,13 +39,6 @@ Foam::cyclicAMIPolyPatch::neighbPatch() const } -inline Foam::coupledPolyPatch::transformType -Foam::cyclicAMIPolyPatch::transform() const -{ - return transform_; -} - - inline const Foam::vector& Foam::cyclicAMIPolyPatch::rotationAxis() const { return rotationAxis_; diff --git a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C index e4457dffade02eb00c0b2b40269bad427e9c642e..bf4507ff8e0161adefb595974282f8072b559eb4 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.C +++ b/src/meshTools/AMIInterpolation/patches/cyclic/cyclicAMIPolyPatch/cyclicAMIPolyPatchTemplates.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 @@ -59,21 +59,21 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicAMIPolyPatch::interpolate } -template<class Type, class BinaryOp> +template<class Type, class CombineOp> void Foam::cyclicAMIPolyPatch::interpolate ( const UList<Type>& fld, - const BinaryOp& bop, + const CombineOp& cop, List<Type>& result ) const { if (owner()) { - AMI().interpolateToSource(fld, bop, result); + AMI().interpolateToSource(fld, cop, result); } else { - neighbPatch().AMI().interpolateToTarget(fld, bop, result); + neighbPatch().AMI().interpolateToTarget(fld, cop, result); } } diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index d341053951523d8d84989ce91de0726d94e1c767..1b3dffa89d2bc34c8cf3d913bd39fd921e2becee 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -128,6 +128,7 @@ faceZoneSources = sets/faceZoneSources $(faceZoneSources)/faceZoneToFaceZone/faceZoneToFaceZone.C $(faceZoneSources)/setsToFaceZone/setsToFaceZone.C $(faceZoneSources)/setToFaceZone/setToFaceZone.C +$(faceZoneSources)/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C cellZoneSources = sets/cellZoneSources $(cellZoneSources)/setToCellZone/setToCellZone.C diff --git a/src/meshTools/Make/options b/src/meshTools/Make/options index 45765759c16acadd0d907685d44e79783df5cc54..1b22dab2a0fd8549e981e74b454bd985bdb45c3a 100644 --- a/src/meshTools/Make/options +++ b/src/meshTools/Make/options @@ -1,5 +1,7 @@ EXE_INC = \ - -I$(LIB_SRC)/triSurface/lnInclude + -I$(LIB_SRC)/triSurface/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude LIB_LIBS = \ - -ltriSurface + -ltriSurface \ + -lfileFormats diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C b/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C index 6fc25dbae9f05999cc3869cf1af726ccd2462129..2a98fdf5f0410f5c5531863d71cd5fbf1fc7aad9 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWaveName.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWaveName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::FaceCellWaveName, 0); +namespace Foam +{ +defineTypeNameAndDebug(FaceCellWaveName, 0); +} + // ************************************************************************* // diff --git a/src/meshTools/algorithms/MeshWave/MeshWaveName.C b/src/meshTools/algorithms/MeshWave/MeshWaveName.C index 6c17c838f7a098d0bb16be8443db735b59ec1397..4de3d767893bff1aa55c09a1647980c04e55ff4a 100644 --- a/src/meshTools/algorithms/MeshWave/MeshWaveName.C +++ b/src/meshTools/algorithms/MeshWave/MeshWaveName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::MeshWaveName, 0); +namespace Foam +{ +defineTypeNameAndDebug(MeshWaveName, 0); +} + // ************************************************************************* // diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C index 5d3f3e1d581a7219bb0f1b9ce2f8f39b86753fc5..5345b425fcfd1a13b149a961db2b456feb096334 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/PatchEdgeFaceWaveName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::PatchEdgeFaceWaveName, 0); +namespace Foam +{ +defineTypeNameAndDebug(PatchEdgeFaceWaveName, 0); +} + // ************************************************************************* // diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C index 4400b0365dd49528b0e4012390f9bcf6685f0787..0ef785383ba27d03ac8c22d84be37cdd0192ea80 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.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 @@ -115,6 +115,7 @@ void Foam::PointEdgeWave<Type, TrackingData>::transform "PointEdgeWave<Type, TrackingData>::transform" "(const tensorField&, List<Type>&)" ) << "Non-uniform transformation on patch " << patch.name() + << " of type " << patch.type() << " not supported for point fields" << abort(FatalError); diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H index 5c1a32cc879e747415dfe317bffdd5de50d6d6b4..1a8d82e5f6c3e83346c1a461d1809698cef20447 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.H +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.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 @@ -26,10 +26,10 @@ Class Description Wave propagation of information through grid. Every iteration - information goes through one layer of edges. Templated on information - that is transferred. + information goes through one layer of edges. Templated on information that is transferred. + Handles parallel and cyclics. Only parallel reasonably tested. Cyclics hardly tested. diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C index ffc2aff4f46307b0e0214994b023e22eed3898f1..796244585a547a3154c614f3fa0c1d66e8223647 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWaveName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::PointEdgeWaveName, 0); +namespace Foam +{ +defineTypeNameAndDebug(PointEdgeWaveName, 0); +} + // ************************************************************************* // diff --git a/src/meshTools/cellClassification/cellClassification.C b/src/meshTools/cellClassification/cellClassification.C index 6fc2b15a97808e593d3ad037a7c56a78e4dc05ad..09e84ac93c0d1d032a240649ce14e8165d60da65 100644 --- a/src/meshTools/cellClassification/cellClassification.C +++ b/src/meshTools/cellClassification/cellClassification.C @@ -38,7 +38,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cellClassification, 0); +namespace Foam +{ +defineTypeNameAndDebug(cellClassification, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/cellDist/cellDistFuncs.C b/src/meshTools/cellDist/cellDistFuncs.C index 2637c4e99e89379e65b11f73804bc4d8e7722a42..103f4ef992a6e670c5ba50f4d252053b34c4a271 100644 --- a/src/meshTools/cellDist/cellDistFuncs.C +++ b/src/meshTools/cellDist/cellDistFuncs.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 @@ -30,7 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cellDistFuncs, 0); +namespace Foam +{ +defineTypeNameAndDebug(cellDistFuncs, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/coordinateSystems/coordinateSystems.C b/src/meshTools/coordinateSystems/coordinateSystems.C index fef44796e3c10d68830462450bf70ad08210ecf3..1739ecd8e2218ca429eb75b7819e95500c5af38f 100644 --- a/src/meshTools/coordinateSystems/coordinateSystems.C +++ b/src/meshTools/coordinateSystems/coordinateSystems.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 @@ -85,7 +85,7 @@ const Foam::coordinateSystems& Foam::coordinateSystems::New IOobject ( typeName, - "constant", + obr.time().constant(), obr, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE diff --git a/src/meshTools/indexedOctree/treeDataEdge.C b/src/meshTools/indexedOctree/treeDataEdge.C index 62ba5f2917c95eff27e0810d802cc04651c068ca..567fae04786363a0e404fbed217d38bc3cb30559 100644 --- a/src/meshTools/indexedOctree/treeDataEdge.C +++ b/src/meshTools/indexedOctree/treeDataEdge.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::treeDataEdge, 0); +namespace Foam +{ +defineTypeNameAndDebug(treeDataEdge, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/indexedOctree/treeDataFace.C b/src/meshTools/indexedOctree/treeDataFace.C index ca928ab1c724851881ac9816b4b4a12b6f992c85..9699416c13412d5e68cf62c0333500f5f9a16440 100644 --- a/src/meshTools/indexedOctree/treeDataFace.C +++ b/src/meshTools/indexedOctree/treeDataFace.C @@ -29,9 +29,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::treeDataFace, 0); +namespace Foam +{ +defineTypeNameAndDebug(treeDataFace, 0); -Foam::scalar Foam::treeDataFace::tolSqr = sqr(1e-6); +scalar treeDataFace::tolSqr = sqr(1e-6); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/indexedOctree/treeDataPoint.C b/src/meshTools/indexedOctree/treeDataPoint.C index 09bf90de38da9a9d00c5e070f1bfc44743dd5ec7..7c3a831159c86e18c112de53c8db1f92fbefa0ea 100644 --- a/src/meshTools/indexedOctree/treeDataPoint.C +++ b/src/meshTools/indexedOctree/treeDataPoint.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 @@ -30,7 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::treeDataPoint, 0); +namespace Foam +{ +defineTypeNameAndDebug(treeDataPoint, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatchName.C b/src/meshTools/indexedOctree/treeDataPrimitivePatchName.C index e1592bf7d31a09ecca70f2108fa7fcaa9ee08ca2..bc6c79727c21a3b1c2a5e74a930eaf1912a6c2b4 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatchName.C +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatchName.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 @@ -27,6 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::treeDataPrimitivePatchName, 0); +namespace Foam +{ +defineTypeNameAndDebug(treeDataPrimitivePatchName, 0); +} + // ************************************************************************* // diff --git a/src/meshTools/indexedOctree/treeDataTriSurface.C b/src/meshTools/indexedOctree/treeDataTriSurface.C index 06c80367e2d70188829255a128e8e5794700d0ee..fb1a4645f690e96b62256556b420e69800697f40 100644 --- a/src/meshTools/indexedOctree/treeDataTriSurface.C +++ b/src/meshTools/indexedOctree/treeDataTriSurface.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 @@ -30,7 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::treeDataTriSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(treeDataTriSurface, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C index 6ff66755e405e5317d4ad4284df6edbfcd266973..f05d31710435f424066c378c20d0ef5f0c605744 100644 --- a/src/meshTools/meshSearch/meshSearch.C +++ b/src/meshTools/meshSearch/meshSearch.C @@ -33,9 +33,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::meshSearch, 0); +namespace Foam +{ +defineTypeNameAndDebug(meshSearch, 0); -Foam::scalar Foam::meshSearch::tol_ = 1e-3; +scalar meshSearch::tol_ = 1e-3; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/searchableSurface/searchableBox.C b/src/meshTools/searchableSurface/searchableBox.C index 7f439ea4ae25d30def728e1d0c1ae1820d2c9462..3503308e422347620127daecb09212fa12e32175 100644 --- a/src/meshTools/searchableSurface/searchableBox.C +++ b/src/meshTools/searchableSurface/searchableBox.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 @@ -232,9 +232,10 @@ const Foam::wordList& Foam::searchableBox::regions() const } -Foam::pointField Foam::searchableBox::coordinates() const +Foam::tmp<Foam::pointField> Foam::searchableBox::coordinates() const { - pointField ctrs(6); + tmp<pointField> tCtrs = tmp<pointField>(new pointField(6)); + pointField& ctrs = tCtrs(); const pointField pts(treeBoundBox::points()); const faceList& fcs = treeBoundBox::faces; @@ -243,7 +244,14 @@ Foam::pointField Foam::searchableBox::coordinates() const { ctrs[i] = fcs[i].centre(pts); } - return ctrs; + + return tCtrs; +} + + +Foam::tmp<Foam::pointField> Foam::searchableBox::points() const +{ + return treeBoundBox::points(); } diff --git a/src/meshTools/searchableSurface/searchableBox.H b/src/meshTools/searchableSurface/searchableBox.H index 2ddc860d1695eba096ac7d98bd08e2df321c965d..40e5c5d7110ff3fe5a5c5a79cdd6b72c2c66e73e 100644 --- a/src/meshTools/searchableSurface/searchableBox.H +++ b/src/meshTools/searchableSurface/searchableBox.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 @@ -127,7 +127,10 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const; + virtual tmp<pointField> coordinates() const; + + //- Get the points that define the surface. + virtual tmp<pointField> points() const; // Does any part of the surface overlap the supplied bound box? virtual bool overlaps(const boundBox& bb) const diff --git a/src/meshTools/searchableSurface/searchableCylinder.C b/src/meshTools/searchableSurface/searchableCylinder.C index 2fc7032f2b2322a55302b627d7bbbdad45271cfd..3231dd95cd36104c06616ad0fa831a457c1f3baf 100644 --- a/src/meshTools/searchableSurface/searchableCylinder.C +++ b/src/meshTools/searchableSurface/searchableCylinder.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 @@ -39,11 +39,23 @@ addToRunTimeSelectionTable(searchableSurface, searchableCylinder, dict); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::pointField Foam::searchableCylinder::coordinates() const +Foam::tmp<Foam::pointField> Foam::searchableCylinder::coordinates() const { - pointField ctrs(1, 0.5*(point1_ + point2_)); + tmp<pointField> tCtrs(new pointField(1, 0.5*(point1_ + point2_))); - return ctrs; + return tCtrs; +} + + +Foam::tmp<Foam::pointField> Foam::searchableCylinder::points() const +{ + tmp<pointField> tPts(new pointField(2)); + pointField& pts = tPts(); + + pts[0] = point1_; + pts[1] = point2_; + + return tPts; } diff --git a/src/meshTools/searchableSurface/searchableCylinder.H b/src/meshTools/searchableSurface/searchableCylinder.H index d2941c31d5ab30de241fc0124b28c935bf71cf76..0bb570e4806b5ee41ae936bd12d05aa6381a39d7 100644 --- a/src/meshTools/searchableSurface/searchableCylinder.H +++ b/src/meshTools/searchableSurface/searchableCylinder.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 @@ -152,7 +152,10 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const; + virtual tmp<pointField> coordinates() const; + + //- Get the points that define the surface. + virtual tmp<pointField> points() const; //- Does any part of the surface overlap the supplied bound box? virtual bool overlaps(const boundBox& bb) const diff --git a/src/meshTools/searchableSurface/searchablePlane.H b/src/meshTools/searchableSurface/searchablePlane.H index 380435e6c1bf903ceebdfbca48dcbc246c62e988..cc64844d0df9b9da1844ecae8e94057901dbde2c 100644 --- a/src/meshTools/searchableSurface/searchablePlane.H +++ b/src/meshTools/searchableSurface/searchablePlane.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 @@ -124,10 +124,16 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const + virtual tmp<pointField> coordinates() const { - //notImplemented("searchablePlane::coordinates()") - return pointField(1, refPoint()); + tmp<pointField> tCtrs(new pointField(1, refPoint())); + return tCtrs; + } + + //- Get the points that define the surface. + virtual tmp<pointField> points() const + { + return coordinates(); } //- Does any part of the surface overlap the supplied bound box? diff --git a/src/meshTools/searchableSurface/searchablePlate.H b/src/meshTools/searchableSurface/searchablePlate.H index 3c4a0ae9fd96ad27dfaa559ce229729ec5fccfe2..671f3785f6be6a8d77e0c3d4deeffe13c97e559e 100644 --- a/src/meshTools/searchableSurface/searchablePlate.H +++ b/src/meshTools/searchableSurface/searchablePlate.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 @@ -144,20 +144,52 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const + virtual tmp<pointField> coordinates() const { - return pointField(1, origin_); + tmp<pointField> tCtrs(new pointField(1, origin_ + 0.5*span_)); + return tCtrs; + } + + //- Get the points that define the surface. + virtual tmp<pointField> points() const + { + tmp<pointField> tPts(new pointField(4)); + pointField& pts = tPts(); + + pts[0] = origin_; + pts[2] = origin_ + span_; + + if (span_.x() < span_.y() && span_.x() < span_.z()) + { + pts[1] = origin_ + point(0, span_.y(), 0); + pts[3] = origin_ + point(0, 0, span_.z()); + } + else if (span_.y() < span_.z()) + { + pts[1] = origin_ + point(span_.x(), 0, 0); + pts[3] = origin_ + point(0, 0, span_.z()); + } + else + { + pts[1] = origin_ + point(span_.x(), 0, 0); + pts[3] = origin_ + point(0, span_.y(), 0); + } + + return tPts; } //- Does any part of the surface overlap the supplied bound box? virtual bool overlaps(const boundBox& bb) const { - notImplemented + return ( - "searchablePlate::overlaps(const boundBox&) const" + (origin_.x() + span_.x()) >= bb.min().x() + && origin_.x() <= bb.max().x() + && (origin_.y() + span_.y()) >= bb.min().y() + && origin_.y() <= bb.max().y() + && (origin_.z() + span_.z()) >= bb.min().z() + && origin_.z() <= bb.max().z() ); - - return false; } diff --git a/src/meshTools/searchableSurface/searchableSphere.C b/src/meshTools/searchableSurface/searchableSphere.C index 8e0a00a739c29af484f00f6ded9cdbea5cd8e935..5f3e98af90d52edb319a805e95b9bbd9cf4491e2 100644 --- a/src/meshTools/searchableSurface/searchableSphere.C +++ b/src/meshTools/searchableSurface/searchableSphere.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 @@ -167,6 +167,12 @@ Foam::searchableSphere::~searchableSphere() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::searchableSphere::overlaps(const boundBox& bb) const +{ + return bb.overlaps(centre_, sqr(radius_)); +} + + const Foam::wordList& Foam::searchableSphere::regions() const { if (regions_.empty()) diff --git a/src/meshTools/searchableSurface/searchableSphere.H b/src/meshTools/searchableSurface/searchableSphere.H index 5b546fcbe3b4cc0a59811c298898e44e2d298cae..5d46f8ad4b5128e3d6748e2a8d3009042a6d8ab0 100644 --- a/src/meshTools/searchableSurface/searchableSphere.H +++ b/src/meshTools/searchableSurface/searchableSphere.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 @@ -133,22 +133,21 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const + virtual tmp<pointField> coordinates() const { - return pointField(1, centre_); + tmp<pointField> tCtrs(new pointField(1, centre_)); + return tCtrs; } - //- Does any part of the surface overlap the supplied bound box? - virtual bool overlaps(const boundBox& bb) const + //- Get the points that define the surface. + virtual tmp<pointField> points() const { - notImplemented - ( - "searchableSphere::overlaps(const boundBox&) const" - ); - - return false; + return coordinates(); } + //- Does any part of the surface overlap the supplied bound box? + virtual bool overlaps(const boundBox& bb) const; + // Multiple point queries. diff --git a/src/meshTools/searchableSurface/searchableSurface.H b/src/meshTools/searchableSurface/searchableSurface.H index 94713fbf386461e6f467bacd66b82dbe8ae0c4d6..baeb970844dfe8e7757afa4c0f3679866a23d17a 100644 --- a/src/meshTools/searchableSurface/searchableSurface.H +++ b/src/meshTools/searchableSurface/searchableSurface.H @@ -206,7 +206,10 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const = 0; + virtual tmp<pointField> coordinates() const = 0; + + //- Get the points that define the surface. + virtual tmp<pointField> points() const = 0; //- Does any part of the surface overlap the supplied bound box? virtual bool overlaps(const boundBox& bb) const = 0; diff --git a/src/meshTools/searchableSurface/searchableSurfaceCollection.C b/src/meshTools/searchableSurface/searchableSurfaceCollection.C index 91115688b23c78d644c6d4bff98d9b37e54f8502..1aa9cbc123fe86e27df4c7c593ebee4550208b15 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceCollection.C +++ b/src/meshTools/searchableSurface/searchableSurfaceCollection.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 @@ -325,21 +325,60 @@ Foam::label Foam::searchableSurfaceCollection::size() const } -Foam::pointField Foam::searchableSurfaceCollection::coordinates() const +Foam::tmp<Foam::pointField> +Foam::searchableSurfaceCollection::coordinates() const { - // Get overall size - pointField coords(size()); + tmp<pointField> tCtrs = tmp<pointField>(new pointField(size())); + pointField& ctrs = tCtrs(); // Append individual coordinates label coordI = 0; forAll(subGeom_, surfI) { - const pointField subCoords = subGeom_[surfI].coordinates(); + const pointField subCoords(subGeom_[surfI].coordinates()); + + forAll(subCoords, i) + { + ctrs[coordI++] = transform_[surfI].globalPosition + ( + cmptMultiply + ( + subCoords[i], + scale_[surfI] + ) + ); + } + } + + return tCtrs; +} + + +Foam::tmp<Foam::pointField> +Foam::searchableSurfaceCollection::points() const +{ + // Get overall size + label nPoints = 0; + + forAll(subGeom_, surfI) + { + nPoints += subGeom_[surfI].points()().size(); + } + + tmp<pointField> tPts(new pointField(nPoints)); + pointField& pts = tPts(); + + // Append individual coordinates + nPoints = 0; + + forAll(subGeom_, surfI) + { + const pointField subCoords(subGeom_[surfI].points()); forAll(subCoords, i) { - coords[coordI++] = transform_[surfI].globalPosition + pts[nPoints++] = transform_[surfI].globalPosition ( cmptMultiply ( @@ -350,7 +389,7 @@ Foam::pointField Foam::searchableSurfaceCollection::coordinates() const } } - return coords; + return tPts; } diff --git a/src/meshTools/searchableSurface/searchableSurfaceCollection.H b/src/meshTools/searchableSurface/searchableSurfaceCollection.H index 7c592ca348280696c179d88f26089af45d4beeec..53e677eaa656ce4adcf6b5b8c8119bd55f0f441d 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceCollection.H +++ b/src/meshTools/searchableSurface/searchableSurfaceCollection.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 @@ -174,7 +174,10 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const; + virtual tmp<pointField> coordinates() const; + + //- Get the points that define the surface. + virtual tmp<pointField> points() const; //- Does any part of the surface overlap the supplied bound box? virtual bool overlaps(const boundBox& bb) const diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index a57e8740ec489e8b9e70c18502640fd6c6e08643..c169a98ca16106a7515fed0212aeab7b218b4347 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.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 @@ -54,7 +54,7 @@ namespace Foam // Forward declaration of classes /*---------------------------------------------------------------------------*\ - Class searchableSurfaceWithGaps Declaration + Class searchableSurfaceWithGaps Declaration \*---------------------------------------------------------------------------*/ class searchableSurfaceWithGaps @@ -151,11 +151,17 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const + virtual tmp<pointField> coordinates() const { return surface().coordinates(); } + //- Get the points that define the surface. + virtual tmp<pointField> points() const + { + return surface().points(); + } + //- Does any part of the surface overlap the supplied bound box? // Note: use perturbed surface? Since uses boundbox of points and // not actual intersection chosen to use unperturbed surface. diff --git a/src/meshTools/searchableSurface/searchableSurfaces.C b/src/meshTools/searchableSurface/searchableSurfaces.C index c42133c29f490d586fa1a3b9bad59b97d93052ef..768e9b33dc67d6f26ab6548d79b6859412584754 100644 --- a/src/meshTools/searchableSurface/searchableSurfaces.C +++ b/src/meshTools/searchableSurface/searchableSurfaces.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 @@ -27,10 +27,43 @@ License #include "searchableSurfacesQueries.H" #include "ListOps.H" #include "Time.H" +//#include "vtkSetWriter.H" +#include "DynamicField.H" +//#include "OBJstream.H" +#include "PatchTools.H" +#include "triSurfaceMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::searchableSurfaces, 0); +namespace Foam +{ +defineTypeNameAndDebug(searchableSurfaces, 0); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +//- Is edge connected to triangle +bool Foam::searchableSurfaces::connected +( + const triSurface& s, + const label edgeI, + const pointIndexHit& hit +) +{ + const triFace& localFace = s.localFaces()[hit.index()]; + const edge& e = s.edges()[edgeI]; + + forAll(localFace, i) + { + if (e.otherVertex(localFace[i]) != -1) + { + return true; + } + } + + return false; +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -378,6 +411,468 @@ Foam::pointIndexHit Foam::searchableSurfaces::facesIntersection ); } + +bool Foam::searchableSurfaces::checkClosed(const bool report) const +{ + if (report) + { + Info<< "Checking for closedness." << endl; + } + + bool hasError = false; + + forAll(*this, surfI) + { + if (!operator[](surfI).hasVolumeType()) + { + hasError = true; + + if (report) + { + Info<< " " << names()[surfI] + << " : not closed" << endl; + } + + if (isA<triSurface>(operator[](surfI))) + { + const triSurface& s = dynamic_cast<const triSurface&> + ( + operator[](surfI) + ); + const labelListList& edgeFaces = s.edgeFaces(); + + label nSingleEdges = 0; + forAll(edgeFaces, edgeI) + { + if (edgeFaces[edgeI].size() == 1) + { + nSingleEdges++; + } + } + + label nMultEdges = 0; + forAll(edgeFaces, edgeI) + { + if (edgeFaces[edgeI].size() > 2) + { + nMultEdges++; + } + } + + if (report && (nSingleEdges != 0 || nMultEdges != 0)) + { + Info<< " connected to one face : " + << nSingleEdges << nl + << " connected to >2 faces : " + << nMultEdges << endl; + } + } + } + } + + if (report) + { + Info<< endl; + } + + return returnReduce(hasError, orOp<bool>()); +} + + +bool Foam::searchableSurfaces::checkNormalOrientation(const bool report) const +{ + if (report) + { + Info<< "Checking for normal orientation." << endl; + } + + bool hasError = false; + + forAll(*this, surfI) + { + if (isA<triSurface>(operator[](surfI))) + { + const triSurface& s = dynamic_cast<const triSurface&> + ( + operator[](surfI) + ); + + labelHashSet borderEdge(s.size()/1000); + PatchTools::checkOrientation(s, false, &borderEdge); + // Colour all faces into zones using borderEdge + labelList normalZone; + label nZones = PatchTools::markZones(s, borderEdge, normalZone); + if (nZones > 1) + { + hasError = true; + + if (report) + { + Info<< " " << names()[surfI] + << " : has multiple orientation zones (" + << nZones << ")" << endl; + } + } + } + } + + if (report) + { + Info<< endl; + } + + return returnReduce(hasError, orOp<bool>()); +} + + +bool Foam::searchableSurfaces::checkSizes +( + const scalar maxRatio, + const bool report +) const +{ + if (report) + { + Info<< "Checking for size." << endl; + } + + bool hasError = false; + + forAll(*this, i) + { + const boundBox& bb = operator[](i).bounds(); + + for (label j = i+1; j < size(); j++) + { + scalar ratio = bb.mag()/operator[](j).bounds().mag(); + + if (ratio > maxRatio || ratio < 1.0/maxRatio) + { + hasError = true; + + if (report) + { + Info<< " " << names()[i] + << " bounds differ from " << names()[j] + << " by more than a factor 100:" << nl + << " bounding box : " << bb << nl + << " bounding box : " << operator[](j).bounds() + << endl; + } + break; + } + } + } + + if (report) + { + Info<< endl; + } + + return returnReduce(hasError, orOp<bool>()); +} + + +bool Foam::searchableSurfaces::checkIntersection +( + const scalar tolerance, + const autoPtr<writer<scalar> >& setWriter, + const bool report +) const +{ + if (report) + { + Info<< "Checking for intersection." << endl; + } + + //cpuTime timer; + + bool hasError = false; + + forAll(*this, i) + { + if (isA<triSurfaceMesh>(operator[](i))) + { + const triSurfaceMesh& s0 = dynamic_cast<const triSurfaceMesh&> + ( + operator[](i) + ); + const edgeList& edges0 = s0.edges(); + const pointField& localPoints0 = s0.localPoints(); + + // Collect all the edge vectors + pointField start(edges0.size()); + pointField end(edges0.size()); + forAll(edges0, edgeI) + { + const edge& e = edges0[edgeI]; + start[edgeI] = localPoints0[e[0]]; + end[edgeI] = localPoints0[e[1]]; + } + + // Test all other surfaces for intersection + forAll(*this, j) + { + List<pointIndexHit> hits; + + if (i == j) + { + // Slightly shorten the edges to prevent finding lots of + // intersections. The fast triangle intersection routine + // has problems with rays passing through a point of the + // triangle. + vectorField d + ( + max(tolerance, 10*s0.tolerance()) + *(end-start) + ); + start += d; + end -= d; + } + + operator[](j).findLineAny(start, end, hits); + + label nHits = 0; + DynamicField<point> intersections(edges0.size()/100); + DynamicField<scalar> intersectionEdge(intersections.capacity()); + + forAll(hits, edgeI) + { + if + ( + hits[edgeI].hit() + && (i != j || !connected(s0, edgeI, hits[edgeI])) + ) + { + intersections.append(hits[edgeI].hitPoint()); + intersectionEdge.append(1.0*edgeI); + nHits++; + } + } + + if (nHits > 0) + { + if (report) + { + Info<< " " << names()[i] + << " intersects " << names()[j] + << " at " << nHits + << " locations." + << endl; + + //vtkSetWriter<scalar> setWriter; + if (setWriter.valid()) + { + scalarField dist(mag(intersections)); + coordSet track + ( + names()[i] + '_' + names()[j], + "xyz", + intersections.xfer(), + dist + ); + wordList valueSetNames(1, "edgeIndex"); + List<const scalarField*> valueSets + ( + 1, + &intersectionEdge + ); + + fileName fName + ( + setWriter().getFileName(track, valueSetNames) + ); + Info<< " Writing intersection locations to " + << fName << endl; + OFstream os + ( + s0.searchableSurface::time().path() + /fName + ); + setWriter().write + ( + track, + valueSetNames, + valueSets, + os + ); + } + } + + hasError = true; + break; + } + } + } + } + + if (report) + { + Info<< endl; + } + + return returnReduce(hasError, orOp<bool>()); +} + + +bool Foam::searchableSurfaces::checkQuality +( + const scalar minQuality, + const bool report +) const +{ + if (report) + { + Info<< "Checking for triangle quality." << endl; + } + + bool hasError = false; + + forAll(*this, surfI) + { + if (isA<triSurface>(operator[](surfI))) + { + const triSurface& s = dynamic_cast<const triSurface&> + ( + operator[](surfI) + ); + + label nBadTris = 0; + forAll(s, faceI) + { + const labelledTri& f = s[faceI]; + + scalar q = triPointRef + ( + s.points()[f[0]], + s.points()[f[1]], + s.points()[f[2]] + ).quality(); + + if (q < minQuality) + { + nBadTris++; + } + } + + if (nBadTris > 0) + { + hasError = true; + + if (report) + { + Info<< " " << names()[surfI] + << " : has " << nBadTris << " bad quality triangles " + << " (quality < " << minQuality << ")" << endl; + } + } + } + } + + if (report) + { + Info<< endl; + } + + return returnReduce(hasError, orOp<bool>()); + +} + + +// Check all surfaces. Return number of failures. +Foam::label Foam::searchableSurfaces::checkTopology +( + const bool report +) const +{ + label noFailedChecks = 0; + + if (checkClosed(report)) + { + noFailedChecks++; + } + + if (checkNormalOrientation(report)) + { + noFailedChecks++; + } + return noFailedChecks; +} + + +Foam::label Foam::searchableSurfaces::checkGeometry +( + const scalar maxRatio, + const scalar tol, + const autoPtr<writer<scalar> >& setWriter, + const scalar minQuality, + const bool report +) const +{ + label noFailedChecks = 0; + + if (maxRatio > 0 && checkSizes(maxRatio, report)) + { + noFailedChecks++; + } + + if (checkIntersection(tol, setWriter, report)) + { + noFailedChecks++; + } + + if (checkQuality(minQuality, report)) + { + noFailedChecks++; + } + + return noFailedChecks; +} + + +void Foam::searchableSurfaces::writeStats +( + const List<wordList>& patchTypes, + Ostream& os +) const +{ + Info<< "Statistics." << endl; + forAll(*this, surfI) + { + Info<< " " << names()[surfI] << ':' << endl; + + const searchableSurface& s = operator[](surfI); + + Info<< " type : " << s.type() << nl + << " size : " << s.globalSize() << nl; + if (isA<triSurfaceMesh>(s)) + { + const triSurfaceMesh& ts = dynamic_cast<const triSurfaceMesh&>(s); + Info<< " edges : " << ts.nEdges() << nl + << " points : " << ts.points()().size() << nl; + } + Info<< " bounds : " << s.bounds() << nl + << " closed : " << Switch(s.hasVolumeType()) << endl; + + if (patchTypes.size() && patchTypes[surfI].size() >= 1) + { + wordList unique(HashSet<word>(patchTypes[surfI]).sortedToc()); + Info<< " patches : "; + forAll(unique, i) + { + Info<< unique[i]; + if (i < unique.size()-1) + { + Info<< ','; + } + } + Info<< endl; + } + } + Info<< endl; +} + + // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // const Foam::searchableSurface& Foam::searchableSurfaces::operator[] diff --git a/src/meshTools/searchableSurface/searchableSurfaces.H b/src/meshTools/searchableSurface/searchableSurfaces.H index cc319679d4fbc85fc912c8f8e7f1bbd58653c705..107e343ef3d262f077a105dfce0441f757b435a5 100644 --- a/src/meshTools/searchableSurface/searchableSurfaces.H +++ b/src/meshTools/searchableSurface/searchableSurfaces.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 @@ -37,6 +37,7 @@ SourceFiles #include "searchableSurface.H" #include "labelPair.H" +#include "writer.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,6 +45,7 @@ namespace Foam { // Forward declaration of classes +class triSurface; /*---------------------------------------------------------------------------*\ Class searchableSurfaces Declaration @@ -70,6 +72,15 @@ class searchableSurfaces // Private Member Functions + //- Is edge on face + static bool connected + ( + const triSurface& s, + const label edgeI, + const pointIndexHit& hit + ); + + //- Disallow default bitwise copy construct searchableSurfaces(const searchableSurfaces&); @@ -189,6 +200,49 @@ public: ) const; + // Checking + + //- Are all surfaces closed and manifold + bool checkClosed(const bool report) const; + + //- Are all (triangulated) surfaces consistent normal orientation + bool checkNormalOrientation(const bool report) const; + + //- Are all bounding boxes of similar size + bool checkSizes(const scalar maxRatio, const bool report) const; + + //- Do surfaces self-intersect or intersect others + bool checkIntersection + ( + const scalar tol, + const autoPtr<writer<scalar> >&, + const bool report + ) const; + + //- Check triangle quality + bool checkQuality + ( + const scalar minQuality, + const bool report + ) const; + + //- All topological checks. Return number of failed checks + label checkTopology(const bool report) const; + + //- All geometric checks. Return number of failed checks + label checkGeometry + ( + const scalar maxRatio, + const scalar tolerance, + const autoPtr<writer<scalar> >& setWriter, + const scalar minQuality, + const bool report + ) const; + + //- Write some stats + void writeStats(const List<wordList>&, Ostream&) const; + + // Member Operators //- Return const and non-const reference to searchableSurface by index. diff --git a/src/meshTools/searchableSurface/searchableSurfacesQueries.C b/src/meshTools/searchableSurface/searchableSurfacesQueries.C index 26f0a4532438786515bd73d60cb312907b79ed98..d533ed90758c16941027e1c0ebed0b41cd2b7730 100644 --- a/src/meshTools/searchableSurface/searchableSurfacesQueries.C +++ b/src/meshTools/searchableSurface/searchableSurfacesQueries.C @@ -31,7 +31,11 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::searchableSurfacesQueries, 0); +namespace Foam +{ +defineTypeNameAndDebug(searchableSurfacesQueries, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index 86fcd5889bc8e587223c27375f04ca19d604f3c4..4e42f5d3adce4ae3cbdf8486c76430f910a2574d 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -148,7 +148,7 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const // Construct pointFaces. Let's hope surface has compact point // numbering ... labelListList pointFaces; - invertManyToMany(points().size(), *this, pointFaces); + invertManyToMany(points()().size(), *this, pointFaces); // Loop over all faces surrounding point. Count edges emanating from point. // Every edge should be used by two faces exactly. @@ -288,7 +288,7 @@ void Foam::triSurfaceMesh::calcBounds(boundBox& bb, label& nPoints) const const triSurface& s = static_cast<const triSurface&>(*this); - PackedBoolList pointIsUsed(points().size()); + PackedBoolList pointIsUsed(points()().size()); nPoints = 0; bb = boundBox::invertedBox; @@ -302,8 +302,8 @@ void Foam::triSurfaceMesh::calcBounds(boundBox& bb, label& nPoints) const label pointI = f[fp]; if (pointIsUsed.set(pointI, 1u)) { - bb.min() = ::Foam::min(bb.min(), points()[pointI]); - bb.max() = ::Foam::max(bb.max(), points()[pointI]); + bb.min() = ::Foam::min(bb.min(), points()()[pointI]); + bb.max() = ::Foam::max(bb.max(), points()()[pointI]); nPoints++; } } @@ -487,14 +487,25 @@ void Foam::triSurfaceMesh::clearOut() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::pointField Foam::triSurfaceMesh::coordinates() const +Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::coordinates() const { + tmp<pointField> tPts(new pointField(8)); + pointField& pt = tPts(); + // Use copy to calculate face centres so they don't get stored - return PrimitivePatch<triSurface::FaceType, SubList, const pointField&> + pt = PrimitivePatch<triSurface::FaceType, SubList, const pointField&> ( SubList<triSurface::FaceType>(*this, triSurface::size()), triSurface::points() ).faceCentres(); + + return tPts; +} + + +Foam::tmp<Foam::pointField> Foam::triSurfaceMesh::points() const +{ + return triSurface::points(); } @@ -526,12 +537,12 @@ Foam::triSurfaceMesh::tree() const label nPoints; calcBounds(bb, nPoints); - if (nPoints != points().size()) + if (nPoints != points()().size()) { WarningIn("triSurfaceMesh::tree() const") << "Surface " << searchableSurface::name() << " does not have compact point numbering." - << " Of " << points().size() << " only " << nPoints + << " Of " << points()().size() << " only " << nPoints << " are used. This might give problems in some routines." << endl; } @@ -625,6 +636,12 @@ Foam::triSurfaceMesh::edgeTree() const } +Foam::scalar Foam::triSurfaceMesh::tolerance() const +{ + return tolerance_; +} + + const Foam::wordList& Foam::triSurfaceMesh::regions() const { if (regions_.empty()) diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.H b/src/meshTools/searchableSurface/triSurfaceMesh.H index a1d037848705cb7bfc1bf0335baaee0666405513..f27df49d7c85d89d876a63287277a344c8284f06 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.H +++ b/src/meshTools/searchableSurface/triSurfaceMesh.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 @@ -182,6 +182,7 @@ public: //- Demand driven contruction of octree for boundary edges const indexedOctree<treeDataEdge>& edgeTree() const; + scalar tolerance() const; // searchableSurface implementation @@ -198,7 +199,10 @@ public: //- Get representative set of element coordinates // Usually the element centres (should be of length size()). - virtual pointField coordinates() const; + virtual tmp<pointField> coordinates() const; + + //- Get the points that define the surface. + virtual tmp<pointField> points() const; // Does any part of the surface overlap the supplied bound box? virtual bool overlaps(const boundBox& bb) const; diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C b/src/meshTools/sets/cellSources/regionToCell/regionToCell.C index 77948ca5a5c263cc3b46ed56ee339725e9ea1268..96c3077cdead9fe330d8176025bda1604860c0c1 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.C +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.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 @@ -24,12 +24,10 @@ License \*---------------------------------------------------------------------------*/ #include "regionToCell.H" -#include "polyMesh.H" #include "regionSplit.H" -#include "globalMeshData.H" +#include "emptyPolyPatch.H" #include "cellSet.H" #include "syncTools.H" - #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -49,104 +47,341 @@ addToRunTimeSelectionTable(topoSetSource, regionToCell, istream); Foam::topoSetSource::addToUsageTable Foam::regionToCell::usage_ ( regionToCell::typeName, - "\n Usage: regionToCell subCellSet (x y z)\n\n" - " Select all cells in the connected region containing point.\n" - " If started inside the subCellSet keeps to it;\n" - " if started outside stays outside.\n" + "\n Usage: regionToCell subCellSet (pt0 .. ptn)\n\n" + " Select all cells in the connected region containing" + " points (pt0..ptn).\n" ); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::regionToCell::combine(topoSet& set, const bool add) const +void Foam::regionToCell::markRegionFaces +( + const boolList& selectedCell, + boolList& regionFace +) const { - label cellI = mesh_.findCell(insidePoint_); + // Internal faces + const labelList& faceOwner = mesh_.faceOwner(); + const labelList& faceNeighbour = mesh_.faceNeighbour(); + forAll(faceNeighbour, faceI) + { + if + ( + selectedCell[faceOwner[faceI]] + != selectedCell[faceNeighbour[faceI]] + ) + { + regionFace[faceI] = true; + } + } + + // Swap neighbour selectedCell state + boolList nbrSelected; + syncTools::swapBoundaryCellList(mesh_, selectedCell, nbrSelected); - // Load the subset of cells + // Boundary faces + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + const labelUList& faceCells = pp.faceCells(); + forAll(faceCells, i) + { + label faceI = pp.start()+i; + label bFaceI = faceI-mesh_.nInternalFaces(); + if + ( + selectedCell[faceCells[i]] + != selectedCell[nbrSelected[bFaceI]] + ) + { + regionFace[faceI] = true; + } + } + } +} + + +Foam::boolList Foam::regionToCell::findRegions +( + const bool verbose, + const regionSplit& cellRegion +) const +{ + boolList keepRegion(cellRegion.nRegions(), false); + + forAll(insidePoints_, i) + { + // Find the region containing the insidePoint + + label cellI = mesh_.findCell(insidePoints_[i]); + + label keepRegionI = -1; + label keepProcI = -1; + if (cellI != -1) + { + keepRegionI = cellRegion[cellI]; + keepProcI = Pstream::myProcNo(); + } + reduce(keepRegionI, maxOp<label>()); + keepRegion[keepRegionI] = true; + + reduce(keepProcI, maxOp<label>()); + + if (keepProcI == -1) + { + FatalErrorIn + ( + "outsideCellSelection::findRegions" + "(const bool, const regionSplit&)" + ) << "Did not find " << insidePoints_[i] + << " in mesh." << " Mesh bounds are " << mesh_.bounds() + << exit(FatalError); + } + + if (verbose) + { + Info<< " Found location " << insidePoints_[i] + << " in cell " << cellI << " on processor " << keepProcI + << " in global region " << keepRegionI + << " out of " << cellRegion.nRegions() << " regions." << endl; + } + } + + return keepRegion; +} + + +void Foam::regionToCell::unselectOutsideRegions +( + boolList& selectedCell +) const +{ + // Determine faces on the edge of selectedCell boolList blockedFace(mesh_.nFaces(), false); + markRegionFaces(selectedCell, blockedFace); + + // Determine regions + regionSplit cellRegion(mesh_, blockedFace); + + // Determine regions containing insidePoints_ + boolList keepRegion(findRegions(true, cellRegion)); + + // Go back to bool per cell + forAll(cellRegion, cellI) { - Info<< "Loading subset " << setName_ << " to delimit search region." - << endl; - cellSet subSet(mesh_, setName_); + if (!keepRegion[cellRegion[cellI]]) + { + selectedCell[cellI] = false; + } + } +} - boolList inSubset(mesh_.nCells(), false); - forAllConstIter(cellSet, subSet, iter) + +void Foam::regionToCell::shrinkRegions +( + boolList& selectedCell +) const +{ + // Select points on unselected cells and boundary + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + boolList boundaryPoint(mesh_.nPoints(), false); + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (!pp.coupled() && !isA<emptyPolyPatch>(pp)) { - inSubset[iter.key()] = true; + forAll(pp, i) + { + const face& f = pp[i]; + forAll(f, fp) + { + boundaryPoint[f[fp]] = true; + } + } } + } - if (cellI != -1 && inSubset[cellI]) + forAll(selectedCell, cellI) + { + if (!selectedCell[cellI]) { - Pout<< "Point " << insidePoint_ << " is inside cellSet " - << setName_ << endl - << "Collecting all cells connected to " << cellI - << " and inside cellSet " << setName_ << endl; + const labelList& cPoints = mesh_.cellPoints(cellI); + forAll(cPoints, i) + { + boundaryPoint[cPoints[i]] = true; + } } - else + } + + syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false); + + + // Select all cells using these points + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + label nChanged = 0; + forAll(boundaryPoint, pointI) + { + if (boundaryPoint[pointI]) { - Pout<< "Point " << insidePoint_ << " is outside cellSet " - << setName_ << endl - << "Collecting all cells connected to " << cellI - << " and outside cellSet " << setName_ << endl; + const labelList& pCells = mesh_.pointCells(pointI); + forAll(pCells, i) + { + label cellI = pCells[i]; + if (selectedCell[cellI]) + { + selectedCell[cellI] = false; + nChanged++; + } + } } + } + Info<< " Eroded " << returnReduce(nChanged, sumOp<label>()) + << " cells." << endl; +} + + +void Foam::regionToCell::erode +( + boolList& selectedCell +) const +{ + //Info<< "Entering shrinkRegions:" << count(selectedCell) << endl; + //generateField("selectedCell_before", selectedCell)().write(); + + // Now erode and see which regions get disconnected + boolList shrunkSelectedCell(selectedCell); + + for (label iter = 0; iter < nErode_; iter++) + { + shrinkRegions(shrunkSelectedCell); + } + + //Info<< "After shrinking:" << count(shrunkSelectedCell) << endl; + //generateField("shrunkSelectedCell", shrunkSelectedCell)().write(); + + + + // Determine faces on the edge of shrunkSelectedCell + boolList blockedFace(mesh_.nFaces(), false); + markRegionFaces(shrunkSelectedCell, blockedFace); + + // Find disconnected regions + regionSplit cellRegion(mesh_, blockedFace); - // Get coupled cell status - label nInt = mesh_.nInternalFaces(); - boolList neiSet(mesh_.nFaces()-nInt, false); - for (label faceI = nInt; faceI < mesh_.nFaces(); faceI++) + // Determine regions containing insidePoints + boolList keepRegion(findRegions(true, cellRegion)); + + + // Extract cells in regions that are not to be kept. + boolList removeCell(mesh_.nCells(), false); + forAll(cellRegion, cellI) + { + if (shrunkSelectedCell[cellI] && !keepRegion[cellRegion[cellI]]) { - neiSet[faceI-nInt] = inSubset[mesh_.faceOwner()[faceI]]; + removeCell[cellI] = true; } - syncTools::swapBoundaryFaceList(mesh_, neiSet); + } + + //Info<< "removeCell before:" << count(removeCell) << endl; + //generateField("removeCell_before", removeCell)().write(); + + - // Find faces inbetween subSet and non-subset. - for (label faceI = 0; faceI < nInt; faceI++) + // Grow removeCell + for (label iter = 0; iter < nErode_; iter++) + { + // Grow selected cell in regions that are not for keeping + boolList boundaryPoint(mesh_.nPoints(), false); + forAll(removeCell, cellI) { - bool ownInSet = inSubset[mesh_.faceOwner()[faceI]]; - bool neiInSet = inSubset[mesh_.faceNeighbour()[faceI]]; - blockedFace[faceI] = (ownInSet != neiInSet); + if (removeCell[cellI]) + { + const labelList& cPoints = mesh_.cellPoints(cellI); + forAll(cPoints, i) + { + boundaryPoint[cPoints[i]] = true; + } + } } - for (label faceI = nInt; faceI < mesh_.nFaces(); faceI++) + syncTools::syncPointList(mesh_, boundaryPoint, orEqOp<bool>(), false); + + // Select all cells using these points + + label nChanged = 0; + forAll(boundaryPoint, pointI) { - bool ownInSet = inSubset[mesh_.faceOwner()[faceI]]; - bool neiInSet = neiSet[faceI-nInt]; - blockedFace[faceI] = (ownInSet != neiInSet); + if (boundaryPoint[pointI]) + { + const labelList& pCells = mesh_.pointCells(pointI); + forAll(pCells, i) + { + label cellI = pCells[i]; + if (!removeCell[cellI]) + { + removeCell[cellI] = true; + nChanged++; + } + } + } } } - // Find connected regions without crossing boundary of the cellset. - regionSplit regions(mesh_, blockedFace); + //Info<< "removeCell after:" << count(removeCell) << endl; + //generateField("removeCell_after", removeCell)().write(); - // Get the region containing the insidePoint - label regionI = -1; - if (cellI != -1) + // Unmark removeCell + forAll(removeCell, cellI) { - // On processor that has found cell. - regionI = regions[cellI]; + if (removeCell[cellI]) + { + selectedCell[cellI] = false; + } } +} + - reduce(regionI, maxOp<label>()); +void Foam::regionToCell::combine(topoSet& set, const bool add) const +{ + // Note: wip. Select cells first + boolList selectedCell(mesh_.nCells(), true); - if (regionI == -1) + if (setName_.size() && setName_ != "none") { - WarningIn - ( - "regionToCell::combine(topoSet&, const bool) const" - ) << "Point " << insidePoint_ - << " is not inside the mesh." << nl - << "Bounding box of the mesh:" << mesh_.bounds() + Info<< " Loading subset " << setName_ << " to delimit search region." << endl; - return; + cellSet subSet(mesh_, setName_); + + selectedCell = false; + forAllConstIter(cellSet, subSet, iter) + { + selectedCell[iter.key()] = true; + } } - // Pick up the cells of the region - const labelList regionCells(findIndices(regions, regionI)); + unselectOutsideRegions(selectedCell); - forAll(regionCells, i) + if (nErode_ > 0) { - addOrDelete(set, regionCells[i], add); + erode(selectedCell); + } + + + forAll(selectedCell, cellI) + { + if (selectedCell[cellI]) + { + addOrDelete(set, cellI, add); + } } } @@ -158,12 +393,14 @@ Foam::regionToCell::regionToCell ( const polyMesh& mesh, const word& setName, - const point& insidePoint + const pointField& insidePoints, + const label nErode ) : topoSetSource(mesh), setName_(setName), - insidePoint_(insidePoint) + insidePoints_(insidePoints), + nErode_(nErode) {} @@ -175,8 +412,14 @@ Foam::regionToCell::regionToCell ) : topoSetSource(mesh), - setName_(dict.lookup("set")), - insidePoint_(dict.lookup("insidePoint")) + setName_(dict.lookupOrDefault<word>("set", "none")), + insidePoints_ + ( + dict.found("insidePoints") + ? dict.lookup("insidePoints") + : dict.lookup("insidePoint") + ), + nErode_(dict.lookupOrDefault("nErode", 0)) {} @@ -189,7 +432,8 @@ Foam::regionToCell::regionToCell : topoSetSource(mesh), setName_(checkIs(is)), - insidePoint_(checkIs(is)) + insidePoints_(checkIs(is)), + nErode_(0) {} @@ -209,15 +453,15 @@ void Foam::regionToCell::applyToSet { if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) { - Info<< " Adding all cells of connected region containing point " - << insidePoint_ << " ..." << endl; + Info<< " Adding all cells of connected region containing points " + << insidePoints_ << " ..." << endl; combine(set, true); } else if (action == topoSetSource::DELETE) { - Info<< " Removing all cells of connected region containing point " - << insidePoint_ << " ..." << endl; + Info<< " Removing all cells of connected region containing points " + << insidePoints_ << " ..." << endl; combine(set, false); } diff --git a/src/meshTools/sets/cellSources/regionToCell/regionToCell.H b/src/meshTools/sets/cellSources/regionToCell/regionToCell.H index 94a49bbf64aa629d7c0673bf96830e89e280abf2..4d740c0ca3096774c6d70a3b7c8952c589646fa3 100644 --- a/src/meshTools/sets/cellSources/regionToCell/regionToCell.H +++ b/src/meshTools/sets/cellSources/regionToCell/regionToCell.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 @@ -26,7 +26,20 @@ Class Description TopoSetSource. Select cells belonging to topological connected region - (that contains given point) + (that contains given points) + + In dictionary input: + + // optional name of cellSet delimiting search + set c0; + + //- Number of cell layers to erode mesh to detect holes in the mesh + // Set to 0 if not used. + nErode 3; + + // points inside region to select + insidePoints ((1 2 3)); + SourceFiles regionToCell.C @@ -37,12 +50,15 @@ SourceFiles #define regionToCell_H #include "topoSetSource.H" +#include "boolList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +class regionSplit; + /*---------------------------------------------------------------------------*\ Class regionToCell Declaration \*---------------------------------------------------------------------------*/ @@ -58,14 +74,38 @@ class regionToCell static addToUsageTable usage_; //- Name of cellSet to keep to - word setName_; + const word setName_; + + //- Coordinate(s) that is inside connected region + const pointField insidePoints_; - //- Coordinate that is inside connected region - point insidePoint_; + //- Number of layers to erode + const label nErode_; // Private Member Functions + //- Mark faces inbetween selected and unselected elements + void markRegionFaces + ( + const boolList& selectedCell, + boolList& regionFace + ) const; + + //- Determine for every disconnected region in the mesh whether + // it contains a locationInMesh + boolList findRegions(const bool verbose, const regionSplit&) const; + + //- Unselect regions not containing a locationInMesh + void unselectOutsideRegions(boolList& selectedCell) const; + + //- Unselect one layer of cells from selectedCell + void shrinkRegions(boolList& selectedCell) const; + + //- Erode a given number of layers from selectedCell. Remove any + // region that gets disconnected that way. + void erode(boolList& selectedCell) const; + void combine(topoSet& set, const bool add) const; @@ -81,7 +121,8 @@ public: ( const polyMesh& mesh, const word& setName, - const point& insidePoint + const pointField& insidePoints, + const label nErode ); //- Construct from dictionary diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C new file mode 100644 index 0000000000000000000000000000000000000000..b91ec33b8285b7bbb31f417938d4c4dd810c1557 --- /dev/null +++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.C @@ -0,0 +1,211 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "searchableSurfaceToFaceZone.H" +#include "polyMesh.H" +#include "faceZoneSet.H" +#include "searchableSurface.H" +#include "syncTools.H" + +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(searchableSurfaceToFaceZone, 0); + addToRunTimeSelectionTable + ( + topoSetSource, + searchableSurfaceToFaceZone, + word + ); +} + + +Foam::topoSetSource::addToUsageTable Foam::searchableSurfaceToFaceZone::usage_ +( + searchableSurfaceToFaceZone::typeName, + "\n Usage: searchableSurfaceToFaceZone surface\n\n" + " Select all faces whose cell-cell centre vector intersects the surface " + "\n" +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from dictionary +Foam::searchableSurfaceToFaceZone::searchableSurfaceToFaceZone +( + const polyMesh& mesh, + const dictionary& dict +) +: + topoSetSource(mesh), + surfacePtr_ + ( + searchableSurface::New + ( + word(dict.lookup("surface")), + mesh.objectRegistry::db(), + dict + ) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::searchableSurfaceToFaceZone::~searchableSurfaceToFaceZone() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::searchableSurfaceToFaceZone::applyToSet +( + const topoSetSource::setAction action, + topoSet& set +) const +{ + if (!isA<faceZoneSet>(set)) + { + WarningIn + ( + "searchableSurfaceToFaceZone::applyToSet" + "(const topoSetSource::setAction" + ", topoSet" + ) << "Operation only allowed on a faceZoneSet." << endl; + } + else + { + faceZoneSet& fzSet = refCast<faceZoneSet>(set); + + // Get cell-cell centre vectors + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + pointField start(mesh_.nFaces()); + pointField end(mesh_.nFaces()); + + const pointField& cc = mesh_.cellCentres(); + + // Internal faces + for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++) + { + start[faceI] = cc[mesh_.faceOwner()[faceI]]; + end[faceI] = cc[mesh_.faceNeighbour()[faceI]]; + } + + // Boundary faces + vectorField nbrCellCentres; + syncTools::swapBoundaryCellList(mesh_, cc, nbrCellCentres); + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + forAll(pbm, patchI) + { + const polyPatch& pp = pbm[patchI]; + + if (pp.coupled()) + { + forAll(pp, i) + { + label faceI = pp.start()+i; + start[faceI] = cc[mesh_.faceOwner()[faceI]]; + end[faceI] = nbrCellCentres[faceI-mesh_.nInternalFaces()]; + } + } + else + { + forAll(pp, i) + { + label faceI = pp.start()+i; + start[faceI] = cc[mesh_.faceOwner()[faceI]]; + end[faceI] = mesh_.faceCentres()[faceI]; + } + } + } + + + // Do all intersection tests + // ~~~~~~~~~~~~~~~~~~~~~~~~~ + + List<pointIndexHit> hits; + surfacePtr_().findLine(start, end, hits); + pointField normals; + surfacePtr_().getNormal(hits, normals); + + + // Select intersected faces + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD)) + { + Info<< " Adding all faces from surface " + << surfacePtr_().name() << " ..." << endl; + + DynamicList<label> newAddressing(fzSet.addressing()); + DynamicList<bool> newFlipMap(fzSet.flipMap()); + + forAll(hits, faceI) + { + if (hits[faceI].hit() && !fzSet.found(faceI)) + { + newAddressing.append(faceI); + vector d = end[faceI]-start[faceI]; + newFlipMap.append((normals[faceI] & d) < 0); + } + } + + fzSet.addressing().transfer(newAddressing); + fzSet.flipMap().transfer(newFlipMap); + fzSet.updateSet(); + } + else if (action == topoSetSource::DELETE) + { + Info<< " Removing all faces from surface " + << surfacePtr_().name() << " ..." << endl; + + // Start off empty + DynamicList<label> newAddressing(fzSet.addressing().size()); + DynamicList<bool> newFlipMap(fzSet.flipMap().size()); + + forAll(fzSet.addressing(), i) + { + if (!hits[fzSet.addressing()[i]].hit()) + { + newAddressing.append(fzSet.addressing()[i]); + newFlipMap.append(fzSet.flipMap()[i]); + } + } + fzSet.addressing().transfer(newAddressing); + fzSet.flipMap().transfer(newFlipMap); + fzSet.updateSet(); + } + } +} + + +// ************************************************************************* // diff --git a/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H new file mode 100644 index 0000000000000000000000000000000000000000..7269a3d38eea48c6a89a7556b2878715bf70dd74 --- /dev/null +++ b/src/meshTools/sets/faceZoneSources/searchableSurfaceToFaceZone/searchableSurfaceToFaceZone.H @@ -0,0 +1,107 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::searchableSurfaceToFaceZone + +Description + A topoSetSource to select faces based on intersection (of cell-cell + vector) with a surface. + +SourceFiles + searchableSurfaceToFaceZone.C + +\*---------------------------------------------------------------------------*/ + +#ifndef searchableSurfaceToFaceZone_H +#define searchableSurfaceToFaceZone_H + +#include "topoSetSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class searchableSurface; + +/*---------------------------------------------------------------------------*\ + Class searchableSurfaceToFaceZone Declaration +\*---------------------------------------------------------------------------*/ + +class searchableSurfaceToFaceZone +: + public topoSetSource +{ + // Private data + + //- Add usage string + static addToUsageTable usage_; + + //- Surface + autoPtr<searchableSurface> surfacePtr_; + +public: + + //- Runtime type information + TypeName("searchableSurfaceToFaceZone"); + + // Constructors + + //- Construct from dictionary + searchableSurfaceToFaceZone + ( + const polyMesh& mesh, + const dictionary& dict + ); + + + //- Destructor + virtual ~searchableSurfaceToFaceZone(); + + + // Member Functions + + virtual sourceType setType() const + { + return FACEZONESOURCE; + } + + virtual void applyToSet + ( + const topoSetSource::setAction action, + topoSet& + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C index b40943cf69e387f93fa8b6f94ff68e4095a2c423..d171b432a036ae72d22796a34794842e924ed6d4 100644 --- a/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.C +++ b/src/meshTools/triSurface/booleanOps/booleanSurface/booleanSurface.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 @@ -33,7 +33,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::booleanSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(booleanSurface, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C index ecf56438c361f61f86bce3b3d2f2c36deed293ac..3a39a47525889e4a67042a84a07d8d2449641698 100644 --- a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C +++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.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 @@ -31,7 +31,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::edgeSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(edgeSurface, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C index d4892716c0139358010f53234f56750277db7845..7cffb1309a7b89571fcb7301dd485381ef080644 100644 --- a/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.C +++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/intersectedSurface.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 @@ -37,13 +37,18 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::intersectedSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(intersectedSurface, 0); +} + const Foam::label Foam::intersectedSurface::UNVISITED = 0; const Foam::label Foam::intersectedSurface::STARTTOEND = 1; const Foam::label Foam::intersectedSurface::ENDTOSTART = 2; const Foam::label Foam::intersectedSurface::BOTH = STARTTOEND | ENDTOSTART; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Write whole pointField and edges to stream diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index 662c9e0ac180fcc541bffbb6369b2abcb63669cd..a233af491d9e0f8b6e80a9d748891122d1843afc 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.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 @@ -40,9 +40,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::edgeIntersections, 0); +namespace Foam +{ +defineTypeNameAndDebug(edgeIntersections, 0); -Foam::scalar Foam::edgeIntersections::alignedCos_ = Foam::cos(degToRad(89.0)); +scalar edgeIntersections::alignedCos_ = cos(degToRad(89.0)); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -589,7 +592,7 @@ Foam::label Foam::edgeIntersections::removeDegenerates // If edge not already marked for retesting if (!affectedEdges[edgeI]) { - // 1. Check edges close to endpoint and perturb if nessecary. + // 1. Check edges close to endpoint and perturb if necessary. bool shiftedEdgeEndPoints = inlinePerturb diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C index 394f796aa32a7ca608a8a4393adc8620c133ea1d..9af93cf0b7be7b5b6962ded550c1f707903dcc06 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersection.C @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfaceIntersection, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfaceIntersection, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/orientedSurface/orientedSurface.C b/src/meshTools/triSurface/orientedSurface/orientedSurface.C index e42553d3c1f0e0055acd34929ae85ff83acd2ef7..95acfa125c60ad32dbb8b5bc4ffc43f0d51939b3 100644 --- a/src/meshTools/triSurface/orientedSurface/orientedSurface.C +++ b/src/meshTools/triSurface/orientedSurface/orientedSurface.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 @@ -30,7 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::orientedSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(orientedSurface, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -204,7 +207,7 @@ void Foam::orientedSurface::propagateOrientation if (side == triSurfaceTools::UNKNOWN) { // Non-closed surface. Do what? For now behave as if no flipping - // nessecary + // necessary flipState[nearestFaceI] = NOFLIP; } else if ((side == triSurfaceTools::OUTSIDE) == orientOutside) diff --git a/src/meshTools/triSurface/orientedSurface/orientedSurface.H b/src/meshTools/triSurface/orientedSurface/orientedSurface.H index bfb318e0151c06f3e56ddae3069807c9cc08275d..54b416e590bad5dafd5f7d454e4fb8f2198e71e6 100644 --- a/src/meshTools/triSurface/orientedSurface/orientedSurface.H +++ b/src/meshTools/triSurface/orientedSurface/orientedSurface.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,7 +47,7 @@ namespace Foam class triSurfaceSearch; /*---------------------------------------------------------------------------*\ - Class orientedSurface Declaration + Class orientedSurface Declaration \*---------------------------------------------------------------------------*/ class orientedSurface @@ -101,7 +101,7 @@ class orientedSurface ); //- Given nearest point and face check orientation to nearest face - // and flip if nessecary (only marked in flipState) and propagate. + // and flip if necessary (only marked in flipState) and propagate. static void propagateOrientation ( const triSurface&, diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 8ac5179fd14f6f148331f2b29c997f441730ad26..514099c8dff0399605632d9844c1eff3f214d0f8 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -37,10 +37,12 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfaceFeatures, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfaceFeatures, 0); -const Foam::scalar Foam::surfaceFeatures::parallelTolerance = - sin(degToRad(1.0)); +const scalar surfaceFeatures::parallelTolerance = sin(degToRad(1.0)); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C index c60be140affddc6c55d851763876fc3fad2da055..9f8a6a5179bf739ac3b41244c337924ac3c7fd96 100644 --- a/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C +++ b/src/meshTools/triSurface/triSurfaceTools/pointToPointPlanarInterpolation.C @@ -34,7 +34,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::pointToPointPlanarInterpolation, 0); +namespace Foam +{ +defineTypeNameAndDebug(pointToPointPlanarInterpolation, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index 9d0acbd618a5b0fa9b7de804494e790f3d59f195..5cea1fbd5e25083142e83810ec92698659136514 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -44,7 +44,18 @@ wmakeLnInclude decompositionMethods if [ -n "$SCOTCH_ARCH_PATH" ] then wmake $makeType scotchDecomp - [ -d "$FOAM_LIBBIN/$FOAM_MPI" ] && wmakeMpiLib ptscotchDecomp + + if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ] + then + #- Bit of a hack: ptscotch 6 requires scotch linked as well as. Can be + # removed once ptscotch declares dependency on scotch itself. + if [ "$SCOTCH_VERSION" = "scotch_6.0.0" ] + then + export LINK_FLAGS="-lscotch" + fi + + wmakeMpiLib ptscotchDecomp + fi else echo echo "Skipping scotchDecomp (ptscotchDecomp)" diff --git a/src/parallel/decompose/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C b/src/parallel/decompose/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C index 1098dfd828353ec1896d34526f008afa897596d8..9928f39f4738c01dec1f2042c995c108fbf20c19 100644 --- a/src/parallel/decompose/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C +++ b/src/parallel/decompose/decompositionMethods/hierarchGeomDecomp/hierarchGeomDecomp.C @@ -230,7 +230,7 @@ void Foam::hierarchGeomDecomp::findBinary if (returnReduce(hasNotChanged, andOp<bool>())) { WarningIn("hierarchGeomDecomp::findBinary(..)") - << "unable to find desired deomposition split, making do!" + << "unable to find desired decomposition split, making do!" << endl; break; } diff --git a/src/parallel/decompose/ptscotchDecomp/Make/options b/src/parallel/decompose/ptscotchDecomp/Make/options index 1e34631aa1b218aa0ba7f2af1e1becd6a7bcdbd4..acdebd89766011135d05276d7f68dcee0de075da 100644 --- a/src/parallel/decompose/ptscotchDecomp/Make/options +++ b/src/parallel/decompose/ptscotchDecomp/Make/options @@ -9,4 +9,4 @@ EXE_INC = \ -I../decompositionMethods/lnInclude LIB_LIBS = \ - -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lrt + -L$(SCOTCH_ROOT)/lib -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit ${LINK_FLAGS} -lrt diff --git a/src/postProcessing/functionObjects/IO/Make/options b/src/postProcessing/functionObjects/IO/Make/options index 5166bcc9e32f547f48a5f87c9c60d7210409967f..a3ae8da833177387e9eecf75b5e2675fc7b481f5 100644 --- a/src/postProcessing/functionObjects/IO/Make/options +++ b/src/postProcessing/functionObjects/IO/Make/options @@ -1,9 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -lfiniteVolume \ - -lmeshTools \ - -lsampling + -lmeshTools diff --git a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H index a5165aaf51eba138191684bacc3ff8aec690cfac..62a53f51943e1af6e31ea4f4ebd0aafbd0407c12 100644 --- a/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H +++ b/src/postProcessing/functionObjects/IO/partialWrite/partialWrite.H @@ -65,7 +65,6 @@ SourceFiles #ifndef partialWrite_H #define partialWrite_H -#include "pointFieldFwd.H" #include "HashSet.H" #include "DynamicList.H" #include "runTimeSelectionTables.H" @@ -78,6 +77,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -166,7 +166,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C index a2103db6e585262b3e865364ec9be28e7de06bf6..802f63f3082b5f9bb3eeb6611921a883c5017fe2 100644 --- a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::removeRegisteredObject, 0); +namespace Foam +{ +defineTypeNameAndDebug(removeRegisteredObject, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H index b25925c3c1c116372420fc297251c6ea45f2a2a4..957c1a9a2d1fa1f3ba4e2c5f7bde20509e7a7b32 100644 --- a/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H +++ b/src/postProcessing/functionObjects/IO/removeRegisteredObject/removeRegisteredObject.H @@ -61,7 +61,6 @@ SourceFiles #ifndef removeRegisteredObject_H #define removeRegisteredObject_H -#include "pointFieldFwd.H" #include "wordList.H" #include "runTimeSelectionTables.H" @@ -73,6 +72,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -154,7 +154,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C index c98ae3696b75148edc4fcffc026033a718acdde8..694fba31b67a3b67c182028cda810603200e991f 100644 --- a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C +++ b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.C @@ -30,7 +30,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::writeDictionary, 0); +namespace Foam +{ +defineTypeNameAndDebug(writeDictionary, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -46,7 +50,9 @@ bool Foam::writeDictionary::tryFolder dictNames_[dictI], location, obr_, - IOobject::MUST_READ + IOobject::MUST_READ, + IOobject::NO_WRITE, + false ); if (dictIO.headerOk()) diff --git a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H index 8c21f32489ddd9367751a90f6e61302c2d691406..1f12efd096f754f07999f3c00e59a4f8a1b9c2d3 100644 --- a/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H +++ b/src/postProcessing/functionObjects/IO/writeDictionary/writeDictionary.H @@ -39,7 +39,6 @@ SourceFiles #ifndef writeDictionary_H #define writeDictionary_H -#include "pointFieldFwd.H" #include "wordList.H" #include "runTimeSelectionTables.H" #include "SHA1Digest.H" @@ -52,6 +51,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -142,7 +142,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C index c6516b70459416fad7508e4acf038153b9ea3cb4..cc3f0c628ecffc6a9b7e2c84fe262181dd95c55f 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.C +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::writeRegisteredObject, 0); +namespace Foam +{ +defineTypeNameAndDebug(writeRegisteredObject, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H index 7dbdb4bd258edc73c072f5a74ecc5eb9fd83f085..f4bd97bd36842bfe75f16806fed65a989f99701a 100644 --- a/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H +++ b/src/postProcessing/functionObjects/IO/writeRegisteredObject/writeRegisteredObject.H @@ -62,7 +62,6 @@ SourceFiles #ifndef writeRegisteredObject_H #define writeRegisteredObject_H -#include "pointFieldFwd.H" #include "wordList.H" #include "runTimeSelectionTables.H" @@ -74,6 +73,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -155,7 +155,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C index b78968887448a3ff0db127928b83fe59735c6798..2a3d212afdc1e334e26cb29eaef9089b0724ac59 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::cloudInfo, 0); +namespace Foam +{ +defineTypeNameAndDebug(cloudInfo, 0); +} // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H index edd5d6897ddb13e78f46b5167a591bb0c8bdcf26..85558d2e3fc8d81eb3de967afe980a03249bfa6d 100644 --- a/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H +++ b/src/postProcessing/functionObjects/cloud/cloudInfo/cloudInfo.H @@ -170,7 +170,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/doc/functionObjects.dox b/src/postProcessing/functionObjects/doc/functionObjects.dox index 098b7ae12dd1546426fc7051e9a0497daace53d0..64073c2a3ff37c0764d52b82212ceadc1b16b2cc 100644 --- a/src/postProcessing/functionObjects/doc/functionObjects.dox +++ b/src/postProcessing/functionObjects/doc/functionObjects.dox @@ -39,6 +39,7 @@ The current range of features comprises of: - \ref grpCloudFunctionObjects - \ref grpFieldFunctionObjects - \ref grpForcesFunctionObjects +- \ref grpFVFunctionObjects - \ref grpIOFunctionObjects - \ref grpJobControlFunctionObjects - \ref grpUtilitiesFunctionObjects diff --git a/src/postProcessing/functionObjects/field/Make/files b/src/postProcessing/functionObjects/field/Make/files index 0abf314f96739f68133c1013b8f81ead28c17116..cba907676ad10502b6ad11e0ce243facc4cc2cd4 100644 --- a/src/postProcessing/functionObjects/field/Make/files +++ b/src/postProcessing/functionObjects/field/Make/files @@ -10,6 +10,9 @@ fieldMinMax/fieldMinMax.C fieldMinMax/fieldMinMaxFunctionObject.C fieldValues/fieldValue/fieldValue.C +fieldValues/fieldValue/fieldValueNew.C +fieldValues/fieldValueDelta/fieldValueDelta.C +fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C fieldValues/faceSource/faceSource.C fieldValues/faceSource/faceSourceFunctionObject.C fieldValues/cellSource/cellSource.C diff --git a/src/postProcessing/functionObjects/field/Make/options b/src/postProcessing/functionObjects/field/Make/options index d7c5f944c60caad1eb365309b14a6bb6e6913c9f..e95ea37c7876c2daeafaf58798c39db0e616abc7 100644 --- a/src/postProcessing/functionObjects/field/Make/options +++ b/src/postProcessing/functionObjects/field/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/turbulenceModels \ @@ -11,6 +12,7 @@ LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -llagrangian \ + -lfileFormats \ -lsampling \ -lincompressibleTransportModels \ -lcompressibleTurbulenceModel \ diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C index 5d63cced6c714f1c11c266bc973cab777b314414..68c4ab2cedf7bbe0db6605acfa27f785ee9813f0 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.C @@ -31,10 +31,13 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldAverage, 0); +namespace Foam +{ +defineTypeNameAndDebug(fieldAverage, 0); -const Foam::word Foam::fieldAverage::EXT_MEAN = "Mean"; -const Foam::word Foam::fieldAverage::EXT_PRIME2MEAN = "Prime2Mean"; +const word fieldAverage::EXT_MEAN = "Mean"; +const word fieldAverage::EXT_PRIME2MEAN = "Prime2Mean"; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -408,7 +411,7 @@ void Foam::fieldAverage::updateMesh(const mapPolyMesh&) } -void Foam::fieldAverage::movePoints(const pointField&) +void Foam::fieldAverage::movePoints(const polyMesh&) { // Do nothing } diff --git a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H index 1ba37ec6d59cdd732cb71396bdc0358d0b8fe818..a77459f82f5961a7810f02fae84fa737bde9ce17 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H +++ b/src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverage.H @@ -116,7 +116,6 @@ SourceFiles #define fieldAverage_H #include "volFieldsFwd.H" -#include "pointFieldFwd.H" #include "Switch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -130,10 +129,11 @@ class dictionary; class fieldAverageItem; template<class Type> class List; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ - Class fieldAverage Declaration + Class fieldAverage Declaration \*---------------------------------------------------------------------------*/ class fieldAverage @@ -266,15 +266,6 @@ protected: void readAveragingProperties(); - // Functions to be over-ridden from IOoutputFilter class - - //- Update mesh - virtual void updateMesh(const mapPolyMesh&); - - //- Move points - virtual void movePoints(const Field<point>&); - - //- Disallow default bitwise copy construct fieldAverage(const fieldAverage&); @@ -324,6 +315,12 @@ public: //- Calculate the field average data and write virtual void write(); + + //- Update mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Move points + virtual void movePoints(const polyMesh&); }; diff --git a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C index afb592bc78dab27c912d39f5fdab4a760b072e87..250e3c34dcac7b4221ae2543dee5420760454be1 100644 --- a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C +++ b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldCoordinateSystemTransform, 0); +namespace Foam +{ +defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H index e583e6b168cae3c2d9162a171100ab9c62240e82..0671327ad8e7abc9d8a71aae427a2955ccedc1ba 100644 --- a/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H +++ b/src/postProcessing/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H @@ -78,7 +78,6 @@ SourceFiles #define fieldCoordinateSystemTransform_H #include "OFstream.H" -#include "pointFieldFwd.H" #include "volFields.H" #include "surfaceFields.H" #include "coordinateSystem.H" @@ -91,6 +90,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -181,7 +181,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C index e268fa4c93de0212f88eb2fd77d1bec722d26d1b..e7a611febc452b8bb148f1cd28088aaa5fcba8ee 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.C @@ -28,17 +28,16 @@ License #include "dictionary.H" #include "Time.H" - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldMinMax, 0); - namespace Foam { + defineTypeNameAndDebug(fieldMinMax, 0); + template<> - const char* Foam::NamedEnum + const char* NamedEnum < - Foam::fieldMinMax::modeType, + fieldMinMax::modeType, 2 >::names[] = { diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H index dbaf40b1da091a264646dfe1258408d3ef403b7b..50e3017f89327ddae9dbbbbd99a0007ab7a5d5a3 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMax.H @@ -82,7 +82,6 @@ SourceFiles #include "HashSet.H" #include "OFstream.H" #include "Switch.H" -#include "pointFieldFwd.H" #include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -93,6 +92,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -205,7 +205,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C index 33564024b1c13146cacebe7e0add6ccb3005b64e..6bd6102b2e124a3aa64a60f6de2f0bcdf2967566 100644 --- a/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldMinMax/fieldMinMaxTemplates.C @@ -75,20 +75,23 @@ void Foam::fieldMinMax::calcMinMaxFields forAll(magFieldBoundary, patchI) { const scalarField& mfp = magFieldBoundary[patchI]; - const vectorField& Cfp = CfBoundary[patchI]; - - label minPI = findMin(mfp); - if (mfp[minPI] < minVs[procI]) + if (mfp.size()) { - minVs[procI] = mfp[minPI]; - minCs[procI] = Cfp[minPI]; - } + const vectorField& Cfp = CfBoundary[patchI]; - label maxPI = findMax(mfp); - if (mfp[maxPI] > maxVs[procI]) - { - maxVs[procI] = mfp[maxPI]; - maxCs[procI] = Cfp[maxPI]; + label minPI = findMin(mfp); + if (mfp[minPI] < minVs[procI]) + { + minVs[procI] = mfp[minPI]; + minCs[procI] = Cfp[minPI]; + } + + label maxPI = findMax(mfp); + if (mfp[maxPI] > maxVs[procI]) + { + maxVs[procI] = mfp[maxPI]; + maxCs[procI] = Cfp[maxPI]; + } } } @@ -173,20 +176,23 @@ void Foam::fieldMinMax::calcMinMaxFields forAll(fieldBoundary, patchI) { const Field<Type>& fp = fieldBoundary[patchI]; - const vectorField& Cfp = CfBoundary[patchI]; - - label minPI = findMin(fp); - if (fp[minPI] < minVs[procI]) + if (fp.size()) { - minVs[procI] = fp[minPI]; - minCs[procI] = Cfp[minPI]; - } + const vectorField& Cfp = CfBoundary[patchI]; - label maxPI = findMax(fp); - if (fp[maxPI] > maxVs[procI]) - { - maxVs[procI] = fp[maxPI]; - maxCs[procI] = Cfp[maxPI]; + label minPI = findMin(fp); + if (fp[minPI] < minVs[procI]) + { + minVs[procI] = fp[minPI]; + minCs[procI] = Cfp[minPI]; + } + + label maxPI = findMax(fp); + if (fp[maxPI] > maxVs[procI]) + { + maxVs[procI] = fp[maxPI]; + maxCs[procI] = Cfp[maxPI]; + } } } @@ -250,7 +256,14 @@ void Foam::fieldMinMax::calcMinMaxFields } default: { - FatalErrorIn("Foam::fieldMinMax::calcMinMaxFields(const word&)") + FatalErrorIn + ( + "Foam::fieldMinMax::calcMinMaxFields" + "(" + "const word&, " + "const modeType&" + ")" + ) << "Unknown min/max mode: " << modeTypeNames_[mode_] << exit(FatalError); } diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C index 488f690ca414d2a846a3bde665e6d9ecd94686b2..3d7977c488db8b7a3807bec026378c201edfeeb4 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C @@ -26,20 +26,14 @@ License #include "cellSource.H" #include "fvMesh.H" #include "volFields.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldValues::cellSource, 0); - namespace Foam { - template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::cellSource::sourceType, - 2 - >::names[] = + const char* NamedEnum<fieldValues::cellSource::sourceType, 2>::names[] = { "cellZone", "all" @@ -47,11 +41,7 @@ namespace Foam template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::cellSource::operationType, - 9 - >::names[] = + const char* NamedEnum<fieldValues::cellSource::operationType, 9>::names[] = { "none", "sum", @@ -63,6 +53,12 @@ namespace Foam "max", "CoV" }; + + namespace fieldValues + { + defineTypeNameAndDebug(cellSource, 0); + addToRunTimeSelectionTable(fieldValue, cellSource, dictionary); + } } @@ -185,7 +181,8 @@ Foam::fieldValues::cellSource::cellSource source_(sourceTypeNames_.read(dict.lookup("source"))), operation_(operationTypeNames_.read(dict.lookup("operation"))), nCells_(0), - cellId_() + cellId_(), + weightFieldName_("none") { read(dict); } diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C index ab59cf13b8ee2b9aca486db21f19475fbd196930..bdeccc6dd0ad79a485e6baf4a3d3cb3f0dd1ce13 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C @@ -177,6 +177,9 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) { Type result = processValues(values, V, weightField); + // add to result dictionary, over-writing any previous entry + resultDict_.add(fieldName, result, true); + if (valueOutput_) { IOField<Type> diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index d9f822dde5bd7c31d87a2087cacdd54047ae45c3..14a6fa310e7d7cad49c36119fc7d1a1b8eeec0f4 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -32,19 +32,14 @@ License #include "mergePoints.H" #include "indirectPrimitivePatch.H" #include "PatchTools.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::fieldValues::faceSource, 0); - namespace Foam { template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::faceSource::sourceType, - 3 - >::names[] = + const char* NamedEnum<fieldValues::faceSource::sourceType, 3>::names[] = { "faceZone", "patch", @@ -53,11 +48,7 @@ namespace Foam template<> - const char* Foam::NamedEnum - < - Foam::fieldValues::faceSource::operationType, - 11 - >::names[] = + const char* NamedEnum<fieldValues::faceSource::operationType, 11>::names[] = { "none", "sum", @@ -72,6 +63,11 @@ namespace Foam "areaNormalIntegrate" }; + namespace fieldValues + { + defineTypeNameAndDebug(faceSource, 0); + addToRunTimeSelectionTable(fieldValue, faceSource, dictionary); + } } diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index 4092bf44008bcedccdfb2a9c1c11c3b8b3a24075..a82f4890361b3de7284e28a9606fdddaf14fc844 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -291,6 +291,9 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { Type result = processValues(values, Sf, weightField); + // add to result dictionary, over-writing any previous entry + resultDict_.add(fieldName, result, true); + file()<< tab << result; if (log_) diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C index cc2aeb0423a852972e4b4bb12911bf7d2c7ef484..5cb2faa3b69d207a9f0dcc23541af9314372b8b2 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.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,29 +26,19 @@ License #include "fieldValue.H" #include "fvMesh.H" #include "Time.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(fieldValue, 0); + defineRunTimeSelectionTable(fieldValue, dictionary); } // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::fieldValue::updateMesh(const mapPolyMesh&) -{ - // Do nothing -} - - -void Foam::fieldValue::movePoints(const Field<point>&) -{ - // Do nothing -} - - void Foam::fieldValue::read(const dictionary& dict) { if (active_) @@ -92,7 +82,8 @@ Foam::fieldValue::fieldValue log_(false), sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")), fields_(dict.lookup("fields")), - valueOutput_(dict.lookup("valueOutput")) + valueOutput_(dict.lookup("valueOutput")), + resultDict_(fileName("name"), dictionary::null) { // Only active if obr is an fvMesh if (isA<fvMesh>(obr_)) @@ -137,4 +128,16 @@ void Foam::fieldValue::end() } +void Foam::fieldValue::updateMesh(const mapPolyMesh&) +{ + // Do nothing +} + + +void Foam::fieldValue::movePoints(const polyMesh&) +{ + // Do nothing +} + + // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 8e52e3ee45452dd0c8094c96f6b3cb935c78d67e..1b2f2621e7b240737f6e5953356bd5d252a07019 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -40,8 +40,10 @@ SourceFiles #include "functionObjectFile.H" #include "Switch.H" -#include "pointFieldFwd.H" #include "OFstream.H" +#include "dictionary.H" +#include "Field.H" +#include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -49,9 +51,9 @@ namespace Foam { // Forward declaration of classes -class dictionary; class objectRegistry; class fvMesh; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -88,14 +90,8 @@ protected: //- Output field values flag Switch valueOutput_; - - // Functions to be over-ridden from IOoutputFilter class - - //- Update mesh - virtual void updateMesh(const mapPolyMesh&); - - //- Move points - virtual void movePoints(const Field<point>&); + //- Results dictionary for external access of results + dictionary resultDict_; public: @@ -103,6 +99,21 @@ public: //- Run-time type information TypeName("fieldValue"); + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + fieldValue, + dictionary, + ( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles + ), + (name, obr, dict, loadFromFiles) + ); //- Construct from components fieldValue @@ -114,6 +125,15 @@ public: const bool loadFromFiles = false ); + //- Return a reference to the selected fieldValue + static autoPtr<fieldValue> New + ( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles = false, + const bool output = true + ); //- Destructor virtual ~fieldValue(); @@ -147,6 +167,9 @@ public: //- Helper function to return the reference to the mesh inline const fvMesh& mesh() const; + //- Return access to the latest set of results + inline const dictionary& resultDict() const; + // Function object functions @@ -162,6 +185,12 @@ public: //- Execute the at the final time-loop, currently does nothing virtual void end(); + //- Update mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Move points + virtual void movePoints(const polyMesh&); + //- Combine fields from all processor domains into single field template<class Type> void combineFields(Field<Type>& field); diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H index c29a7b918afd776d8dbfb09e176eeca2c15bab9f..aaee816af205747697031b269fc8e62c63044d52 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.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 @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "fieldValue.H" +#include "fvMesh.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -75,4 +76,10 @@ inline const Foam::fvMesh& Foam::fieldValue::mesh() const } +inline const Foam::dictionary& Foam::fieldValue::resultDict() const +{ + return resultDict_; +} + + // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C new file mode 100644 index 0000000000000000000000000000000000000000..f418ad02156352df8061f7fd96fcc28c24599c00 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueNew.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fieldValue.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles, + const bool output +) +{ + const word modelType(dict.lookup("type")); + + if (output) + { + Info<< "Selecting " << typeName << " " << modelType << endl; + } + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "fieldValue::New" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "Unknown " << typeName << " type " + << modelType << nl << nl + << "Valid " << typeName << " types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr<fieldValue> + ( + cstrIter() + ( + name, + obr, + dict, + loadFromFiles + ) + ); +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/IOfieldValueDelta.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/IOfieldValueDelta.H new file mode 100644 index 0000000000000000000000000000000000000000..7c316e926eb4be619d88395767fc6074933a26f8 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/IOfieldValueDelta.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOfieldValueDelta + + +Description + Instance of the generic IOOutputFilter for fieldValueDelta. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOfieldValueDelta_H +#define IOfieldValueDelta_H + +#include "fieldValueDelta.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<fieldValueDelta> IOfieldValueDelta; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C new file mode 100644 index 0000000000000000000000000000000000000000..20614f474f0f082f9d6cdcc629249159a159f5a1 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -0,0 +1,214 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fieldValueDelta.H" +#include "ListOps.H" +#include "Time.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace fieldValues + { + defineTypeNameAndDebug(fieldValueDelta, 0); + } + + template<> + const char* + NamedEnum<fieldValues::fieldValueDelta::operationType, 4>::names[] = + { + "add", + "subtract", + "min", + "max" + }; + + const NamedEnum<fieldValues::fieldValueDelta::operationType, 4> + fieldValues::fieldValueDelta::operationTypeNames_; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fieldValues::fieldValueDelta::fieldValueDelta +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + functionObjectFile(obr, name, typeName), + name_(name), + obr_(obr), + loadFromFiles_(loadFromFiles), + log_(false), + operation_(opSubtract), + source1Ptr_(NULL), + source2Ptr_(NULL) +{ + read(dict); +} + + +void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i) +{ + const wordList& fields1 = source1Ptr_->fields(); + const wordList& fields2 = source2Ptr_->fields(); + + DynamicList<word> commonFields(fields1.size()); + forAll(fields1, i) + { + label index = findIndex(fields2, fields1[i]); + if (index != -1) + { + commonFields.append(fields1[i]); + } + } + + Ostream& os = file(); + + os << "# Source1 : " << source1Ptr_->name() << nl + << "# Source2 : " << source2Ptr_->name() << nl + << "# Operation : " << operationTypeNames_[operation_] << nl; + + os << "# Time"; + + forAll(commonFields, i) + { + os << tab << commonFields[i]; + } + + os << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fieldValues::fieldValueDelta::~fieldValueDelta() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict) +{ + log_ = dict.lookupOrDefault<Switch>("log", false); + source1Ptr_.reset + ( + fieldValue::New + ( + name_ + ".source1", + obr_, + dict.subDict("source1"), + loadFromFiles_, + false + ).ptr() + ); + source2Ptr_.reset + ( + fieldValue::New + ( + name_ + ".source2", + obr_, + dict.subDict("source2"), + loadFromFiles_, + false + ).ptr() + ); + + operation_ = operationTypeNames_.read(dict.lookup("operation")); +} + + +void Foam::fieldValues::fieldValueDelta::write() +{ + functionObjectFile::write(); + + source1Ptr_->write(); + source2Ptr_->write(); + + if (Pstream::master()) + { + file()<< obr_.time().timeName(); + } + + if (log_) + { + Info<< type() << " output:" << endl; + } + + bool found = false; + processFields<scalar>(found); + processFields<vector>(found); + processFields<sphericalTensor>(found); + processFields<symmTensor>(found); + processFields<tensor>(found); + + if (Pstream::master()) + { + file()<< endl; + } + + if (log_) + { + if (!found) + { + Info<< " none" << endl; + } + else + { + Info<< endl; + } + } +} + + +void Foam::fieldValues::fieldValueDelta::execute() +{ + // Do nothing +} + + +void Foam::fieldValues::fieldValueDelta::end() +{ + // Do nothing +} + + +void Foam::fieldValues::fieldValueDelta::updateMesh(const mapPolyMesh&) +{ + // Do nothing +} + + +void Foam::fieldValues::fieldValueDelta::movePoints(const polyMesh&) +{ + // Do nothing +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H new file mode 100644 index 0000000000000000000000000000000000000000..e28771109a2f55004a05ef4af071c72d3a061cda --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::fieldValues::fieldValueDelta + +Group + grpFieldFunctionObjects + +Description + This function object provides a differencing option between two 'field + value' function objects. + + Example of function object specification: + \verbatim + fieldValueDelta1 + { + type fieldValueDelta; + functionObjectLibs ("libfieldFunctionObjects.so"); + fieldValue1 + { + ... + } + fieldValue2 + { + ... + } + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: fieldValueDelta | yes | + \endtable + +SeeAlso + Foam::fieldValue + +SourceFiles + fieldValueDelta.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldValueDelta_H +#define fieldValueDelta_H + +#include "functionObjectFile.H" +#include "fieldValue.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace fieldValues +{ + +/*---------------------------------------------------------------------------*\ + Class fieldValueDelta Declaration +\*---------------------------------------------------------------------------*/ + +class fieldValueDelta +: + public functionObjectFile +{ +public: + //- Operation type enumeration + enum operationType + { + opAdd, + opSubtract, + opMin, + opMax + }; + + //- Operation type names + static const NamedEnum<operationType, 4> operationTypeNames_; + + +private: + + // Private data + + //- Name of this fieldValue object + word name_; + + //- Database this class is registered to + const objectRegistry& obr_; + + //- Flag to indicate to load from files + bool loadFromFiles_; + + //- Switch to send output to Info as well as to file + Switch log_; + + //- Operation to apply to values + operationType operation_; + + //- Field value source object 1 + autoPtr<fieldValue> source1Ptr_; + + //- Field value source object 2 + autoPtr<fieldValue> source2Ptr_; + + + // Private Member Functions + + //- Templated function to process common fields + template<class Type> + void processFields(bool& found); + + //- Templated function to apply the operation + template<class Type> + Type applyOperation(const Type& value1, const Type& value2) const; + + +protected: + + // Functions to be over-ridden from IOoutputFilter class + + //- Output file header information + virtual void writeFileHeader(const label i); + + +public: + + //- Run-time type information + TypeName("fieldValueDelta"); + + + //- Construct from components + fieldValueDelta + ( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~fieldValueDelta(); + + + // Public Member Functions + + // Function object functions + + //- Read from dictionary + virtual void read(const dictionary&); + + //- Calculate and write + virtual void write(); + + //- Execute + virtual void execute(); + + //- Execute the at the final time-loop, currently does nothing + virtual void end(); + + //- Update mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Move points + virtual void movePoints(const polyMesh&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fieldValues +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "fieldValueDeltaTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..7d093c37818aa9a9fd45d2018447500d57fcee1a --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fieldValueDeltaFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug + ( + fieldValueDeltaFunctionObject, + 0 + ); + + addToRunTimeSelectionTable + ( + functionObject, + fieldValueDeltaFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..120d5991bcb3845f8a13f2a66e9b107e9a614ac2 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::fieldValueDeltaFunctionObject + +Description + FunctionObject wrapper around fieldValueDelta to allow it to be + created via the functions entry within controlDict. + +SourceFiles + fieldValueDeltaFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldValueDeltaFunctionObject_H +#define fieldValueDeltaFunctionObject_H + +#include "fieldValueDelta.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<fieldValues::fieldValueDelta> + fieldValueDeltaFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..6b757fc2df391d3e393690c1de2708432be15c86 --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C @@ -0,0 +1,123 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "GeometricField.H" +#include "volMesh.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +Type Foam::fieldValues::fieldValueDelta::applyOperation +( + const Type& value1, + const Type& value2 +) const +{ + Type result = pTraits<Type>::zero; + + switch (operation_) + { + case opAdd: + { + result = value1 + value2; + break; + } + case opSubtract: + { + result = value1 - value2; + break; + } + case opMin: + { + result = min(value1, value2); + break; + } + case opMax: + { + result = max(value1, value2); + break; + } + default: + { + FatalErrorIn + ( + "Type Foam::fieldValues::fieldValueDelta::applyOperation" + "(" + "const Type&, " + "const Type&" + ") const" + ) + << "Unable to process operation " + << operationTypeNames_[operation_] + << abort(FatalError); + } + } + + return result; +} + + +template<class Type> +void Foam::fieldValues::fieldValueDelta::processFields(bool& found) +{ + typedef GeometricField<Type, fvPatchField, volMesh> vf; + + const wordList& fields1 = source1Ptr_->fields(); + + const dictionary& results1 = source1Ptr_->resultDict(); + const dictionary& results2 = source2Ptr_->resultDict(); + + Type r1(pTraits<Type>::zero); + Type r2(pTraits<Type>::zero); + + forAll(fields1, i) + { + const word& fieldName = fields1[i]; + if (obr_.foundObject<vf>(fieldName) && results2.found(fieldName)) + { + results1.lookup(fieldName) >> r1; + results2.lookup(fieldName) >> r2; + + Type result = applyOperation(r1, r2); + + if (log_) + { + Info<< " " << operationTypeNames_[operation_] + << "(" << fieldName << ") = " << result + << endl; + } + + if (Pstream::master()) + { + file()<< tab << result; + } + + found = true; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C index ee8eb8e334a18db5517a9890a43ac0b3530cdb83..715bcfa7f8fa51bc791b88a39480361eafcc2e95 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.C @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::nearWallFields, 0); +namespace Foam +{ +defineTypeNameAndDebug(nearWallFields, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.H b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.H index e6be5d7948ee44e1ef2bbcef3544e843bcb36c1a..df6c8f80635ce8df57630d246082a2cd1b2f203e 100644 --- a/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.H +++ b/src/postProcessing/functionObjects/field/nearWallFields/nearWallFields.H @@ -199,7 +199,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/processorField/processorField.C b/src/postProcessing/functionObjects/field/processorField/processorField.C index 87794ba92e4d74d4b84ae27ef80f26e0bb9ed805..bd72316b23685a605173e899cc51f2a7bd679621 100644 --- a/src/postProcessing/functionObjects/field/processorField/processorField.C +++ b/src/postProcessing/functionObjects/field/processorField/processorField.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::processorField, 0); +namespace Foam +{ +defineTypeNameAndDebug(processorField, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/field/processorField/processorField.H b/src/postProcessing/functionObjects/field/processorField/processorField.H index b1ecdb65f5cebbc7acc84a811ae32c09823adcf9..cee878adc1d5e005ac27ebfa513e1e79a056d5a9 100644 --- a/src/postProcessing/functionObjects/field/processorField/processorField.H +++ b/src/postProcessing/functionObjects/field/processorField/processorField.H @@ -153,7 +153,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.C b/src/postProcessing/functionObjects/field/readFields/readFields.C index 6e5c44935fc6d704d2462d1d0aee42ddfe558024..2d8a0fd0e0e6e840b4f5f14ff204f690d6503949 100644 --- a/src/postProcessing/functionObjects/field/readFields/readFields.C +++ b/src/postProcessing/functionObjects/field/readFields/readFields.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 @@ -28,7 +28,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::readFields, 0); +namespace Foam +{ +defineTypeNameAndDebug(readFields, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/field/readFields/readFields.H b/src/postProcessing/functionObjects/field/readFields/readFields.H index 8a26b89f5688af7b6caba7980966534fe8ee51be..81f11922b7fa0c8084b192b4161cfa0e7795ceff 100644 --- a/src/postProcessing/functionObjects/field/readFields/readFields.H +++ b/src/postProcessing/functionObjects/field/readFields/readFields.H @@ -181,7 +181,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H index e24a4fd5ac97640e8dde899956c265eb0ffb3920..1fd236f024c8b202f42b3379054be74b9d91af91 100644 --- a/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H +++ b/src/postProcessing/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H @@ -274,7 +274,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLine.C b/src/postProcessing/functionObjects/field/streamLine/streamLine.C index 47adbd003f3ad924a72e2896def8831423d4d9d7..037ddc5ae16a1ce5e8ae90bc72e15e41cf83ef26 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLine.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLine.C @@ -38,7 +38,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::streamLine, 0); +namespace Foam +{ +defineTypeNameAndDebug(streamLine, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -749,7 +753,7 @@ void Foam::streamLine::updateMesh(const mapPolyMesh&) } -void Foam::streamLine::movePoints(const pointField&) +void Foam::streamLine::movePoints(const polyMesh&) { // Moving mesh affects the search tree read(dict_); diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLine.H b/src/postProcessing/functionObjects/field/streamLine/streamLine.H index 08f01e45194d80c80fa9052722da70a361929a60..bce1808d90a6e7627e07110ae68cb8c125d75c7b 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLine.H +++ b/src/postProcessing/functionObjects/field/streamLine/streamLine.H @@ -273,7 +273,7 @@ public: virtual void updateMesh(const mapPolyMesh&); //- Update for mesh point-motion - virtual void movePoints(const pointField&); + virtual void movePoints(const polyMesh&); ////- Update for changes of mesh due to readUpdate //virtual void readUpdate(const polyMesh::readUpdateState state); diff --git a/src/postProcessing/functionObjects/field/surfaceInterpolateFields/surfaceInterpolateFields.H b/src/postProcessing/functionObjects/field/surfaceInterpolateFields/surfaceInterpolateFields.H index 61d8724d698bb6fb4c410b6c3fbe608b8a15d013..07110c8d88203a9bce1a1b8750ad98a01e5bd8cf 100644 --- a/src/postProcessing/functionObjects/field/surfaceInterpolateFields/surfaceInterpolateFields.H +++ b/src/postProcessing/functionObjects/field/surfaceInterpolateFields/surfaceInterpolateFields.H @@ -177,7 +177,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C index fd4ba20b65e48d514e66431ca2dedf5600b122f0..855b3ce80078193b7a6ead5f0cb78ade5ba650b9 100644 --- a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C +++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.C @@ -32,7 +32,7 @@ License namespace Foam { - defineTypeNameAndDebug(Foam::turbulenceFields, 0); + defineTypeNameAndDebug(turbulenceFields, 0); template<> const char* NamedEnum<turbulenceFields::compressibleField, 6>::names[] = diff --git a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H index 527f332c4687aef2dfc9851170bddb97e593af15..b885759223fdd44e649282897029d438d9a598f5 100644 --- a/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H +++ b/src/postProcessing/functionObjects/field/turbulenceFields/turbulenceFields.H @@ -86,7 +86,6 @@ SourceFiles #include "HashSet.H" #include "IOobject.H" #include "NamedEnum.H" -#include "pointField.H" #include "volFieldsFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -97,6 +96,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -214,7 +214,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C index 8ae2ed96d218e936f36b898738958dfbcaca5577..e2487e3cd68d43f5bf8ade6af60531f2aa6c19f5 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.C @@ -40,7 +40,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::wallBoundedStreamLine, 0); +namespace Foam +{ +defineTypeNameAndDebug(wallBoundedStreamLine, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -876,7 +880,7 @@ void Foam::wallBoundedStreamLine::updateMesh(const mapPolyMesh&) } -void Foam::wallBoundedStreamLine::movePoints(const pointField&) +void Foam::wallBoundedStreamLine::movePoints(const polyMesh&) { // Moving mesh affects the search tree read(dict_); diff --git a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H index e7dceed8bb6697a51d7b8f3112b7a0a0e2e9de28..c6b8a178a3553dab1e9633fc3b5b7edf93667455 100644 --- a/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H +++ b/src/postProcessing/functionObjects/field/wallBoundedStreamLine/wallBoundedStreamLine.H @@ -279,7 +279,7 @@ public: virtual void updateMesh(const mapPolyMesh&); //- Update for mesh point-motion - virtual void movePoints(const pointField&); + virtual void movePoints(const polyMesh&); ////- Update for changes of mesh due to readUpdate //virtual void readUpdate(const polyMesh::readUpdateState state); diff --git a/src/postProcessing/functionObjects/forces/Make/options b/src/postProcessing/functionObjects/forces/Make/options index afc10fb1aad15a165291f66c0861d7362061da13..5952c6b6cb5f66e783d7dddeaccce7bdf5f89f25 100644 --- a/src/postProcessing/functionObjects/forces/Make/options +++ b/src/postProcessing/functionObjects/forces/Make/options @@ -1,7 +1,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \ @@ -17,4 +17,4 @@ LIB_LIBS = \ -lcompressibleLESModels \ -lfiniteVolume \ -lmeshTools \ - -lsampling + -lfileFormats diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 1487175753972a162d5478ad25b4d722c5e85d0b..ce38948089bac61b7ee462eb4ec091c1a8fa0d1e 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -31,7 +31,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::forceCoeffs, 0); +namespace Foam +{ +defineTypeNameAndDebug(forceCoeffs, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index bfcd001eaba9e049e35cb0034bcd544fde636273..27310c7a803e62cf94055bf94f871f5f0d52542a 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -40,7 +40,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::forces, 0); +namespace Foam +{ +defineTypeNameAndDebug(forces, 0); +} // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H index d2d2e4b2dcfda63b27ad32eeb144db7fdc5ca3f9..12d72f61a69302bfdb0f5bf53c81e56f01cb5434 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.H +++ b/src/postProcessing/functionObjects/forces/forces/forces.H @@ -112,7 +112,6 @@ SourceFiles #include "Tuple2.H" #include "OFstream.H" #include "Switch.H" -#include "pointFieldFwd.H" #include "writer.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -123,6 +122,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -316,7 +316,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C index a36367f80507a154f133f3270ea2388111ad447f..b4154fc847f0b62de2e694b5c6a760aff560440e 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.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 @@ -27,9 +27,13 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::sixDoFRigidBodyMotionConstraint, 0); +namespace Foam +{ +defineTypeNameAndDebug(sixDoFRigidBodyMotionConstraint, 0); + +defineRunTimeSelectionTable(sixDoFRigidBodyMotionConstraint, dictionary); +} -defineRunTimeSelectionTable(Foam::sixDoFRigidBodyMotionConstraint, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C index 19feb9aadf3173342b366fc0a8d0b4d0be9021eb..6a7088a0dc351764b68d747215870491470b8bc3 100644 --- a/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C +++ b/src/postProcessing/functionObjects/forces/pointPatchFields/derived/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.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 @@ -27,9 +27,13 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::sixDoFRigidBodyMotionRestraint, 0); +namespace Foam +{ +defineTypeNameAndDebug(sixDoFRigidBodyMotionRestraint, 0); + +defineRunTimeSelectionTable(sixDoFRigidBodyMotionRestraint, dictionary); +} -defineRunTimeSelectionTable(Foam::sixDoFRigidBodyMotionRestraint, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/fvTools/Make/files b/src/postProcessing/functionObjects/fvTools/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..f5940e8ce3bc4928c8cef7f60d9666f5576f370d --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/Make/files @@ -0,0 +1,10 @@ +calcFvcDiv/calcFvcDiv.C +calcFvcDiv/calcFvcDivFunctionObject.C + +calcFvcGrad/calcFvcGrad.C +calcFvcGrad/calcFvcGradFunctionObject.C + +calcMag/calcMag.C +calcMag/calcMagFunctionObject.C + +LIB = $(FOAM_LIBBIN)/libFVFunctionObjects diff --git a/applications/solvers/multiphase/bubbleFoam/Make/options b/src/postProcessing/functionObjects/fvTools/Make/options similarity index 51% rename from applications/solvers/multiphase/bubbleFoam/Make/options rename to src/postProcessing/functionObjects/fvTools/Make/options index 39da2bd6db2a4f59426299612d0c907926f0d3e0..71b7873964d544eddf96d22aa40f4c3372c23c9c 100644 --- a/applications/solvers/multiphase/bubbleFoam/Make/options +++ b/src/postProcessing/functionObjects/fvTools/Make/options @@ -1,6 +1,5 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude -EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools +LIB_LIBS = \ + -lfiniteVolume diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/IOcalcFvcDiv.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/IOcalcFvcDiv.H new file mode 100644 index 0000000000000000000000000000000000000000..245aae6e2bf89adc3b50197cd94687d2cdeac8ad --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/IOcalcFvcDiv.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOcalcFvcDiv + +Description + Instance of the generic IOOutputFilter for calcFvcDiv. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcalcFvcDiv_H +#define IOcalcFvcDiv_H + +#include "calcFvcDiv.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<calcFvcDiv> IOcalcFvcDiv; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C new file mode 100644 index 0000000000000000000000000000000000000000..b5fd621b711bbf6c3b9c29c919e705253c79bc00 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.C @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcDiv.H" +#include "volFields.H" +#include "dictionary.H" +#include "calcFvcDiv.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(calcFvcDiv, 0); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::volScalarField& Foam::calcFvcDiv::divField +( + const word& divName, + const dimensionSet& dims +) +{ + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (!mesh.foundObject<volScalarField>(divName)) + { + volScalarField* divFieldPtr + ( + new volScalarField + ( + IOobject + ( + divName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dims/dimLength, 0.0) + ) + ); + + mesh.objectRegistry::store(divFieldPtr); + } + + const volScalarField& field = mesh.lookupObject<volScalarField>(divName); + + return const_cast<volScalarField&>(field); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcFvcDiv::calcFvcDiv +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldName_("undefined-fieldName"), + resultName_("undefined-resultName") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "calcFvcDiv::calcFvcDiv" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcFvcDiv::~calcFvcDiv() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcFvcDiv::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fieldName") >> fieldName_; + dict.lookup("resultName") >> resultName_; + } +} + + +void Foam::calcFvcDiv::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcDiv::end() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcDiv::write() +{ + if (active_) + { + bool processed = false; + + calcDiv<surfaceScalarField>(fieldName_, resultName_, processed); + calcDiv<volVectorField>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcFvcDiv::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H new file mode 100644 index 0000000000000000000000000000000000000000..bbf42c6809a0d833ac23ce6af24eda81b9e32b97 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDiv.H @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::calcFvcDiv + +Group + grpFVFunctionObjects + +Description + This function object calculates the divergence of a field. The operation is + limited to surfaceScalarFields and volumeVector fields, and the output is a + volume scalar field. + +SourceFiles + calcFvcDiv.C + IOcalcFvcDiv.H + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcDiv_H +#define calcFvcDiv_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class dimensionSet; + +/*---------------------------------------------------------------------------*\ + Class calcFvcDiv Declaration +\*---------------------------------------------------------------------------*/ + +class calcFvcDiv +{ + // Private data + + //- Name of this calcFvcDiv object + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of field to process + word fieldName_; + + //- Name of result field + word resultName_; + + + // Private Member Functions + + //- Helper function to create/store/return the divergence field + volScalarField& divField + ( + const word& gradName, + const dimensionSet& dims + ); + + //- Helper function to calculate the divergence of different field types + template<class FieldType> + void calcDiv + ( + const word& fieldName, + const word& resultName, + bool& processed + ); + + //- Disallow default bitwise copy construct + calcFvcDiv(const calcFvcDiv&); + + //- Disallow default bitwise assignment + void operator=(const calcFvcDiv&); + + +public: + + //- Runtime type information + TypeName("calcFvcDiv"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + calcFvcDiv + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~calcFvcDiv(); + + + // Member Functions + + //- Return name of the set of calcFvcDiv + virtual const word& name() const + { + return name_; + } + + //- Read the calcFvcDiv data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the calcFvcDiv and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "calcFvcDivTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..32f990ec09f6f7e54596d0efe261727e66f2ca5e --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcDivFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(calcFvcDivFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + calcFvcDivFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.H b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..5cc8af7332b65cdb8fdd4b6fa2ec6c2d8d6179d1 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::calcFvcDivFunctionObject + +Description + FunctionObject wrapper around calcFvcDiv to allow it to be created + via the functions entry within controlDict. + +SourceFiles + calcFvcDivFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcDivFunctionObject_H +#define calcFvcDivFunctionObject_H + +#include "calcFvcDiv.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<calcFvcDiv> calcFvcDivFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..cfdf55f1bfbeae20c7dea2f7f420bd1b16eca475 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcDiv/calcFvcDivTemplates.C @@ -0,0 +1,65 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "fvcDiv.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class FieldType> +void Foam::calcFvcDiv::calcDiv +( + const word& fieldName, + const word& resultName, + bool& processed +) +{ + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + word divName = resultName; + if (divName == "none") + { + divName = "fvc::div(" + fieldName + ")"; + } + + if (mesh.foundObject<FieldType>(fieldName)) + { + const FieldType& vf = mesh.lookupObject<FieldType>(fieldName); + + volScalarField& field = divField(divName, vf.dimensions()); + + field = fvc::div(vf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/IOcalcFvcGrad.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/IOcalcFvcGrad.H new file mode 100644 index 0000000000000000000000000000000000000000..2e97ac645958b8bbd106f91ad3826df47e6c79b0 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/IOcalcFvcGrad.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOcalcFvcGrad + +Description + Instance of the generic IOOutputFilter for calcFvcGrad. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcalcFvcGrad_H +#define IOcalcFvcGrad_H + +#include "calcFvcGrad.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<calcFvcGrad> IOcalcFvcGrad; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C new file mode 100644 index 0000000000000000000000000000000000000000..edcddb2eaec5dbf18ab6e26ad5ed7285770bb5ec --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcGrad.H" +#include "volFields.H" +#include "dictionary.H" +#include "calcFvcGrad.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(calcFvcGrad, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcFvcGrad::calcFvcGrad +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldName_("undefined-fieldName"), + resultName_("undefined-resultName") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "calcFvcGrad::calcFvcGrad" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcFvcGrad::~calcFvcGrad() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcFvcGrad::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fieldName") >> fieldName_; + dict.lookup("resultName") >> resultName_; + } +} + + +void Foam::calcFvcGrad::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcGrad::end() +{ + // Do nothing - only valid on write +} + + +void Foam::calcFvcGrad::write() +{ + if (active_) + { + bool processed = false; + + calcGrad<scalar>(fieldName_, resultName_, processed); + calcGrad<vector>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcFvcGrad::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H new file mode 100644 index 0000000000000000000000000000000000000000..7c8b15f499210a5ff881fe13bb66d18aec3ebf10 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGrad.H @@ -0,0 +1,180 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::calcFvcGrad + +Group + grpFVFunctionObjects + +Description + This function object calculates the gradient of a field. The operation is + limited to scalar and vector volume or surface fields, and the output is a + volume vector or tensor field. + +SourceFiles + calcFvcGrad.C + IOcalcFvcGrad.H + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcGrad_H +#define calcFvcGrad_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class dimensionSet; + +/*---------------------------------------------------------------------------*\ + Class calcFvcGrad Declaration +\*---------------------------------------------------------------------------*/ + +class calcFvcGrad +{ + // Private data + + //- Name of this calcFvcGrad object + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of field to process + word fieldName_; + + //- Name of result field + word resultName_; + + + // Private Member Functions + + //- Helper function to create/store/return the gradient field + template<class Type> + GeometricField + < + typename outerProduct<vector, Type>::type, + fvPatchField, + volMesh + >& + gradField(const word& gradName, const dimensionSet& dims); + + //- Helper function to calculate the gradient of different field types + template<class Type> + void calcGrad + ( + const word& fieldName, + const word& resultName, + bool& processed + ); + + //- Disallow default bitwise copy construct + calcFvcGrad(const calcFvcGrad&); + + //- Disallow default bitwise assignment + void operator=(const calcFvcGrad&); + + +public: + + //- Runtime type information + TypeName("calcFvcGrad"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + calcFvcGrad + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~calcFvcGrad(); + + + // Member Functions + + //- Return name of the set of calcFvcGrad + virtual const word& name() const + { + return name_; + } + + //- Read the calcFvcGrad data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the calcFvcGrad and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "calcFvcGradTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..3e2d1e669858928dd84dd49e7f4e4db3c7aa4edc --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcFvcGradFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(calcFvcGradFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + calcFvcGradFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.H b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..0c3f5806976dd07ed117f016a94d6cbe70ec94b3 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::calcFvcGradFunctionObject + +Description + FunctionObject wrapper around calcFvcGrad to allow it to be created + via the functions entry within controlDict. + +SourceFiles + calcFvcGradFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef calcFvcGradFunctionObject_H +#define calcFvcGradFunctionObject_H + +#include "calcFvcGrad.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<calcFvcGrad> calcFvcGradFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..3e95bbd4245ff912279cfb4d959d522bb14cb0a4 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcFvcGrad/calcFvcGradTemplates.C @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "fvcGrad.H" + +template<class Type> +Foam::GeometricField +< + typename Foam::outerProduct<Foam::vector, Type>::type, + Foam::fvPatchField, + Foam::volMesh +>& +Foam::calcFvcGrad::gradField(const word& gradName, const dimensionSet& dims) +{ + typedef typename outerProduct<vector, Type>::type gradType; + typedef GeometricField<gradType, fvPatchField, volMesh> vfGradType; + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (!mesh.foundObject<vfGradType>(gradName)) + { + vfGradType* gradFieldPtr + ( + new vfGradType + ( + IOobject + ( + gradName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensioned<gradType> + ( + "zero", + dims/dimLength, + pTraits<gradType>::zero + ) + ) + ); + + mesh.objectRegistry::store(gradFieldPtr); + } + + const vfGradType& field = mesh.lookupObject<vfGradType>(gradName); + + return const_cast<vfGradType&>(field); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void Foam::calcFvcGrad::calcGrad +( + const word& fieldName, + const word& resultName, + bool& processed +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> vfType; + typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType; + + typedef typename outerProduct<vector, Type>::type gradType; + typedef GeometricField<gradType, fvPatchField, volMesh> vfGradType; + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + word gradName = resultName; + if (gradName == "none") + { + gradName = "fvc::grad(" + fieldName + ")"; + } + + if (mesh.foundObject<vfType>(fieldName)) + { + const vfType& vf = mesh.lookupObject<vfType>(fieldName); + + vfGradType& field = gradField<Type>(gradName, vf.dimensions()); + + field = fvc::grad(vf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } + else if (mesh.foundObject<sfType>(fieldName)) + { + const sfType& sf = mesh.lookupObject<sfType>(fieldName); + + vfGradType& field = gradField<Type>(gradName, sf.dimensions()); + + field = fvc::grad(sf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/IOcalcMag.H b/src/postProcessing/functionObjects/fvTools/calcMag/IOcalcMag.H new file mode 100644 index 0000000000000000000000000000000000000000..3f0a584d14959a980fa8ad47111b4d362d6c21b4 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/IOcalcMag.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOcalcMag + +Description + Instance of the generic IOOutputFilter for calcMag. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOcalcMag_H +#define IOcalcMag_H + +#include "calcMag.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<calcMag> IOcalcMag; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C new file mode 100644 index 0000000000000000000000000000000000000000..f997cc8b78bf75127aee01d765b6775b6d1aad7f --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.C @@ -0,0 +1,127 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcMag.H" +#include "volFields.H" +#include "dictionary.H" +#include "calcMag.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(calcMag, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::calcMag::calcMag +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + fieldName_("undefined-fieldName"), + resultName_("undefined-resultName") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "calcMag::calcMag" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::calcMag::~calcMag() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::calcMag::read(const dictionary& dict) +{ + if (active_) + { + dict.lookup("fieldName") >> fieldName_; + dict.lookup("resultName") >> resultName_; + } +} + + +void Foam::calcMag::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::calcMag::end() +{ + // Do nothing - only valid on write +} + + +void Foam::calcMag::write() +{ + if (active_) + { + bool processed = false; + + calc<scalar>(fieldName_, resultName_, processed); + calc<vector>(fieldName_, resultName_, processed); + calc<sphericalTensor>(fieldName_, resultName_, processed); + calc<symmTensor>(fieldName_, resultName_, processed); + calc<tensor>(fieldName_, resultName_, processed); + + if (!processed) + { + WarningIn("void Foam::calcMag::write()") + << "Unprocessed field " << fieldName_ << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H new file mode 100644 index 0000000000000000000000000000000000000000..96fe433d1e599108221032e3f43aca6e3b60e1be --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMag.H @@ -0,0 +1,174 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::calcMag + +Group + grpFVFunctionObjects + +Description + This function object calculates the magnitude of a field. The operation + can be applied to any volume or surface fieldsm and the output is a + volume or surface scalar field. + +SourceFiles + calcMag.C + IOcalcMag.H + +\*---------------------------------------------------------------------------*/ + +#ifndef calcMag_H +#define calcMag_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "pointFieldFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class mapPolyMesh; +class dimensionSet; + +/*---------------------------------------------------------------------------*\ + Class calcMag Declaration +\*---------------------------------------------------------------------------*/ + +class calcMag +{ + // Private data + + //- Name of this calcMag object + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of field to process + word fieldName_; + + //- Name of result field + word resultName_; + + + // Private Member Functions + + //- Helper function to create/store/return the mag field + template<class FieldType> + FieldType& magField(const word& magName, const dimensionSet& dims); + + //- Helper function to calculate the magnitude of different field types + template<class Type> + void calc + ( + const word& fieldName, + const word& resultName, + bool& processed + ); + + //- Disallow default bitwise copy construct + calcMag(const calcMag&); + + //- Disallow default bitwise assignment + void operator=(const calcMag&); + + +public: + + //- Runtime type information + TypeName("calcMag"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + calcMag + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~calcMag(); + + + // Member Functions + + //- Return name of the set of calcMag + virtual const word& name() const + { + return name_; + } + + //- Read the calcMag data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the calcMag and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "calcMagTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..61aded1e61fbe58fc97e1149b750c1066f629afa --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "calcMagFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(calcMagFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + calcMagFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.H b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..ea143666e13716be46d6aa79ad5812a940d52f3f --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::calcMagFunctionObject + +Description + FunctionObject wrapper around calcMag to allow it to be created + via the functions entry within controlDict. + +SourceFiles + calcMagFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef calcMagFunctionObject_H +#define calcMagFunctionObject_H + +#include "calcMag.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<calcMag> calcMagFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..4435b64f1bec51001bc109e69384b1e6b2083363 --- /dev/null +++ b/src/postProcessing/functionObjects/fvTools/calcMag/calcMagTemplates.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "Time.H" +#include "volFields.H" +#include "surfaceFields.H" + +template<class FieldType> +FieldType& Foam::calcMag::magField +( + const word& magName, + const dimensionSet& dims +) +{ + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (!mesh.foundObject<FieldType>(magName)) + { + FieldType* magFieldPtr + ( + new FieldType + ( + IOobject + ( + magName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dims, 0.0) + ) + ); + + mesh.objectRegistry::store(magFieldPtr); + } + + const FieldType& f = mesh.lookupObject<FieldType>(magName); + + return const_cast<FieldType&>(f); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void Foam::calcMag::calc +( + const word& fieldName, + const word& resultName, + bool& processed +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> vfType; + typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType; + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + word magName = resultName; + if (magName == "none") + { + magName = "mag(" + fieldName + ")"; + } + + if (mesh.foundObject<vfType>(fieldName)) + { + const vfType& vf = mesh.lookupObject<vfType>(fieldName); + + volScalarField& field = + magField<volScalarField>(magName, vf.dimensions()); + + field = mag(vf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } + else if (mesh.foundObject<sfType>(fieldName)) + { + const sfType& sf = mesh.lookupObject<sfType>(fieldName); + + surfaceScalarField& field = + magField<surfaceScalarField>(magName, sf.dimensions()); + + field = mag(sf); + + Info<< type() << " output:" << nl + << " writing " << field.name() << " field" << nl << endl; + + field.write(); + + processed = true; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/jobControl/Make/options b/src/postProcessing/functionObjects/jobControl/Make/options index 5166bcc9e32f547f48a5f87c9c60d7210409967f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/postProcessing/functionObjects/jobControl/Make/options +++ b/src/postProcessing/functionObjects/jobControl/Make/options @@ -1,9 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling diff --git a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C index 7d4d9aa52adc805689d6721fba855b58fb58485a..41b8f697c1681fe775ec65158e4df4d19bde537b 100644 --- a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.C +++ b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.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 @@ -32,7 +32,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::abortCalculation, 0); +namespace Foam +{ +defineTypeNameAndDebug(abortCalculation, 0); +} // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.H b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.H index 42da71f90c4e66f642939ebfa4c42124e3b2a25f..4040709fdb32b5b5edb6dffcef62299098e986e0 100644 --- a/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.H +++ b/src/postProcessing/functionObjects/jobControl/abortCalculation/abortCalculation.H @@ -45,7 +45,6 @@ SourceFiles #ifndef abortCalculation_H #define abortCalculation_H -#include "pointFieldFwd.H" #include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,6 +55,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -154,7 +154,7 @@ public: {} //- Update for changes of mesh - does nothing - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/systemCall/Make/options b/src/postProcessing/functionObjects/systemCall/Make/options index 5166bcc9e32f547f48a5f87c9c60d7210409967f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/postProcessing/functionObjects/systemCall/Make/options +++ b/src/postProcessing/functionObjects/systemCall/Make/options @@ -1,9 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling diff --git a/src/postProcessing/functionObjects/systemCall/systemCall.C b/src/postProcessing/functionObjects/systemCall/systemCall.C index 299c792aabc29a50c1aefd922c8594e4c0fad5a1..00cb7b850cf86db88fdf5171701b13e93f64a5fb 100644 --- a/src/postProcessing/functionObjects/systemCall/systemCall.C +++ b/src/postProcessing/functionObjects/systemCall/systemCall.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::systemCall, 0); +namespace Foam +{ +defineTypeNameAndDebug(systemCall, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/systemCall/systemCall.H b/src/postProcessing/functionObjects/systemCall/systemCall.H index ad82219bcee9d32befa95e65edd1a94b3e48359a..5de53fa26cf392a62531925eefbf37e73bf72b20 100644 --- a/src/postProcessing/functionObjects/systemCall/systemCall.H +++ b/src/postProcessing/functionObjects/systemCall/systemCall.H @@ -88,7 +88,6 @@ SourceFiles #define systemCall_H #include "stringList.H" -#include "pointFieldFwd.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -98,6 +97,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -180,7 +180,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C index 538fb1040d32a312c417857c3d86db668faac372..e72e69333892280731bd1a84cbff7325e8a9deab 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.C @@ -32,7 +32,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::CourantNo, 0); +namespace Foam +{ +defineTypeNameAndDebug(CourantNo, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -58,7 +61,9 @@ Foam::tmp<Foam::volScalarField> Foam::CourantNo::rho ( "rho", mesh.time().timeName(), - mesh + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE ), mesh, dimensionedScalar("rho", dimless, 1.0) @@ -116,7 +121,8 @@ Foam::CourantNo::CourantNo type(), mesh.time().timeName(), mesh, - IOobject::NO_READ + IOobject::NO_READ, + IOobject::NO_WRITE ), mesh, dimensionedScalar("0", dimless, 0.0), @@ -189,7 +195,7 @@ void Foam::CourantNo::write() CourantNo.write(); Info<< type() << " output:" << nl - << " writing " << CourantNo.name() << "field" << nl << endl; + << " writing " << CourantNo.name() << " field" << nl << endl; } } diff --git a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H index d1235f446f91465436cbd8920f965f126f40aab4..e74d6c9e2cc8a8c492aa35c3afc658fb86c2f980 100644 --- a/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H +++ b/src/postProcessing/functionObjects/utilities/CourantNo/CourantNo.H @@ -24,6 +24,9 @@ License Class Foam::CourantNo +Group + grpUtilitiesFunctionObjects + Description This function object calculates and outputs the Courant number as a volScalarField. The field is stored on the mesh database so that it can @@ -40,7 +43,6 @@ SourceFiles #include "volFieldsFwd.H" #include "surfaceFieldsFwd.H" -#include "pointFieldFwd.H" #include "OFstream.H" #include "Switch.H" @@ -52,6 +54,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -139,7 +142,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C index 94e375304aa0c3b05c760f2e1b180332361302e0..b9a48436007c6d64fec0eda84f8a5c71d2d32816 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C @@ -32,7 +32,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::DESModelRegions, 0); +namespace Foam +{ +defineTypeNameAndDebug(DESModelRegions, 0); +} // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -130,7 +133,7 @@ void Foam::DESModelRegions::write() Info<< type() << " output:" << nl; } - tmp<volScalarField> result; + tmp<volScalarField> tresult; label DESpresent = false; if (mesh.foundObject<icoModel>("turbulenceModel")) @@ -142,7 +145,7 @@ void Foam::DESModelRegions::write() { const icoDESModel& des = dynamic_cast<const icoDESModel&>(model); - result = des.LESRegion(); + tresult = des.LESRegion(); DESpresent = true; } } @@ -155,15 +158,17 @@ void Foam::DESModelRegions::write() { const cmpDESModel& des = dynamic_cast<const cmpDESModel&>(model); - result = des.LESRegion(); + tresult = des.LESRegion(); DESpresent = true; } } if (DESpresent) { + const volScalarField& result = tresult(); + scalar prc = - gSum(result().internalField()*mesh.V())/gSum(mesh.V())*100.0; + gSum(result.internalField()*mesh.V())/gSum(mesh.V())*100.0; if (Pstream::master()) { @@ -174,9 +179,11 @@ void Foam::DESModelRegions::write() if (log_) { Info<< " LES = " << prc << " % (volume)" << nl - << " RES = " << 100.0 - prc << " % (volume)" << nl + << " RAS = " << 100.0 - prc << " % (volume)" << nl << endl; } + + result.write(); } else { diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H index fe36b462de7efd3f92bb262c9da55e9173f75329..858fab4e05258e2ebe47a981ea08b1e501f808fe 100644 --- a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H @@ -45,7 +45,6 @@ SourceFiles #include "functionObjectFile.H" #include "volFieldsFwd.H" -#include "pointFieldFwd.H" #include "Switch.H" #include "OFstream.H" @@ -57,6 +56,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; class fvMesh; @@ -144,7 +144,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/IOLambda2.H b/src/postProcessing/functionObjects/utilities/Lambda2/IOLambda2.H new file mode 100644 index 0000000000000000000000000000000000000000..0aacf47e94ca018fc96f4895622e9b14b5890985 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/IOLambda2.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOLambda2 + +Description + Instance of the generic IOOutputFilter for Lambda2. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOLambda2_H +#define IOLambda2_H + +#include "Lambda2.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<Lambda2> IOLambda2; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C new file mode 100644 index 0000000000000000000000000000000000000000..5b1b3f0cf934123cfe266229edf0a4b02dd87286 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.C @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Lambda2.H" +#include "volFields.H" +#include "dictionary.H" +#include "zeroGradientFvPatchFields.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(Lambda2, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Lambda2::Lambda2 +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + UName_("U") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "Lambda2::Lambda2" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField* Lambda2Ptr + ( + new volScalarField + ( + IOobject + ( + type(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless/sqr(dimTime), 0.0) + ) + ); + + mesh.objectRegistry::store(Lambda2Ptr); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Lambda2::~Lambda2() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::Lambda2::read(const dictionary& dict) +{ + if (active_) + { + UName_ = dict.lookupOrDefault<word>("UName", "U"); + } +} + + +void Foam::Lambda2::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::Lambda2::end() +{ + // Do nothing - only valid on write +} + + +void Foam::Lambda2::write() +{ + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + const volVectorField& U = + mesh.lookupObject<volVectorField>(UName_); + + const volTensorField gradU(fvc::grad(U)); + + const volTensorField SSplusWW + ( + (symm(gradU) & symm(gradU)) + + (skew(gradU) & skew(gradU)) + ); + + volScalarField& Lambda2 = + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(type()) + ); + + Lambda2 = -eigenValues(SSplusWW)().component(vector::Y); + + Lambda2.write(); + + Info<< type() << " output:" << nl + << " writing " << Lambda2.name() << " field" << nl << endl; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.H b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.H new file mode 100644 index 0000000000000000000000000000000000000000..77659532e26f2788ffe61e4b3a2d6dcfa25e44b5 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::Lambda2 + +Group + grpUtilitiesFunctionObjects + +Description + This function object calculates and outputs the second largest eigenvalue + of the sum of the square of the symmetrical and anti-symmetrical parts of + the velocity gradient tensor. + +SourceFiles + Lambda2.C + IOLambda2.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Lambda2_H +#define Lambda2_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class polyMesh; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class Lambda2 Declaration +\*---------------------------------------------------------------------------*/ + +class Lambda2 +{ + // Private data + + //- Name of this set of Lambda2 objects + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of velocity field, default is "U" + word UName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Lambda2(const Lambda2&); + + //- Disallow default bitwise assignment + void operator=(const Lambda2&); + + +public: + + //- Runtime type information + TypeName("Lambda2"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + Lambda2 + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~Lambda2(); + + + // Member Functions + + //- Return name of the set of Lambda2 + virtual const word& name() const + { + return name_; + } + + //- Read the Lambda2 data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the Lambda2 and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.C b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..ced087ce9bb9684d9333733f8d95eb72ac6ac9d5 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Lambda2FunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(Lambda2FunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + Lambda2FunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.H b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..e63d04a721dc2992e270aa4bf5d9d17d708495a4 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Lambda2/Lambda2FunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::Lambda2FunctionObject + +Description + FunctionObject wrapper around Lambda2 to allow it to be created + via the functions entry within controlDict. + +SourceFiles + Lambda2FunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef Lambda2FunctionObject_H +#define Lambda2FunctionObject_H + +#include "Lambda2.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<Lambda2> Lambda2FunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index 362f24a0e7e7ef93aa9bb2ef264c2b710d0c045b..01b4d0c4c9172f4d985513ac234c6dc7fbef16db 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -3,6 +3,15 @@ codedFunctionObject/codedFunctionObject.C CourantNo/CourantNo.C CourantNo/CourantNoFunctionObject.C +Lambda2/Lambda2.C +Lambda2/Lambda2FunctionObject.C + +Peclet/Peclet.C +Peclet/PecletFunctionObject.C + +Q/Q.C +Q/QFunctionObject.C + DESModelRegions/DESModelRegions.C DESModelRegions/DESModelRegionsFunctionObject.C diff --git a/src/postProcessing/functionObjects/utilities/Peclet/IOPeclet.H b/src/postProcessing/functionObjects/utilities/Peclet/IOPeclet.H new file mode 100644 index 0000000000000000000000000000000000000000..ea49009d559ed41bcc7902208851ef0b1e1b345f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/IOPeclet.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOPeclet + +Description + Instance of the generic IOOutputFilter for Peclet. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOPeclet_H +#define IOPeclet_H + +#include "Peclet.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<Peclet> IOPeclet; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C new file mode 100644 index 0000000000000000000000000000000000000000..874977faed9ad9ba3600fbcde9a5a55f33f36ae1 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.C @@ -0,0 +1,199 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Peclet.H" +#include "volFields.H" +#include "dictionary.H" +#include "surfaceFields.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" +#include "surfaceInterpolate.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(Peclet, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Peclet::Peclet +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + phiName_("phi"), + rhoName_("rho") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "Peclet::Peclet" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + surfaceScalarField* PecletPtr + ( + new surfaceScalarField + ( + IOobject + ( + type(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ) + ); + + mesh.objectRegistry::store(PecletPtr); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Peclet::~Peclet() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::Peclet::read(const dictionary& dict) +{ + if (active_) + { + phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); + rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho"); + } +} + + +void Foam::Peclet::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::Peclet::end() +{ + // Do nothing - only valid on write +} + + +void Foam::Peclet::write() +{ + typedef compressible::turbulenceModel cmpTurbModel; + typedef incompressible::turbulenceModel icoTurbModel; + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + tmp<volScalarField> nuEff; + if (mesh.foundObject<cmpTurbModel>("turbulenceModel")) + { + const cmpTurbModel& model = + mesh.lookupObject<cmpTurbModel>("turbulenceModel"); + + const volScalarField& rho = + mesh.lookupObject<volScalarField>(rhoName_); + + nuEff = model.muEff()/rho; + } + else if (mesh.foundObject<icoTurbModel>("turbulenceModel")) + { + const icoTurbModel& model = + mesh.lookupObject<icoTurbModel>("turbulenceModel"); + + nuEff = model.nuEff(); + } + else if (mesh.foundObject<transportModel>("transportProperties")) + { + const transportModel& model = + mesh.lookupObject<transportModel>("transportProperties"); + + nuEff = model.nu(); + } + else + { + FatalErrorIn("void Foam::wallShearStress::write()") + << "Unable to determine the viscosity" + << exit(FatalError); + } + + const surfaceScalarField& phi = + mesh.lookupObject<surfaceScalarField>(phiName_); + + surfaceScalarField& Peclet = + const_cast<surfaceScalarField&> + ( + mesh.lookupObject<surfaceScalarField>(type()) + ); + + Peclet = + mag(phi) + /( + mesh.magSf() + *mesh.surfaceInterpolation::deltaCoeffs() + *fvc::interpolate(nuEff) + ); + + Peclet.write(); + + Info<< type() << " output:" << nl + << " writing " << Peclet.name() << " field" << nl << endl; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/Peclet.H b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.H new file mode 100644 index 0000000000000000000000000000000000000000..4c4ec390b7b7f4a14a43c5c9541cb420b9f7f82d --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/Peclet.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::Peclet + +Group + grpUtilitiesFunctionObjects + +Description + This function object calculates and outputs the Peclet number as a + surfaceScalarField. + +SourceFiles + Peclet.C + IOPeclet.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Peclet_H +#define Peclet_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class polyMesh; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class Peclet Declaration +\*---------------------------------------------------------------------------*/ + +class Peclet +{ + // Private data + + //- Name of this set of Peclet objects + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of flux field, default is "phi" + word phiName_; + + //- Name of density field (compressible cases only), default is "rho" + word rhoName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Peclet(const Peclet&); + + //- Disallow default bitwise assignment + void operator=(const Peclet&); + + +public: + + //- Runtime type information + TypeName("Peclet"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + Peclet + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~Peclet(); + + + // Member Functions + + //- Return name of the set of Peclet + virtual const word& name() const + { + return name_; + } + + //- Read the Peclet data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the Peclet and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.C b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..fdb247703cf93447ef7443649c06aa92626b5c8f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "PecletFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(PecletFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + PecletFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.H b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..fdeca7e571739bc36c4e34751a3452add4bb186b --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Peclet/PecletFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::PecletFunctionObject + +Description + FunctionObject wrapper around Peclet to allow it to be created + via the functions entry within controlDict. + +SourceFiles + PecletFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef PecletFunctionObject_H +#define PecletFunctionObject_H + +#include "Peclet.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<Peclet> PecletFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/IOQ.H b/src/postProcessing/functionObjects/utilities/Q/IOQ.H new file mode 100644 index 0000000000000000000000000000000000000000..f4739a087695d6d2c70731d449315f420c3ba77f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/IOQ.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::IOQ + +Description + Instance of the generic IOOutputFilter for Q. + +\*---------------------------------------------------------------------------*/ + +#ifndef IOQ_H +#define IOQ_H + +#include "Q.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<Q> IOQ; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/Q.C b/src/postProcessing/functionObjects/utilities/Q/Q.C new file mode 100644 index 0000000000000000000000000000000000000000..5dec2d3aa7ec5ee64cbee0d75257a991e31a59e0 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/Q.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "Q.H" +#include "volFields.H" +#include "dictionary.H" +#include "fvcGrad.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(Q, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::Q::Q +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + name_(name), + obr_(obr), + active_(true), + UName_("U") +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "Q::Q" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating." << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField* QPtr + ( + new volScalarField + ( + IOobject + ( + type(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless/sqr(dimTime), 0.0) + ) + ); + + mesh.objectRegistry::store(QPtr); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::Q::~Q() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::Q::read(const dictionary& dict) +{ + if (active_) + { + UName_ = dict.lookupOrDefault<word>("UName", "U"); + } +} + + +void Foam::Q::execute() +{ + // Do nothing - only valid on write +} + + +void Foam::Q::end() +{ + // Do nothing - only valid on write +} + + +void Foam::Q::write() +{ + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + const volVectorField& U = + mesh.lookupObject<volVectorField>(UName_); + + const volTensorField gradU(fvc::grad(U)); + + volScalarField& Q = + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(type()) + ); + + Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU)))); + + Q.write(); + + Info<< type() << " output:" << nl + << " writing " << Q.name() << " field" << nl << endl; + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/Q.H b/src/postProcessing/functionObjects/utilities/Q/Q.H new file mode 100644 index 0000000000000000000000000000000000000000..892808ef95d385d113e4b831548d7cb75efa24fa --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/Q.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::Q + +Group + grpUtilitiesFunctionObjects + +Description + This function object calculates and outputs the second invariant of the + velocity gradient tensor [1/s^2]. + + \f[ + Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U)))) + \f] + +SourceFiles + Q.C + IOQ.H + +\*---------------------------------------------------------------------------*/ + +#ifndef Q_H +#define Q_H + +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" +#include "OFstream.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class polyMesh; +class mapPolyMesh; + +/*---------------------------------------------------------------------------*\ + Class Q Declaration +\*---------------------------------------------------------------------------*/ + +class Q +{ + // Private data + + //- Name of this set of Q objects + word name_; + + //- Reference to the database + const objectRegistry& obr_; + + //- On/off switch + bool active_; + + //- Name of velocity field, default is "U" + word UName_; + + + // Private Member Functions + + //- Disallow default bitwise copy construct + Q(const Q&); + + //- Disallow default bitwise assignment + void operator=(const Q&); + + +public: + + //- Runtime type information + TypeName("Q"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + Q + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~Q(); + + + // Member Functions + + //- Return name of the set of Q + virtual const word& name() const + { + return name_; + } + + //- Read the Q data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Calculate the Q and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.C b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..0fa525f0b6020edc244e981eadfbbfbf85f238a3 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "QFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(QFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + QFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.H b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..4c96aac505475107ae423e482e2ebcadcd300dd6 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/Q/QFunctionObject.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Typedef + Foam::QFunctionObject + +Description + FunctionObject wrapper around Q to allow it to be created + via the functions entry within controlDict. + +SourceFiles + QFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef QFunctionObject_H +#define QFunctionObject_H + +#include "Q.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<Q> QFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C index 0248190cde571ab78111670f6047a3eefcfb6bc3..98b57ec4873389125d922db3e5676736b28eb959 100644 --- a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C +++ b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C @@ -266,4 +266,12 @@ bool Foam::codedFunctionObject::read(const dictionary& dict) } +void Foam::codedFunctionObject::updateMesh(const mapPolyMesh&) +{} + + +void Foam::codedFunctionObject::movePoints(const polyMesh&) +{} + + // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H index a9c6818f7765f64132722d73cb03968e0c4fada2..84b48a91e6a59d60ed366279a299f8ec800e4bea 100644 --- a/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H +++ b/src/postProcessing/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H @@ -150,6 +150,12 @@ public: //- Read and set the function object if its data have changed virtual bool read(const dictionary&); + + //- Update mesh + virtual void updateMesh(const mapPolyMesh&); + + //- Move points + virtual void movePoints(const polyMesh&); }; diff --git a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C index ac8b9cca10ec129323237aa279ec3e575ddc2c5f..fb60ce2527a9fce7e6ca6a5ca49b21b42fb698a4 100644 --- a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C +++ b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.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 @@ -34,7 +34,10 @@ using namespace Foam::constant; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::dsmcFields, 0); +namespace Foam +{ +defineTypeNameAndDebug(dsmcFields, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.H b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.H index 512ac251c6aa46200974a985f502f8c1b9e37aa8..a88d3c207044f7861e617af135fd3bd9e72ceafa 100644 --- a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.H +++ b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.H @@ -44,7 +44,7 @@ SourceFiles #ifndef dsmcFields_H #define dsmcFields_H -#include "pointFieldFwd.H" +#include "typeInfo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,10 +54,11 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ - Class dsmcFields Declaration + Class dsmcFields Declaration \*---------------------------------------------------------------------------*/ class dsmcFields @@ -130,7 +131,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C index 6d70be969a2fe6caad71d16a572890783a28a747..7fc298e74d8565c5b32ba38e131e05aa3b52a9a7 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::pressureTools, 0); +namespace Foam +{ +defineTypeNameAndDebug(pressureTools, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -56,7 +59,7 @@ Foam::word Foam::pressureTools::pName() const } -Foam::dimensionedScalar Foam::pressureTools::rho +Foam::dimensionedScalar Foam::pressureTools::rhoScale ( const volScalarField& p ) const @@ -72,6 +75,38 @@ Foam::dimensionedScalar Foam::pressureTools::rho } +Foam::tmp<Foam::volScalarField> Foam::pressureTools::rho +( + const volScalarField& p +) const +{ + if (p.dimensions() == dimPressure) + { + return p.mesh().lookupObject<volScalarField>(rhoName_); + } + else + { + return + tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "rho", + p.mesh().time().timeName(), + p.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + p.mesh(), + dimensionedScalar("zero", dimDensity, rhoRef_) + ) + ); + } +} + + Foam::dimensionedScalar Foam::pressureTools::pRef() const { dimensionedScalar value("pRef", dimPressure, 0.0); @@ -81,11 +116,14 @@ Foam::dimensionedScalar Foam::pressureTools::pRef() const value.value() += pRef_; } - return pRef(); + return value; } -Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn() const +Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn +( + const volScalarField& p +) const { const fvMesh& mesh = refCast<const fvMesh>(obr_); @@ -110,7 +148,7 @@ Foam::tmp<Foam::volScalarField> Foam::pressureTools::pDyn() const { const volVectorField& U = obr_.lookupObject<volVectorField>(UName_); - tpDyn() == 0.5*magSqr(U); + tpDyn() == rho(p)*0.5*magSqr(U); } return tpDyn; @@ -126,7 +164,13 @@ Foam::tmp<Foam::volScalarField> Foam::pressureTools::convertToCoeff if (calcCoeff_) { - tCoeff() /= pDyn(); + tCoeff() -= dimensionedScalar("pInf", dimPressure, pInf_); + + const dimensionedScalar p0("p0", dimPressure, SMALL); + const dimensionedVector U("U", dimVelocity, UInf_); + const dimensionedScalar rho("rho", dimDensity, rhoInf_); + + tCoeff() /= 0.5*rho*magSqr(U) + p0; } return tCoeff; @@ -146,12 +190,16 @@ Foam::pressureTools::pressureTools name_(name), obr_(obr), active_(true), - calcTotal_(false), - calcCoeff_(false), pName_("p"), UName_("U"), + rhoName_("rho"), + rhoRef_(1.0), + calcTotal_(false), pRef_(0.0), - rhoRef_(1.0) + calcCoeff_(false), + pInf_(0.0), + UInf_(vector::zero), + rhoInf_(0.0) { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA<fvMesh>(obr_)) @@ -188,10 +236,11 @@ void Foam::pressureTools::read(const dictionary& dict) { dict.readIfPresent("pName", pName_); dict.readIfPresent("UName", UName_); + dict.readIfPresent("rhoName", rhoName_); const volScalarField& p = obr_.lookupObject<volScalarField>(pName_); - if (p.dimensions() != p.dimensions()) + if (p.dimensions() != dimPressure) { dict.lookup("rhoRef") >> rhoRef_; } @@ -203,6 +252,12 @@ void Foam::pressureTools::read(const dictionary& dict) } dict.lookup("calcCoeff") >> calcCoeff_; + if (calcCoeff_) + { + dict.lookup("pInf") >> pInf_; + dict.lookup("UInf") >> UInf_; + dict.lookup("rhoInf") >> rhoInf_; + } } } @@ -234,7 +289,7 @@ void Foam::pressureTools::write() obr_, IOobject::NO_READ ), - convertToCoeff(rho(p)*(p + pDyn()) + pRef()) + convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef()) ); pResult.write(); diff --git a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H index 702d4961995f24d7856c619b7804304bc18cfd6e..11f490429d25f11630a0aaf1ce387886c26df1ce 100644 --- a/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H +++ b/src/postProcessing/functionObjects/utilities/pressureTools/pressureTools.H @@ -24,28 +24,82 @@ License Class Foam::pressureTools +Group + grpUtilitiesFunctionObjects + Description This function object includes tools to manipulate the pressure into different forms. These currently include: - static pressure - - p_s = rho*p_k - + \f[ + p_s = \rho p_k + \f] - total pressure - - p_T = pRef + p_s + 0.5 rho |U|^2 - + \f[ + p_T = p_{ref} + p_s + 0.5 \rho |U|^2 + \f] - static pressure coefficient - - Cp_s = p_s / (0.5 rho |U|^2) - + \f[ + Cp_s = \frac{p_s - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2} + \f] - total pressure coefficient - - Cp_T = p_T / (0.5 rho |U|^2) - - The function object will operate on both kinematic (p_k) and static - pressure (p_s) fields, and the result is written as a volScalarField. + \f[ + Cp_T = \frac{p_T - p_{\inf}}{0.5 \rho_{\inf} |U_{\inf}|^2} + \f] + + where + \vartable + \rho | density [kg/m3] + U | velocity [m/s] + \rho_{\inf} | freestream density [kg/m3] + p_{\inf} | freestream pressure [Pa] + U_{\inf} | freestream velocity [m/s] + p_k | kinematic pressure (p/rho)[m2/s2] + p_s | pressure [Pa] + p_T | total pressure [Pa] + p_{ref} | reference pressure level [Pa] + Cp_{s} | pressure coefficient + Cp_{T} | total pressure coefficient + \endvartable + + The function object will operate on both kinematic (\f$ p_k \f$) and static + pressure (\f$ p_s \f$) fields, and the result is written as a + volScalarField. + + The modes of operation are: + \table + Mode | calcTotal | calcCoeff + static pressure | no | no + total pressure | yes | no + pressure coefficient | no | yes + total pressure coefficient | yes | yes + \endtable + + Example of function object specification to calculate pressure coefficient: + \verbatim + pressureTools1 + { + type pressureTools; + functionObjectLibs ("libutilityFunctionObjects.so"); + ... + calcTotal no; + calcCoeff yes; + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: pressureTools| yes | + rhoRef | Reference density for incompressible cases | no | 1 + calcTotal | Calculate total coefficient | yes | + pRef | Reference pressure for total pressure | no | 0.0 + calcCoeff | Calculate pressure coefficient | yes | + pInf | Freestream pressure for coefficient calculation | no | + UInf | Freestream velocity for coefficient calculation | no | + rhoInf | Freestream density for coefficient calculation | no | + \endtable SourceFiles pressureTools.C @@ -57,7 +111,6 @@ SourceFiles #define pressureTools_H #include "volFieldsFwd.H" -#include "pointFieldFwd.H" #include "dimensionedScalar.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -68,6 +121,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -87,40 +141,61 @@ class pressureTools //- On/off switch bool active_; - //- Flag to calculate total pressure - bool calcTotal_; - - //- Flag to calculate pressure coefficient - bool calcCoeff_; - //- Name of pressure field, default is "p" word pName_; //- Name of velocity field, default is "U" word UName_; - //- Reference pressure level (used for total pressure) - scalar pRef_; + //- Name of density field, default is "rho" + word rhoName_; - //- Reference density value + //- Reference density employed for incompressible cases scalar rhoRef_; + // Total pressure calculation + + //- Flag to calculate total pressure + bool calcTotal_; + + //- Reference pressure level + scalar pRef_; + + + // Pressure coefficient calculation + + //- Flag to calculate pressure coefficient + bool calcCoeff_; + + //- Freestream pressure + scalar pInf_; + + //- Freestream velocity + vector UInf_; + + //- Freestream density + scalar rhoInf_; + + // Private Member Functions //- Return the name of the derived pressure field word pName() const; //- Return the density scaling if supplied with kinematic pressure - dimensionedScalar rho(const volScalarField& p) const; + dimensionedScalar rhoScale(const volScalarField& p) const; + + //- Return the density field + tmp<volScalarField> rho(const volScalarField& p) const; //- Return the reference pressure dimensionedScalar pRef() const; - //- Calculate and return the (kinematic) dynamic pressure - tmp<volScalarField> pDyn() const; + //- Calculate and return the dynamic pressure + tmp<volScalarField> pDyn(const volScalarField& p) const; - //- Convert to coeff data by applying the pDyn scaling + //- Convert to coeff by applying the freestream dynamic pressure scaling tmp<volScalarField> convertToCoeff(const volScalarField& p) const; //- Disallow default bitwise copy construct @@ -178,7 +253,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C index 00518f6bdc033c86fa9137a7fb87288d6ab506da..69e7f1c554876bc29e6025c62d4b5470328325e7 100644 --- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C +++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.C @@ -39,7 +39,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::scalarTransport, 0); +namespace Foam +{ +defineTypeNameAndDebug(scalarTransport, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H index e08e40943a6de36f5a1686e87c1905020965267f..c948d9d6d2fc9f6c2968ae017512a36a6e9eb580 100644 --- a/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H +++ b/src/postProcessing/functionObjects/utilities/scalarTransport/scalarTransport.H @@ -24,6 +24,9 @@ License Class Foam::scalarTransport +Group + grpUtilitiesFunctionObjects + Description This function object evolves a passive scalar transport equation. The field in ininitially zero, to which sources are added. The field name @@ -172,7 +175,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C b/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C index 31a583624fac1a46e03b84bebde7726018a9db2a..aa88880eee39e68b8a180b923196fb464b0841c7 100644 --- a/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.C +++ b/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.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 @@ -30,7 +30,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::timeActivatedFileUpdate, 0); +namespace Foam +{ +defineTypeNameAndDebug(timeActivatedFileUpdate, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.H b/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.H index 786e0f21fa70b958d3fa35e295c6703949604a83..dc43ee39a322e5fa05ac29570cd14004a7672d78 100644 --- a/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.H +++ b/src/postProcessing/functionObjects/utilities/timeActivatedFileUpdate/timeActivatedFileUpdate.H @@ -60,7 +60,6 @@ SourceFiles #ifndef timeActivatedFileUpdate_H #define timeActivatedFileUpdate_H -#include "pointFieldFwd.H" #include "Tuple2.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -71,6 +70,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; /*---------------------------------------------------------------------------*\ @@ -160,7 +160,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C index a7e5e1ee094e361fff15ffe7c9f921a577e080b2..55a4011d6ae6d2115dc77063bbe9ba8e28c66445 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.C @@ -32,7 +32,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::wallShearStress, 0); +namespace Foam +{ +defineTypeNameAndDebug(wallShearStress, 0); +} // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -53,34 +56,32 @@ void Foam::wallShearStress::calcShearStress volVectorField& shearStress ) { - forAll(shearStress.boundaryField(), patchI) + forAllConstIter(labelHashSet, patchSet_, iter) { + label patchI = iter.key(); const polyPatch& pp = mesh.boundaryMesh()[patchI]; - if (isA<wallPolyPatch>(pp)) - { - vectorField& ssp = shearStress.boundaryField()[patchI]; - const vectorField& Sfp = mesh.Sf().boundaryField()[patchI]; - const scalarField& magSfp = mesh.magSf().boundaryField()[patchI]; - const symmTensorField& Reffp = Reff.boundaryField()[patchI]; + vectorField& ssp = shearStress.boundaryField()[patchI]; + const vectorField& Sfp = mesh.Sf().boundaryField()[patchI]; + const scalarField& magSfp = mesh.magSf().boundaryField()[patchI]; + const symmTensorField& Reffp = Reff.boundaryField()[patchI]; - ssp = (-Sfp/magSfp) & Reffp; + ssp = (-Sfp/magSfp) & Reffp; - vector minSsp = gMin(ssp); - vector maxSsp = gMax(ssp); + vector minSsp = gMin(ssp); + vector maxSsp = gMax(ssp); - if (Pstream::master()) - { - file() << mesh.time().timeName() << token::TAB - << pp.name() << token::TAB << minSsp - << token::TAB << maxSsp << endl; - } + if (Pstream::master()) + { + file() << mesh.time().timeName() << token::TAB + << pp.name() << token::TAB << minSsp + << token::TAB << maxSsp << endl; + } - if (log_) - { - Info<< " min/max(" << pp.name() << ") = " - << minSsp << ", " << maxSsp << endl; - } + if (log_) + { + Info<< " min/max(" << pp.name() << ") = " + << minSsp << ", " << maxSsp << endl; } } } @@ -101,7 +102,7 @@ Foam::wallShearStress::wallShearStress obr_(obr), active_(true), log_(false), - phiName_("phi") + patchSet_() { // Check if the available mesh is an fvMesh, otherwise deactivate if (!isA<fvMesh>(obr_)) @@ -137,7 +138,54 @@ void Foam::wallShearStress::read(const dictionary& dict) if (active_) { log_ = dict.lookupOrDefault<Switch>("log", false); - phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); + + const fvMesh& mesh = refCast<const fvMesh>(obr_); + const polyBoundaryMesh& pbm = mesh.boundaryMesh(); + + patchSet_ = + mesh.boundaryMesh().patchSet + ( + wordReList(dict.lookupOrDefault("patches", wordReList())) + ); + + Info<< type() << " output:" << nl; + + if (patchSet_.empty()) + { + forAll(pbm, patchI) + { + if (isA<wallPolyPatch>(pbm[patchI])) + { + patchSet_.insert(patchI); + } + } + + Info<< " processing all wall patches" << nl << endl; + } + else + { + Info<< " processing wall patches: " << nl; + labelHashSet filteredPatchSet; + forAllConstIter(labelHashSet, patchSet_, iter) + { + label patchI = iter.key(); + if (isA<wallPolyPatch>(pbm[patchI])) + { + filteredPatchSet.insert(patchI); + Info<< " " << pbm[patchI].name() << endl; + } + else + { + WarningIn("void wallShearStress::read(const dictionary&)") + << "Requested wall shear stress on non-wall boundary " + << "type patch: " << pbm[patchI].name() << endl; + } + } + + Info<< endl; + + patchSet_ = filteredPatchSet; + } } } @@ -184,38 +232,27 @@ void Foam::wallShearStress::write() } - const surfaceScalarField& phi = - obr_.lookupObject<surfaceScalarField>(phiName_); - tmp<volSymmTensorField> Reff; - if (phi.dimensions() == dimMass/dimTime) + if (mesh.foundObject<cmpModel>("turbulenceModel")) { - if (!mesh.foundObject<cmpModel>("turbulenceModel")) - { - FatalErrorIn("void Foam::wallShearStress::write()") - << "Unable to find compressible turbulence model in the " - << "database" << exit(FatalError); - } - const cmpModel& model = mesh.lookupObject<cmpModel>("turbulenceModel"); Reff = model.devRhoReff(); } - else + else if (mesh.foundObject<icoModel>("turbulenceModel")) { - if (!mesh.foundObject<icoModel>("turbulenceModel")) - { - FatalErrorIn("void Foam::wallShearStress::write()") - << "Unable to find incompressible turbulence model in the " - << "database" << exit(FatalError); - } - const icoModel& model = mesh.lookupObject<icoModel>("turbulenceModel"); Reff = model.devReff(); } + else + { + FatalErrorIn("void Foam::wallShearStress::write()") + << "Unable to find incompressible turbulence model in the " + << "database" << exit(FatalError); + } calcShearStress(mesh, Reff(), wallShearStress); diff --git a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H index 80f12d0c24d6f134dbdf4e738e5519627a5efb1a..f8ecbbcfde7e14295a14135d88fcd207fbe967bd 100644 --- a/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H +++ b/src/postProcessing/functionObjects/utilities/wallShearStress/wallShearStress.H @@ -36,15 +36,34 @@ Description Stress = R \dot n \f] - The shear stress (symmetrical) tensor field is retrieved from the - turbulence model. - where \vartable R | stress tensor n | patch normal vector (into the domain) \endvartable + The shear stress (symmetrical) tensor field is retrieved from the + turbulence model. All wall patches are included by default; to restrict + the calculation to certain patches, use the optional 'patches' entry. + + Example of function object specification: + \verbatim + wallShearStress1 + { + type wallShearStress; + functionObjectLibs ("libutilityFunctionObjects.so"); + ... + patches (".*Wall"); + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: wallShearStress | yes | + patches | list of patches to process | no | all wall patches + \endtable + SourceFiles wallShearStress.C IOwallShearStress.H @@ -56,7 +75,6 @@ SourceFiles #include "functionObjectFile.H" #include "volFieldsFwd.H" -#include "pointFieldFwd.H" #include "Switch.H" #include "OFstream.H" @@ -68,6 +86,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; class fvMesh; @@ -94,8 +113,8 @@ protected: //- Switch to send output to Info as well as to file Switch log_; - //- Name of mass/volume flux field (optional, default = phi) - word phiName_; + //- Optional list of patches to process + labelHashSet patchSet_; // Protected Member Functions @@ -166,7 +185,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C index d7543ff1b529bd88f31421dc56710afd3cca2144..789c06ddc73b71b30cd83ec1af64e75a55a66609 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.C @@ -34,7 +34,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::yPlusLES, 0); +namespace Foam +{ +defineTypeNameAndDebug(yPlusLES, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H index 45f8fec68e0a5d6e4093d8fcf69e49cff9ad2686..78e7d38db78adf66d4f6f539b9cf91841a53af02 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H +++ b/src/postProcessing/functionObjects/utilities/yPlusLES/yPlusLES.H @@ -42,7 +42,6 @@ SourceFiles #include "functionObjectFile.H" #include "volFieldsFwd.H" -#include "pointFieldFwd.H" #include "Switch.H" #include "OFstream.H" @@ -54,6 +53,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; class fvMesh; @@ -161,7 +161,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C index 8d81c05bfe165d107c4e841ab98a432ea9949590..663c6dda74391a5c9b86d212d35467df4721c681 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.C @@ -36,7 +36,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::yPlusRAS, 0); +namespace Foam +{ +defineTypeNameAndDebug(yPlusRAS, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -56,7 +59,7 @@ void Foam::yPlusRAS::calcIncompressibleYPlus volScalarField& yPlus ) { - typedef incompressible::RASModels::nutWallFunctionFvPatchScalarField + typedef incompressible::nutWallFunctionFvPatchScalarField wallFunctionPatchField; const incompressible::RASModel& model = @@ -114,7 +117,7 @@ void Foam::yPlusRAS::calcCompressibleYPlus volScalarField& yPlus ) { - typedef compressible::RASModels::mutWallFunctionFvPatchScalarField + typedef compressible::mutWallFunctionFvPatchScalarField wallFunctionPatchField; const compressible::RASModel& model = diff --git a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H index 98b8134e0c729c4e683417d29ae8f573051ee866..241c4b6a74e08b5e0a88484dd031064e62300cac 100644 --- a/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H +++ b/src/postProcessing/functionObjects/utilities/yPlusRAS/yPlusRAS.H @@ -42,7 +42,6 @@ SourceFiles #include "functionObjectFile.H" #include "volFieldsFwd.H" -#include "pointFieldFwd.H" #include "Switch.H" #include "OFstream.H" @@ -54,6 +53,7 @@ namespace Foam // Forward declaration of classes class objectRegistry; class dictionary; +class polyMesh; class mapPolyMesh; class fvMesh; @@ -148,7 +148,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} }; diff --git a/src/postProcessing/postCalc/postCalc.C b/src/postProcessing/postCalc/postCalc.C index ff2dd174e0781c46feeaddeab750da2bd0abab53..0dfb6bf95707c0d1fa3482827ee2288f43b6f3b3 100644 --- a/src/postProcessing/postCalc/postCalc.C +++ b/src/postProcessing/postCalc/postCalc.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,12 +68,7 @@ int main(int argc, char *argv[]) "noFlow", "suppress creating flow models (execFlowFunctionObjects only)" ); - Foam::argList::addOption - ( - "dict", - "name", - "dictionary to use" - ); + #include "addDictOption.H" #include "setRootCase.H" #include "createTime.H" diff --git a/src/randomProcesses/Make/options b/src/randomProcesses/Make/options index 61fc018ad930d8d5dda59891e9e59e52ff1ecba6..71b7873964d544eddf96d22aa40f4c3372c23c9c 100644 --- a/src/randomProcesses/Make/options +++ b/src/randomProcesses/Make/options @@ -1,7 +1,5 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude LIB_LIBS = \ - -lfiniteVolume \ - -lsampling + -lfiniteVolume diff --git a/src/randomProcesses/noise/noiseFFT.C b/src/randomProcesses/noise/noiseFFT.C index eea9646f58672cc46732c6fc97c39b51f3b7a44f..9a7ca7cd95cbd6d4f093635861f7302e6ef1a434 100644 --- a/src/randomProcesses/noise/noiseFFT.C +++ b/src/randomProcesses/noise/noiseFFT.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 @@ -27,8 +27,8 @@ License #include "IFstream.H" #include "DynamicList.H" #include "fft.H" -#include "mathematicalConstants.H" #include "SubField.H" +#include "mathematicalConstants.H" // * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * // @@ -37,7 +37,6 @@ Foam::scalar Foam::noiseFFT::p0 = 2e-5; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from pressure field Foam::noiseFFT::noiseFFT ( const scalar deltat, @@ -49,7 +48,6 @@ Foam::noiseFFT::noiseFFT {} -// Construct from pressure field file name Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip) : scalarField(), @@ -63,7 +61,7 @@ Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip) { FatalErrorIn ( - "noiseFFT::noiseFFT(const fileName& pFileName, const label skip)" + "noiseFFT::noiseFFT(const fileName&, const label)" ) << "Cannot read file " << pFileName << exit(FatalError); } @@ -78,11 +76,8 @@ Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip) if (!pFile.good() || pFile.eof()) { - FatalErrorIn - ( - "noiseFFT::noiseFFT(const fileName& pFileName, " - "const label skip)" - ) << "Number of points in file " << pFileName + FatalErrorIn("noiseFFT::noiseFFT(const fileName&, const label)") + << "Number of points in file " << pFileName << " is less than the number to be skipped = " << skip << exit(FatalError); } @@ -103,7 +98,7 @@ Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip) deltat_ = T/pData.size(); - scalarField::operator=(pData.shrink()); + this->transfer(pData); } @@ -138,7 +133,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::window if ((N + ni*windowOffset) > size()) { - FatalErrorIn("noiseFFT::window(const label N, const label n) const") + FatalErrorIn("noiseFFT::window(const label, const label) const") << "Requested window is outside set of data" << endl << "number of data = " << size() << endl << "size of window = " << N << endl @@ -217,10 +212,10 @@ Foam::graph Foam::noiseFFT::meanPf { if (N > size()) { - FatalErrorIn("noiseFFT::meanPf(const label N, const label nw) const") - << "Requested window is outside set of data" << endl - << "number of data = " << size() << endl - << "size of window = " << N << endl + FatalErrorIn("noiseFFT::meanPf(const label, const label) const") + << "Requested window is outside set of data" << nl + << "number of data = " << size() << nl + << "size of window = " << N << nl << "window = " << nw << exit(FatalError); } @@ -263,7 +258,7 @@ Foam::graph Foam::noiseFFT::RMSmeanPf { if (N > size()) { - FatalErrorIn("noiseFFT::RMSmeanPf(const label N, const label nw) const") + FatalErrorIn("noiseFFT::RMSmeanPf(const label, const label) const") << "Requested window is outside set of data" << endl << "number of data = " << size() << endl << "size of window = " << N << endl diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C index b64afa0be661e17ce5bcc904be0229c95b683dc5..cfa52c3e80ef223ffe0e15d4b1d591e6db1de4f6 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.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 @@ -42,61 +42,11 @@ defineTypeNameAndDebug(pyrolysisModel, 0); defineRunTimeSelectionTable(pyrolysisModel, mesh); defineRunTimeSelectionTable(pyrolysisModel, dictionary); -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -void pyrolysisModel::constructMeshObjects() -{ - // construct filmDelta field if coupled to film model - if (filmCoupled_) - { - filmDeltaPtr_.reset - ( - new volScalarField - ( - IOobject - ( - "filmDelta", - time_.timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ) - ); - - const volScalarField& filmDelta = filmDeltaPtr_(); - - bool foundCoupledPatch = false; - forAll(filmDelta.boundaryField(), patchI) - { - const fvPatchField<scalar>& fvp = filmDelta.boundaryField()[patchI]; - if (isA<mappedFieldFvPatchField<scalar> >(fvp)) - { - foundCoupledPatch = true; - break; - } - } - - if (!foundCoupledPatch) - { - WarningIn("void pyrolysisModels::constructMeshObjects()") - << "filmCoupled flag set to true, but no " - << mappedFieldFvPatchField<scalar>::typeName - << " patches found on " << filmDelta.name() << " field" - << endl; - } - } -} - - // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void pyrolysisModel::readPyrolysisControls() { - filmCoupled_ = readBool(coeffs_.lookup("filmCoupled")); - reactionDeltaMin_ = - coeffs_.lookupOrDefault<scalar>("reactionDeltaMin", 0.0); + // do nothing } @@ -132,24 +82,17 @@ bool pyrolysisModel::read(const dictionary& dict) pyrolysisModel::pyrolysisModel(const fvMesh& mesh) : - regionModel1D(mesh), - filmCoupled_(false), - filmDeltaPtr_(NULL), - reactionDeltaMin_(0.0) + regionModel1D(mesh) {} pyrolysisModel::pyrolysisModel(const word& modelType, const fvMesh& mesh) : - regionModel1D(mesh, "pyrolysis", modelType), - filmCoupled_(false), - filmDeltaPtr_(NULL), - reactionDeltaMin_(0.0) + regionModel1D(mesh, "pyrolysis", modelType) { if (active_) { read(); - constructMeshObjects(); } } @@ -161,15 +104,11 @@ pyrolysisModel::pyrolysisModel const dictionary& dict ) : - regionModel1D(mesh, "pyrolysis", modelType, dict), - filmCoupled_(false), - filmDeltaPtr_(NULL), - reactionDeltaMin_(0.0) + regionModel1D(mesh, "pyrolysis", modelType, dict) { if (active_) { read(dict); - constructMeshObjects(); } } @@ -192,15 +131,6 @@ scalar pyrolysisModel::addMassSources } -void pyrolysisModel::preEvolveRegion() -{ - if (filmCoupled_) - { - filmDeltaPtr_->correctBoundaryConditions(); - } -} - - scalar pyrolysisModel::solidRegionDiffNo() const { return -GREAT; diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H index 57d8caa3c4fc2d98b3a19f6cf0effedafc1ba8c3..98da338d9a8b6f01c9740db483698db08ab01312 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H @@ -80,18 +80,6 @@ private: protected: - // Protected Data - - //- Flag to indicate whether pyrolysis region coupled to a film region - bool filmCoupled_; - - //- Pointer to film thickness field - autoPtr<volScalarField> filmDeltaPtr_; - - //- Film height below which reactions can occur [m] - scalar reactionDeltaMin_; - - // Protected Member Functions //- Read control parameters @@ -115,8 +103,8 @@ public: pyrolysisModel, mesh, ( - const word& modelType, - const fvMesh& mesh + const word& modelType, + const fvMesh& mesh ), (modelType, mesh) ); @@ -127,9 +115,9 @@ public: pyrolysisModel, dictionary, ( - const word& modelType, - const fvMesh& mesh, - const dictionary& dict + const word& modelType, + const fvMesh& mesh, + const dictionary& dict ), (modelType, mesh, dict) ); @@ -234,12 +222,6 @@ public: ); - // Evolution - - //- Pre-evolve region - virtual void preEvolveRegion(); - - // Helper function //- Mean diffusion number of the solid region diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 5c36e4ad53e61d265fffea43c589855ea965e23c..84fb91407fedc08693a192807ff640a0bfd5d46b 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -90,58 +90,6 @@ bool reactingOneDim::read(const dictionary& dict) } -void reactingOneDim::updateQr() -{ - // Retrieve field from coupled region using mapped boundary conditions - QrCoupled_.correctBoundaryConditions(); - - // Update local Qr from coupled Qr field - Qr_ == dimensionedScalar("zero", Qr_.dimensions(), 0.0); - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - - scalarField& Qrp = Qr_.boundaryField()[patchI]; - - // Qr is negative going out the solid - // If the surface is emitting the radiative flux is set to zero - Qrp = max(Qrp, scalar(0.0)); - } - - const volScalarField kappaRad_(kappaRad()); - - // Propagate Qr through 1-D regions - label totalFaceId = 0; - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - - const scalarField& Qrp = Qr_.boundaryField()[patchI]; - const vectorField& Cf = regionMesh().Cf().boundaryField()[patchI]; - - forAll(Qrp, faceI) - { - const scalar Qr0 = Qrp[faceI]; - point Cf0 = Cf[faceI]; - const labelList& cells = boundaryFaceCells_[totalFaceId]; - scalar kappaInt = 0.0; - forAll(cells, k) - { - const label cellI = cells[k]; - const point& Cf1 = regionMesh().cellCentres()[cellI]; - const scalar delta = mag(Cf1 - Cf0); - kappaInt += kappaRad_[cellI]*delta; - Qr_[cellI] = Qr0*exp(-kappaInt); - Cf0 = Cf1; - } - totalFaceId ++; - } - } - - Qr_.correctBoundaryConditions(); -} - - void reactingOneDim::updatePhiGas() { phiHsGas_ == dimensionedScalar("zero", phiHsGas_.dimensions(), 0.0); @@ -198,8 +146,6 @@ void reactingOneDim::updatePhiGas() void reactingOneDim::updateFields() { - updateQr(); - updatePhiGas(); } @@ -305,18 +251,12 @@ void reactingOneDim::solveEnergy() tmp<volScalarField> alpha(solidThermo_.alpha()); - const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf()); - - const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_)); - fvScalarMatrix hEqn ( fvm::ddt(rho_, h_) - fvm::laplacian(alpha, h_) == chemistrySh_ - + fvc::div(phiQr) - + fvc::div(phiGas) ); if (regionMesh().moving()) @@ -380,7 +320,6 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) ), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), - primaryRadFluxName_(coeffs().lookupOrDefault<word>("radFluxName", "Qr")), nNonOrthCorr_(-1), maxDiff_(10), minimumDelta_(1e-4), @@ -392,7 +331,7 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) "phiGas", time().timeName(), regionMesh(), - IOobject::NO_READ, + IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), regionMesh(), @@ -427,34 +366,6 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0) ), - QrCoupled_ - ( - IOobject - ( - primaryRadFluxName_, - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - - Qr_ - ( - IOobject - ( - "QrPyr", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), - zeroGradientFvPatchVectorField::typeName - ), - lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)), addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)), totalGasMassFlux_(0.0), @@ -492,7 +403,6 @@ reactingOneDim::reactingOneDim ), Ys_(solidThermo_.composition().Y()), h_(solidThermo_.he()), - primaryRadFluxName_(dict.lookupOrDefault<word>("radFluxName", "Qr")), nNonOrthCorr_(-1), maxDiff_(10), minimumDelta_(1e-4), @@ -539,34 +449,6 @@ reactingOneDim::reactingOneDim dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0) ), - QrCoupled_ - ( - IOobject - ( - primaryRadFluxName_, - time().timeName(), - regionMesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - regionMesh() - ), - - Qr_ - ( - IOobject - ( - "QrPyr", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - regionMesh(), - dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), - zeroGradientFvPatchVectorField::typeName - ), - lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)), addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)), totalGasMassFlux_(0.0), @@ -684,36 +566,6 @@ void reactingOneDim::preEvolveRegion() { solidChemistry_->setCellReacting(cellI, true); } - - // De-activate reactions if pyrolysis region coupled to (valid) film - if (filmCoupled_) - { - const volScalarField& filmDelta = filmDeltaPtr_(); - - forAll(intCoupledPatchIDs_, i) - { - const label patchI = intCoupledPatchIDs_[i]; - const scalarField& filmDeltap = filmDelta.boundaryField()[patchI]; - - forAll(filmDeltap, faceI) - { - const scalar filmDelta0 = filmDeltap[faceI]; - if (filmDelta0 > reactionDeltaMin_) - { - const labelList& cells = boundaryFaceCells_[faceI]; - - // TODO: only limit cell adjacent to film? - //solidChemistry_->setCellNoReacting(cells[0]) - - // Propagate flag through 1-D region - forAll(cells, k) - { - solidChemistry_->setCellReacting(cells[k], false); - } - } - } - } - } } diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H index 76cf66a60feec70bf07c7f539f79cefea6609280..104e56c34e82b1598fa324c66602812601047482 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.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 @@ -125,16 +125,6 @@ protected: volScalarField chemistrySh_; - // Source term fields - - //- Coupled region radiative heat flux [W/m2] - // Requires user to input mapping info for coupled patches - volScalarField QrCoupled_; - - //- In depth radiative heat flux [W/m2] - volScalarField Qr_; - - // Checks //- Cumulative lost mass of the condensed phase [kg] @@ -164,9 +154,6 @@ protected: //- Update/move mesh based on change in mass void updateMesh(const scalarField& mass0); - //- Update radiative flux in pyrolysis region - void updateQr(); - //- Update enthalpy flux for pyrolysis gases void updatePhiGas(); @@ -259,12 +246,6 @@ public: virtual scalar solidRegionDiffNo() const; - // Source fields (read/write access) - - //- In depth radiative heat flux - inline const volScalarField& Qr() const; - - // Evolution //- Pre-evolve region diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H index eec1e7fa0a046491eee3de7b5555b0925a3c4b7e..375c3780804337ddef0cf5c0129a680e1df0954a 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.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 @@ -34,11 +34,4 @@ Foam::regionModels::pyrolysisModels::reactingOneDim::nNonOrthCorr() const } -inline const Foam::volScalarField& -Foam::regionModels::pyrolysisModels::reactingOneDim::Qr() const -{ - return Qr_; -} - - // ************************************************************************* // diff --git a/src/regionModels/regionCoupling/Make/options b/src/regionModels/regionCoupling/Make/options index 4eaef77e23fdb8a64cf01f11691b13a6f70283ad..28569ccda68e500c6b26cfab904e9507bd6fa120 100644 --- a/src/regionModels/regionCoupling/Make/options +++ b/src/regionModels/regionCoupling/Make/options @@ -1,6 +1,5 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/AMIInterpolation/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C index b0f8d1629a919d008f1267e6dcb99cc5562aef3b..1ffe2ae82f034af094ffa5ea933b9eb9dad4b8f0 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.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 @@ -40,8 +40,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(p, iF), phiName_("phi"), - rhoName_("rho"), - deltaWet_(1e-6) + rhoName_("rho") {} @@ -56,8 +55,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - deltaWet_(ptf.deltaWet_) + rhoName_(ptf.rhoName_) {} @@ -71,8 +69,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6)) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")) { fvPatchScalarField::operator=(scalarField("value", dict, p.size())); } @@ -86,8 +83,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(fptpsf), phiName_(fptpsf.phiName_), - rhoName_(fptpsf.rhoName_), - deltaWet_(fptpsf.deltaWet_) + rhoName_(fptpsf.rhoName_) {} @@ -100,8 +96,7 @@ filmPyrolysisTemperatureCoupledFvPatchScalarField : fixedValueFvPatchScalarField(fptpsf, iF), phiName_(fptpsf.phiName_), - rhoName_(fptpsf.rhoName_), - deltaWet_(fptpsf.deltaWet_) + rhoName_(fptpsf.rhoName_) {} @@ -151,13 +146,12 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() const label filmPatchI = filmModel.regionPatchID(patchI); - scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI]; - filmModel.toPrimary(filmPatchI, deltaFilm); + scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI]; + filmModel.toPrimary(filmPatchI, alphaFilm); scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI]; filmModel.toPrimary(filmPatchI, TFilm); - // Retrieve pyrolysis model const pyrModelType& pyrModel = db().lookupObject<pyrModelType>("pyrolysisProperties"); @@ -168,19 +162,8 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs() pyrModel.toPrimary(pyrPatchI, TPyr); - forAll(deltaFilm, i) - { - if (deltaFilm[i] > deltaWet_) - { - // temperature set by film - Tp[i] = TFilm[i]; - } - else - { - // temperature set by pyrolysis model - Tp[i] = TPyr[i]; - } - } + // Evaluate temperature + Tp = alphaFilm*TFilm + (1.0 - alphaFilm)*TPyr; // Restore tag UPstream::msgType() = oldTag; @@ -197,7 +180,6 @@ void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write fvPatchScalarField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H index 503b023f955c89dccc683a0311766352aaf38413..bc4ace8abdfcdcd7b84b36af1d481f5af8f7e27a 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.H @@ -28,15 +28,7 @@ Description This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelling. It provides a temperature boundary condition for patches on the primary region based on whether the patch is seen to - be 'wet', specified by: - - \f[ - delta > delta_wet - \f] - - where - \var delta = film height [m] - \var delta_wet = film height above which the surface is considered wet + be 'wet', retrieved from the film alpha field. \li if the patch is wet, the temperature is set using the film temperature \li otherwise, it is set using pyrolysis temperature @@ -84,9 +76,6 @@ class filmPyrolysisTemperatureCoupledFvPatchScalarField //- Name of density field word rhoName_; - //- Film height threshold beyond which it is considered 'wet' [m] - scalar deltaWet_; - public: diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C index 29b3e345868bcc112d33535b76bb42e1f89448f6..9210d30e576f1b7ba86518265760cf5764a60045 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.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 @@ -40,8 +40,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(p, iF), phiName_("phi"), - rhoName_("rho"), - deltaWet_(1e-6) + rhoName_("rho") {} @@ -56,8 +55,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(ptf, p, iF, mapper), phiName_(ptf.phiName_), - rhoName_(ptf.rhoName_), - deltaWet_(ptf.deltaWet_) + rhoName_(ptf.rhoName_) {} @@ -71,8 +69,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), - rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6)) + rhoName_(dict.lookupOrDefault<word>("rho", "rho")) { fvPatchVectorField::operator=(vectorField("value", dict, p.size())); } @@ -86,8 +83,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(fpvpvf), phiName_(fpvpvf.phiName_), - rhoName_(fpvpvf.rhoName_), - deltaWet_(fpvpvf.deltaWet_) + rhoName_(fpvpvf.rhoName_) {} @@ -100,8 +96,7 @@ filmPyrolysisVelocityCoupledFvPatchVectorField : fixedValueFvPatchVectorField(fpvpvf, iF), phiName_(fpvpvf.phiName_), - rhoName_(fpvpvf.rhoName_), - deltaWet_(fpvpvf.deltaWet_) + rhoName_(fpvpvf.rhoName_) {} @@ -154,13 +149,12 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() const label filmPatchI = filmModel.regionPatchID(patchI); - scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI]; - filmModel.toPrimary(filmPatchI, deltaFilm); + scalarField alphaFilm = filmModel.alpha().boundaryField()[filmPatchI]; + filmModel.toPrimary(filmPatchI, alphaFilm); vectorField UFilm = filmModel.Us().boundaryField()[filmPatchI]; filmModel.toPrimary(filmPatchI, UFilm); - // Retrieve pyrolysis model const pyrModelType& pyrModel = db().objectRegistry::lookupObject<pyrModelType> @@ -203,19 +197,9 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs() const scalarField UAvePyr(-phiPyr/patch().magSf()); const vectorField& nf = patch().nf(); - forAll(deltaFilm, i) - { - if (deltaFilm[i] > deltaWet_) - { - // velocity set by film - Up[i] = UFilm[i]; - } - else - { - // velocity set by pyrolysis model - Up[i] = UAvePyr[i]*nf[i]; - } - } + + // Evaluate velocity + Up = alphaFilm*UFilm + (1.0 - alphaFilm)*UAvePyr*nf; // Restore tag UPstream::msgType() = oldTag; @@ -232,7 +216,6 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::write fvPatchVectorField::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl; writeEntry("value", os); } diff --git a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H index c7c4c5d24be220b83c3bb478b61b40148895b104..b37157ddf0251f6e1a7d0c8a8169c153d7fa0f80 100644 --- a/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H +++ b/src/regionModels/regionCoupling/derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.H @@ -28,15 +28,7 @@ Description This boundary condition is designed to be used in conjunction with surface film and pyrolysis modelling. It provides a velocity boundary condition for patches on the primary region based on whether the patch is seen to - be 'wet', specified by: - - \f[ - delta > delta_wet - \f] - - where - \var delta = film height [m] - \var delta_wet = film height above which the surface is considered wet + be 'wet', retrieved from the film alpha field. \li if the patch is wet, the velocity is set using the film velocity \li otherwise, it is set using pyrolysis out-gassing velocity @@ -84,9 +76,6 @@ class filmPyrolysisVelocityCoupledFvPatchVectorField //- Name of density field word rhoName_; - //- Film height threshold beyond which it is considered 'wet' - scalar deltaWet_; - public: diff --git a/src/regionModels/regionModel/Make/files b/src/regionModels/regionModel/Make/files index ab1853089066055765a022cbbe3249f36fc23f3e..11002e0a2902e40bf3b778df3145e988cf4ff937 100644 --- a/src/regionModels/regionModel/Make/files +++ b/src/regionModels/regionModel/Make/files @@ -8,4 +8,8 @@ derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch. regionProperties/regionProperties.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C +regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C + LIB = $(FOAM_LIBBIN)/libregionModels diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 98e152c3f1784818c406da85352ebf0651f012e9..55ced3fe534eddd5e8ef6029907c76d6c6d3461a 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.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 @@ -190,6 +190,147 @@ bool Foam::regionModels::regionModel::read(const dictionary& dict) } +const Foam::AMIPatchToPatchInterpolation& +Foam::regionModels::regionModel::interRegionAMI +( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const bool flip +) +{ + label nbrRegionID = findIndex(interRegionAMINames_, nbrRegion.name()); + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + if (nbrRegionID != -1) + { + if (!interRegionAMI_[nbrRegionID].set(regionPatchI)) + { + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + interRegionAMI_[nbrRegionID].set + ( + regionPatchI, + new AMIPatchToPatchInterpolation + ( + p, + nbrP, + faceAreaIntersect::tmMesh, + flip + ) + ); + + UPstream::msgType() = oldTag; + } + + return interRegionAMI_[nbrRegionID][regionPatchI]; + } + else + { + label nbrRegionID = interRegionAMINames_.size(); + + interRegionAMINames_.append(nbrRegion.name()); + + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + const polyPatch& nbrP = nbrRegionMesh.boundaryMesh()[nbrPatchI]; + + label nPatch = regionMesh().boundaryMesh().size(); + + + interRegionAMI_.resize(nbrRegionID + 1); + + interRegionAMI_.set + ( + nbrRegionID, + new PtrList<AMIPatchToPatchInterpolation>(nPatch) + ); + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + interRegionAMI_[nbrRegionID].set + ( + regionPatchI, + new AMIPatchToPatchInterpolation + ( + p, + nbrP, + faceAreaIntersect::tmMesh, + flip + ) + ); + + UPstream::msgType() = oldTag; + + return interRegionAMI_[nbrRegionID][regionPatchI]; + } +} + + +Foam::label Foam::regionModels::regionModel::nbrCoupledPatchID +( + const regionModel& nbrRegion, + const label regionPatchI +) const +{ + label nbrPatchI = -1; + + // region + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + // boundary mesh + const polyBoundaryMesh& nbrPbm = nbrRegionMesh.boundaryMesh(); + + const mappedPatchBase& mpb = + refCast<const mappedPatchBase> + ( + regionMesh().boundaryMesh()[regionPatchI] + ); + + // sample patch name on the primary region + const word& primaryPatchName = mpb.samplePatch(); + + // find patch on nbr region that has the same sample patch name + forAll(nbrRegion.intCoupledPatchIDs(), j) + { + const label nbrRegionPatchI = nbrRegion.intCoupledPatchIDs()[j]; + + const mappedPatchBase& mpb = + refCast<const mappedPatchBase>(nbrPbm[nbrRegionPatchI]); + + if (mpb.samplePatch() == primaryPatchName) + { + nbrPatchI = nbrRegionPatchI; + break; + } + } + + if (nbrPatchI == -1) + { + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + FatalErrorIn + ( + "Foam::label Foam::regionModels::regionModel::nbrCoupledPatchID" + "(" + "const regionModel& , " + "const label" + ") const" + ) + << "Unable to find patch pair for local patch " + << p.name() << " and region " << nbrRegion.name() + << abort(FatalError); + } + + return nbrPatchI; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) @@ -214,7 +355,10 @@ Foam::regionModels::regionModel::regionModel(const fvMesh& mesh) coeffs_(dictionary::null), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_("none") + regionName_("none"), + functions_(*this), + interRegionAMINames_(), + interRegionAMI_() {} @@ -246,7 +390,8 @@ Foam::regionModels::regionModel::regionModel coeffs_(subOrEmptyDict(modelName + "Coeffs")), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_(lookup("regionName")) + regionName_(lookup("regionName")), + functions_(*this, subOrEmptyDict("functions")) { if (active_) { @@ -274,7 +419,7 @@ Foam::regionModels::regionModel::regionModel ( IOobject ( - regionType, + regionType + "Properties", mesh.time().constant(), mesh, IOobject::NO_READ, @@ -292,7 +437,8 @@ Foam::regionModels::regionModel::regionModel coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")), primaryPatchIDs_(), intCoupledPatchIDs_(), - regionName_(dict.lookup("regionName")) + regionName_(dict.lookup("regionName")), + functions_(*this, subOrEmptyDict("functions")) { if (active_) { @@ -315,18 +461,6 @@ Foam::regionModels::regionModel::~regionModel() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -void Foam::regionModels::regionModel::preEvolveRegion() -{ - // do nothing -} - - -void Foam::regionModels::regionModel::evolveRegion() -{ - // do nothing -} - - void Foam::regionModels::regionModel::evolve() { if (active_) @@ -334,15 +468,14 @@ void Foam::regionModels::regionModel::evolve() Info<< "\nEvolving " << modelName_ << " for region " << regionMesh().name() << endl; - // Update any input information //read(); - // Pre-evolve preEvolveRegion(); - // Increment the region equations up to the new time level evolveRegion(); + postEvolveRegion(); + // Provide some feedback if (infoOutput_) { @@ -354,6 +487,24 @@ void Foam::regionModels::regionModel::evolve() } +void Foam::regionModels::regionModel::preEvolveRegion() +{ + functions_.preEvolveRegion(); +} + + +void Foam::regionModels::regionModel::evolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModel::postEvolveRegion() +{ + functions_.postEvolveRegion(); +} + + void Foam::regionModels::regionModel::info() const { // do nothing diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index 6fbad3d3720465d69cba391df69e7f67dba61a2e..c0bd06e4df4c57120b24ed95385cd0b5dfb95eda 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -41,21 +41,18 @@ SourceFiles #include "labelList.H" #include "volFields.H" #include "mappedPatchBase.H" +#include "regionModelFunctionObjectList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes -//class fvMesh; -//class Time; - namespace regionModels { /*---------------------------------------------------------------------------*\ - Class regionModel Declaration + Class regionModel Declaration \*---------------------------------------------------------------------------*/ class regionModel @@ -121,6 +118,18 @@ protected: //- Region name word regionName_; + //- Region model function objects + regionModelFunctionObjectList functions_; + + + // Inter-region AMI interpolation caching + + //- List of region names this region is coupled to + wordList interRegionAMINames_; + + //- List of AMI objects per coupled region + PtrList<PtrList<AMIPatchToPatchInterpolation> > interRegionAMI_; + // Protected member functions @@ -130,6 +139,14 @@ protected: //- Read control parameters from dictionary virtual bool read(const dictionary& dict); + //- Create or return a new inter-region AMI object + virtual const Foam::AMIPatchToPatchInterpolation& interRegionAMI + ( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const bool flip + ); public: @@ -162,7 +179,6 @@ public: ); - //- Destructor virtual ~regionModel(); @@ -201,9 +217,13 @@ public: // Addressing + //- Return true if patchI on the local region is a coupled + // patch to the primary region + inline bool isCoupledPatch(const label regionPatchI) const; + //- Return true if patchI on the primary region is a coupled // patch to the local region - inline bool isRegionPatch(const label patchI) const; + inline bool isRegionPatch(const label primaryPatchI) const; //- Return the list of patch IDs on the primary region coupled // to this region @@ -219,6 +239,46 @@ public: // Helper + //- Return the coupled patch ID paired with coupled patch + // regionPatchI + label nbrCoupledPatchID + ( + const regionModel& nbrRegion, + const label regionPatchI + ) const; + + //- Map patch field from another region model to local patch + template<class Type> + tmp<Foam::Field<Type> > mapRegionPatchField + ( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const Field<Type>& nbrField, + const bool flip = false + ); + + //- Map patch field from another region model to local patch + template<class Type> + tmp<Field<Type> > mapRegionPatchField + ( + const regionModel& nbrRegion, + const word& fieldName, + const label regionPatchI, + const bool flip = false + ); + + //- Map patch internal field from another region model to local + // patch + template<class Type> + tmp<Field<Type> > mapRegionPatchInternalField + ( + const regionModel& nbrRegion, + const word& fieldName, + const label regionPatchI, + const bool flip = false + ); + //- Convert a local region field to the primary region template<class Type> void toPrimary @@ -256,14 +316,17 @@ public: // Evolution + //- Main driver routing to evolve the region - calls other evolves + virtual void evolve(); + //- Pre-evolve region virtual void preEvolveRegion(); //- Evolve the region virtual void evolveRegion(); - //- Evolve the region - virtual void evolve(); + //- Post-evolve region + virtual void postEvolveRegion(); // I-O diff --git a/src/regionModels/regionModel/regionModel/regionModelI.H b/src/regionModels/regionModel/regionModel/regionModelI.H index 834bbfb0222e2b8c59e94b1b5490decd63cdf84e..287fcc1920291ea3296dbf826f2c295770e781bd 100644 --- a/src/regionModels/regionModel/regionModel/regionModelI.H +++ b/src/regionModels/regionModel/regionModel/regionModelI.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 @@ -112,14 +112,31 @@ Foam::regionModels::regionModel::solution() const } +inline bool Foam::regionModels::regionModel::isCoupledPatch +( + const label regionPatchI +) const +{ + forAll(intCoupledPatchIDs_, i) + { + if (intCoupledPatchIDs_[i] == regionPatchI) + { + return true; + } + } + + return false; +} + + inline bool Foam::regionModels::regionModel::isRegionPatch ( - const label patchI + const label primaryPatchI ) const { forAll(primaryPatchIDs_, i) { - if (primaryPatchIDs_[i] == patchI) + if (primaryPatchIDs_[i] == primaryPatchI) { return true; } diff --git a/src/regionModels/regionModel/regionModel/regionModelTemplates.C b/src/regionModels/regionModel/regionModel/regionModelTemplates.C index b78772de017f34dd966b8e6df1be4bab0a9490ce..5855ee5906140583195366d71df9d507bab9b608 100644 --- a/src/regionModels/regionModel/regionModel/regionModelTemplates.C +++ b/src/regionModels/regionModel/regionModel/regionModelTemplates.C @@ -23,6 +23,139 @@ License \*---------------------------------------------------------------------------*/ +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::regionModels::regionModel::mapRegionPatchField +( + const regionModel& nbrRegion, + const label regionPatchI, + const label nbrPatchI, + const Field<Type>& nbrField, + const bool flip +) +{ + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + const AMIPatchToPatchInterpolation& ami = + interRegionAMI(nbrRegion, regionPatchI, nbrPatchI, flip); + + tmp<Field<Type> > tresult(ami.interpolateToSource(nbrField)); + + UPstream::msgType() = oldTag; + + return tresult; +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::regionModels::regionModel::mapRegionPatchField +( + const regionModel& nbrRegion, + const word& fieldName, + const label regionPatchI, + const bool flip +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + if (nbrRegionMesh.foundObject<fieldType>(fieldName)) + { + const label nbrPatchI = nbrCoupledPatchID(nbrRegion, regionPatchI); + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + const AMIPatchToPatchInterpolation& ami = + interRegionAMI(nbrRegion, regionPatchI, nbrPatchI, flip); + + const fieldType& nbrField = + nbrRegionMesh.lookupObject<fieldType>(fieldName); + + const Field<Type>& nbrFieldp = nbrField.boundaryField()[nbrPatchI]; + + tmp<Field<Type> > tresult(ami.interpolateToSource(nbrFieldp)); + + UPstream::msgType() = oldTag; + + return tresult; + } + else + { + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + return + tmp<Field<Type> > + ( + new Field<Type> + ( + p.size(), + pTraits<Type>::zero + ) + ); + } +} + + +template<class Type> +Foam::tmp<Foam::Field<Type> > +Foam::regionModels::regionModel::mapRegionPatchInternalField +( + const regionModel& nbrRegion, + const word& fieldName, + const label regionPatchI, + const bool flip +) +{ + typedef GeometricField<Type, fvPatchField, volMesh> fieldType; + + const fvMesh& nbrRegionMesh = nbrRegion.regionMesh(); + + if (nbrRegionMesh.foundObject<fieldType>(fieldName)) + { + const label nbrPatchI = nbrCoupledPatchID(nbrRegion, regionPatchI); + + int oldTag = UPstream::msgType(); + UPstream::msgType() = oldTag + 1; + + const AMIPatchToPatchInterpolation& ami = + interRegionAMI(nbrRegion, regionPatchI, nbrPatchI, flip); + + const fieldType& nbrField = + nbrRegionMesh.lookupObject<fieldType>(fieldName); + + const fvPatchField<Type>& nbrFieldp = + nbrField.boundaryField()[nbrPatchI]; + + tmp<Field<Type> > tresult + ( + ami.interpolateToSource(nbrFieldp.patchInternalField()) + ); + + UPstream::msgType() = oldTag; + + return tresult; + } + else + { + const polyPatch& p = regionMesh().boundaryMesh()[regionPatchI]; + + return + tmp<Field<Type> > + ( + new Field<Type> + ( + p.size(), + pTraits<Type>::zero + ) + ); + } +} + + template<class Type> void Foam::regionModels::regionModel::toPrimary ( diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..182258b6379418e08eb06c85eec5125ee246c589 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionModelFunctionObject.H" +#include "regionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ + defineTypeNameAndDebug(regionModelFunctionObject, 0); + defineRunTimeSelectionTable(regionModelFunctionObject, dictionary); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + regionModel& owner +) +: + dict_(dictionary::null), + owner_(owner), + modelType_("modelType") +{} + + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + const dictionary& dict, + regionModel& owner, + const word& type +) +: + dict_(dict), + owner_(owner), + modelType_(type) +{} + + +Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject +( + const regionModelFunctionObject& rmfo +) +: + dict_(rmfo.dict_), + owner_(rmfo.owner_), + modelType_(rmfo.modelType_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObject::~regionModelFunctionObject() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionModels::regionModelFunctionObject::preEvolveRegion() +{ + // do nothing +} + + +void Foam::regionModels::regionModelFunctionObject::postEvolveRegion() +{ + if (owner_.regionMesh().time().outputTime()) + { + write(); + } +} + + +void Foam::regionModels::regionModelFunctionObject::write() const +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..77e56b14d19b329dd880ff0c3425ee7432392545 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::regionModelFunctionObject + +Description + Region model function object base class + +SourceFiles + regionModelFunctionObject.C + regionModelFunctionObjectNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionModelFunctionObject_H +#define regionModelFunctionObject_H + +#include "IOdictionary.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +namespace regionModels +{ + +class regionModel; + +/*---------------------------------------------------------------------------*\ + Class regionModelFunctionObject Declaration +\*---------------------------------------------------------------------------*/ + +class regionModelFunctionObject +{ +protected: + + // Protected data + + //- Dictionary + dictionary dict_; + + //- Reference to the region model + regionModel& owner_; + + //- Model type name + word modelType_; + + +public: + + //- Runtime type information + TypeName("regionModelFunctionObject"); + + //- Declare runtime constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + regionModelFunctionObject, + dictionary, + ( + const dictionary& dict, + regionModel& owner + ), + (dict, owner) + ); + + + // Constructors + + //- Construct null from owner + regionModelFunctionObject(regionModel& owner); + + //- Construct from dictionary + regionModelFunctionObject + ( + const dictionary& dict, + regionModel& owner, + const word& modelType + ); + + //- Construct copy + regionModelFunctionObject(const regionModelFunctionObject& ppm); + + //- Construct and return a clone + virtual autoPtr<regionModelFunctionObject> clone() const + { + return autoPtr<regionModelFunctionObject> + ( + new regionModelFunctionObject(*this) + ); + } + + + //- Destructor + virtual ~regionModelFunctionObject(); + + + //- Selector + static autoPtr<regionModelFunctionObject> New + ( + const dictionary& dict, + regionModel& owner, + const word& modelType + ); + + + // Member Functions + + // Evaluation + + //- Pre-evolve region hook + virtual void preEvolveRegion(); + + //- Post-evolve region hook + virtual void postEvolveRegion(); + + // I-O + + //- write + virtual void write() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C new file mode 100644 index 0000000000000000000000000000000000000000..366ec496badd36fd3371b245115346e6b0129e3b --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionModelFunctionObjectList.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + regionModel& owner +) +: + PtrList<regionModelFunctionObject>(), + owner_(owner), + dict_(dictionary::null) +{} + + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + regionModel& owner, + const dictionary& dict, + const bool readFields +) +: + PtrList<regionModelFunctionObject>(), + owner_(owner), + dict_(dict) +{ + if (readFields) + { + wordList modelNames(dict.toc()); + + Info<< " Selecting region model functions" << endl; + + if (modelNames.size() > 0) + { + this->setSize(modelNames.size()); + + forAll(modelNames, i) + { + const word& modelName = modelNames[i]; + + this->set + ( + i, + regionModelFunctionObject::New + ( + dict, + owner, + modelName + ) + ); + } + } + else + { + Info<< " none" << endl; + } + } +} + + +Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList +( + const regionModelFunctionObjectList& cfol +) +: + PtrList<regionModelFunctionObject>(cfol), + owner_(cfol.owner_), + dict_(cfol.dict_) +{} + + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +Foam::regionModels::regionModelFunctionObjectList:: +~regionModelFunctionObjectList() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::regionModels::regionModelFunctionObjectList::preEvolveRegion() +{ + forAll(*this, i) + { + this->operator[](i).preEvolveRegion(); + } +} + + +void Foam::regionModels::regionModelFunctionObjectList::postEvolveRegion() +{ + forAll(*this, i) + { + this->operator[](i).postEvolveRegion(); + } +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H new file mode 100644 index 0000000000000000000000000000000000000000..22488f18c8f4527a0c883c9c78a00ffe6a08a332 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::regionModelFunctionObjectList + +Description + List of cloud function objects + +SourceFiles + regionModelFunctionObjectListI.H + regionModelFunctionObjectList.C + +\*---------------------------------------------------------------------------*/ + +#ifndef regionModelFunctionObjectList_H +#define regionModelFunctionObjectList_H + +#include "PtrList.H" +#include "regionModelFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ + +class regionModel; + +/*---------------------------------------------------------------------------*\ + Class regionModelFunctionObjectList Declaration +\*---------------------------------------------------------------------------*/ + +class regionModelFunctionObjectList +: + public PtrList<regionModelFunctionObject> +{ +protected: + + // Protected Data + + //- Reference to the owner region model + regionModel& owner_; + + //- Dictionary + const dictionary dict_; + + +public: + + // Constructors + + //- Null constructor + regionModelFunctionObjectList(regionModel& owner); + + //- Construct from mesh + regionModelFunctionObjectList + ( + regionModel& owner, + const dictionary& dict, + const bool readFields = true + ); + + //- Construct copy + regionModelFunctionObjectList + ( + const regionModelFunctionObjectList& rmfol + ); + + + //- Destructor + virtual ~regionModelFunctionObjectList(); + + + // Member Functions + + // Access + + //- Return const access to the cloud owner + inline const regionModel& owner() const; + + //- Return refernce to the cloud owner + inline regionModel& owner(); + + //- Return the forces dictionary + inline const dictionary& dict() const; + + + // Evaluation + + //- Pre-evolve hook + virtual void preEvolveRegion(); + + //- Post-evolve hook + virtual void postEvolveRegion(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "regionModelFunctionObjectListI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H new file mode 100644 index 0000000000000000000000000000000000000000..a0a90d0f67535a0852fef3cc7a8675d1034b2782 --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectListI.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +inline const Foam::regionModels::regionModel& +Foam::regionModels::regionModelFunctionObjectList::owner() const +{ + return owner_; +} + + +inline Foam::regionModels::regionModel& +Foam::regionModels::regionModelFunctionObjectList::owner() +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::regionModels::regionModelFunctionObjectList::dict() const +{ + return dict_; +} + + +// ************************************************************************* // diff --git a/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C new file mode 100644 index 0000000000000000000000000000000000000000..11371b1f7967525c31669fbcdb26ad4707d3859e --- /dev/null +++ b/src/regionModels/regionModel/regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C @@ -0,0 +1,74 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "regionModelFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::regionModels::regionModelFunctionObject> +Foam::regionModels::regionModelFunctionObject::New +( + const dictionary& dict, + regionModel& owner, + const word& modelName +) +{ + const word modelType = dict.subDict(modelName).lookup("type"); + + Info<< " " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "regionModelFunctionObject::New" + "(" + "const dictionary&, " + "regionModel&, " + "const word&" + ")" + ) << "Unknown region model function type " + << modelType << nl << nl + << "Valid region model function types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return + autoPtr<regionModelFunctionObject> + ( + cstrIter() + ( + dict.subDict(modelName), + owner + ) + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index 12f80a7ce78a673b74feb8a81651f9450fa1161c..1151e2f7fd380386fc5c10bd64f921f3e068f24c 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -38,12 +38,16 @@ $(THERMOMODELS)/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveH $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModel.C $(THERMOMODELS)/filmRadiationModel/filmRadiationModel/filmRadiationModelNew.C $(THERMOMODELS)/filmRadiationModel/noRadiation/noRadiation.C +$(THERMOMODELS)/filmRadiationModel/constantRadiation/constantRadiation.C +$(THERMOMODELS)/filmRadiationModel/primaryRadiation/primaryRadiation.C $(THERMOMODELS)/filmRadiationModel/standardRadiation/standardRadiation.C /* Boundary conditions */ PATCHFIELDS=derivedFvPatchFields $(PATCHFIELDS)/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C +$(PATCHFIELDS)/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C +$(PATCHFIELDS)/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C /* Wall functions for primary region */ WALLFUNCS=$(PATCHFIELDS)/wallFunctions diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..617af63382203e67fbca60057c5ff2816f7e22fa --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.C @@ -0,0 +1,213 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "inclinedFilmNusseltHeightFvPatchScalarField.H" +#include "volFields.H" +#include "kinematicSingleLayer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(p, iF), + GammaMean_(), + a_(), + omega_() +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + GammaMean_(ptf.GammaMean_().clone().ptr()), + a_(ptf.a_().clone().ptr()), + omega_(ptf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF), + GammaMean_(DataEntry<scalar>::New("GammaMean", dict)), + a_(DataEntry<scalar>::New("a", dict)), + omega_(DataEntry<scalar>::New("omega", dict)) +{ + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); +} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& wmfrhpsf +) +: + fixedValueFvPatchScalarField(wmfrhpsf), + GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), + a_(wmfrhpsf.a_().clone().ptr()), + omega_(wmfrhpsf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltHeightFvPatchScalarField:: +inclinedFilmNusseltHeightFvPatchScalarField +( + const inclinedFilmNusseltHeightFvPatchScalarField& wmfrhpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchScalarField(wmfrhpsf, iF), + GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), + a_(wmfrhpsf.a_().clone().ptr()), + omega_(wmfrhpsf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const scalar t = db().time().timeOutputValue(); + + // retrieve the film region from the database + + const regionModels::regionModel& region = + db().lookupObject<regionModels::regionModel>("surfaceFilmProperties"); + + const regionModels::surfaceFilmModels::kinematicSingleLayer& film = + dynamic_cast + < + const regionModels::surfaceFilmModels::kinematicSingleLayer& + >(region); + + // calculate the vector tangential to the patch + + const vectorField n(patch().nf()); + + const volVectorField& nHat = film.nHat(); + + const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField()); + + vectorField nTan(nHatp ^ n); + nTan /= mag(nTan) + ROOTVSMALL; + + // calculate distance in patch tangential direction + + const vectorField& Cf = patch().Cf(); + scalarField d(nTan & Cf); + + // calculate the wavy film height + + const scalar GMean = GammaMean_->value(t); + const scalar a = a_->value(t); + const scalar omega = omega_->value(t); + + const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d)); + + const volScalarField& mu = film.mu(); + const scalarField mup(mu.boundaryField()[patchI].patchInternalField()); + + const volScalarField& rho = film.rho(); + const scalarField rhop(rho.boundaryField()[patchI].patchInternalField()); + + const scalarField Re(max(G, scalar(0.0))/mup); + + // TODO: currently re-evaluating the entire gTan field to return this patch + const scalarField gTan(film.gTan()().boundaryField()[patchI] & n); + + if (max(mag(gTan)) < SMALL) + { + WarningIn + ( + "void Foam::inclinedFilmNusseltHeightFvPatchScalarField::" + "updateCoeffs()" + ) + << "Tangential gravity component is zero. This boundary condition " + << "is designed to operate on patches inclined with respect to " + << "gravity" + << endl; + } + + operator== + ( + pow(3.0*sqr(mup/rhop)/(gTan + ROOTVSMALL), 0.333)*pow(Re, 0.333) + ); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void Foam::inclinedFilmNusseltHeightFvPatchScalarField::write +( + Ostream& os +) const +{ + fixedValueFvPatchScalarField::write(os); + GammaMean_->writeData(os); + a_->writeData(os); + omega_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchScalarField, + inclinedFilmNusseltHeightFvPatchScalarField + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..7be767718db0dc2eb86d7ebd483f4c78a43e4316 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltHeight/inclinedFilmNusseltHeightFvPatchScalarField.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::inclinedFilmNusseltHeightFvPatchScalarField + +Description + Film height boundary condition for inclined films that imposes a + sinusoidal perturbation on top of a mean flow rate, where the height is + calculated using the Nusselt solution. + +SourceFiles + inclinedFilmNusseltHeightFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef inclinedFilmNusseltHeightFvPatchScalarField_H +#define inclinedFilmNusseltHeightFvPatchScalarField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class inclinedFilmNusseltHeightFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class inclinedFilmNusseltHeightFvPatchScalarField +: + public fixedValueFvPatchScalarField +{ + // Private data + + //- Mean mass flow rate per unit length [kg/s/m] + autoPtr<DataEntry<scalar> > GammaMean_; + + //- Perturbation amplitude [m] + autoPtr<DataEntry<scalar> > a_; + + //- Perturbation frequency [rad/s/m] + autoPtr<DataEntry<scalar> > omega_; + + +public: + + //- Runtime type information + TypeName("inclinedFilmNusseltHeight"); + + + // Constructors + + //- Construct from patch and internal field + inclinedFilmNusseltHeightFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + inclinedFilmNusseltHeightFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // inclinedFilmNusseltHeightFvPatchScalarField onto a new patch + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new inclinedFilmNusseltHeightFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + inclinedFilmNusseltHeightFvPatchScalarField + ( + const inclinedFilmNusseltHeightFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new inclinedFilmNusseltHeightFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..923a559dfaf077b2bf3531c4990ff390f2d44da7 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "inclinedFilmNusseltInletVelocityFvPatchVectorField.H" +#include "volFields.H" +#include "kinematicSingleLayer.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(p, iF), + GammaMean_(), + a_(), + omega_() +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + GammaMean_(ptf.GammaMean_().clone().ptr()), + a_(ptf.a_().clone().ptr()), + omega_(ptf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + GammaMean_(DataEntry<scalar>::New("GammaMean", dict)), + a_(DataEntry<scalar>::New("a", dict)), + omega_(DataEntry<scalar>::New("omega", dict)) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); +} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& fmfrpvf +) +: + fixedValueFvPatchVectorField(fmfrpvf), + GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), + a_(fmfrpvf.a_().clone().ptr()), + omega_(fmfrpvf.omega_().clone().ptr()) +{} + + +Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField:: +inclinedFilmNusseltInletVelocityFvPatchVectorField +( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& fmfrpvf, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(fmfrpvf, iF), + GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), + a_(fmfrpvf.a_().clone().ptr()), + omega_(fmfrpvf.omega_().clone().ptr()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const scalar t = db().time().timeOutputValue(); + + // retrieve the film region from the database + + const regionModels::regionModel& region = + db().lookupObject<regionModels::regionModel>("surfaceFilmProperties"); + + const regionModels::surfaceFilmModels::kinematicSingleLayer& film = + dynamic_cast + < + const regionModels::surfaceFilmModels::kinematicSingleLayer& + >(region); + + // calculate the vector tangential to the patch + + const vectorField n(patch().nf()); + + const volVectorField& nHat = film.nHat(); + + const vectorField nHatp(nHat.boundaryField()[patchI].patchInternalField()); + + vectorField nTan(nHatp ^ n); + nTan /= mag(nTan) + ROOTVSMALL; + + // calculate distance in patch tangential direction + + const vectorField& Cf = patch().Cf(); + scalarField d(nTan & Cf); + + // calculate the wavy film height + + const scalar GMean = GammaMean_->value(t); + const scalar a = a_->value(t); + const scalar omega = omega_->value(t); + + const scalarField G(GMean + a*sin(omega*constant::mathematical::twoPi*d)); + + const volScalarField& mu = film.mu(); + const scalarField mup(mu.boundaryField()[patchI].patchInternalField()); + + const volScalarField& rho = film.rho(); + const scalarField rhop(rho.boundaryField()[patchI].patchInternalField()); + + const scalarField Re(max(G, scalar(0.0))/mup); + + // TODO: currently re-evaluating the entire gTan field to return this patch + const scalarField gTan(film.gTan()().boundaryField()[patchI] & n); + + if (max(mag(gTan)) < SMALL) + { + WarningIn + ( + "void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::" + "updateCoeffs()" + ) + << "Tangential gravity component is zero. This boundary condition " + << "is designed to operate on patches inclined with respect to " + << "gravity" + << endl; + } + + operator==(n*pow(gTan*mup/(3.0*rhop), 0.333)*pow(Re, 0.666)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::write +( + Ostream& os +) const +{ + fvPatchVectorField::write(os); + GammaMean_->writeData(os); + a_->writeData(os); + omega_->writeData(os); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + inclinedFilmNusseltInletVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..211ea77561df22f3910bc90c0895c22fc11b65b6 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/derivedFvPatchFields/inclinedFilmNusseltInletVelocity/inclinedFilmNusseltInletVelocityFvPatchVectorField.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField + +Description + Film velocity boundary condition for inclined films that imposes a + sinusoidal perturbation on top of a mean flow rate, where the velocity is + calculated using the Nusselt solution. + +SourceFiles + inclinedFilmNusseltInletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef inclinedFilmNusseltInletVelocityFvPatchVectorField_H +#define inclinedFilmNusseltInletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" +#include "DataEntry.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class inclinedFilmNusseltInletVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class inclinedFilmNusseltInletVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Mean mass flow rate per unit length [kg/s/m] + autoPtr<DataEntry<scalar> > GammaMean_; + + //- Perturbation amplitude [m] + autoPtr<DataEntry<scalar> > a_; + + //- Perturbation frequency [rad/s/m] + autoPtr<DataEntry<scalar> > omega_; + + +public: + + //- Runtime type information + TypeName("inclinedFilmNusseltInletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // inclinedFilmNusseltInletVelocityFvPatchVectorField onto a new patch + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new inclinedFilmNusseltInletVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + const inclinedFilmNusseltInletVelocityFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + new inclinedFilmNusseltInletVelocityFvPatchVectorField + ( + *this, iF + ) + ); + } + + + // Member functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 86f5b34b63e550dac6fe049fc115522262d87433..21d86aa6fa8c2f2c64ef1aac41c607a5317b4d47 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -61,7 +61,7 @@ bool kinematicSingleLayer::read() { const dictionary& solution = this->solution().subDict("PISO"); solution.lookup("momentumPredictor") >> momentumPredictor_; - solution.lookup("nOuterCorr") >> nOuterCorr_; + solution.readIfPresent("nOuterCorr", nOuterCorr_); solution.lookup("nCorr") >> nCorr_; solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; @@ -197,6 +197,12 @@ tmp<volScalarField> kinematicSingleLayer::pp() } +void kinematicSingleLayer::correctAlpha() +{ + alpha_ == pos(delta_ - dimensionedScalar("SMALL", dimLength, SMALL)); +} + + void kinematicSingleLayer::updateSubmodels() { if (debug) @@ -276,8 +282,8 @@ void kinematicSingleLayer::updateSurfaceVelocities() Uw_ -= nHat()*(Uw_ & nHat()); Uw_.correctBoundaryConditions(); - // TODO: apply quadratic profile to determine surface velocity - Us_ = U_; + // apply quadratic profile to surface velocity + Us_ = 2.0*U_; Us_.correctBoundaryConditions(); } @@ -302,7 +308,8 @@ tmp<Foam::fvVectorMatrix> kinematicSingleLayer::solveMomentum + fvm::div(phi_, U_) == - USp_ - - fvm::SuSp(rhoSp_, U_) +// - fvm::SuSp(rhoSp_, U_) + - rhoSp_*U_ + forces_.correct(U_) ); @@ -439,7 +446,7 @@ kinematicSingleLayer::kinematicSingleLayer surfaceFilmModel(modelType, mesh, g), momentumPredictor_(solution().subDict("PISO").lookup("momentumPredictor")), - nOuterCorr_(readLabel(solution().subDict("PISO").lookup("nOuterCorr"))), + nOuterCorr_(solution().subDict("PISO").lookupOrDefault("nOuterCorr", 1)), nCorr_(readLabel(solution().subDict("PISO").lookup("nCorr"))), nNonOrthCorr_ ( @@ -503,6 +510,20 @@ kinematicSingleLayer::kinematicSingleLayer ), regionMesh() ), + alpha_ + ( + IOobject + ( + "alpha", + time().timeName(), + regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + regionMesh(), + dimensionedScalar("zero", dimless, 0.0), + zeroGradientFvPatchScalarField::typeName + ), U_ ( IOobject @@ -745,7 +766,7 @@ kinematicSingleLayer::kinematicSingleLayer ( IOobject ( - "mu", // must have same name as mu to enable mapping + "thermo:mu", // must have same name as mu to enable mapping time().timeName(), regionMesh(), IOobject::NO_READ, @@ -817,6 +838,8 @@ void kinematicSingleLayer::preEvolveRegion() Info<< "kinematicSingleLayer::preEvolveRegion()" << endl; } + surfaceFilmModel::preEvolveRegion(); + transferPrimaryRegionThermoFields(); correctThermoFields(); @@ -838,6 +861,8 @@ void kinematicSingleLayer::evolveRegion() Info<< "kinematicSingleLayer::evolveRegion()" << endl; } + correctAlpha(); + updateSubmodels(); // Solve continuity for deltaRho_ @@ -846,7 +871,7 @@ void kinematicSingleLayer::evolveRegion() // Implicit pressure source coefficient - constant tmp<volScalarField> tpp(this->pp()); - for (int oCorr=0; oCorr<nOuterCorr_; oCorr++) + for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++) { // Explicit pressure source contribution - varies with delta_ tmp<volScalarField> tpu(this->pu()); @@ -1025,14 +1050,18 @@ void kinematicSingleLayer::info() const { Info<< "\nSurface film: " << type() << endl; + const vectorField& Uinternal = U_.internalField(); + Info<< indent << "added mass = " << returnReduce<scalar>(addedMassTotal_, sumOp<scalar>()) << nl << indent << "current mass = " << gSum((deltaRho_*magSf())()) << nl - << indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", " - << max(mag(U_)).value() << nl + << indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", " + << gMax(mag(Uinternal)) << nl << indent << "min/max(delta) = " << min(delta_).value() << ", " - << max(delta_).value() << nl; + << max(delta_).value() << nl + << indent << "coverage = " + << gSum(alpha_.internalField()*magSf())/gSum(magSf()) << nl; injection_.info(Info); } diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index b084f885d48905bd801862d658605745658a203f..079999d0cd4e835674f5aef5839a91cc61666e5d 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.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 @@ -113,6 +113,9 @@ protected: //- Film thickness / [m] volScalarField delta_; + //- Film coverage indicator, 1 = covered, 0 = uncovered / [] + volScalarField alpha_; + //- Velocity - mean / [m/s] volVectorField U_; @@ -221,12 +224,15 @@ protected: //- Transfer source fields from the primary region to the film region virtual void transferPrimaryRegionSourceFields(); - // Explicit pressure source contribution + //- Explicit pressure source contribution virtual tmp<volScalarField> pu(); - // Implicit pressure source coefficient + //- Implicit pressure source coefficient virtual tmp<volScalarField> pp(); + //- Correct film coverage field + virtual void correctAlpha(); + //- Update the film sub-models virtual void updateSubmodels(); @@ -323,6 +329,9 @@ public: //- Return const access to the film thickness / [m] inline const volScalarField& delta() const; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + inline const volScalarField& alpha() const; + //- Return the film velocity [m/s] virtual const volVectorField& U() const; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index e717acc430be46b2929e903844263c8f4ec8f124..6a77b614bcad146deb45f56c7546e9d208bbf9ee 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.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 @@ -79,6 +79,12 @@ inline const volScalarField& kinematicSingleLayer::delta() const } +inline const volScalarField& kinematicSingleLayer::alpha() const +{ + return alpha_; +} + + inline volVectorField& kinematicSingleLayer::USpPrimary() { return USpPrimary_; @@ -173,7 +179,8 @@ inline tmp<volScalarField> kinematicSingleLayer::netMass() const { dimensionedScalar d0("SMALL", dimLength, ROOTVSMALL); return - fvc::surfaceSum(phi_/(fvc::interpolate(delta_) + d0))*time().deltaT() + fvc::surfaceSum(pos(phi_)*phi_/(fvc::interpolate(delta_) + d0)) + *time().deltaT() + rho_*delta_*magSf(); } diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 1c267307ec7204794b37823c8706bfdf3e66cdf3..82f3d0afc999ae21d91a7652e748aed4c21e21e8 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.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 @@ -102,10 +102,10 @@ const volScalarField& noFilm::delta() const } -const volScalarField& noFilm::sigma() const +const volScalarField& noFilm::alpha() const { - FatalErrorIn("const volScalarField& noFilm::sigma() const") - << "sigma field not available for " << type() << abort(FatalError); + FatalErrorIn("const volScalarField& noFilm::alpha() const") + << "alpha field not available for " << type() << abort(FatalError); return volScalarField::null(); } @@ -192,6 +192,15 @@ const volScalarField& noFilm::kappa() const } +const volScalarField& noFilm::sigma() const +{ + FatalErrorIn("const volScalarField& noFilm::sigma() const") + << "sigma field not available for " << type() << abort(FatalError); + + return volScalarField::null(); +} + + tmp<volScalarField> noFilm::primaryMassTrans() const { return tmp<volScalarField> diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H b/src/regionModels/surfaceFilmModels/noFilm/noFilm.H index 76501a4fd82cd59c6211251fef1e9a52d3e31608..17915f778806849c0f636023f98aa853dbf39e61 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.H +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.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 @@ -115,8 +115,8 @@ public: //- Return the film thickness [m] virtual const volScalarField& delta() const; - //- Return const access to the surface tension / [m/s2] - inline const volScalarField& sigma() const; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + virtual const volScalarField& alpha() const; //- Return the film velocity [m/s] virtual const volVectorField& U() const; @@ -145,6 +145,9 @@ public: //- Return the film thermal conductivity [W/m/K] virtual const volScalarField& kappa() const; + //- Return const access to the surface tension / [m/s2] + inline const volScalarField& sigma() const; + // Transfer fields - to the primary region diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C index 5f31601474a327835ab8b8fd2b73cf8fb7de2ede..8b9f8a51ddafba18ae6f5591b1f364af1a420c36 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.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 @@ -52,7 +52,6 @@ contactAngleForce::contactAngleForce ) : force(typeName, owner, dict), - deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), Ccf_(readScalar(coeffs_.lookup("Ccf"))), rndGen_(label(0), -1), distribution_ @@ -82,7 +81,7 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) ( IOobject ( - "contactForce", + typeName + ".contactForce", owner_.time().timeName(), owner_.regionMesh(), IOobject::NO_READ, @@ -100,17 +99,11 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) const scalarField& magSf = owner_.magSf(); - const volScalarField& delta = owner_.delta(); + const volScalarField& alpha = owner_.alpha(); const volScalarField& sigma = owner_.sigma(); - volScalarField alpha - ( - "alpha", - pos(delta - dimensionedScalar("deltaWet", dimLength, deltaWet_)) - ); volVectorField gradAlpha(fvc::grad(alpha)); - scalarField nHits(owner_.regionMesh().nCells(), 0.0); forAll(nbr, faceI) @@ -119,19 +112,17 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) const label cellN = nbr[faceI]; label cellI = -1; - if ((delta[cellO] > deltaWet_) && (delta[cellN] < deltaWet_)) + if ((alpha[cellO] > 0.5) && (alpha[cellN] < 0.5)) { cellI = cellO; } - else if ((delta[cellO] < deltaWet_) && (delta[cellN] > deltaWet_)) + else if ((alpha[cellO] < 0.5) && (alpha[cellN] > 0.5)) { cellI = cellN; } if (cellI != -1) { -// const scalar dx = Foam::sqrt(magSf[cellI]); - // bit of a cheat, but ok for regular meshes const scalar dx = owner_.regionMesh().deltaCoeffs()[faceI]; const vector n = gradAlpha[cellI]/(mag(gradAlpha[cellI]) + ROOTVSMALL); @@ -141,23 +132,26 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) } } - forAll(delta.boundaryField(), patchI) + forAll(alpha.boundaryField(), patchI) { - const fvPatchField<scalar>& df = delta.boundaryField()[patchI]; - const scalarField& dx = df.patch().deltaCoeffs(); - const labelUList& faceCells = df.patch().faceCells(); - - forAll(df, faceI) + if (!owner().isCoupledPatch(patchI)) { - label cellO = faceCells[faceI]; + const fvPatchField<scalar>& alphaf = alpha.boundaryField()[patchI]; + const scalarField& dx = alphaf.patch().deltaCoeffs(); + const labelUList& faceCells = alphaf.patch().faceCells(); - if ((delta[cellO] > deltaWet_) && (df[faceI] < deltaWet_)) + forAll(alphaf, faceI) { - const vector n = - gradAlpha[cellO]/(mag(gradAlpha[cellO]) + ROOTVSMALL); - scalar theta = cos(degToRad(distribution_->sample())); - force[cellO] += Ccf_*n*sigma[cellO]*(1.0 - theta)/dx[faceI]; - nHits[cellO]++; + label cellO = faceCells[faceI]; + + if ((alpha[cellO] > 0.5) && (alphaf[faceI] < 0.5)) + { + const vector n = + gradAlpha[cellO]/(mag(gradAlpha[cellO]) + ROOTVSMALL); + scalar theta = cos(degToRad(distribution_->sample())); + force[cellO] += Ccf_*n*sigma[cellO]*(1.0 - theta)/dx[faceI]; + nHits[cellO]++; + } } } } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H index 2ed08e02eeaf16e0872768d3ab6ee1c66ffec6b8..8a6dc7a8b3be713ba44e89c9746669b5deea4b1d 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForce/contactAngleForce.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 @@ -60,9 +60,6 @@ private: // Private Data - //- Threshold film thickness beyon which the film is 'wet' - scalar deltaWet_; - //- Coefficient applied to the contact angle force scalar Ccf_; diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C index c5419d2909b880014daa0c6c5b48a5cf4560cfcf..a2c910c412397d0a85ca7b0447af260a3701d298 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/surfaceShearForce/surfaceShearForce.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 @@ -80,11 +80,11 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U) tmp<volScalarField> tCs; typedef compressible::turbulenceModel turbModel; - if (film.primaryMesh().foundObject<turbModel>("turbulenceProperties")) + if (film.primaryMesh().foundObject<turbModel>("turbulenceModel")) { // local reference to turbulence model const turbModel& turb = - film.primaryMesh().lookupObject<turbModel>("turbulenceProperties"); + film.primaryMesh().lookupObject<turbModel>("turbulenceModel"); // calculate and store the stress on the primary region const volSymmTensorField primaryReff(turb.devRhoReff()); @@ -117,13 +117,23 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U) Reff.correctBoundaryConditions(); dimensionedScalar U0("SMALL", U.dimensions(), SMALL); - tCs = Cf_*mag(-film.nHat() & Reff)/(mag(Up - U) + U0); + volVectorField UHat("UHat", (Up - U)/(mag(Up - U) + U0)); + + // shear stress tangential to the film + volVectorField tauTan + ( + "tauTan", + UHat & (Reff + film.nHat()*(-film.nHat() & Reff)) + ); + + // note: Cf_ 'should' be 1 in this case + tCs = Cf_*mag(tauTan)/(mag(Up - U) + U0); } else { // laminar case - employ simple coeff-based model - const volScalarField& rho = film.rho(); - tCs = Cf_*rho*mag(Up - U); + const volScalarField& rhop = film.rhoPrimary(); + tCs = Cf_*rhop*mag(Up - U); } dimensionedScalar d0("SMALL", delta.dimensions(), SMALL); @@ -131,7 +141,7 @@ tmp<fvVectorMatrix> surfaceShearForce::correct(volVectorField& U) // linear coeffs to apply to velocity const volScalarField& Cs = tCs(); volScalarField Cw("Cw", mu/(0.3333*(delta + d0))); - Cw.min(1.0e+06); + Cw.min(5000.0); return ( diff --git a/src/regionModels/surfaceFilmModels/submodels/subModelBase.C b/src/regionModels/surfaceFilmModels/submodels/subModelBase.C index 469b62e855599055e2ebd7daee86ed27a00bd7e7..b2283172b39c913783fdc84fea23aa0d2e7f211d 100644 --- a/src/regionModels/surfaceFilmModels/submodels/subModelBase.C +++ b/src/regionModels/surfaceFilmModels/submodels/subModelBase.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 @@ -51,7 +51,7 @@ subModelBase::subModelBase ) : owner_(owner), - coeffs_(dict.subDict(type + "Coeffs")) + coeffs_(dict.subOrEmptyDict(type + "Coeffs")) {} diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C new file mode 100644 index 0000000000000000000000000000000000000000..f7e1b821432e644d405d2242a825c98596e2c8e3 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C @@ -0,0 +1,146 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "constantRadiation.H" +#include "volFields.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(constantRadiation, 0); + +addToRunTimeSelectionTable +( + filmRadiationModel, + constantRadiation, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +constantRadiation::constantRadiation +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmRadiationModel(typeName, owner, dict), + QrConst_ + ( + IOobject + ( + typeName + "::QrConst", + owner.time().timeName(), + owner.regionMesh(), + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + owner.regionMesh() + ), + mask_ + ( + IOobject + ( + typeName + "::mask", + owner.time().timeName(), + owner.regionMesh(), + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + owner.regionMesh(), + dimensionedScalar("one", dimless, 1.0) + ), + absorptivity_(readScalar(coeffs_.lookup("absorptivity"))), + timeStart_(readScalar(coeffs_.lookup("timeStart"))), + duration_(readScalar(coeffs_.lookup("duration"))) +{ + mask_ = pos(mask_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +constantRadiation::~constantRadiation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void constantRadiation::correct() +{} + + +tmp<volScalarField> constantRadiation::Shs() +{ + tmp<volScalarField> tShs + ( + new volScalarField + ( + IOobject + ( + typeName + "::Shs", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + const scalar time = owner().time().value(); + + if ((time >= timeStart_) && (time <= timeStart_ + duration_)) + { + scalarField& Shs = tShs(); + const scalarField& Qr = QrConst_.internalField(); + const scalarField& alpha = owner_.alpha().internalField(); + + Shs = mask_*Qr*alpha*absorptivity_; + } + + return tShs; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H new file mode 100644 index 0000000000000000000000000000000000000000..911d53e461a422578d64f39919ba093752a01113 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.H @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::constantRadiation + +Description + Film constant radiation model. The constant radiative flux is specified + by the user, and operated over a time interval defined by a start time and + duration. In addition, a mask can be applied to shield the film from the + radiation. + +SourceFiles + constantRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantRadiation_H +#define constantRadiation_H + +#include "filmRadiationModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantRadiation Declaration +\*---------------------------------------------------------------------------*/ + +class constantRadiation +: + public filmRadiationModel +{ +private: + + // Private data + + //- Constant radiative flux [kg/s3] + volScalarField QrConst_; + + //- Radiation mask + volScalarField mask_; + + //- Absorptivity + scalar absorptivity_; + + //- Time start [s] + const scalar timeStart_; + + //- Duration [s] + const scalar duration_; + + + // Private member functions + + //- Disallow default bitwise copy construct + constantRadiation(const constantRadiation&); + + //- Disallow default bitwise assignment + void operator=(const constantRadiation&); + + +public: + + //- Runtime type information + TypeName("constantRadiation"); + + + // Constructors + + //- Construct from surface film model and dictionary + constantRadiation + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~constantRadiation(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); + + //- Return the radiation sensible enthalpy source + // Also updates QrNet + virtual tmp<volScalarField> Shs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C new file mode 100644 index 0000000000000000000000000000000000000000..2fdccf63f76db32f078bd76d436202119f1d016d --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "primaryRadiation.H" +#include "volFields.H" +#include "zeroGradientFvPatchFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(primaryRadiation, 0); + +addToRunTimeSelectionTable +( + filmRadiationModel, + primaryRadiation, + dictionary +); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +primaryRadiation::primaryRadiation +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmRadiationModel(typeName, owner, dict), + QinPrimary_ + ( + IOobject + ( + "Qin", // same name as Qin on primary region to enable mapping + owner.time().timeName(), + owner.regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner.regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + owner.mappedPushedFieldPatchTypes<scalar>() + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +primaryRadiation::~primaryRadiation() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void primaryRadiation::correct() +{ + // Transfer Qin from primary region + QinPrimary_.correctBoundaryConditions(); +} + + +tmp<volScalarField> primaryRadiation::Shs() +{ + tmp<volScalarField> tShs + ( + new volScalarField + ( + IOobject + ( + typeName + "::Shs", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& Shs = tShs(); + const scalarField& QinP = QinPrimary_.internalField(); + const scalarField& alpha = owner_.alpha().internalField(); + + Shs = QinP*alpha; + + return tShs; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H new file mode 100644 index 0000000000000000000000000000000000000000..a8904cb1e2100ea4ebd8e4f8e9f0275ad4435e2f --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.H @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::primaryRadiation + +Description + Radiation model whereby the radiative heat flux is mapped from the primary + region + +SourceFiles + primaryRadiation.C + +\*---------------------------------------------------------------------------*/ + +#ifndef primaryRadiation_H +#define primaryRadiation_H + +#include "filmRadiationModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class primaryRadiation Declaration +\*---------------------------------------------------------------------------*/ + +class primaryRadiation +: + public filmRadiationModel +{ +private: + + // Private data + + //- Incident radiative flux mapped from the primary region / [kg/s3] + volScalarField QinPrimary_; + + + // Private member functions + + //- Disallow default bitwise copy construct + primaryRadiation(const primaryRadiation&); + + //- Disallow default bitwise assignment + void operator=(const primaryRadiation&); + + +public: + + //- Runtime type information + TypeName("primaryRadiation"); + + + // Constructors + + //- Construct from surface film model and dictionary + primaryRadiation + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~primaryRadiation(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); + + //- Return the radiation sensible enthalpy source + // Also updates QrNet + virtual tmp<volScalarField> Shs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C index be5460757fe76f12808d2b5eb48f44456632af90..1ff32747161d746d71b3b9e8c82f9af7deec74c8 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C @@ -85,8 +85,6 @@ standardRadiation::standardRadiation dimensionedScalar("zero", dimMass/pow3(dimTime), 0.0), zeroGradientFvPatchScalarField::typeName ), - delta_(owner.delta()), - deltaMin_(readScalar(coeffs_.lookup("deltaMin"))), beta_(readScalar(coeffs_.lookup("beta"))), kappaBar_(readScalar(coeffs_.lookup("kappaBar"))) {} @@ -129,9 +127,10 @@ tmp<volScalarField> standardRadiation::Shs() scalarField& Shs = tShs(); const scalarField& QinP = QinPrimary_.internalField(); - const scalarField& delta = delta_.internalField(); + const scalarField& delta = owner_.delta().internalField(); + const scalarField& alpha = owner_.alpha().internalField(); - Shs = beta_*(QinP*pos(delta - deltaMin_))*(1.0 - exp(-kappaBar_*delta)); + Shs = beta_*QinP*alpha*(1.0 - exp(-kappaBar_*delta)); // Update net Qr on local region QrNet_.internalField() = QinP - Shs; diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H index 9b96fb60fe189f33f3415f585f333af01cabadc3..799bb6c64934962f5f8c08e694a1b22486608abe 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.H @@ -65,15 +65,9 @@ private: //- Remaining radiative flux after removing local contribution volScalarField QrNet_; - //- Reference to the film thickness field / [m] - const volScalarField& delta_; - // Model coefficients - //- Minimum thickness to apply radiation model - scalar deltaMin_; - //- Beta coefficient scalar beta_; diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C index 552bd0dda447264962d23889c21f85fff4daee1c..4a08755ee3e68a1950074fc80295882222d421c3 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.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 @@ -77,7 +77,6 @@ standardPhaseChange::standardPhaseChange ) : phaseChangeModel(typeName, owner, dict), - Tb_(readScalar(coeffs_.lookup("Tb"))), deltaMin_(readScalar(coeffs_.lookup("deltaMin"))), L_(readScalar(coeffs_.lookup("L"))), TbFactor_(coeffs_.lookupOrDefault<scalar>("TbFactor", 1.1)) @@ -113,14 +112,10 @@ void standardPhaseChange::correctModel const scalarField& YInf = film.YPrimary()[vapId]; const scalarField& pInf = film.pPrimary(); const scalarField& T = film.T(); - const scalarField& Tw = film.Tw(); const scalarField& rho = film.rho(); - const scalarField& TInf = film.TPrimary(); const scalarField& rhoInf = film.rhoPrimary(); const scalarField& muInf = film.muPrimary(); const scalarField& magSf = film.magSf(); - const scalarField hInf(film.htcs().h()); - const scalarField hFilm(film.htcw().h()); const vectorField dU(film.UPrimary() - film.Us()); const scalarField limMass ( @@ -134,8 +129,11 @@ void standardPhaseChange::correctModel // cell pressure [Pa] const scalar pc = pInf[cellI]; + // calculate the boiling temperature + const scalar Tb = liq.pvInvert(pc); + // local temperature - impose lower limit of 200 K for stability - const scalar Tloc = min(TbFactor_*Tb_, max(200.0, T[cellI])); + const scalar Tloc = min(TbFactor_*Tb, max(200.0, T[cellI])); // saturation pressure [Pa] const scalar pSat = liq.pv(pc, Tloc); @@ -147,15 +145,10 @@ void standardPhaseChange::correctModel if (pSat >= 0.95*pc) { // boiling - const scalar qDotInf = hInf[cellI]*(TInf[cellI] - T[cellI]); - const scalar qDotFilm = hFilm[cellI]*(T[cellI] - Tw[cellI]); - const scalar Cp = liq.Cp(pc, Tloc); - const scalar Tcorr = max(0.0, T[cellI] - Tb_); + const scalar Tcorr = max(0.0, T[cellI] - Tb); const scalar qCorr = limMass[cellI]*Cp*(Tcorr); - dMass[cellI] = - dt*magSf[cellI]/hVap*(qDotInf + qDotFilm) - + qCorr/hVap; + dMass[cellI] = qCorr/hVap; } else { diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H index 1fff3384ff87c90ad93f9b0f9ac08db0b26f753f..ee1b21d6d0adfd80ad1e6d42c1e2612c699bb074 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.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 @@ -69,9 +69,6 @@ protected: // Protected data - //- Boiling temperature / [K] - const scalar Tb_; - //- Minimum film height for model to be active const scalar deltaMin_; diff --git a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H index 32c71b3fed7205e411bbb24282e941253cc209ae..2aa442319670d96c026ecd5d296d704fee6aee36 100644 --- a/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.H +++ b/src/regionModels/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel.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 @@ -186,6 +186,9 @@ public: //- Return the film thickness [m] virtual const volScalarField& delta() const = 0; + //- Return the film coverage, 1 = covered, 0 = uncovered / [] + virtual const volScalarField& alpha() const = 0; + //- Return the film velocity [m/s] virtual const volVectorField& U() const = 0; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 1cb392eb6aae39549fc56095e0c6908e382cf919..e6cee26e0342b63b720caae1dcf6637eeedda28b 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -227,6 +227,33 @@ void thermoSingleLayer::transferPrimaryRegionSourceFields() } +void thermoSingleLayer::correctAlpha() +{ + if (hydrophilic_) + { + const scalar hydrophilicDry = hydrophilicDryScale_*deltaWet_; + const scalar hydrophilicWet = hydrophilicWetScale_*deltaWet_; + + forAll(alpha_, i) + { + if ((alpha_[i] < 0.5) && (delta_[i] > hydrophilicWet)) + { + alpha_[i] = 1.0; + } + else if ((alpha_[i] > 0.5) && (delta_[i] < hydrophilicDry)) + { + alpha_[i] = 0.0; + } + } + } + else + { + alpha_ == + pos(delta_ - dimensionedScalar("deltaWet", dimLength, deltaWet_)); + } +} + + void thermoSingleLayer::updateSubmodels() { if (debug) @@ -290,7 +317,8 @@ void thermoSingleLayer::solveEnergy() - hsSp_ + q(hs_) + radiation_->Shs() - - fvm::SuSp(rhoSp_, hs_) +// - fvm::SuSp(rhoSp_, hs_) + - rhoSp_*hs_ ); correctThermoFields(); @@ -426,6 +454,11 @@ thermoSingleLayer::thermoSingleLayer zeroGradientFvPatchScalarField::typeName ), + deltaWet_(readScalar(coeffs_.lookup("deltaWet"))), + hydrophilic_(readBool(coeffs_.lookup("hydrophilic"))), + hydrophilicDryScale_(0.0), + hydrophilicWetScale_(0.0), + hsSp_ ( IOobject @@ -481,8 +514,20 @@ thermoSingleLayer::thermoSingleLayer heatTransferModel::New(*this, coeffs().subDict("lowerSurfaceModels")) ), phaseChange_(phaseChangeModel::New(*this, coeffs())), - radiation_(filmRadiationModel::New(*this, coeffs())) + radiation_(filmRadiationModel::New(*this, coeffs())), + Tmin_(-VGREAT), + Tmax_(VGREAT) { + if (coeffs().readIfPresent("Tmin", Tmin_)) + { + Info<< " limiting minimum temperature to " << Tmin_ << endl; + } + + if (coeffs().readIfPresent("Tmax", Tmax_)) + { + Info<< " limiting maximum temperature to " << Tmax_ << endl; + } + if (thermo_.hasMultiComponentCarrier()) { YPrimary_.setSize(thermo_.carrier().species().size()); @@ -510,6 +555,12 @@ thermoSingleLayer::thermoSingleLayer } } + if (hydrophilic_) + { + coeffs_.lookup("hydrophilicDryScale") >> hydrophilicDryScale_; + coeffs_.lookup("hydrophilicWetScale") >> hydrophilicWetScale_; + } + if (readFields) { transferPrimaryRegionThermoFields(); @@ -584,12 +635,14 @@ void thermoSingleLayer::evolveRegion() Info<< "thermoSingleLayer::evolveRegion()" << endl; } + correctAlpha(); + updateSubmodels(); // Solve continuity for deltaRho_ solveContinuity(); - for (int oCorr=0; oCorr<nOuterCorr_; oCorr++) + for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++) { // Explicit pressure source contribution tmp<volScalarField> tpu(this->pu()); @@ -674,8 +727,10 @@ void thermoSingleLayer::info() const { kinematicSingleLayer::info(); - Info<< indent << "min/max(T) = " << min(T_).value() << ", " - << max(T_).value() << nl; + const scalarField& Tinternal = T_.internalField(); + + Info<< indent << "min/max(T) = " << gMin(Tinternal) << ", " + << gMax(Tinternal) << nl; phaseChange_->info(Info); } diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index 6814e25a3e4c0e934378bd72b0e77d2a55110358..b13c8ac3b012406f9e3e5f7679ebaa1dd4055067 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.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 @@ -123,6 +123,24 @@ protected: volScalarField primaryEnergyPCTrans_; + //- Threshold film thickness beyond which the film is considered 'wet' + scalar deltaWet_; + + + // Hyprophilic/phobic properties + + //- Activation flag + bool hydrophilic_; + + //- Length scale applied to deltaWet_ to determine when a wet + // surface becomes dry, typically 0.5 + scalar hydrophilicDryScale_; + + //- Length scale applied to deltaWet_ to determine when a dry + // surface becomes wet, typically 0.001 + scalar hydrophilicWetScale_; + + // Source term fields // Film region - registered to the film region mesh @@ -166,6 +184,14 @@ protected: autoPtr<filmRadiationModel> radiation_; + // Limits + + //- Minimum temperature limit (optional) + scalar Tmin_; + + //- Maximum temperature limit (optional) + scalar Tmax_; + // Protected member functions @@ -190,6 +216,9 @@ protected: //- Transfer source fields from the primary region to the film region virtual void transferPrimaryRegionSourceFields(); + //- Correct film coverage field + virtual void correctAlpha(); + //- Update the film sub-models virtual void updateSubmodels(); @@ -342,6 +371,15 @@ public: inline const filmRadiationModel& radiation() const; + // Derived fields (calculated on-the-fly) + + //- Return the convective heat energy from film to wall + inline tmp<scalarField> Qconvw(const label patchI) const; + + //- Return the convective heat energy from primary region to film + inline tmp<scalarField> Qconvp(const label patchI) const; + + // Evolution //- Pre-evolve film hook diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index 73dc08496b64a1543be3ba563ae492f2efc814d4..659a315f4916487eedfe0a8ce0db10f32705c50d 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.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 @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "thermoSingleLayer.H" +#include "heatTransferModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -88,7 +89,7 @@ inline tmp<volScalarField> thermoSingleLayer::T const volScalarField& hs ) const { - return tmp<volScalarField> + tmp<volScalarField> tT ( new volScalarField ( @@ -104,6 +105,11 @@ inline tmp<volScalarField> thermoSingleLayer::T zeroGradientFvPatchScalarField::typeName ) ); + + tT().min(Tmax_); + tT().max(Tmin_); + + return tT; } @@ -155,6 +161,26 @@ inline const filmRadiationModel& thermoSingleLayer::radiation() const } +inline tmp<scalarField> thermoSingleLayer::Qconvw(const label patchI) const +{ + const scalarField htc(htcw_->h()().boundaryField()[patchI]); + const scalarField& Tp = T_.boundaryField()[patchI]; + const scalarField& Twp = Tw_.boundaryField()[patchI]; + + return htc*(Tp - Twp); +} + + +inline tmp<scalarField> thermoSingleLayer::Qconvp(const label patchI) const +{ + const scalarField htc(htcs_->h()().boundaryField()[patchI]); + const scalarField& Tp = T_.boundaryField()[patchI]; + const scalarField& Tpp = TPrimary_.boundaryField()[patchI]; + + return htc*(Tp - Tpp); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels diff --git a/src/regionModels/thermoBaffleModels/Make/options b/src/regionModels/thermoBaffleModels/Make/options index 2c0e2cf57ca23b57686ac288837710aa4ba0174d..21a54595be530da1a87d94e9e1aacdedb522cdea 100644 --- a/src/regionModels/thermoBaffleModels/Make/options +++ b/src/regionModels/thermoBaffleModels/Make/options @@ -3,7 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/AMIInterpolation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 8c5227dbf206a2ec9cf3560c42e10d82435ae6ca..ef0415f0f24848e1ea802c699731ac6587d69a29 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -5,7 +5,6 @@ probes/probesFunctionObject/probesFunctionObject.C sampledSet/circle/circleSet.C sampledSet/cloud/cloudSet.C -sampledSet/coordSet/coordSet.C sampledSet/patchCloud/patchCloudSet.C sampledSet/polyLine/polyLineSet.C sampledSet/face/faceOnlySet.C @@ -20,17 +19,6 @@ sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C sampledSet/uniform/uniformSet.C sampledSet/array/arraySet.C -setWriters = sampledSet/writers - -$(setWriters)/writers.C -$(setWriters)/ensight/ensightSetWriterRunTime.C -$(setWriters)/gnuplot/gnuplotSetWriterRunTime.C -$(setWriters)/jplot/jplotSetWriterRunTime.C -$(setWriters)/raw/rawSetWriterRunTime.C -$(setWriters)/vtk/vtkSetWriterRunTime.C -$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C -$(setWriters)/csv/csvSetWriterRunTime.C - cuttingPlane/cuttingPlane.C sampledSurface/sampledPatch/sampledPatch.C diff --git a/src/sampling/Make/options b/src/sampling/Make/options index 3fbc509d541cb70355abee9f03412bea6c2d2528..23e6bc81a7e708d69b5fd14d27073827646e14ef 100644 --- a/src/sampling/Make/options +++ b/src/sampling/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/surfMesh/lnInclude \ + -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/conversion/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude @@ -10,6 +11,7 @@ LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ -lsurfMesh \ + -lfileFormats \ -ltriSurface \ -llagrangian \ -lconversion diff --git a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C index fa495c40ce5dfd76497becf67d4a0f07682443cb..3cbd5fd02f3fdc95e877b31228dfdb03d7c8277a 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.C +++ b/src/sampling/meshToMeshInterpolation/meshToMesh/meshToMesh.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 @@ -27,12 +27,16 @@ License #include "processorFvPatch.H" #include "demandDrivenData.H" - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::meshToMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(meshToMesh, 0); +} + const Foam::scalar Foam::meshToMesh::directHitTol = 1e-5; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::meshToMesh::meshToMesh diff --git a/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C b/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C index 43061586dedbe83f43f6c2945b011862a4a313e7..219d78ce761c5532b00b5195681451878cf39ffd 100644 --- a/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C +++ b/src/sampling/meshToMeshInterpolation/tetOverlapVolume/tetOverlapVolume.C @@ -34,7 +34,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::tetOverlapVolume, 0); +namespace Foam +{ +defineTypeNameAndDebug(tetOverlapVolume, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index 4e2a0aa06076dab13c48a707cce356d2f2a48feb..8652fa9a25cfc21cf4b6121d0e64648203394fd7 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.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 @@ -31,7 +31,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::probes, 0); +namespace Foam +{ +defineTypeNameAndDebug(probes, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/probes/probes.H b/src/sampling/probes/probes.H index 9634d626dd07d1fc8c840702cee1c17a33224dfb..85a3928fdcae70f2f149b02e3e2225a7f9cf0b36 100644 --- a/src/sampling/probes/probes.H +++ b/src/sampling/probes/probes.H @@ -254,7 +254,7 @@ public: {} //- Update for changes of mesh - virtual void movePoints(const pointField&) + virtual void movePoints(const polyMesh&) {} //- Update for changes of mesh due to readUpdate diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 340b5cd091d40fdb5bf1ec7316cfa96d9f9bb62e..803190a4a197337af6907b42681de15a69947eae 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.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 @@ -33,8 +33,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::sampledSets, 0); -bool Foam::sampledSets::verbose_ = false; +namespace Foam +{ +defineTypeNameAndDebug(sampledSets, 0); +bool sampledSets::verbose_ = false; +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -302,7 +305,7 @@ void Foam::sampledSets::updateMesh(const mapPolyMesh&) } -void Foam::sampledSets::movePoints(const pointField&) +void Foam::sampledSets::movePoints(const polyMesh&) { correct(); } diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.H b/src/sampling/sampledSet/sampledSets/sampledSets.H index 2007cda3d5af6d49873371f0a7443c126b641fd1..2b4987303d2962f4d9eacc5f55f5c2135147ea92 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.H +++ b/src/sampling/sampledSet/sampledSets/sampledSets.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 @@ -301,7 +301,7 @@ public: virtual void updateMesh(const mapPolyMesh&); //- Update for mesh point-motion - virtual void movePoints(const pointField&); + virtual void movePoints(const polyMesh&); //- Update for changes of mesh due to readUpdate virtual void readUpdate(const polyMesh::readUpdateState state); diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index f96983d27ac657fa9c2224748091ea25672ccd2c..7fc707494375e5183bd6df4fa5f60536222e2ebb 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.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 @@ -35,7 +35,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::isoSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(isoSurface, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C index 53f99b67c03569c11ebe2e46d00b401b6581c2b1..8123541ebee8bbabcf84c9586a0bc523b5d90c6a 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurfaceCell.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 @@ -33,7 +33,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::isoSurfaceCell, 0); +namespace Foam +{ +defineTypeNameAndDebug(isoSurfaceCell, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 6287722ae5e06896ae40cb48a1fbf30780673ed6..4a6425105307d82dc35af89b38d70449ffe77c66 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -33,10 +33,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::sampledSurfaces, 0); +namespace Foam +{ +defineTypeNameAndDebug(sampledSurfaces, 0); +} + + bool Foam::sampledSurfaces::verbose_ = false; + Foam::scalar Foam::sampledSurfaces::mergeTol_ = 1e-10; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::sampledSurfaces::writeGeometry() const @@ -248,7 +255,7 @@ void Foam::sampledSurfaces::updateMesh(const mapPolyMesh&) } -void Foam::sampledSurfaces::movePoints(const pointField&) +void Foam::sampledSurfaces::movePoints(const polyMesh&) { expire(); } diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index f16a2ceabfda48b57d7221c8f99602d59fd6e0df..5278e850e9d98c28b987bf33c0adf5e56603c0c5 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.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 @@ -230,7 +230,7 @@ public: virtual void updateMesh(const mapPolyMesh&); //- Update for mesh point-motion - expires the surfaces - virtual void movePoints(const pointField&); + virtual void movePoints(const polyMesh&); //- Update for changes of mesh due to readUpdate - expires the surfaces virtual void readUpdate(const polyMesh::readUpdateState state); diff --git a/src/sampling/sampledSurface/thresholdCellFaces/thresholdCellFaces.C b/src/sampling/sampledSurface/thresholdCellFaces/thresholdCellFaces.C index 63c76f641aa547e5cd22e89268b0205cb2057072..81f46165c244049037d13df3e49543d9eccdccf6 100644 --- a/src/sampling/sampledSurface/thresholdCellFaces/thresholdCellFaces.C +++ b/src/sampling/sampledSurface/thresholdCellFaces/thresholdCellFaces.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 @@ -34,7 +34,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::thresholdCellFaces, 0); +namespace Foam +{ +defineTypeNameAndDebug(thresholdCellFaces, 0); +} + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C index e01429fc88cbea5018d7f5bcb128927df49341ea..e43dc5757fe2762dce15951679509b37e456ab48 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C @@ -25,6 +25,7 @@ License #include "OFstream.H" #include "IOmanip.H" +#include "OSspecific.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index dd54a756c69f1b927d20882f0259ce093200ebe6..84ca3cdf5d57ba6e38c2326eed2bef5aad6f1ec4 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -35,7 +35,6 @@ SourceFiles #ifndef surfaceWriter_H #define surfaceWriter_H -#include "volFields.H" #include "typeInfo.H" #include "autoPtr.H" #include "pointField.H" diff --git a/src/surfMesh/surfMesh/surfMesh.C b/src/surfMesh/surfMesh/surfMesh.C index 3f5d71c5712f98ab3be7b0e5b44cfc1bc63a2538..88a74271355bb10843bbea99b7facc0b67bc3941 100644 --- a/src/surfMesh/surfMesh/surfMesh.C +++ b/src/surfMesh/surfMesh/surfMesh.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 @@ -33,7 +33,11 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfMesh, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfMesh, 0); +} + Foam::word Foam::surfMesh::meshSubDir = "surfMesh"; diff --git a/src/surfMesh/surfZone/surfZone/surfZone.C b/src/surfMesh/surfZone/surfZone/surfZone.C index a4370eb1222436f761363bff5e223a463f4d7746..faab2394569cb012e42f8a59fb8e774466a9f33f 100644 --- a/src/surfMesh/surfZone/surfZone/surfZone.C +++ b/src/surfMesh/surfZone/surfZone/surfZone.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 @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfZone, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfZone, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/surfMesh/surfZone/surfZone/surfZoneIOList.C b/src/surfMesh/surfZone/surfZone/surfZoneIOList.C index b3adbce76275dd26fd54fe9c70c3c5afd2764d21..745fec325f02ba16a2103ee0ce37516dfa995a76 100644 --- a/src/surfMesh/surfZone/surfZone/surfZoneIOList.C +++ b/src/surfMesh/surfZone/surfZone/surfZoneIOList.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfZoneIOList, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfZoneIOList, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/surfMesh/surfaceFormats/obj/OBJstream.C b/src/surfMesh/surfaceFormats/obj/OBJstream.C index ca24b6b6aa2a54c07fa7c471ee392614e4f7ef21..ce0eb2721b54ae2a303e64344b6d3962ff03c85d 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJstream.C +++ b/src/surfMesh/surfaceFormats/obj/OBJstream.C @@ -29,7 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::OBJstream, 0); +namespace Foam +{ +defineTypeNameAndDebug(OBJstream, 0); +} // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -238,6 +241,38 @@ Foam::Ostream& Foam::OBJstream::write(const linePointRef& ln) } +Foam::Ostream& Foam::OBJstream::write +( + const triPointRef& f, + const bool lines +) +{ + label start = nVertices_; + write(f.a()); + write(f.b()); + write(f.c()); + if (lines) + { + write('l'); + for (int i = 0; i < 3; i++) + { + write(' ') << start+1+i; + } + write(' ') << start+1 << '\n'; + } + else + { + write('f'); + for (int i = 0; i < 3; i++) + { + write(' ') << start+1+i; + } + write('\n'); + } + return *this; +} + + Foam::Ostream& Foam::OBJstream::write ( const face& f, diff --git a/src/surfMesh/surfaceFormats/obj/OBJstream.H b/src/surfMesh/surfaceFormats/obj/OBJstream.H index 9e62cbdbebcc186bc31ba5384bd984f00915f67d..ec7e93d24ea0184ff3c840f9ae902fa46a90c821 100644 --- a/src/surfMesh/surfaceFormats/obj/OBJstream.H +++ b/src/surfMesh/surfaceFormats/obj/OBJstream.H @@ -39,13 +39,14 @@ SourceFiles #include "point.H" #include "edge.H" #include "face.H" +#include "triPointRef.H" +#include "linePointRef.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - /*---------------------------------------------------------------------------*\ Class OBJstream Declaration \*---------------------------------------------------------------------------*/ @@ -134,6 +135,9 @@ public: //- Write line Ostream& write(const linePointRef&); + //- Write triangle as points with lines or filled polygon + Ostream& write(const triPointRef&, const bool lines = true); + //- Write face as points with lines or filled polygon Ostream& write ( diff --git a/src/surfMesh/surfaceFormats/surfaceFormatsCore.C b/src/surfMesh/surfaceFormats/surfaceFormatsCore.C index c1d1aac7acae2753ec2839ff61de09f10d92a668..c098eaf1b9114eb7df187633c0f77ca130010dc5 100644 --- a/src/surfMesh/surfaceFormats/surfaceFormatsCore.C +++ b/src/surfMesh/surfaceFormats/surfaceFormatsCore.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 @@ -105,7 +105,7 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshInstance } } - return "constant"; + return t.constant(); } @@ -148,7 +148,7 @@ Foam::fileName Foam::fileFormats::surfaceFormatsCore::findMeshFile } // fallback to "constant" - return t.path()/"constant"/localName; + return t.path()/t.constant()/localName; } #endif diff --git a/src/surfMesh/surfaceRegistry/surfaceRegistry.C b/src/surfMesh/surfaceRegistry/surfaceRegistry.C index 716612eb5901d12a3c1af832bef02c4bd190e333..227481d7efadf9367d2e4b84c1901088fb71f593 100644 --- a/src/surfMesh/surfaceRegistry/surfaceRegistry.C +++ b/src/surfMesh/surfaceRegistry/surfaceRegistry.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 @@ -28,11 +28,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfaceRegistry, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfaceRegistry, 0); +} + const Foam::word Foam::surfaceRegistry::prefix("surfaces"); Foam::word Foam::surfaceRegistry::defaultName("default"); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::surfaceRegistry::surfaceRegistry diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index f1ac31e4593d968bde59175420cf1e82e93a2b92..e2fc874b5ef6ba930a1c85a745cf2032891c6e86 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -34,16 +34,56 @@ namespace Foam defineRunTimeSelectionTable(basicThermo, fvMesh); } +const Foam::word Foam::basicThermo::dictName("thermophysicalProperties"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::basicThermo::basicThermo(const fvMesh& mesh) +Foam::volScalarField& Foam::basicThermo::lookupOrConstruct +( + const fvMesh& mesh, + const char* name +) const +{ + if (!mesh.objectRegistry::foundObject<volScalarField>(name)) + { + volScalarField* fPtr + ( + new volScalarField + ( + IOobject + ( + name, + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + + // Transfer ownership of this object to the objectRegistry + fPtr->store(fPtr); + } + + return const_cast<volScalarField&> + ( + mesh.objectRegistry::lookupObject<volScalarField>(name) + ); +} + + +Foam::basicThermo::basicThermo +( + const fvMesh& mesh, + const word& phaseName +) : IOdictionary ( IOobject ( - "thermophysicalProperties", + phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, @@ -51,24 +91,15 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh) ) ), - p_ - ( - IOobject - ( - "p", - mesh.time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ), + phaseName_(phaseName), + + p_(lookupOrConstruct(mesh, "p")), T_ ( IOobject ( - "T", + phasePropertyName("T"), mesh.time().timeName(), mesh, IOobject::MUST_READ, @@ -81,7 +112,7 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh) ( IOobject ( - "alpha", + phasePropertyName("thermo:alpha"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -98,14 +129,15 @@ Foam::basicThermo::basicThermo(const fvMesh& mesh) Foam::basicThermo::basicThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : IOdictionary ( IOobject ( - "thermophysicalProperties", + phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::NO_READ, @@ -114,24 +146,15 @@ Foam::basicThermo::basicThermo dict ), - p_ - ( - IOobject - ( - "p", - mesh.time().timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ), + phaseName_(phaseName), + + p_(lookupOrConstruct(mesh, "p")), T_ ( IOobject ( - "T", + phasePropertyName("T"), mesh.time().timeName(), mesh, IOobject::MUST_READ, @@ -144,7 +167,7 @@ Foam::basicThermo::basicThermo ( IOobject ( - "alpha", + phasePropertyName("thermo:alpha"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -160,10 +183,11 @@ Foam::basicThermo::basicThermo Foam::autoPtr<Foam::basicThermo> Foam::basicThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return New<basicThermo>(mesh); + return New<basicThermo>(mesh, phaseName); } @@ -175,16 +199,52 @@ Foam::basicThermo::~basicThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const Foam::basicThermo& Foam::basicThermo::lookupThermo +( + const fvPatchScalarField& pf +) +{ + if (pf.db().foundObject<basicThermo>(dictName)) + { + return pf.db().lookupObject<basicThermo>(dictName); + } + else + { + HashTable<const basicThermo*> thermos = + pf.db().lookupClass<basicThermo>(); + + for + ( + HashTable<const basicThermo*>::iterator iter = thermos.begin(); + iter != thermos.end(); + ++iter + ) + { + if + ( + &(iter()->he().dimensionedInternalField()) + == &(pf.dimensionedInternalField()) + ) + { + return *iter(); + } + } + } + + return pf.db().lookupObject<basicThermo>(dictName); +} + + void Foam::basicThermo::validate ( - const word& app, + const string& app, const word& a ) const { - if (!(he().name() == a)) + if (!(he().name() == phasePropertyName(a))) { FatalErrorIn(app) - << "Supported energy type is " << a + << "Supported energy type is " << phasePropertyName(a) << ", thermodynamics package provides " << he().name() << exit(FatalError); } @@ -192,15 +252,22 @@ void Foam::basicThermo::validate void Foam::basicThermo::validate ( - const word& app, + const string& app, const word& a, const word& b ) const { - if (!(he().name() == a || he().name() == b)) + if + ( + !( + he().name() == phasePropertyName(a) + || he().name() == phasePropertyName(b) + ) + ) { FatalErrorIn(app) - << "Supported energy types are " << a << " and " << b + << "Supported energy types are " << phasePropertyName(a) + << " and " << phasePropertyName(b) << ", thermodynamics package provides " << he().name() << exit(FatalError); } @@ -208,7 +275,7 @@ void Foam::basicThermo::validate void Foam::basicThermo::validate ( - const word& app, + const string& app, const word& a, const word& b, const word& c @@ -217,14 +284,16 @@ void Foam::basicThermo::validate if ( !( - he().name() == a - || he().name() == b - || he().name() == c + he().name() == phasePropertyName(a) + || he().name() == phasePropertyName(b) + || he().name() == phasePropertyName(c) ) ) { FatalErrorIn(app) - << "Supported energy types are " << a << ", " << b << " and " << c + << "Supported energy types are " << phasePropertyName(a) + << ", " << phasePropertyName(b) + << " and " << phasePropertyName(c) << ", thermodynamics package provides " << he().name() << exit(FatalError); } @@ -232,7 +301,7 @@ void Foam::basicThermo::validate void Foam::basicThermo::validate ( - const word& app, + const string& app, const word& a, const word& b, const word& c, @@ -242,16 +311,18 @@ void Foam::basicThermo::validate if ( !( - he().name() == a - || he().name() == b - || he().name() == c - || he().name() == d + he().name() == phasePropertyName(a) + || he().name() == phasePropertyName(b) + || he().name() == phasePropertyName(c) + || he().name() == phasePropertyName(d) ) ) { FatalErrorIn(app) - << "Supported energy types are " << a << ", " << b - << ", " << c << " and " << d + << "Supported energy types are " << phasePropertyName(a) + << ", " << phasePropertyName(b) + << ", " << phasePropertyName(c) + << " and " << phasePropertyName(d) << ", thermodynamics package provides " << he().name() << exit(FatalError); } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 2064444ff24ead3b3b8be10c8eaa3e4e0cd88b18..e652c30ee6cc3216a0227160a9450e99e5223f78 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -59,10 +59,14 @@ protected: // Protected data + //- Phase-name + const word& phaseName_; + + // Fields //- Pressure [Pa] - volScalarField p_; + volScalarField& p_; //- Temperature [K] volScalarField T_; @@ -76,6 +80,12 @@ protected: //- Construct as copy (not implemented) basicThermo(const basicThermo&); + volScalarField& lookupOrConstruct + ( + const fvMesh& mesh, + const char* name + ) const; + public: @@ -89,18 +99,27 @@ public: autoPtr, basicThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - basicThermo(const fvMesh&); + //- Construct from mesh and phase name + basicThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh - basicThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + basicThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); // Selectors @@ -115,14 +134,27 @@ public: //- Generic New for each of the related thermodynamics packages template<class Thermo> - static autoPtr<Thermo> New(const fvMesh&); + static autoPtr<Thermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Generic New for each of the related thermodynamics packages template<class Thermo> - static autoPtr<Thermo> New(const fvMesh&, const dictionary&); + static autoPtr<Thermo> New + ( + const fvMesh&, + const dictionary&, + const word& phaseName=word::null + ); //- Specialisation of the Generic New for basicThermo - static autoPtr<basicThermo> New(const fvMesh&); + static autoPtr<basicThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor @@ -131,11 +163,29 @@ public: // Member functions + static const word dictName; + + static word phasePropertyName + ( + const word& name, + const word& phaseName + ) + { + return name + phaseName; + } + + word phasePropertyName(const word& name) const + { + return basicThermo::phasePropertyName(name, phaseName_); + } + + static const basicThermo& lookupThermo(const fvPatchScalarField& pf); + //- Check that the thermodynamics package is consistent // with energy forms supported by the application void validate ( - const word& app, + const string& app, const word& ) const; @@ -143,7 +193,7 @@ public: // with energy forms supported by the application void validate ( - const word& app, + const string& app, const word&, const word& ) const; @@ -152,7 +202,7 @@ public: // with energy forms supported by the application void validate ( - const word& app, + const string& app, const word&, const word&, const word& @@ -162,7 +212,7 @@ public: // with energy forms supported by the application void validate ( - const word& app, + const string& app, const word&, const word&, const word&, @@ -213,6 +263,14 @@ public: //- Enthalpy/Internal energy [J/kg] virtual const volScalarField& he() const = 0; + //- Enthalpy/Internal energy + // for given pressure and temperature [J/kg] + virtual tmp<volScalarField> he + ( + const volScalarField& p, + const volScalarField& T + ) const = 0; + //- Enthalpy/Internal energy for cell-set [J/kg] virtual tmp<scalarField> he ( @@ -356,7 +414,7 @@ public: ) const = 0; - //- Read thermophysicalProperties dictionary + //- Read thermophysical properties dictionary virtual bool read(); }; diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C index e22b4f33c76cbce3112b3ac5903216746c733e48..4521750996c17468e856e9fb7a84dbf454c2dec4 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C @@ -136,14 +136,15 @@ typename Table::iterator Foam::basicThermo::lookupThermo template<class Thermo> Foam::autoPtr<Thermo> Foam::basicThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { IOdictionary thermoDict ( IOobject ( - "thermophysicalProperties", + phasePropertyName(dictName, phaseName), mesh.time().constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, @@ -159,7 +160,7 @@ Foam::autoPtr<Thermo> Foam::basicThermo::New Thermo::fvMeshConstructorTablePtr_ ); - return autoPtr<Thermo>(cstrIter()(mesh)); + return autoPtr<Thermo>(cstrIter()(mesh, phaseName)); } @@ -167,7 +168,8 @@ template<class Thermo> Foam::autoPtr<Thermo> Foam::basicThermo::New ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) { typename Thermo::dictionaryConstructorTable::iterator cstrIter = @@ -177,7 +179,7 @@ Foam::autoPtr<Thermo> Foam::basicThermo::New Thermo::dictionaryConstructorTablePtr_ ); - return autoPtr<Thermo>(cstrIter()(mesh, dict)); + return autoPtr<Thermo>(cstrIter()(mesh, dict, phaseName)); } diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C index 71a097f55f6b9b51aec1498e4f96657f272e920d..9851f44b6ff3d7b6528d9b2cb82b6bb5137573e0 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJump/energyJumpFvPatchScalarField.C @@ -68,6 +68,10 @@ Foam::energyJumpFvPatchScalarField::energyJumpFvPatchScalarField scalarField("value", dict, p.size()) ); } + else + { + evaluate(Pstream::blocking); + } } @@ -101,9 +105,7 @@ void Foam::energyJumpFvPatchScalarField::updateCoeffs() if (this->cyclicPatch().owner()) { - const basicThermo& thermo = - db().lookupObject<basicThermo>("thermophysicalProperties"); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); label patchID = patch().index(); const scalarField& pp = thermo.p().boundaryField()[patchID]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C index 81a992b9ab2a93a89d510d3c2b059e68fa71705c..cc8675dad9bc22114957ab568ce1b759461ef9b2 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/energyJump/energyJumpAMI/energyJumpAMIFvPatchScalarField.C @@ -68,6 +68,10 @@ Foam::energyJumpAMIFvPatchScalarField::energyJumpAMIFvPatchScalarField scalarField("value", dict, p.size()) ); } + else + { + evaluate(Pstream::blocking); + } } @@ -101,9 +105,7 @@ void Foam::energyJumpAMIFvPatchScalarField::updateCoeffs() if (this->cyclicAMIPatch().owner()) { - const basicThermo& thermo = - db().lookupObject<basicThermo>("thermophysicalProperties"); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); label patchID = patch().index(); const scalarField& pp = thermo.p().boundaryField()[patchID]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C index 3dd72e1e68579b520bd25636d71adcdeae4a6757..0be59a2285d40e17c0ea47fe33344c194f977272 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C @@ -97,12 +97,7 @@ void Foam::fixedEnergyFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = db().lookupObject<basicThermo> - ( - "thermophysicalProperties" - ); - - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C index 5f0e009d13c0731faf04bb3068ee972c80a825e9..5a173ec12d92d66d61a670410efb8d994b313e0c 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/gradientEnergy/gradientEnergyFvPatchScalarField.C @@ -97,9 +97,7 @@ void Foam::gradientEnergyFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = - db().lookupObject<basicThermo>("thermophysicalProperties"); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C index af83cfd20e9c4053fe1fedf102a96a5d84be6f7a..4d8d66874f81a69b3b8f435d6a1206bf2828bcce 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C @@ -102,11 +102,7 @@ void Foam::mixedEnergyFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = db().lookupObject<basicThermo> - ( - "thermophysicalProperties" - ); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C b/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C index 681f1c36a1975bcfc125431dd084d26794d3ec50..da9ff9b2bbda41af7728d06317b2eb92c211880d 100644 --- a/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C +++ b/src/thermophysicalModels/basic/derivedFvPatchFields/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C @@ -149,11 +149,7 @@ void Foam::wallHeatTransferFvPatchScalarField::updateCoeffs() return; } - const basicThermo& thermo = db().lookupObject<basicThermo> - ( - "thermophysicalProperties" - ); - + const basicThermo& thermo = basicThermo::lookupThermo(*this); const label patchi = patch().index(); const scalarField& pw = thermo.p().boundaryField()[patchi]; diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C index 4aef741b50f3afaadd279328debb572d564db058..f330c6ae81511c61ce9f6e994f1767b7f52ca5ac 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C @@ -36,16 +36,21 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fluidThermo::fluidThermo(const fvMesh& mesh) +Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const word& phaseName) : - basicThermo(mesh) + basicThermo(mesh, phaseName) {} -Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const dictionary& dict) +Foam::fluidThermo::fluidThermo +( + const fvMesh& mesh, + const dictionary& dict, + const word& phaseName +) : - basicThermo(mesh, dict) + basicThermo(mesh, dict, phaseName) {} @@ -53,10 +58,11 @@ Foam::fluidThermo::fluidThermo(const fvMesh& mesh, const dictionary& dict) Foam::autoPtr<Foam::fluidThermo> Foam::fluidThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<fluidThermo>(mesh); + return basicThermo::New<fluidThermo>(mesh, phaseName); } diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H index 21de4808fff330baf02c25f8fe5268fe63471d43..d8612d7db5afecbe8b3e51e013ec6a5c593adc8d 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H @@ -63,21 +63,34 @@ public: autoPtr, fluidThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - fluidThermo(const fvMesh&); + //- Construct from mesh and phase name + fluidThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh - fluidThermo(const fvMesh&, const dictionary&); + //- Construct from mesh and phase name + fluidThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Selector - static autoPtr<fluidThermo> New(const fvMesh&); + static autoPtr<fluidThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index 1457ce6d02edada767008bf1a8a54efb283878f1..aaa7aa6da358813afd6a75368f54509080996ac2 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -36,6 +36,39 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +template<class BasicThermo, class MixtureType> +Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryBaseTypes() +{ + const volScalarField::GeometricBoundaryField& tbf = + this->T_.boundaryField(); + + wordList hbt(tbf.size(), word::null); + + forAll(tbf, patchi) + { + if (isA<fixedJumpFvPatchScalarField>(tbf[patchi])) + { + const fixedJumpFvPatchScalarField& pf = + dynamic_cast<const fixedJumpFvPatchScalarField&>(tbf[patchi]); + + hbt[patchi] = pf.interfaceFieldType(); + } + else if (isA<fixedJumpAMIFvPatchScalarField>(tbf[patchi])) + { + const fixedJumpAMIFvPatchScalarField& pf = + dynamic_cast<const fixedJumpAMIFvPatchScalarField&> + ( + tbf[patchi] + ); + + hbt[patchi] = pf.interfaceFieldType(); + } + } + + return hbt; +} + + template<class BasicThermo, class MixtureType> Foam::wordList Foam::heThermo<BasicThermo, MixtureType>::heBoundaryTypes() { @@ -133,16 +166,23 @@ void Foam::heThermo<BasicThermo, MixtureType>::init() template<class BasicThermo, class MixtureType> -Foam::heThermo<BasicThermo, MixtureType>::heThermo(const fvMesh& mesh) +Foam::heThermo<BasicThermo, MixtureType>::heThermo +( + const fvMesh& mesh, + const word& phaseName +) : - BasicThermo(mesh), + BasicThermo(mesh, phaseName), MixtureType(*this, mesh), he_ ( IOobject ( - MixtureType::thermoType::heName(), + BasicThermo::phasePropertyName + ( + MixtureType::thermoType::heName() + ), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -150,7 +190,8 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo(const fvMesh& mesh) ), mesh, dimEnergy/dimMass, - this->heBoundaryTypes() + this->heBoundaryTypes(), + this->heBoundaryBaseTypes() ) { init(); @@ -161,17 +202,21 @@ template<class BasicThermo, class MixtureType> Foam::heThermo<BasicThermo, MixtureType>::heThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : - BasicThermo(mesh, dict), + BasicThermo(mesh, dict, phaseName), MixtureType(*this, mesh), he_ ( IOobject ( - MixtureType::thermoType::heName(), + BasicThermo::phasePropertyName + ( + MixtureType::thermoType::heName() + ), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -179,7 +224,8 @@ Foam::heThermo<BasicThermo, MixtureType>::heThermo ), mesh, dimEnergy/dimMass, - this->heBoundaryTypes() + this->heBoundaryTypes(), + this->heBoundaryBaseTypes() ) { init(); @@ -195,6 +241,60 @@ Foam::heThermo<BasicThermo, MixtureType>::~heThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template<class BasicThermo, class MixtureType> +Foam::tmp<Foam::volScalarField> Foam::heThermo<BasicThermo, MixtureType>::he +( + const volScalarField& p, + const volScalarField& T +) const +{ + const fvMesh& mesh = this->T_.mesh(); + + tmp<volScalarField> the + ( + new volScalarField + ( + IOobject + ( + "he", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + he_.dimensions() + ) + ); + + volScalarField& he = the(); + scalarField& heCells = he.internalField(); + const scalarField& pCells = p.internalField(); + const scalarField& TCells = T.internalField(); + + forAll(heCells, celli) + { + heCells[celli] = + this->cellMixture(celli).HE(pCells[celli], TCells[celli]); + } + + forAll(he.boundaryField(), patchi) + { + scalarField& hep = he.boundaryField()[patchi]; + const scalarField& pp = p.boundaryField()[patchi]; + const scalarField& Tp = T.boundaryField()[patchi]; + + forAll(hep, facei) + { + hep[facei] = + this->patchFaceMixture(patchi, facei).HE(pp[facei], Tp[facei]); + } + } + + return the; +} + + template<class BasicThermo, class MixtureType> Foam::tmp<Foam::scalarField> Foam::heThermo<BasicThermo, MixtureType>::he ( diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index c6416878e1bb62812392fd82057654e4c2e695d6..f77d017e1396afd3840611449829eb89fbc6653a 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -68,6 +68,10 @@ protected: // by interrogating the temperature field boundary types wordList heBoundaryTypes(); + //- Return the enthalpy/internal energy field boundary base types + // by interrogating the temperature field boundary types + wordList heBoundaryBaseTypes(); + //- Correct the enthalpy/internal energy field boundaries void heBoundaryCorrection(volScalarField& he); @@ -89,10 +93,19 @@ public: // Constructors //- Construct from mesh - heThermo(const fvMesh&); + heThermo + ( + const fvMesh&, + const word& phaseName + ); //- Construct from mesh and dictionary - heThermo(const fvMesh&, const dictionary&); + heThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Destructor @@ -148,6 +161,14 @@ public: // Fields derived from thermodynamic state variables + //- Enthalpy/Internal energy + // for given pressure and temperature [J/kg] + virtual tmp<volScalarField> he + ( + const volScalarField& p, + const volScalarField& T + ) const; + //- Enthalpy/Internal energy for cell-set [J/kg] virtual tmp<scalarField> he ( @@ -284,7 +305,7 @@ public: ) const; - //- Read thermophysicalProperties dictionary + //- Read thermophysical properties dictionary virtual bool read(); }; diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C index 06c9b4769785a472aaf8cbbcd968f6f3bde307f8..970fc82fe3e57bc851d99a715deeaa74bd6731d6 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C @@ -102,9 +102,13 @@ void Foam::hePsiThermo<BasicPsiThermo, MixtureType>::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class BasicPsiThermo, class MixtureType> -Foam::hePsiThermo<BasicPsiThermo, MixtureType>::hePsiThermo(const fvMesh& mesh) +Foam::hePsiThermo<BasicPsiThermo, MixtureType>::hePsiThermo +( + const fvMesh& mesh, + const word& phaseName +) : - heThermo<BasicPsiThermo, MixtureType>(mesh) + heThermo<BasicPsiThermo, MixtureType>(mesh, phaseName) { calculate(); diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H index a701a854c2fb1e1ce12efc27095b780f03feae66..41aa6da1c821597b894806d1f78e3a1072f395ba 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H @@ -68,8 +68,12 @@ public: // Constructors - //- Construct from mesh - hePsiThermo(const fvMesh&); + //- Construct from mesh and phase name + hePsiThermo + ( + const fvMesh&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index 30949d16d7ba2c04f3890cc8db5c707b28264962..dd69890313406b8e9ca182b9d0510aab991766e0 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -36,15 +36,15 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::psiThermo::psiThermo(const fvMesh& mesh) +Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName) : - fluidThermo(mesh), + fluidThermo(mesh, phaseName), psi_ ( IOobject ( - "psi", + phasePropertyName("thermo:psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -58,7 +58,7 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh) ( IOobject ( - "mu", + phasePropertyName("thermo:mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -74,10 +74,11 @@ Foam::psiThermo::psiThermo(const fvMesh& mesh) Foam::autoPtr<Foam::psiThermo> Foam::psiThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<psiThermo>(mesh); + return basicThermo::New<psiThermo>(mesh, phaseName); } diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index 84a9dff0b48903d9ac2e265da9134bdda4b4fd90..7ac2973a5bca7bcf36ea49ec1660f1617c061a3b 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -81,19 +81,27 @@ public: autoPtr, psiThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - psiThermo(const fvMesh&); + //- Construct from mesh and phase name + psiThermo + ( + const fvMesh&, + const word& phaseName + ); //- Selector - static autoPtr<psiThermo> New(const fvMesh&); + static autoPtr<psiThermo> New + ( + const fvMesh& mesh, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C index 0284f764546b2a936120dbefc135672b2be7c357..ec7aad7e72a0dc68d25b1a787fd5df2800b954e1 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C @@ -107,9 +107,13 @@ void Foam::heRhoThermo<BasicPsiThermo, MixtureType>::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class BasicPsiThermo, class MixtureType> -Foam::heRhoThermo<BasicPsiThermo, MixtureType>::heRhoThermo(const fvMesh& mesh) +Foam::heRhoThermo<BasicPsiThermo, MixtureType>::heRhoThermo +( + const fvMesh& mesh, + const word& phaseName +) : - heThermo<BasicPsiThermo, MixtureType>(mesh) + heThermo<BasicPsiThermo, MixtureType>(mesh, phaseName) { calculate(); } diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H index 9722526fc610c319e7fd9ac17b80e84e7f064b2c..287041dbf886c05b50105923d475695afe3d957d 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H @@ -69,8 +69,12 @@ public: // Constructors - //- Construct from mesh - heRhoThermo(const fvMesh&); + //- Construct from mesh and phase name + heRhoThermo + ( + const fvMesh&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index d5e572f615388ec82ad7972c12a0df02b04ef093..d34186eea9ee534ceec2376b91acba11c92c8466 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -36,14 +36,14 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::rhoThermo::rhoThermo(const fvMesh& mesh) +Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const word& phaseName) : - fluidThermo(mesh), + fluidThermo(mesh, phaseName), rho_ ( IOobject ( - "rhoThermo", + phasePropertyName("thermo:rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -57,7 +57,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) ( IOobject ( - "psi", + phasePropertyName("thermo:psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -71,7 +71,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) ( IOobject ( - "mu", + phasePropertyName("thermo:mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -83,14 +83,19 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh) {} -Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) +Foam::rhoThermo::rhoThermo +( + const fvMesh& mesh, + const dictionary& dict, + const word& phaseName +) : - fluidThermo(mesh, dict), + fluidThermo(mesh, dict, phaseName), rho_ ( IOobject ( - "rhoThermo", + phasePropertyName("thermo:rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -104,7 +109,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) ( IOobject ( - "psi", + phasePropertyName("thermo:psi"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -118,7 +123,7 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) ( IOobject ( - "mu", + phasePropertyName("thermo:mu"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -134,10 +139,11 @@ Foam::rhoThermo::rhoThermo(const fvMesh& mesh, const dictionary& dict) Foam::autoPtr<Foam::rhoThermo> Foam::rhoThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<rhoThermo>(mesh); + return basicThermo::New<rhoThermo>(mesh, phaseName); } diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index cc477d35eb0f7e7f7221a3d73d11d24d89cd6423..4202267e2bc04bfc5d1d9c41c35faba6a440888a 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -85,22 +85,35 @@ public: autoPtr, rhoThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from mesh - rhoThermo(const fvMesh&); + //- Construct from mesh and phase name + rhoThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from mesh - rhoThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + rhoThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Selector - static autoPtr<rhoThermo> New(const fvMesh&); + static autoPtr<rhoThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C index fcfc3437dd35810afbc88e6f4160879852e23236..beaa43b7350ab95fb0ed3a57535931dbaf2fc7bf 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C @@ -30,6 +30,7 @@ License #include "perfectGas.H" #include "incompressiblePerfectGas.H" #include "rhoConst.H" +#include "perfectFluid.H" #include "hConstThermo.H" #include "janafThermo.H" #include "sensibleEnthalpy.H" @@ -101,6 +102,18 @@ makeThermo specie ); +makeThermo +( + rhoThermo, + heRhoThermo, + pureMixture, + constTransport, + sensibleEnthalpy, + hConstThermo, + perfectFluid, + specie +); + makeThermo ( rhoThermo, @@ -200,6 +213,18 @@ makeThermo specie ); +makeThermo +( + rhoThermo, + heRhoThermo, + pureMixture, + constTransport, + sensibleInternalEnergy, + hConstThermo, + perfectFluid, + specie +); + makeThermo ( rhoThermo, diff --git a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C index 5387a38a5336e5e377ff13168f532c431ae16130..ced47a9504ce85c48fd7eecb82e4d5f7aeebf759 100644 --- a/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C +++ b/src/thermophysicalModels/radiationModels/derivedFvPatchFields/radiationCoupledBase/radiationCoupledBase.C @@ -146,9 +146,6 @@ Foam::scalarField Foam::radiationCoupledBase::emissivity() const ); - // Force recalculation of mapping and schedule - const mapDistribute& distMap = mpp.map(); - const fvMesh& nbrFvMesh = refCast<const fvMesh>(nbrMesh); const fvPatch& nbrPatch = @@ -162,7 +159,7 @@ Foam::scalarField Foam::radiationCoupledBase::emissivity() const nbrPatch.index() ] ); - distMap.distribute(emissivity); + mpp.distribute(emissivity); return emissivity; diff --git a/src/thermophysicalModels/radiationModels/radiationModel/noRadiation/noRadiation.C b/src/thermophysicalModels/radiationModels/radiationModel/noRadiation/noRadiation.C index 604a5dbbe3843ca1348caf90b708a8663d5b5799..69666b7c63a0a591021ed049dc00e439bbc4bb4c 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/noRadiation/noRadiation.C +++ b/src/thermophysicalModels/radiationModels/radiationModel/noRadiation/noRadiation.C @@ -52,7 +52,7 @@ Foam::radiation::noRadiation::noRadiation const volScalarField& T ) : - radiationModel(dict, T) + radiationModel(T) {} diff --git a/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.C b/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.C index 55e2e1fb53668ee06a9154ec9c506c27822a016d..5948101185c074bc1aa90c44b10bca28be2c7759 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.C +++ b/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.C @@ -43,6 +43,33 @@ namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +Foam::IOobject Foam::radiation::radiationModel::createIOobject +( + const fvMesh& mesh +) const +{ + IOobject io + ( + "radiationProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ); + + if (io.headerOk()) + { + io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; + return io; + } + else + { + io.readOpt() = IOobject::NO_READ; + return io; + } +} + + void Foam::radiation::radiationModel::initialise() { if (radiation_) @@ -62,35 +89,6 @@ void Foam::radiation::radiationModel::initialise() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::radiation::radiationModel::radiationModel(const volScalarField& T) -: - IOdictionary - ( - IOobject - ( - "radiationProperties", - T.time().constant(), - T.mesh(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ), - mesh_(T.mesh()), - time_(T.time()), - T_(T), - radiation_(false), - coeffs_(dictionary::null), - solverFreq_(0), - firstIter_(true), - absorptionEmission_(NULL), - scatter_(NULL) -{} - - -Foam::radiation::radiationModel::radiationModel -( - const dictionary& dict, - const volScalarField& T -) : IOdictionary ( @@ -101,8 +99,7 @@ Foam::radiation::radiationModel::radiationModel T.mesh(), IOobject::NO_READ, IOobject::NO_WRITE - ), - dict + ) ), mesh_(T.mesh()), time_(T.time()), @@ -122,17 +119,7 @@ Foam::radiation::radiationModel::radiationModel const volScalarField& T ) : - IOdictionary - ( - IOobject - ( - "radiationProperties", - T.time().constant(), - T.mesh(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ), + IOdictionary(createIOobject(T.mesh())), mesh_(T.mesh()), time_(T.time()), T_(T), @@ -143,6 +130,11 @@ Foam::radiation::radiationModel::radiationModel absorptionEmission_(NULL), scatter_(NULL) { + if (readOpt() == IOobject::NO_READ) + { + radiation_ = false; + } + initialise(); } diff --git a/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.H b/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.H index 5f5a92887baea8fa00ccb07c4e0df30472636e08..1218dac9e9b72612be3a91984f2d08d52215ec88 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.H +++ b/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModel.H @@ -109,6 +109,9 @@ private: // Private Member Functions + //- Create IO object if dictionary is present + IOobject createIOobject(const fvMesh& mesh) const; + //- Initialise void initialise(); @@ -156,9 +159,6 @@ public: //- Null constructor radiationModel(const volScalarField& T); - //- Construct with dictionary - radiationModel(const dictionary& dict, const volScalarField& T); - //- Construct from components radiationModel(const word& type, const volScalarField& T); diff --git a/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModelNew.C b/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModelNew.C index ae13f11d1a503f2d1838c78c4540dbd66c222ec7..0a4dd3730c8e47d264c38de8d4255444bdfdfec3 100644 --- a/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModelNew.C +++ b/src/thermophysicalModels/radiationModels/radiationModel/radiationModel/radiationModelNew.C @@ -33,23 +33,27 @@ Foam::radiation::radiationModel::New const volScalarField& T ) { - // get model name, but do not register the dictionary - const word modelType + IOobject radIO ( - IOdictionary - ( - IOobject - ( - "radiationProperties", - T.time().constant(), - T.mesh(), - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ) - ).lookup("radiationModel") + "radiationProperties", + T.time().constant(), + T.mesh(), + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false ); + word modelType("none"); + if (radIO.headerOk()) + { + IOdictionary(radIO).lookup("radiationModel") >> modelType; + } + else + { + Info<< "Radiation model not active: radiationProperties not found" + << endl; + } + Info<< "Selecting radiationModel " << modelType << endl; TConstructorTable::iterator cstrIter = diff --git a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C index c0afb6a513d133de0e7a26c0b4f76220af28fd61..afacba2ebff6546a8341434e31251fa20aca27aa 100644 --- a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.C @@ -36,9 +36,13 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::psiReactionThermo::psiReactionThermo(const fvMesh& mesh) +Foam::psiReactionThermo::psiReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - psiThermo(mesh) + psiThermo(mesh, phaseName) {} @@ -46,10 +50,11 @@ Foam::psiReactionThermo::psiReactionThermo(const fvMesh& mesh) Foam::autoPtr<Foam::psiReactionThermo> Foam::psiReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<psiReactionThermo>(mesh); + return basicThermo::New<psiReactionThermo>(mesh, phaseName); } diff --git a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H index 8add518a8b780c0ec762ad9b119a6cf4fc4b2122..79af428518213558452c66e85004620313b15bce 100644 --- a/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/psiReactionThermo/psiReactionThermo.H @@ -66,21 +66,29 @@ public: autoPtr, psiReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from dictionary and mesh - psiReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + psiReactionThermo + ( + const fvMesh&, + const word& phaseName + ); // Selectors //- Standard selection based on fvMesh - static autoPtr<psiReactionThermo> New(const fvMesh&); + static autoPtr<psiReactionThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C index 8a2daccfe6ec751fa7ed00fd516c0e0af9364ca6..cc6950b80a643d1a9aa8e5fc9a82676baca00c52 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.C @@ -121,10 +121,11 @@ void Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::calculate() template<class BasicPsiThermo, class MixtureType> Foam::heheuPsiThermo<BasicPsiThermo, MixtureType>::heheuPsiThermo ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) : - heThermo<psiuReactionThermo, MixtureType>(mesh), + heThermo<psiuReactionThermo, MixtureType>(mesh, phaseName), Tu_ ( IOobject diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H index 2a9645df0e1c13a6c50726b7c52fa0c8e9b3c572..4c52e775ed7464e172aa84e0de90a55b49a57e98 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/heheuPsiThermo.H @@ -76,8 +76,12 @@ public: // Constructors - //- Construct from mesh - heheuPsiThermo(const fvMesh&); + //- Construct from mesh and phase name + heheuPsiThermo + ( + const fvMesh&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C index b5f824c376fa0679b03592d6fe3fcfe33b1bf8f9..45e6b01bacef40beeada1bafc364fac72df320b0 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.C @@ -100,9 +100,13 @@ void psiuReactionThermo::heuBoundaryCorrection(volScalarField& heu) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -psiuReactionThermo::psiuReactionThermo(const fvMesh& mesh) +psiuReactionThermo::psiuReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - psiReactionThermo(mesh) + psiReactionThermo(mesh, phaseName) {} @@ -110,10 +114,11 @@ psiuReactionThermo::psiuReactionThermo(const fvMesh& mesh) Foam::autoPtr<Foam::psiuReactionThermo> Foam::psiuReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<psiuReactionThermo>(mesh); + return basicThermo::New<psiuReactionThermo>(mesh, phaseName); } diff --git a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H index f27e3662c0c61a7c5afd5fbc9584383ae35d3ed1..0a0b3bcfa4f243fd8333872f0e2ed96e8992252e 100644 --- a/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/psiuReactionThermo/psiuReactionThermo.H @@ -73,20 +73,28 @@ public: autoPtr, psiuReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from dictionary and mesh - psiuReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + psiuReactionThermo + ( + const fvMesh&, + const word& phaseName + ); // Selectors - static autoPtr<psiuReactionThermo> New(const fvMesh&); + static autoPtr<psiuReactionThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C index ef056e426762191d0feda4ca4496755812889ea1..12e34e90b757d03185003ca6c9b61588412bd072 100644 --- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C +++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.C @@ -36,9 +36,13 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::rhoReactionThermo::rhoReactionThermo(const fvMesh& mesh) +Foam::rhoReactionThermo::rhoReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - rhoThermo(mesh) + rhoThermo(mesh, phaseName) {} @@ -46,10 +50,11 @@ Foam::rhoReactionThermo::rhoReactionThermo(const fvMesh& mesh) Foam::autoPtr<Foam::rhoReactionThermo> Foam::rhoReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<rhoReactionThermo>(mesh); + return basicThermo::New<rhoReactionThermo>(mesh, phaseName); } diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H index 227d6382daf2b9d6e87b393fff3fc221938267b3..346b0d85803b04a28a8431c3d7037e5f0019779b 100644 --- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H +++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermo.H @@ -66,21 +66,29 @@ public: autoPtr, rhoReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Constructors - //- Construct from dictionary and mesh - rhoReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + rhoReactionThermo + ( + const fvMesh&, + const word& phaseName + ); // Selectors //- Standard selection based on fvMesh - static autoPtr<rhoReactionThermo> New(const fvMesh&); + static autoPtr<rhoReactionThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C index 77184b166b4b1ea98df6f61c1590a7790d4f9fe0..5bf7cd778693185fdfc2eacaaa00e0594a4dd7f0 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.C @@ -38,19 +38,24 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidReactionThermo::solidReactionThermo(const fvMesh& mesh) +Foam::solidReactionThermo::solidReactionThermo +( + const fvMesh& mesh, + const word& phaseName +) : - solidThermo(mesh) + solidThermo(mesh, phaseName) {} Foam::solidReactionThermo::solidReactionThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : - solidThermo(mesh, dict) + solidThermo(mesh, dict, phaseName) {} @@ -58,20 +63,22 @@ Foam::solidReactionThermo::solidReactionThermo Foam::autoPtr<Foam::solidReactionThermo> Foam::solidReactionThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<solidReactionThermo>(mesh); + return basicThermo::New<solidReactionThermo>(mesh, phaseName); } Foam::autoPtr<Foam::solidReactionThermo> Foam::solidReactionThermo::New ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) { - return basicThermo::New<solidReactionThermo>(mesh, dict); + return basicThermo::New<solidReactionThermo>(mesh, dict, phaseName); } diff --git a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H index ebb74aa0b4ef7ce1dd770ed654d782068499e7e7..ed31ca5e2f9fc3fdd3021537289e8c2b10a68670 100644 --- a/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H +++ b/src/thermophysicalModels/solidThermo/solidReactionThermo/solidReactionThermo.H @@ -67,8 +67,8 @@ public: autoPtr, solidReactionThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Declare run-time constructor selection tables @@ -77,31 +77,46 @@ public: autoPtr, solidReactionThermo, dictionary, - (const fvMesh& mesh, const dictionary& dict), - (mesh, dict) + (const fvMesh& mesh, const dictionary& dict, const word& phaseName), + (mesh, dict, phaseName) ); // Constructors - //- Construct from mesh - solidReactionThermo(const fvMesh&); + //- Construct from mesh and phase name + solidReactionThermo + ( + const fvMesh&, + const word& phaseName + ); - //- Construct from dictionary and mesh - solidReactionThermo(const fvMesh&, const dictionary&); + //- Construct from mesh, dictionary and phase name + solidReactionThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); // Selectors //- Standard selection based on fvMesh - static autoPtr<solidReactionThermo> New(const fvMesh&); + static autoPtr<solidReactionThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Standard selection based on fvMesh amd dictionary static autoPtr<solidReactionThermo> New ( const fvMesh&, - const dictionary& + const dictionary&, + const word& phaseName=word::null ); + //- Destructor virtual ~solidReactionThermo(); diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C index 193ec0a9a6009695ead0937694c713c7b6507e9e..d70e42a77e4dba600364e7b675950743f98dde02 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C @@ -127,9 +127,13 @@ void Foam::heSolidThermo<BasicSolidThermo, MixtureType>::calculate() template<class BasicSolidThermo, class MixtureType> Foam::heSolidThermo<BasicSolidThermo, MixtureType>:: -heSolidThermo(const fvMesh& mesh) +heSolidThermo +( + const fvMesh& mesh, + const word& phaseName +) : - heThermo<BasicSolidThermo, MixtureType>(mesh) + heThermo<BasicSolidThermo, MixtureType>(mesh, phaseName) { calculate(); } @@ -137,9 +141,14 @@ heSolidThermo(const fvMesh& mesh) template<class BasicSolidThermo, class MixtureType> Foam::heSolidThermo<BasicSolidThermo, MixtureType>:: -heSolidThermo(const fvMesh& mesh, const dictionary& dict) +heSolidThermo +( + const fvMesh& mesh, + const dictionary& dict, + const word& phaseName +) : - heThermo<BasicSolidThermo, MixtureType>(mesh, dict) + heThermo<BasicSolidThermo, MixtureType>(mesh, dict, phaseName) { calculate(); } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H index ee1f9aa010a46b86cf82a7f594ae5e96ae917239..8d13ea6e28a61c7467f6b90b0922e40e5b587125 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H @@ -68,11 +68,20 @@ public: // Constructors - //- Construct from mesh - heSolidThermo(const fvMesh&); - - //- Construct from mesh and dictionary - heSolidThermo(const fvMesh&, const dictionary&); + //- Construct from mesh and phase name + heSolidThermo + ( + const fvMesh&, + const word& phaseName + ); + + //- Construct from mesh, dictionary and phase name + heSolidThermo + ( + const fvMesh&, + const dictionary&, + const word& phaseName + ); //- Destructor diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C index faf4ea6155ad495ff2e71c5dac97c283e70aaaeb..2e12bcf213d0ba2e82b213b55be0891956d95c6c 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C @@ -39,14 +39,18 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::solidThermo::solidThermo(const fvMesh& mesh) +Foam::solidThermo::solidThermo +( + const fvMesh& mesh, + const word& phaseName +) : - basicThermo(mesh), + basicThermo(mesh, phaseName), rho_ ( IOobject ( - "rhoThermo", + phasePropertyName("thermo:rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -61,15 +65,16 @@ Foam::solidThermo::solidThermo(const fvMesh& mesh) Foam::solidThermo::solidThermo ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) : - basicThermo(mesh, dict), + basicThermo(mesh, dict, phaseName), rho_ ( IOobject ( - "rhoThermo", + phasePropertyName("thermo:rho"), mesh.time().timeName(), mesh, IOobject::NO_READ, @@ -85,20 +90,22 @@ Foam::solidThermo::solidThermo Foam::autoPtr<Foam::solidThermo> Foam::solidThermo::New ( - const fvMesh& mesh + const fvMesh& mesh, + const word& phaseName ) { - return basicThermo::New<solidThermo>(mesh); + return basicThermo::New<solidThermo>(mesh, phaseName); } Foam::autoPtr<Foam::solidThermo> Foam::solidThermo::New ( const fvMesh& mesh, - const dictionary& dict + const dictionary& dict, + const word& phaseName ) { - return basicThermo::New<solidThermo>(mesh, dict); + return basicThermo::New<solidThermo>(mesh, dict, phaseName); } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index 12ec3eb308ac7fdf8c2c9ef108a2c1a62fbf0383..e3cf9b8e19d641b554e549be24ac75700857dbe9 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -77,8 +77,8 @@ public: autoPtr, solidThermo, fvMesh, - (const fvMesh& mesh), - (mesh) + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) ); // Declare run-time constructor selection tables @@ -87,26 +87,44 @@ public: autoPtr, solidThermo, dictionary, - (const fvMesh& mesh, const dictionary& dict), - (mesh, dict) + (const fvMesh& mesh, const dictionary& dict, const word& phaseName), + (mesh, dict, phaseName) ); // Constructors - //- Construct from mesh - solidThermo(const fvMesh&); - - //- Construct from mesh and dict - solidThermo(const fvMesh&, const dictionary& dict); + //- Construct from mesh and phase name + solidThermo + ( + const fvMesh&, + const word& phaseName + ); + + //- Construct from mesh, dictionary and phase name + solidThermo + ( + const fvMesh&, + const dictionary& dict, + const word& phaseName + ); //- Return a pointer to a new solidThermo created from // the solidThermophysicalProperties dictionary - static autoPtr<solidThermo> New(const fvMesh&); + static autoPtr<solidThermo> New + ( + const fvMesh&, + const word& phaseName=word::null + ); //- Return a pointer to a new solidThermo created from // local dictionary - static autoPtr<solidThermo> New(const fvMesh&, const dictionary&); + static autoPtr<solidThermo> New + ( + const fvMesh&, + const dictionary&, + const word& phaseName=word::null + ); //- Destructor diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.C b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.C new file mode 100644 index 0000000000000000000000000000000000000000..844f293e2dd580a904cc9fa93ba877dfd8d0df5a --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "perfectFluid.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Specie> +Foam::perfectFluid<Specie>::perfectFluid(Istream& is) +: + Specie(is), + rho0_(readScalar(is)) +{ + is.check("perfectFluid<Specie>::perfectFluid(Istream& is)"); +} + + +template<class Specie> +Foam::perfectFluid<Specie>::perfectFluid(const dictionary& dict) +: + Specie(dict), + rho0_(readScalar(dict.subDict("equationOfState").lookup("rho0"))) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Specie> +void Foam::perfectFluid<Specie>::write(Ostream& os) const +{ + Specie::write(os); + + dictionary dict("equationOfState"); + dict.add("rho0", rho0_); + + os << indent << dict.dictName() << dict; +} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template<class Specie> +Foam::Ostream& Foam::operator<<(Ostream& os, const perfectFluid<Specie>& pf) +{ + os << static_cast<const Specie&>(pf) + << token::SPACE << pf.rho0_; + + os.check("Ostream& operator<<(Ostream&, const perfectFluid<Specie>&)"); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H new file mode 100644 index 0000000000000000000000000000000000000000..76cf80c4a8fd504ad52bcef4f0f4a55653c20dda --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluid.H @@ -0,0 +1,223 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::perfectFluid + +Description + Perfect gas equation of state. + +SourceFiles + perfectFluidI.H + perfectFluid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef perfectFluid_H +#define perfectFluid_H + +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template<class Specie> class perfectFluid; + +template<class Specie> +inline perfectFluid<Specie> operator+ +( + const perfectFluid<Specie>&, + const perfectFluid<Specie>& +); + +template<class Specie> +inline perfectFluid<Specie> operator- +( + const perfectFluid<Specie>&, + const perfectFluid<Specie>& +); + +template<class Specie> +inline perfectFluid<Specie> operator* +( + const scalar, + const perfectFluid<Specie>& +); + +template<class Specie> +inline perfectFluid<Specie> operator== +( + const perfectFluid<Specie>&, + const perfectFluid<Specie>& +); + +template<class Specie> +Ostream& operator<< +( + Ostream&, + const perfectFluid<Specie>& +); + + +/*---------------------------------------------------------------------------*\ + Class perfectFluid Declaration +\*---------------------------------------------------------------------------*/ + +template<class Specie> +class perfectFluid +: + public Specie +{ + // Private data + + //- The reference density + scalar rho0_; + +public: + + // Constructors + + //- Construct from components + inline perfectFluid(const Specie& sp, const scalar rho0); + + //- Construct from Istream + perfectFluid(Istream&); + + //- Construct from dictionary + perfectFluid(const dictionary& dict); + + //- Construct as named copy + inline perfectFluid(const word& name, const perfectFluid&); + + //- Construct and return a clone + inline autoPtr<perfectFluid> clone() const; + + // Selector from Istream + inline static autoPtr<perfectFluid> New(Istream& is); + + // Selector from dictionary + inline static autoPtr<perfectFluid> New(const dictionary& dict); + + + // Member functions + + //- Return the instantiated type name + static word typeName() + { + return "perfectFluid<" + word(Specie::typeName_()) + '>'; + } + + + // Fundamental properties + + //- Is the equation of state is incompressible i.e. rho != f(p) + static const bool incompressible = false; + + //- Is the equation of state is isochoric i.e. rho = const + static const bool isochoric = false; + + //- Return density [kg/m^3] + inline scalar rho(scalar p, scalar T) const; + + //- Return compressibility rho/p [s^2/m^2] + inline scalar psi(scalar p, scalar T) const; + + //- Return compression factor [] + inline scalar Z(scalar p, scalar T) const; + + //- Return (cp - cv) [J/(kmol K] + inline scalar cpMcv(scalar p, scalar T) const; + + + // IO + + //- Write to Ostream + void write(Ostream& os) const; + + + // Member operators + + inline void operator+=(const perfectFluid&); + inline void operator-=(const perfectFluid&); + + inline void operator*=(const scalar); + + + // Friend operators + + friend perfectFluid operator+ <Specie> + ( + const perfectFluid&, + const perfectFluid& + ); + + friend perfectFluid operator- <Specie> + ( + const perfectFluid&, + const perfectFluid& + ); + + friend perfectFluid operator* <Specie> + ( + const scalar s, + const perfectFluid& + ); + + friend perfectFluid operator== <Specie> + ( + const perfectFluid&, + const perfectFluid& + ); + + + // Ostream Operator + + friend Ostream& operator<< <Specie> + ( + Ostream&, + const perfectFluid& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "perfectFluidI.H" + +#ifdef NoRepository +# include "perfectFluid.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H new file mode 100644 index 0000000000000000000000000000000000000000..21fc092fe2adca3d3875247001d26cacb61309da --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H @@ -0,0 +1,220 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "perfectFluid.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template<class Specie> +inline Foam::perfectFluid<Specie>::perfectFluid +( + const Specie& sp, + const scalar rho0 +) +: + Specie(sp), + rho0_(rho0) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Specie> +inline Foam::perfectFluid<Specie>::perfectFluid +( + const word& name, + const perfectFluid<Specie>& pf +) +: + Specie(name, pf), + rho0_(pf.rho0_) +{} + + +template<class Specie> +inline Foam::autoPtr<Foam::perfectFluid<Specie> > +Foam::perfectFluid<Specie>::clone() const +{ + return autoPtr<perfectFluid<Specie> >(new perfectFluid<Specie>(*this)); +} + + +template<class Specie> +inline Foam::autoPtr<Foam::perfectFluid<Specie> > +Foam::perfectFluid<Specie>::New(Istream& is) +{ + return autoPtr<perfectFluid<Specie> >(new perfectFluid<Specie>(is)); +} + + +template<class Specie> +inline Foam::autoPtr<Foam::perfectFluid<Specie> > +Foam::perfectFluid<Specie>::New +( + const dictionary& dict +) +{ + return autoPtr<perfectFluid<Specie> >(new perfectFluid<Specie>(dict)); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Specie> +inline Foam::scalar Foam::perfectFluid<Specie>::rho(scalar p, scalar T) const +{ + return rho0_ + p/(this->R()*T); +} + + +template<class Specie> +inline Foam::scalar Foam::perfectFluid<Specie>::psi(scalar, scalar T) const +{ + return 1.0/(this->R()*T); +} + + +template<class Specie> +inline Foam::scalar Foam::perfectFluid<Specie>::Z(scalar, scalar) const +{ + return 1.0; +} + + +template<class Specie> +inline Foam::scalar Foam::perfectFluid<Specie>::cpMcv(scalar, scalar) const +{ + return this->RR; +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +template<class Specie> +inline void Foam::perfectFluid<Specie>::operator+= +( + const perfectFluid<Specie>& pf +) +{ + scalar molr1 = this->nMoles(); + + Specie::operator+=(pf); + + molr1 /= this->nMoles(); + scalar molr2 = pf.nMoles()/this->nMoles(); + + rho0_ = molr1*rho0_ + molr2*pf.rho0_; +} + + +template<class Specie> +inline void Foam::perfectFluid<Specie>::operator-= +( + const perfectFluid<Specie>& pf +) +{ + scalar molr1 = this->nMoles(); + + Specie::operator-=(pf); + + molr1 /= this->nMoles(); + scalar molr2 = pf.nMoles()/this->nMoles(); + + rho0_ = molr1*rho0_ - molr2*pf.rho0_; +} + + +template<class Specie> +inline void Foam::perfectFluid<Specie>::operator*=(const scalar s) +{ + Specie::operator*=(s); +} + + +// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // + +template<class Specie> +inline Foam::perfectFluid<Specie> Foam::operator+ +( + const perfectFluid<Specie>& pf1, + const perfectFluid<Specie>& pf2 +) +{ + scalar nMoles = pf1.nMoles() + pf2.nMoles(); + scalar molr1 = pf1.nMoles()/nMoles; + scalar molr2 = pf2.nMoles()/nMoles; + + return rhoConst<Specie> + ( + static_cast<const Specie&>(pf1) + + static_cast<const Specie&>(pf2), + molr1*pf1.rho0_ + molr2*pf2.rho0_ + ); +} + + +template<class Specie> +inline Foam::perfectFluid<Specie> Foam::operator- +( + const perfectFluid<Specie>& pf1, + const perfectFluid<Specie>& pf2 +) +{ + scalar nMoles = pf1.nMoles() + pf2.nMoles(); + scalar molr1 = pf1.nMoles()/nMoles; + scalar molr2 = pf2.nMoles()/nMoles; + + return rhoConst<Specie> + ( + static_cast<const Specie&>(pf1) + - static_cast<const Specie&>(pf2), + molr1*pf1.rho0_ - molr2*pf2.rho0_ + ); +} + + +template<class Specie> +inline Foam::perfectFluid<Specie> Foam::operator* +( + const scalar s, + const perfectFluid<Specie>& pf +) +{ + return perfectFluid<Specie>(s*static_cast<const Specie&>(pf), pf.rho0_); +} + + +template<class Specie> +inline Foam::perfectFluid<Specie> Foam::operator== +( + const perfectFluid<Specie>& pf1, + const perfectFluid<Specie>& pf2 +) +{ + return pf2 - pf1; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/specie/specie.C b/src/thermophysicalModels/specie/specie/specie.C index fa4bea7ca99a39270bc47a290c2055a463767569..a35e5850e9485c8ebe75d64bb7bbedb61cbf3ced 100644 --- a/src/thermophysicalModels/specie/specie/specie.C +++ b/src/thermophysicalModels/specie/specie/specie.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 @@ -38,7 +38,10 @@ const Foam::scalar Foam::specie::Pstd = constant::standard::Pstd.value(); //- Standard temperature (default in [K]) const Foam::scalar Foam::specie::Tstd = constant::standard::Tstd.value(); -defineTypeNameAndDebug(Foam::specie, 0); +namespace Foam +{ +defineTypeNameAndDebug(specie, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C b/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C index 8d39083330c363ac063bb798cb05e56e9b2dad51..63c97e53a5301571f0d215a32b9e2564d8b565a6 100644 --- a/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.C +++ b/src/topoChangerFvMesh/topoChangerFvMesh/topoChangerFvMesh.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 @@ -30,7 +30,7 @@ License namespace Foam { - defineTypeNameAndDebug(Foam::topoChangerFvMesh, 0); + defineTypeNameAndDebug(topoChangerFvMesh, 0); } diff --git a/src/triSurface/meshTriangulation/meshTriangulation.C b/src/triSurface/meshTriangulation/meshTriangulation.C index 56c18327d176009be3d444a70d3145591e7ec29f..4231c3d16fbecd5c7d802ecd4a4c569ee26549fd 100644 --- a/src/triSurface/meshTriangulation/meshTriangulation.C +++ b/src/triSurface/meshTriangulation/meshTriangulation.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 @@ -451,7 +451,7 @@ Foam::meshTriangulation::meshTriangulation } } - // Shrink if nessecary (because of invalid triangulations) + // Shrink if necessary (because of invalid triangulations) triangles.setSize(triI); faceMap_.setSize(triI); diff --git a/src/triSurface/triSurface/surfacePatch/surfacePatch.C b/src/triSurface/triSurface/surfacePatch/surfacePatch.C index 4b0f4bb0edae32ed81378cf42dfed2bc9417d0c8..aab5a7962e24cb29e966170540fe7523f081e818 100644 --- a/src/triSurface/triSurface/surfacePatch/surfacePatch.C +++ b/src/triSurface/triSurface/surfacePatch/surfacePatch.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 @@ -29,8 +29,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfacePatch, 0); - +namespace Foam +{ +defineTypeNameAndDebug(surfacePatch, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/triSurface/triSurface/surfacePatch/surfacePatchIOList.C b/src/triSurface/triSurface/surfacePatch/surfacePatchIOList.C index 1abcc7e4457e358ef6c925f64b1d3190e8969724..1eb61761937b5b52f77ef421ba5bf263dc43fb4d 100644 --- a/src/triSurface/triSurface/surfacePatch/surfacePatchIOList.C +++ b/src/triSurface/triSurface/surfacePatch/surfacePatchIOList.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 @@ -27,7 +27,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::surfacePatchIOList, 0); +namespace Foam +{ +defineTypeNameAndDebug(surfacePatchIOList, 0); +} // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 1350653865ff03b4557c110307c2df1f7ba1605e..e0e6c265ff748040dc8f5f47d539965c66e890c3 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -34,7 +34,10 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(Foam::triSurface, 0); +namespace Foam +{ +defineTypeNameAndDebug(triSurface, 0); +} Foam::fileName Foam::triSurface::triSurfInstance(const Time& d) @@ -83,7 +86,7 @@ Foam::fileName Foam::triSurface::triSurfInstance(const Time& d) << "reading " << foamName << " from constant/" << endl; } - return "constant"; + return d.constant(); } diff --git a/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H b/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H index 6b39231580885f7ad437bd52466b559be523ddd9..ba7fd1be491941da8f63cd33a60c46d24bf5e6b8 100644 --- a/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.H +++ b/src/turbulenceModels/LES/LESdeltas/smoothDelta/smoothDelta.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 smoothDelta Declaration + Class smoothDelta Declaration \*---------------------------------------------------------------------------*/ class smoothDelta @@ -62,7 +62,7 @@ public: // Private Member Functions //- Update. Gets information from neighbouring face/cell and - // uses this to update itself (if nessecary) and return true. + // uses this to update itself (if necessary) and return true. template<class TrackingData> inline bool update ( diff --git a/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C b/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C index d613db9f6abc9083d46fbc5a22af7a30be7764f0..060ed5bda3c37385932ff2f3d66c33661056d263 100644 --- a/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.C +++ b/src/turbulenceModels/LES/LESfilters/anisotropicFilter/anisotropicFilter.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 @@ -173,9 +173,7 @@ Foam::tmp<Foam::volSymmTensorField> Foam::anisotropicFilter::operator() ( "anisotropicFilteredSymmTensorField", mesh().time().timeName(), - mesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE + mesh() ), mesh(), unFilteredField().dimensions() @@ -209,9 +207,7 @@ Foam::tmp<Foam::volTensorField> Foam::anisotropicFilter::operator() ( "anisotropicFilteredTensorField", mesh().time().timeName(), - mesh(), - IOobject::MUST_READ, - IOobject::AUTO_WRITE + mesh() ), mesh(), unFilteredField().dimensions() diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H index 1f514840ae2bf7a53c4e1e3dab86a95a20f769f8..5b4cc39fca2cbf0a7978c2c5da9045be3b0b57da 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H @@ -169,7 +169,7 @@ public: //- Const access to the coefficients dictionary, // which provides info. about choice of models, // and all related data (particularly model coefficients). - inline const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C b/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C index 8a7bdb02917473968b41b55043ff4cc392f0e4b1..df84d4fe8984113ce67418817a21d43a8f1dfe14 100644 --- a/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/homogeneousDynOneEqEddy/homogeneousDynOneEqEddy.C @@ -145,7 +145,7 @@ void homogeneousDynOneEqEddy::correct(const tmp<volTensorField>& tgradU) volSymmTensorField D(dev(symm(gradU))); volScalarField divU(fvc::div(phi()/fvc::interpolate(rho()))); - volScalarField G(2*muSgs_*(gradU && D)); + volScalarField G(type() + ".G", 2*muSgs_*(gradU && D)); tmp<fvScalarMatrix> kEqn ( diff --git a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C index aeaa8351d02af8d3903551c9421fa46701967c71..c811874e73dd12f165345959ad0b3631b93ac47e 100644 --- a/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/lowReOneEqEddy/lowReOneEqEddy.C @@ -118,7 +118,7 @@ void lowReOneEqEddy::correct(const tmp<volTensorField>& tgradU) GenEddyVisc::correct(gradU); volScalarField divU(fvc::div(phi()/fvc::interpolate(rho()))); - volScalarField G(2*muSgs_*(gradU && dev(symm(gradU)))); + volScalarField G(type() + ".G", 2*muSgs_*(gradU && dev(symm(gradU)))); tmp<fvScalarMatrix> kEqn ( diff --git a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C index d02b487de5478629f33964f8d15a9453c757e0c2..9b2f0319f67a6d1cfac998f74d96a758c857b1a3 100644 --- a/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C +++ b/src/turbulenceModels/compressible/LES/oneEqEddy/oneEqEddy.C @@ -105,7 +105,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& tgradU) GenEddyVisc::correct(gradU); volScalarField divU(fvc::div(phi()/fvc::interpolate(rho()))); - volScalarField G(2*muSgs_*(gradU && dev(symm(gradU)))); + volScalarField G(type() + ".G", 2*muSgs_*(gradU && dev(symm(gradU)))); tmp<fvScalarMatrix> kEqn ( diff --git a/src/turbulenceModels/compressible/LES/vanDriestDelta/vanDriestDelta.C b/src/turbulenceModels/compressible/LES/vanDriestDelta/vanDriestDelta.C index f6d85d5464c9ee47f5357148ed4241c50cc96674..8c9137846d0963f4eeb39ce584a28976eda9a6c4 100644 --- a/src/turbulenceModels/compressible/LES/vanDriestDelta/vanDriestDelta.C +++ b/src/turbulenceModels/compressible/LES/vanDriestDelta/vanDriestDelta.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 @@ -82,8 +82,10 @@ void vanDriestDelta::calcDelta() } } + scalar cutOff = wallPointYPlus::yPlusCutOff; wallPointYPlus::yPlusCutOff = 500; wallDistData<wallPointYPlus> y(mesh_, ystar); + wallPointYPlus::yPlusCutOff = cutOff; delta_ = min ( diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.C b/src/turbulenceModels/compressible/RAS/LRR/LRR.C index 1528ba2affc56f092dd970317fc5052b1b9af983..0a36879bc463eccf04655830a091d8b5610783a3 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.C @@ -342,7 +342,7 @@ void LRR::correct() RASModel::correct(); volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 7273efc82cd452df81b8f80088d15557bd9b4091..dafa58ebb3a01f0ece2dc059639d47bcec3e9c13 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -379,7 +379,7 @@ void LaunderGibsonRSTM::correct() } volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index 048f15eec624e577f68e8c047d5d1dbeeef7f187..8a1073e354a84152a11c04cf95781ec6801bd86e 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C @@ -304,7 +304,7 @@ void LaunderSharmaKE::correct() } tmp<volTensorField> tgradU = fvc::grad(U_); - volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); diff --git a/src/turbulenceModels/compressible/RAS/Make/files b/src/turbulenceModels/compressible/RAS/Make/files index 524f89b653b19e0b5f66cd04b8c5f56878ce8840..e107b6793d815e6334096f346c467129e0efe91e 100644 --- a/src/turbulenceModels/compressible/RAS/Make/files +++ b/src/turbulenceModels/compressible/RAS/Make/files @@ -9,6 +9,7 @@ LaunderGibsonRSTM/LaunderGibsonRSTM.C realizableKE/realizableKE.C SpalartAllmaras/SpalartAllmaras.C kOmegaSST/kOmegaSST.C +v2f/v2f.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions @@ -30,12 +31,20 @@ $(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField. epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C + +fWallFunctions = $(wallFunctions)/fWallFunctions +$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C omegaWallFunctions = $(wallFunctions)/omegaWallFunctions $(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C +$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C + +v2WallFunctions = $(wallFunctions)/v2WallFunctions +$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C /* Patch fields */ derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index 1efe2cd08dfdd64be7c8a4e1080120d76976479d..8bfa031882b1cdb9c1834f7ed15ac56483b69780 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H @@ -209,7 +209,7 @@ public: } //- Const access to the coefficients dictionary - const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C index 70094c353b6987808b6c19d3ad54bf90350f0b07..56192780098ec1ee47e4eeed497bb4712c116235 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -303,7 +303,7 @@ void RNGkEpsilon::correct() volScalarField S2((tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); - volScalarField G("RASModel.G", mut_*S2); + volScalarField G(type() + ".G", mut_*S2); volScalarField eta(sqrt(mag(S2))*k_/epsilon_); volScalarField eta3(eta*sqr(eta)); diff --git a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C index 52c5a2ed4f6adbceb9e1c1ace0dda6a2cceeb28e..55434df625a5b4588e9034d58805c53ec89d5b71 100644 --- a/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C +++ b/src/turbulenceModels/compressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.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 @@ -76,7 +76,7 @@ tmp<volScalarField> autoCreateAlphat if (isA<wallFvPatch>(bm[patchI])) { alphatBoundaryTypes[patchI] = - RASModels::alphatWallFunctionFvPatchScalarField::typeName; + alphatWallFunctionFvPatchScalarField::typeName; } else { @@ -146,7 +146,7 @@ tmp<volScalarField> autoCreateMut if (isA<wallFvPatch>(bm[patchI])) { mutBoundaryTypes[patchI] = - RASModels::mutkWallFunctionFvPatchScalarField::typeName; + mutkWallFunctionFvPatchScalarField::typeName; } else { @@ -216,7 +216,7 @@ tmp<volScalarField> autoCreateLowReMut if (isA<wallFvPatch>(bm[patchI])) { mutBoundaryTypes[patchI] = - RASModels::mutLowReWallFunctionFvPatchScalarField::typeName; + mutLowReWallFunctionFvPatchScalarField::typeName; } else { @@ -262,7 +262,7 @@ tmp<volScalarField> autoCreateEpsilon autoCreateWallFunctionField < scalar, - RASModels::epsilonWallFunctionFvPatchScalarField + epsilonWallFunctionFvPatchScalarField > ( fieldName, @@ -281,7 +281,7 @@ tmp<volScalarField> autoCreateOmega autoCreateWallFunctionField < scalar, - RASModels::omegaWallFunctionFvPatchScalarField + omegaWallFunctionFvPatchScalarField > ( fieldName, @@ -300,7 +300,7 @@ tmp<volScalarField> autoCreateK autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -319,7 +319,7 @@ tmp<volScalarField> autoCreateQ autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -338,7 +338,7 @@ tmp<volSymmTensorField> autoCreateR autoCreateWallFunctionField < symmTensor, - RASModels::kqRWallFunctionFvPatchField<symmTensor> + kqRWallFunctionFvPatchField<symmTensor> > ( fieldName, diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C index 116bfc9c2534b5b906b2491b5eda97f170767665..65405445628d270328547a7cebc3182cae43f90f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "convectiveHeatTransferFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "addToRunTimeSelectionTable.H" @@ -34,8 +34,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -167,7 +165,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H index 2bc06bb0e47751bf72d8887ca9ba011fb647ed34..cbbd7869befd12b7b5ba42fb4ca4b6e8758dd45b 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::convectiveHeatTransferFvPatchScalarField + Foam::compressible::convectiveHeatTransferFvPatchScalarField Group grpCmpRASBoundaryConditions @@ -85,8 +85,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class convectiveHeatTransferFvPatchScalarField Declaration @@ -190,7 +188,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index 2811ea25795e9734a7faca4ebdfc0e6708aad2a5..e7003426bec723cd4007e985fbc19278627fc562 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" #include "volFields.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,10 +131,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu75 = pow(Cmu, 0.75); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index eda8faf3244b0cdf47c01234b069db195c94d00a..de7c947a9f5e4b02a1e1f073edba7dc69e1878fd 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C @@ -131,10 +131,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu25 = pow(Cmu, 0.25); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index 5db232e85eae14d90291788034448a1a523f3b06..16b69874f0eb13caf7404530ea06f50ec95e2ae3 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "alphatJayatillekeWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -36,8 +36,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -312,7 +310,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H index 60271aae48a4a17fc420737a61f4696468d2efd3..455041334e43aaee81f7df2e0a180ea9712c9723 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - alphatJayatillekeWallFunctionFvPatchScalarField + Foam::compressible::alphatJayatillekeWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -72,8 +72,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class alphatJayatillekeWallFunctionFvPatchScalarField Declaration @@ -211,7 +209,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C index c8051bb4511368e303df468eb62b165d3a3fcdfc..dcf694ad1ab6eaa115a7c17308e51594e177d675 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.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 @@ -34,13 +34,10 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF @@ -52,8 +49,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const alphatWallFunctionFvPatchScalarField& ptf, const fvPatch& p, @@ -67,8 +63,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, @@ -81,8 +76,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const alphatWallFunctionFvPatchScalarField& awfpsf ) @@ -93,8 +87,7 @@ alphatWallFunctionFvPatchScalarField {} -alphatWallFunctionFvPatchScalarField:: -alphatWallFunctionFvPatchScalarField +alphatWallFunctionFvPatchScalarField::alphatWallFunctionFvPatchScalarField ( const alphatWallFunctionFvPatchScalarField& awfpsf, const DimensionedField<scalar, volMesh>& iF @@ -143,7 +136,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H index c9031e53ed58e8ba158584d6067948adcd9e41ea..011d17f958453d0485fddfa44a048cb1429b8a8f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::alphatWallFunctionFvPatchScalarField + Foam::compressible::alphatWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -84,8 +84,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class alphatWallFunctionFvPatchScalarField Declaration @@ -190,7 +188,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..279897e833d0376e4abb090cc4a40ce317626b43 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,213 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "epsilonLowReWallFunctionFvPatchScalarField.H" +#include "compressible/turbulenceModel/turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + yPlusLam_(ptf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF, dict), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf, iF), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + + volScalarField& G = + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); + + DimensionedField<scalar, volMesh>& epsilon = + const_cast<DimensionedField<scalar, volMesh>&> + ( + dimensionedInternalField() + ); + + const tmp<volScalarField> tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tmu = turbulence.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const tmp<volScalarField> tmut = turbulence.mut(); + const volScalarField& mut = tmut(); + const scalarField& mutw = mut.boundaryField()[patchI]; + + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; + + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; + const scalarField magGradUw(mag(Uw.snGrad())); + + const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu75 = pow(Cmu_, 0.75); + + // Set epsilon and G + forAll(mutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*sqrt(k[faceCellI])*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]); + } + else + { + epsilon[faceCellI] = + 2.0*k[faceCellI]*muw[faceI]/rhow[faceI]/sqr(y[faceI]); + } + + G[faceCellI] = + (mutw[faceI] + muw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[faceCellI]) + /(kappa_*y[faceI]); + } + + fixedInternalValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + epsilonLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..61434c29b5020f24de8cca75004ce0ff4cb8c7c3 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::iompressible::epsilonLowReWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence dissipation wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The condition can be applied to wall boundaries, whereby it inserts near + wall epsilon values directly into the epsilon equation to act as a + constraint. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type epsilonLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::epsilonWallFunctionFvPatchScalarField + +SourceFiles + epsilonLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef epsilonLowReWallFunctionFvPatchScalarField_H +#define epsilonLowReWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class epsilonLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class epsilonLowReWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField +{ + +protected: + + // Protected data + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::epsilonLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // epsilonLowReWallFunctionFvPatchScalarField + // onto a new patch + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index c2cce3febdb7c9233922b2f5c906092c318f6c22..88b91c0513923c12d5cbf0d96fcc62fb62fa021d 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "epsilonWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -37,8 +37,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -58,7 +56,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType() void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -74,7 +71,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8) @@ -92,7 +88,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_) @@ -109,7 +104,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)) @@ -124,7 +118,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -140,7 +133,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf, iF), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -160,15 +152,22 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu25 = pow025(Cmu_); const scalar Cmu75 = pow(Cmu_, 0.75); - const scalarField& y = rasModel.y()[patchI]; + const scalarField& y = turbulence.y()[patchI]; volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& epsilon = const_cast<DimensionedField<scalar, volMesh>&> @@ -176,16 +175,16 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbulence.mu().boundaryField()[patchI]; - const tmp<volScalarField> tmut = rasModel.mut(); + const tmp<volScalarField> tmut = turbulence.mut(); const volScalarField& mut = tmut(); const scalarField& mutw = mut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -236,7 +235,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index 486b7fb707deb2fdad9f18f307c67196f4760218..9975348d0be53acb86dc2765eb872df90f4634f8 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::epsilonWallFunctionFvPatchScalarField + Foam::compressible::epsilonWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -47,7 +47,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -80,8 +79,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class epsilonWallFunctionFvPatchScalarField Declaration @@ -95,9 +92,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -206,7 +200,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..abb969914b1562eac83799a57f34b4a8cdb3e7b4 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -0,0 +1,258 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fWallFunctionFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "v2f.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("fWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar fWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField<scalar>(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const v2f& v2fModel = refCast<const v2f>(turbulence); + + const scalarField& y = v2fModel.y()[patchI]; + + const tmp<volScalarField> tk = v2fModel.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tepsilon = v2fModel.epsilon(); + const volScalarField& epsilon = tepsilon(); + + const tmp<volScalarField> tv2 = v2fModel.v2(); + const volScalarField& v2 = tv2(); + + const tmp<volScalarField> tmu = v2fModel.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const scalarField& rhow = v2fModel.rho().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& f = *this; + + // Set f wall values + forAll(f, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + scalar N = 6.0; + scalar v2c = v2[faceCellI]; + scalar epsc = epsilon[faceCellI]; + scalar kc = k[faceCellI]; + + f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL); + f[faceI] /= sqr(uTau) + ROOTVSMALL; + } + else + { + f[faceI] = 0.0; + } + } + + fixedValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void fWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField<scalar>::evaluate(commsType); +} + + +void fWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField<scalar>::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + fWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..b78613eebad0ee78fab0ea87fecb31d871923cc0 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::compressible::RASModels::fWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence damping function, f, wall + function condition for low- and high Reynolds number, turbulent flow cases + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + fWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fWallFunctionFvPatchScalarField_H +#define fWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class fWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class fWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField<scalar> +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::fWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given fWallFunctionFvPatchScalarField + // onto a new patch + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new fWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new fWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..5e403ab932b1baa4c74022cdde82ab74eefe6b1e --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,255 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kLowReWallFunctionFvPatchScalarField.H" +#include "compressible/turbulenceModel/turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("kLowReWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar kLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + Ceps2_(1.9), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + Ceps2_(ptf.Ceps2_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", 1.9)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf +) +: + fixedValueFvPatchField<scalar>(kwfpsf), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(kwfpsf, iF), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + + const tmp<volScalarField> tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tmu = turbulence.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& kw = *this; + + // Set k wall values + forAll(kw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Ck = -0.416; + scalar Bk = 8.366; + kw[faceI] = Ck/kappa_*log(yPlus) + Bk; + } + else + { + scalar C = 11.0; + scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C)); + kw[faceI] = 2400.0/sqr(Ceps2_)*Cf; + } + + kw[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void kLowReWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField<scalar>::evaluate(commsType); +} + + +void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField<scalar>::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + os.writeKeyword("Ceps2") << Ceps2_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + kLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..511bc19b6c6304a6260b80005a960482d2d46dcb --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,207 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::compressible::kLowReWallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence kinetic energy wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + Ceps2 | model coefficient | no | 1.9 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type kLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + kLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kLowReWallFunctionFvPatchScalarField_H +#define kLowReWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class kLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class kLowReWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField<scalar> +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Ceps2 coefficient + scalar Ceps2_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::kLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given kLowReWallFunctionFvPatchScalarField + // onto a new patch + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new kLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new kLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C index 6cabd2171ab9f9781326524838f28dac41f12ebb..0d0fc613812df257164a92d88d7807a5c5360bb5 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.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 @@ -34,8 +34,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -146,7 +144,6 @@ void kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H index d525d80b56c8f16ab1560d5a41ef7d752a6fe1ff..e96076fbc76a038958b20c81d4d07f7d9893a400 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.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 @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::kqRWallFunctionFvPatchField + Foam::compressible::kqRWallFunctionFvPatchField Group grpCmpWallFunctions @@ -60,8 +60,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kqRWallFunctionFvPatchField Declaration @@ -168,7 +166,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C index cd4eb03ec6f3b0c27246696fe74b04b4557c6c21..249b99ba3d0581fffab745a0d7851f53fc488a99 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.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 @@ -34,8 +34,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -43,7 +41,6 @@ makePatchFields(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H index 95e36995dd38e99283c8cd3638737571d2990312..a62cd0806edd69365a1137a76c7b4c9f293e6e04 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.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 @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +42,6 @@ makePatchTypeFieldTypedefs(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C index 5eee5c270289d210b489b5497a9d8a7c100be7d1..269f9698a9515b66d71ab8aa4a5c1f78889798fe 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -129,7 +127,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H index 2cbbef359cb13de77d4c80e703471f9d12940bbc..75f751288b97c80d911e2b3e2199af905a7d5449 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutLowReWallFunctionFvPatchScalarField + Foam::compressible::mutLowReWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -43,7 +43,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutLowReWallFunctionFvPatchScalarField.C @@ -61,8 +61,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutLowReWallFunctionFvPatchScalarField Declaration @@ -160,7 +158,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C index f5571451a1fb4d9f20dd4350a8e5d355825c9eff..5591904c9e0e93f49917e3d979539977ac8805bb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C @@ -26,7 +26,7 @@ License #include "mutURoughWallFunctionFvPatchScalarField.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -311,7 +309,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H index 479cb18b4009dc3b940cd965a6ddcae6417726cd..12beef633820fcb4ec2e39e8044e6806dc3cba26 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutURoughWallFunctionFvPatchScalarField + Foam::compressible:::mutURoughWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -52,7 +52,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutURoughWallFunctionFvPatchScalarField.C @@ -70,8 +70,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutURoughWallFunctionFvPatchScalarField Declaration @@ -232,7 +230,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C index 4a4691c12c98254e27b567d19f985a349da1cffd..64bb1238ec7869113a6844989f3aceee24fc5893 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C @@ -26,7 +26,7 @@ License #include "mutUSpaldingWallFunctionFvPatchScalarField.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -219,7 +217,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H index 2501fa5b719427f210694eb2b417ab8b18ae851f..a0322dbeb26b8b2688830588dcdd3af37843074f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutUSpaldingWallFunctionFvPatchScalarField + Foam::compressible::mutUSpaldingWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -56,7 +56,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutUSpaldingWallFunctionFvPatchScalarField.C @@ -74,8 +74,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutUSpaldingWallFunctionFvPatchScalarField Declaration @@ -182,7 +180,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C index 85efec0327fd244601701cabdb2980bc21909d1b..3148119dcfb100f226e955946a998f0d0ec61385 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutUWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -197,7 +195,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H index 08a938b52c5716cd6a30b19de151096809350910..1c6ed4f7d64cf47fd91894404bf7ffead1f0eebb 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUWallFunction/mutUWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutUWallFunctionFvPatchScalarField + Foam::compressible::mutUWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -42,7 +42,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutUWallFunctionFvPatchScalarField.C @@ -60,8 +60,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutUWallFunctionFvPatchScalarField Declaration @@ -168,7 +166,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C index 6f0dbb1a9fea14a6301e90b90419d237a68f7177..f4a6476be6b7fad21ace76c82e6204876eec9d33 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "mutWallFunctionFvPatchScalarField.H" -#include "RASModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -184,7 +181,6 @@ void mutWallFunctionFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H index 9228b609242f5a08f1e76e18e52885d753781520..29bc406aa1e3f9ee85b88acb35f8bc4e72c8d2de 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutWallFunction/mutWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutWallFunctionFvPatchScalarField Declaration @@ -173,7 +171,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C index cc04471f4fc4ca692f9ccb8d98d0012ab42cb8c7..e634b89acc1baca2277abe37645aaa311e3c105f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutkRoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -237,7 +235,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H index fdf5a0a7d6364919c2cea2b7604c9951953f2473..6ff72c42d3b22341b64a0f13c7e84298dd692f18 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutkRoughWallFunctionFvPatchScalarField + Foam::compressible::mutkRoughWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -56,7 +56,7 @@ Description \endverbatim SeeAlso - Foam::mutkRoughWallFunctionFvPatchScalarField + Foam::compressible::mutkRoughWallFunctionFvPatchScalarField SourceFiles mutkRoughWallFunctionFvPatchScalarField.C @@ -74,8 +74,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutkRoughWallFunctionFvPatchScalarField Declaration @@ -198,7 +196,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C index 9aeb96b297e2720547fad2a1f13f246d8d13a34f..72b010d55d0d11b3774ef07b41a1d0b3c84559b4 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "mutkWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +36,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -159,7 +157,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H index 8d952a64285e0811afca6082f9c2d778030e04f1..f81625627cf26d86d2ac36abc5f492078f59ab5e 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkWallFunction/mutkWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::mutkWallFunctionFvPatchScalarField + Foam::compressible::mutkWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -43,7 +43,7 @@ Description \endverbatim SeeAlso - Foam::mutWallFunctionFvPatchScalarField + Foam::compressible::mutWallFunctionFvPatchScalarField SourceFiles mutkWallFunctionFvPatchScalarField.C @@ -61,8 +61,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class mutkWallFunctionFvPatchScalarField Declaration @@ -160,7 +158,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index d7f2f4fa5ed14cbe229dd4d1fa7dd7e9837d0b17..e95a4d9bf7b92e61eda664157df89c901d9bcd6c 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "omegaWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -37,8 +37,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -58,7 +56,6 @@ void omegaWallFunctionFvPatchScalarField::checkType() void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -75,7 +72,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8), @@ -96,7 +92,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_), @@ -115,7 +110,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)), @@ -132,7 +126,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -150,7 +143,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf, iF), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -173,13 +165,19 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patch().index()]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patch().index()]; const scalar Cmu25 = pow025(Cmu_); volScalarField& G = const_cast<volScalarField&> - (db().lookupObject<volScalarField>(GName_)); + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& omega = const_cast<DimensionedField<scalar, volMesh>&> @@ -187,18 +185,18 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; - const scalarField& muw = rasModel.mu().boundaryField()[patchI]; + const scalarField& muw = turbulence.mu().boundaryField()[patchI]; - const tmp<volScalarField> tmut = rasModel.mut(); + const tmp<volScalarField> tmut = turbulence.mut(); const volScalarField& mut = tmut(); const scalarField& mutw = mut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -242,7 +240,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index d6516c5449ab748a213960619e6301e290e1a602..69fa8ee9cd06ea6ab759ef193a94c9c89a8e3f9f 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::compressible::RASModels::omegaWallFunctionFvPatchScalarField + Foam::compressible::omegaWallFunctionFvPatchScalarField Group grpCmpWallFunctions @@ -54,7 +54,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -85,8 +84,6 @@ namespace Foam { namespace compressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class omegaWallFunctionFvPatchScalarField Declaration @@ -100,9 +97,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -214,7 +208,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace compressible } // End namespace Foam diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..8c30e82d006ec0f5024cbac918a2d4ed36afce96 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -0,0 +1,249 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "v2WallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar v2WallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField<scalar>(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + + const tmp<volScalarField> tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tmu = turbulence.mu(); + const scalarField& muw = tmu().boundaryField()[patchI]; + + const scalarField& rhow = turbulence.rho().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& v2 = *this; + + // Set v2 wall values + forAll(v2, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/muw[faceI]/rhow[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Cv2 = 0.193; + scalar Bv2 = -0.94; + v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2; + } + else + { + scalar Cv2 = 0.193; + v2[faceI] = Cv2*pow4(yPlus); + } + + v2[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void v2WallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField<scalar>::evaluate(commsType); +} + + +void v2WallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField<scalar>::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + v2WallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..bfedbbddf50331caeeb3331eb1349d15e3835004 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::compressible::RASModels::v2WallFunctionFvPatchScalarField + +Group + grpCmpWallFunctions + +Description + This boundary condition provides a turbulence stress normal to streamlines + wall function condition for low- and high-Reynolds number, turbulent flow + cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type v2WallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + v2WallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef v2WallFunctionFvPatchScalarField_H +#define v2WallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2WallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class v2WallFunctionFvPatchScalarField +: + public fixedValueFvPatchField<scalar> +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("compressible::v2WallFunction"); + + + // Constructors + + //- Construct from patch and internal field + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given v2WallFunctionFvPatchScalarField + // onto a new patch + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new v2WallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new v2WallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C index 7475a39f5bdfc699c275421ad91f1dcd1e6882f5..93e902cfe406c029932c460dc201d45f42783bc4 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C @@ -281,7 +281,7 @@ void kEpsilon::correct() } tmp<volTensorField> tgradU = fvc::grad(U_); - volScalarField G("RASModel.G", mut_*(tgradU() && dev(twoSymm(tgradU())))); + volScalarField G(type() + ".G", mut_*(tgradU() && dev(twoSymm(tgradU())))); tgradU.clear(); // Update epsilon and G at the wall diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C index 066e427741e4e576b210e036b21ea282495924df..321c07443b1297f776ac6b0d4580ef8e09b4baa2 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.C @@ -85,6 +85,31 @@ tmp<volScalarField> kOmegaSST::F2() const } +tmp<volScalarField> kOmegaSST::F3() const +{ + tmp<volScalarField> arg3 = min + ( + 150*(mu()/rho_)/(omega_*sqr(y_)), + scalar(10) + ); + + return 1 - tanh(pow4(arg3)); +} + + +tmp<volScalarField> kOmegaSST::F23() const +{ + tmp<volScalarField> f23(F2()); + + if (F3_) + { + f23() *= F3(); + } + + return f23; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // kOmegaSST::kOmegaSST @@ -198,6 +223,15 @@ kOmegaSST::kOmegaSST 0.31 ) ), + b1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "b1", + coeffDict_, + 1.0 + ) + ), c1_ ( dimensioned<scalar>::lookupOrAddToDict @@ -207,6 +241,15 @@ kOmegaSST::kOmegaSST 10.0 ) ), + F3_ + ( + Switch::lookupOrAddToDict + ( + "F3", + coeffDict_, + false + ) + ), y_(mesh_), @@ -268,7 +311,7 @@ kOmegaSST::kOmegaSST / max ( a1_*omega_, - F2()*sqrt(2.0)*mag(symm(fvc::grad(U_))) + b1_*F23()*sqrt(2.0)*mag(symm(fvc::grad(U_))) ) ); mut_.correctBoundaryConditions(); @@ -347,7 +390,9 @@ bool kOmegaSST::read() beta2_.readIfPresent(coeffDict()); betaStar_.readIfPresent(coeffDict()); a1_.readIfPresent(coeffDict()); + b1_.readIfPresent(coeffDict()); c1_.readIfPresent(coeffDict()); + F3_.readIfPresent("F3", coeffDict()); return true; } @@ -392,7 +437,7 @@ void kOmegaSST::correct() tmp<volTensorField> tgradU = fvc::grad(U_); volScalarField S2(2*magSqr(symm(tgradU()))); volScalarField GbyMu((tgradU() && dev(twoSymm(tgradU())))); - volScalarField G("RASModel.G", mut_*GbyMu); + volScalarField G(type() + ".G", mut_*GbyMu); tgradU.clear(); // Update omega and G at the wall @@ -448,7 +493,7 @@ void kOmegaSST::correct() // Re-calculate viscosity - mut_ = a1_*rho_*k_/max(a1_*omega_, F2()*sqrt(S2)); + mut_ = a1_*rho_*k_/max(a1_*omega_, b1_*F23()*sqrt(S2)); mut_.correctBoundaryConditions(); // Re-calculate thermal diffusivity diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H index d498a9a1f1031afdbeeb768dc1c9f3453720b170..222242a74cb2fe26e851b53688f564a80c9affe5 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H @@ -38,6 +38,15 @@ Description Nov. 2001 \endverbatim + with the addition of the optional F3 term for rough walls from + \verbatim + Hellsten, A. + "Some Improvements in Menter’s k-omega-SST turbulence model" + 29th AIAA Fluid Dynamics Conference, + AIAA-98-2554, + June 1998. + \endverbatim + Note that this implementation is written in terms of alpha diffusion coefficients rather than the more traditional sigma (alpha = 1/sigma) so that the blending can be applied to all coefficuients in a consistent @@ -69,7 +78,9 @@ Description gamma1 0.5532; gamma2 0.4403; a1 0.31; + b1 1.0; c1 10.0; + F3 no; } \endverbatim @@ -125,8 +136,11 @@ protected: dimensionedScalar betaStar_; dimensionedScalar a1_; + dimensionedScalar b1_; dimensionedScalar c1_; + Switch F3_; + //- Wall distance // Note: different to wall distance in parent RASModel @@ -144,6 +158,8 @@ protected: tmp<volScalarField> F1(const volScalarField& CDkOmega) const; tmp<volScalarField> F2() const; + tmp<volScalarField> F3() const; + tmp<volScalarField> F23() const; tmp<volScalarField> blend ( diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C index 537a2c8e44cad7853ae22e6478aac93bdba400d2..4d3e8cf94b9afdee89c537b25528cf473d37176b 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.C @@ -321,7 +321,7 @@ void realizableKE::correct() volScalarField eta(magS*k_/epsilon_); volScalarField C1(max(eta/(scalar(5) + eta), scalar(0.43))); - volScalarField G("RASModel.G", mut_*(gradU && dev(twoSymm(gradU)))); + volScalarField G(type() + ".G", mut_*(gradU && dev(twoSymm(gradU)))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.C b/src/turbulenceModels/compressible/RAS/v2f/v2f.C new file mode 100644 index 0000000000000000000000000000000000000000..36e04932d713adff2b5f5b1d5e7d33c9c8415bcf --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.C @@ -0,0 +1,491 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "v2f.H" +#include "fixedValueFvPatchField.H" +#include "zeroGradientFvPatchField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(v2f, 0); +addToRunTimeSelectionTable(RASModel, v2f, dictionary); + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +wordList v2f::RBoundaryTypes() const +{ + const volScalarField::GeometricBoundaryField& bf(k_.boundaryField()); + + wordList bTypes + ( + bf.size(), + zeroGradientFvPatchField<symmTensor>::typeName + ); + + forAll(bf, patchI) + { + if (bf[patchI].fixesValue()) + { + bTypes[patchI] = fixedValueFvPatchField<symmTensor>::typeName; + } + } + + return bTypes; +} + + +tmp<volScalarField> v2f::davidsonCorrectNut +( + const tmp<volScalarField>& value +) const +{ + return min(CmuKEps_*sqr(k_)/epsilon_, value); +} + + +tmp<volScalarField> v2f::Ts() const +{ + return max(k_/epsilon_, 6.0*sqrt(mu()/rho_/epsilon_)); +} + + +tmp<volScalarField> v2f::Ls() const +{ + return + CL_*max(pow(k_, 1.5)/epsilon_, Ceta_*pow025(pow3(mu()/rho_)/epsilon_)); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2f::v2f +( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const fluidThermo& thermophysicalModel, + const word& turbulenceModelName, + const word& modelName +) +: + RASModel(modelName, rho, U, phi, thermophysicalModel, turbulenceModelName), + + Cmu_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cmu", + coeffDict_, + 0.22 + ) + ), + CmuKEps_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CmuKEps", + coeffDict_, + 0.09 + ) + ), + C1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "C1", + coeffDict_, + 1.4 + ) + ), + C2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "C2", + coeffDict_, + 0.3 + ) + ), + CL_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CL", + coeffDict_, + 0.23 + ) + ), + Ceta_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ceta", + coeffDict_, + 70.0 + ) + ), + Ceps2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ceps2", + coeffDict_, + 1.9 + ) + ), + Ceps3_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ceps3", + coeffDict_, + -0.33 + ) + ), + sigmaK_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "sigmaK", + coeffDict_, + 1.0 + ) + ), + sigmaEps_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "sigmaEps", + coeffDict_, + 1.3 + ) + ), + Prt_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Prt", + coeffDict_, + 1.0 + ) + ), + + k_ + ( + IOobject + ( + "k", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + epsilon_ + ( + IOobject + ( + "epsilon", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2_ + ( + IOobject + ( + "v2", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + f_ + ( + IOobject + ( + "f", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + mut_ + ( + IOobject + ( + "mut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + alphat_ + ( + IOobject + ( + "alphat", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2Min_(dimensionedScalar("v2Min", v2_.dimensions(), SMALL)), + fMin_(dimensionedScalar("fMin", f_.dimensions(), 0.0)) +{ + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + bound(v2_, v2Min_); + bound(f_, fMin_); + + mut_ = rho_*davidsonCorrectNut(Cmu_*v2_*Ts()); + mut_.correctBoundaryConditions(); + + alphat_ = mut_/Prt_; + alphat_.correctBoundaryConditions(); + + printCoeffs(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp<volSymmTensorField> v2f::R() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*k_ - (mut_/rho_)*dev(twoSymm(fvc::grad(U_))), + RBoundaryTypes() + ) + ); +} + + +tmp<volSymmTensorField> v2f::devRhoReff() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -muEff()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp<fvVectorMatrix> v2f::divDevRhoReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(muEff(), U) + - fvc::div(muEff()*dev2(T(fvc::grad(U)))) + ); +} + + +bool v2f::read() +{ + if (RASModel::read()) + { + Cmu_.readIfPresent(coeffDict()); + CmuKEps_.readIfPresent(coeffDict()); + C1_.readIfPresent(coeffDict()); + C2_.readIfPresent(coeffDict()); + CL_.readIfPresent(coeffDict()); + Ceta_.readIfPresent(coeffDict()); + Ceps2_.readIfPresent(coeffDict()); + sigmaK_.readIfPresent(coeffDict()); + sigmaEps_.readIfPresent(coeffDict()); + + return true; + } + else + { + return false; + } +} + + +void v2f::correct() +{ + if (!turbulence_) + { + // Re-calculate viscosity + mut_ = rho_*Cmu_*sqr(k_)/epsilon_; + mut_.correctBoundaryConditions(); + + // Re-calculate thermal diffusivity + alphat_ = mut_/Prt_; + alphat_.correctBoundaryConditions(); + + return; + } + + RASModel::correct(); + + volScalarField divU(fvc::div(phi_/fvc::interpolate(rho_))); + + if (mesh_.moving()) + { + divU += fvc::div(mesh_.phi()); + } + + // use N=6 so that f=0 at walls + const dimensionedScalar N("N", dimless, 6.0); + + const volTensorField gradU(fvc::grad(U_)); + const volScalarField S2(2*magSqr(dev(symm(gradU)))); + + const volScalarField G(type() + ".G", mut_*S2); + const volScalarField T(Ts()); + const volScalarField L2("v2f.L2", sqr(Ls())); + const volScalarField alpha + ( + "v2f::alpha", + 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) + ); + + tmp<volScalarField> Ceps1 = + 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0))); + + // Update epsilon (and possibly G) at the wall + epsilon_.boundaryField().updateCoeffs(); + + // Dissipation equation + tmp<fvScalarMatrix> epsEqn + ( + fvm::ddt(rho_, epsilon_) + + fvm::div(phi_, epsilon_) + - fvm::laplacian(DepsilonEff(), epsilon_) + == + Ceps1()*G/T + - fvm::SuSp(((2.0/3.0)*Ceps1 + Ceps3_)*rho_*divU, epsilon_) + - fvm::Sp(Ceps2_*rho_/T, epsilon_) + ); + + epsEqn().relax(); + + epsEqn().boundaryManipulate(epsilon_.boundaryField()); + + solve(epsEqn); + bound(epsilon_, epsilonMin_); + + // Turbulent kinetic energy equation + tmp<fvScalarMatrix> kEqn + ( + fvm::ddt(rho_, k_) + + fvm::div(phi_, k_) + - fvm::laplacian(DkEff(), k_) + == + G + - fvm::SuSp((2.0/3.0)*rho_*divU, k_) + - fvm::Sp(rho_*epsilon_/k_, k_) + ); + + kEqn().relax(); + solve(kEqn); + bound(k_, kMin_); + + // Relaxation function equation + tmp<fvScalarMatrix> fEqn + ( + - fvm::laplacian(rho_, f_) + == + - fvm::Sp(rho_/L2, f_) + - 1.0/L2/k_*(rho_*alpha - C2_*G) + ); + + fEqn().relax(); + solve(fEqn); + bound(f_, fMin_); + + // Turbulence stress normal to streamlines equation + tmp<fvScalarMatrix> v2Eqn + ( + fvm::ddt(rho_, v2_) + + fvm::div(phi_, v2_) + - fvm::laplacian(DkEff(), v2_) + == + min(rho_*k_*f_, -rho_*alpha + C2_*G) + - fvm::Sp(rho_*N*epsilon_/k_, v2_) + ); + + v2Eqn().relax(); + solve(v2Eqn); + bound(v2_, v2Min_); + + // Re-calculate viscosity + mut_ = rho_*davidsonCorrectNut(Cmu_*v2_*T); + mut_.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/RAS/v2f/v2f.H b/src/turbulenceModels/compressible/RAS/v2f/v2f.H new file mode 100644 index 0000000000000000000000000000000000000000..5b68a605d9c1b73046e5c2cee7ddd6b478882a03 --- /dev/null +++ b/src/turbulenceModels/compressible/RAS/v2f/v2f.H @@ -0,0 +1,288 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::compressible::RASModels::v2f + +Group + grpCmpRASTurbulence + +Description + Lien and Kalitzin's v2-f turbulence model for incompressible flows, with + a limit imposed on the turbulent viscosity given by Davidson et al. + + The model solves for turbulence k and epsilon, with additional equations + for the turbulence stress normal to streamlines, v2, and elliptic damping + function, f. The variant implemented employs N=6, such that f=0 on walls. + + Wall boundary conditions are: + + k = kLowReWallFunction + epsilon = epsilonLowReWallFunction + v2 = v2WalLFunction + f = fWallFunction + + These are applicable to both low- and high-Reynolds number flows. + + Inlet values can be approximated by: + + v2 = 2/3 k + f = zero-gradient + + + References: + + Lien F-S, Kalitzin G, 2001. Computations of transonic flow with the v2-f + turbulence model. Int. J. Heat Fluid Flow 22, pp 53-61 + + Davidson L, Nielsen P, Sveningsson A, 2003. Modifications of the v2-f + model for computing the flow in a 3D wall jet. Turbulence, Heat and Mass + Transfer 4, pp 577-584 + + The default model coefficients are given as: + \verbatim + v2fCoeffs + { + Cmu 0.22; + CmuKEps 0.09; + C1 1.4; + C2 0.3; + CL 0.23; + Ceta 70; + Ceps2 1.9; + sigmaEps 1.3; + sigmaK 1; + } + \endverbatim + +Note + If the kLowReWallFunction is employed, a velocity variant of the turbulent + viscosity wall function should be used, e.g. nutUWallFunction. Turbulence + k variants (nutk...) for this case will not behave correctly. + +SeeAlso + Foam::kEpsilon + Foam::kLowReWallFunctionFvPatchScalarField + Foam::epsilonLowReWallFunctionFvPatchScalarField + Foam::v2WallFunctionFvPatchScalarField + Foam::fWallFunctionFvPatchScalarField + +SourceFiles + v2f.C + +\*---------------------------------------------------------------------------*/ + +#ifndef compressiblev2f_H +#define compressiblev2f_H + +#include "RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2f Declaration +\*---------------------------------------------------------------------------*/ + +class v2f +: + public RASModel +{ + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar Cmu_; + dimensionedScalar CmuKEps_; + dimensionedScalar C1_; + dimensionedScalar C2_; + dimensionedScalar CL_; + dimensionedScalar Ceta_; + dimensionedScalar Ceps2_; + dimensionedScalar Ceps3_; + dimensionedScalar sigmaK_; + dimensionedScalar sigmaEps_; + dimensionedScalar Prt_; + + // Fields + + //- Turbulence kinetic energy + volScalarField k_; + + //- Turbulence dissipation + volScalarField epsilon_; + + //- Turbulence stress normal to streamlines + volScalarField v2_; + + //- Damping function + volScalarField f_; + + //- Turbulence viscosity + volScalarField mut_; + + //- Turbulence thermal diffusivity + volScalarField alphat_; + + + // Bounding values + + dimensionedScalar v2Min_; + dimensionedScalar fMin_; + + + // Protected Member Functions + + //- Return boundary type names for the R field + wordList RBoundaryTypes() const; + + //- Apply Davidson correction to nut + tmp<volScalarField> davidsonCorrectNut + ( + const tmp<volScalarField>& value + ) const; + + //- Return time scale, Ts + tmp<volScalarField> Ts() const; + + //- Return length scale, Ls + tmp<volScalarField> Ls() const; + + +public: + + //- Runtime type information + TypeName("v2f"); + + // Constructors + + //- Construct from components + v2f + ( + const volScalarField& rho, + const volVectorField& U, + const surfaceScalarField& phi, + const fluidThermo& thermophysicalModel, + const word& turbulenceModelName = turbulenceModel::typeName, + const word& modelName = typeName + ); + + + //- Destructor + virtual ~v2f() + {} + + + // Member Functions + + //- Return the effective diffusivity for k + tmp<volScalarField> DkEff() const + { + return tmp<volScalarField> + ( + new volScalarField("DkEff", mut_/sigmaK_ + mu()) + ); + } + + //- Return the effective diffusivity for epsilon + tmp<volScalarField> DepsilonEff() const + { + return tmp<volScalarField> + ( + new volScalarField("DepsilonEff", mut_/sigmaEps_ + mu()) + ); + } + + //- Return the turbulence viscosity + virtual tmp<volScalarField> mut() const + { + return mut_; + } + + //- Return the turbulence thermal diffusivity + virtual tmp<volScalarField> alphat() const + { + return alphat_; + } + + //- Return the turbulence kinetic energy + virtual tmp<volScalarField> k() const + { + return k_; + } + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp<volScalarField> epsilon() const + { + return epsilon_; + } + + //- Return turbulence stress normal to streamlines + virtual tmp<volScalarField> v2() const + { + return v2_; + } + + //- Return the damping function + virtual tmp<volScalarField> f() const + { + return f_; + } + + //- Return the Reynolds stress tensor + virtual tmp<volSymmTensorField> R() const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devRhoReff() const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevRhoReff(volVectorField& U) const; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/compressible/turbulenceModel/Make/options b/src/turbulenceModels/compressible/turbulenceModel/Make/options index a3d25da57a978ab8d50c77a8462c8997483d1b5e..9b024f163da9d0895dc55e75f65ab3c3af9992ae 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/Make/options +++ b/src/turbulenceModels/compressible/turbulenceModel/Make/options @@ -15,4 +15,3 @@ LIB_LIBS = \ -lmeshTools \ -lsolidSpecie \ -lradiationModels - diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C index 034cd50e3edb04b7c4ee0c6f3d696a19a98ee24c..14448ca71c8da21e63bc17d3348041afb45f48b6 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C @@ -99,66 +99,58 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa ); return model.kappaEff(patch_.index()); + break; } - break; case SOLIDTHERMO: { const solidThermo& thermo = - mesh.lookupObject<solidThermo> - ( - "thermophysicalProperties" - ); + mesh.lookupObject<solidThermo>("thermophysicalProperties"); + return thermo.kappa(patch_.index()); + break; } - break; case DIRECTIONALSOLIDTHERMO: { const solidThermo& thermo = - mesh.lookupObject<solidThermo> - ( - "thermophysicalProperties" - ); + mesh.lookupObject<solidThermo>("thermophysicalProperties"); + + const vectorField kappa(thermo.Kappa(patch_.index())); tmp<scalarField> tmeanKappa(Tp); scalarField& meanKappa = tmeanKappa(); forAll(meanKappa, i) { - meanKappa[i] = - ( - thermo.Kappa(patch_.index())()[i].x() - + thermo.Kappa(patch_.index())()[i].y() - + thermo.Kappa(patch_.index())()[i].z() - )/3.0; + meanKappa[i] = (kappa[i].x() + kappa[i].y() + kappa[i].z())/3.0; } return meanKappa; + break; } - break; case LOOKUP: { if (mesh.objectRegistry::foundObject<volScalarField>(kappaName_)) { - return patch_.lookupPatchField - < - volScalarField, scalar - >(kappaName_); + return patch_.lookupPatchField<volScalarField, scalar> + ( + kappaName_ + ); } else if ( - mesh.objectRegistry::foundObject - < - volSymmTensorField - >(kappaName_) + mesh.objectRegistry::foundObject<volSymmTensorField> + ( + kappaName_ + ) ) { const symmTensorField& KWall = - patch_.lookupPatchField - < - volSymmTensorField, scalar - >(kappaName_); + patch_.lookupPatchField<volSymmTensorField, scalar> + ( + kappaName_ + ); const vectorField n(patch_.nf()); @@ -166,7 +158,10 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa } else { - FatalErrorIn("temperatureCoupledBase::K() const") + FatalErrorIn + ( + "temperatureCoupledBase::kappa(const scalarField&) const" + ) << "Did not find field " << kappaName_ << " on mesh " << mesh.name() << " patch " << patch_.name() << endl @@ -178,12 +173,16 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa return scalarField(0); } + break; } default: { - FatalErrorIn("temperatureCoupledBase::kappa() const") - << "Unimplemented method " << method_ << endl + FatalErrorIn + ( + "temperatureCoupledBase::kappa(const scalarField&) const" + ) + << "Unimplemented method " << method_ << nl << "Please set 'kappa' to one of " << KMethodTypeNames_.toc() << " and 'kappaName' to the name of the volScalar" << " or volSymmTensor field (if kappa=lookup)" diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C index 850cc79f6e35cad8d63aa3c1a8126c58eb7df3d9..5271b5da6955d79bea817d2a6fc357e1aaa1e85e 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField.C @@ -36,9 +36,6 @@ namespace Foam namespace compressible { -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField:: @@ -161,8 +158,6 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() nbrMesh ).boundary()[mpp.samplePolyPatch().index()]; - // Force recalculation of mapping and schedule - const mapDistribute& distMap = mpp.map(); tmp<scalarField> intFld = patchInternalField(); @@ -184,11 +179,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() // Swap to obtain full local values of neighbour internal field scalarField nbrIntFld(nbrField.patchInternalField()); - distMap.distribute(nbrIntFld); + mpp.distribute(nbrIntFld); // Swap to obtain full local values of neighbour kappa*delta scalarField nbrKDelta(nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs()); - distMap.distribute(nbrKDelta); + mpp.distribute(nbrKDelta); tmp<scalarField> myKDelta = kappa(*this)*patch().deltaCoeffs(); diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C index beec3b069c67ea3acd864ed98ad1341e7695f68e..137db852d481eea3bb8fb11343b21d896dfaf6e0 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/turbulentTemperatureRadCoupledMixed/turbulentTemperatureRadCoupledMixedFvPatchScalarField.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 @@ -163,8 +163,6 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs() const fvPatch& nbrPatch = refCast<const fvMesh>(nbrMesh).boundary()[samplePatchI]; - // Force recalculation of mapping and schedule - const mapDistribute& distMap = mpp.map(); scalarField Tc(patchInternalField()); scalarField& Tp = *this; @@ -178,12 +176,12 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs() // Swap to obtain full local values of neighbour internal field scalarField TcNbr(nbrField.patchInternalField()); - distMap.distribute(TcNbr); + mpp.distribute(TcNbr); // Swap to obtain full local values of neighbour K*delta scalarField KDeltaNbr(nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs()); - distMap.distribute(KDeltaNbr); + mpp.distribute(KDeltaNbr); scalarField KDelta(kappa(*this)*patch().deltaCoeffs()); @@ -198,7 +196,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs() if (QrNbrName_ != "none") { QrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(QrNbrName_); - distMap.distribute(QrNbr); + mpp.distribute(QrNbr); } scalarField alpha(KDeltaNbr - (Qr + QrNbr)/Tp); diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C index aa56d7cfddb3203db512b59f152a677b893c6592..a7188c5eebdd9a61873dc0d964178888164f3805 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C @@ -79,6 +79,12 @@ autoPtr<laminar> laminar::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const dictionary& laminar::coeffDict() const +{ + return dictionary::null; +} + + tmp<volScalarField> laminar::mut() const { return tmp<volScalarField> diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H index bead5d06de48c9295978b3848732d39b442f255c..b1de35154ecb5612d72cf11480821425518ccb9d 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H @@ -91,6 +91,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const; + //- Return the turbulence viscosity, i.e. 0 for laminar flow virtual tmp<volScalarField> mut() const; diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H index e6d8bf290fdfbef40eccb24596df3f01596761ef..87d283b29ab8d318cb625269052367e219f5a3a2 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H @@ -158,6 +158,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const = 0; + //- Access function to density field const volScalarField& rho() const { diff --git a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C index 0f1d19bb2e04a4cfaf55054b1cc327767efcb01d..7afc74c400d527e2072fc6abdd008ea2dc326b40 100644 --- a/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C +++ b/src/turbulenceModels/derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C @@ -28,8 +28,9 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "incompressible/RAS/RASModel/RASModel.H" -#include "compressible/RAS/RASModel/RASModel.H" +#include "surfaceFields.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "compressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C index 07cc0c9481eed6baa9c866a8875b3811c405c4ee..afd43395ba493f779ebee2267b0ba3156b48c4a1 100644 --- a/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C +++ b/src/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.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 @@ -111,14 +111,10 @@ Foam::porousBafflePressureFvPatchField<Type>::porousBafflePressureFvPatchField template<class Type> void Foam::porousBafflePressureFvPatchField<Type>::write(Ostream& os) const { - fixedJumpFvPatchField<Type>::write(os); - os.writeKeyword("D") << D_ << token::END_STATEMENT << nl; os.writeKeyword("I") << I_ << token::END_STATEMENT << nl; os.writeKeyword("length") << length_ << token::END_STATEMENT << nl; - - this->writeEntry("value", os); } diff --git a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H index c790bb587196e0a22660779e001f39207f21f6ed..d08086234b856a55ebc4c941b3cf587b3ae18dd1 100644 --- a/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H @@ -166,7 +166,7 @@ public: //- Const access to the coefficients dictionary, // which provides info. about choice of models, // and all related data (particularly model coefficients). - inline const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C index bbbf51332b98cd60f5ca3f12a07001d7d3cac223..4bbf67702af1f770995b91a71684cda821678f58 100644 --- a/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C +++ b/src/turbulenceModels/incompressible/LES/SpalartAllmaras/SpalartAllmaras.C @@ -53,7 +53,7 @@ void SpalartAllmaras::updateSubGridScaleFields() tmp<volScalarField> SpalartAllmaras::fv1() const { - const volScalarField chi3(pow3(nuTilda_/nu())); + const volScalarField chi3("chi3", pow3(nuTilda_/nu())); return chi3/(chi3 + pow3(Cv1_)); } @@ -66,8 +66,8 @@ tmp<volScalarField> SpalartAllmaras::fv2() const tmp<volScalarField> SpalartAllmaras::fv3() const { - const volScalarField chi(nuTilda_/nu()); - const volScalarField chiByCv2((1/Cv2_)*chi); + const volScalarField chi("chi", nuTilda_/nu()); + const volScalarField chiByCv2(chi/Cv2_); return (scalar(1) + chi*fv1()) diff --git a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C index 2b54d0ef09223a0942b96f6345f4211e18ce13e8..acb34537c7fca816f3d6324a8d2ba4236b817e1e 100644 --- a/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C +++ b/src/turbulenceModels/incompressible/LES/kOmegaSSTSAS/kOmegaSSTSAS.C @@ -353,7 +353,7 @@ void kOmegaSSTSAS::correct(const tmp<volTensorField>& gradU) volScalarField L(sqrt(k_)/(pow025(Cmu_)*omega_)); volScalarField CDkOmega((2.0*alphaOmega2_)*(gradK & gradOmega)/omega_); volScalarField F1(this->F1(CDkOmega)); - volScalarField G(nuSgs_*S2); + volScalarField G(type() + ".G", nuSgs_*S2); // Turbulent kinetic energy equation { diff --git a/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C b/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C index 40e4f293e63c69b0e20298cca1a20054672a09d1..e0c891584677d490c1469f4ce86e0fda86d6da7e 100644 --- a/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C +++ b/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.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 @@ -101,7 +101,7 @@ void oneEqEddy::correct(const tmp<volTensorField>& gradU) { GenEddyVisc::correct(gradU); - tmp<volScalarField> G = 2.0*nuSgs_*magSqr(symm(gradU)); + volScalarField G(type() + ".G", 2.0*nuSgs_*magSqr(symm(gradU))); tmp<fvScalarMatrix> kEqn ( diff --git a/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C b/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C index 22aa5cb076adae2d2ca3859b9f1c2e66319bdc56..35cf23f686ac0719d12edbbbe2ec22bde6c0ec0e 100644 --- a/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.C +++ b/src/turbulenceModels/incompressible/LES/vanDriestDelta/vanDriestDelta.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 @@ -81,8 +81,10 @@ void vanDriestDelta::calcDelta() } } + scalar cutOff = wallPointYPlus::yPlusCutOff; wallPointYPlus::yPlusCutOff = 500; wallDistData<wallPointYPlus> y(mesh_, ystar); + wallPointYPlus::yPlusCutOff = cutOff; delta_ = min ( diff --git a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C b/src/turbulenceModels/incompressible/RAS/LRR/LRR.C index 68f0d2b2b0916f736169bbc7062bfccab7982113..49b0bd0a17b6192d4a8745b384b2c83d4b30c11f 100644 --- a/src/turbulenceModels/incompressible/RAS/LRR/LRR.C +++ b/src/turbulenceModels/incompressible/RAS/LRR/LRR.C @@ -339,7 +339,7 @@ void LRR::correct() } volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C index 17d9157c905492c8806e93ef4cf7c7b71d4c7955..576d830421908a8e32e83065d09e5bc0787418c1 100644 --- a/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C +++ b/src/turbulenceModels/incompressible/RAS/LamBremhorstKE/LamBremhorstKE.C @@ -252,7 +252,7 @@ void LamBremhorstKE::correct() y_.correct(); } - volScalarField G("RASModel.G", nut_*2*magSqr(symm(fvc::grad(U_)))); + volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_)))); // Calculate parameters and coefficients for low-Reynolds number model diff --git a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index c6ee7a7d448528bb363b420a923e85d9d1a37e97..2f8ff3b7ea0af39c5c2c35be8e160726be142dce 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -386,7 +386,7 @@ void LaunderGibsonRSTM::correct() } volSymmTensorField P(-twoSymm(R_ & fvc::grad(U_))); - volScalarField G("RASModel.G", 0.5*mag(tr(P))); + volScalarField G(type() + ".G", 0.5*mag(tr(P))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C index 53cc490f297f68a27758c1fdf311d8ba9172c616..c6854e7cba2f0c8a199ed0b7fea4a98b93390ed3 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderSharmaKE/LaunderSharmaKE.C @@ -255,7 +255,7 @@ void LaunderSharmaKE::correct() tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); const volScalarField E(2.0*nu()*nut_*fvc::magSqrGradGrad(U_)); const volScalarField D(2.0*nu()*magSqr(fvc::grad(sqrt(k_)))); diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C index 8eb972dcfbdc7083e243486748a25d2b3162e287..dbecdb2dc83602b917d5588005c6dc327b985844 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKE/LienCubicKE.C @@ -356,7 +356,7 @@ void LienCubicKE::correct() volScalarField G ( - "RASModel.G", + type() + ".G", Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU) ); diff --git a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C index 5162fa78bdafe469329f5ce28037b19ec34b7282..9c5d561998dc45c2256f5f92e0aeebcb694cc13c 100644 --- a/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C +++ b/src/turbulenceModels/incompressible/RAS/LienCubicKELowRe/LienCubicKELowRe.C @@ -446,7 +446,7 @@ void LienCubicKELowRe::correct() volScalarField G ( - "RASModel.G", + type() + ".G", Cmu_*fMu*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU) ); diff --git a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C index 6daecaae6badc12bb3b88b7f5c46e348ae478f78..faf5c125e4f4a84e44e65124fc6753aa1c7b6580 100644 --- a/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C +++ b/src/turbulenceModels/incompressible/RAS/LienLeschzinerLowRe/LienLeschzinerLowRe.C @@ -319,7 +319,7 @@ void LienLeschzinerLowRe::correct() const volScalarField f2(scalar(1) - 0.3*exp(-sqr(Rt))); - volScalarField G("RASModel.G", Cmu_*fMu*sqr(k_)/epsilon_*S2); + volScalarField G(type() + ".G", Cmu_*fMu*sqr(k_)/epsilon_*S2); // Dissipation equation diff --git a/src/turbulenceModels/incompressible/RAS/Make/files b/src/turbulenceModels/incompressible/RAS/Make/files index ce75d3834626a834541b142d988649ca9f0af0b0..9ad68d8c76e01f54c5c189572df142c314d1234e 100644 --- a/src/turbulenceModels/incompressible/RAS/Make/files +++ b/src/turbulenceModels/incompressible/RAS/Make/files @@ -17,6 +17,7 @@ NonlinearKEShih/NonlinearKEShih.C LienLeschzinerLowRe/LienLeschzinerLowRe.C LamBremhorstKE/LamBremhorstKE.C kkLOmega/kkLOmega.C +v2f/v2f.C /* Wall functions */ wallFunctions = derivedFvPatchFields/wallFunctions @@ -36,16 +37,23 @@ $(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarFiel epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +$(epsilonWallFunctions)/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C + +fWallFunctions = $(wallFunctions)/fWallFunctions +$(fWallFunctions)/fWallFunction/fWallFunctionFvPatchScalarField.C omegaWallFunctions = $(wallFunctions)/omegaWallFunctions $(omegaWallFunctions)/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C kqRWallFunctions = $(wallFunctions)/kqRWallFunctions $(kqRWallFunctions)/kqRWallFunction/kqRWallFunctionFvPatchFields.C +$(kqRWallFunctions)/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C kappatWallFunctions = $(wallFunctions)/kappatWallFunctions $(kappatWallFunctions)/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C +v2WallFunctions = $(wallFunctions)/v2WallFunctions +$(v2WallFunctions)/v2WallFunction/v2WallFunctionFvPatchScalarField.C /* Patch fields */ derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C diff --git a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C index 750a4dc15b58d6a937ac4ffc633a8cd40b1b28cc..b33c0cd3a863b39f70876d86664e17b077ff94af 100644 --- a/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C +++ b/src/turbulenceModels/incompressible/RAS/NonlinearKEShih/NonlinearKEShih.C @@ -348,9 +348,8 @@ void NonlinearKEShih::correct() volScalarField G ( - "RASModel.G", - Cmu_*sqr(k_)/epsilon_*S2 - - (nonlinearStress_ && gradU) + type() + ".G", + Cmu_*sqr(k_)/epsilon_*S2 - (nonlinearStress_ && gradU) ); #include "nonLinearWallFunctionsI.H" diff --git a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H index b1a97681c28c41f042f0235e7e5abe4e9ac0f498..4e890bb20514b6517bec7e280ca41a3902470f27 100644 --- a/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/incompressible/RAS/RASModel/RASModel.H @@ -208,7 +208,7 @@ public: } //- Const access to the coefficients dictionary - const dictionary& coeffDict() const + virtual const dictionary& coeffDict() const { return coeffDict_; } diff --git a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C index 20ed988ca7eb507ecd9cc79fc111d6dcdd84056b..b82719f22189c2add52274d42141aea85ee45cf0 100644 --- a/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C +++ b/src/turbulenceModels/incompressible/RAS/RNGkEpsilon/RNGkEpsilon.C @@ -267,7 +267,7 @@ void RNGkEpsilon::correct() } const volScalarField S2(2*magSqr(symm(fvc::grad(U_)))); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); const volScalarField eta(sqrt(S2)*k_/epsilon_); volScalarField R diff --git a/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C index 3940b067a45ce75724acd68de67b48778b15c891..98514bb5bec842d5a97ded1ec85a49111afd9a0a 100644 --- a/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.C +++ b/src/turbulenceModels/incompressible/RAS/backwardsCompatibility/wallFunctions/backwardsCompatibilityWallFunctions.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 @@ -75,7 +75,7 @@ tmp<volScalarField> autoCreateNut if (isA<wallFvPatch>(bm[patchI])) { nutBoundaryTypes[patchI] = - RASModels::nutkWallFunctionFvPatchScalarField::typeName; + nutkWallFunctionFvPatchScalarField::typeName; } else { @@ -145,7 +145,7 @@ tmp<volScalarField> autoCreateLowReNut if (isA<wallFvPatch>(bm[patchI])) { nutBoundaryTypes[patchI] = - RASModels::nutLowReWallFunctionFvPatchScalarField::typeName; + nutLowReWallFunctionFvPatchScalarField::typeName; } else { @@ -191,7 +191,7 @@ tmp<volScalarField> autoCreateEpsilon autoCreateWallFunctionField < scalar, - RASModels::epsilonWallFunctionFvPatchScalarField + epsilonWallFunctionFvPatchScalarField > ( fieldName, @@ -210,7 +210,7 @@ tmp<volScalarField> autoCreateOmega autoCreateWallFunctionField < scalar, - RASModels::omegaWallFunctionFvPatchScalarField + omegaWallFunctionFvPatchScalarField > ( fieldName, @@ -229,7 +229,7 @@ tmp<volScalarField> autoCreateK autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -248,7 +248,7 @@ tmp<volScalarField> autoCreateQ autoCreateWallFunctionField < scalar, - RASModels::kqRWallFunctionFvPatchField<scalar> + kqRWallFunctionFvPatchField<scalar> > ( fieldName, @@ -267,7 +267,7 @@ tmp<volSymmTensorField> autoCreateR autoCreateWallFunctionField < symmTensor, - RASModels::kqRWallFunctionFvPatchField<symmTensor> + kqRWallFunctionFvPatchField<symmTensor> > ( fieldName, diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index b65b1cde9e8f3a60de74648d1bbc7764625d0993..52d39a366f0e6089e7458ed1278ce47f26632447 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.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 @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -184,8 +184,9 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs() patch().lookupPatchField<volScalarField, scalar>(alphaEffName_); // retrieve (constant) specific heat capacity from transport dictionary - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalar Cp0(readScalar(rasModel.transport().lookup("Cp0"))); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalar Cp0(readScalar(turbulence.transport().lookup("Cp0"))); switch (heatSource_) { diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C index f0e9d5bdfeaffb5fddcd4984ef270325b0aae6f7..a7563417448bc0c6041b18e63dab4ed6608ed675 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthDissipationRateInlet/turbulentMixingLengthDissipationRateInletFvPatchScalarField.C @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" #include "volFields.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,10 +131,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu75 = pow(Cmu, 0.75); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C index 1a9c4ae29a0b9e1b7a0aba257236b957e7768478..bf9f904f7a8a6d8abcdc11c82a7083311bc0c17f 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentMixingLengthFrequencyInlet/turbulentMixingLengthFrequencyInletFvPatchScalarField.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 @@ -28,7 +28,7 @@ License #include "fvPatchFieldMapper.H" #include "surfaceFields.H" #include "volFields.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -127,10 +127,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs() } // Lookup Cmu corresponding to the turbulence model selected - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); const scalar Cmu = - rasModel.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); + turbulence.coeffDict().lookupOrDefault<scalar>("Cmu", 0.09); const scalar Cmu25 = pow(Cmu, 0.25); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..df52c7373e8ffac02c03ecbc016d179e97fe75cc --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "epsilonLowReWallFunctionFvPatchScalarField.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar epsilonLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + epsilonWallFunctionFvPatchScalarField(p, iF), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + epsilonWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + yPlusLam_(ptf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + epsilonWallFunctionFvPatchScalarField(p, iF, dict), + yPlusLam_(yPlusLam(kappa_, E_)) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +epsilonLowReWallFunctionFvPatchScalarField:: +epsilonLowReWallFunctionFvPatchScalarField +( + const epsilonLowReWallFunctionFvPatchScalarField& ewfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + epsilonWallFunctionFvPatchScalarField(ewfpsf, iF), + yPlusLam_(ewfpsf.yPlusLam_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void epsilonLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + + volScalarField& G = + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); + + DimensionedField<scalar, volMesh>& epsilon = + const_cast<DimensionedField<scalar, volMesh>&> + ( + dimensionedInternalField() + ); + + const tmp<volScalarField> tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tnu = turbulence.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const tmp<volScalarField> tnut = turbulence.nut(); + const volScalarField& nut = tnut(); + const scalarField& nutw = nut.boundaryField()[patchI]; + + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; + const scalarField magGradUw(mag(Uw.snGrad())); + + const scalar Cmu25 = pow025(Cmu_); + const scalar Cmu75 = pow(Cmu_, 0.75); + + // Set epsilon and G + forAll(nutw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar yPlus = Cmu25*sqrt(k[faceCellI])*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]); + } + else + { + epsilon[faceCellI] = 2.0*k[faceCellI]*nuw[faceI]/sqr(y[faceI]); + } + + G[faceCellI] = + (nutw[faceI] + nuw[faceI]) + *magGradUw[faceI] + *Cmu25*sqrt(k[faceCellI]) + /(kappa_*y[faceI]); + } + + fixedInternalValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + epsilonLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..b8cf09f0b7930d3da619f0fbd350089ff4b725f0 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonLowReWallFunction/epsilonLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,188 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::epsilonLowReWallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence dissipation wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The condition can be applied to wall boundaries, whereby it inserts near + wall epsilon values directly into the epsilon equation to act as a + constraint. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type epsilonLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::epsilonWallFunctionFvPatchScalarField + +SourceFiles + epsilonLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef epsilonLowReWallFunctionFvPatchScalarField_H +#define epsilonLowReWallFunctionFvPatchScalarField_H + +#include "epsilonWallFunctionFvPatchScalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ + +/*---------------------------------------------------------------------------*\ + Class epsilonLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class epsilonLowReWallFunctionFvPatchScalarField +: + public epsilonWallFunctionFvPatchScalarField +{ + +protected: + + // Protected data + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("epsilonLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + epsilonLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // epsilonLowReWallFunctionFvPatchScalarField + // onto a new patch + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + epsilonLowReWallFunctionFvPatchScalarField + ( + const epsilonLowReWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new epsilonLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C index 3fcb175fb36310fafa789db3288c7346c06ec191..518bb38f471a8f97818deab85d043275d3d25757 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "epsilonWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -38,8 +38,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -59,7 +57,6 @@ void epsilonWallFunctionFvPatchScalarField::checkType() void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -75,7 +72,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8) @@ -93,7 +89,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_) @@ -110,7 +105,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)) @@ -125,7 +119,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -141,7 +134,6 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ewfpsf, iF), - GName_(ewfpsf.GName_), Cmu_(ewfpsf.Cmu_), kappa_(ewfpsf.kappa_), E_(ewfpsf.E_) @@ -161,14 +153,21 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; const scalar Cmu25 = pow025(Cmu_); const scalar Cmu75 = pow(Cmu_, 0.75); volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& epsilon = const_cast<DimensionedField<scalar, volMesh>&> @@ -176,17 +175,17 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; - const tmp<volScalarField> tnut = rasModel.nut(); + const tmp<volScalarField> tnut = turbulence.nut(); const volScalarField& nut = tnut(); const scalarField& nutw = nut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -237,7 +236,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H index e988f05aff5bc85cc6de9737f4fd7926a7fb1e56..9ff7b7acb544341bc1a46a8d1ef9d9ce20cb7f31 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/epsilonWallFunctions/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::epsilonWallFunctionFvPatchScalarField + Foam::incompressible::epsilonWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -47,7 +47,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -80,8 +79,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class epsilonWallFunctionFvPatchScalarField Declaration @@ -95,9 +92,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -206,7 +200,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..cb905c80e28a839c4266fc79814581d666465b35 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.C @@ -0,0 +1,257 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fWallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "wallFvPatch.H" +#include "v2f.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("fWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar fWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField<scalar>(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +fWallFunctionFvPatchScalarField::fWallFunctionFvPatchScalarField +( + const fWallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const v2f& v2fModel = refCast<const v2f>(turbulence); + + const scalarField& y = v2fModel.y()[patchI]; + + const tmp<volScalarField> tk = v2fModel.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tepsilon = v2fModel.epsilon(); + const volScalarField& epsilon = tepsilon(); + + const tmp<volScalarField> tv2 = v2fModel.v2(); + const volScalarField& v2 = tv2(); + + const tmp<volScalarField> tnu = v2fModel.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& f = *this; + + // Set f wall values + forAll(f, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + scalar N = 6.0; + scalar v2c = v2[faceCellI]; + scalar epsc = epsilon[faceCellI]; + scalar kc = k[faceCellI]; + + f[faceI] = N*v2c*epsc/(sqr(kc) + ROOTVSMALL); + f[faceI] /= sqr(uTau) + ROOTVSMALL; + } + else + { + f[faceI] = 0.0; + } + } + + fixedValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void fWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField<scalar>::evaluate(commsType); +} + + +void fWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField<scalar>::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + fWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..771da70dfadd302688d4245e6d19fd5d9bfd350e --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/fWallFunctions/fWallFunction/fWallFunctionFvPatchScalarField.H @@ -0,0 +1,206 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::RASModels::fWallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence damping function, f, wall + function condition for low- and high Reynolds number, turbulent flow cases + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type fWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + fWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fWallFunctionFvPatchScalarField_H +#define fWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class fWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class fWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField<scalar> +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("fWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + fWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given fWallFunctionFvPatchScalarField + // onto a new patch + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new fWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + fWallFunctionFvPatchScalarField + ( + const fWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new fWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C index a87f31144164c263e2e0eb6865514080a69b0322..ac3855632aa1208405d6a53925297a0e4d5494b5 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "kappatJayatillekeWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +36,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -272,7 +270,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H index c26d9a41ecbfadfe77b83ca340892a814034f7e0..d4e0af5dd8728469b06aa08b5059e12028bc4e72 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kappatWallFunctions/kappatJayatillekeWallFunction/kappatJayatillekeWallFunctionFvPatchScalarField.H @@ -22,8 +22,7 @@ License OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels:: - kappatJayatillekeWallFunctionFvPatchScalarField + Foam::incompressible::kappatJayatillekeWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -72,8 +71,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kappatJayatillekeWallFunctionFvPatchScalarField Declaration @@ -208,7 +205,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..a53c5e0697cfd2280d9de3d32039afb650231cfd --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.C @@ -0,0 +1,253 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kLowReWallFunctionFvPatchScalarField.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("kLowReWallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar kLowReWallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + Ceps2_(1.9), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + Ceps2_(ptf.Ceps2_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + Ceps2_(dict.lookupOrDefault<scalar>("Ceps2", 1.9)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf +) +: + fixedValueFvPatchField<scalar>(kwfpsf), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +kLowReWallFunctionFvPatchScalarField::kLowReWallFunctionFvPatchScalarField +( + const kLowReWallFunctionFvPatchScalarField& kwfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(kwfpsf, iF), + Cmu_(kwfpsf.Cmu_), + kappa_(kwfpsf.kappa_), + E_(kwfpsf.E_), + Ceps2_(kwfpsf.Ceps2_), + yPlusLam_(kwfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void kLowReWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + + const tmp<volScalarField> tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tnu = turbulence.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& kw = *this; + + // Set k wall values + forAll(kw, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Ck = -0.416; + scalar Bk = 8.366; + kw[faceI] = Ck/kappa_*log(yPlus) + Bk; + } + else + { + scalar C = 11.0; + scalar Cf = (1.0/sqr(yPlus + C) + 2.0*yPlus/pow3(C) - 1.0/sqr(C)); + kw[faceI] = 2400.0/sqr(Ceps2_)*Cf; + } + + kw[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void kLowReWallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField<scalar>::evaluate(commsType); +} + + +void kLowReWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField<scalar>::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + os.writeKeyword("Ceps2") << Ceps2_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + kLowReWallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..db99287eaaf6b348d74bd72599bf69ea158dfd23 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kLowReWallFunction/kLowReWallFunctionFvPatchScalarField.H @@ -0,0 +1,207 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::kLowReWallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence kinetic energy wall function + condition for low- and high-Reynolds number turbulent flow cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + Ceps2 | model coefficient | no | 1.9 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type kLowReWallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + kLowReWallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kLowReWallFunctionFvPatchScalarField_H +#define kLowReWallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ + +/*---------------------------------------------------------------------------*\ + Class kLowReWallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class kLowReWallFunctionFvPatchScalarField +: + public fixedValueFvPatchField<scalar> +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Ceps2 coefficient + scalar Ceps2_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("kLowReWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + kLowReWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given kLowReWallFunctionFvPatchScalarField + // onto a new patch + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new kLowReWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + kLowReWallFunctionFvPatchScalarField + ( + const kLowReWallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new kLowReWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C index 8861be642ec43c68029593b76649cd2889daf393..9ff2371a62c5528fbd0b0c1f6cabdb0aeedce4f5 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.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 @@ -34,8 +34,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -146,7 +144,6 @@ void kqRWallFunctionFvPatchField<Type>::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H index c63821fe9a9da5502a534060c93801f5088df372..e9b3731deb16fc93be0c1724d012328fe6734ac3 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::kqRWallFunctionFvPatchField + Foam::incompressible::kqRWallFunctionFvPatchField Group grpIcoWallFunctions @@ -63,8 +63,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class kqRWallFunctionFvPatchField Declaration @@ -171,7 +169,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C index 0ecaa87a5dc69baa7c101e50df3f1c75015970f4..9465bdf18c5bf24fce9b0e6afd9362c9882bba35 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.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 @@ -34,8 +34,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -43,7 +41,6 @@ makePatchFields(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H index fe76853910a2203c020dff6c10202fbfe5791aef..b9a2727f34da2c52c2556b79d4d86a854b50e1df 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/kqRWallFunctions/kqRWallFunction/kqRWallFunctionFvPatchFields.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 @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,7 +42,6 @@ makePatchTypeFieldTypedefs(kqRWallFunction); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C index c23e832c5ce11880465dca3ffde97123a4eac754..a0e340bf4dee21b29bb69d8d5cb274e272c2942e 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutLowReWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -127,7 +125,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H index 008fe9c96c6559b978b189787080ccbeb9c346b7..f79533c20420fb94bbd3d4bae786e8a5d7883ee5 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutLowReWallFunctionFvPatchScalarField + Foam::incompressible::nutLowReWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutLowReWallFunctionFvPatchScalarField Declaration @@ -158,7 +156,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C index 4be408474d68b4bfda648db04d94894c11f0a736..9ec799e35323b8cfa37269d66b34287c85918d7a 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutURoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -302,7 +300,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H index 881752d9f54e21fb0565311a0756957634d5cb68..17adf6f909fa2d0f334c8e52b3f675cba0b0f9c9 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutURoughWallFunctionFvPatchScalarField + Foam::incompressible::nutURoughWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -70,8 +70,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutURoughWallFunctionFvPatchScalarField Declaration @@ -233,7 +231,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C index 2d55b5ed7925240ab455d119eee6fe317e73642f..7dca54b3e5964ce3e3d07abbedc1434622dfb295 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutUSpaldingWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,22 +35,20 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcNut() const { - const label patchi = patch().index(); + const label patchI = patch().index(); const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>("turbulenceModel"); - const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchi]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI]; const scalarField magGradU(mag(Uw.snGrad())); const tmp<volScalarField> tnu = turbModel.nu(); const volScalarField& nu = tnu(); - const scalarField& nuw = nu.boundaryField()[patchi]; + const scalarField& nuw = nu.boundaryField()[patchI]; return max ( @@ -65,23 +63,27 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau const scalarField& magGradU ) const { + const label patchI = patch().index(); + const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>("turbulenceModel"); - const scalarField& y = turbModel.y()[patch().index()]; + const scalarField& y = turbModel.y()[patchI]; - const fvPatchVectorField& Uw = - turbModel.U().boundaryField()[patch().index()]; + const fvPatchVectorField& Uw = turbModel.U().boundaryField()[patchI]; const scalarField magUp(mag(Uw.patchInternalField() - Uw)); - const scalarField& nuw = turbModel.nu()().boundaryField()[patch().index()]; + const tmp<volScalarField> tnu = turbModel.nu(); + const volScalarField& nu = tnu(); + const scalarField& nuw = nu.boundaryField()[patchI]; + const scalarField& nutw = *this; tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0)); scalarField& uTau = tuTau(); - forAll(uTau, facei) + forAll(uTau, faceI) { - scalar ut = sqrt((nutw[facei] + nuw[facei])*magGradU[facei]); + scalar ut = sqrt((nutw[faceI] + nuw[faceI])*magGradU[faceI]); if (ut > ROOTVSMALL) { @@ -90,17 +92,17 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau do { - scalar kUu = min(kappa_*magUp[facei]/ut, 50); + scalar kUu = min(kappa_*magUp[faceI]/ut, 50); scalar fkUu = exp(kUu) - 1 - kUu*(1 + 0.5*kUu); scalar f = - - ut*y[facei]/nuw[facei] - + magUp[facei]/ut + - ut*y[faceI]/nuw[faceI] + + magUp[faceI]/ut + 1/E_*(fkUu - 1.0/6.0*kUu*sqr(kUu)); scalar df = - y[facei]/nuw[facei] - + magUp[facei]/sqr(ut) + y[faceI]/nuw[faceI] + + magUp[faceI]/sqr(ut) + 1/E_*kUu*fkUu/ut; scalar uTauNew = ut + f/df; @@ -109,7 +111,7 @@ tmp<scalarField> nutUSpaldingWallFunctionFvPatchScalarField::calcUTau } while (ut > ROOTVSMALL && err > 0.01 && ++iter < 10); - uTau[facei] = max(0.0, ut); + uTau[faceI] = max(0.0, ut); } } @@ -212,7 +214,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H index b9f75ed1b17395581b2b981b9532bf4ba7bd7257..210de458373175f451c07339024440bbfa499d3c 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutUSpaldingWallFunctionFvPatchScalarField + Foam::incompressible::nutUSpaldingWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -74,8 +74,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutUSpaldingWallFunctionFvPatchScalarField Declaration @@ -182,7 +180,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C index 1cbc8971f745cf851a4960f8a50c5a66562bc472..63bab814711cfb16d81a159f16cb629fe6b19cc6 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutUTabulatedWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -214,7 +212,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H index 95bde3ba032d724ebb8c5628af4a7155ff6632bc..dbc1a75ab738d91220b812dfeaccf514b116efbc 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutUTabulatedWallFunctionFvPatchScalarField + Foam::incompressible::nutUTabulatedWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -73,8 +73,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutUTabulatedWallFunctionFvPatchScalarField Declaration @@ -190,7 +188,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C index 5ba0a0ef34626ba631ace1f20df3815f6e41515b..3b34b46df128ec8a0736e236c791a4adca532a58 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutUWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -198,7 +196,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H index 6f32734149b36460f2f1e8069db4366c41ae6410..0a34ad6facabbf086557f2613ad576559f9199a8 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutUWallFunction/nutUWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutUWallFunctionFvPatchScalarField + Foam::incompressible::nutUWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -60,8 +60,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutUWallFunctionFvPatchScalarField Declaration @@ -168,7 +166,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C index c23aea5551d9c13e99025834358d851a1ba084de..3b8749974d706e54d98b177e838ce84f350d6b7c 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "nutWallFunctionFvPatchScalarField.H" -#include "RASModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -194,7 +191,6 @@ void nutWallFunctionFvPatchScalarField::write(Ostream& os) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H index 01355ec454d7260ba0000f81d887e3c7e73e97df..de68000bd9f6e672442787c9262a29ff0090b316 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutWallFunction/nutWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutWallFunctionFvPatchScalarField + Foam::incompressible::nutWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutWallFunctionFvPatchScalarField Declaration @@ -173,7 +171,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C index b00e9f0bf984e881f8237a3f75197531ae9e4cfa..2406f30d0ad656f8534d8f1f807e2fa6ec1ba62b 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutkAtmRoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -44,11 +42,12 @@ tmp<scalarField> nutkAtmRoughWallFunctionFvPatchScalarField::calcNut() const { const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; - const tmp<volScalarField> tk = rasModel.k(); + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const volScalarField& nu = tnu(); const scalarField& nuw = nu.boundaryField()[patchI]; @@ -192,7 +191,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H index 3e0f67a4fcbfe3803eb4b0f6f4189a39006742a3..3767de1fc0dc1ad73f634fe2c4e49fe0f9afc80f 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H @@ -22,8 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels:: - nutkAtmRoughWallFunctionFvPatchScalarField + Foam::incompressible::nutkAtmRoughWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -82,8 +81,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutkAtmRoughWallFunctionFvPatchScalarField Declaration @@ -210,7 +207,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C index df8480da007b798e1ff9d7b431e4259a84e439fa..61d806882685d2b1c4831ae6bff8e8dedea7cdcc 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutkRoughWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -35,8 +35,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -237,7 +235,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H index 50d24a3ebd804f849b7ad7b550d127693c18ef4d..4a8d812ad5aedf8d2791392aa1dc67b41dc7dca1 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkRoughWallFunction/nutkRoughWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutkRoughWallFunctionFvPatchScalarField + Foam::incompressible::nutkRoughWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -74,8 +74,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutkRoughWallFunctionFvPatchScalarField Declaration @@ -213,7 +211,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C index afbd1548d15fb7e38b4c494a56b92feb12dff40c..bfc542434fa882b2a288e036cd9d2ccebced29d3 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "nutkWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" @@ -36,8 +36,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -160,7 +158,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H index 49a2257e093eb2df45e83be774232dbe9f23ded3..ef0a3066db762efa32589694d81909d77fa324e0 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/nutWallFunctions/nutkWallFunction/nutkWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::nutkWallFunctionFvPatchScalarField + Foam::incompressible::nutkWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -61,8 +61,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class nutkWallFunctionFvPatchScalarField Declaration @@ -158,7 +156,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C index 0ad2595c7c6217d7738f14e8855c72f139a2ca6e..83444c5d407156cee0655377d13e75d9a5cd80cf 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "omegaWallFunctionFvPatchScalarField.H" -#include "RASModel.H" +#include "incompressible/turbulenceModel/turbulenceModel.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "addToRunTimeSelectionTable.H" @@ -38,8 +38,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -59,7 +57,6 @@ void omegaWallFunctionFvPatchScalarField::checkType() void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const { - writeEntryIfDifferent<word>(os, "G", "RASModel.G", GName_); os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; @@ -76,7 +73,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF), - GName_("RASModel.G"), Cmu_(0.09), kappa_(0.41), E_(9.8), @@ -96,7 +92,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper), - GName_(ptf.GName_), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), E_(ptf.E_), @@ -115,7 +110,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(p, iF, dict), - GName_(dict.lookupOrDefault<word>("G", "RASModel.G")), Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), E_(dict.lookupOrDefault<scalar>("E", 9.8)), @@ -132,7 +126,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -150,7 +143,6 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField ) : fixedInternalValueFvPatchField<scalar>(owfpsf, iF), - GName_(owfpsf.GName_), Cmu_(owfpsf.Cmu_), kappa_(owfpsf.kappa_), E_(owfpsf.E_), @@ -172,13 +164,20 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() const label patchI = patch().index(); - const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties"); - const scalarField& y = rasModel.y()[patchI]; + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; const scalar Cmu25 = pow025(Cmu_); volScalarField& G = - const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_)); + const_cast<volScalarField&> + ( + db().lookupObject<volScalarField> + ( + turbulence.type() + ".G" + ) + ); DimensionedField<scalar, volMesh>& omega = const_cast<DimensionedField<scalar, volMesh>&> @@ -186,17 +185,17 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs() dimensionedInternalField() ); - const tmp<volScalarField> tk = rasModel.k(); + const tmp<volScalarField> tk = turbulence.k(); const volScalarField& k = tk(); - const tmp<volScalarField> tnu = rasModel.nu(); + const tmp<volScalarField> tnu = turbulence.nu(); const scalarField& nuw = tnu().boundaryField()[patchI]; - const tmp<volScalarField> tnut = rasModel.nut(); + const tmp<volScalarField> tnut = turbulence.nut(); const volScalarField& nut = tnut(); const scalarField& nutw = nut.boundaryField()[patchI]; - const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI]; + const fvPatchVectorField& Uw = turbulence.U().boundaryField()[patchI]; const scalarField magGradUw(mag(Uw.snGrad())); @@ -242,7 +241,6 @@ makePatchTypeField // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H index 9c03a85f259a0ddfded87dcba8313f5cf29798ab..9ee99bd6c6927e76a57325b96fbeb8b1be76d1a1 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/omegaWallFunctions/omegaWallFunction/omegaWallFunctionFvPatchScalarField.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. Class - Foam::incompressible::RASModels::omegaWallFunctionFvPatchScalarField + Foam::incompressible::omegaWallFunctionFvPatchScalarField Group grpIcoWallFunctions @@ -54,7 +54,6 @@ Description \table Property | Description | Required | Default value - G | turbulence generation field name | no | G Cmu | model coefficient | no | 0.09 kappa | Von Karman constant | no | 0.41 E | model coefficient | no | 9.8 @@ -85,8 +84,6 @@ namespace Foam { namespace incompressible { -namespace RASModels -{ /*---------------------------------------------------------------------------*\ Class omegaWallFunctionFvPatchScalarField Declaration @@ -100,9 +97,6 @@ protected: // Protected data - //- Name of turbulence generation field - word GName_; - //- Cmu coefficient scalar Cmu_; @@ -214,7 +208,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace RASModels } // End namespace incompressible } // End namespace Foam diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000000000000000000000000000000000..b2a3e38dedfa7049f2d0b0e5daf4afa37ea5e4ef --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.C @@ -0,0 +1,247 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "v2WallFunctionFvPatchScalarField.H" +#include "RASModel.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "addToRunTimeSelectionTable.H" +#include "wallFvPatch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::checkType() +{ + if (!isA<wallFvPatch>(patch())) + { + FatalErrorIn("v2WallFunctionFvPatchScalarField::checkType()") + << "Invalid wall function specification" << nl + << " Patch type for patch " << patch().name() + << " must be wall" << nl + << " Current patch type is " << patch().type() << nl << endl + << abort(FatalError); + } +} + + +scalar v2WallFunctionFvPatchScalarField::yPlusLam +( + const scalar kappa, + const scalar E +) +{ + scalar ypl = 11.0; + + for (int i=0; i<10; i++) + { + ypl = log(max(E*ypl, 1))/kappa; + } + + return ypl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(p, iF), + Cmu_(0.09), + kappa_(0.41), + E_(9.8), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField<scalar>(ptf, p, iF, mapper), + Cmu_(ptf.Cmu_), + kappa_(ptf.kappa_), + E_(ptf.E_), + yPlusLam_(ptf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchField<scalar>(p, iF, dict), + Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)), + kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)), + E_(dict.lookupOrDefault<scalar>("E", 9.8)), + yPlusLam_(yPlusLam(kappa_, E_)) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf +) +: + fixedValueFvPatchField<scalar>(v2wfpsf), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +v2WallFunctionFvPatchScalarField::v2WallFunctionFvPatchScalarField +( + const v2WallFunctionFvPatchScalarField& v2wfpsf, + const DimensionedField<scalar, volMesh>& iF +) +: + fixedValueFvPatchField<scalar>(v2wfpsf, iF), + Cmu_(v2wfpsf.Cmu_), + kappa_(v2wfpsf.kappa_), + E_(v2wfpsf.E_), + yPlusLam_(v2wfpsf.yPlusLam_) +{ + checkType(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void v2WallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const label patchI = patch().index(); + + const turbulenceModel& turbulence = + db().lookupObject<turbulenceModel>("turbulenceModel"); + const scalarField& y = turbulence.y()[patchI]; + + const tmp<volScalarField> tk = turbulence.k(); + const volScalarField& k = tk(); + + const tmp<volScalarField> tnu = turbulence.nu(); + const scalarField& nuw = tnu().boundaryField()[patchI]; + + const scalar Cmu25 = pow025(Cmu_); + + scalarField& v2 = *this; + + // Set v2 wall values + forAll(v2, faceI) + { + label faceCellI = patch().faceCells()[faceI]; + + scalar uTau = Cmu25*sqrt(k[faceCellI]); + + scalar yPlus = uTau*y[faceI]/nuw[faceI]; + + if (yPlus > yPlusLam_) + { + scalar Cv2 = 0.193; + scalar Bv2 = -0.94; + v2[faceI] = Cv2/kappa_*log(yPlus) + Bv2; + } + else + { + scalar Cv2 = 0.193; + v2[faceI] = Cv2*pow4(yPlus); + } + + v2[faceI] *= sqr(uTau); + } + + fixedValueFvPatchField<scalar>::updateCoeffs(); + + // TODO: perform averaging for cells sharing more than one boundary face +} + + +void v2WallFunctionFvPatchScalarField::evaluate +( + const Pstream::commsTypes commsType +) +{ + fixedValueFvPatchField<scalar>::evaluate(commsType); +} + + +void v2WallFunctionFvPatchScalarField::write(Ostream& os) const +{ + fixedValueFvPatchField<scalar>::write(os); + os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl; + os.writeKeyword("E") << E_ << token::END_STATEMENT << nl; + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + v2WallFunctionFvPatchScalarField +); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000000000000000000000000000000000..68bb2daaa0faa0693c61e8ffc4d89ecc3a9ab2e7 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/v2WallFunctions/v2WallFunction/v2WallFunctionFvPatchScalarField.H @@ -0,0 +1,208 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::RASModels::v2WallFunctionFvPatchScalarField + +Group + grpIcoWallFunctions + +Description + This boundary condition provides a turbulence stress normal to streamlines + wall function condition for low- and high-Reynolds number, turbulent flow + cases. + + The model operates in two modes, based on the computed laminar-to-turbulent + switch-over y+ value derived from kappa and E. + + + \heading Patch usage + + \table + Property | Description | Required | Default value + Cmu | model coefficient | no | 0.09 + kappa | Von Karman constant | no | 0.41 + E | model coefficient | no | 9.8 + \endtable + + Example of the boundary condition specification: + \verbatim + myPatch + { + type v2WallFunction; + } + \endverbatim + +SeeAlso + Foam::fixedValueFvPatchField + +SourceFiles + v2WallFunctionFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef v2WallFunctionFvPatchScalarField_H +#define v2WallFunctionFvPatchScalarField_H + +#include "fixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2WallFunctionFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class v2WallFunctionFvPatchScalarField +: + public fixedValueFvPatchField<scalar> +{ +protected: + + // Protected data + + //- Cmu coefficient + scalar Cmu_; + + //- Von Karman constant + scalar kappa_; + + //- E coefficient + scalar E_; + + //- Y+ at the edge of the laminar sublayer + scalar yPlusLam_; + + + // Protected Member Functions + + //- Check the type of the patch + virtual void checkType(); + + //- Calculate the Y+ at the edge of the laminar sublayer + scalar yPlusLam(const scalar kappa, const scalar E); + + +public: + + //- Runtime type information + TypeName("v2WallFunction"); + + + // Constructors + + //- Construct from patch and internal field + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + v2WallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given v2WallFunctionFvPatchScalarField + // onto a new patch + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new v2WallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + v2WallFunctionFvPatchScalarField + ( + const v2WallFunctionFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new v2WallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Evaluate the patchField + virtual void evaluate(const Pstream::commsTypes); + + + // I-O + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C index c12783bcdbb2c69e329bf73c3f9443885430b7cd..48ccd699c74bd230a63f70af181411996ad1ec50 100644 --- a/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/incompressible/RAS/kEpsilon/kEpsilon.C @@ -235,7 +235,7 @@ void kEpsilon::correct() return; } - volScalarField G("RASModel.G", nut_*2*magSqr(symm(fvc::grad(U_)))); + volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_)))); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C index f2faf19966b4e11f493d28849078bedecd3e7615..497fbed7c6914eb53572a52af6c02ed8b09483b3 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C +++ b/src/turbulenceModels/incompressible/RAS/kOmega/kOmega.C @@ -244,7 +244,7 @@ void kOmega::correct() return; } - volScalarField G("RASModel.G", nut_*2*magSqr(symm(fvc::grad(U_)))); + volScalarField G(type() + ".G", nut_*2*magSqr(symm(fvc::grad(U_)))); // Update omega and G at the wall omega_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C index 02899ec4c9b197b0b30169ddac07251c288e492b..290a4c73a862c3b4cdb22f6ae76928472b444c53 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C +++ b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C @@ -69,6 +69,7 @@ tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const return tanh(pow4(arg1)); } + tmp<volScalarField> kOmegaSST::F2() const { tmp<volScalarField> arg2 = min @@ -85,6 +86,31 @@ tmp<volScalarField> kOmegaSST::F2() const } +tmp<volScalarField> kOmegaSST::F3() const +{ + tmp<volScalarField> arg3 = min + ( + 150*nu()/(omega_*sqr(y_)), + scalar(10) + ); + + return 1 - tanh(pow4(arg3)); +} + + +tmp<volScalarField> kOmegaSST::F23() const +{ + tmp<volScalarField> f23(F2()); + + if (F3_) + { + f23() *= F3(); + } + + return f23; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // kOmegaSST::kOmegaSST @@ -188,6 +214,15 @@ kOmegaSST::kOmegaSST 0.31 ) ), + b1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "b1", + coeffDict_, + 1.0 + ) + ), c1_ ( dimensioned<scalar>::lookupOrAddToDict @@ -197,6 +232,15 @@ kOmegaSST::kOmegaSST 10.0 ) ), + F3_ + ( + Switch::lookupOrAddToDict + ( + "F3", + coeffDict_, + false + ) + ), y_(mesh_), @@ -246,7 +290,7 @@ kOmegaSST::kOmegaSST / max ( a1_*omega_, - F2()*sqrt(2.0)*mag(symm(fvc::grad(U_))) + b1_*F23()*sqrt(2.0)*mag(symm(fvc::grad(U_))) ) ); nut_.correctBoundaryConditions(); @@ -338,7 +382,9 @@ bool kOmegaSST::read() beta2_.readIfPresent(coeffDict()); betaStar_.readIfPresent(coeffDict()); a1_.readIfPresent(coeffDict()); + b1_.readIfPresent(coeffDict()); c1_.readIfPresent(coeffDict()); + F3_.readIfPresent("F3", coeffDict()); return true; } @@ -364,7 +410,7 @@ void kOmegaSST::correct() } const volScalarField S2(2*magSqr(symm(fvc::grad(U_)))); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); // Update omega and G at the wall omega_.boundaryField().updateCoeffs(); @@ -416,7 +462,7 @@ void kOmegaSST::correct() // Re-calculate viscosity - nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2)); + nut_ = a1_*k_/max(a1_*omega_, b1_*F23()*sqrt(S2)); nut_.correctBoundaryConditions(); } diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C.new b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C.new deleted file mode 100644 index b28e14bce9e3d070a6d68928a1051170c8bbe3e6..0000000000000000000000000000000000000000 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.C.new +++ /dev/null @@ -1,419 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "kOmegaSST.H" -#include "addToRunTimeSelectionTable.H" - -#include "backwardsCompatibilityWallFunctions.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace incompressible -{ -namespace RASModels -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(kOmegaSST, 0); -addToRunTimeSelectionTable(RASModel, kOmegaSST, dictionary); - -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -tmp<volScalarField> kOmegaSST::F1(const volScalarField& CDkOmega) const -{ - volScalarField CDkOmegaPlus = max - ( - CDkOmega, - dimensionedScalar("1.0e-10", dimless/sqr(dimTime), 1.0e-10) - ); - - volScalarField arg1 = min - ( - min - ( - max - ( - (scalar(1)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - (4*alphaOmega2_)*k_/(CDkOmegaPlus*sqr(y_)) - ), - scalar(10) - ); - - return tanh(pow4(arg1)); -} - -tmp<volScalarField> kOmegaSST::F2() const -{ - volScalarField arg2 = min - ( - max - ( - (scalar(2)/betaStar_)*sqrt(k_)/(omega_*y_), - scalar(500)*nu()/(sqr(y_)*omega_) - ), - scalar(100) - ); - - return tanh(sqr(arg2)); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -kOmegaSST::kOmegaSST -( - const volVectorField& U, - const surfaceScalarField& phi, - transportModel& lamTransportModel -) -: - RASModel(typeName, U, phi, lamTransportModel), - - alphaK1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaK1", - coeffDict_, - 0.85034 - ) - ), - alphaK2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaK2", - coeffDict_, - 1.0 - ) - ), - alphaOmega1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaOmega1", - coeffDict_, - 0.5 - ) - ), - alphaOmega2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "alphaOmega2", - coeffDict_, - 0.85616 - ) - ), - gamma1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "gamma1", - coeffDict_, - 0.5532 - ) - ), - gamma2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "gamma2", - coeffDict_, - 0.4403 - ) - ), - beta1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "beta1", - coeffDict_, - 0.075 - ) - ), - beta2_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "beta2", - coeffDict_, - 0.0828 - ) - ), - betaStar_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "betaStar", - coeffDict_, - 0.09 - ) - ), - a1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "a1", - coeffDict_, - 0.31 - ) - ), - c1_ - ( - dimensioned<scalar>::lookupOrAddToDict - ( - "c1", - coeffDict_, - 10.0 - ) - ), - - y_(mesh_), - - k_ - ( - IOobject - ( - "k", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateK("k", mesh_) - ), - omega_ - ( - IOobject - ( - "omega", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateOmega("omega", mesh_) - ), - nut_ - ( - IOobject - ( - "nut", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - autoCreateNut("nut", mesh_) - ) -{ - nut_ = - a1_*k_ - /max - ( - a1_*(omega_ + omegaSmall_), - F2()*mag(symm(fvc::grad(U_))) - ); - nut_.correctBoundaryConditions(); - - printCoeffs(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -tmp<volSymmTensorField> kOmegaSST::R() const -{ - return tmp<volSymmTensorField> - ( - new volSymmTensorField - ( - IOobject - ( - "R", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), - k_.boundaryField().types() - ) - ); -} - - -tmp<volSymmTensorField> kOmegaSST::devReff() const -{ - return tmp<volSymmTensorField> - ( - new volSymmTensorField - ( - IOobject - ( - "devRhoReff", - runTime_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - -nuEff()*dev(twoSymm(fvc::grad(U_))) - ) - ); -} - - -tmp<fvVectorMatrix> kOmegaSST::divDevReff(volVectorField& U) const -{ - return - ( - - fvm::laplacian(nuEff(), U) - - fvc::div(nuEff()*dev(fvc::grad(U)().T())) - ); -} - - -bool kOmegaSST::read() -{ - if (RASModel::read()) - { - alphaK1_.readIfPresent(coeffDict()); - alphaK2_.readIfPresent(coeffDict()); - alphaOmega1_.readIfPresent(coeffDict()); - alphaOmega2_.readIfPresent(coeffDict()); - gamma1_.readIfPresent(coeffDict()); - gamma2_.readIfPresent(coeffDict()); - beta1_.readIfPresent(coeffDict()); - beta2_.readIfPresent(coeffDict()); - betaStar_.readIfPresent(coeffDict()); - a1_.readIfPresent(coeffDict()); - c1_.readIfPresent(coeffDict()); - - return true; - } - else - { - return false; - } -} - - -void kOmegaSST::correct() -{ - RASModel::correct(); - - if (!turbulence_) - { - return; - } - - if (mesh_.changing()) - { - y_.correct(); - } - - volScalarField S2 = magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel.G", nut_*2*S2); - - // Update omega and G at the wall - omega_.boundaryField().updateCoeffs(); - - volScalarField F1 = this->F1 - ( - (2*alphaOmega2_)*(fvc::grad(k_) & fvc::grad(omega_))/omega_ - ); - - // Epsilon diffusion correction - surfaceScalarField CDkPhiOmega - ( - "CDkPhiOmega", - (2*alphaOmega2_) - *fvc::interpolate(F1 - scalar(1)) - /fvc::interpolate(omega_) - *fvc::snGrad(k_)*mesh_.magSf() - ); - - forAll (CDkPhiOmega.boundaryField(), patchi) - { - if (!CDkPhiOmega.boundaryField()[patchi].coupled()) - { - CDkPhiOmega.boundaryField()[patchi] = 0.0; - } - } - - // Turbulent frequency equation - tmp<fvScalarMatrix> omegaEqn - ( - fvm::ddt(omega_) - + fvm::div(phi_, omega_) - - fvm::laplacian(DomegaEff(F1), omega_) - + fvm::div(CDkPhiOmega, omega_) - == - gamma(F1)*2*S2 - - fvm::Sp(beta(F1)*omega_, omega_) - ); - - omegaEqn().relax(); - - omegaEqn().boundaryManipulate(omega_.boundaryField()); - - solve(omegaEqn); - bound(omega_, omega0_); - - // Turbulent kinetic energy equation - tmp<fvScalarMatrix> kEqn - ( - fvm::ddt(k_) - + fvm::div(phi_, k_) - - fvm::laplacian(DkEff(F1), k_) - == - min(G, c1_*betaStar_*k_*omega_) - - fvm::Sp(betaStar_*omega_, k_) - ); - - kEqn().relax(); - solve(kEqn); - bound(k_, k0_); - - - // Re-calculate viscosity - nut_ = a1_*k_/max(a1_*omega_, F2()*sqrt(S2)); - nut_.correctBoundaryConditions(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace RASModels -} // End namespace incompressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.H index 7b2580094e1cb76e511066f3cb7dbd8e36aa6e25..07d16d273210a68d882aeaaebef81b02d5b6683c 100644 --- a/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/incompressible/RAS/kOmegaSST/kOmegaSST.H @@ -24,19 +24,25 @@ License Class Foam::incompressible::RASModels::kOmegaSST -Group - grpIcoRASTurbulence - Description Implementation of the k-omega-SST turbulence model for incompressible flows. Turbulence model described in: \verbatim - Menter, F., Esch, T. - "Elements of Industrial Heat Transfer Prediction" + Menter, F., Esch, T., + "Elements of Industrial Heat Transfer Prediction", 16th Brazilian Congress of Mechanical Engineering (COBEM), - Nov. 2001 + Nov. 2001. + \endverbatim + + with the addition of the optional F3 term for rough walls from + \verbatim + Hellsten, A. + "Some Improvements in Menter’s k-omega-SST turbulence model" + 29th AIAA Fluid Dynamics Conference, + AIAA-98-2554, + June 1998. \endverbatim Note that this implementation is written in terms of alpha diffusion @@ -69,7 +75,9 @@ Description gamma1 0.5532; gamma2 0.4403; a1 0.31; + b1 1.0; c1 10.0; + F3 no; } \endverbatim @@ -122,8 +130,12 @@ protected: dimensionedScalar betaStar_; dimensionedScalar a1_; + dimensionedScalar b1_; dimensionedScalar c1_; + Switch F3_; + + //- Wall distance field // Note: different to wall distance in parent RASModel wallDist y_; @@ -139,6 +151,8 @@ protected: tmp<volScalarField> F1(const volScalarField& CDkOmega) const; tmp<volScalarField> F2() const; + tmp<volScalarField> F3() const; + tmp<volScalarField> F23() const; tmp<volScalarField> blend ( diff --git a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C index 03a3b8a5a6eaa9981d91986000fc33e9985bc716..8803807bbee7c4d89f5c5ace959c0b0aaa7cf882 100644 --- a/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C +++ b/src/turbulenceModels/incompressible/RAS/qZeta/qZeta.C @@ -311,7 +311,7 @@ void qZeta::correct() tmp<volScalarField> S2 = 2*magSqr(symm(fvc::grad(U_))); - volScalarField G("RASModel.G", nut_/(2.0*q_)*S2); + volScalarField G(type() + ".G", nut_/(2.0*q_)*S2); const volScalarField E(nu()*nut_/q_*fvc::magSqrGradGrad(U_)); diff --git a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C index 3161d16371a95bf46db40c7dc4808acca7284a7d..d106180142072934341fe6040083f7e33a4fb444 100644 --- a/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C +++ b/src/turbulenceModels/incompressible/RAS/realizableKE/realizableKE.C @@ -297,7 +297,7 @@ void realizableKE::correct() const volScalarField eta(magS*k_/epsilon_); tmp<volScalarField> C1 = max(eta/(scalar(5) + eta), scalar(0.43)); - volScalarField G("RASModel.G", nut_*S2); + volScalarField G(type() + ".G", nut_*S2); // Update epsilon and G at the wall epsilon_.boundaryField().updateCoeffs(); diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.C b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C new file mode 100644 index 0000000000000000000000000000000000000000..642dc819bfcfc7782fd39afbd83358e9171b8993 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.C @@ -0,0 +1,460 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "v2f.H" +#include "fixedValueFvPatchField.H" +#include "zeroGradientFvPatchField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(v2f, 0); +addToRunTimeSelectionTable(RASModel, v2f, dictionary); + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +wordList v2f::RBoundaryTypes() const +{ + const volScalarField::GeometricBoundaryField& bf(k_.boundaryField()); + + wordList bTypes + ( + bf.size(), + zeroGradientFvPatchField<symmTensor>::typeName + ); + + forAll(bf, patchI) + { + if (bf[patchI].fixesValue()) + { + bTypes[patchI] = fixedValueFvPatchField<symmTensor>::typeName; + } + } + + return bTypes; +} + + +tmp<volScalarField> v2f::davidsonCorrectNut +( + const tmp<volScalarField>& value +) const +{ + return min(CmuKEps_*sqr(k_)/epsilon_, value); +} + + +tmp<volScalarField> v2f::Ts() const +{ + return max(k_/epsilon_, 6.0*sqrt(nu()/epsilon_)); +} + + +tmp<volScalarField> v2f::Ls() const +{ + return CL_*max(pow(k_, 1.5)/epsilon_, Ceta_*pow025(pow3(nu())/epsilon_)); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +v2f::v2f +( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport, + const word& turbulenceModelName, + const word& modelName +) +: + RASModel(modelName, U, phi, transport, turbulenceModelName), + + Cmu_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Cmu", + coeffDict_, + 0.22 + ) + ), + CmuKEps_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CmuKEps", + coeffDict_, + 0.09 + ) + ), + C1_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "C1", + coeffDict_, + 1.4 + ) + ), + C2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "C2", + coeffDict_, + 0.3 + ) + ), + CL_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "CL", + coeffDict_, + 0.23 + ) + ), + Ceta_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ceta", + coeffDict_, + 70.0 + ) + ), + Ceps2_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "Ceps2", + coeffDict_, + 1.9 + ) + ), + sigmaK_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "sigmaK", + coeffDict_, + 1.0 + ) + ), + sigmaEps_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "sigmaEps", + coeffDict_, + 1.3 + ) + ), + + k_ + ( + IOobject + ( + "k", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + epsilon_ + ( + IOobject + ( + "epsilon", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2_ + ( + IOobject + ( + "v2", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + f_ + ( + IOobject + ( + "f", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + nut_ + ( + IOobject + ( + "nut", + runTime_.timeName(), + mesh_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh_ + ), + v2Min_(dimensionedScalar("v2Min", v2_.dimensions(), SMALL)), + fMin_(dimensionedScalar("fMin", f_.dimensions(), 0.0)) +{ + bound(k_, kMin_); + bound(epsilon_, epsilonMin_); + bound(v2_, v2Min_); + bound(f_, fMin_); + + nut_ = davidsonCorrectNut(Cmu_*v2_*Ts()); + nut_.correctBoundaryConditions(); + + printCoeffs(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp<volSymmTensorField> v2f::R() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "R", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + ((2.0/3.0)*I)*k_ - nut_*twoSymm(fvc::grad(U_)), + RBoundaryTypes() + ) + ); +} + + +tmp<volSymmTensorField> v2f::devReff() const +{ + return tmp<volSymmTensorField> + ( + new volSymmTensorField + ( + IOobject + ( + "devRhoReff", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -nuEff()*dev(twoSymm(fvc::grad(U_))) + ) + ); +} + + +tmp<fvVectorMatrix> v2f::divDevReff(volVectorField& U) const +{ + return + ( + - fvm::laplacian(nuEff(), U) + - fvc::div(nuEff()*dev(T(fvc::grad(U)))) + ); +} + + +tmp<fvVectorMatrix> v2f::divDevRhoReff +( + const volScalarField& rho, + volVectorField& U +) const +{ + volScalarField muEff("muEff", rho*nuEff()); + + return + ( + - fvm::laplacian(muEff, U) + - fvc::div(muEff*dev(T(fvc::grad(U)))) + ); +} + + +bool v2f::read() +{ + if (RASModel::read()) + { + Cmu_.readIfPresent(coeffDict()); + CmuKEps_.readIfPresent(coeffDict()); + C1_.readIfPresent(coeffDict()); + C2_.readIfPresent(coeffDict()); + CL_.readIfPresent(coeffDict()); + Ceta_.readIfPresent(coeffDict()); + Ceps2_.readIfPresent(coeffDict()); + sigmaK_.readIfPresent(coeffDict()); + sigmaEps_.readIfPresent(coeffDict()); + + return true; + } + else + { + return false; + } +} + + +void v2f::correct() +{ + RASModel::correct(); + + if (!turbulence_) + { + return; + } + + // use N=6 so that f=0 at walls + const dimensionedScalar N("N", dimless, 6.0); + + const volTensorField gradU(fvc::grad(U_)); + const volScalarField S2(2*magSqr(dev(symm(gradU)))); + + const volScalarField G(type() + ".G", nut_*S2); + const volScalarField T(Ts()); + const volScalarField L2(type() + ".L2", sqr(Ls())); + const volScalarField alpha + ( + "v2f::alpha", + 1.0/T*((C1_ - N)*v2_ - 2.0/3.0*k_*(C1_ - 1.0)) + ); + + + tmp<volScalarField> Ceps1 = + 1.4*(1.0 + 0.05*min(sqrt(k_/v2_), scalar(100.0))); + + // Update epsilon (and possibly G) at the wall + epsilon_.boundaryField().updateCoeffs(); + + // Dissipation equation + tmp<fvScalarMatrix> epsEqn + ( + fvm::ddt(epsilon_) + + fvm::div(phi_, epsilon_) + - fvm::laplacian(DepsilonEff(), epsilon_) + == + Ceps1*G/T + - fvm::Sp(Ceps2_/T, epsilon_) + ); + + epsEqn().relax(); + + epsEqn().boundaryManipulate(epsilon_.boundaryField()); + + solve(epsEqn); + bound(epsilon_, epsilonMin_); + + + // Turbulent kinetic energy equation + tmp<fvScalarMatrix> kEqn + ( + fvm::ddt(k_) + + fvm::div(phi_, k_) + - fvm::laplacian(DkEff(), k_) + == + G + - fvm::Sp(epsilon_/k_, k_) + ); + + kEqn().relax(); + solve(kEqn); + bound(k_, kMin_); + + + // Relaxation function equation + tmp<fvScalarMatrix> fEqn + ( + - fvm::laplacian(f_) + == + - fvm::Sp(1.0/L2, f_) + - 1.0/L2/k_*(alpha - C2_*G) + ); + + fEqn().relax(); + solve(fEqn); + bound(f_, fMin_); + + + // Turbulence stress normal to streamlines equation + tmp<fvScalarMatrix> v2Eqn + ( + fvm::ddt(v2_) + + fvm::div(phi_, v2_) + - fvm::laplacian(DkEff(), v2_) + == + min(k_*f_, -alpha + C2_*G) + - fvm::Sp(N*epsilon_/k_, v2_) + ); + + v2Eqn().relax(); + solve(v2Eqn); + bound(v2_, v2Min_); + + + // Re-calculate viscosity + nut_ = davidsonCorrectNut(Cmu_*v2_*T); + nut_.correctBoundaryConditions(); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/RAS/v2f/v2f.H b/src/turbulenceModels/incompressible/RAS/v2f/v2f.H new file mode 100644 index 0000000000000000000000000000000000000000..0aff2182b95bdd968c6bab74e69268e2b0804209 --- /dev/null +++ b/src/turbulenceModels/incompressible/RAS/v2f/v2f.H @@ -0,0 +1,284 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::incompressible::RASModels::v2f + +Group + grpIcoRASTurbulence + +Description + Lien and Kalitzin's v2-f turbulence model for incompressible flows, with + a limit imposed on the turbulent viscosity given by Davidson et al. + + The model solves for turbulence k and epsilon, with additional equations + for the turbulence stress normal to streamlines, v2, and elliptic damping + function, f. The variant implemented employs N=6, such that f=0 on walls. + + Wall boundary conditions are: + + k = kLowReWallFunction + epsilon = epsilonLowReWallFunction + v2 = v2WalLFunction + f = fWallFunction + + These are applicable to both low- and high-Reynolds number flows. + + Inlet values can be approximated by: + + v2 = 2/3 k + f = zero-gradient + + + References: + + Lien F-S, Kalitzin G, 2001. Computations of transonic flow with the v2-f + turbulence model. Int. J. Heat Fluid Flow 22, pp 53-61 + + Davidson L, Nielsen P, Sveningsson A, 2003. Modifications of the v2-f + model for computing the flow in a 3D wall jet. Turbulence, Heat and Mass + Transfer 4, pp 577-584 + + The default model coefficients are given as: + \verbatim + v2fCoeffs + { + Cmu 0.22; + CmuKEps 0.09; + C1 1.4; + C2 0.3; + CL 0.23; + Ceta 70; + Ceps2 1.9; + sigmaEps 1.3; + sigmaK 1; + } + \endverbatim + +Note + If the kLowReWallFunction is employed, a velocity variant of the turbulent + viscosity wall function should be used, e.g. nutUWallFunction. Turbulence + k variants (nutk...) for this case will not behave correctly. + +SeeAlso + Foam::kEpsilon + Foam::kLowReWallFunctionFvPatchScalarField + Foam::epsilonLowReWallFunctionFvPatchScalarField + Foam::v2WallFunctionFvPatchScalarField + Foam::fWallFunctionFvPatchScalarField + +SourceFiles + v2f.C + +\*---------------------------------------------------------------------------*/ + +#ifndef v2f_H +#define v2f_H + +#include "RASModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace incompressible +{ +namespace RASModels +{ + +/*---------------------------------------------------------------------------*\ + Class v2f Declaration +\*---------------------------------------------------------------------------*/ + +class v2f +: + public RASModel +{ + +protected: + + // Protected data + + // Model coefficients + + dimensionedScalar Cmu_; + dimensionedScalar CmuKEps_; + dimensionedScalar C1_; + dimensionedScalar C2_; + dimensionedScalar CL_; + dimensionedScalar Ceta_; + dimensionedScalar Ceps2_; + dimensionedScalar sigmaK_; + dimensionedScalar sigmaEps_; + + + // Fields + + //- Turbulence kinetic energy + volScalarField k_; + + //- Turbulence dissipation + volScalarField epsilon_; + + //- Turbulence stress normal to streamlines + volScalarField v2_; + + //- Damping function + volScalarField f_; + + //- Turbulence viscosity + volScalarField nut_; + + + // Bounding values + + dimensionedScalar v2Min_; + dimensionedScalar fMin_; + + + // Protected Member Functions + + //- Return boundary type names for the R field + wordList RBoundaryTypes() const; + + //- Apply Davidson correction to nut + tmp<volScalarField> davidsonCorrectNut + ( + const tmp<volScalarField>& value + ) const; + + //- Return time scale, Ts + tmp<volScalarField> Ts() const; + + //- Return length scale, Ls + tmp<volScalarField> Ls() const; + + +public: + + //- Runtime type information + TypeName("v2f"); + + // Constructors + + //- Construct from components + v2f + ( + const volVectorField& U, + const surfaceScalarField& phi, + transportModel& transport, + const word& turbulenceModelName = turbulenceModel::typeName, + const word& modelName = typeName + ); + + + //- Destructor + virtual ~v2f() + {} + + + // Member Functions + + //- Return the turbulence viscosity + virtual tmp<volScalarField> nut() const + { + return nut_; + } + + //- Return the effective diffusivity for k + tmp<volScalarField> DkEff() const + { + return tmp<volScalarField> + ( + new volScalarField("DkEff", nut_/sigmaK_ + nu()) + ); + } + + //- Return the effective diffusivity for epsilon + tmp<volScalarField> DepsilonEff() const + { + return tmp<volScalarField> + ( + new volScalarField("DepsilonEff", nut_/sigmaEps_ + nu()) + ); + } + + //- Return the turbulence kinetic energy + virtual tmp<volScalarField> k() const + { + return k_; + } + + //- Return the turbulence kinetic energy dissipation rate + virtual tmp<volScalarField> epsilon() const + { + return epsilon_; + } + + //- Return turbulence stress normal to streamlines + virtual tmp<volScalarField> v2() const + { + return v2_; + } + + //- Return the damping function + virtual tmp<volScalarField> f() const + { + return f_; + } + + //- Return the Reynolds stress tensor + virtual tmp<volSymmTensorField> R() const; + + //- Return the effective stress tensor including the laminar stress + virtual tmp<volSymmTensorField> devReff() const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevReff(volVectorField& U) const; + + //- Return the source term for the momentum equation + virtual tmp<fvVectorMatrix> divDevRhoReff + ( + const volScalarField& rho, + volVectorField& U + ) const; + + //- Solve the turbulence equations and correct the turbulence viscosity + virtual void correct(); + + //- Read RASProperties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace incompressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C index a633c7a70e30df29bdc8c7feb1b33e4fa86d3ffc..65a6e2e6850bb00222cdd8103482490e41d27b78 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C +++ b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.C @@ -77,6 +77,12 @@ autoPtr<laminar> laminar::New // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +const dictionary& laminar::coeffDict() const +{ + return dictionary::null; +} + + tmp<volScalarField> laminar::nut() const { return tmp<volScalarField> diff --git a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H index 5b79ecd48538d6226854350183a0746e7ab9b5ca..9c8588015f02025d604238d121367902b2a0e95a 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/laminar/laminar.H @@ -89,6 +89,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const; + //- Return the turbulence viscosity, i.e. 0 for laminar flow virtual tmp<volScalarField> nut() const; diff --git a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H index c2eacdaf39201458b69422646d363383a7fde7f3..91eef14ad78ce3f5cb62e9c556b28586e3325ee1 100644 --- a/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H @@ -153,6 +153,9 @@ public: // Member Functions + //- Const access to the coefficients dictionary + virtual const dictionary& coeffDict() const = 0; + //- Access function to velocity field inline const volVectorField& U() const { diff --git a/tutorials/Allrun b/tutorials/Allrun index 3eddc44e93dda100053da41202d99cd38427304d..d4bdfb3dff2a7f740ba82ef1a1a3e6ed80723682 100755 --- a/tutorials/Allrun +++ b/tutorials/Allrun @@ -68,7 +68,7 @@ logReport() # Recursively run all tutorials -foamRunTutorials cases +foamRunTutorials -test -skipFirst # Analyse all log files diff --git a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes index 2d46eb050dc4cd2c61df6644591aa04e17a993be..a3dcbfcc2e66654b9297106cde9a02c2d1ec37d7 100644 --- a/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes +++ b/tutorials/combustion/PDRFoam/flamePropagationWithObstacles/system/fvSchemes @@ -57,14 +57,14 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian((rho*inv((((1)*A(U))+tDragDcu))),p) Gauss linear limited 0.333; - laplacian(Db,b) Gauss linear limited 0.333; - laplacian(Db,ft) Gauss linear limited 0.333; - laplacian(Db,ha) Gauss linear limited 0.333; - laplacian(Db,hau) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian((rho*inv((((1)*A(U))+tDragDcu))),p) Gauss linear limited corrected 0.333; + laplacian(Db,b) Gauss linear limited corrected 0.333; + laplacian(Db,ft) Gauss linear limited corrected 0.333; + laplacian(Db,ha) Gauss linear limited corrected 0.333; + laplacian(Db,hau) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -74,7 +74,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes b/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes index 9bfa83ecf5e6486167c95847d19a382cbe849f57..a92565feff27b97e4a0918e9dc37cae47751da0b 100644 --- a/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes +++ b/tutorials/combustion/engineFoam/kivaTest/system/fvSchemes @@ -58,7 +58,7 @@ divSchemes laplacianSchemes { - default Gauss linear limited 0.5; + default Gauss linear limited corrected 0.5; } interpolationSchemes @@ -68,7 +68,7 @@ interpolationSchemes snGradSchemes { - default limited 0.5; + default limited corrected 0.5; } fluxRequired diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun index ca4e9e4bd84db1274086f8d9521027c1ab0f93f7..6763873c72aa5f2e8a3c6face61c654817615293 100755 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/Allrun @@ -10,7 +10,7 @@ application=`getApplication` runApplication blockMesh runApplication topoSet -dict cRefine.topoSetDict -runApplication refineMesh -overwrite -dict +runApplication refineMesh -overwrite -dict system/refineMeshDict rm log.topoSet runApplication topoSet -dict f.topoSetDict diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones index 1895f851df5b662b8e39e0b663c4b2d2e358cba1..cef16b64a545cd096a1387206ea715df3c9f582f 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones @@ -27,8 +27,6 @@ FoamFile reactingOneDimCoeffs { - filmCoupled false; - radFluxName Qr; minimumDelta 1e-12; diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes index e683569e7a4ff14a8dce39837c09a946d0f1cecb..ce5f53c2cf9759f169675321eb09bc0b59cbb59b 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes @@ -50,7 +50,7 @@ laplacianSchemes default Gauss linear corrected; laplacian(muEff,U) Gauss linear corrected; laplacian(DkEff,k) Gauss linear corrected; - laplacian(alphaEff,h) Gauss linear corrected; + laplacian(thermo:alpha,h) Gauss linear corrected; laplacian((((rho*(1|A(U)))*rho)*gh)) Gauss linear corrected; laplacian(interpolate((rho*(1|A(U)))),p) Gauss linear corrected; laplacian(gammaRad,G) Gauss linear corrected; diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes index ba8fe3450957cef74c51d40a8806c5b7fdc71181..afb9f402f103f655e60bcebdde33457f94302ce8 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear uncorrected; + laplacian(thermo:alpha,h) Gauss linear uncorrected; } interpolationSchemes diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones index 65436e1e8d7b36fb10c386e0eec7efff240ba130..d5ebc6e44efc3b6467acbd8b0cd6f33780f01a25 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/pyrolysisZones @@ -28,8 +28,6 @@ FoamFile reactingOneDimCoeffs { - filmCoupled false; - radFluxName Qr; minimumDelta 1e-8; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones index 65436e1e8d7b36fb10c386e0eec7efff240ba130..d5ebc6e44efc3b6467acbd8b0cd6f33780f01a25 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/pyrolysisZones @@ -28,8 +28,6 @@ FoamFile reactingOneDimCoeffs { - filmCoupled false; - radFluxName Qr; minimumDelta 1e-8; diff --git a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0.org/T b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0.org/T index 85431492b2ff7f5527c6f82e582d533d8349fa63..3ddfa33af1cc4faa80700b3981855743bc50800d 100644 --- a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0.org/T +++ b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0.org/T @@ -39,7 +39,7 @@ boundaryField U U; phi phi; rho none; - psi psi; + psi thermo:psi; gamma 1.4; } diff --git a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/T b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/T index 5361f751ed6c0641f80cd0af5082aef76c43190c..4fee89f86e76dba1287952d26dc7c97f80836833 100644 --- a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/T +++ b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/T @@ -1243,7 +1243,7 @@ boundaryField type totalTemperature; U U; phi phi; - psi psi; + psi thermo:psi; gamma 1.4; T0 uniform 297; value nonuniform List<scalar> diff --git a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/p b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/p index 982367ad38085aa13beae19a5ebe4ca1a6940fe4..9de87d0b3f89fddad04d3c5a42733512bf59c8d9 100644 --- a/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/p +++ b/tutorials/compressible/rhoCentralFoam/LadenburgJet60psi/0/p @@ -1235,7 +1235,7 @@ boundaryField field p; phi phi; rho rho; - psi psi; + psi thermo:psi; gamma 1.4; fieldInf 101325; lInf 0.025; @@ -1275,7 +1275,7 @@ boundaryField U U; phi phi; rho none; - psi psi; + psi thermo:psi; gamma 1.4; p0 uniform 101325; value nonuniform List<scalar> diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/T b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/T similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/T rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/T diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/U b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/U similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/U rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/U diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/alphat b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/alphat similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/alphat rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/alphat diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/epsilon b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/epsilon similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/epsilon rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/epsilon diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/k b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/k similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/k rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/k diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/mut b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/mut similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/mut rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/mut diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/p b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/p similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/0/p rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/0/p diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/Allrun b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/Allrun similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/Allrun rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/Allrun diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/RASProperties b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/RASProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/RASProperties rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/RASProperties diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/polyMesh/blockMeshDict.m4 b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/polyMesh/blockMeshDict.m4 similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/polyMesh/blockMeshDict.m4 rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/polyMesh/blockMeshDict.m4 diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/polyMesh/boundary b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/polyMesh/boundary similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/polyMesh/boundary rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/polyMesh/boundary diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/porosityProperties b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/sourcesProperties similarity index 58% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/porosityProperties rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/sourcesProperties index adc5ef3cc2132d7cce9aa225dd447c2b99a9dac3..6137d5900e33a0f991e238e97b99a0ec3d1b0968 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/porosityProperties +++ b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/sourcesProperties @@ -11,29 +11,36 @@ FoamFile format ascii; class dictionary; location "constant"; - object porosityProperties; + object sourcesProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // porosity1 { - type fixedCoeff; - active yes; + type explicitPorositySource; + active true; + timeStart 0; + duration 1000000; + selectionMode cellZone; cellZone porosity; - fixedCoeffCoeffs + explicitPorositySourceCoeffs { - alpha alpha [0 0 -1 0 0 0 0] (500 -1000 -1000); - beta beta [0 -1 0 0 0 0 0] (0 0 0); - rhoRef 1; + type DarcyForchheimer; - coordinateSystem + DarcyForchheimerCoeffs { - e1 (0.70710678 0.70710678 0); - e2 (0 0 1); + d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000); + f f [0 -1 0 0 0 0 0] (0 0 0); + + coordinateSystem + { + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } } } } -// ************************************************************************* // +************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/thermophysicalProperties b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/thermophysicalProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/thermophysicalProperties rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/thermophysicalProperties diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/turbulenceProperties b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/turbulenceProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/turbulenceProperties rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/constant/turbulenceProperties diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/controlDict b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/controlDict similarity index 96% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/controlDict rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/controlDict index 63886eda94d690ecdb5ec01e4b63198b2a91fed0..5a690b046ddce702ec81f2ed6c9aeba2b9bfaf56 100644 --- a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/controlDict +++ b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoPorousMRFLTSPimpleFoam; +application rhoLTSPimpleFoam; startFrom startTime; diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/fvSchemes b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/fvSchemes rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvSchemes diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/fvSolution b/tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvSolution similarity index 100% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/system/fvSolution rename to tutorials/compressible/rhoLTSPimpleFoam/angledDuct/system/fvSolution diff --git a/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/0/p b/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/0/p index fa4008822f40a122b52b124b049854df1dbc30fa..0f1e50b4b897813357996cc8f94848c3249d886f 100644 --- a/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/0/p +++ b/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/0/p @@ -31,7 +31,7 @@ boundaryField field p; phi phi; rho rho; - psi psi; + psi thermo:psi; gamma 1.3; fieldInf 1e5; lInf 0.3; diff --git a/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/constant/thermophysicalProperties b/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/constant/thermophysicalProperties index 014d7ffc49fd2e1a0940f5c07d21a51c60c02310..955bebb2d53b720343f10ffdd98024b8131779b7 100644 --- a/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/constant/thermophysicalProperties +++ b/tutorials/compressible/rhoPimpleFoam/les/pitzDaily/constant/thermophysicalProperties @@ -42,7 +42,7 @@ gasThermoTypes thermoType { - $.gasThermoTypes.constant; + ${:gasThermoTypes.constant}; } mixture diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/T b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/T similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/T rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/T diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/U b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/U similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/U rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/U diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/alphat b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/alphat similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/alphat rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/alphat diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/epsilon b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/epsilon similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/epsilon rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/epsilon diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/k b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/k similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/k rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/k diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/mut b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/mut similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/mut rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/mut diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/p b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/p similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/0/p rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/0/p diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/Allrun b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/Allrun similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/Allrun rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/Allrun diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/RASProperties b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/RASProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/RASProperties rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/RASProperties diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/polyMesh/boundary similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/polyMesh/boundary rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/polyMesh/boundary diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porosityProperties b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/porosityProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/porosityProperties rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/porosityProperties diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/thermophysicalProperties b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/thermophysicalProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/thermophysicalProperties rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/thermophysicalProperties diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/transportProperties b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/transportProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/transportProperties rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/transportProperties diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/turbulenceProperties b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/turbulenceProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/turbulenceProperties rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/constant/turbulenceProperties diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/makeMesh similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/makeMesh rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/makeMesh diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/controlDict similarity index 96% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/controlDict index 2e2970fd6f11c72ec084b1f0c95d3923f24e88d9..3ee2c8f628a2690341bd46457ebce4821a6eebb2 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/controlDict +++ b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoPorousMRFPimpleFoam; +application rhoPimpleFoam; startFrom startTime; diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSchemes rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/fvSchemes diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution b/tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/fvSolution similarity index 100% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/system/fvSolution rename to tutorials/compressible/rhoPimpleFoam/ras/mixerVessel2D/system/fvSolution diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/0 b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/0 deleted file mode 120000 index f1c4a884b51ae4171513426c3b7f5f585d0d889e..0000000000000000000000000000000000000000 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/0 +++ /dev/null @@ -1 +0,0 @@ -../angledDuctImplicit/0 \ No newline at end of file diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/Allrun b/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/Allrun deleted file mode 120000 index 09efeaf930d72136d1edbe49a421bc368227ad21..0000000000000000000000000000000000000000 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/Allrun +++ /dev/null @@ -1 +0,0 @@ -../angledDuctImplicit/Allrun \ No newline at end of file diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/0 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/0 similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/0 rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/0 diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/Allrun b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/Allrun similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/Allrun rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/Allrun diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/constant b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/constant similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/constant rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/constant diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/controlDict b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/controlDict similarity index 96% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/controlDict rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/controlDict index 4208f0d7564a0dffee439962d23367206545fca6..4974079c9d7ff51a1f65a7ded878e7afb9eb2592 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/controlDict +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoPorousMRFSimpleFoam; +application rhoPorousSimpleFoam; startFrom startTime; diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/fvSchemes rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSchemes diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/fvSolution b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSolution similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/fvSolution rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctExplicit/system/fvSolution diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/T b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/T similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/T rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/T diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/U b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/U similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/U rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/U diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/alphat b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/alphat similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/alphat rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/alphat diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/epsilon b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/epsilon similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/epsilon rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/epsilon diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/k b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/k similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/k rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/k diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/mut b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/mut similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/mut rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/mut diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/p b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/p similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/0/p rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/0/p diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/Allrun b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/Allrun similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/Allrun rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/Allrun diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFZones b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/MRFProperties similarity index 95% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFZones rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/MRFProperties index de81c73439850dabae0c51d6f0b899921f752af6..fd749d03963870c76ab4a9d85ad86bd95c33a71f 100644 --- a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/MRFZones +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/MRFProperties @@ -11,11 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0 -() +// none // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/RASProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/RASProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/RASProperties rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/RASProperties diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/blockMeshDict.m4 b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/polyMesh/blockMeshDict.m4 similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/blockMeshDict.m4 rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/polyMesh/blockMeshDict.m4 diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/boundary b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/polyMesh/boundary similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/boundary rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/polyMesh/boundary diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/porosityProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/porosityProperties rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/porosityProperties diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/sourcesProperties similarity index 90% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/sourcesProperties index 4386bc52506b016f5aa089d5535b7d7c81ed7694..1a3adf4c90dbcad913511bc34ec92168dc1207b1 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/sourcesProperties @@ -17,15 +17,16 @@ FoamFile source1 { - type fixedTemperatureSource; + type fixedTemperatureConstraint; active true; timeStart 0; duration 1000000; selectionMode cellZone; cellZone porosity; - fixedTemperatureSourceCoeffs + fixedTemperatureConstraintCoeffs { + mode uniform; temperature 350; } } diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/thermophysicalProperties b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/thermophysicalProperties rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/controlDict b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/controlDict similarity index 96% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/controlDict rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/controlDict index 22f84576a10d2e942c9eb465ca7db3f3c0636d5d..ded00ba56989e5cf543268e42fa253de1208fb42 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/controlDict +++ b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoPorousMRFSimpleFoam; +application rhoPorousSimpleFoam; startFrom startTime; diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSchemes b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSchemes rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSchemes diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/fvSolution b/tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSolution similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/fvSolution rename to tutorials/compressible/rhoPorousSimpleFoam/angledDuctImplicit/system/fvSolution diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/T b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/T new file mode 100644 index 0000000000000000000000000000000000000000..561ca236be3bbed252ef63b29c24063a3bea4c6b --- /dev/null +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/T @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 293; + +boundaryField +{ + + front + { + type zeroGradient; + } + back + { + type zeroGradient; + } + wall + { + type zeroGradient; + } + porosityWall + { + type zeroGradient; + } + + inlet + { + type fixedValue; + value $internalField; + } + outlet + { + type inletOutlet; + value $internalField; + inletValue $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/U1 b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/U similarity index 74% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/U1 rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/U index 6272fb918822b948a477372c7182acb492a1ac31..20e25d12a8c318b8b0532714ad2919ed4068fe7c 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/U1 +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/U @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volVectorField; - object U1; + object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -20,28 +20,37 @@ internalField uniform (0 0 0); boundaryField { - inlet + front { type fixedValue; - value uniform (0 0.1 0); + value uniform (0 0 0); } - - outlet + back { - type inletOutlet; - inletValue uniform (0 0 0); + type fixedValue; value uniform (0 0 0); } - - walls + wall { type fixedValue; value uniform (0 0 0); } - - defaultFaces + porosityWall + { + type slip; + value uniform (0 0 0); + } + inlet + { + type flowRateInletVelocity; + massFlowRate constant 0.1; + value uniform (0 0 0); + } + outlet { - type empty; + type inletOutlet; + value uniform (0 0 0); + inletValue uniform (0 0 0); } } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/alphat b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/alphat similarity index 84% rename from tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/alphat rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/alphat index aefa32d852bcadeec8d59effb605a7a8182c6ee6..f609fa6c14c41bba0ec2726af2cf56a9ca8c949a 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/alphat +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/alphat @@ -21,32 +21,36 @@ internalField uniform 0; boundaryField { - //- Set patchGroups for constraint patches - #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - - ground + front { type alphatWallFunction; value uniform 0; } - - igloo_region0 + back { type alphatWallFunction; value uniform 0; } - - twoFridgeFreezers_seal_0 + wall { type alphatWallFunction; value uniform 0; } - - twoFridgeFreezers_herring_1 + porosityWall { type alphatWallFunction; value uniform 0; } + inlet + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } } diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/epsilon b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/epsilon new file mode 100644 index 0000000000000000000000000000000000000000..7588e13063f38c366c8ffde4243960a54be45481 --- /dev/null +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/epsilon @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -3 0 0 0 0 ]; + +internalField uniform 200; + +boundaryField +{ + front + { + type compressible::epsilonWallFunction; + value uniform 200; + } + + back + { + type compressible::epsilonWallFunction; + value uniform 200; + } + + wall + { + type compressible::epsilonWallFunction; + value uniform 200; + } + + porosityWall + { + type compressible::epsilonWallFunction; + value uniform 200; + } + + inlet + { + type compressible::turbulentMixingLengthDissipationRateInlet; + mixingLength 0.005; + value uniform 200; + } + + outlet + { + type inletOutlet; + inletValue uniform 200; + value uniform 200; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/k b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/k new file mode 100644 index 0000000000000000000000000000000000000000..85df9b83c3bce148f8c7ac811acd0cf59387505a --- /dev/null +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/k @@ -0,0 +1,64 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 0 2 -2 0 0 0 0 ]; + +internalField uniform 1; + +boundaryField +{ + front + { + type compressible::kqRWallFunction; + value uniform 1; + } + + back + { + type compressible::kqRWallFunction; + value uniform 1; + } + + wall + { + type compressible::kqRWallFunction; + value uniform 1; + } + + porosityWall + { + type compressible::kqRWallFunction; + value uniform 1; + } + + inlet + { + type turbulentIntensityKineticEnergyInlet; + intensity 0.05; + value uniform 1; + } + + outlet + { + type inletOutlet; + inletValue uniform 1; + value uniform 1; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/mut b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/mut new file mode 100644 index 0000000000000000000000000000000000000000..2ba718d5b53378d89430ecd57f631fb03f833a0f --- /dev/null +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/mut @@ -0,0 +1,62 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object mut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 -1 -1 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + front + { + type mutkWallFunction; + value uniform 0; + } + + back + { + type mutkWallFunction; + value uniform 0; + } + + wall + { + type mutkWallFunction; + value uniform 0; + } + + porosityWall + { + type mutkWallFunction; + value uniform 0; + } + + inlet + { + type calculated; + value uniform 0; + } + + outlet + { + type calculated; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/epsilon b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/p similarity index 73% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/epsilon rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/p index d5ee15eb79d080246921e64270bf55a4d1541884..21db04d6109a0348229d019cb3a13d728044c86d 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/epsilon +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/0/p @@ -10,37 +10,41 @@ FoamFile version 2.0; format ascii; class volScalarField; - object epsilon; + object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -3 0 0 0 0]; +dimensions [1 -1 -2 0 0 0 0]; -internalField uniform 0.1; +internalField uniform 1.0e5; boundaryField { - inlet + front { - type fixedValue; - value uniform 0.1; + type zeroGradient; } - - outlet + back { - type inletOutlet; - inletValue uniform 0.1; - value uniform 0.1; + type zeroGradient; } - - walls + wall + { + type zeroGradient; + } + porosityWall { type zeroGradient; } - defaultFaces + inlet + { + type zeroGradient; + } + outlet { - type empty; + type fixedValue; + value $internalField; } } diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..e51c24da589a43cad82e0ee61b0940f550f0a880 --- /dev/null +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/Allrun @@ -0,0 +1,14 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +application=`getApplication` + +runApplication blockMesh +runApplication $application + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/RASProperties b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/RASProperties similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/RASProperties rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/RASProperties diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/polyMesh/blockMeshDict.m4 b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/blockMeshDict.m4 similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/polyMesh/blockMeshDict.m4 rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/blockMeshDict.m4 diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/polyMesh/boundary b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/boundary similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/polyMesh/boundary rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/polyMesh/boundary diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties new file mode 100644 index 0000000000000000000000000000000000000000..a73a9bd2b7ce0c63bf7e09a803ccdfa1241ec2b8 --- /dev/null +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/sourcesProperties @@ -0,0 +1,66 @@ +/*--------------------------------*- 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; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +fixedTemperaure1 +{ + type fixedTemperatureConstraint; + active true; + timeStart 0; + duration 1000000; + selectionMode cellZone; + cellZone porosity; + + fixedTemperatureConstraintCoeffs + { + mode uniform; + temperature 350; + } +} + + +porosity1 +{ + type explicitPorositySource; + active true; + timeStart 0; + duration 1000000; + selectionMode cellZone; + cellZone porosity; + + explicitPorositySourceCoeffs + { + type fixedCoeff; + active yes; + cellZone porosity; + + fixedCoeffCoeffs + { + alpha alpha [0 0 -1 0 0 0 0] (500 -1000 -1000); + beta beta [0 -1 0 0 0 0 0] (0 0 0); + rhoRef 1; + + coordinateSystem + { + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); + } + } + } +} + + +************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/thermophysicalProperties similarity index 97% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/thermophysicalProperties index 920fff435c7b6e2c8b72b0af9f9e5e27324dbb6b..db1f5947af089c7ad50aba3b9b07cbfb10d2f643 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/thermophysicalProperties +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/constant/thermophysicalProperties @@ -17,7 +17,7 @@ FoamFile thermoType { - type heRhoThermo; + type hePsiThermo; mixture pureMixture; transport sutherland; thermo hConst; diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/controlDict b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/controlDict similarity index 96% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/controlDict rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/controlDict index 4208f0d7564a0dffee439962d23367206545fca6..2ec29c29a85d3870b10f2fb141af823cc4b8b31c 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicit/system/controlDict +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoPorousMRFSimpleFoam; +application rhoSimpleFoam; startFrom startTime; diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/fvSchemes b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSchemes similarity index 94% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/fvSchemes rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSchemes index e106336cb2dd0a748f8d4dc499995db3c8067024..576b46fe86e27be61a028433c302cce09643ec89 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/system/fvSchemes +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSchemes @@ -39,10 +39,9 @@ laplacianSchemes { laplacian(muEff,U) Gauss linear corrected; laplacian(alphaEff,e) Gauss linear corrected; - laplacian((rho*rAU),p) Gauss linear corrected; + laplacian((rho*(1|A(U))),p) Gauss linear corrected; laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DkEff,k) Gauss linear corrected; - laplacian(1,p) Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSolution b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSolution similarity index 100% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSolution rename to tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvSolution diff --git a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes b/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes index 0cab2f77d3ac1d8f4f224427ea6d8162e1f3c398..5a12a4e1dad9591a9322cced1e3bfb8041170629 100644 --- a/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes +++ b/tutorials/compressible/rhoSimplecFoam/squareBend/system/fvSchemes @@ -48,7 +48,6 @@ laplacianSchemes interpolationSchemes { default linear; - UD upwind phid; } snGradSchemes diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/0/p b/tutorials/compressible/sonicFoam/laminar/forwardStep/0/p index e4c6d1271167aeca841b9c31fc91d9eeb7f2ba59..bdbc4f96ce910e8e160544dd595aa116766e1bf5 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/0/p +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/0/p @@ -32,7 +32,7 @@ boundaryField field p; phi phi; rho rho; - psi psi; + psi thermo:psi; gamma 1.4; fieldInf 1; lInf 3; diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/0/p b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/0/p index 4628c438e8696a083cba22f17347f47680458334..846f03a390f09795ca44e94ab170b883f30f3c97 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/0/p +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/0/p @@ -31,7 +31,7 @@ boundaryField field p; phi phi; rho rho; - psi psi; + psi thermo:psi; gamma 1.3; fieldInf 100000; lInf 1; diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Running_Notes b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Running_Notes index 5bfc37a8623eea846dd94fa7412721b385f8f72e..030bcbe4008458e21b07295919f71a9438c031c4 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Running_Notes +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/Running_Notes @@ -3,6 +3,6 @@ nacaAirfoil * large domain with airfoil section near centre * extremely non-orthogonal, highly skew mesh refined around the airfoil * running at Mach 1.78 -* limited 0.5 on all laplacianSchemes because the mesh is so poor +* limited corrected 0.5 on all laplacianSchemes because the mesh is so poor * run to t = 0.02 with nextWrite; change to stopAt endTime to continue running * deltaT can be increased later in the run to 2e-07 diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes index 02e15a0996492aee006118eb7a41cd88ba111154..ec1368d9cac60b0b192b810b85b3b13874840ed8 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes @@ -40,7 +40,7 @@ divSchemes laplacianSchemes { - default Gauss linear limited 0.5; + default Gauss linear limited corrected 0.5; } interpolationSchemes diff --git a/tutorials/compressible/sonicFoam/ras/prism/0/p b/tutorials/compressible/sonicFoam/ras/prism/0/p index a922f0a8a5c43d18acf88282bc9e5bdca2dcf5b0..c1cc7124ff9f8cf2012de0fa92a5cd1173939012 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/0/p +++ b/tutorials/compressible/sonicFoam/ras/prism/0/p @@ -32,7 +32,7 @@ boundaryField field p; phi phi; rho rho; - psi psi; + psi thermo:psi; gamma 1.3; fieldInf 100000; lInf 1; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/T b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/T index dd74be1133a46b9ff97ad2064ed6cc089baf8d8d..7e8969b3078e2322a1a0b322509d596eb333ca63 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/T +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/T @@ -23,13 +23,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type fixedValue; - value uniform 265; - } - - igloo_region0 + wall { type fixedValue; value uniform 265; @@ -43,8 +37,7 @@ boundaryField twoFridgeFreezers_herring_1 { - type fixedValue; - value uniform 303; + $twoFridgeFreezers_seal_0; } } diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/U b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/U index f1a91fe9714a2a5299bc4a09327c18ac9df13324..03d53ee7ed6204637a49f2c048c169f6a52a7efb 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/U +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/U @@ -23,25 +23,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type fixedValue; - value uniform (0 0 0); - } - - igloo_region0 - { - type fixedValue; - value uniform (0 0 0); - } - - twoFridgeFreezers_seal_0 - { - type fixedValue; - value uniform (0 0 0); - } - - twoFridgeFreezers_herring_1 + wall { type fixedValue; value uniform (0 0 0); diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/epsilon b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/epsilon index b75802e0e81c67886d7640dda6eff85934947043..e36fe920fca9129567de3e086d9304c174333b7a 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/epsilon +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/epsilon @@ -24,25 +24,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type epsilonWallFunction; - value uniform 0.01; - } - - igloo_region0 - { - type epsilonWallFunction; - value uniform 0.01; - } - - twoFridgeFreezers_seal_0 - { - type epsilonWallFunction; - value uniform 0.01; - } - - twoFridgeFreezers_herring_1 + wall { type epsilonWallFunction; value uniform 0.01; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/k b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/k index 04edc9d0d718ca3ad5d6c5030f7988a9571fde1a..0d889ec8f851f20eb41b7231500003ea9474167a 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/k +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/k @@ -24,25 +24,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type kqRWallFunction; - value uniform 0.1; - } - - igloo_region0 - { - type kqRWallFunction; - value uniform 0.1; - } - - twoFridgeFreezers_seal_0 - { - type kqRWallFunction; - value uniform 0.1; - } - - twoFridgeFreezers_herring_1 + wall { type kqRWallFunction; value uniform 0.1; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat index 5c82ad4a5580eb46a966f9a8bcc4b1030a435732..44f2524e7fe1831c0d373adcc6586c9fff364f8c 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/kappat @@ -24,28 +24,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type kappatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - - igloo_region0 - { - type kappatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - - twoFridgeFreezers_seal_0 - { - type kappatJayatillekeWallFunction; - Prt 0.85; - value uniform 0; - } - - twoFridgeFreezers_herring_1 + wall { type kappatJayatillekeWallFunction; Prt 0.85; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/nut b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/nut index b8dae4d50fbd4d2ede26b7377332d56ee79e78fd..42472f31f0e68965ee9a1ad13f6601fa5b0fccd3 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/nut +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/nut @@ -24,25 +24,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type nutkWallFunction; - value uniform 0; - } - - igloo_region0 - { - type nutkWallFunction; - value uniform 0; - } - - twoFridgeFreezers_seal_0 - { - type nutkWallFunction; - value uniform 0; - } - - twoFridgeFreezers_herring_1 + wall { type nutkWallFunction; value uniform 0; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p index 19bfa3d347bb90bc7845cd7e598947c04de99f63..5a2eb19619103fb42215271895f29e7570444dad 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p @@ -23,25 +23,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type calculated; - value $internalField; - } - - igloo_region0 - { - type calculated; - value $internalField; - } - - twoFridgeFreezers_seal_0 - { - type calculated; - value $internalField; - } - - twoFridgeFreezers_herring_1 + wall { type calculated; value $internalField; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p_rgh b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p_rgh index e39f2ab7cec1a5b80d80c8ba492fe66bf148105c..69ceeb45df80d6666aa57b7a0d5ace5a82eba0c2 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p_rgh +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/0/p_rgh @@ -23,28 +23,7 @@ boundaryField //- Set patchGroups for constraint patches #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" - ground - { - type fixedFluxPressure; - rho rhok; - value uniform 0; - } - - igloo_region0 - { - type fixedFluxPressure; - rho rhok; - value uniform 0; - } - - twoFridgeFreezers_seal_0 - { - type fixedFluxPressure; - rho rhok; - value uniform 0; - } - - twoFridgeFreezers_herring_1 + wall { type fixedFluxPressure; rho rhok; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/blockMeshDict b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/blockMeshDict index 707a53ea74743869a8d8285474f90e9001917390..c854ce532d428bb89c9389ccb5b1a3085f262077 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/blockMeshDict +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/constant/polyMesh/blockMeshDict @@ -31,7 +31,7 @@ vertices blocks ( - hex (0 1 2 3 4 5 6 7) (20 20 20) simpleGrading (1 1 1) + hex (0 1 2 3 4 5 6 7) (20 20 10) simpleGrading (1 1 1) ); edges @@ -78,7 +78,8 @@ boundary ground { - type wall; + type wall; + inGroups (wall); faces ( (0 3 2 1) diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/controlDict b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/controlDict index 590a482d4a0ab0771e23f9cf7b5f5c20c7c442c2..31ca07d47d105adc96770c8f2667ff9a10b655ea 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/controlDict +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/controlDict @@ -15,6 +15,13 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +libs +( + "libincompressibleTurbulenceModel.so" + "libincompressibleRASModels.so" + "libincompressibleTransportModels.so" +); + application buoyantBoussinesqSimpleFoam; startFrom startTime; diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/decomposeParDict b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/decomposeParDict index 09e2478dbb33706da812b761e393eb4e280df091..7c420218539e58612ac150f681086e87a7ed50c6 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/decomposeParDict +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/decomposeParDict @@ -15,9 +15,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 6; +numberOfSubdomains 2; -method hierarchical; +method scotch; simpleCoeffs { diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes index 7a53eb9600ae3fc8926ba2dccddf2883fc109fc5..52d63773c08e1a30a4cf86e408cf5c918e69944d 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(nuEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(kappaEff,T) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(nuEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(kappaEff,T) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict index 8297dae5af0b607bd8f64704b108f3962a95336c..c5e80f8d1a3715a2600d25caa26d4fb32be862cf 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/iglooWithFridges/system/snappyHexMeshDict @@ -42,38 +42,6 @@ geometry max (1 1 1); } - fridgeFreezer - { - type searchableSurfaceCollection; - - mergeSubRegions true; - - freezer - { - surface box1; - scale (1 1 1); - transform - { - type cartesian; - origin (0 0 0); - e1 (1 0 0); - e3 (0 0 1); - } - } - fridge - { - surface box1; - scale (1 1 1.1); - transform - { - type cartesian; - origin (0 0 1); - e1 (1 0 0); - e3 (0 0 1); - } - } - } - twoFridgeFreezers { type searchableSurfaceCollection; @@ -150,7 +118,7 @@ castellatedMeshControls ( { file "fridgeA.eMesh"; - level 3; + levels ((0.01 3)); } ); @@ -180,12 +148,28 @@ castellatedMeshControls level (3 3); } } + + // Optional specification of patch type (default is wall). No + // constraint types (cyclic, symmetry) etc. are allowed. + patchInfo + { + type wall; + inGroups (wall); + } } "iglo.*" { // Surface-wise min and max refinement level level (1 1); + + // Optional specification of patch type (default is wall). No + // constraint types (cyclic, symmetry) etc. are allowed. + patchInfo + { + type wall; + inGroups (wall); + } } } @@ -288,35 +272,34 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.5; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/T b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/T index 8fbb73eff0a77df2dfa7f1c74c43b77a3fc5c5b6..92fbe4aaac1a0b84bdf24d482a9f61a8a007b046 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/T +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/T @@ -44,10 +44,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/U b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/U index 1cee83b6cf85af9d1fdbc2e3af652bf2f7e0f607..76239f12ddfe847696a49abb363e8b14db268d56 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/U +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/U @@ -46,10 +46,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/alphat b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/alphat index 977203512af76a1a6b6069e46a79016ceed42041..3bc99dd80842ce5c24663ff2f90700cf992ae00b 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/alphat +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/alphat @@ -45,10 +45,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/epsilon b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/epsilon index 21a6d42fa82dbd3969e667a7f6288a5454da2068..69f9ac68038d554c538eee00ace54ab86d56286d 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/epsilon +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/epsilon @@ -44,10 +44,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/k b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/k index 5f4612566950433a4dea33c49bb15c141e422a22..9ecfe3d9f81f3c09d5318f3d6ff78f6185e7f19a 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/k +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/k @@ -44,10 +44,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/mut b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/mut index 41310b7ced3210d164ec057f293a1e61f2a184c8..f83a004214fcb79130c0afe91bf098bb0afe6db9 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/mut +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/mut @@ -45,10 +45,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p index 8bbeb86853e72244e693f6d353a0f16019ac5ab1..d20b276591daa3df6405dd1118f665b4c7685e03 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p @@ -45,10 +45,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p_rgh b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p_rgh index 8cb7d58cdf5374a02b7f54e8539a5e3bb28102b8..26fa39b2553d6f9632bba0bfd73a4ec90aa02ca3 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p_rgh +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/0.org/p_rgh @@ -45,10 +45,6 @@ boundaryField { type empty; } - "baffle1Wall.*" - { - type calculated; - } } diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun index ed131900d36d14e0bb34237f1e1e0b69976c65dc..e83f5f5977f2f59d124f2f3aa47d3b684f064161 100755 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/Allrun @@ -13,15 +13,11 @@ unset FOAM_SETNAN unset FOAM_SIGFPE # Create first baffle -runApplication createBaffles baffleFaces '(baffle1Wall_0 baffle1Wall_1)' -overwrite +runApplication createBaffles -overwrite # Create region runApplication extrudeToRegionMesh -overwrite -# Set the BC's for the baffle -runApplication changeDictionary -dict system/changeDictionaryDict.baffle -rm log.changeDictionary - # Set Bc's for the region baffle runApplication changeDictionary -dict system/changeDictionaryDict.baffleRegion -literalRE rm log.changeDictionary diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/polyMesh/blockMeshDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/polyMesh/blockMeshDict index b1def0a3a2e42d02ff5bce810435b744873b306b..4b273990da876a73e3b02cb3064bb706916b1b08 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/polyMesh/blockMeshDict +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/constant/polyMesh/blockMeshDict @@ -84,28 +84,6 @@ boundary (4 5 6 7) ); } - - baffle1Wall_0 - { - type mappedWall; - sampleMode nearestPatchFace; - sampleRegion region0; - samplePatch baffle1Wall_1; - offsetMode uniform; - offset (0 0 0); - faces (); - } - - baffle1Wall_1 - { - type mappedWall; - sampleMode nearestPatchFace; - sampleRegion region0; - samplePatch baffle1Wall_0; - offsetMode uniform; - offset (0 0 0); - faces (); - } ); mergePatchPairs diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict index ace5803d4970623cf854673b3d6f4855a412a984..acd337d87733d98406a88afc1b08b05124efa50f 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict +++ b/tutorials/heatTransfer/buoyantSimpleFoam/circuitBoardCooling/system/controlDict @@ -44,6 +44,6 @@ timePrecision 6; runTimeModifiable true; -libs ("libthermoBaffleModels.so"); +libs ("libthermoBaffleModels.so" "libcompressibleRASModels.so"); // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/G b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/G similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/G rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/G diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/T b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/T similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/T rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/T diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/U b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/U similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/U rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/U diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/alphat b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/alphat similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/alphat rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/alphat diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/epsilon b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/epsilon similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/epsilon rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/epsilon diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/k b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/k similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/k rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/k diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/mut b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/mut similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/mut rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/mut diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/p b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/p similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/p rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/p diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/p_rgh b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/p_rgh similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/0/p_rgh rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/0/p_rgh diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/Allclean b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allclean similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/Allclean rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allclean diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allrun similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/Allrun rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/Allrun diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/RASProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/RASProperties similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/RASProperties rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/RASProperties diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/g b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/g similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/g rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/g diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/polyMesh/blockMeshDict b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/polyMesh/blockMeshDict similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/polyMesh/blockMeshDict rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/polyMesh/blockMeshDict diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/polyMesh/boundary b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/polyMesh/boundary similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/polyMesh/boundary rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/polyMesh/boundary diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/radiationProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/radiationProperties similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/radiationProperties rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/radiationProperties diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/constant/thermophysicalProperties rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/constant/thermophysicalProperties diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/controlDict b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/controlDict similarity index 96% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/controlDict rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/controlDict index 3a0f2f992fdd130a79a8399cf6de5c9130fe4ade..9e129840100693b9588d49189ad5637815be529a 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/controlDict +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application buoyantSimpleRadiationFoam; +application buoyantSimpleFoam; startFrom latestTime; diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/fvSchemes similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSchemes rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/fvSchemes diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSolution b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/fvSolution similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoom/system/fvSolution rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoom/system/fvSolution diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/G b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/G similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/G rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/G diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/IDefault b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/IDefault similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/IDefault rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/IDefault diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/T b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/T similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/T rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/T diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/U b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/U similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/U rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/U diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/alphat b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/alphat similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/alphat rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/alphat diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/epsilon b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/epsilon similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/epsilon rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/epsilon diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/k b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/k similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/k rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/k diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/mut b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/mut similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/mut rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/mut diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/p b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/p similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/p rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/p diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/p_rgh b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/p_rgh similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/0/p_rgh rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/0/p_rgh diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/Allclean b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allclean similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/Allclean rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allclean diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/Allrun b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allrun similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/Allrun rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/Allrun diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/RASProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/RASProperties similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/RASProperties rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/RASProperties diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/g b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/g similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/g rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/g diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/polyMesh/blockMeshDict b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/polyMesh/blockMeshDict similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/polyMesh/blockMeshDict rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/polyMesh/blockMeshDict diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/polyMesh/boundary b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/polyMesh/boundary similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/polyMesh/boundary rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/polyMesh/boundary diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/radiationProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/radiationProperties similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/radiationProperties rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/radiationProperties diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/constant/thermophysicalProperties diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/controlDict b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/controlDict similarity index 96% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/controlDict rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/controlDict index 95fff8df10f0e4b9049ce4b1826d90d5f0db9367..76e8fe4beff90b9a3ab183db020965f809f5023b 100644 --- a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/controlDict +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/controlDict @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application buoyantSimpleRadiationFoam; +application buoyantSimpleFoam; startFrom latestTime; diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/fvSchemes similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSchemes rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/fvSchemes diff --git a/tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSolution b/tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/fvSolution similarity index 100% rename from tutorials/heatTransfer/buoyantSimpleRadiationFoam/hotRadiationRoomFvDOM/system/fvSolution rename to tutorials/heatTransfer/buoyantSimpleFoam/hotRadiationRoomFvDOM/system/fvSolution diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes index 148fdb45eb91d90c8679f8e76413aa09cb96917b..74a1cb4a711975de201ca8ffec565f0518bc07b1 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/bottomAir/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(alphaEff,h) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(alphaEff,h) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/controlDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/controlDict index 5d0174164bc5d5128b89659c2c93842fcb954437..97f299f8a5a9660522de6174d253ef42a0a9930c 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/controlDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/controlDict @@ -15,6 +15,12 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +libs +( + "libcompressibleTurbulenceModel.so" + "libcompressibleRASModels.so" +); + application chtMultiRegionFoam; startFrom latestTime; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict index 0f936407a4f3ece79bb85279d2ee5a23c11046a8..c92d4511d033e9e22c54e7ab6ba9977eccc5a66d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -58,37 +58,6 @@ dictionaryReplacement } } } - - pmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - char - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes index a1071797a3025b5775dda4e68a9b21908526b6c4..998b93b283bb83b17ebac24f9fda25f633cfe14d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/heater/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear limited 0.333; + laplacian(alpha,h) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -42,7 +42,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index 4deb0d8e1b0b0377fae898d61778e644e31f1044..8c75b7e4bddf6063c0b7ee7aecf77fbbeeb1d536 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - pmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - char - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/fvSchemes index 44cdd8eb8c8a3e2603b50d8eef0800bfa8bcad4e..8fc4915d8ea730e0445655fe5b8732be3226d57a 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/leftSolid/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear limited 0.333; + laplacian(alpha,h) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -42,7 +42,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index c97bbad50fa6ecd12205ac09503c3b61d16dc70e..9c9b20e5ed859499ab26e59d59fe085b7c1a9f3d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - pmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - char - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/fvSchemes index e21e6d5b8c4c392be4de42ddcb7cd8e5382237f7..d17c3fadce2d9f41e047ef574381977ea07f9360 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/rightSolid/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear limited 0.333; + laplacian(alpha,h) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -42,7 +42,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSchemes index 5694ac1f59bb24ecf0f2ef153d1d7b3c4c1d61a8..8dce282ff227254cd352e729ebea025dec7617b9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionHeater/system/topAir/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(alphaEff,h) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(alphaEff,h) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/bottomWater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/bottomWater/fvSchemes index 5694ac1f59bb24ecf0f2ef153d1d7b3c4c1d61a8..8dce282ff227254cd352e729ebea025dec7617b9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/bottomWater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/bottomWater/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(alphaEff,h) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(alphaEff,h) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/heater/fvSchemes index a1071797a3025b5775dda4e68a9b21908526b6c4..998b93b283bb83b17ebac24f9fda25f633cfe14d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/heater/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear limited 0.333; + laplacian(alpha,h) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -42,7 +42,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/leftSolid/fvSchemes deleted file mode 120000 index 63236f302cfd79847ce312cced35784fa149c827..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/leftSolid/fvSchemes +++ /dev/null @@ -1 +0,0 @@ -../heater/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/leftSolid/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..998b93b283bb83b17ebac24f9fda25f633cfe14d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/leftSolid/fvSchemes @@ -0,0 +1,53 @@ +/*--------------------------------*- 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; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(alpha,h) Gauss linear limited corrected 0.333; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited corrected 0.333; +} + +fluxRequired +{ + default no; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/rightSolid/fvSchemes deleted file mode 120000 index 63236f302cfd79847ce312cced35784fa149c827..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/rightSolid/fvSchemes +++ /dev/null @@ -1 +0,0 @@ -../heater/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/rightSolid/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..998b93b283bb83b17ebac24f9fda25f633cfe14d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/rightSolid/fvSchemes @@ -0,0 +1,53 @@ +/*--------------------------------*- 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; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(alpha,h) Gauss linear limited corrected 0.333; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited corrected 0.333; +} + +fluxRequired +{ + default no; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/topAir/fvSchemes index 5694ac1f59bb24ecf0f2ef153d1d7b3c4c1d61a8..8dce282ff227254cd352e729ebea025dec7617b9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/topAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/multiRegionLiquidHeater/system/topAir/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(alphaEff,h) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(alphaEff,h) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes index 5694ac1f59bb24ecf0f2ef153d1d7b3c4c1d61a8..8dce282ff227254cd352e729ebea025dec7617b9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/bottomAir/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(alphaEff,h) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(alphaEff,h) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict index 1222482e8fa96ac25ee1b8118f5e3e71e59752f3..c92d4511d033e9e22c54e7ab6ba9977eccc5a66d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/changeDictionaryDict @@ -58,37 +58,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes index a1071797a3025b5775dda4e68a9b21908526b6c4..998b93b283bb83b17ebac24f9fda25f633cfe14d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/heater/fvSchemes @@ -32,7 +32,7 @@ divSchemes laplacianSchemes { default none; - laplacian(alpha,h) Gauss linear limited 0.333; + laplacian(alpha,h) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -42,7 +42,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict index c70f5391f632c2889eb1f33d255d6548d96abd14..8c75b7e4bddf6063c0b7ee7aecf77fbbeeb1d536 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes deleted file mode 120000 index 63236f302cfd79847ce312cced35784fa149c827..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes +++ /dev/null @@ -1 +0,0 @@ -../heater/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..998b93b283bb83b17ebac24f9fda25f633cfe14d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/leftSolid/fvSchemes @@ -0,0 +1,53 @@ +/*--------------------------------*- 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; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(alpha,h) Gauss linear limited corrected 0.333; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited corrected 0.333; +} + +fluxRequired +{ + default no; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict index 913adcf7844b5fd8984ea628382de5953af89ad4..9c9b20e5ed859499ab26e59d59fe085b7c1a9f3d 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes deleted file mode 120000 index 63236f302cfd79847ce312cced35784fa149c827..0000000000000000000000000000000000000000 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes +++ /dev/null @@ -1 +0,0 @@ -../heater/fvSchemes \ No newline at end of file diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..998b93b283bb83b17ebac24f9fda25f633cfe14d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/rightSolid/fvSchemes @@ -0,0 +1,53 @@ +/*--------------------------------*- 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; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(alpha,h) Gauss linear limited corrected 0.333; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited corrected 0.333; +} + +fluxRequired +{ + default no; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict index 82b6381b1b4c594362bec8c764549d9acf5ce4eb..072870efc37c3182654f6675c8623e8e0c70fa7e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/snappyHexMeshDict @@ -285,31 +285,30 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.3; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. finalLayerThickness 1; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes index 5694ac1f59bb24ecf0f2ef153d1d7b3c4c1d61a8..8dce282ff227254cd352e729ebea025dec7617b9 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/snappyMultiRegionHeater/system/topAir/fvSchemes @@ -40,12 +40,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.333; - laplacian(Dp,p_rgh) Gauss linear limited 0.333; - laplacian(alphaEff,h) Gauss linear limited 0.333; - laplacian(DkEff,k) Gauss linear limited 0.333; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.333; - laplacian(DREff,R) Gauss linear limited 0.333; + laplacian(muEff,U) Gauss linear limited corrected 0.333; + laplacian(Dp,p_rgh) Gauss linear limited corrected 0.333; + laplacian(alphaEff,h) Gauss linear limited corrected 0.333; + laplacian(DkEff,k) Gauss linear limited corrected 0.333; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.333; + laplacian(DREff,R) Gauss linear limited corrected 0.333; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict index 1222482e8fa96ac25ee1b8118f5e3e71e59752f3..c92d4511d033e9e22c54e7ab6ba9977eccc5a66d 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/heater/changeDictionaryDict @@ -58,37 +58,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict index c70f5391f632c2889eb1f33d255d6548d96abd14..8c75b7e4bddf6063c0b7ee7aecf77fbbeeb1d536 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/leftSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict index 913adcf7844b5fd8984ea628382de5953af89ad4..9c9b20e5ed859499ab26e59d59fe085b7c1a9f3d 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeater/system/rightSolid/changeDictionaryDict @@ -49,36 +49,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun index 61fd0e371bf42fa954a5f677fbfb6c239b342af2..ecc9459467659daa24afa9c8c32d84ed8a0d4169 100755 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/Allrun @@ -23,7 +23,7 @@ done for i in bottomAir topAir do - faceAgglomerate -region $i -dict viewFactorsDict > log.faceAgglomerate.$i 2>&1 + faceAgglomerate -region $i -dict constant/viewFactorsDict > log.faceAgglomerate.$i 2>&1 done for i in bottomAir topAir @@ -42,7 +42,7 @@ runApplication `getApplication` # #for i in bottomAir topAir #do -# mpirun -np 4 faceAgglomerate -region $i -dict viewFactorsDict -parallel> log.faceAgglomerate.$i 2>&1 +# mpirun -np 4 faceAgglomerate -region $i -dict constant/viewFactorsDict -parallel> log.faceAgglomerate.$i 2>&1 #done #for i in bottomAir topAir diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict index 1a680f09a2404fe8a9aaf975352ae5ea1ab439ad..024770648cad728b831dbff97512347dbb7693a1 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/heater/changeDictionaryDict @@ -81,36 +81,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } - } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict index 59116a041a13ea466a74dd387aa9e77e27a7b62a..b3ef4c896eb0db12d78f9d716f6e4b33b0ce4e16 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/leftSolid/changeDictionaryDict @@ -72,36 +72,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict index 4f018226087024a4f0527d1d122ccc260a1b2179..741624e3d1980d9f1f49cea5b39813661c48dbb5 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/multiRegionHeaterRadiation/system/rightSolid/changeDictionaryDict @@ -72,36 +72,6 @@ dictionaryReplacement } } } - - Ypmma - { - internalField uniform 0.5; - - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - - } - - Ychar - { - internalField uniform 0.5; - - boundaryField - { - ".*" - { - type calculated; - value uniform 0.5; - } - } - } } // ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon index d2d9900782a24e2181e23836d7828820a1de8e28..ac692bb7f2b0ed6680969f4477a21b008de32e46 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon @@ -24,12 +24,12 @@ boundaryField lowerWall { type epsilonWallFunction; - value uniform 1e-08; + value $internalField; } upperWall { type epsilonWallFunction; - value uniform 1e-08; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k index 5f80226cc8c8273ea7fe2efd8d6dc29a1a30db24..1c9826aebd4b14149824fc4dc7cc540d28b6a931 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k @@ -24,12 +24,12 @@ boundaryField lowerWall { type kqRWallFunction; - internalField uniform 0.1; + value $internalField; } upperWall { type kqRWallFunction; - internalField uniform 0.1; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut index ecdb3d27330cb39968e9c4cb144f3163df68c553..c9cc1c5b79ca5260ab5daed2b5b0991408a0c84a 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut @@ -24,12 +24,12 @@ boundaryField lowerWall { type nutkWallFunction; - value uniform 0; + value $internalField; } upperWall { type nutkWallFunction; - value uniform 0; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k index c353c0b7f29fca9af32532e8937ba79c182b4c2b..7d7ba9f720146176f2ca5d9f7d6056a43c040a2a 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k @@ -24,12 +24,12 @@ boundaryField lowerWall { type nutkWallFunction; - value uniform 0; + value $internalField; } upperWall { type nutkWallFunction; - value uniform 0; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding index b3d810e965e216fac2089baa77b5e711442b2fb4..4b988ac9abb2a469ae09e9566733551257c56bc3 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding @@ -24,12 +24,12 @@ boundaryField lowerWall { type nutUSpaldingWallFunction; - value uniform 0; + value $internalField; } upperWall { type nutUSpaldingWallFunction; - value uniform 0; + value $internalField; } front { diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega index 45a6d6abade499373722858a8e8825d42a6b4fd9..8cc512ab34135083b1958acc8a3db5e43e7d8588 100644 --- a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega @@ -24,12 +24,12 @@ boundaryField lowerWall { type omegaWallFunction; - value uniform 1111.11; + value $internalField; } upperWall { type omegaWallFunction; - value uniform 1111.11; + value $internalField; } front { diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties similarity index 76% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones rename to tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties index 87c1c43c6e53899dface499629ccdabbb6fe4638..623823d3ab9ee5cc818a1b745aa3cc9cceefd2a9 100644 --- a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/MRFZones +++ b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); - origin (0 0 0); - axis (0 0 1); - omega 104.72; - } -) + origin (0 0 0); + axis (0 0 1); + omega constant 104.72; +} // ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/U b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/U index d1bbe709514df2f23d9ba0b74629ef712b518ef5..c78eec59c1ac050920773b926425de12207aa40e 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/U +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/U @@ -45,18 +45,6 @@ boundaryField type movingWallVelocity; value uniform (0 0 0); } - - AMI1 - { - type cyclicAMI; - value uniform (0 0 0); - } - - AMI2 - { - type cyclicAMI; - value uniform (0 0 0); - } } diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/epsilon b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/epsilon index 4512a15707fa597d775782ba4c3c61ea866abd4b..c8a9ab3e88501a17fcfb6ff1e8175727e1aedf64 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/epsilon +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/epsilon @@ -45,18 +45,6 @@ boundaryField type epsilonWallFunction; value $internalField; } - - AMI1 - { - type cyclicAMI; - value $internalField; - } - - AMI2 - { - type cyclicAMI; - value $internalField; - } } diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/k b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/k index 4539cc1591a6328f35823143965310bfb84f29b4..fa184b506d48bde2bebf95aa33fe96fe8f8a126e 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/k +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/k @@ -45,18 +45,6 @@ boundaryField type kqRWallFunction; value $internalField; } - - AMI1 - { - type cyclicAMI; - value $internalField; - } - - AMI2 - { - type cyclicAMI; - value $internalField; - } } diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/nut b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/nut index 3b34b2cbbfe5d6a81f8061fc13b9d73a9ba090de..0c696194233c251558db178dce834e0b54bdf409 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/nut +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/nut @@ -44,18 +44,6 @@ boundaryField type nutkWallFunction; value uniform 0; } - - AMI1 - { - type cyclicAMI; - value uniform 0; - } - - AMI2 - { - type cyclicAMI; - value uniform 0; - } } diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/p b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/p index 3196c16c90fbadc438d449f0c7d9e25dca2c5296..98504cb29b28d7fbc41a94def393c075b473a49c 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/p +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/0.org/p @@ -41,18 +41,6 @@ boundaryField { type zeroGradient; } - - AMI1 - { - type cyclicAMI; - value uniform 0; - } - - AMI2 - { - type cyclicAMI; - value uniform 0; - } } diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre index 472c03a6f7034d02b4e0b8a4f01bba629dc6de59..2abd5b41e176064c93c21aaa4c76a354ad3bee03 100755 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/Allrun.pre @@ -17,6 +17,7 @@ runApplication surfaceFeatureExtract runApplication snappyHexMesh -overwrite # force removal of fields generated by snappy \rm -rf 0 +cp -rf 0.org 0 # - generate face/cell sets and zones @@ -37,19 +38,18 @@ runApplication topoSet -dict system/createAMIFaces.topoSetDict mv log.topoSet log.createAMIFaces.topoSet -# - create the inlet/outlet patches and AMI patches +# - create the inlet/outlet patches runApplication createPatch -overwrite -# - create the AMI faces by creating baffles, and then splitting the mesh +# - apply the initial fields -createBaffles -internalFacesOnly -overwrite innerCylinderSmall '(AMI1 AMI2)' \ - > log.createBaffles 2>&1 +cp -rf 0.org 0 -runApplication mergeOrSplitBaffles -split -overwrite +# - create the AMI faces by creating baffles, and then splitting the mesh -# - apply the initial fields +runApplication createBaffles -overwrite -cp -rf 0.org 0 +runApplication mergeOrSplitBaffles -split -overwrite diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/controlDict b/tutorials/incompressible/pimpleDyMFoam/propeller/system/controlDict index babfb5351e760aa24ce8b6340d5c30469886199a..96dc9e9cfd0b11d40f08f13f1804fb0876356d11 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/system/controlDict +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/controlDict @@ -15,6 +15,12 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +libs +( + "libincompressibleTurbulenceModel.so" + "libincompressibleRASModels.so" +); + application pimpleDyMFoam; startFrom startTime; diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/createBafflesDict b/tutorials/incompressible/pimpleDyMFoam/propeller/system/createBafflesDict new file mode 100644 index 0000000000000000000000000000000000000000..f3a7eadc973754efb7c12d42d38db1946a201100 --- /dev/null +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/createBafflesDict @@ -0,0 +1,58 @@ +/*--------------------------------*- 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; + object createBafflesDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Whether to convert internal faces only (so leave boundary faces intact). +// This is only relevant if your face selection type can pick up boundary +// faces. +internalFacesOnly true; + + +// Baffles to create. +baffles +{ + baffleFaces + { + //- Use predefined faceZone to select faces and orientation. + type faceZone; + zoneName innerCylinderSmall; + + + patches + { + master + { + //- Master side patch + name AMI1; + type cyclicAMI; + matchTolerance 0.0001; + neighbourPatch AMI2; + transform noOrdering; + } + slave + { + //- Slave side patch + name AMI2; + type cyclicAMI; + matchTolerance 0.0001; + neighbourPatch AMI1; + transform noOrdering; + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/createPatchDict b/tutorials/incompressible/pimpleDyMFoam/propeller/system/createPatchDict index 2400a435093264b8c3b78b72a05b574d5250f967..1559be08ddd80f8823edfedd2da120216eb30a31 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/system/createPatchDict +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/createPatchDict @@ -46,37 +46,6 @@ patches set outletFaces; } - - - // Construct empty patches - { - name AMI1; - patchInfo - { - type cyclicAMI; - neighbourPatch AMI2; - transform noOrdering; - surface - {} - } - constructFrom set; - set dummyFaces; - } - { - name AMI2; - - patchInfo - { - type cyclicAMI; - neighbourPatch AMI1; - transform noOrdering; - surface - {} - } - constructFrom set; - set dummyFaces; - } - ); // ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSchemes index 9106eed2736a5595cb332edc1fcb2d8395f46833..b6ae74a4e93443b0987df7ae5831866b36b37584 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/fvSchemes @@ -39,7 +39,7 @@ divSchemes laplacianSchemes { - default Gauss linear limited 0.33; + default Gauss linear limited corrected 0.33; } interpolationSchemes @@ -49,7 +49,7 @@ interpolationSchemes snGradSchemes { - default limited 0.33; + default limited corrected 0.33; } fluxRequired diff --git a/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict b/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict index 326bafe1d49c61d867727ca6e9caa85f1221ee8e..d060b73f934050abc1739c7cb772d3973390ac80 100644 --- a/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict +++ b/tutorials/incompressible/pimpleDyMFoam/propeller/system/snappyHexMeshDict @@ -335,33 +335,33 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes index 258bb383f2477907b634c0b99d2b55cc683206de..953fe762d095a64cba9f0aa576c6cc5547e8ccc8 100644 --- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion2D_pimpleDyMFoam/system/fvSchemes @@ -37,7 +37,7 @@ divSchemes laplacianSchemes { - default Gauss linear limited 0.5; + default Gauss linear limited corrected 0.5; } interpolationSchemes diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/fvSchemes b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/fvSchemes index b12dc45dcf6d0ba6aaad7e83fbbbdcac2bffd7c9..bfd86f807ade86e59da4c91215c4a31b15738f1f 100644 --- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/fvSchemes +++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/fvSchemes @@ -42,12 +42,12 @@ divSchemes laplacianSchemes { default none; - laplacian(muEff,U) Gauss linear limited 0.5; - laplacian(DkEff,k) Gauss linear limited 0.5; - laplacian(DREff,R) Gauss linear limited 0.5; - laplacian(DepsilonEff,epsilon) Gauss linear limited 0.5; - laplacian((rho*(1|A(U))),p) Gauss linear limited 0.5; - laplacian(alphaEff,e) Gauss linear limited 0.5; + laplacian(muEff,U) Gauss linear limited corrected 0.5; + laplacian(DkEff,k) Gauss linear limited corrected 0.5; + laplacian(DREff,R) Gauss linear limited corrected 0.5; + laplacian(DepsilonEff,epsilon) Gauss linear limited corrected 0.5; + laplacian((rho*(1|A(U))),p) Gauss linear limited corrected 0.5; + laplacian(alphaEff,e) Gauss linear limited corrected 0.5; } interpolationSchemes diff --git a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict index b4c3ed8f64c234a2fa7ea9e71484da7d363427f9..fcf64ed65dcf03ea4b3b82920264dd6d6772d2ac 100644 --- a/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict +++ b/tutorials/incompressible/pimpleDyMFoam/wingMotion/wingMotion_snappyHexMesh/system/snappyHexMeshDict @@ -189,34 +189,33 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.3; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.7; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U index 7d734082dd447e826fb7c20820dc8c9a406ae173..54e519308c97f92de09f77be9e65f27faf9bd572 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/U @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 1 -1 0 0 0 0]; +dimensions [m s^-1]; internalField uniform (0 0 0); @@ -38,19 +38,6 @@ boundaryField inletValue uniform (0 0 0); value uniform (0 0 0); } - baffles - { - type fixedValue; - value uniform (0 0 0); - } - fan_half0 - { - type cyclic; - } - fan_half1 - { - type cyclic; - } defaultFaces { type fixedValue; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon index b972d9f1d292f64130a687183d44cabe99c71cbb..3648316bd38090a5f638d8d65a466019caaa3173 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/epsilon @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -3 0 0 0 0]; +dimensions [m^2 s^-3]; internalField uniform 200; @@ -41,22 +41,6 @@ boundaryField inletValue uniform 200; value uniform 200; } - baffles - { - type epsilonWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 0; - } - fan_half0 - { - type cyclic; - } - fan_half1 - { - type cyclic; - } defaultFaces { type epsilonWallFunction; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k index a58acefeab74e73cab3a532e784204d01c3683d5..bd8e325c2f55617a6f659002859be7cf2da7aed3 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/k @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -2 0 0 0 0]; +dimensions [m^2 s^-2]; internalField uniform 0.375; @@ -25,8 +25,6 @@ boundaryField { type turbulentIntensityKineticEnergyInlet; intensity 0.05; - U U; - phi phi; value uniform 0.375; } outlet1 @@ -41,19 +39,6 @@ boundaryField inletValue uniform 0.375; value uniform 0.375; } - baffles - { - type kqRWallFunction; - value uniform 0; - } - fan_half0 - { - type cyclic; - } - fan_half1 - { - type cyclic; - } defaultFaces { type kqRWallFunction; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda index dfa76ef6fdd0317413029a7f3e92139467292920..5bd1e94d8b1d4b286f9f168fb5a9159718bb699a 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nuTilda @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -1 0 0 0 0]; +dimensions [m^2 s^-1]; internalField uniform 0; @@ -33,18 +33,6 @@ boundaryField { type zeroGradient; } - baffles - { - type zeroGradient; - } - fan_half0 - { - type cyclic; - } - fan_half1 - { - type cyclic; - } defaultFaces { type zeroGradient; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut index 831ea1e70ba076d445b141e02144b97c83c4f87a..894d5b53455cc1029c07a559938867d82caa5a81 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/nut @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -1 0 0 0 0]; +dimensions [m^2 s^-1]; internalField uniform 0; @@ -36,22 +36,6 @@ boundaryField type calculated; value uniform 0; } - baffles - { - type nutkWallFunction; - Cmu 0.09; - kappa 0.41; - E 9.8; - value uniform 0; - } - fan_half0 - { - type cyclic; - } - fan_half1 - { - type cyclic; - } defaultFaces { type nutkWallFunction; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p index e69dbaddef297209acae529c13477d797fc2e80d..42728c992c060c84f25b6230b8e883ce133fd575 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/0/p @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 2 -2 0 0 0 0]; +dimensions [m^2 s^-2]; internalField uniform 0; @@ -27,15 +27,13 @@ boundaryField rho none; psi none; gamma 1; - p0 40; pressure table - -2 -( -(0 10) -(1 40) -) -; + 2 + ( + (0 10) + (1 40) + ) + ; value uniform 40; } outlet1 @@ -48,30 +46,6 @@ boundaryField type fixedValue; value uniform 0; } - baffles - { - type zeroGradient; - } - fan_half0 - { - type fan; - patchType cyclic; - jumpTable polynomial - -2 -( -(100 0) -(-0.1 1) -) -; - value uniform 0; - } - fan_half1 - { - type fan; - patchType cyclic; - value uniform 0; - } defaultFaces { type zeroGradient; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun index 2374d2fb6c3277c6f5aa1db7cd77620c2bc5109e..932dded90be1d07e045f395b723c0a5a02dc65b3 100755 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/Allrun @@ -8,21 +8,10 @@ application=`getApplication` runApplication blockMesh - -# Creating patches 'out of nothing' so will get undefined value which -# might cause floating point error -unset FOAM_SIGFPE -unset FOAM_SETNAN - -# Create faceZones for fan and baffles +# Create faceZones for baffles and fan runApplication topoSet -# Create fan cyclics -runApplication createBaffles cyclicFaces '(fan_half0 fan_half1)' -overwrite -mv log.createBaffles log.createBaffles.1 - -# Create wall baffles -runApplication createBaffles baffleFaces '(baffles baffles)' -overwrite -mv log.createBaffles log.createBaffles.2 +# Create wall and cyclic baffles and the fields on them +runApplication createBaffles -overwrite runApplication $application diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt b/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt index 0ef40d8110b71cbf246525cc263874a56936525c..7c7924cf5635a55975cdc8a681e7052d7fc458d6 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/README.txt @@ -1,3 +1,3 @@ 2010-04-16 T-junction with baffles and fan. Inlet on left, one outlet at bottom, one at top. -To test multiple outlets. +To test multiple outlets and fan cyclics diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict b/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict index 66f0af7d65f4c17ee1a94a3b7b18d5cc7f345899..7464688c337f8df55f4a231bad438489aa186240 100644 --- a/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/constant/polyMesh/blockMeshDict @@ -104,25 +104,6 @@ boundary faces ((8 18 19 9)); } - baffles - { - type wall; - faces (); - } - - fan_half0 - { - type cyclic; - faces (); - neighbourPatch fan_half1; - } - fan_half1 - { - type cyclic; - faces (); - neighbourPatch fan_half0; - } - defaultFaces { type wall; diff --git a/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict b/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict new file mode 100644 index 0000000000000000000000000000000000000000..544288617fb6712ce5406f73102526af3e589111 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/TJunctionFan/system/createBafflesDict @@ -0,0 +1,150 @@ +/*--------------------------------*- 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; + object createBafflesDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Whether to convert internal faces only (so leave boundary faces intact). +// This is only relevant if your face selection type can pick up boundary +// faces. +internalFacesOnly true; + + +// Baffles to create. +baffles +{ + baffleFaces + { + //- Use predefined faceZone to select faces and orientation. + type faceZone; + zoneName baffleFaces; + + + //- Optional flip + //flip false; + + patches + { + master + { + //- Master side patch + name baffles; + type wall; + + patchFields + { + epsilon + { + type epsilonWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + k + { + type kqRWallFunction; + value uniform 0; + } + nut + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + nuTilda + { + type zeroGradient; + } + p + { + type zeroGradient; + } + U + { + type fixedValue; + value uniform (0 0 0); + } + } + } + slave + { + //- Slave side patch + name baffles; + type wall; + + ${..master.patchFields} + } + } + } + + + + cyclicFaces + { + //- Select faces and orientation through a searchableSurface + type searchableSurface; + surface searchablePlate; + origin (0.099 -0.006 0.004); + span (0 0.012 0.012); + + patches + { + master + { + //- Master side patch + + name fan_half0; + type cyclic; + neighbourPatch fan_half1; + + //- Optional override of added patchfields. If not specified + // any added patchfields are of type calculated. + patchFields + { + p + { + type fan; + patchType cyclic; + jump uniform 0; + value uniform 0; + jumpTable polynomial 1((100 0)); + } + } + } + slave + { + //- Slave side patch + + name fan_half1; + type cyclic; + neighbourPatch fan_half0; + + patchFields + { + p + { + type fan; + patchType cyclic; + value uniform 0; + } + } + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/channel395/Allrun b/tutorials/incompressible/pimpleFoam/channel395/Allrun index 61c1b54530e027a68bf1199743afea0f485ce81f..7f75af44c215be7cb2f1a6329f4d3c85933f2df6 100755 --- a/tutorials/incompressible/pimpleFoam/channel395/Allrun +++ b/tutorials/incompressible/pimpleFoam/channel395/Allrun @@ -8,7 +8,15 @@ cd ${0%/*} || exit 1 # run from this directory application=`getApplication` runApplication blockMesh -runApplication $application + +#- Run serial +#runApplication $application + +#- Run parallel +runApplication decomposePar -cellDist +runParallel $application 5 +runApplication reconstructPar + runApplication postChannel # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/boundary b/tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/boundary index 655c5c0b545664243cd8c2f26aacdc522960b1c7..12dc93fdc2dfa8bfeca183b9624f2d55d261c2c3 100644 --- a/tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/boundary +++ b/tutorials/incompressible/pimpleFoam/channel395/constant/polyMesh/boundary @@ -32,6 +32,7 @@ FoamFile sides1_half0 { type cyclic; + inGroups 1(cyclic); nFaces 1000; startFace 177700; matchTolerance 0.0001; @@ -40,6 +41,7 @@ FoamFile sides1_half1 { type cyclic; + inGroups 1(cyclic); nFaces 1000; startFace 178700; matchTolerance 0.0001; @@ -48,6 +50,7 @@ FoamFile sides2_half0 { type cyclic; + inGroups 1(cyclic); nFaces 1000; startFace 179700; matchTolerance 0.0001; @@ -56,6 +59,7 @@ FoamFile sides2_half1 { type cyclic; + inGroups 1(cyclic); nFaces 1000; startFace 180700; matchTolerance 0.0001; @@ -64,6 +68,7 @@ FoamFile inout1_half0 { type cyclic; + inGroups 1(cyclic); nFaces 750; startFace 181700; matchTolerance 0.0001; @@ -72,6 +77,7 @@ FoamFile inout1_half1 { type cyclic; + inGroups 1(cyclic); nFaces 750; startFace 182450; matchTolerance 0.0001; @@ -80,6 +86,7 @@ FoamFile inout2_half0 { type cyclic; + inGroups 1(cyclic); nFaces 750; startFace 183200; matchTolerance 0.0001; @@ -88,6 +95,7 @@ FoamFile inout2_half1 { type cyclic; + inGroups 1(cyclic); nFaces 750; startFace 183950; matchTolerance 0.0001; diff --git a/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties b/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties index 106403ce538c64a3dc839458182fb9f598f0a991..501ab02cb1a37b40aee82205730e0555e0dabb28 100644 --- a/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties +++ b/tutorials/incompressible/pimpleFoam/channel395/constant/sourcesProperties @@ -27,7 +27,6 @@ momentumSource { fieldNames (U); Ubar ( 0.1335 0 0 ); - gradPini gradPIni [0 1 -2 0 0 ] 0; } } diff --git a/tutorials/incompressible/pimpleFoam/channel395/system/decomposeParDict b/tutorials/incompressible/pimpleFoam/channel395/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..9f0365f2de4db8c3e8c07d8faf5cad1640cbed17 --- /dev/null +++ b/tutorials/incompressible/pimpleFoam/channel395/system/decomposeParDict @@ -0,0 +1,135 @@ +/*--------------------------------*- 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; + note "mesh decomposition control dictionary"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 5; + +//- Keep owner and neighbour on same processor for faces in zones: +// preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_half0 cyclic_half1); + +//- Keep all of faceSet on a single processor. This puts all cells +// connected with a point, edge or face on the same processor. +// (just having face connected cells might not guarantee a balanced +// decomposition) +// The processor can be -1 (the decompositionMethod chooses the processor +// for a good load balance) or explicitly provided (upsets balance). +//singleProcessorFaceSets ((f0 -1)); + + +//- Use the volScalarField named here as a weight for each cell in the +// decomposition. For example, use a particle population field to decompose +// for a balanced number of particles in a lagrangian simulation. +// weightField dsmcRhoNMean; + +method scotch; +//method hierarchical; +// method simple; +// method metis; +// method manual; +// method multiLevel; +// method structured; // does 2D decomposition of structured mesh + +multiLevelCoeffs +{ + // Decomposition methods to apply in turn. This is like hierarchical but + // fully general - every method can be used at every level. + + level0 + { + numberOfSubdomains 64; + //method simple; + //simpleCoeffs + //{ + // n (2 1 1); + // delta 0.001; + //} + method scotch; + } + level1 + { + numberOfSubdomains 4; + method scotch; + } +} + +// Desired output + +simpleCoeffs +{ + n (2 1 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (1 2 1); + delta 0.001; + order xyz; +} + +metisCoeffs +{ + /* + processorWeights + ( + 1 + 1 + 1 + 1 + ); + */ +} + +scotchCoeffs +{ + //processorWeights + //( + // 1 + // 1 + // 1 + // 1 + //); + //writeGraph true; + //strategy "b"; +} + +manualCoeffs +{ + dataFile "decompositionData"; +} + +structuredCoeffs +{ + // Patches to do 2D decomposition on. Structured mesh only; cells have + // to be in 'columns' on top of patches. + patches (bottomPatch); +} + +//// Is the case distributed? Note: command-line argument -roots takes +//// precedence +//distributed yes; +//// Per slave (so nProcs-1 entries) the directory above the case. +//roots +//( +// "/tmp" +// "/tmp" +//); + +// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun index 656b92f3addbd931034a7f844bb2f46dffce0a97..f4d2c06b9412ae0029ac96b15ad8bb187fb0dd48 100755 --- a/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun +++ b/tutorials/incompressible/pimpleFoam/elipsekkLOmega/Allrun @@ -15,7 +15,7 @@ runApplication mirrorMesh -overwrite rm log.mirrorMesh rm log.changeDictionary -runApplication changeDictionary -instance system -dict system/changeDictionaryDict.Y +runApplication changeDictionary -instance system -dict system/changeDictionaryDict.Y runApplication mirrorMesh -overwrite diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/fvSchemes b/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/fvSchemes index 3d223e01d629d25a16d5ea038fb4d76fb4fe682d..03be7b49e02c1c9078b28fa7bfbf7d610c233221 100644 --- a/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/fvSchemes +++ b/tutorials/incompressible/pisoFoam/les/motorBike/lesFiles/fvSchemes @@ -45,7 +45,7 @@ divSchemes laplacianSchemes { - default Gauss linear limited 0.33; + default Gauss linear limited corrected 0.33; } interpolationSchemes @@ -55,7 +55,7 @@ interpolationSchemes snGradSchemes { - default limited 0.33; + default limited corrected 0.33; } fluxRequired diff --git a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict index 3e9353f452e73fc4215f3134676befae39dea890..452adf13dee51d21ca557ff438a774bf0eddade4 100644 --- a/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict +++ b/tutorials/incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict @@ -204,30 +204,30 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/pisoFoam/les/pitzDaily/constant/polyMesh/boundary b/tutorials/incompressible/pisoFoam/les/pitzDaily/constant/polyMesh/boundary index 313dcceba1abd7b93d57320c4c674f1734692506..43b78ef4111bd17a26b37dd07818415f04eac737 100644 --- a/tutorials/incompressible/pisoFoam/les/pitzDaily/constant/polyMesh/boundary +++ b/tutorials/incompressible/pisoFoam/les/pitzDaily/constant/polyMesh/boundary @@ -44,6 +44,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 24450; startFace 24730; } diff --git a/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary b/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary index 61feadd97403fbf58a57c925fc262f3de46ec95a..9294a312662a782327ee00bce133050c7518aa9d 100644 --- a/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary +++ b/tutorials/incompressible/pisoFoam/ras/cavity/constant/polyMesh/boundary @@ -32,6 +32,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 800; startFace 840; } diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/U2 b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/U similarity index 81% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/U2 rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/U index fb96d28c70508e3e2b87b7290f0f7fc6ff202a54..711702f9871ed36f0695ef53bedb90b80c345a78 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/U2 +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/U @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volVectorField; - object U2; + object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -20,26 +20,19 @@ internalField uniform (0 0 0); boundaryField { - inlet + movingWall { type fixedValue; - value uniform (0 0 0); - } - - outlet - { - type inletOutlet; - inletValue uniform (0 0 0); - value uniform (0 0 0); + value uniform (1 0 0); } - walls + fixedWalls { type fixedValue; value uniform (0 0 0); } - defaultFaces + frontAndBack { type empty; } diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/epsilon b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/epsilon similarity index 75% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0/epsilon rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/epsilon index d5ee15eb79d080246921e64270bf55a4d1541884..6b009c939ad092fdef7f54b8ecb9b755fb70ac3c 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/epsilon +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/epsilon @@ -10,38 +10,32 @@ FoamFile version 2.0; format ascii; class volScalarField; + location "0"; object epsilon; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -3 0 0 0 0]; -internalField uniform 0.1; +internalField uniform 0.000765; boundaryField { - inlet + movingWall { - type fixedValue; - value uniform 0.1; + type epsilonWallFunction; + value uniform 0.000765; } - - outlet - { - type inletOutlet; - inletValue uniform 0.1; - value uniform 0.1; - } - - walls + fixedWalls { - type zeroGradient; + type epsilonWallFunction; + value uniform 0.000765; } - - defaultFaces + frontAndBack { type empty; } } + // ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/k b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/k similarity index 75% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/k rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/k index a791cb824f67debc5017f8efa4da5b3e4349556d..72d1287df1f9d694a11cdb8b08012070367d6f06 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/k +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/k @@ -10,38 +10,32 @@ FoamFile version 2.0; format ascii; class volScalarField; + location "0"; object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; -internalField uniform 1e-8; +internalField uniform 0.00325; boundaryField { - inlet + movingWall { - type fixedValue; - value uniform 1e-8; + type kqRWallFunction; + value uniform 0.00325; } - - outlet - { - type inletOutlet; - inletValue uniform 1e-8; - value uniform 1e-8; - } - - walls + fixedWalls { - type zeroGradient; + type kqRWallFunction; + value uniform 0.00325; } - - defaultFaces + frontAndBack { type empty; } } + // ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/alpha1 b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nuTilda similarity index 76% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/alpha1 rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nuTilda index 4eedc0954974901d592e4b22a5b2c8ef9a624c46..36021c60af557192f19b9aed3e448742c21843c5 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/alpha1 +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nuTilda @@ -10,35 +10,27 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha1; + object nuTilda; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [0 0 0 0 0 0 0]; +dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; boundaryField { - inlet + movingWall { - type fixedValue; - value uniform 0.5; - } - - outlet - { - type inletOutlet; - inletValue uniform 1; - value uniform 1; + type zeroGradient; } - walls + fixedWalls { type zeroGradient; } - defaultFaces + frontAndBack { type empty; } diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/p b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nut similarity index 78% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/p rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nut index 536747ce3f16ca8751dfc977d88a95cb3a6faad8..2a9a9727fc9069af13d53199405fdc00e5d5d913 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0.org/p +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/nut @@ -10,38 +10,32 @@ FoamFile version 2.0; format ascii; class volScalarField; - object p; + location "0"; + object nut; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dimensions [1 -1 -2 0 0 0 0]; +dimensions [0 2 -1 0 0 0 0]; internalField uniform 0; boundaryField { - inlet + movingWall { - type fixedFluxPressure; + type nutkWallFunction; value uniform 0; } - - outlet + fixedWalls { - type fixedValue; + type nutkWallFunction; value uniform 0; } - - walls - { - type fixedFluxPressure; - value uniform 0; - } - - defaultFaces + frontAndBack { type empty; } } + // ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/k b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/p similarity index 76% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/0/k rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/p index a791cb824f67debc5017f8efa4da5b3e4349556d..3e00d9eb3198e7c3d1d96d37378ad5ab6466637b 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/k +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/0/p @@ -10,35 +10,27 @@ FoamFile version 2.0; format ascii; class volScalarField; - object k; + object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; -internalField uniform 1e-8; +internalField uniform 0; boundaryField { - inlet + movingWall { - type fixedValue; - value uniform 1e-8; - } - - outlet - { - type inletOutlet; - inletValue uniform 1e-8; - value uniform 1e-8; + type zeroGradient; } - walls + fixedWalls { type zeroGradient; } - defaultFaces + frontAndBack { type empty; } diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/RASProperties b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/RASProperties similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/RASProperties rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/RASProperties diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/polyMesh/blockMeshDict b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/blockMeshDict similarity index 82% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/constant/polyMesh/blockMeshDict rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/blockMeshDict index 8ab4654b46e01071dad8b57d433440c165a17a37..165a600c7b4a929aaa62ad1750bfbb9d279c2e65 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/polyMesh/blockMeshDict +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/blockMeshDict @@ -14,23 +14,23 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -convertToMeters 1; +convertToMeters 0.1; vertices ( (0 0 0) - (0.15 0 0) - (0.15 1 0) + (1 0 0) + (1 1 0) (0 1 0) (0 0 0.1) - (0.15 0 0.1) - (0.15 1 0.1) + (1 0 0.1) + (1 1 0.1) (0 1 0.1) ); blocks ( - hex (0 1 2 3 4 5 6 7) (25 75 1) simpleGrading (1 1 1) + hex (0 1 2 3 4 5 6 7) (20 20 1) simpleGrading (1 1 1) ); edges @@ -39,29 +39,31 @@ edges boundary ( - inlet + movingWall { - type patch; + type wall; faces ( - (1 5 4 0) + (3 7 6 2) ); } - outlet + fixedWalls { - type patch; + type wall; faces ( - (3 7 6 2) + (0 4 7 3) + (2 6 5 1) + (1 5 4 0) ); } - walls + frontAndBack { - type wall; + type empty; faces ( - (0 4 7 3) - (2 6 5 1) + (0 3 2 1) + (4 5 6 7) ); } ); diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/polyMesh/boundary b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/boundary similarity index 73% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/constant/polyMesh/boundary rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/boundary index 56e0a545c15839416fcd3beca616ce0f609c5879..9294a312662a782327ee00bce133050c7518aa9d 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/polyMesh/boundary +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/polyMesh/boundary @@ -15,31 +15,26 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -4 +3 ( - inlet + movingWall { - type patch; - nFaces 25; - startFace 3650; - } - outlet - { - type patch; - nFaces 25; - startFace 3675; + type wall; + nFaces 20; + startFace 760; } - walls + fixedWalls { type wall; - nFaces 150; - startFace 3700; + nFaces 60; + startFace 780; } - defaultFaces + frontAndBack { type empty; - nFaces 3750; - startFace 3850; + inGroups 1(empty); + nFaces 800; + startFace 840; } ) diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/transportProperties b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/transportProperties similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/transportProperties rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/transportProperties diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/turbulenceProperties b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..3721a46a2ead37eb2bf10434bcde59afa9fe9bf6 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- 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 RASModel; + + +// ************************************************************************* // diff --git a/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/controlDict b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..15396ddf40c7eaf68016dadeb5bda58bc62ccd31 --- /dev/null +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/controlDict @@ -0,0 +1,49 @@ +/*--------------------------------*- 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 "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application pisoFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 10; + +deltaT 0.005; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/system/fvSchemes b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSchemes similarity index 63% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/system/fvSchemes rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSchemes index 0779f1ea22142fea4f0c473c6e11fe2be822c587..6a9eea83ddac00d64496b8bc5a959e22bb44e0ca 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/system/fvSchemes +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSchemes @@ -23,31 +23,37 @@ ddtSchemes gradSchemes { default Gauss linear; + grad(p) Gauss linear; + grad(U) Gauss linear; } divSchemes { default none; - div(phi1,U1) Gauss limitedLinearV 1; - div(phi2,U2) Gauss limitedLinearV 1; - div(phi2,k) Gauss limitedLinear 1; - div(phi2,epsilon) Gauss limitedLinear 1; - div(phi,alpha1) Gauss limitedLinear01 1; - div((-nuEff1*T(grad(U1)))) Gauss linear; - div((-nuEff2*T(grad(U2)))) Gauss linear; + div(phi,U) Gauss limitedLinearV 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,epsilon) Gauss limitedLinear 1; + div(phi,R) Gauss limitedLinear 1; + div(R) Gauss linear; + div(phi,nuTilda) Gauss limitedLinear 1; + div((nuEff*dev(T(grad(U))))) Gauss linear; } laplacianSchemes { default none; - laplacian(nuEff1,U1) Gauss linear corrected; - laplacian(nuEff2,U2) Gauss linear corrected; - laplacian(Dp,p) Gauss linear corrected; + laplacian(nuEff,U) Gauss linear corrected; + laplacian((1|A(U)),p) Gauss linear corrected; + laplacian(DkEff,k) Gauss linear corrected; + laplacian(DepsilonEff,epsilon) Gauss linear corrected; + laplacian(DREff,R) Gauss linear corrected; + laplacian(DnuTildaEff,nuTilda) Gauss linear corrected; } interpolationSchemes { default linear; + interpolate(U) linear; } snGradSchemes diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/system/fvSolution b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSolution similarity index 61% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/system/fvSolution rename to tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSolution index f9046b1447add4e64a7973bcd51ea70ee529581b..a115a11a4477554b44fa77dc437c8600eed417fc 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/system/fvSolution +++ b/tutorials/incompressible/pisoFoam/ras/cavityCoupledU/system/fvSolution @@ -21,39 +21,64 @@ solvers { solver PCG; preconditioner DIC; - tolerance 1e-10; + tolerance 1e-06; relTol 0.1; } pFinal { - $p; - tolerance 1e-10; + solver PCG; + preconditioner DIC; + tolerance 1e-06; relTol 0; } - alpha1 + U + { + type coupled; + solver PBiCCCG; + preconditioner DILU; + tolerance (1e-05 1e-05 1e-05); + relTol (0 0 0); + } + + k { solver PBiCG; preconditioner DILU; - tolerance 1e-10; - relTol 0.1; + tolerance 1e-05; + relTol 0; + } + + epsilon + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; } - alpha1Final + R { - $alpha1; - tolerance 1e-10; + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; + relTol 0; + } + + nuTilda + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-05; relTol 0; } } -PIMPLE +PISO { nCorrectors 2; nNonOrthogonalCorrectors 0; - nAlphaCorr 2; - correctAlpha no; pRefCell 0; pRefValue 0; } diff --git a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties similarity index 99% rename from tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties rename to tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties index 22add8ff299919833276bb7b4770c81785d1ace6..650f01268ca7bb4dfe14c25d5d8f2a860cda2544 100644 --- a/tutorials/compressible/rhoPorousMRFLTSPimpleFoam/angledDuct/constant/porosityProperties +++ b/tutorials/incompressible/porousSimpleFoam/angledDuctImplicit/constant/porosityProperties @@ -34,4 +34,5 @@ porosity1 } } + // ************************************************************************* // diff --git a/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/constant/freeSurfaceProperties b/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/constant/freeSurfaceProperties deleted file mode 100644 index 5fdff74e52fb81a4490d167aa187d656e441d622..0000000000000000000000000000000000000000 --- a/tutorials/incompressible/potentialFreeSurfaceFoam/oscillatingBox/constant/freeSurfaceProperties +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object freeSurfaceProperties; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -freeSurfacePatch freeSurface; - -// ************************************************************************* // diff --git a/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary b/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary index b96b8676fd4a649081dc3b177ade0f112412a450..4778c6be3c64e1be531f0ad92a4216c6e8261cd2 100644 --- a/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary +++ b/tutorials/incompressible/shallowWaterFoam/squareBump/constant/polyMesh/boundary @@ -38,6 +38,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 800; startFace 840; } diff --git a/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes b/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes index 7a0b99df5dcbf331a31429d24bf363e01020ce81..036a75cf3c9a39cc390a99659f9a47b3ca2299ab 100644 --- a/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes +++ b/tutorials/incompressible/shallowWaterFoam/squareBump/system/fvSchemes @@ -16,7 +16,7 @@ FoamFile ddtSchemes { - default CrankNicholson 0.9; + default CrankNicolson 0.9; } gradSchemes diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/U b/tutorials/incompressible/simpleFoam/mixerVessel2D/0/U similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/U rename to tutorials/incompressible/simpleFoam/mixerVessel2D/0/U diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/epsilon b/tutorials/incompressible/simpleFoam/mixerVessel2D/0/epsilon similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/epsilon rename to tutorials/incompressible/simpleFoam/mixerVessel2D/0/epsilon diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/k b/tutorials/incompressible/simpleFoam/mixerVessel2D/0/k similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/k rename to tutorials/incompressible/simpleFoam/mixerVessel2D/0/k diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/nut b/tutorials/incompressible/simpleFoam/mixerVessel2D/0/nut similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/nut rename to tutorials/incompressible/simpleFoam/mixerVessel2D/0/nut diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/p b/tutorials/incompressible/simpleFoam/mixerVessel2D/0/p similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/0/p rename to tutorials/incompressible/simpleFoam/mixerVessel2D/0/p diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/Allrun b/tutorials/incompressible/simpleFoam/mixerVessel2D/Allrun similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/Allrun rename to tutorials/incompressible/simpleFoam/mixerVessel2D/Allrun diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/RASProperties b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/RASProperties similarity index 92% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/constant/RASProperties rename to tutorials/incompressible/simpleFoam/mixerVessel2D/constant/RASProperties index 552ecb32c7b2430e061322808c20842dc3e354b8..a4937b503a46850b2626f0d301e4a07b9f691507 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/RASProperties +++ b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/RASProperties @@ -15,11 +15,11 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -RASModel laminar; +RASModel kEpsilon; -turbulence off; +turbulence on; -printCoeffs off; +printCoeffs on; // ************************************************************************* // diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 rename to tutorials/incompressible/simpleFoam/mixerVessel2D/constant/polyMesh/blockMeshDict.m4 diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/polyMesh/boundary similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/constant/polyMesh/boundary rename to tutorials/incompressible/simpleFoam/mixerVessel2D/constant/polyMesh/boundary diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/sourcesProperties similarity index 83% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties rename to tutorials/incompressible/simpleFoam/mixerVessel2D/constant/sourcesProperties index 4386bc52506b016f5aa089d5535b7d7c81ed7694..8b7fb7bcf238ea417a80bcea72015643d29f94c1 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/sourcesProperties +++ b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/sourcesProperties @@ -15,18 +15,20 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -source1 +MRF1 { - type fixedTemperatureSource; + type MRFSource; active true; timeStart 0; - duration 1000000; + duration 1e100; selectionMode cellZone; - cellZone porosity; + cellZone rotor; - fixedTemperatureSourceCoeffs + MRFSourceCoeffs { - temperature 350; + origin (0 0 0); + axis (0 0 1); + omega 104.72; } } diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/transportProperties b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/transportProperties similarity index 63% rename from tutorials/multiphase/bubbleFoam/bubbleColumn/constant/transportProperties rename to tutorials/incompressible/simpleFoam/mixerVessel2D/constant/transportProperties index 2ddae4195c1660416302f266960a8e13d49a5949..b40b7d66cd884b7a54d4c7a61b50b1e39a466150 100644 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/transportProperties +++ b/tutorials/incompressible/simpleFoam/mixerVessel2D/constant/transportProperties @@ -15,23 +15,25 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -rho1 rho1 [ 1 -3 0 0 0 0 0 ] 1; +transportModel Newtonian; -rho2 rho2 [ 1 -3 0 0 0 0 0 ] 1000; +nu nu [ 0 2 -1 0 0 0 0 ] 1e-05; -nu1 nu1 [ 0 2 -1 0 0 0 0 ] 1.6e-05; - -nu2 nu2 [ 0 2 -1 0 0 0 0 ] 1e-06; - -d1 d1 [ 0 1 0 0 0 0 0 ] 0.003; - -d2 d2 [ 0 1 0 0 0 0 0 ] 0.0001; - -Cvm Cvm [ 0 0 0 0 0 0 0 ] 0.5; - -Cl Cl [ 0 0 0 0 0 0 0 ] 0; +CrossPowerLawCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 1; +} -Ct Ct [ 0 0 0 0 0 0 0 ] 1; +BirdCarreauCoeffs +{ + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 0; + n n [ 0 0 0 0 0 0 0 ] 1; +} // ************************************************************************* // diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh b/tutorials/incompressible/simpleFoam/mixerVessel2D/makeMesh similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/makeMesh rename to tutorials/incompressible/simpleFoam/mixerVessel2D/makeMesh diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/controlDict b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/controlDict similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/controlDict rename to tutorials/incompressible/simpleFoam/mixerVessel2D/system/controlDict diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvSchemes similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSchemes rename to tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvSchemes diff --git a/tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSolution b/tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvSolution similarity index 100% rename from tutorials/incompressible/MRFSimpleFoam/mixerVessel2D/system/fvSolution rename to tutorials/incompressible/simpleFoam/mixerVessel2D/system/fvSolution diff --git a/tutorials/incompressible/simpleFoam/motorBike/Allrun b/tutorials/incompressible/simpleFoam/motorBike/Allrun index 714dba48dc36754d69f2c7400414afb8a3a785fc..d3466dcfab58f9900044d93201fad9910d88d874 100755 --- a/tutorials/incompressible/simpleFoam/motorBike/Allrun +++ b/tutorials/incompressible/simpleFoam/motorBike/Allrun @@ -6,6 +6,7 @@ cd ${0%/*} || exit 1 # run from this directory # copy motorbike surface from resources folder cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/ +runApplication surfaceFeatureExtract runApplication blockMesh @@ -19,6 +20,7 @@ runParallel snappyHexMesh 6 -overwrite ls -d processor* | xargs -i rm -rf ./{}/0 $1 ls -d processor* | xargs -i cp -r 0.org ./{}/0 $1 +runParallel patchSummary 6 runParallel potentialFoam 6 -noFunctionObjects -writep runParallel `getApplication` 6 diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict index e7c16adc8d3dd3fb8ebba77e0e7646a2f0f81893..f075505d6870afcaed85cdfe23a65e4b7e1aca33 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/controlDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/controlDict @@ -39,6 +39,13 @@ writeInterval 100; purgeWrite 0; + +//- Have regular restart files +secondaryWriteControl cpuTime; +secondaryWriteInterval 120; +secondaryPurgeWrite 1; + + writeFormat ascii; writePrecision 6; diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict b/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict index 68819f01c42149e557daa31e094cc4fb84192297..ebed3bc292960c9266648dc86bea82d3bb82faf9 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict +++ b/tutorials/incompressible/simpleFoam/motorBike/system/snappyHexMeshDict @@ -90,10 +90,10 @@ castellatedMeshControls // This is a featureEdgeMesh, read from constant/triSurface for now. features ( - //{ - // file "someLine.eMesh"; - // level 2; - //} + { + file "motorBike.eMesh"; + level 0; + } ); @@ -189,10 +189,21 @@ snapControls // before upon reaching a correct mesh. nRelaxIter 5; - //- Highly experimental and wip: number of feature edge snapping - // iterations. Leave out altogether to disable. - // Do not use here since mesh resolution too low and baffles present - //nFeatureSnapIter 10; + // Feature snapping + + //- Number of feature edge snapping iterations. + // Leave out altogether to disable. + nFeatureSnapIter 0; + + //- Detect (geometric only) features by sampling the surface + // (default=false). + implicitFeatureSnap false; + + //- Use castellatedMeshControls::features (default = true) + explicitFeatureSnap false; + + //- Detect points on multiple surfaces (only for explicitFeatureSnap) + multiRegionFeatureSnap false; } @@ -216,33 +227,37 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. - featureAngle 30; + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // At non-patched sides allow mesh to slip if extrusion direction makes + // angle larger than slipFeatureAngle. + slipFeatureAngle 30; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary index 9b8e73ecfd9cd5aa8d8300034ab96dc76e98ad78..123fc6be271cf0b98d8ab3ac8dff9ed781fb9d26 100644 --- a/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary +++ b/tutorials/incompressible/simpleFoam/pipeCyclic/constant/polyMesh/boundary @@ -32,22 +32,24 @@ FoamFile side1 { type cyclicAMI; + inGroups 1(cyclicAMI); nFaces 400; startFace 4478; matchTolerance 0.0001; - neighbourPatch side2; transform rotational; + neighbourPatch side2; rotationAxis (1 0 0); rotationCentre (0 0 0); } side2 { type cyclicAMI; + inGroups 1(cyclicAMI); nFaces 250; startFace 4878; matchTolerance 0.0001; - neighbourPatch side1; transform rotational; + neighbourPatch side1; rotationAxis (1 0 0); rotationCentre (0 0 0); } diff --git a/tutorials/incompressible/simpleFoam/pitzDaily/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/pitzDaily/constant/polyMesh/boundary index 313dcceba1abd7b93d57320c4c674f1734692506..43b78ef4111bd17a26b37dd07818415f04eac737 100644 --- a/tutorials/incompressible/simpleFoam/pitzDaily/constant/polyMesh/boundary +++ b/tutorials/incompressible/simpleFoam/pitzDaily/constant/polyMesh/boundary @@ -44,6 +44,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 24450; startFace 24730; } diff --git a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U index c261ab16ba13cd1d55b5c54484a2df0ae19842de..bb861bfc6d1728ef2dc6aa6797e028a7fbb77371 100644 --- a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U +++ b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/U @@ -23,6 +23,7 @@ boundaryField inlet { type timeVaryingMappedFixedValue; + offset (0 0 0); setAverage off; } diff --git a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon index 28ff270cc2051c697e7760a851b726ac66155de8..b70f15f11994bfb3c213f3ff4dcc453c323b1b64 100644 --- a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon +++ b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/epsilon @@ -25,6 +25,7 @@ boundaryField { type timeVaryingMappedFixedValue; setAverage 0; + offset 0; value nonuniform List<scalar> 30 ( diff --git a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k index 3d54d8e0972efdf77d41884462f1c7d2082699d8..f5f11a1aed3de9e8d9b76526cbf6fefc45853167 100644 --- a/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k +++ b/tutorials/incompressible/simpleFoam/pitzDailyExptInlet/0/k @@ -25,6 +25,7 @@ boundaryField { type timeVaryingMappedFixedValue; setAverage 0; + offset 0; value nonuniform List<scalar> 30 ( diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon index cbbcc3aebf1d66be973620bc24c7b867d2b14c96..5a75819a1282a444688a63d94cdde2030a788cf2 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/epsilon @@ -33,10 +33,14 @@ boundaryField E 9.8; value $internalField; } + outlet { - type zeroGradient; + type inletOutlet; + inletValue uniform $turbulentEpsilon; + value $internalField; } + inlet { type atmBoundaryLayerInletEpsilon; diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k index 443a3a5794d3858d18108117113c4d73264bc7fe..ad81499bb61a98f3c7a7583dd0bcbc28aebffe6a 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k +++ b/tutorials/incompressible/simpleFoam/turbineSiting/0.org/k @@ -27,14 +27,16 @@ boundaryField outlet { type inletOutlet; - inletValue uniform 0.0; + inletValue uniform $turbulentKE; value $internalField; } + inlet { type uniformFixedValue; uniformValue constant $turbulentKE; } + "terrain_.*" { type kqRWallFunction; diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary index c3da61bd8ccedea26df22b891bcf5d95f322dd66..f37b2684f5f06a9a08cb9824cdf5565ef8530dfa 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary +++ b/tutorials/incompressible/simpleFoam/turbineSiting/constant/polyMesh/boundary @@ -15,43 +15,37 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -6 +5 ( outlet { type patch; - nFaces 922; - startFace 364825; + nFaces 600; + startFace 51900; } sides { type patch; - nFaces 1834; - startFace 365747; + nFaces 1200; + startFace 52500; } inlet { type patch; - nFaces 923; - startFace 367581; + nFaces 600; + startFace 53700; } ground { type wall; - nFaces 0; - startFace 368504; + nFaces 900; + startFace 54300; } top { type patch; nFaces 900; - startFace 368504; - } - terrain_patch0 - { - type wall; - nFaces 14400; - startFace 369404; + startFace 55200; } ) diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/system/fvSchemes b/tutorials/incompressible/simpleFoam/turbineSiting/system/fvSchemes index 774f507b640eca0d324b6804a502629ad98583eb..492b79ef744f264eeef3d8054c15216ce5d29448 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/system/fvSchemes +++ b/tutorials/incompressible/simpleFoam/turbineSiting/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes laplacianSchemes { - default Gauss linear limited 0.333; + default Gauss linear limited corrected 0.333; } interpolationSchemes @@ -45,7 +45,7 @@ interpolationSchemes snGradSchemes { - default limited 0.333; + default limited corrected 0.333; } fluxRequired diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict b/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict index 8054858f2a7cbcaffe1b8512939d6372af22b7c9..f294a40e53e28b67533e5908c3d2c555c2e69183 100644 --- a/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict +++ b/tutorials/incompressible/simpleFoam/turbineSiting/system/snappyHexMeshDict @@ -277,31 +277,31 @@ addLayersControls expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index 5c93f36555fb23d2470c0721fae62da403190349..aa8b02241a5b7ed42e112ad151f2340bb5ea59db 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -44,7 +44,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index fc5042f2c19d9695cc92d7c9d3c51753f976172d..bc122d0a3791682a799e6ab51be69453dafc5428 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index 29cfd8d563a15366018ca647af8ac59556abec4b..0517933f4d4b7470debddaedb58196a8662a04ad 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -35,7 +35,7 @@ solution interpolationSchemes { rho cell; - mu cell; + thermo:mu cell; U cellPoint; Cp cell; T cell; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties index 715f0ebdd9fc926737bb0f26ff740a4bada1bd4c..f5778839099a021219f6012b3ec56a1d4d5d503b 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/sourcesProperties @@ -17,15 +17,16 @@ FoamFile source1 { - type fixedTemperatureSource; + type fixedTemperatureConstraint; active true; timeStart 0.1; duration 0.4; selectionMode cellSet; cellSet ignitionCells; - fixedTemperatureSourceCoeffs + fixedTemperatureConstraintCoeffs { + mode uniform; temperature 2000; } } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties index 875e31a59c626d8f66982de456cb801c56dbf372..68e6be961fcf77de5a29026e74b7ae2c5f7d9773 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties index 98c728fdecd864d5e28f394f3537f7bd06bf75c3..e327a829599ca9d90206d28ee6bcfd5a96bfeea9 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/surfaceFilmProperties @@ -26,6 +26,9 @@ thermoSingleLayerCoeffs thermoModel singleComponent; liquid H2O; + deltaWet 1e-4; + hydrophilic no; + forces ( surfaceShear diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution index 381a5c4f27841eb58906d9902ce7a15261dc7eb2..eedbd097d3d322b785bb49d61583fa5af0cd6f47 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties index 78f4e7bb5dcc06fec98d6f6521d26a7fef98091f..a4d326c0411c0f9831860b14739a1294fa5cac6d 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties index 6984dcbb1e876386d5eaba75c0fc4786b0d7c7e4..96e33c1d68a2f91c9a59fe4bb9e2b083c4e78838 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/surfaceFilmProperties @@ -28,6 +28,9 @@ thermoSingleLayerCoeffs liquid H2O; + deltaWet 1e-4; + hydrophilic no; + radiationModel none; upperSurfaceModels @@ -65,7 +68,6 @@ thermoSingleLayerCoeffs contactAngleCoeffs { - deltaWet 1e-4; Ccf 0.085; contactAngleDistribution { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution index cfae8b06ceb271cf05a9ee11ec39344afa079585..9385e6ec40d512c789920599ee18efa3b828ca02 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/system/wallFilmRegion.org/fvSolution @@ -39,8 +39,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties index d9a68e059d339cc8cc23b54067fb0c7798b1fdce..8440f3f47953d46dd66cbf6ae0207948f049df64 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/constant/surfaceFilmProperties @@ -43,7 +43,6 @@ kinematicSingleLayerCoeffs contactAngleCoeffs { - deltaWet 1e-4; Ccf 1; contactAngleDistribution { diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution index 645d42a4563911f1bd0f6adc3531cea607b3bfda..86cdc388bf53280a96c3d9322b7579a3c4f04f58 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/rivuletPanel/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties index 6704aad9146ee24c13108ef2749e2349ec9eb112..42ddef823562d0f19e64ba22fa74c97fc5496bfb 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties index 30a2dd79f3721bd35423dc2c48f5217be5eec1a2..8335fadfc218d46a36d4c93c882f0e40738d7b69 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/surfaceFilmProperties @@ -27,6 +27,9 @@ thermoSingleLayerCoeffs liquid H2O; + deltaWet 1e-4; + hydrophilic no; + forces ( surfaceShear diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution index 381a5c4f27841eb58906d9902ce7a15261dc7eb2..eedbd097d3d322b785bb49d61583fa5af0cd6f47 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/system/wallFilmRegion/fvSolution @@ -37,8 +37,7 @@ solvers PISO { momentumPredictor true; - nOuterCorr 1; - nCorr 2; + nCorr 1; nNonOrthCorr 0; } diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun index b7428e064f41ff60966bae7e3ee0f990ef38bd62..7db81c26764f11073eff2d532bd2f1c1ba524b88 100755 --- a/tutorials/lagrangian/reactingParcelFoam/filter/Allrun +++ b/tutorials/lagrangian/reactingParcelFoam/filter/Allrun @@ -10,26 +10,10 @@ application=`getApplication` runApplication blockMesh # create sets -#setSet -batch system/sets.setSet > log.setSet1 2>&1 runApplication topoSet -# convert sets to zones -setsToZones -noFlipMap > log.setsToZones 2>&1 - -# create the first cyclic - lhs of porous zone -# Note that we don't know what value to give these patches-out-of-nothing so -# - use binary writing to avoid 'nan' -# - use setFields to set values -unset FOAM_SIGFPE -runApplication createBaffles cycLeft '(cycLeft_half0 cycLeft_half1)' -overwrite -mv log.createBaffles log.createBaffles1 - -# create the second cyclic - rhs of porous zone -runApplication createBaffles cycRight '(cycRight_half0 cycRight_half1)' -overwrite -mv log.createBaffles log.createBaffles2 - -# Initialise newly created patchFields to 0 -runApplication changeDictionary +# create baffles and fields +createBaffles -overwrite runApplication $application diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict b/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict index 04b1edd6ab2023f613d1b9b34c400b4e0390a666..ae16964f9352790d20bc408641b3027323f09503 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/blockMeshDict @@ -100,32 +100,6 @@ boundary ); } - cycLeft_half0 - { - type cyclic; - faces (); - neighbourPatch cycLeft_half1; - } - cycLeft_half1 - { - type cyclic; - faces (); - neighbourPatch cycLeft_half0; - } - - cycRight_half0 - { - type cyclic; - faces (); - neighbourPatch cycRight_half1; - } - cycRight_half1 - { - type cyclic; - faces (); - neighbourPatch cycRight_half0; - } - frontAndBack { type empty; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary b/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary deleted file mode 100644 index 3a75efa15be726e00276bc3ee9a6d2fdbb2220f0..0000000000000000000000000000000000000000 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/polyMesh/boundary +++ /dev/null @@ -1,83 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format binary; - class polyBoundaryMesh; - location "constant/polyMesh"; - object boundary; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -8 -( - walls - { - type wall; - nFaces 172; - startFace 3294; - } - inlet - { - type patch; - nFaces 20; - startFace 3466; - } - outlet - { - type patch; - nFaces 20; - startFace 3486; - } - cycLeft_half0 - { - type cyclic; - inGroups 1(cyclic); - nFaces 20; - startFace 3506; - matchTolerance 0.0001; - neighbourPatch cycLeft_half1; - } - cycLeft_half1 - { - type cyclic; - inGroups 1(cyclic); - nFaces 20; - startFace 3526; - matchTolerance 0.0001; - neighbourPatch cycLeft_half0; - } - cycRight_half0 - { - type cyclic; - inGroups 1(cyclic); - nFaces 20; - startFace 3546; - matchTolerance 0.0001; - neighbourPatch cycRight_half1; - } - cycRight_half1 - { - type cyclic; - inGroups 1(cyclic); - nFaces 20; - startFace 3566; - matchTolerance 0.0001; - neighbourPatch cycRight_half0; - } - frontAndBack - { - type empty; - inGroups 1(empty); - nFaces 3440; - startFace 3586; - } -) - -// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties index 613b407de15bd9dd5ca7257a66ed3818d232ce5a..cb6c2dd3becd14a73d94c1392f5671307b8e7898 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict b/tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict new file mode 100644 index 0000000000000000000000000000000000000000..1caf47dc89d7e6df43b99af09865fe4827778ce3 --- /dev/null +++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/createBafflesDict @@ -0,0 +1,81 @@ +/*--------------------------------*- 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; + object createBafflesDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Whether to convert internal faces only (so leave boundary faces intact). +// This is only relevant if your face selection type can pick up boundary +// faces. +internalFacesOnly true; + +// Baffles to create. +baffles +{ + cycLeft + { + //- Use predefined faceZone to select faces and orientation. + type faceZone; + zoneName cycLeft; + + patches + { + master + { + //- Master side patch + + name cycLeft_half0; + type cyclic; + neighbourPatch cycLeft_half1; + } + slave + { + //- Slave side patch + + name cycLeft_half1; + type cyclic; + neighbourPatch cycLeft_half0; + } + } + } + + cycRight + { + //- Use predefined faceZone to select faces and orientation. + type faceZone; + zoneName cycRight; + + patches + { + master + { + //- Master side patch + + name cycRight_half0; + type cyclic; + neighbourPatch cycRight_half1; + } + slave + { + //- Slave side patch + + name cycRight_half1; + type cyclic; + neighbourPatch cycRight_half0; + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/topoSetDict b/tutorials/lagrangian/reactingParcelFoam/filter/system/topoSetDict index fd7ee0e747f98e328828d96453f9ab3db9bd7858..e77e55346fbcf1e14d984de620a9201db022246c 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/system/topoSetDict +++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/topoSetDict @@ -28,6 +28,17 @@ actions box (1.5 -10 -10) (2 10 10); } } + { + name filter; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set filter; + } + } + { name leftFluid; @@ -39,6 +50,16 @@ actions box (-10 -10 -10) (1.5 10 10); } } + { + name leftFluid; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set leftFluid; + } + } { name rightFluid; type cellSet; @@ -49,6 +70,16 @@ actions box (2 -1 -1) (10 10 10); } } + { + name rightFluid; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set rightFluid; + } + } // cycLeft @@ -74,6 +105,17 @@ actions option all; } } + // Create faceZone from cycLeft + { + name cycLeft; + type faceZoneSet; + action new; + source setToFaceZone; + sourceInfo + { + faceSet cycLeft; // name of faceSet + } + } // cycRight { @@ -98,6 +140,18 @@ actions option all; } } + // Create faceZone from cycRight + { + name cycRight; + type faceZoneSet; + action new; + source setToFaceZone; + sourceInfo + { + faceSet cycRight; // name of faceSet + } + } + ); // ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties index 10bb7ccc333cd1af3293421a91f8815c849185fd..56b0a2d3e7c473f1316a983cbfa0e1aed79c467d 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index aac578722d8a63635cf9afd4869a7755edd1d948..b4d1d9abdf50879e95417c9dbe5aac5e873ca786 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties index 153a5fc0b2bd83c346589193ad9b8d783199c74a..0ce1e3bbc8a22230ffde01e1393f55c4e6c05deb 100644 --- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties @@ -38,7 +38,7 @@ solution { rho cell; U cellPoint; - mu cell; + thermo:mu cell; T cell; Cp cell; p cell; diff --git a/tutorials/mesh/cvMesh/blob/Allclean b/tutorials/mesh/cvMesh/blob/Allclean index 4a8e3bf4d98aa84d3985e9189af619fd80f7dc1f..3b8eb25810039817af3290c78cec672d91be429c 100755 --- a/tutorials/mesh/cvMesh/blob/Allclean +++ b/tutorials/mesh/cvMesh/blob/Allclean @@ -6,4 +6,9 @@ cd ${0%/*} || exit 1 # run from this directory cleanCase +rm -rf constant/cellAlignments > /dev/null 2>&1 +rm -rf constant/targetCellSize > /dev/null 2>&1 +rm -rf constant/internalDelaunayVertices > /dev/null 2>&1 + + # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/blob/Allrun b/tutorials/mesh/cvMesh/blob/Allrun index 860857ec95671dcadfaa411c85190b7ee08b1fe8..ab12a6cbd5e5cd43785ffae0f8d8e1c4e2019ebf 100755 --- a/tutorials/mesh/cvMesh/blob/Allrun +++ b/tutorials/mesh/cvMesh/blob/Allrun @@ -4,10 +4,8 @@ cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -runApplication blockMesh runApplication cvMesh -#runApplication collapseEdges 1e-10 180 -overwrite -runApplication snappyHexMesh -overwrite -runApplication checkMesh -constant -allGeometry -allTopology +runApplication collapseEdges -latestTime -collapseFaces +runApplication checkMesh -latestTime -allGeometry -allTopology # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/blob/Allrun-parallel b/tutorials/mesh/cvMesh/blob/Allrun-parallel index ce7e7049807344506d26d4f8497fada5170d2bdf..253294de1f153f5933dac13f3c4559a366225cf1 100755 --- a/tutorials/mesh/cvMesh/blob/Allrun-parallel +++ b/tutorials/mesh/cvMesh/blob/Allrun-parallel @@ -5,30 +5,15 @@ cd ${0%/*} || exit 1 # run from this directory . $WM_PROJECT_DIR/bin/tools/RunFunctions # Get the number of processors to run on from system/decomposeParDict -nProc=`grep numberOfSubdomains system/decomposeParDict \ - | sed s/"numberOfSubdomains *\(.*\);"/"\1"/` +nProc=$(getNumberOfProcessors) runApplication blockMesh runApplication decomposePar -for dir in processor* -do - if [[ -d $dir ]] - then - cp -r $dir/constant/polyMesh $dir/constant/polyMesh_background - fi -done - runParallel cvMesh $nProc +runParallel collapseEdges $nProc -latestTime -collapseFaces +runParallel checkMesh $nProc -latestTime -allTopology -allGeometry -runApplication reconstructParMesh -constant -mergeTol 1e-10 -runParallel checkMesh $nProc -constant -allGeometry -allTopology - -# To run from the same background mesh as before -# for dir in processor*; -# do -# rm -r $dir/constant/polyMesh -# cp -r $dir/constant/polyMesh_background $dir/constant/polyMesh -# done +runApplication reconstructParMesh -latestTime # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/blob/Alltest b/tutorials/mesh/cvMesh/blob/Alltest new file mode 100755 index 0000000000000000000000000000000000000000..fc9136aea51b1f0ea208ef462afc59dbbb9b3693 --- /dev/null +++ b/tutorials/mesh/cvMesh/blob/Alltest @@ -0,0 +1,18 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication cvMesh + +# Change collapseEdges to only do one iteration +cp system/collapseDict system/collapseDict.org + +sed -e s/"\(maximumIterations[ \t]*\)\([0-9]*\);"/"\1 1;"/g \ +system/collapseDict.org > system/collapseDict + +runApplication collapseEdges -latestTime -collapseFaces + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/blob/constant/polyMesh/boundary b/tutorials/mesh/cvMesh/blob/constant/polyMesh/boundary index cc9c4f83420c2f151ef01147140461dfe17b2f67..69a2a888d4cbc8ceaaf582487e5027df213da58a 100644 --- a/tutorials/mesh/cvMesh/blob/constant/polyMesh/boundary +++ b/tutorials/mesh/cvMesh/blob/constant/polyMesh/boundary @@ -8,7 +8,7 @@ FoamFile { version 2.0; - format binary; + format ascii; class polyBoundaryMesh; location "constant/polyMesh"; object boundary; diff --git a/tutorials/mesh/cvMesh/blob/system/collapseDict b/tutorials/mesh/cvMesh/blob/system/collapseDict new file mode 100644 index 0000000000000000000000000000000000000000..f340ced2b5dca8a8985043d641a56f3c4cae6c83 --- /dev/null +++ b/tutorials/mesh/cvMesh/blob/system/collapseDict @@ -0,0 +1,54 @@ +/*--------------------------------*- 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; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object collapseDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +collapseEdgesCoeffs +{ + minimumEdgeLength 1e-4; + maximumMergeAngle 180; + reductionFactor 0.5; +} + + +collapseFacesCoeffs +{ + initialFaceLengthFactor 0.5; + reductionFactor 0.5; + + allowEarlyCollapseToPoint on; + allowEarlyCollapseCoeff 0.2; + guardFraction 0.1; + maxCollapseFaceToPointSideLengthCoeff 0.3; +} + + +meshQualityCoeffs +{ + #include "meshQualityDict"; + maximumIterations 30; + maximumSmoothingIterations 1; + maxPointErrorCount 5; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/blob/system/controlDict b/tutorials/mesh/cvMesh/blob/system/controlDict index ca09d8971cb312e3f9c48ee685f588a00fb4ab10..e941da70361b269fd1277b95767e74fa28303525 100644 --- a/tutorials/mesh/cvMesh/blob/system/controlDict +++ b/tutorials/mesh/cvMesh/blob/system/controlDict @@ -34,11 +34,11 @@ deltaT 1; writeControl timeStep; -writeInterval 1000; +writeInterval 80; purgeWrite 0; -writeFormat binary;//ascii; +writeFormat ascii; writePrecision 12; diff --git a/tutorials/mesh/cvMesh/blob/system/cvMeshDict b/tutorials/mesh/cvMesh/blob/system/cvMeshDict index af0db035085f0f51cf85ded8b928586f76e11143..eda52324f55ca0fdb1431ce058ee1304f61ab4de 100644 --- a/tutorials/mesh/cvMesh/blob/system/cvMeshDict +++ b/tutorials/mesh/cvMesh/blob/system/cvMeshDict @@ -86,7 +86,9 @@ surfaceConformation surfaceSearchDistanceCoeff 5; - maxSurfaceProtrusionCoeff 0.1; + nearBoundaryDistanceCoeff 5; + + maxSurfaceProtrusionCoeff 0.001; maxQuadAngle 125; @@ -96,34 +98,15 @@ surfaceConformation conformationControls { - initial - { - edgeSearchDistCoeff 5; - surfacePtReplaceDistCoeff 0.5; - surfacePtExclusionDistanceCoeff 0.5; - } - - iteration - { - edgeSearchDistCoeff 1.5; - surfacePtReplaceDistCoeff 0.7; - } + edgeSearchDistCoeff 5; + surfacePtReplaceDistCoeff 0.5; + surfacePtExclusionDistanceCoeff 0.5; maxIterations 15; iterationToInitialHitRatioLimit 0.0001; } - coarseConformationControls - { - $conformationControls; - } - - fineConformationControls - { - $conformationControls; - } - geometryToConformTo { blob.stl @@ -140,37 +123,36 @@ surfaceConformation motionControl { - defaultCellSize 0.04; - - // Assign a priority to all requests for cell sizes, the highest overrules. - defaultPriority 0; + defaultCellSize 0.1; - cellSizeControlGeometry + shapeControlFunctions { blob.stl { - priority 1; - mode bothSides; + type searchableSurfaceControl; + priority 1; + mode bothSides; surfaceCellSizeFunction uniformValue; uniformValueCoeffs { - surfaceCellSize 0.04; + surfaceCellSize $defaultCellSize; } - cellSizeFunction uniformDistance; - uniformDistanceCoeffs - { - distance 0.1; - } - linearDistanceCoeffs - { - distanceCellSize $defaultCellSize; - distance 0.1; - } + cellSizeFunction uniform; + uniformCoeffs + {} } } + maxRefinementIterations 1; + + cellAspectRatioControl + { + aspectRatio 1.0; + aspectRatioDirection (1 0 0); + } + relaxationModel adaptiveLinear; adaptiveLinearCoeffs @@ -183,7 +165,7 @@ motionControl timeChecks no; - maxLoadUnbalance 0.05; + maxLoadUnbalance 0.5; alignmentSearchSpokes 24; @@ -215,18 +197,9 @@ motionControl polyMeshFiltering { - writeTetDualMesh false; - filterSizeCoeff 0.2; - mergeClosenessCoeff 1e-3; - edgeMergeAngle 45; - continueFilteringOnBadInitialPolyMesh true; - filterErrorReductionCoeff 0.5; - filterCountSkipThreshold 4; - surfaceStepFaceAngle 80; - maxCollapseIterations 25; - maxConsecutiveEqualFaceSets 5; - edgeCollapseGuardFraction 0.1; - maxCollapseFaceToPointSideLengthCoeff 0.35; + filterEdges on; + filterFaces off; + writeTetDualMesh false; } diff --git a/tutorials/mesh/cvMesh/blob/system/decomposeParDict b/tutorials/mesh/cvMesh/blob/system/decomposeParDict index 58cbdde81165c889472eed6e0cf22ae520fec424..3d3806e87382b1f4fef074e2aad6f535c98881b6 100644 --- a/tutorials/mesh/cvMesh/blob/system/decomposeParDict +++ b/tutorials/mesh/cvMesh/blob/system/decomposeParDict @@ -15,10 +15,10 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 8; +numberOfSubdomains 2; -//method scotch; - method ptscotch; +method scotch; +//method ptscotch; // method hierarchical; simpleCoeffs @@ -29,7 +29,7 @@ simpleCoeffs hierarchicalCoeffs { - n ( 2 2 2 ); + n ( 2 1 1 ); delta 0.001; order xyz; } diff --git a/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict b/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict index da3f1895b4b58c861f8902a8a109d83c5fa61fbf..c5723d829f22cd893114a969605b413cdcb75b84 100644 --- a/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict +++ b/tutorials/mesh/cvMesh/blob/system/snappyHexMeshDict @@ -216,33 +216,32 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.5; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.02; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.005; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 90; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/mesh/cvMesh/flange/Allclean b/tutorials/mesh/cvMesh/flange/Allclean index 926f4a12b9cffbf888b47cda9e644aa084c7e45d..dc1ee49a8fe81c236846b581745b8bf9c0f9b13a 100755 --- a/tutorials/mesh/cvMesh/flange/Allclean +++ b/tutorials/mesh/cvMesh/flange/Allclean @@ -4,8 +4,10 @@ cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/CleanFunctions -rm -rf constant/extendedFeatureEdgeMesh flange > /dev/null 2>&1 -rm -r constant/ccx constant/ccy constant/ccz > /dev/null 2>&1 +rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1 +rm -r constant/ccx constant/ccy constant/ccz > /dev/null 2>&1 +rm -r constant/internalDelaunayVertices constant/targetCellSize > /dev/null 2>&1 +rm -r 0/ccx 0/ccy 0/ccz > /dev/null 2>&1 cleanCase diff --git a/tutorials/mesh/cvMesh/flange/Allrun b/tutorials/mesh/cvMesh/flange/Allrun index dcbbfb47d41692c7e12c8aa3cb009f6e482def5d..f3f891243724f6262cc41d0e6115929907235b4d 100755 --- a/tutorials/mesh/cvMesh/flange/Allrun +++ b/tutorials/mesh/cvMesh/flange/Allrun @@ -4,10 +4,6 @@ cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -# Get the number of processors to run on from system/decomposeParDict -nProc=`grep numberOfSubdomains system/decomposeParDict \ - | sed s/"numberOfSubdomains *\(.*\);"/"\1"/` - runApplication surfaceFeatureExtract # Create tight-fitting background mesh @@ -16,25 +12,8 @@ runApplication topoSet -dict system/topoSetDict-background mv log.topoSet log.topoSet.background runApplication subsetMesh background -patch walls -overwrite -runApplication decomposePar - -# Backup initial background mesh on each processor -for dir in processor* -do - if [[ -d $dir ]] - then - cp -r $dir/constant/polyMesh $dir/constant/polyMesh_background - fi -done - -runParallel cvMesh $nProc -#runParallel snappyHexMesh $nProc - -runApplication reconstructParMesh -constant -mergeTol 1e-6 - -runApplication topoSet -dict system/topoSetDict-slices -mv log.topoSet log.topoSet.slices -runApplication writeCellCentres -constant -runParallel checkMesh $nProc -constant -allGeometry -allTopology +runApplication cvMesh +runApplication collapseEdges -latestTime -collapseFaces +runApplication checkMesh -latestTime -allGeometry -allTopology # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/flange/Allrun-parallel b/tutorials/mesh/cvMesh/flange/Allrun-parallel new file mode 100755 index 0000000000000000000000000000000000000000..f5bedb8935ec8f063146fa1432b4769182cdc2f9 --- /dev/null +++ b/tutorials/mesh/cvMesh/flange/Allrun-parallel @@ -0,0 +1,26 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Get the number of processors to run on from system/decomposeParDict +nProc=$(getNumberOfProcessors) + +runApplication surfaceFeatureExtract + +# Create tight-fitting background mesh +runApplication blockMesh +runApplication topoSet -dict system/topoSetDict-background +mv log.topoSet log.topoSet.background +runApplication subsetMesh background -patch walls -overwrite + +runApplication decomposePar + +runParallel cvMesh $nProc +runParallel collapseEdges $nProc -latestTime -collapseFaces +runParallel checkMesh $nProc -latestTime -allTopology -allGeometry + +runApplication reconstructParMesh -latestTime + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/flange/Alltest b/tutorials/mesh/cvMesh/flange/Alltest new file mode 100755 index 0000000000000000000000000000000000000000..75b5887193055fc87ce8120145c5e72d0c335399 --- /dev/null +++ b/tutorials/mesh/cvMesh/flange/Alltest @@ -0,0 +1,21 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication surfaceFeatureExtract + +# Create tight-fitting background mesh +runApplication blockMesh +runApplication cvMesh + +# Change collapseEdges to only do one iteration +cp system/collapseDict system/collapseDict.org + +sed -e s/"\(maximumIterations[ \t]*\)\([0-9]*\);"/"\1 1;"/g \ +system/collapseDict.org > system/collapseDict + +runApplication collapseEdges -latestTime -collapseFaces + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/flange/constant/polyMesh/blockMeshDict b/tutorials/mesh/cvMesh/flange/constant/polyMesh/blockMeshDict index e04b7a40412244673be6f2c7d3664995247de35f..81d15816e37cbce5427f961bf339915ba1395524 100644 --- a/tutorials/mesh/cvMesh/flange/constant/polyMesh/blockMeshDict +++ b/tutorials/mesh/cvMesh/flange/constant/polyMesh/blockMeshDict @@ -21,7 +21,7 @@ xmax 0.0265; ymin -0.028; ymax 0.023; zmin -0.024; -zmax 0.0025; +zmax 0.01; vertices ( diff --git a/tutorials/mesh/cvMesh/flange/constant/polyMesh/boundary b/tutorials/mesh/cvMesh/flange/constant/polyMesh/boundary index 939aa87f628f8b80b327e66df881f3fac023c5a8..efe6bfe832fedad4de807c79b291f6dcc2b14dde 100644 --- a/tutorials/mesh/cvMesh/flange/constant/polyMesh/boundary +++ b/tutorials/mesh/cvMesh/flange/constant/polyMesh/boundary @@ -8,44 +8,20 @@ FoamFile { version 2.0; - format binary; + format ascii; class polyBoundaryMesh; location "constant/polyMesh"; object boundary; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -5 +1 ( - flange.obj_patch1 + walls { type wall; - nFaces 24684; - startFace 193547; - } - flange.obj_patch2 - { - type wall; - nFaces 1674; - startFace 218231; - } - flange.obj_patch3 - { - type wall; - nFaces 438; - startFace 219905; - } - flange.obj_patch4 - { - type wall; - nFaces 3595; - startFace 220343; - } - cvMesh_defaultPatch - { - type wall; - nFaces 0; - startFace 223938; + nFaces 126; + startFace 207; } ) diff --git a/tutorials/mesh/cvMesh/flange/constant/triSurface/flange.eMesh b/tutorials/mesh/cvMesh/flange/constant/triSurface/flange.eMesh deleted file mode 100644 index b21ffb616f8f075b28a0929986c3c4b35176dc1c..0000000000000000000000000000000000000000 --- a/tutorials/mesh/cvMesh/flange/constant/triSurface/flange.eMesh +++ /dev/null @@ -1,224 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format binary; - class featureEdgeMesh; - location "constant/triSurface"; - object flange.eMesh; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// points: - -777 -(9´Èv¾Ÿz?¸…ëQ¸~?R¸…ëQ˜¿9´Èv¾Ÿz?¸…ëQ¸~¿R¸…ëQ˜¿9´Èv¾Ÿz?¸…ëQ¸~?;ßO—nb?9´Èv¾Ÿz¿¸…ëQ¸~?R¸…ëQ˜¿9´Èv¾Ÿz¿¸…ëQ¸~¿R¸…ëQ˜¿9´Èv¾Ÿz¿¸…ëQ¸~?;ßO—nb?9´Èv¾Ÿz?ü©ñÒMb`?¥p˜ÃIõ¿9´Èv¾Ÿz?ü©ñÒMb`?9Ü`îÅ_¿9´Èv¾Ÿz¿ü©ñÒMb`?¥p˜ÃIõ¿9´Èv¾Ÿz¿ü©ñÒMb`?9Ü`îÅ_¿9´Èv¾Ÿz?ü©ñÒMb`?R¸…ëQ˜¿9´Èv¾Ÿz?ü©ñÒMb`?;ßO—nb?9´Èv¾Ÿz¿ü©ñÒMb`?R¸…ëQ˜¿9´Èv¾Ÿz¿ü©ñÒMb`?;ßO—nb?9´Èv¾Ÿz?¸…ëQ¸~?¨!á Æ¿9šD9¨/Q?A¦çé%ɼøä¼ZI†‡¿9´Èv¾Ÿz?¸…ëQ¸~?x}»8\a¿9´Èv¾Ÿz¿¸…ëQ¸~?¨!á Æ¿9šD9¨/Q¿A¦çé%ɼøä¼ZI†‡¿9´Èv¾Ÿz¿¸…ëQ¸~?x}»8\a¿+ï²xd?A¦çé%ɼ‹lçû©ñ‚¿Sí.«Ób?A¦çé%ɼ›™Eï„¿ðd‡Bˆ?ü©ñÒMb`?‹lçû©ñ‚¿âý]D€ˆ?ü©ñÒMb`?“®ô5&†¿P_…J:Ž?ü©ñÒMb`?ÑvLÝ•¿¹Ïॊ˜?ü©ñÒMb`?#<«GÐŽ¿6¦Ìr~/’?ü©ñÒMb`?¬Zd;¿Â‘(´¬‹?ü©ñÒMb`?OØî ‹¿ÅÿQ¡º‰?ü©ñÒMb`?/$ç^‰¿Sí.«Ób?A¦çé%ɼ|Ö5Zô€¿õ«(¹˜?ü©ñÒMb`?ò¹n¥2 †¿õEç¡[T˜?ü©ñÒMb`?‹lçû©ñ‚¿}X˜—?ü©ñÒMb`?eôín¯‰¿jOÉ9±‡–?ü©ñÒMb`?”q碋¿ÅœVÀóA•?ü©ñÒMb`?ÑvLÝ•¿ê«PIBÇ“?ü©ñÒMb`?0ÑÅKÜÏŽ¿õ«(¹˜?ü©ñÒMb`?I>À¤B†¿}X˜—?ü©ñÒMb`?dÉÁI™y¿jOÉ9±‡–?ü©ñÒMb`?§ÕG–‚t¿ÅœVÀóA•?ü©ñÒMb`?µ¼Y Íšp¿ê«PIBÇ“?ü©ñÒMb`?˳)ôMl¿6¦Ìr~/’?ü©ñÒMb`?9´Èv¾Ÿj¿âý]D€ˆ?ü©ñÒMb`?Ãï¦[vˆ¿¹Ïॊ˜?ü©ñÒMb`?Ïsú01Ll¿P_…J:Ž?ü©ñÒMb`?Au½~Òšp¿Â‘(´¬‹?ü©ñÒMb`?3»-z†t¿ÅÿQ¡º‰?ü©ñÒMb`?Ðiq!ê™y¿Sí.«Ób¿A¦çé%ɼ›™Eï„¿+ï²xd¿A¦çé%ɼ‹lçû©ñ‚¿âý]D€ˆ¿ü©ñÒMb`?“®ô5&†¿ðd‡Bˆ¿ü©ñÒMb`?‹lçû©ñ‚¿¹Ïॊ˜¿ü©ñÒMb`?#<«GÐŽ¿P_…J:Ž¿ü©ñÒMb`?ÑvLÝ•¿6¦Ìr~/’¿ü©ñÒMb`?¬Zd;¿Â‘(´¬‹¿ü©ñÒMb`?OØî ‹¿ÅÿQ¡º‰¿ü©ñÒMb`?/$ç^‰¿Sí.«Ób¿A¦çé%ɼ|Ö5Zô€¿õEç¡[T˜¿ü©ñÒMb`?‹lçû©ñ‚¿õ«(¹˜¿ü©ñÒMb`?ò¹n¥2 †¿}X˜—¿ü©ñÒMb`?eôín¯‰¿jOÉ9±‡–¿ü©ñÒMb`?”q碋¿ÅœVÀóA•¿ü©ñÒMb`?ÑvLÝ•¿ê«PIBÇ“¿ü©ñÒMb`?0ÑÅKÜÏŽ¿õ«(¹˜¿ü©ñÒMb`?I>À¤B†¿}X˜—¿ü©ñÒMb`?dÉÁI™y¿jOÉ9±‡–¿ü©ñÒMb`?§ÕG–‚t¿ÅœVÀóA•¿ü©ñÒMb`?µ¼Y Íšp¿ê«PIBÇ“¿ü©ñÒMb`?˳)ôMl¿6¦Ìr~/’¿ü©ñÒMb`?9´Èv¾Ÿj¿âý]D€ˆ¿ü©ñÒMb`?Ãï¦[vˆ¿P_…J:Ž¿ü©ñÒMb`?Au½~Òšp¿¹Ïॊ˜¿ü©ñÒMb`?Ïsú01Ll¿Â‘(´¬‹¿ü©ñÒMb`?3»-z†t¿ÅÿQ¡º‰¿ü©ñÒMb`?Ðiq!ê™y¿4×ÌÎ`[X?¸…ëQ¸~¿R¸…ëQ˜¿†x¥Þ³« ?¸…ëQ¸~¿R¸…ëQ˜¿Kxh²Úg?¸…ëQ¸~¿R¸…ëQ˜¿ÓY„oPq?¸…ëQ¸~¿R¸…ëQ˜¿VèÍò†Ev?¸…ëQ¸~¿R¸…ëQ˜¿†x¥Þ³« ? -×£p= -—?¤p= -×£¿9šD9¨/Q? -×£p= -—?Wñ¡Ÿ‘¿eÛ²a? -×£p= -—?òÑâŒaN¿ÔÀEݽ’j? -×£p= -—?¾ñZ®#³¿Oß|4æ¿q? -×£p= -—?š(£éGŽ¿H ¹¢)v? -×£p= -—?)\Âõ(Œ¿PŒ,™cy? -×£p= -—?ÀJôèüʉ¿§ÉŒ·•^{? -×£p= -—?øä¼ZI†‡¿ö$U€”}|? -×£p= -—?¸çùÓF…¿ ƒ‡iß|? -×£p= -—?‹lçû©ñ‚¿ÀÓ¿N\?½~Ñucn>Þ…A™†¿^tG9w?W?½~Ñucn>"z™‡¿†x¥Þ³« ?¸…ëQ¸~¿;ßO—nb?öOŸ†X?¸…ëQ¸~¿;ßO—nb?Kxh²Úg?¸…ëQ¸~¿;ßO—nb?ÓY„oPq?¸…ëQ¸~¿;ßO—nb?VèÍò†Ev?¸…ëQ¸~¿;ßO—nb?9´Èv¾Ÿz?¸…ëQ¸~¿;ßO—nb?9šD9¨/Q? -×£p= -—?!ȃ%c¿†x¥Þ³« ? -×£p= -—?;ßO—nb¿eÛ²a? -×£p= -—?ƒÎA#e¿ÔÀEݽ’j? -×£p= -—?bÏ%ÁÀh¿Oß|4æ¿q? -×£p= -—?Àß7דmn¿H ¹¢)v? -×£p= -—?Ûù~j¼ts¿§ÉŒ·•^{? -×£p= -—?jSŽ, º|¿PŒ,™cy? -×£p= -—?µ®0x¿ö$U€”}|? -×£p= -—?®Óí‘rœ€¿ÀÓ¿N\?½~Ñucn>p–’å$”~¿Ío=¯1O?²G@ -¡¸=É°Š72|¿†x¥Þ³« ?/#ñ®Z‚>_ÎQÚ{¿4×ÌÎ`[X¿¸…ëQ¸~¿R¸…ëQ˜¿Kxh²Úg¿¸…ëQ¸~¿R¸…ëQ˜¿ÓY„oPq¿¸…ëQ¸~¿R¸…ëQ˜¿VèÍò†Ev¿¸…ëQ¸~¿R¸…ëQ˜¿9šD9¨/Q¿ -×£p= -—?Wñ¡Ÿ‘¿eÛ²a¿ -×£p= -—?òÑâŒaN¿ÔÀEݽ’j¿ -×£p= -—?¾ñZ®#³¿Oß|4æ¿q¿ -×£p= -—?š(£éGŽ¿H ¹¢)v¿ -×£p= -—?)\Âõ(Œ¿§ÉŒ·•^{¿ -×£p= -—?øä¼ZI†‡¿PŒ,™cy¿ -×£p= -—?ÀJôèüʉ¿ö$U€”}|¿ -×£p= -—?¸çùÓF…¿ ƒ‡iß|¿ -×£p= -—?‹lçû©ñ‚¿ÀÓ¿N\¿½~Ñucn>Þ…A™†¿^tG9w?W¿½~Ñucn>"z™‡¿öOŸ†X¿¸…ëQ¸~¿;ßO—nb?Kxh²Úg¿¸…ëQ¸~¿;ßO—nb?ÓY„oPq¿¸…ëQ¸~¿;ßO—nb?VèÍò†Ev¿¸…ëQ¸~¿;ßO—nb?9´Èv¾Ÿz¿¸…ëQ¸~¿;ßO—nb?9šD9¨/Q¿ -×£p= -—?!ȃ%c¿eÛ²a¿ -×£p= -—?ƒÎA#e¿ÔÀEݽ’j¿ -×£p= -—?bÏ%ÁÀh¿Oß|4æ¿q¿ -×£p= -—?Àß7דmn¿H ¹¢)v¿ -×£p= -—?Ûù~j¼ts¿PŒ,™cy¿ -×£p= -—?µ®0x¿§ÉŒ·•^{¿ -×£p= -—?jSŽ, º|¿ö$U€”}|¿ -×£p= -—?®Óí‘rœ€¿ÀÓ¿N\¿½~Ñucn>p–’å$”~¿Ío=¯1O¿²G@ -¡¸=É°Š72|¿†x¥Þ³« ?9´Èv¾Ÿz?¤p= -×£¿9šD9¨/Q?9´Èv¾Ÿz?Wñ¡Ÿ‘¿9šD9¨/Q?¾ÇôßÞ?Wñ¡Ÿ‘¿†x¥Þ³« ?¾ÇôßÞ?¤p= -×£¿eÛ²a?9´Èv¾Ÿz?òÑâŒaN¿eÛ²a?¾ÇôßÞ?òÑâŒaN¿ÔÀEݽ’j?9´Èv¾Ÿz?¾ñZ®#³¿ÔÀEݽ’j?¾ÇôßÞ?¾ñZ®#³¿Oß|4æ¿q?9´Èv¾Ÿz?š(£éGŽ¿Oß|4æ¿q?¾ÇôßÞ?š(£éGŽ¿H ¹¢)v?9´Èv¾Ÿz?)\Âõ(Œ¿H ¹¢)v?¾ÇôßÞ?)\Âõ(Œ¿PŒ,™cy?9´Èv¾Ÿz?ÀJôèüʉ¿§ÉŒ·•^{?9´Èv¾Ÿz?øä¼ZI†‡¿§ÉŒ·•^{?¾ÇôßÞ?øä¼ZI†‡¿PŒ,™cy?¾ÇôßÞ?ÀJôèüʉ¿ö$U€”}|?9´Èv¾Ÿz?¸çùÓF…¿ö$U€”}|?¾ÇôßÞ?¸çùÓF…¿ ƒ‡iß|?9´Èv¾Ÿz?‹lçû©ñ‚¿ ƒ‡iß|?¾ÇôßÞ?‹lçû©ñ‚¿9šD9¨/Q?9´Èv¾Ÿz?£Ù+â*c¿†x¥Þ³« ?9´Èv¾Ÿz?;ßO—nb¿†x¥Þ³« ?¾ÇôßÞ?;ßO—nb¿9šD9¨/Q?¾ÇôßÞ?£Ù+â*c¿eÛ²a?9´Èv¾Ÿz?ƒÎA#e¿eÛ²a?¾ÇôßÞ?ƒÎA#e¿ÔÀEݽ’j?9´Èv¾Ÿz?bÏ%ÁÀh¿ÔÀEݽ’j?¾ÇôßÞ?bÏ%ÁÀh¿Oß|4æ¿q?9´Èv¾Ÿz?Àß7דmn¿Oß|4æ¿q?¾ÇôßÞ?Àß7דmn¿H ¹¢)v?9´Èv¾Ÿz?Ûù~j¼ts¿H ¹¢)v?¾ÇôßÞ?Ûù~j¼ts¿§ÉŒ·•^{?9´Èv¾Ÿz?jSŽ, º|¿PŒ,™cy?9´Èv¾Ÿz?g@ƒn«0x¿PŒ,™cy?¾ÇôßÞ?g@ƒn«0x¿§ÉŒ·•^{?¾ÇôßÞ?jSŽ, º|¿ö$U€”}|?9´Èv¾Ÿz?®Óí‘rœ€¿ö$U€”}|?¾ÇôßÞ?®Óí‘rœ€¿9šD9¨/Q¿9´Èv¾Ÿz?Wñ¡Ÿ‘¿9šD9¨/Q¿¾ÇôßÞ?Wñ¡Ÿ‘¿eÛ²a¿9´Èv¾Ÿz?òÑâŒaN¿eÛ²a¿¾ÇôßÞ?òÑâŒaN¿ÔÀEݽ’j¿9´Èv¾Ÿz?¾ñZ®#³¿ÔÀEݽ’j¿¾ÇôßÞ?¾ñZ®#³¿Oß|4æ¿q¿9´Èv¾Ÿz?š(£éGŽ¿Oß|4æ¿q¿¾ÇôßÞ?š(£éGŽ¿H ¹¢)v¿9´Èv¾Ÿz?)\Âõ(Œ¿H ¹¢)v¿¾ÇôßÞ?)\Âõ(Œ¿§ÉŒ·•^{¿9´Èv¾Ÿz?øä¼ZI†‡¿PŒ,™cy¿9´Èv¾Ÿz?ÀJôèüʉ¿PŒ,™cy¿¾ÇôßÞ?ÀJôèüʉ¿§ÉŒ·•^{¿¾ÇôßÞ?øä¼ZI†‡¿ö$U€”}|¿9´Èv¾Ÿz?¸çùÓF…¿ö$U€”}|¿¾ÇôßÞ?¸çùÓF…¿ ƒ‡iß|¿9´Èv¾Ÿz?‹lçû©ñ‚¿ ƒ‡iß|¿¾ÇôßÞ?‹lçû©ñ‚¿9šD9¨/Q¿9´Èv¾Ÿz?£Ù+â*c¿9šD9¨/Q¿¾ÇôßÞ?£Ù+â*c¿eÛ²a¿9´Èv¾Ÿz?ƒÎA#e¿eÛ²a¿¾ÇôßÞ?ƒÎA#e¿ÔÀEݽ’j¿9´Èv¾Ÿz?bÏ%ÁÀh¿ÔÀEݽ’j¿¾ÇôßÞ?bÏ%ÁÀh¿Oß|4æ¿q¿9´Èv¾Ÿz?Àß7דmn¿Oß|4æ¿q¿¾ÇôßÞ?Àß7דmn¿H ¹¢)v¿9´Èv¾Ÿz?Ûù~j¼ts¿H ¹¢)v¿¾ÇôßÞ?Ûù~j¼ts¿PŒ,™cy¿9´Èv¾Ÿz?g@ƒn«0x¿§ÉŒ·•^{¿9´Èv¾Ÿz?jSŽ, º|¿§ÉŒ·•^{¿¾ÇôßÞ?jSŽ, º|¿PŒ,™cy¿¾ÇôßÞ?g@ƒn«0x¿ö$U€”}|¿9´Èv¾Ÿz?®Óí‘rœ€¿ö$U€”}|¿¾ÇôßÞ?®Óí‘rœ€¿7qÍx¶¢ˆ¿¸…ëQ¸~¿;ßO—nb?q Ä -‚¿¸…ëQ¸~¿;ßO—nb?ò{›þìGš?¸…ëQ¸~¿¹‚·Q®:|¿ÜA‘“.¢š?¸…ëQ¸~¿‹lçû©ñ‚¿óUò±»@™?¸…ëQ¸~¿eÀ/`s¿’>¢—?¸…ëQ¸~¿bSÄÖ"h¿ìßPS&•?¸…ëQ¸~¿à8Bi¨[¿ÃcÒß“?¸…ëQ¸~¿eÎéh¾O¿6¦Ìr~/’?¸…ëQ¸~¿ \³·W0¿/œß. Œ?¸…ëQ¸~¿Å -èðV?Í(LÎ??¸…ëQ¸~¿?lm -ùÚB?ŸnEɧŒ¿¸…ëQ¸~¿Öß—ª”¿¾·ŽS¿¸…ëQ¸~¿ÇãXÍ)·“¿ò{›þìGš¿¸…ëQ¸~¿ºóÎüŇ¿ÜA‘“.¢š¿¸…ëQ¸~¿‹lçû©ñ‚¿óUò±»@™¿¸…ëQ¸~¿d˜nm<3Œ¿’>¢—¿¸…ëQ¸~¿>„§FžÚ¿ìßPS&•¿¸…ëQ¸~¿2®¸8*7‘¿ ù g³ê“¿¸…ëQ¸~¿ÎÉæ3’¿6¦Ìr~/’¿¸…ëQ¸~¿Íà”^@Ô’¿q Ä -‚?¸…ëQ¸~¿;ßO—nb?7qÍx¶¢ˆ?¸…ëQ¸~¿;ßO—nb?e®gc€O?ª4{@Ó:?RAÊ™‡¿u¸B³FH?1àv²å¦G?7}ØÁ‡¿î ?±®<?F‹}TN?°Ÿþ³æ‡¿†x¥Þ³« ?ŽPž?ŽbP?ˆîþö‡¿†x¥Þ³« ?¸…ëQ¸~¿ã¥›Ä °’¿»«G¯@ÓV?¸…ëQ¸~¿ÈÒŦ•’¿*¶"f?¸…ëQ¸~¿×4ï8EG’¿ç}Ò?w8p?¸…ëQ¸~¿ˆÄ˜O±Å‘¿Ð賨ô¸t?¸…ëQ¸~¿wTë³¹ ‘¿ç“¼Çy?¸…ëQ¸~¿D9,hµ¿‰ÅÚ¥.•~?¸…ëQ¸~¿Až]¾õa¿G÷½—?¸…ëQ¸~¿‡¾»•%Š¿ˆkA0‚?¸…ëQ¸~¿ØG§®|†¿Ïõ}8Hˆ‚?¸…ëQ¸~¿‹lçû©ñ‚¿6¦Ìr~/’?¸…ëQ¸~¿Íà”^@Ô’¿¾·ŽS?¸…ëQ¸~¿ÇãXÍ)·“¿>æ¨H*ø‚?¸…ëQ¸~¿*¶8ù–¿H)2„#ˆ?¸…ëQ¸~¿˜Âƒf×½•¿ŸnEɧŒ?¸…ëQ¸~¿Öß—ª”¿»«G¯@ÓV?¸…ëQ¸~¿Ÿ¸5Láÿ6¿†x¥Þ³« ?¸…ëQ¸~¿ü©ñÒMb0¿*¶"f?¸…ëQ¸~¿¼µ§?VKE¿ç}Ò?w8p?¸…ëQ¸~¿ó,”Žj¿R¿Ð賨ô¸t?¸…ëQ¸~¿ÆKÜÏÎ]¿ç“¼Çy?¸…ëQ¸~¿ -¸J$¯f¿G÷½—?¸…ëQ¸~¿£ x|{w¿‰ÅÚ¥.•~?¸…ëQ¸~¿ïÚïš¡q¿ˆkA0‚?¸…ëQ¸~¿!¡JÍ~¿¾¼¥Avƒ•?ü©ñÒMb`?‹lçû©ñ‚¿”N$˜jf•?ü©ñÒMb`?®œ½3Úª„¿Ç&žXL•?ü©ñÒMb`?qй6¯E†¿?Ñ+T퉔?ü©ñÒMb`?>u¬Rz¦‡¿)Ø5Ù“?ü©ñÒMb`?»ƒ3Sµˆ¿Ïç’``“?ü©ñÒMb`?+ÕªZ_‰¿6¦Ìr~/’?ü©ñÒMb`?š™™™™™‰¿@vÍšS‘?ü©ñÒMb`?¥ -²_‰¿ó`‹‚…?ü©ñÒMb`?mŠÇEµˆ¿üê`³©?ü©ñÒMb`?ài2ãm¥‡¿°BF›Ž?ü©ñÒMb`?VèÍò†E†¿S®ð.ñ?ü©ñÒMb`? IFª„¿^çG ·?ü©ñÒMb`?‹lçû©ñ‚¿”N$˜jf•?¸…ëQ¸~¿®œ½3Úª„¿¾¼¥Avƒ•?¸…ëQ¸~¿‹lçû©ñ‚¿Ç&žXL•?¸…ëQ¸~¿qй6¯E†¿?Ñ+T퉔?¸…ëQ¸~¿>u¬Rz¦‡¿)Ø5Ù“?¸…ëQ¸~¿»ƒ3Sµˆ¿Ïç’``“?¸…ëQ¸~¿+ÕªZ_‰¿6¦Ìr~/’?¸…ëQ¸~¿š™™™™™‰¿@vÍšS‘?¸…ëQ¸~¿¥ -²_‰¿ó`‹‚…?¸…ëQ¸~¿mŠÇEµˆ¿üê`³©?¸…ëQ¸~¿ài2ãm¥‡¿°BF›Ž?¸…ëQ¸~¿VèÍò†E†¿S®ð.ñ?¸…ëQ¸~¿ IFª„¿^çG ·?¸…ëQ¸~¿‹lçû©ñ‚¿”N$˜jf•?ü©ñÒMb`?h<Äy8¿Ç&žXL•?ü©ñÒMb`?L*‚I;¿?Ñ+T퉔?ü©ñÒMb`?ó,Rr˜y|¿)Ø5Ù“?ü©ñÒMb`?<–ˆ\z¿Ïç’``“?ü©ñÒMb`?×Hêóy¿6¦Ìr~/’?ü©ñÒMb`?ú~j¼t“x¿@vÍšS‘?ü©ñÒMb`?è|€y¿ó`‹‚…?ü©ñÒMb`?ÔÖˆ`\z¿üê`³©?ü©ñÒMb`?±CFQ±{|¿°BF›Ž?ü©ñÒMb`?õ(ž«”;¿S®ð.ñ?ü©ñÒMb`?vÇg 9¿”N$˜jf•?¸…ëQ¸~¿h<Äy8¿Ç&žXL•?¸…ëQ¸~¿L*‚I;¿?Ñ+T퉔?¸…ëQ¸~¿ó,Rr˜y|¿)Ø5Ù“?¸…ëQ¸~¿<–ˆ\z¿Ïç’``“?¸…ëQ¸~¿×Hêóy¿6¦Ìr~/’?¸…ëQ¸~¿ú~j¼t“x¿@vÍšS‘?¸…ëQ¸~¿è|€y¿ó`‹‚…?¸…ëQ¸~¿ÔÖˆ`\z¿üê`³©?¸…ëQ¸~¿±CFQ±{|¿°BF›Ž?¸…ëQ¸~¿õ(ž«”;¿S®ð.ñ?¸…ëQ¸~¿vÇg 9¿e®gc€O¿ª4{@Ó:?RAÊ™‡¿u¸B³FH¿1àv²å¦G?7}ØÁ‡¿î ?±®<¿F‹}TN?°Ÿþ³æ‡¿»«G¯@ÓV¿¸…ëQ¸~¿ÈÒŦ•’¿*¶"f¿¸…ëQ¸~¿×4ï8EG’¿ç}Ò?w8p¿¸…ëQ¸~¿ˆÄ˜O±Å‘¿Ð賨ô¸t¿¸…ëQ¸~¿wTë³¹ ‘¿ç“¼Çy¿¸…ëQ¸~¿D9,hµ¿G÷½—¿¸…ëQ¸~¿‡¾»•%Š¿‰ÅÚ¥.•~¿¸…ëQ¸~¿Až]¾õa¿ˆkA0‚¿¸…ëQ¸~¿ØG§®|†¿Ïõ}8Hˆ‚¿¸…ëQ¸~¿‹lçû©ñ‚¿>æ¨H*ø‚¿¸…ëQ¸~¿*¶8ù–¿H)2„#ˆ¿¸…ëQ¸~¿˜Âƒf×½•¿»«G¯@ÓV¿¸…ëQ¸~¿Ÿ¸5Láÿ6¿*¶"f¿¸…ëQ¸~¿¼µ§?VKE¿ç}Ò?w8p¿¸…ëQ¸~¿ó,”Žj¿R¿Ð賨ô¸t¿¸…ëQ¸~¿ÆKÜÏÎ]¿ç“¼Çy¿¸…ëQ¸~¿ -¸J$¯f¿‰ÅÚ¥.•~¿¸…ëQ¸~¿ïÚïš¡q¿G÷½—¿¸…ëQ¸~¿£ x|{w¿ˆkA0‚¿¸…ëQ¸~¿!¡JÍ~¿”N$˜jf•¿ü©ñÒMb`?®œ½3Úª„¿¾¼¥Avƒ•¿ü©ñÒMb`?‹lçû©ñ‚¿Ç&žXL•¿ü©ñÒMb`?qй6¯E†¿?Ñ+T퉔¿ü©ñÒMb`?>u¬Rz¦‡¿)Ø5Ù“¿ü©ñÒMb`?»ƒ3Sµˆ¿Ïç’``“¿ü©ñÒMb`?+ÕªZ_‰¿6¦Ìr~/’¿ü©ñÒMb`?š™™™™™‰¿@vÍšS‘¿ü©ñÒMb`?¥ -²_‰¿ó`‹‚…¿ü©ñÒMb`?mŠÇEµˆ¿üê`³©¿ü©ñÒMb`?ài2ãm¥‡¿°BF›Ž¿ü©ñÒMb`?VèÍò†E†¿S®ð.ñ¿ü©ñÒMb`? IFª„¿^çG ·¿ü©ñÒMb`?‹lçû©ñ‚¿¾¼¥Avƒ•¿¸…ëQ¸~¿‹lçû©ñ‚¿”N$˜jf•¿¸…ëQ¸~¿®œ½3Úª„¿Ç&žXL•¿¸…ëQ¸~¿qй6¯E†¿?Ñ+T퉔¿¸…ëQ¸~¿>u¬Rz¦‡¿)Ø5Ù“¿¸…ëQ¸~¿»ƒ3Sµˆ¿Ïç’``“¿¸…ëQ¸~¿+ÕªZ_‰¿6¦Ìr~/’¿¸…ëQ¸~¿š™™™™™‰¿@vÍšS‘¿¸…ëQ¸~¿¥ -²_‰¿ó`‹‚…¿¸…ëQ¸~¿mŠÇEµˆ¿üê`³©¿¸…ëQ¸~¿ài2ãm¥‡¿°BF›Ž¿¸…ëQ¸~¿VèÍò†E†¿S®ð.ñ¿¸…ëQ¸~¿ IFª„¿^çG ·¿¸…ëQ¸~¿‹lçû©ñ‚¿”N$˜jf•¿ü©ñÒMb`?h<Äy8¿Ç&žXL•¿ü©ñÒMb`?L*‚I;¿?Ñ+T퉔¿ü©ñÒMb`?ó,Rr˜y|¿)Ø5Ù“¿ü©ñÒMb`?<–ˆ\z¿Ïç’``“¿ü©ñÒMb`?×Hêóy¿6¦Ìr~/’¿ü©ñÒMb`?ú~j¼t“x¿@vÍšS‘¿ü©ñÒMb`?è|€y¿ó`‹‚…¿ü©ñÒMb`?ÔÖˆ`\z¿üê`³©¿ü©ñÒMb`?±CFQ±{|¿°BF›Ž¿ü©ñÒMb`?õ(ž«”;¿S®ð.ñ¿ü©ñÒMb`?vÇg 9¿”N$˜jf•¿¸…ëQ¸~¿h<Äy8¿Ç&žXL•¿¸…ëQ¸~¿L*‚I;¿?Ñ+T퉔¿¸…ëQ¸~¿ó,Rr˜y|¿)Ø5Ù“¿¸…ëQ¸~¿<–ˆ\z¿Ïç’``“¿¸…ëQ¸~¿×Hêóy¿6¦Ìr~/’¿¸…ëQ¸~¿ú~j¼t“x¿@vÍšS‘¿¸…ëQ¸~¿è|€y¿ó`‹‚…¿¸…ëQ¸~¿ÔÖˆ`\z¿üê`³©¿¸…ëQ¸~¿±CFQ±{|¿°BF›Ž¿¸…ëQ¸~¿õ(ž«”;¿S®ð.ñ¿¸…ëQ¸~¿vÇg 9¿6¦Ìr~/’¿¸…ëQ¸~¿ \³·W0¿Í(LÎ?¿¸…ëQ¸~¿?lm -ùÚB?/œß. Œ¿¸…ëQ¸~¿Å -èðV?ò{›þìGš?¸…ëQ¸~¿ºóÎüŇ¿óUò±»@™?¸…ëQ¸~¿d˜nm<3Œ¿’>¢—?¸…ëQ¸~¿>„§FžÚ¿ìßPS&•?¸…ëQ¸~¿2®¸8*7‘¿ ù g³ê“?¸…ëQ¸~¿ÎÉæ3’¿ò{›þìGš¿¸…ëQ¸~¿¹‚·Q®:|¿óUò±»@™¿¸…ëQ¸~¿eÀ/`s¿’>¢—¿¸…ëQ¸~¿bSÄÖ"h¿ìßPS&•¿¸…ëQ¸~¿à8Bi¨[¿ÃcÒß“¿¸…ëQ¸~¿eÎéh¾O¿9šD9¨/Q?‚±ýR¼)\Âõ(Œ¿è˜ûýÅàO?C¢·N9?)\Âõ(Œ¿Ð4ö_ÆH?l �°•+G?)\Âõ(Œ¿q?tÑI<?n¸U1FN?)\Âõ(Œ¿†x¥Þ³« ?ü©ñÒMbP?)\Âõ(Œ¿è˜ûýÅàO?C¢·N9¿)\Âõ(Œ¿Ð4ö_ÆH?l �°•+G¿)\Âõ(Œ¿q?tÑI<?n¸U1FN¿)\Âõ(Œ¿†x¥Þ³« ?ü©ñÒMbP¿)\Âõ(Œ¿6¦Ìr~/’?ü©ñÒMb`?Íà”^@Ô’¿¾·ŽS?ü©ñÒMb`?ÇãXÍ)·“¿>æ¨H*ø‚?ü©ñÒMb`?*¶8ù–¿H)2„#ˆ?ü©ñÒMb`?˜Âƒf×½•¿ŸnEɧŒ?ü©ñÒMb`?Öß—ª”¿ÜA‘“.¢š?ü©ñÒMb`?‹lçû©ñ‚¿ò{›þìGš?ü©ñÒMb`?ºóÎüŇ¿óUò±»@™?ü©ñÒMb`?d˜nm<3Œ¿’>¢—?ü©ñÒMb`?>„§FžÚ¿ìßPS&•?ü©ñÒMb`?2®¸8*7‘¿ ù g³ê“?ü©ñÒMb`?ÎÉæ3’¿ò{›þìGš?ü©ñÒMb`?¹‚·Q®:|¿óUò±»@™?ü©ñÒMb`?eÀ/`s¿’>¢—?ü©ñÒMb`?bSÄÖ"h¿ìßPS&•?ü©ñÒMb`?à8Bi¨[¿ÃcÒß“?ü©ñÒMb`?eÎéh¾O¿6¦Ìr~/’?ü©ñÒMb`? \³·W0¿Í(LÎ??ü©ñÒMb`??lm -ùÚB?q Ä -‚?ü©ñÒMb`?;ßO—nb?7qÍx¶¢ˆ?ü©ñÒMb`?;ßO—nb?/œß. Œ?ü©ñÒMb`?Å -èðV?è˜ûýÅàO¿C¢·N9?)\Âõ(Œ¿9šD9¨/Q¿‚±ýR¼)\Âõ(Œ¿Ð4ö_ÆH¿l �°•+G?)\Âõ(Œ¿q?tÑI<¿n¸U1FN?)\Âõ(Œ¿è˜ûýÅàO¿C¢·N9¿)\Âõ(Œ¿Ð4ö_ÆH¿l �°•+G¿)\Âõ(Œ¿q?tÑI<¿n¸U1FN¿)\Âõ(Œ¿¾·ŽS¿ü©ñÒMb`?ÇãXÍ)·“¿6¦Ìr~/’¿ü©ñÒMb`?Íà”^@Ô’¿>æ¨H*ø‚¿ü©ñÒMb`?*¶8ù–¿H)2„#ˆ¿ü©ñÒMb`?˜Âƒf×½•¿ŸnEɧŒ¿ü©ñÒMb`?Öß—ª”¿ò{›þìGš¿ü©ñÒMb`?ºóÎüŇ¿ÜA‘“.¢š¿ü©ñÒMb`?‹lçû©ñ‚¿óUò±»@™¿ü©ñÒMb`?d˜nm<3Œ¿’>¢—¿ü©ñÒMb`?>„§FžÚ¿ìßPS&•¿ü©ñÒMb`?2®¸8*7‘¿ ù g³ê“¿ü©ñÒMb`?ÎÉæ3’¿ò{›þìGš¿ü©ñÒMb`?¹‚·Q®:|¿óUò±»@™¿ü©ñÒMb`?eÀ/`s¿’>¢—¿ü©ñÒMb`?bSÄÖ"h¿ìßPS&•¿ü©ñÒMb`?à8Bi¨[¿ÃcÒß“¿ü©ñÒMb`?eÎéh¾O¿6¦Ìr~/’¿ü©ñÒMb`? \³·W0¿Í(LÎ?¿ü©ñÒMb`??lm -ùÚB?q Ä -‚¿ü©ñÒMb`?;ßO—nb?/œß. Œ¿ü©ñÒMb`?Å -èðV?7qÍx¶¢ˆ¿ü©ñÒMb`?;ßO—nb?ÀÜ8sY–i?)\Âõ(œ¿)\Âõ(Œ¿£(ȶ© p?)\Âõ(œ¿×¢h[ÍŠ¿H…5¾Ä’q?)\Âõ(œ¿ð ~¼ü󉿣(ȶ© p?)\Âõ(œ¿ÂÑŸGÖ+v¿ÀÜ8sY–i?)\Âõ(œ¿Ûù~j¼ts¿H…5¾Ä’q?)\Âõ(œ¿5ÿع£Þw¿£(ȶ© p¿)\Âõ(œ¿×¢h[ÍŠ¿ÀÜ8sY–i¿)\Âõ(œ¿)\Âõ(Œ¿H…5¾Ä’q¿)\Âõ(œ¿ð ~¼üó‰¿ÀÜ8sY–i¿)\Âõ(œ¿Ûù~j¼ts¿£(ȶ© p¿)\Âõ(œ¿ÂÑŸGÖ+v¿H…5¾Ä’q¿)\Âõ(œ¿5ÿع£Þw¿9šD9¨/Q?'Ê1›øq?R¸…ëQ˜¿†x¥Þ³« ?;ßO—nr?R¸…ëQ˜¿†x¥Þ³« ?¸…ëQ¸~?R¸…ëQ˜¿4×ÌÎ`[X?¸…ëQ¸~?R¸…ëQ˜¿pµ@¼a?ÑE\cDp?R¸…ëQ˜¿Kxh²Úg?¸…ëQ¸~?R¸…ëQ˜¿ÝésZ\ˆj?¥ŽDw�j?R¸…ëQ˜¿ÓY„oPq?¸…ëQ¸~?R¸…ëQ˜¿c¬ãø¡r?gæNVɤȼR¸…ëQ˜¿I˜Bår?kÜ´|ÑÜR?R¸…ëQ˜¿mHíA8p?mÏ$˜<b?R¸…ëQ˜¿VèÍò†Ev?¸…ëQ¸~?R¸…ëQ˜¿9´Èv¾Ÿz?¬” -{¢ø<R¸…ëQ˜¿9´Èv¾Ÿz?ÙÎ÷Sã¥k?R¸…ëQ˜¿9´Èv¾Ÿz?Ûù~j¼ts?R¸…ëQ˜¿9´Èv¾Ÿz?J+‡y?R¸…ëQ˜¿†x¥Þ³« ?;ßO—nr¿R¸…ëQ˜¿9šD9¨/Q?'Ê1›øq¿R¸…ëQ˜¿pµ@¼a?ÑE\cDp¿R¸…ëQ˜¿ÝésZ\ˆj?¥ŽDw�j¿R¸…ëQ˜¿I˜Bår?kÜ´|ÑÜR¿R¸…ëQ˜¿mHíA8p?mÏ$˜<b¿R¸…ëQ˜¿9´Èv¾Ÿz?ü©ñÒMb`¿R¸…ëQ˜¿9´Èv¾Ÿz?ÙÎ÷Sã¥k¿R¸…ëQ˜¿9´Èv¾Ÿz?Ûù~j¼ts¿R¸…ëQ˜¿9´Èv¾Ÿz?J+‡y¿R¸…ëQ˜¿†x¥Þ³« ?ìQ¸…ë‘¿ã¥›Ä °’¿»«G¯@ÓV?ìQ¸…ë‘¿ÈÒŦ•’¿*¶"f?ìQ¸…ë‘¿×4ï8EG’¿ç}Ò?w8p?ìQ¸…ë‘¿ˆÄ˜O±Å‘¿Ð賨ô¸t?ìQ¸…ë‘¿wTë³¹ ‘¿ç“¼Çy?ìQ¸…ë‘¿D9,hµ¿‰ÅÚ¥.•~?ìQ¸…ë‘¿Až]¾õa¿G÷½—?ìQ¸…ë‘¿‡¾»•%Š¿ˆkA0‚?ìQ¸…ë‘¿ØG§®|†¿Ïõ}8Hˆ‚?ìQ¸…ë‘¿‹lçû©ñ‚¿9šD9¨/Q?)\Âõ(œ¿µ¯2d†‡¿9¨‚‘« ?)\Âõ(œ¿gÕçj+ö‡¿ìÃy›/]?)\Âõ(œ¿<f 2þ}†¿çB¼à™ñb?)\Âõ(œ¿3Y’òIÝ„¿+ï²xd?)\Âõ(œ¿‹lçû©ñ‚¿dNáRßCs?)\Âõ(œ¿öü Àˆ¿ö¼4¨ªŽt?)\Âõ(œ¿øä¼ZI†‡¿í–‰Çêûu?)\Âõ(œ¿ßLLb…¿\>’’†v?)\Âõ(œ¿‹lçû©ñ‚¿†x¥Þ³« ?)\Âõ(œ¿%ušŽ¿Yh)QÝùQ?)\Âõ(œ¿ýˤ<©å¿"€åR¦â`?)\Âõ(œ¿Sè¼Æ.Q¿_vôd£X? -×£p= -—?õþõÀ}Ó’¿†x¥Þ³« ? -×£p= -—?‹lçû©ñ’¿÷_!Rg? -×£p= -—?£)–¶€’¿nä²ú¸p? -×£p= -—?F$ --ëþ‘¿#ÆÆH«u? -×£p= -—?³déžÐF‘¿¦ -F%uz? -×£p= -—?†è8h¿ö–r¾Ø{? -×£p= -—?ýD - -(yŠ¿¿YïÜ ? -×£p= -—?ÓNï⿹röÎh«‚? -×£p= -—?<Û¤¢±†¿ƒ§Zƒ? -×£p= -—?‹lçû©ñ‚¿e®gc€O?ª4{@Ó:¿RAÊ™‡¿u¸B³FH?1àv²å¦G¿7}ØÁ‡¿î ?±®<?F‹}TN¿°Ÿþ³æ‡¿†x¥Þ³« ?ŽPž?ŽbP¿ˆîþö‡¿öOŸ†X?¸…ëQ¸~?;ßO—nb?†x¥Þ³« ?¸…ëQ¸~?;ßO—nb?Kxh²Úg?¸…ëQ¸~?;ßO—nb?ÓY„oPq?¸…ëQ¸~?;ßO—nb?VèÍò†Ev?¸…ëQ¸~?;ßO—nb?9´Èv¾Ÿz?ÙÎ÷Sã¥k?;ßO—nb?9´Èv¾Ÿz?Ûù~j¼ts?;ßO—nb?9´Èv¾Ÿz?J+‡y?;ßO—nb?»«G¯@ÓV?ìQ¸…ë‘¿Ÿ¸5Láÿ6¿†x¥Þ³« ?ìQ¸…ë‘¿ü©ñÒMb0¿*¶"f?ìQ¸…ë‘¿¼µ§?VKE¿ç}Ò?w8p?ìQ¸…ë‘¿ó,”Žj¿R¿Ð賨ô¸t?ìQ¸…ë‘¿ÆKÜÏÎ]¿ç“¼Çy?ìQ¸…ë‘¿ -¸J$¯f¿G÷½—?ìQ¸…ë‘¿£ x|{w¿‰ÅÚ¥.•~?ìQ¸…ë‘¿ïÚïš¡q¿ˆkA0‚?ìQ¸…ë‘¿!¡JÍ~¿9¨‚‘« ?)\Âõ(œ¿_ÎQÚ{¿9šD9¨/Q?)\Âõ(œ¿Ã²>Šß¹|¿ìÃy›/]?)\Âõ(œ¿´å\Š«Ê~¿çB¼à™ñb?)\Âõ(œ¿À‘£¿ö¼4¨ªŽt?)\Âõ(œ¿jSŽ, º|¿dNáRßCs?)\Âõ(œ¿B¸]ÃgFz¿í–‰Çêûu?)\Âõ(œ¿jù«<€¿Yh)QÝùQ?)\Âõ(œ¿ª™µöo¿†x¥Þ³« ?)\Âõ(œ¿Å1w-!o¿"€åR¦â`?)\Âõ(œ¿·Ã²Û_$q¿†x¥Þ³« ? -×£p= -—?��������_vôd£X? -×£p= -—?ÑA—pè-¿÷_!Rg? -×£p= -—? m÷ze<¿nä²ú¸p? -×£p= -—?i,ÉlVN¿#ÆÆH«u? -×£p= -—?„}àÏ•Z¿¦ -F%uz? -×£p= -—?. ´¾Ld¿¿YïÜ ? -×£p= -—?Êí¨{®�p¿ö–r¾Ø{? -×£p= -—?2(‰ÛWÔv¿¹röÎh«‚? -×£p= -—?¶…ç¥bc~¿9šD9¨/Q¿'Ê1›øq?R¸…ëQ˜¿4×ÌÎ`[X¿¸…ëQ¸~?R¸…ëQ˜¿pµ@¼a¿ÑE\cDp?R¸…ëQ˜¿Kxh²Úg¿¸…ëQ¸~?R¸…ëQ˜¿ÝésZ\ˆj¿¥ŽDw�j?R¸…ëQ˜¿ÓY„oPq¿¸…ëQ¸~?R¸…ëQ˜¿I˜Bår¿kÜ´|ÑÜR?R¸…ëQ˜¿c¬ãø¡r¿gæNVɤȼR¸…ëQ˜¿mHíA8p¿mÏ$˜<b?R¸…ëQ˜¿VèÍò†Ev¿¸…ëQ¸~?R¸…ëQ˜¿9´Èv¾Ÿz¿¬” -{¢ø<R¸…ëQ˜¿9´Èv¾Ÿz¿ÙÎ÷Sã¥k?R¸…ëQ˜¿9´Èv¾Ÿz¿Ûù~j¼ts?R¸…ëQ˜¿9´Èv¾Ÿz¿J+‡y?R¸…ëQ˜¿9šD9¨/Q¿'Ê1›øq¿R¸…ëQ˜¿pµ@¼a¿ÑE\cDp¿R¸…ëQ˜¿ÝésZ\ˆj¿¥ŽDw�j¿R¸…ëQ˜¿I˜Bår¿kÜ´|ÑÜR¿R¸…ëQ˜¿mHíA8p¿mÏ$˜<b¿R¸…ëQ˜¿9´Èv¾Ÿz¿ü©ñÒMb`¿R¸…ëQ˜¿9´Èv¾Ÿz¿ÙÎ÷Sã¥k¿R¸…ëQ˜¿9´Èv¾Ÿz¿Ûù~j¼ts¿R¸…ëQ˜¿9´Èv¾Ÿz¿J+‡y¿R¸…ëQ˜¿»«G¯@ÓV¿ìQ¸…ë‘¿ÈÒŦ•’¿*¶"f¿ìQ¸…ë‘¿×4ï8EG’¿ç}Ò?w8p¿ìQ¸…ë‘¿ˆÄ˜O±Å‘¿Ð賨ô¸t¿ìQ¸…ë‘¿wTë³¹ ‘¿ç“¼Çy¿ìQ¸…ë‘¿D9,hµ¿G÷½—¿ìQ¸…ë‘¿‡¾»•%Š¿‰ÅÚ¥.•~¿ìQ¸…ë‘¿Až]¾õa¿ˆkA0‚¿ìQ¸…ë‘¿ØG§®|†¿Ïõ}8Hˆ‚¿ìQ¸…ë‘¿‹lçû©ñ‚¿9šD9¨/Q¿)\Âõ(œ¿µ¯2d†‡¿ìÃy›/]¿)\Âõ(œ¿<f 2þ}†¿çB¼à™ñb¿)\Âõ(œ¿3Y’òIÝ„¿+ï²xd¿)\Âõ(œ¿‹lçû©ñ‚¿ö¼4¨ªŽt¿)\Âõ(œ¿øä¼ZI†‡¿dNáRßCs¿)\Âõ(œ¿öü Àˆ¿í–‰Çêûu¿)\Âõ(œ¿ßLLb…¿\>’’†v¿)\Âõ(œ¿‹lçû©ñ‚¿Yh)QÝùQ¿)\Âõ(œ¿ýˤ<©å¿"€åR¦â`¿)\Âõ(œ¿Sè¼Æ.Q¿_vôd£X¿ -×£p= -—?õþõÀ}Ó’¿÷_!Rg¿ -×£p= -—?£)–¶€’¿nä²ú¸p¿ -×£p= -—?F$ --ëþ‘¿#ÆÆH«u¿ -×£p= -—?³déžÐF‘¿¦ -F%uz¿ -×£p= -—?†è8h¿¿YïÜ ¿ -×£p= -—?ÓNïâ¿ö–r¾Ø{¿ -×£p= -—?ýD - -(yŠ¿¹röÎh«‚¿ -×£p= -—?<Û¤¢±†¿ƒ§Zƒ¿ -×£p= -—?‹lçû©ñ‚¿e®gc€O¿ª4{@Ó:¿RAÊ™‡¿u¸B³FH¿1àv²å¦G¿7}ØÁ‡¿î ?±®<¿F‹}TN¿°Ÿþ³æ‡¿öOŸ†X¿¸…ëQ¸~?;ßO—nb?Kxh²Úg¿¸…ëQ¸~?;ßO—nb?ÓY„oPq¿¸…ëQ¸~?;ßO—nb?VèÍò†Ev¿¸…ëQ¸~?;ßO—nb?9´Èv¾Ÿz¿ÙÎ÷Sã¥k?;ßO—nb?9´Èv¾Ÿz¿Ûù~j¼ts?;ßO—nb?9´Èv¾Ÿz¿J+‡y?;ßO—nb?»«G¯@ÓV¿ìQ¸…ë‘¿Ÿ¸5Láÿ6¿*¶"f¿ìQ¸…ë‘¿¼µ§?VKE¿ç}Ò?w8p¿ìQ¸…ë‘¿ó,”Žj¿R¿Ð賨ô¸t¿ìQ¸…ë‘¿ÆKÜÏÎ]¿ç“¼Çy¿ìQ¸…ë‘¿ -¸J$¯f¿‰ÅÚ¥.•~¿ìQ¸…ë‘¿ïÚïš¡q¿G÷½—¿ìQ¸…ë‘¿£ x|{w¿ˆkA0‚¿ìQ¸…ë‘¿!¡JÍ~¿9šD9¨/Q¿)\Âõ(œ¿Ã²>Šß¹|¿ìÃy›/]¿)\Âõ(œ¿´å\Š«Ê~¿çB¼à™ñb¿)\Âõ(œ¿À‘£¿dNáRßCs¿)\Âõ(œ¿B¸]ÃgFz¿ö¼4¨ªŽt¿)\Âõ(œ¿jSŽ, º|¿í–‰Çêûu¿)\Âõ(œ¿jù«<€¿Yh)QÝùQ¿)\Âõ(œ¿ª™µöo¿"€åR¦â`¿)\Âõ(œ¿·Ã²Û_$q¿_vôd£X¿ -×£p= -—?ÑA—pè-¿÷_!Rg¿ -×£p= -—? m÷ze<¿nä²ú¸p¿ -×£p= -—?i,ÉlVN¿#ÆÆH«u¿ -×£p= -—?„}àÏ•Z¿¦ -F%uz¿ -×£p= -—?. ´¾Ld¿ö–r¾Ø{¿ -×£p= -—?2(‰ÛWÔv¿¿YïÜ ¿ -×£p= -—?Êí¨{®�p¿¹röÎh«‚¿ -×£p= -—?¶…ç¥bc~¿9´Èv¾Ÿz?¸…ëQ¸~?yf„â‡}4?9´Èv¾Ÿz¿¸…ëQ¸~?<rÿì¢C“¿9´Èv¾Ÿz¿¸…ëQ¸~? &áBÁ•¿9´Èv¾Ÿz?¸…ëQ¸~?<rÿì¢C“¿9´Èv¾Ÿz?¸…ëQ¸~? &áBÁ•¿9´Èv¾Ÿz¿¸…ëQ¸~?yf„â‡}4?çB¼à™ñb?9´Èv¾Ÿz?Õ™†<Ý„¿ìÃy›/]?9´Èv¾Ÿz?Þ§Æð}†¿+ï²xd?9´Èv¾Ÿz?‹lçû©ñ‚¿çB¼à™ñb¿9´Èv¾Ÿz?AÍ5q¿ìÃy›/]¿9´Èv¾Ÿz?+¤³ÃÊ~¿+ï²xd¿9´Èv¾Ÿz?‹lçû©ñ‚¿9šD9¨/Q?9´Èv¾Ÿz?øä¼ZI†‡¿†x¥Þ³« ?9´Èv¾Ÿz?ˆîþö‡¿†x¥Þ³« ?9´Èv¾Ÿz?¢ÀñkÚ{¿9šD9¨/Q?9´Èv¾Ÿz?jSŽ, º|¿ìÃy›/]?9´Èv¾Ÿz?+¤³ÃÊ~¿9šD9¨/Q¿9´Èv¾Ÿz?øä¼ZI†‡¿ìÃy›/]¿9´Èv¾Ÿz?Þ§Æð}†¿9šD9¨/Q¿9´Èv¾Ÿz?jSŽ, º|¿çB¼à™ñb?9´Èv¾Ÿz?AÍ5q¿çB¼à™ñb¿9´Èv¾Ÿz?Õ™†<Ý„¿Ã}äÖ¤Ûb?k¬/Ø.éo?)\Âõ(Œ¿^H‡‡0~j?TÀj¸ -j?)\Âõ(Œ¿^H‡‡0~j?TÀj¸ -j¿)\Âõ(Œ¿Ã}äÖ¤Ûb?k¬/Ø.éo¿)\Âõ(Œ¿^H‡‡0~j¿TÀj¸ -j?)\Âõ(Œ¿Ã}äÖ¤Ûb¿k¬/Ø.éo?)\Âõ(Œ¿Ã}äÖ¤Ûb¿k¬/Ø.éo¿)\Âõ(Œ¿^H‡‡0~j¿TÀj¸ -j¿)\Âõ(Œ¿Á¹Ð¦4¬ƒ?ü©ñÒMb`?ÂN±j憿¿D„„?ü©ñÒMb`?‹lçû©ñ‚¿îáÜpiF€?ü©ñÒMb`?6K�-§Ž¿9´Èv¾Ÿz?ü©ñÒMb`?f»B,c“¿9´Èv¾Ÿz?ü©ñÒMb`?6úâœ"Ñ•¿ª~¥óáY‚?ü©ñÒMb`?éþ ‰‹¿Á¹Ð¦4¬ƒ?ü©ñÒMb`?©;‡ú}¿îáÜpiF€?ü©ñÒMb`?7îÞ›ðl¿9´Èv¾Ÿz?ü©ñÒMb`? …ëîc<?ª~¥óáY‚?ü©ñÒMb`?ˆù Œ¯u¿¿D„„¿ü©ñÒMb`?‹lçû©ñ‚¿Á¹Ð¦4¬ƒ¿ü©ñÒMb`?ÂN±j憿îáÜpiF€¿ü©ñÒMb`?6K�-§Ž¿9´Èv¾Ÿz¿ü©ñÒMb`?f»B,c“¿9´Èv¾Ÿz¿ü©ñÒMb`?6úâœ"Ñ•¿ª~¥óáY‚¿ü©ñÒMb`?éþ ‰‹¿Á¹Ð¦4¬ƒ¿ü©ñÒMb`?©;‡ú}¿îáÜpiF€¿ü©ñÒMb`?7îÞ›ðl¿9´Èv¾Ÿz¿ü©ñÒMb`? …ëîc<?ª~¥óáY‚¿ü©ñÒMb`?ˆù Œ¯u¿$ûÖ=h,p?»„¿6Meb?)\Âõ(Œ¿$ûÖ=h,p?»„¿6Meb¿)\Âõ(Œ¿$ûÖ=h,p¿»„¿6Meb?)\Âõ(Œ¿$ûÖ=h,p¿»„¿6Meb¿)\Âõ(Œ¿9´Èv¾Ÿz?ÙÎ÷Sã¥k?ºp{Ý}é¿9´Èv¾Ÿz?Ûù~j¼ts?~[¸Ý¿9´Èv¾Ÿz?J+‡y?“>ÇìÑ¿Yh)QÝùQ?ìQ¸…ë‘¿ýˤ<©å¿†x¥Þ³« ?ìQ¸…ë‘¿%ušŽ¿"€åR¦â`?ìQ¸…ë‘¿Sè¼Æ.Q¿ÀÜ8sY–i?ìQ¸…ë‘¿)\Âõ(Œ¿£(ȶ© p?ìQ¸…ë‘¿×¢h[ÍŠ¿H…5¾Ä’q?ìQ¸…ë‘¿ð ~¼üó‰¿ö¼4¨ªŽt?ìQ¸…ë‘¿øä¼ZI†‡¿dNáRßCs?ìQ¸…ë‘¿öü Àˆ¿í–‰Çêûu?ìQ¸…ë‘¿ßLLb…¿\>’’†v?ìQ¸…ë‘¿‹lçû©ñ‚¿9´Èv¾Ÿz?ÙÎ÷Sã¥k?ÐCmFA`¿9´Èv¾Ÿz?Ûù~j¼ts?ÒšŸ`¿9´Èv¾Ÿz?J+‡y?ħJ¥éý`¿†x¥Þ³« ?ìQ¸…ë‘¿Å1w-!o¿Yh)QÝùQ?ìQ¸…ë‘¿ª™µöo¿"€åR¦â`?ìQ¸…ë‘¿·Ã²Û_$q¿ÀÜ8sY–i?ìQ¸…ë‘¿Ûù~j¼ts¿£(ȶ© p?ìQ¸…ë‘¿ÂÑŸGÖ+v¿H…5¾Ä’q?ìQ¸…ë‘¿5ÿع£Þw¿dNáRßCs?ìQ¸…ë‘¿B¸]ÃgFz¿ö¼4¨ªŽt?ìQ¸…ë‘¿jSŽ, º|¿í–‰Çêûu?ìQ¸…ë‘¿jù«<€¿9´Èv¾Ÿz¿ÙÎ÷Sã¥k?ºp{Ý}é¿9´Èv¾Ÿz¿Ûù~j¼ts?~[¸Ý¿9´Èv¾Ÿz¿J+‡y?“>ÇìÑ¿Yh)QÝùQ¿ìQ¸…ë‘¿ýˤ<©å¿"€åR¦â`¿ìQ¸…ë‘¿Sè¼Æ.Q¿ÀÜ8sY–i¿ìQ¸…ë‘¿)\Âõ(Œ¿£(ȶ© p¿ìQ¸…ë‘¿×¢h[ÍŠ¿H…5¾Ä’q¿ìQ¸…ë‘¿ð ~¼üó‰¿dNáRßCs¿ìQ¸…ë‘¿öü Àˆ¿ö¼4¨ªŽt¿ìQ¸…ë‘¿øä¼ZI†‡¿í–‰Çêûu¿ìQ¸…ë‘¿ßLLb…¿\>’’†v¿ìQ¸…ë‘¿‹lçû©ñ‚¿9´Èv¾Ÿz¿ÙÎ÷Sã¥k?ÐCmFA`¿9´Èv¾Ÿz¿Ûù~j¼ts?ÒšŸ`¿9´Èv¾Ÿz¿J+‡y?ħJ¥éý`¿Yh)QÝùQ¿ìQ¸…ë‘¿ª™µöo¿"€åR¦â`¿ìQ¸…ë‘¿·Ã²Û_$q¿ÀÜ8sY–i¿ìQ¸…ë‘¿Ûù~j¼ts¿£(ȶ© p¿ìQ¸…ë‘¿ÂÑŸGÖ+v¿H…5¾Ä’q¿ìQ¸…ë‘¿5ÿع£Þw¿ö¼4¨ªŽt¿ìQ¸…ë‘¿jSŽ, º|¿dNáRßCs¿ìQ¸…ë‘¿B¸]ÃgFz¿í–‰Çêûu¿ìQ¸…ë‘¿jù«<€¿¹(Äm~ r?ÌÞ„YR?)\Âõ(Œ¿c¬ãø¡r?‚±ýR¼)\Âõ(Œ¿†x¥Þ³« ?D]µ|nr?)\Âõ(Œ¿0¯+!XS?£Dd»ïÖq?)\Âõ(Œ¿¹(Äm~ r?ÌÞ„YR¿)\Âõ(Œ¿0¯+!XS?£Dd»ïÖq¿)\Âõ(Œ¿†x¥Þ³« ?D]µ|nr¿)\Âõ(Œ¿¹(Äm~ r¿ÌÞ„YR?)\Âõ(Œ¿c¬ãø¡r¿‚±ýR¼)\Âõ(Œ¿0¯+!XS¿£Dd»ïÖq?)\Âõ(Œ¿¹(Äm~ r¿ÌÞ„YR¿)\Âõ(Œ¿0¯+!XS¿£Dd»ïÖq¿)\Âõ(Œ¿†x¥Þ³« ?¸…ëQ¸~?CÖ •Q“¿öOŸ†X?¸…ëQ¸~? ‘cFÓ4“¿Kxh²Úg?¸…ëQ¸~?1XñBß’¿ÓY„oPq?¸…ëQ¸~?0nþº.W’¿VèÍò†Ev?¸…ëQ¸~?û ‘¿öOŸ†X?¸…ëQ¸~?{¤FyÊ0?†x¥Þ³« ?¸…ëQ¸~?ï—Éñù7?Kxh²Úg?¸…ëQ¸~?CÖU¬Úh¿ÓY„oPq?¸…ëQ¸~?wËhOC¿VèÍò†Ev?¸…ëQ¸~?vnÚŒÓU¿öOŸ†X¿¸…ëQ¸~? ‘cFÓ4“¿Kxh²Úg¿¸…ëQ¸~?1XñBß’¿ÓY„oPq¿¸…ëQ¸~?0nþº.W’¿VèÍò†Ev¿¸…ëQ¸~?û ‘¿öOŸ†X¿¸…ëQ¸~?{¤FyÊ0?Kxh²Úg¿¸…ëQ¸~?CÖU¬Úh¿ÓY„oPq¿¸…ëQ¸~?wËhOC¿VèÍò†Ev¿¸…ëQ¸~?vnÚŒÓU¿) - -// edges: - -788 -(J���K���L���J���M���L���N���M������N���O���P���P���Q���Q���R���R���S���S���T���U���V���T���U���V���W���W���X������Y���[���\���\���]���]���^���^���_���_���`���a���b���c���a���d���c���e���d���f���e���g���h���h���f���i���g���X���i���j������k���j���K���m���m���n���n���o���o���p���p������q���O���r���q���s���r���t���s���u���t���v���w���w���u���x���v���y���x���z���/���|���[���}���|���~���}������~���€������b���������‚���‚���ƒ���ƒ���„���„���…���†���‡���…���†���‡���ˆ���ˆ���y���8���‰���‰���Š���Ó���Ô���Õ���Ö���×���Õ���Ø���×���Ù���Ø���Ú���Ù���Û���Ú���Ü���Ý���Þ���ß���à���á���â���à���ã���â���ä���ã���å���ä���æ���å���ç���è������é���é���ê���ê���ë���ë���ì���÷���ø���ù������ú���ù���û���ú����������������� �� �� -�� -���������� �� �������������������������������������������������������������������� ����!�� ��"��!��#��"��$��#��%��$��&��%��'��&��(��'��)��(����)����*��*��+��+��,��,��-��-��.��.��/��/��0��0��1��1��2��2��3��3��4��4����Ý���Û���`���ç���è���Ü���5�����6��5��7��6��ì���7��ß���æ������A��A��B��B��Þ���K��L��M��K��N��M��O��N��P��O��Q��P��R��Q��S��R��T��S��U��T��V��U��W��V��X��Y��Y��Z��Z��[��[��\��\��]��]��^��^��_��_��`��`��a��a��b��b��c��c��d��L��e��e��f��f��g��g��h��h��i��i��j��j��k��k��l��l��m��m��n��n��o��o��W��p��X��q��p��r��q��s��r��t��s��u��t��v��u��w��v��x��w��y��x��z��y��d��z��{��|��Ô���€���}��Ó���ø���û���Ö���~��~������€��€������‚��‚��÷���á���ƒ��ƒ��„��„��…��…��†��†��‡��‡��{��|��}��ˆ��‰��‰��Š��Š��‹��‹��Œ����ˆ��Ž������Ž������‘��’��“�� -���”��“��•��”��’��•��–��—��—��˜��˜��™��™��š��š��›��›��‘��œ��–����œ��ž����Ÿ��ž�� ��Ÿ��¡�� ��¢��¡�����£��¤��¥��¥��¢��¦��§��¨��¦��©��¨��Œ��©��§��ª��ª��«��«��¬��¬������®�����¯��¯��°��°��±��±����²��³��´��²��µ��´��¶��µ��·��¶��®��·��³��¸��¸��¹��¹��º��º��»��»��¼��¼��½��½��¾��¿�� ���À��Á��¾��À��Â��Ã��Ã��Ä��Å��Æ��Ç��Å��£��¤��È��É��Ê��È��Ë��Ì��Ì��Í��Á��¿��Î��Ï��Ð��Ñ��Ò��Î��Ñ��Ó��Ô��Ò��Ó��Õ��Ö��×��×��Ø��Ø��Ô��Õ��Ù�� -���Ú��Û�� -���Ü��Û��Ý��Ü��Ù����������Ý��Þ��ß��ß��à��à��á��â��Ö��ã��â��á��ã��Ú��ä��ä��å��å��æ��æ��ç��ç�����è��é��é��ê��ê��ë��ë��ì��ì��í��î��ï��í��î��ï��ð��ð��ñ��ò��ó��ô��ò��õ��ô��ö��õ��÷��ø��Ä��÷��ø��ù��ù��ú��û��ü��ü��ý��ý��Â��þ��ÿ�����þ�������������������������������������� �� �� -�� -������ ���������������������������������������������������������������������ñ�������������� �� ��ö��!��"��"��Ç��#��!��ú��#��$��%��&��$��Æ��&��'��(��(��)��)��*��*��+��+��,��-��.��,��-��.��/��/����Ï��0��1��Ð��0��2��3��1��2��4��5��3��6��7��8��6��4��8��9��5��:��������;��;��<��<��=��=��������9��>��Þ��?��>��@��?��7��A��A��B��B��@��C��:��D��C��E��D��F��E�����F��G��è��H��G��I��H��J��I��K��J��L��M��M��K��N��L��O��N��ó��P��P��Q��Q��R��R��S��T��U��U��Ê��V��T��W��V��X��û��Y��X��É��Y��ÿ��Z��Z��[��[��\��\��]��]��^��_��`��^��_��`��a��a��b��c�����d��c��e��d����e�� ��f��f��g��g��h��h��i��j�� ���k��j��l��k��i��������l����m��m��n��n��o��o��p��p��q��r��s��q��r��s��t��t��O��u����v��u��w��v��S��w��x��y��Í��x��y��z��z��W��%��{��{��|��|��Ë��}��'��~��}����~��€������€��‚��ƒ��ƒ����„��‚��b��„�����…��…��������†��†��‡��‡��������ˆ��ˆ��‰��‰���������Š��Š�����‹��Œ����‹��Ž������Ž��‘��’��Œ��‘��“��”��”��•��’��–��–��—��˜��“����˜��•��™��™����—��š��š����Y���Z���Z������{���z������{���‹���Œ���Œ���������‘���‘���“���“���•���—���˜���•���—���˜���›���›������Ÿ��� ���£���Ÿ���¥���£���§���¥���©���§���«���¬���¬���©���¯���«������¯���±���‹���³���±���µ���³���·���µ���¹���·���»���¼���¼���¹���¿���»���Á���¿��� ���Ã���Ã���Å���Å���Ç���Ç���É���É���Ë���Í���Î���Ë���Í���Î���Ñ���Ñ���Á���í���î���î���ï���ï���ð���ð���ñ���ñ���ò���ó���ô���ò���ó���ô���õ���õ���ö���ü���ý���þ���ü���ÿ���þ������ÿ��������������������ö�����8��í���9��8��:��9��;��:��<��;��=��>��>��<��?��=��@��?��ý���C��C��D��D��E��E��F��F��G��H��I��G��H��I��J��J��@��›��œ����ž��Ÿ�� ��¡��¢��£��¤�����¥��¦�����§��¦�� -���§��¥��¨��¨��£��¤��©��ª��������«��«�����¬��ª��©��¬����®��¯��������°��°��±��±�����²��¯��®��²��³���� ���´��µ�� ��� ���µ��´��¶��¶��³��œ��·��¸����¹��Ÿ��¢��º�����»��»��¼��¼��½��½�����¾��¿��À��¾��Á��À��Â��Á��Ã��Â��Ä��Å��Å��Ã��Æ��Ä��Ç��Æ��È�����É��È��Ê��É�����Ê��Ë��Ì��Ì��Í��Í��Î��Î��Ï��Ï��Ð��Ñ��Ò��Ð��Ñ��Ò��Ó��Ó��Ç��Ô�����Õ��Ô��Ö��Õ�����Ö��¿��×��×��Ø��Ø��Ù��Ù��Ú��Ú��Û��Ü��Ý��Û��Ü��Ý��Þ��Þ��ß�� ���à��à��á��á��â��â�����ã��Ë��ä��ã��å��ä��æ��å��ç��æ��è��é��é��ç��ê��è��ß��ê��·��ë��ë��ì��í��î��î��›��ï��¸��ì��ï��ð��ñ��ž��ð��ò��¹��ó��ò��ô��í�� ��ô��º��õ��õ��ó��ñ��ö��ö��¡��÷��ø��ø��ù��ù��ú��ú��û��û�����ü��ý��þ��ü��ÿ��þ�����ÿ����������÷�������������������ý��������������������������������������������������������������������������� ������!��� ���"���!���#���"������#������$���$���%���%���&���&���'���'���(���(���)���*������+���,���)���+���,���-���.���*���-���.���/���0���1���2���3���4���5���3���4���6���7���1���6���7���0���8���9���:���:���;���;���<���<���=���=���>���>���5���?���9���@���?���A���@���B���A���C���B���D���C���2���E���F���G���G���D���H���F���E���I���I���H���l���k���Š���l������Ž���������’������”���’���–���”���™���š���š���–���œ���™���ž���œ���¡���¢���¢���¤���¤���¦���¦���¨���¨���ª������®���ª������®���°���°���ž���Ž���²���²���´���´���¶���¶���¸���¸���º���½���¾���º���½���¾���À���À���Â���Ä���¡���Æ���Ä���È���Æ���Ê���È���Ì���Ê���Ï���Ð���Ð���Ì���Ò���Ï���Â���Ò���) -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/flange/system/collapseDict b/tutorials/mesh/cvMesh/flange/system/collapseDict new file mode 100644 index 0000000000000000000000000000000000000000..9034677ca9c28252bd5ecf19eb24095c33c763c9 --- /dev/null +++ b/tutorials/mesh/cvMesh/flange/system/collapseDict @@ -0,0 +1,52 @@ +/*--------------------------------*- 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; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object collapseDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +collapseEdgesCoeffs +{ + minimumEdgeLength 1e-6; + maximumMergeAngle 180; + reductionFactor 0.5; +} + +collapseFacesCoeffs +{ + initialFaceLengthFactor 0.5; + reductionFactor 0.5; + + allowEarlyCollapseToPoint on; + allowEarlyCollapseCoeff 0.2; + guardFraction 0.1; + maxCollapseFaceToPointSideLengthCoeff 0.3; +} + +meshQualityCoeffs +{ + #include "meshQualityDict"; + maximumIterations 30; + maximumSmoothingIterations 1; + maxPointErrorCount 5; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/flange/system/controlDict b/tutorials/mesh/cvMesh/flange/system/controlDict index 66a4bab34e67f6193ac3dcbad0d2e0c424851a5f..213488e4d87fa255e59377dd8d143ef26af4731f 100644 --- a/tutorials/mesh/cvMesh/flange/system/controlDict +++ b/tutorials/mesh/cvMesh/flange/system/controlDict @@ -22,23 +22,25 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +application cvMesh; + startFrom startTime; startTime 0; stopAt endTime; -endTime 0; +endTime 100; deltaT 1; writeControl timeStep; -writeInterval 1000; +writeInterval 10; purgeWrite 0; -writeFormat binary; //ascii; +writeFormat ascii; writePrecision 10; diff --git a/tutorials/mesh/cvMesh/flange/system/cvMeshDict b/tutorials/mesh/cvMesh/flange/system/cvMeshDict index e0dace7c28388a91b23c8f0ad12e712d419d8594..ea769c8152d9942d923449c1fc4d8a62a7426f1d 100644 --- a/tutorials/mesh/cvMesh/flange/system/cvMeshDict +++ b/tutorials/mesh/cvMesh/flange/system/cvMeshDict @@ -45,52 +45,35 @@ backgroundMeshDecomposition surfaceConformation { - locationInMesh (0 0 0); + locationInMesh (0 0 0); - pointPairDistanceCoeff 0.1; + pointPairDistanceCoeff 0.1; mixedFeaturePointPPDistanceCoeff 5.0; - featurePointExclusionDistanceCoeff 0.65; + featurePointExclusionDistanceCoeff 0.7; - featureEdgeExclusionDistanceCoeff 0.8; + featureEdgeExclusionDistanceCoeff 0.7; - surfaceSearchDistanceCoeff 3; + surfaceSearchDistanceCoeff 5; - maxSurfaceProtrusionCoeff 0.1; + maxSurfaceProtrusionCoeff 0.1; - maxQuadAngle 125; + maxQuadAngle 125; surfaceConformationRebuildFrequency 10; + specialiseFeaturePoints on; + conformationControls { - initial - { - edgeSearchDistCoeff 5; - surfacePtReplaceDistCoeff 0.5; - surfacePtExclusionDistanceCoeff 0.5; - } - - iteration - { - edgeSearchDistCoeff 2; - surfacePtReplaceDistCoeff 0.5; - } + edgeSearchDistCoeff 5; + surfacePtReplaceDistCoeff 0.5; + surfacePtExclusionDistanceCoeff 0.5; - maxIterations 15; + maxIterations 15; - iterationToInitialHitRatioLimit 0.001; - } - - coarseConformationControls - { - $conformationControls; - } - - fineConformationControls - { - $conformationControls; + iterationToInitialHitRatioLimit 0.0001; } geometryToConformTo @@ -134,30 +117,30 @@ motionControl { defaultCellSize 0.001; - // Assign a priority to all requests for cell sizes, the highest overrules. - defaultPriority 0; - - cellSizeControlGeometry + shapeControlFunctions { flange.obj { - priority 1; - mode inside; + type searchableSurfaceControl; + priority 1; + mode inside; surfaceCellSizeFunction uniformValue; uniformValueCoeffs { - surfaceCellSize 0.0005; + surfaceCellSize $defaultCellSize; } - cellSizeFunction linearDistance; - linearDistanceCoeffs - { - distanceCellSize $defaultCellSize; - distance 0.004; - } + cellSizeFunction uniform; + uniformCoeffs{} } } + cellAspectRatioControl + { + aspectRatio 1.0; + aspectRatioDirection (0 0 0); + } + relaxationModel adaptiveLinear; adaptiveLinearCoeffs @@ -170,7 +153,7 @@ motionControl timeChecks no; - maxLoadUnbalance 0.05; + maxLoadUnbalance 0.2; alignmentSearchSpokes 36; @@ -202,18 +185,9 @@ motionControl polyMeshFiltering { - writeTetDualMesh false; - filterSizeCoeff 0.2; - mergeClosenessCoeff 1e-9; - continueFilteringOnBadInitialPolyMesh true; - filterErrorReductionCoeff 0.5; - filterCountSkipThreshold 4; - maxCollapseIterations 25; - maxConsecutiveEqualFaceSets 5; - surfaceStepFaceAngle 90; - edgeCollapseGuardFraction 0.0; //0.3; - maxCollapseFaceToPointSideLengthCoeff 0.35; - edgeMergeAngle 30; + filterEdges on; + filterFaces off; + writeTetDualMesh false; } @@ -222,4 +196,5 @@ meshQualityControls #include "meshQualityDict" } + // ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/flange/system/decomposeParDict b/tutorials/mesh/cvMesh/flange/system/decomposeParDict index f54d913bac9be6231f317a5048009951e647692f..afb5d8a226cc699ab6db67b043e65ba01103f2d7 100644 --- a/tutorials/mesh/cvMesh/flange/system/decomposeParDict +++ b/tutorials/mesh/cvMesh/flange/system/decomposeParDict @@ -15,14 +15,14 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -numberOfSubdomains 4; +numberOfSubdomains 8; -method scotch; -//method hierarchical; +//method scotch; +method hierarchical; simpleCoeffs { - n ( 2 2 1 ); + n ( 2 2 2 ); delta 0.001; } diff --git a/tutorials/mesh/cvMesh/flange/system/fvSchemes b/tutorials/mesh/cvMesh/flange/system/fvSchemes index 2e5c55b28ba64ca0cfc1a7c714148109cd736563..046181f3576de294a25da6429547f491989dd144 100644 --- a/tutorials/mesh/cvMesh/flange/system/fvSchemes +++ b/tutorials/mesh/cvMesh/flange/system/fvSchemes @@ -22,7 +22,7 @@ ddtSchemes gradSchemes { - default none; + default Gauss linear; } divSchemes @@ -33,6 +33,7 @@ divSchemes laplacianSchemes { default none; + laplacian(nn) Gauss linear corrected; } interpolationSchemes @@ -42,7 +43,7 @@ interpolationSchemes snGradSchemes { - default none; + default corrected; } fluxRequired diff --git a/tutorials/mesh/cvMesh/flange/system/fvSolution b/tutorials/mesh/cvMesh/flange/system/fvSolution index 740eb61a4bcb97e64ae0b33558f5c7057e7a6d20..6368c1229865b54c53db9d5d239567540a12540b 100644 --- a/tutorials/mesh/cvMesh/flange/system/fvSolution +++ b/tutorials/mesh/cvMesh/flange/system/fvSolution @@ -17,6 +17,13 @@ FoamFile solvers { + nn + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0; + } } // ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/flange/system/meshQualityDict b/tutorials/mesh/cvMesh/flange/system/meshQualityDict index 1b83e2bd87b647e97cf8b39d2dccbb30af267c8e..4a182cc0b58b9795df86df5d6e220f285bd42595 100644 --- a/tutorials/mesh/cvMesh/flange/system/meshQualityDict +++ b/tutorials/mesh/cvMesh/flange/system/meshQualityDict @@ -23,7 +23,7 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // //- Maximum non-orthogonality allowed. Set to 180 to disable. -maxNonOrtho 65; +maxNonOrtho 45; //- Max skewness allowed. Set to <0 to disable. maxBoundarySkewness 50; diff --git a/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict index 9da7fabcafea5f7ef0e7951a190148200f5a701c..12c88b16c4dba21ff638a3d6c8738fb70fa44c40 100644 --- a/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict +++ b/tutorials/mesh/cvMesh/flange/system/snappyHexMeshDict @@ -216,33 +216,32 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.5; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.0003; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.0001; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 90; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/mesh/cvMesh/flange/system/surfaceFeatureExtractDict b/tutorials/mesh/cvMesh/flange/system/surfaceFeatureExtractDict index ca6dfb9e7c63e9f6dc8098bbdd5a778249797660..520df11958ba69a71cf8b55c16a97653b883cdd3 100644 --- a/tutorials/mesh/cvMesh/flange/system/surfaceFeatureExtractDict +++ b/tutorials/mesh/cvMesh/flange/system/surfaceFeatureExtractDict @@ -24,7 +24,7 @@ flange.obj // than includedAngle as features // - 0 : selects no edges // - 180: selects all edges - includedAngle 155; + includedAngle 100; } diff --git a/tutorials/mesh/cvMesh/simpleShapes/Allrun b/tutorials/mesh/cvMesh/simpleShapes/Allrun index 4c2ecc94734fd310575de005bb4df43b710db1bb..c37109987b9f66122fdddb9d394a3ccaea0e059a 100755 --- a/tutorials/mesh/cvMesh/simpleShapes/Allrun +++ b/tutorials/mesh/cvMesh/simpleShapes/Allrun @@ -30,18 +30,14 @@ runApplication surfaceOrient \ constant/triSurface/domain_clean_orient.stl mv log.surfaceOrient log.surfaceOrient.domain -runApplication surfaceFeatureExtract -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.coneAndSphere_clean - unset FOAM_SIGFPE runApplication surfaceFeatureExtract -mv log.surfaceFeatureExtract log.surfaceFeatureExtract.domain # Generate aligned points (in constant/internalDelaunayVertices) and a # mesh from that. runApplication cvMesh # Generate some sets for a bit of mesh inspection -runApplication topoSet -constant -time 0:100 +runApplication topoSet -time 0:100 # ----------------------------------------------------------------- end-of-file diff --git a/tutorials/mesh/cvMesh/simpleShapes/constant/triSurface/domain.stl b/tutorials/mesh/cvMesh/simpleShapes/constant/triSurface/domain.stl index b51c05291445e5202b86eec6cea4878abd6639e5..5650ed200133c64ccaf37ccf55701500b6acfbac 100644 --- a/tutorials/mesh/cvMesh/simpleShapes/constant/triSurface/domain.stl +++ b/tutorials/mesh/cvMesh/simpleShapes/constant/triSurface/domain.stl @@ -83,4 +83,4 @@ solid ascii vertex 1.3 -0.9 1 endloop endfacet -end solid +endsolid diff --git a/tutorials/mesh/cvMesh/simpleShapes/system/collapseDict b/tutorials/mesh/cvMesh/simpleShapes/system/collapseDict new file mode 100644 index 0000000000000000000000000000000000000000..9034677ca9c28252bd5ecf19eb24095c33c763c9 --- /dev/null +++ b/tutorials/mesh/cvMesh/simpleShapes/system/collapseDict @@ -0,0 +1,52 @@ +/*--------------------------------*- 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; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object collapseDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +collapseEdgesCoeffs +{ + minimumEdgeLength 1e-6; + maximumMergeAngle 180; + reductionFactor 0.5; +} + +collapseFacesCoeffs +{ + initialFaceLengthFactor 0.5; + reductionFactor 0.5; + + allowEarlyCollapseToPoint on; + allowEarlyCollapseCoeff 0.2; + guardFraction 0.1; + maxCollapseFaceToPointSideLengthCoeff 0.3; +} + +meshQualityCoeffs +{ + #include "meshQualityDict"; + maximumIterations 30; + maximumSmoothingIterations 1; + maxPointErrorCount 5; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/simpleShapes/system/controlDict b/tutorials/mesh/cvMesh/simpleShapes/system/controlDict index 05271d052bbd4b99b5c88a534621349ad8fef047..8bbced6c67a446eef989729934ebaa162998c034 100644 --- a/tutorials/mesh/cvMesh/simpleShapes/system/controlDict +++ b/tutorials/mesh/cvMesh/simpleShapes/system/controlDict @@ -34,7 +34,7 @@ deltaT 1; writeControl timeStep; -writeInterval 1000; //10 to see the meshing steps +writeInterval 80; // 10 to see the meshing steps purgeWrite 0; diff --git a/tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict b/tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict index 26952c55cee63d59c3a941d2d1415477b53abadd..99379e62c9399731eb8f9949bfcf84f4daf669cc 100644 --- a/tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict +++ b/tutorials/mesh/cvMesh/simpleShapes/system/cvMeshDict @@ -96,12 +96,12 @@ surfaceConformation // Distance to a feature point within which surface and edge // conformation points are excluded - fraction of the local target // cell size - featurePointExclusionDistanceCoeff 0.4; + featurePointExclusionDistanceCoeff 0.6; // Distance to an existing feature edge conformation location // within which other edge conformation location are excluded - // fraction of the local target cell size - featureEdgeExclusionDistanceCoeff 0.2; + featureEdgeExclusionDistanceCoeff 0.6; // Optimisation: do not check for surface intersection (of dual edges) // for points near to surface. @@ -120,35 +120,27 @@ surfaceConformation // Frequency to redo surface conformation (expensive). surfaceConformationRebuildFrequency 10; + // Specialised feature point handling + specialiseFeaturePoints on; + // Initial and intermediate controls conformationControls { - // Initial conformation - initial - { - // We've got a point poking through the surface. Don't do any - // surface conformation if near feature edge (since feature edge - // conformation should have priority) - - // distance to search for near feature edges - edgeSearchDistCoeff 1.1; + // We've got a point poking through the surface. Don't do any + // surface conformation if near feature edge (since feature edge + // conformation should have priority) - // Proximity to a feature edge where a surface hit is - // not created, only the edge conformation is created - // - fraction of the local target cell size. Coarse - // conformation, initial protrusion tests. - surfacePtReplaceDistCoeff 0.5; + // distance to search for near feature edges + edgeSearchDistCoeff 2; + // Proximity to a feature edge where a surface hit is + // not created, only the edge conformation is created + // - fraction of the local target cell size. Coarse + // conformation, initial protrusion tests. + surfacePtReplaceDistCoeff 0.5; - surfacePtExclusionDistanceCoeff 0.5; - } - // Same for iterations - iteration - { - edgeSearchDistCoeff 1.25; - surfacePtReplaceDistCoeff 0.7; - } + surfacePtExclusionDistanceCoeff 0.5; // Stop either at maxIterations or if the number of surface pokes // is very small (iterationToInitialHitRatioLimit * initial number) @@ -159,16 +151,6 @@ surfaceConformation iterationToInitialHitRatioLimit 0.001; } - coarseConformationControls - { - $conformationControls; - } - - fineConformationControls - { - $conformationControls; - } - // Geometry to mesh to geometryToConformTo { @@ -257,11 +239,47 @@ motionControl // Absolute cell size of back ground mesh. This is the maximum cell size. defaultCellSize 0.1; - // Assign a priority to all requests for cell sizes, the highest overrules. - defaultPriority 0; + shapeControlFunctions + { + coneAndSphere + { + type searchableSurfaceControl; + priority 1; + mode bothSides; + + surfaceCellSizeFunction uniformValue; + uniformValueCoeffs + { + surfaceCellSize 0.075; + } + + cellSizeFunction uniform; + uniformCoeffs + {} + } + + domain + { + type searchableSurfaceControl; + priority 1; + mode bothSides; + + surfaceCellSizeFunction uniformValue; + uniformValueCoeffs + { + surfaceCellSize $defaultCellSize; + } + + cellSizeFunction uniform; + uniformCoeffs + {} + } + } - cellSizeControlGeometry + cellAspectRatioControl { + aspectRatio 1.0; + aspectRatioDirection (0 0 0); } // Underrelaxation for point motion. Simulated annealing: starts off at 1 @@ -280,7 +298,7 @@ motionControl objOutput no; // Timing and memory usage. - timeChecks yes; + timeChecks no; // Number of rays in plane parallel to nearest surface. Used to detect // next closest surfaces. Used to work out alignment (three vectors) @@ -341,101 +359,13 @@ motionControl // Do not change. See cvControls.H polyMeshFiltering { - // Upper limit on the size of faces to be filtered. - // fraction of the local target cell size - filterSizeCoeff 0.2; - - // Upper limit on how close two dual vertices can be before - // being merged, fraction of the local target cell size - mergeClosenessCoeff 1e-9; - - // To not filter: set maxNonOrtho to 1 (so check fails) and then - // set continueFilteringOnBadInitialPolyMesh to false. - continueFilteringOnBadInitialPolyMesh true; - - // When a face is "bad", what fraction should the filterSizeCoeff be - // reduced by. Recursive, so for a filterCount value of fC, the - // filterSizeCoeff is reduced by pow(filterErrorReductionCoeff, fC) - filterErrorReductionCoeff 0.5; - - // Maximum number of filterCount applications before a face - // is not attempted to be filtered - filterCountSkipThreshold 4; - - // Maximum number of permissible iterations of the face collapse - // algorithm. The value to choose will be related the maximum number - // of points on a face that is to be collapsed and how many faces - // around it need to be collapsed. - maxCollapseIterations 25; - - // Maximum number of times an to allow an equal faceSet to be - // returned from the face quality assessment before stopping iterations - // to break an infinitie loop. - maxConsecutiveEqualFaceSets 5; - // Remove little steps (almost perp to surface) by collapsing face. - surfaceStepFaceAngle 80; - // Do not collapse face to edge if should become edges - edgeCollapseGuardFraction 0.3; - // Only collapse face to point if high aspect ratio - maxCollapseFaceToPointSideLengthCoeff 0.35; - - // Write the tet-dual mesh for post-processing - writeTetDualMesh yes; + filterEdges on; + filterFaces on; + writeTetDualMesh false; } -// Generic mesh quality settings. At any undoable phase these determine -// where to undo. Same as in snappyHexMeshDict -meshQualityControls -{ - //- Maximum non-orthogonality allowed. Set to 180 to disable. - maxNonOrtho 65; - - //- Max skewness allowed. Set to <0 to disable. - maxBoundarySkewness 50; - maxInternalSkewness 10; - - //- Max concaveness allowed. Is angle (in degrees) below which concavity - // is allowed. 0 is straight face, <0 would be convex face. - // Set to 180 to disable. - maxConcave 80; - - //- Minimum pyramid volume. Is absolute volume of cell pyramid. - // Set to a sensible fraction of the smallest cell volume expected. - // Set to very negative number (e.g. -1E30) to disable. - minVol -1E30; - - //- Minimum quality of the tet formed by the - // variable base point minimum decomposition triangles and - // the cell centre (so not face-centre decomposition). - // This has to be a positive number for tracking - // to work. Set to very negative number (e.g. -1E30) to - // disable. - // <0 = inside out tet, - // 0 = flat tet - // 1 = regular tet - minTetQuality 1e-30; - - //- Minimum absolute face area. Set to <0 to disable. - minArea -1; - - //- Minimum face twist. Set to <-1 to disable. dot product of face normal - //- and face centre triangles normal - minTwist 0.001; - - //- minimum normalised cell determinant - //- 1 = hex, <= 0 = folded or flattened illegal cell - minDeterminant 0.001; - - //- minFaceWeight (0 -> 0.5) - minFaceWeight 0.02; - - //- minVolRatio (0 -> 1) - minVolRatio 0.01; - - //must be >0 for Fluent compatibility - minTriangleTwist -1; -} +#include "meshQualityDict"; // ************************************************************************* // diff --git a/tutorials/mesh/cvMesh/simpleShapes/system/meshQualityDict b/tutorials/mesh/cvMesh/simpleShapes/system/meshQualityDict new file mode 100644 index 0000000000000000000000000000000000000000..1b83e2bd87b647e97cf8b39d2dccbb30af267c8e --- /dev/null +++ b/tutorials/mesh/cvMesh/simpleShapes/system/meshQualityDict @@ -0,0 +1,73 @@ +/*--------------------------------*- 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; + + root ""; + case ""; + instance ""; + local ""; + + class dictionary; + object meshQualityDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//- Maximum non-orthogonality allowed. Set to 180 to disable. +maxNonOrtho 65; + +//- Max skewness allowed. Set to <0 to disable. +maxBoundarySkewness 50; +maxInternalSkewness 10; + +//- Max concaveness allowed. Is angle (in degrees) below which concavity +// is allowed. 0 is straight face, <0 would be convex face. +// Set to 180 to disable. +maxConcave 80; + +//- Minimum quality of the tet formed by the face-centre +// and variable base point minimum decomposition triangles and +// the cell centre. This has to be a positive number for tracking +// to work. Set to very negative number (e.g. -1E30) to +// disable. +// <0 = inside out tet, +// 0 = flat tet +// 1 = regular tet +minTetQuality 1e-30; + +//- Minimum pyramid volume. Is absolute volume of cell pyramid. +// Set to a sensible fraction of the smallest cell volume expected. +// Set to very negative number (e.g. -1E30) to disable. +minVol 0; + +//- Minimum face area. Set to <0 to disable. +minArea -1; + +//- Minimum face twist. Set to <-1 to disable. dot product of face normal +//- and face centre triangles normal +minTwist 0.001; + +//- minimum normalised cell determinant +//- 1 = hex, <= 0 = folded or flattened illegal cell +minDeterminant 0.001; + +//- minFaceWeight (0 -> 0.5) +minFaceWeight 0.02; + +//- minVolRatio (0 -> 1) +minVolRatio 0.01; + +//must be >0 for Fluent compatibility +minTriangleTwist -1; + + +// ************************************************************************* // diff --git a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict index a1c0e1162f43801b6007ec103c38b837ec14209c..0e686729062863241611a64d61872df14ae436dc 100644 --- a/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict +++ b/tutorials/mesh/snappyHexMesh/flange/system/snappyHexMeshDict @@ -214,30 +214,30 @@ addLayersControls expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict index 01badbd1ec0ac2a2512d5fdd4e4214feaa9467e3..dbb112f07439ca131953010a34df5c5cb802fdb1 100644 --- a/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict +++ b/tutorials/multiphase/LTSInterFoam/wigleyHull/system/snappyHexMeshDict @@ -228,31 +228,31 @@ addLayersControls expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the thickness of the layer furthest away from the wall. - // See relativeSizes parameter. + // Wanted thickness of final added cell layer. If multiple layers + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // See relativeSizes parameter. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // See relativeSizes parameter. minThickness 0.25; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 60; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals diff --git a/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties b/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..956389e755fcd819f23b29ba167b214fdcb8309e --- /dev/null +++ b/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFProperties @@ -0,0 +1,31 @@ +/*--------------------------------*- 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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 6.2831853; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..956389e755fcd819f23b29ba167b214fdcb8309e --- /dev/null +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFProperties @@ -0,0 +1,31 @@ +/*--------------------------------*- 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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); + + origin (0 0 0); + axis (0 0 1); + omega constant 6.2831853; +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index ec52208dc086647fac0e39ddc1c8c7f582f549e7..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 6.2831853; - } -) - -// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/U1 b/tutorials/multiphase/bubbleFoam/bubbleColumn/0/U1 deleted file mode 100644 index a067cb3d2056171d39715808cb1b052d23e59de8..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/U1 +++ /dev/null @@ -1,1956 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volVectorField; - object U1; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -1 0 0 0 0]; - -internalField nonuniform List<vector> -1875 -( -(0.235741 0.282915 0) -(0.643036 0.399243 0) -(0.656185 0.509736 0) -(0.636409 0.544659 0) -(0.620127 0.564227 0) -(0.618713 0.561656 0) -(0.624412 0.553842 0) -(0.632129 0.542499 0) -(0.629964 0.532026 0) -(0.624875 0.526406 0) -(0.614482 0.526789 0) -(0.599004 0.532843 0) -(0.577409 0.553691 0) -(0.530174 0.581747 0) -(0.467086 0.62077 0) -(0.341265 0.702532 0) -(0.200802 0.714208 0) -(0.165579 0.724117 0) -(0.0823803 0.878697 0) -(-0.016522 0.926312 0) -(-0.226396 0.75159 0) -(-0.179979 0.678163 0) -(-0.399049 0.427978 0) -(-0.566877 0.274105 0) -(-0.384263 -0.0548673 0) -(0.0716513 -0.439321 0) -(0.279506 -0.152191 0) -(0.184572 0.1313 0) -(0.175589 0.255174 0) -(0.184014 0.271204 0) -(0.208684 0.269064 0) -(0.242769 0.248253 0) -(0.280598 0.228197 0) -(0.319307 0.217199 0) -(0.34987 0.217243 0) -(0.381907 0.223478 0) -(0.424078 0.230925 0) -(0.428005 0.270264 0) -(0.382643 0.307171 0) -(0.372617 0.391425 0) -(0.258543 0.50144 0) -(0.0953053 0.676366 0) -(0.104968 0.742667 0) -(0.096802 0.869526 0) -(0.139361 0.870893 0) -(0.0573226 0.667963 0) -(0.214903 0.561766 0) -(0.0766779 0.612272 0) -(-0.122334 -0.0156288 0) -(-0.279094 -0.521725 0) -(-0.0176985 -0.513921 0) -(0.0347137 -0.042279 0) -(-0.0122756 0.189036 0) -(0.0400778 0.115918 0) -(0.127855 0.0810941 0) -(0.180943 0.0966721 0) -(0.198338 0.136208 0) -(0.208426 0.154902 0) -(0.247423 0.163264 0) -(0.249173 0.210267 0) -(0.218257 0.201626 0) -(0.161338 0.201241 0) -(0.176038 0.26962 0) -(0.0915893 0.343315 0) -(0.0809896 0.414782 0) -(-0.0331324 0.566673 0) -(-0.122711 0.595887 0) -(-0.0631875 0.636468 0) -(-0.0752413 0.772388 0) -(0.016323 0.787342 0) -(-0.00494172 0.556271 0) -(0.168714 0.358189 0) -(0.0777835 0.477472 0) -(0.0848983 0.117252 0) -(-0.150044 -0.530939 0) -(-0.00246017 -0.543038 0) -(0.0310676 0.0203172 0) -(-0.00859394 0.242012 0) -(0.0432859 0.157066 0) -(0.0739057 0.132058 0) -(0.0769579 0.160969 0) -(0.0543572 0.201658 0) -(0.0281194 0.187048 0) -(0.0597751 0.160184 0) -(0.0150864 0.204361 0) -(-0.0627548 0.330466 0) -(-0.125905 0.384734 0) -(-0.162897 0.409445 0) -(-0.176189 0.432821 0) -(-0.164775 0.478269 0) -(-0.170618 0.523923 0) -(-0.108591 0.511002 0) -(-0.126957 0.573263 0) -(-0.12712 0.734609 0) -(-0.0845458 0.759789 0) -(0.0331765 0.480641 0) -(0.101535 0.455155 0) -(0.010038 0.657924 0) -(0.0613247 0.491649 0) -(-0.0891678 -0.313494 0) -(0.000978649 -0.577408 0) -(-0.0152532 -0.125008 0) -(-0.00602979 0.0905946 0) -(0.0792542 -0.0215229 0) -(0.0448018 -0.0383249 0) -(0.0212028 0.0839119 0) -(-0.0733629 0.190164 0) -(-0.106851 0.162443 0) -(-0.143221 0.168897 0) -(-0.218732 0.293125 0) -(-0.226009 0.313401 0) -(-0.230132 0.296989 0) -(-0.213528 0.316163 0) -(-0.213571 0.346585 0) -(-0.189509 0.381493 0) -(-0.166401 0.381986 0) -(-0.167863 0.465124 0) -(-0.273715 0.550543 0) -(-0.282759 0.685692 0) -(-0.144366 0.557903 0) -(0.0228787 0.269495 0) -(0.0339209 0.413566 0) -(-0.0446192 0.53295 0) -(0.0689717 0.338812 0) -(-0.0777225 -0.43038 0) -(0.00337122 -0.510514 0) -(-0.0233767 -0.0465083 0) -(-0.0190977 0.00964726 0) -(0.0445354 -0.0085983 0) -(-0.0290037 0.0996159 0) -(-0.0714682 0.256276 0) -(-0.141746 0.328702 0) -(-0.146813 0.298179 0) -(-0.220543 0.313735 0) -(-0.23063 0.316241 0) -(-0.215578 0.326605 0) -(-0.208755 0.351326 0) -(-0.207563 0.378341 0) -(-0.213012 0.392876 0) -(-0.195504 0.408488 0) -(-0.207271 0.443346 0) -(-0.252032 0.56554 0) -(-0.293884 0.626126 0) -(-0.277673 0.649848 0) -(-0.140787 0.414759 0) -(-0.0173278 0.237967 0) -(-0.00146389 0.449184 0) -(-0.00921544 0.593652 0) -(0.0443774 0.468614 0) -(-0.101398 -0.313839 0) -(0.0119738 -0.498432 0) -(-0.0226992 -0.034944 0) -(-0.0302639 0.0354088 0) -(-0.0461342 0.015388 0) -(-0.117576 0.125313 0) -(-0.155351 0.28538 0) -(-0.184462 0.328131 0) -(-0.18456 0.310887 0) -(-0.222241 0.306776 0) -(-0.228316 0.283665 0) -(-0.22837 0.28412 0) -(-0.237535 0.312724 0) -(-0.243165 0.343901 0) -(-0.247758 0.359063 0) -(-0.238153 0.403224 0) -(-0.281716 0.490919 0) -(-0.301372 0.53859 0) -(-0.270337 0.559814 0) -(-0.209984 0.480356 0) -(-0.116475 0.162647 0) -(-0.0848917 0.035491 0) -(-0.0162196 0.389816 0) -(0.00804055 0.547809 0) -(0.000151655 0.44985 0) -(-0.0742983 -0.373666 0) -(0.0226381 -0.424386 0) -(-0.0159965 0.0889873 0) -(-0.0489576 0.158477 0) -(-0.0932017 0.135951 0) -(-0.131842 0.252351 0) -(-0.169339 0.376081 0) -(-0.208511 0.406023 0) -(-0.236303 0.386353 0) -(-0.263553 0.361001 0) -(-0.280644 0.323677 0) -(-0.307179 0.324151 0) -(-0.338995 0.354472 0) -(-0.351826 0.37819 0) -(-0.363041 0.394315 0) -(-0.38315 0.429582 0) -(-0.37241 0.460261 0) -(-0.278268 0.484737 0) -(-0.151544 0.43029 0) -(0.0354422 0.303739 0) -(0.133782 0.109043 0) -(0.0461519 0.155129 0) -(-0.0969644 0.350308 0) -(-0.0260814 0.555089 0) -(-0.0576074 0.509295 0) -(0.0638435 -0.36229 0) -(0.0397873 -0.401762 0) -(0.0132581 0.208607 0) -(-0.0503483 0.290348 0) -(-0.139116 0.21531 0) -(-0.124556 0.315017 0) -(-0.165117 0.47282 0) -(-0.166557 0.506898 0) -(-0.221453 0.47662 0) -(-0.240043 0.436727 0) -(-0.279175 0.417863 0) -(-0.311754 0.419931 0) -(-0.337641 0.423714 0) -(-0.343674 0.415868 0) -(-0.348424 0.416639 0) -(-0.338202 0.415982 0) -(-0.326527 0.394585 0) -(-0.268182 0.288732 0) -(-0.158546 0.159757 0) -(-0.00445933 0.0705633 0) -(0.00775141 0.0256028 0) -(-0.133256 0.248876 0) -(-0.293176 0.437779 0) -(-0.241293 0.497609 0) -(-0.106385 0.385991 0) -(0.177888 -0.400565 0) -(0.104788 -0.388573 0) -(-0.0393141 0.305495 0) -(0.0314174 0.518475 0) -(-0.141042 0.351628 0) -(-0.131753 0.347489 0) -(-0.135579 0.491547 0) -(-0.103922 0.56379 0) -(-0.14706 0.583771 0) -(-0.15107 0.5458 0) -(-0.194289 0.515018 0) -(-0.216366 0.477417 0) -(-0.24922 0.451599 0) -(-0.246783 0.428726 0) -(-0.247815 0.413063 0) -(-0.239395 0.371203 0) -(-0.235777 0.287928 0) -(-0.238215 0.186885 0) -(-0.245344 0.109425 0) -(-0.245592 0.0939 0) -(-0.361738 0.192577 0) -(-0.464709 0.325927 0) -(-0.459003 0.332914 0) -(-0.348293 0.260469 0) -(-0.10742 0.047654 0) -(0.186306 -0.315578 0) -(0.129128 -0.319172 0) -(-0.132039 0.274902 0) -(0.177386 0.599848 0) -(-0.00569923 0.545343 0) -(-0.107578 0.376326 0) -(-0.101016 0.458921 0) -(-0.0840805 0.549942 0) -(-0.0843162 0.575151 0) -(-0.0853267 0.566258 0) -(-0.0955599 0.546293 0) -(-0.112786 0.503591 0) -(-0.128787 0.447535 0) -(-0.144053 0.394955 0) -(-0.146489 0.356389 0) -(-0.155312 0.31432 0) -(-0.1612 0.291751 0) -(-0.209886 0.250728 0) -(-0.250769 0.216813 0) -(-0.290388 0.277419 0) -(-0.383223 0.404172 0) -(-0.430982 0.404915 0) -(-0.39869 0.288507 0) -(-0.261189 0.0585085 0) -(-0.117553 -0.154962 0) -(0.0284448 -0.228772 0) -(0.0532209 -0.256435 0) -(-0.0878511 0.284606 0) -(0.183881 0.519631 0) -(0.173214 0.831358 0) -(-0.0214973 0.609281 0) -(-0.0257563 0.51429 0) -(-0.0764946 0.571152 0) -(-0.0851017 0.58564 0) -(-0.0835825 0.5714 0) -(-0.0731847 0.539861 0) -(-0.0567206 0.494451 0) -(-0.0633894 0.448248 0) -(-0.0501005 0.412787 0) -(-0.0722485 0.397611 0) -(-0.0915791 0.372539 0) -(-0.123198 0.3627 0) -(-0.1621 0.385102 0) -(-0.201852 0.418073 0) -(-0.211814 0.505279 0) -(-0.292788 0.542034 0) -(-0.350848 0.410291 0) -(-0.298318 0.0969379 0) -(-0.221553 -0.0919876 0) -(-0.159419 -0.1918 0) -(-0.109666 -0.409249 0) -(-0.099626 -0.329575 0) -(0.0829934 0.275393 0) -(0.129316 0.445538 0) -(0.182822 0.937096 0) -(0.0586748 0.912372 0) -(-0.0366136 0.733023 0) -(-0.0693767 0.662879 0) -(-0.0958532 0.628555 0) -(-0.102424 0.566329 0) -(-0.0952108 0.509975 0) -(-0.0654833 0.460343 0) -(-0.0340469 0.416414 0) -(-0.0302951 0.387487 0) -(0.0100919 0.393965 0) -(-0.0102004 0.428929 0) -(-0.0131914 0.45272 0) -(-0.0536362 0.46925 0) -(-0.0302082 0.518055 0) -(-0.0824134 0.624794 0) -(-0.131488 0.629799 0) -(-0.190399 0.354308 0) -(-0.227804 0.0378569 0) -(-0.196371 -0.137285 0) -(-0.115147 -0.384143 0) -(-0.0925873 -0.652513 0) -(-0.129486 -0.47392 0) -(0.184737 0.0590685 0) -(0.0951174 0.279155 0) -(0.115851 0.929985 0) -(0.00536483 1.15476 0) -(-0.0612269 0.940058 0) -(-0.0913946 0.768869 0) -(-0.109165 0.66495 0) -(-0.103878 0.578309 0) -(-0.100924 0.478229 0) -(-0.0982537 0.409154 0) -(-0.0446602 0.363152 0) -(-0.0233506 0.344588 0) -(0.0221284 0.361135 0) -(0.0622751 0.404815 0) -(0.068573 0.476626 0) -(0.0397619 0.56955 0) -(0.044843 0.696141 0) -(0.00739304 0.784365 0) -(-0.0353837 0.682166 0) -(-0.054491 0.348148 0) -(-0.110365 0.0272955 0) -(-0.151626 -0.31712 0) -(-0.083404 -0.572871 0) -(-0.0299063 -0.795518 0) -(-0.076496 -0.56303 0) -(0.158467 -0.0433973 0) -(0.00265698 0.231616 0) -(0.0754251 0.912905 0) -(0.0273339 1.21539 0) -(0.0186149 1.05431 0) -(-0.0674814 0.773516 0) -(-0.0734814 0.603954 0) -(-0.072503 0.534852 0) -(-0.0512511 0.433518 0) -(-0.0689144 0.330904 0) -(-0.0333096 0.25889 0) -(0.00335975 0.24727 0) -(0.0385826 0.246643 0) -(0.086685 0.306052 0) -(0.109185 0.477149 0) -(0.107485 0.646506 0) -(0.060058 0.813502 0) -(0.0623319 0.809725 0) -(0.0660441 0.626911 0) -(0.0294839 0.31501 0) -(-0.0410107 -0.0413669 0) -(-0.0688077 -0.461737 0) -(-0.0451669 -0.675752 0) -(-0.0312537 -0.95119 0) -(-0.0282598 -0.627506 0) -(0.0931726 -0.0896422 0) -(-0.0535398 0.196147 0) -(0.03951 0.795993 0) -(0.0184638 1.17691 0) -(0.0483535 1.03713 0) -(0.01431 0.794962 0) -(0.0132507 0.536308 0) -(0.0092842 0.456988 0) -(0.0481602 0.349471 0) -(0.0701298 0.271648 0) -(0.0575455 0.225959 0) -(0.0785957 0.216094 0) -(0.0779246 0.224146 0) -(0.120944 0.31623 0) -(0.164705 0.532851 0) -(0.123465 0.754381 0) -(0.104467 0.817128 0) -(0.116549 0.764054 0) -(0.0831026 0.504635 0) -(0.128796 0.205998 0) -(-0.0138401 -0.0667637 0) -(0.0181645 -0.459589 0) -(-0.0128174 -0.68815 0) -(-0.017547 -0.974061 0) -(-0.00840551 -0.673361 0) -(0.00822702 -0.194852 0) -(-0.071645 0.168316 0) -(-0.0806822 0.737102 0) -(-0.0938222 1.0826 0) -(0.0177071 0.937794 0) -(0.0796967 0.718466 0) -(0.127064 0.444121 0) -(0.168919 0.315965 0) -(0.181978 0.203143 0) -(0.202663 0.173831 0) -(0.192463 0.177011 0) -(0.217227 0.208191 0) -(0.192131 0.26242 0) -(0.164929 0.411379 0) -(0.157545 0.664289 0) -(0.0948154 0.84731 0) -(0.111204 0.801222 0) -(0.0852142 0.662595 0) -(0.196797 0.409345 0) -(0.101225 0.247307 0) -(0.037499 -0.0453147 0) -(0.0418648 -0.437514 0) -(0.0305666 -0.654025 0) -(-0.0101884 -0.967798 0) -(0.00666966 -0.606389 0) -(-0.0466157 -0.106413 0) -(-0.0930025 0.223512 0) -(-0.103796 0.683087 0) -(-0.126081 0.946518 0) -(-0.0809068 0.714748 0) -(0.164119 0.56268 0) -(0.22365 0.41285 0) -(0.343769 0.284466 0) -(0.367632 0.226448 0) -(0.403446 0.226353 0) -(0.381248 0.259374 0) -(0.28092 0.285321 0) -(0.19021 0.389749 0) -(0.123542 0.639503 0) -(0.0822898 0.859198 0) -(0.0275014 0.845123 0) -(0.0478751 0.719529 0) -(0.1634 0.508388 0) -(0.18675 0.418961 0) -(-0.0188603 0.300859 0) -(0.112872 -0.139527 0) -(0.0319502 -0.397924 0) -(0.0413109 -0.611967 0) -(0.0121018 -0.911382 0) -(0.0292974 -0.520995 0) -(-0.0454483 -0.0342725 0) -(-0.0552005 0.244192 0) -(-0.0187108 0.641819 0) -(-0.00392448 0.945723 0) -(0.0590754 0.464378 0) -(0.193572 0.230904 0) -(0.360107 0.129977 0) -(0.457896 0.114731 0) -(0.449846 0.153839 0) -(0.35478 0.218934 0) -(0.282452 0.31836 0) -(0.135631 0.529179 0) -(-0.0104523 0.766662 0) -(-0.0699151 0.884932 0) -(-0.0798656 0.907075 0) -(-0.0180589 0.77165 0) -(0.0654196 0.572711 0) -(0.103478 0.504827 0) -(-0.0039403 0.466 0) -(-0.0164834 0.195092 0) -(0.0943815 -0.199648 0) -(0.0483169 -0.352399 0) -(0.0309815 -0.530705 0) -(0.0199486 -0.83714 0) -(0.0616991 -0.485384 0) -(-0.08931 0.0278569 0) -(-0.0369102 0.218205 0) -(-0.0710228 0.521819 0) -(0.129189 0.69364 0) -(0.300769 0.351698 0) -(0.43648 0.0142277 0) -(0.422976 -0.0116133 0) -(0.402254 0.019141 0) -(0.329033 0.116881 0) -(0.132185 0.332016 0) -(-0.0504714 0.58357 0) -(-0.164611 0.752304 0) -(-0.161356 0.819447 0) -(-0.140296 0.847766 0) -(-0.133019 0.780767 0) -(-0.0558104 0.565828 0) -(-0.0421847 0.481593 0) -(-0.0610841 0.429487 0) -(-0.0495913 0.385818 0) -(0.0701272 -0.00087012 0) -(0.0699393 -0.203695 0) -(0.0699017 -0.264919 0) -(0.0352785 -0.453343 0) -(0.0198059 -0.758114 0) -(0.0947532 -0.366002 0) -(-0.103995 0.1518 0) -(-0.0611994 0.255559 0) -(-0.136178 0.326725 0) -(0.0145911 0.296929 0) -(0.276856 0.05756 0) -(0.380361 0.019215 0) -(0.273045 0.0628518 0) -(-0.0187354 0.246248 0) -(-0.084113 0.384817 0) -(-0.173072 0.517818 0) -(-0.210301 0.654612 0) -(-0.216471 0.73272 0) -(-0.15641 0.783852 0) -(-0.111004 0.791076 0) -(-0.0919115 0.626045 0) -(-0.0382221 0.422521 0) -(-0.00374529 0.396448 0) -(0.0199982 0.277348 0) -(0.0807092 0.126763 0) -(0.137657 -0.107667 0) -(0.108744 -0.175782 0) -(0.0921292 -0.229546 0) -(0.0330253 -0.410571 0) -(0.0399913 -0.701655 0) -(0.0831855 -0.264682 0) -(-0.0525147 0.33668 0) -(-0.0995546 0.353966 0) -(-0.147808 0.345331 0) -(0.00114486 0.235027 0) -(0.0780509 0.17504 0) -(-0.130424 0.194343 0) -(-0.21737 0.246303 0) -(-0.282431 0.313825 0) -(-0.281029 0.384869 0) -(-0.298633 0.48192 0) -(-0.286344 0.560142 0) -(-0.204477 0.600066 0) -(-0.101962 0.589334 0) -(0.0154568 0.562593 0) -(0.104744 0.419933 0) -(0.113871 0.29179 0) -(0.114072 0.253422 0) -(0.144195 0.207784 0) -(0.137859 0.13119 0) -(0.179822 0.0103463 0) -(0.154117 -0.0125473 0) -(0.111143 -0.0821216 0) -(0.0452644 -0.277637 0) -(0.0322329 -0.578898 0) -(0.0587524 -0.204294 0) -(-0.0217904 0.535616 0) -(-0.0759713 0.560311 0) -(-0.0924362 0.477343 0) -(-0.0858707 0.335762 0) -(-0.222658 0.349394 0) -(-0.324933 0.382547 0) -(-0.372756 0.375995 0) -(-0.393928 0.392573 0) -(-0.403701 0.422262 0) -(-0.382142 0.48022 0) -(-0.330672 0.522744 0) -(-0.230309 0.531101 0) -(-0.106644 0.484111 0) -(0.0327251 0.428938 0) -(0.111603 0.400133 0) -(0.122368 0.377773 0) -(0.118555 0.363892 0) -(0.148874 0.320774 0) -(0.104056 0.262003 0) -(0.143294 0.132499 0) -(0.0727229 0.0733983 0) -(0.0822665 -0.029979 0) -(0.0216526 -0.216217 0) -(0.0338216 -0.49864 0) -(-0.0234396 -0.231193 0) -(0.0373678 0.582834 0) -(-0.017698 0.648052 0) -(0.0448454 0.683503 0) -(-0.0308462 0.625434 0) -(-0.121979 0.533731 0) -(-0.230161 0.47568 0) -(-0.282096 0.43059 0) -(-0.328778 0.427814 0) -(-0.353656 0.439371 0) -(-0.356971 0.45729 0) -(-0.333592 0.467845 0) -(-0.276499 0.433591 0) -(-0.206096 0.395726 0) -(-0.166571 0.380191 0) -(-0.122135 0.384489 0) -(-0.0749418 0.390556 0) -(-0.0191717 0.370048 0) -(0.0508939 0.338859 0) -(0.0781517 0.240278 0) -(0.107177 0.144706 0) -(0.0414861 0.0862876 0) -(0.0797925 -0.00775321 0) -(0.0192869 -0.169527 0) -(0.0241504 -0.438638 0) -(-0.081061 -0.281677 0) -(0.0680263 0.501908 0) -(0.00761151 0.592481 0) -(0.11237 0.650602 0) -(0.120222 0.692767 0) -(0.076381 0.640735 0) -(0.0435646 0.592202 0) -(-0.00704673 0.519488 0) -(-0.0529055 0.457091 0) -(-0.0945998 0.415788 0) -(-0.109221 0.39738 0) -(-0.128647 0.382119 0) -(-0.15085 0.343108 0) -(-0.165905 0.323666 0) -(-0.159186 0.272493 0) -(-0.178405 0.212053 0) -(-0.152347 0.200932 0) -(-0.106738 0.206092 0) -(-0.0409545 0.220547 0) -(0.0292831 0.205538 0) -(0.0480035 0.170426 0) -(0.0216452 0.0979804 0) -(0.0605892 0.00452084 0) -(0.0197604 -0.108866 0) -(0.0191903 -0.35583 0) -(-0.168087 -0.222241 0) -(0.124255 0.373472 0) -(0.100922 0.562734 0) -(0.107066 0.553002 0) -(0.111518 0.647912 0) -(0.121255 0.593008 0) -(0.177971 0.534942 0) -(0.173158 0.49479 0) -(0.175518 0.46665 0) -(0.151385 0.450839 0) -(0.136686 0.434342 0) -(0.129877 0.421327 0) -(0.0888619 0.370709 0) -(0.0677146 0.343116 0) -(0.0451249 0.33121 0) -(-0.0354312 0.248082 0) -(-0.0677769 0.185143 0) -(-0.0624212 0.124639 0) -(-0.0358642 0.106767 0) -(-0.0183848 0.117101 0) -(-0.00722449 0.113201 0) -(0.0091117 0.0698647 0) -(0.0190983 0.0258889 0) -(0.010464 -0.0583469 0) -(0.0124889 -0.292181 0) -(-0.101489 -0.158783 0) -(0.0941319 0.222708 0) -(0.223795 0.679517 0) -(0.0859099 0.638079 0) -(0.118747 0.618448 0) -(0.0947352 0.50543 0) -(0.166015 0.504795 0) -(0.154554 0.506781 0) -(0.180343 0.482475 0) -(0.188773 0.466304 0) -(0.183248 0.43866 0) -(0.195555 0.42226 0) -(0.18703 0.398796 0) -(0.172307 0.357477 0) -(0.188553 0.322775 0) -(0.179164 0.315358 0) -(0.138888 0.257457 0) -(0.0555977 0.157168 0) -(0.0334133 0.116259 0) -(0.045675 0.0960564 0) -(0.045597 0.0768809 0) -(0.0460825 0.0482323 0) -(0.0308541 0.0298896 0) -(0.0150448 -0.0266301 0) -(0.0107973 -0.263822 0) -(0.109591 -0.242822 0) -(-0.0345656 -0.0552707 0) -(0.219224 0.577897 0) -(0.172744 0.726031 0) -(0.176021 0.632936 0) -(0.0997307 0.512431 0) -(0.0647615 0.453942 0) -(0.0774694 0.456494 0) -(0.113461 0.447621 0) -(0.140381 0.447794 0) -(0.148106 0.424762 0) -(0.178683 0.409128 0) -(0.188975 0.390282 0) -(0.198496 0.336553 0) -(0.215609 0.293902 0) -(0.216578 0.292526 0) -(0.21657 0.289171 0) -(0.195731 0.242661 0) -(0.153341 0.183659 0) -(0.116212 0.165992 0) -(0.0869091 0.135945 0) -(0.0703859 0.108181 0) -(0.0480584 0.0857186 0) -(0.0211139 0.0218787 0) -(0.00519211 -0.225222 0) -(0.178603 -0.278265 0) -(-0.106461 -0.0909177 0) -(0.146275 0.381655 0) -(0.290084 0.658313 0) -(0.306093 0.715942 0) -(0.256461 0.620428 0) -(0.13089 0.506253 0) -(0.0691344 0.46424 0) -(0.0333927 0.376227 0) -(0.0842164 0.39668 0) -(0.110246 0.38841 0) -(0.153541 0.373591 0) -(0.179875 0.364521 0) -(0.191288 0.333081 0) -(0.196534 0.309778 0) -(0.188151 0.312461 0) -(0.185766 0.312039 0) -(0.175564 0.288461 0) -(0.156038 0.279805 0) -(0.112074 0.270078 0) -(0.088611 0.219895 0) -(0.0674079 0.183114 0) -(0.0471247 0.169935 0) -(0.0194921 0.122769 0) -(-0.00285402 -0.170739 0) -(0.0941155 -0.259626 0) -(-0.0234933 -0.0152202 0) -(0.071703 0.0752687 0) -(0.294711 0.411006 0) -(0.393775 0.677173 0) -(0.382177 0.820832 0) -(0.311991 0.785725 0) -(0.153294 0.5849 0) -(0.0581871 0.445413 0) -(0.019897 0.340989 0) -(0.0598109 0.30556 0) -(0.0799765 0.30064 0) -(0.0975052 0.317296 0) -(0.107351 0.330964 0) -(0.106836 0.335844 0) -(0.0963823 0.349838 0) -(0.0898661 0.351248 0) -(0.0980146 0.34323 0) -(0.0924582 0.336779 0) -(0.0861809 0.311847 0) -(0.0814255 0.254263 0) -(0.058156 0.23788 0) -(0.0359749 0.226852 0) -(0.014445 0.167141 0) -(-0.00998266 -0.15107 0) -(0.0112834 -0.313363 0) -(0.0715993 -0.126529 0) -(0.13804 0.0596103 0) -(0.208352 0.198328 0) -(0.33543 0.556612 0) -(0.367526 0.817105 0) -(0.331963 0.925083 0) -(0.288716 0.86626 0) -(0.119516 0.613272 0) -(0.0213305 0.409556 0) -(0.00288115 0.321486 0) -(-0.00184527 0.327894 0) -(-0.0200352 0.336838 0) -(-0.0176014 0.318454 0) -(-0.0123875 0.322313 0) -(-0.00711572 0.34405 0) -(0.00582193 0.334679 0) -(0.0431185 0.313189 0) -(0.0610771 0.308512 0) -(0.0816515 0.299416 0) -(0.0762299 0.276897 0) -(0.0530371 0.288962 0) -(0.0227383 0.294844 0) -(0.0156083 0.231894 0) -(-0.0114399 -0.132471 0) -(0.0134529 -0.347688 0) -(0.079025 -0.225853 0) -(0.193419 -0.0825656 0) -(0.185346 0.19832 0) -(0.198066 0.430484 0) -(0.261748 0.752074 0) -(0.2655 0.935787 0) -(0.253947 0.968376 0) -(0.197651 0.887118 0) -(0.0569221 0.596265 0) -(-0.00727763 0.389971 0) -(0.00647102 0.367941 0) -(-0.019417 0.366703 0) -(-0.0491864 0.339547 0) -(-0.0609269 0.313277 0) -(-0.0537495 0.290211 0) -(-0.00291402 0.274253 0) -(0.0212483 0.244181 0) -(0.0615173 0.247987 0) -(0.0646929 0.281769 0) -(0.0650348 0.319014 0) -(0.0397922 0.357081 0) -(0.0147324 0.337644 0) -(0.0130117 0.248252 0) -(-0.00522624 -0.12207 0) -(0.0174861 -0.582804 0) -(0.101267 -0.447083 0) -(0.153078 -0.307123 0) -(0.138352 0.0765649 0) -(0.0169229 0.375656 0) -(0.0635127 0.63493 0) -(0.117076 0.884902 0) -(0.109839 0.971737 0) -(0.106707 0.911321 0) -(0.0204431 0.765901 0) -(0.0190239 0.564596 0) -(0.0332211 0.497217 0) -(-0.0104522 0.467609 0) -(-0.0386365 0.407411 0) -(-0.0599213 0.295918 0) -(-0.0357757 0.223158 0) -(0.00377389 0.200356 0) -(0.025912 0.195859 0) -(0.0468245 0.220486 0) -(0.0547925 0.29274 0) -(0.024556 0.353807 0) -(0.0115634 0.379676 0) -(0.022681 0.366547 0) -(-0.00387461 0.282119 0) -(0.00984657 -0.118877 0) -(-0.0154485 -0.646497 0) -(0.0619399 -0.522591 0) -(0.0298834 -0.388703 0) -(0.0153697 0.0468793 0) -(-0.167824 0.313491 0) -(-0.0596589 0.46941 0) -(-0.0297625 0.73582 0) -(0.0149087 0.929575 0) -(0.00302068 0.948068 0) -(-0.0594943 0.80347 0) -(-0.0214168 0.608683 0) -(-0.00260312 0.537231 0) -(-0.021117 0.522042 0) -(-0.0274971 0.411276 0) -(-0.0342818 0.260393 0) -(0.0203943 0.153033 0) -(0.026644 0.142869 0) -(0.0618593 0.160265 0) -(0.0380121 0.227009 0) -(0.0142235 0.339477 0) -(-0.0287879 0.426888 0) -(0.00376108 0.356778 0) -(0.0124013 0.365546 0) -(-0.0148726 0.294815 0) -(0.0121691 -0.12912 0) -(-0.00837725 -0.646993 0) -(0.0303243 -0.494813 0) -(-0.056148 -0.34333 0) -(0.0247167 0.179262 0) -(-0.116245 0.391012 0) -(-0.141089 0.36748 0) -(-0.00977432 0.554635 0) -(-0.0506905 0.842692 0) -(-0.0584951 0.936035 0) -(-0.126521 0.836338 0) -(-0.0616442 0.679534 0) -(-0.0381944 0.586149 0) -(-0.0563979 0.527771 0) -(-0.0310636 0.38849 0) -(0.0137392 0.201387 0) -(0.0384745 0.120632 0) -(0.0499893 0.121272 0) -(0.049417 0.171544 0) -(0.0108466 0.296391 0) -(-0.0597035 0.438302 0) -(-0.0593196 0.411948 0) -(-0.0370405 0.306178 0) -(-0.000567594 0.351611 0) -(-0.0145671 0.304825 0) -(0.00569453 -0.127327 0) -(-0.00175474 -0.632184 0) -(-0.0167561 -0.491808 0) -(-0.0339384 -0.393575 0) -(0.00660426 0.0201117 0) -(0.00459421 0.394683 0) -(-0.0782881 0.324231 0) -(-0.0757814 0.537292 0) -(-0.192919 0.876977 0) -(-0.213285 0.945702 0) -(-0.226764 0.860683 0) -(-0.131272 0.728648 0) -(-0.0816488 0.605627 0) -(-0.111472 0.506008 0) -(-0.0348215 0.317314 0) -(-0.00210775 0.152294 0) -(0.00985953 0.0973508 0) -(0.0183181 0.0927687 0) -(0.0012309 0.230642 0) -(-0.0569869 0.400433 0) -(-0.0518154 0.446686 0) -(-0.0524795 0.394719 0) -(-0.0520397 0.245992 0) -(-0.00898284 0.31004 0) -(-0.00936986 0.286268 0) -(-0.0120188 -0.15093 0) -(-0.00124509 -0.580516 0) -(-0.0508386 -0.41997 0) -(-0.0574098 -0.317123 0) -(-0.0807306 -0.0281494 0) -(-0.0188234 0.319458 0) -(-0.0500477 0.355009 0) -(-0.18666 0.606264 0) -(-0.228665 0.86669 0) -(-0.235455 0.918083 0) -(-0.228263 0.860398 0) -(-0.15448 0.705207 0) -(-0.14404 0.59085 0) -(-0.144805 0.451652 0) -(-0.064383 0.261286 0) -(-0.0814582 0.171595 0) -(-0.052395 0.124168 0) -(-0.079759 0.112212 0) -(-0.0406262 0.247633 0) -(-0.0418178 0.394852 0) -(-0.0307752 0.433291 0) -(-0.0254287 0.370634 0) -(-0.0530538 0.230166 0) -(-0.035095 0.271946 0) -(0.0150094 0.276405 0) -(-0.0448812 -0.16052 0) -(0.0240896 -0.513333 0) -(-0.0863335 -0.367498 0) -(-0.0688123 -0.244121 0) -(-0.0890785 -0.0317175 0) -(-0.0793237 0.297982 0) -(-0.0563717 0.500362 0) -(-0.161074 0.715071 0) -(-0.180122 0.877156 0) -(-0.173559 0.920054 0) -(-0.171918 0.866964 0) -(-0.128901 0.69887 0) -(-0.148239 0.54928 0) -(-0.150545 0.380671 0) -(-0.103008 0.22971 0) -(-0.141783 0.152239 0) -(-0.110652 0.0932229 0) -(-0.125519 0.0795343 0) -(-0.0618407 0.205492 0) -(-0.0268184 0.366537 0) -(0.00436284 0.417029 0) -(0.026955 0.394564 0) -(-0.041 0.243698 0) -(-0.0189685 0.207076 0) -(0.0171521 0.242314 0) -(-0.0627274 -0.176441 0) -(-0.00469549 -0.417746 0) -(-0.0682657 -0.25485 0) -(-0.0446811 -0.0716016 0) -(-0.134864 0.119087 0) -(-0.056723 0.314636 0) -(0.0246377 0.540308 0) -(-0.0355549 0.736661 0) -(-0.0261421 0.869366 0) -(-0.00338725 0.893001 0) -(-0.0280542 0.844498 0) -(-0.0501085 0.624275 0) -(-0.108064 0.461067 0) -(-0.101965 0.336476 0) -(-0.12582 0.239797 0) -(-0.145465 0.136284 0) -(-0.133991 0.0647587 0) -(-0.119506 0.0500433 0) -(-0.0944102 0.094431 0) -(-0.0381739 0.265869 0) -(-0.00181084 0.369962 0) -(0.0191126 0.386683 0) -(-0.0132707 0.296248 0) -(-0.00503545 0.221029 0) -(-0.00360394 0.230115 0) -(-0.00387831 -0.193514 0) -(-0.00124815 -0.396263 0) -(0.000659186 -0.217313 0) -(-0.0149599 -0.0227759 0) -(-0.103082 0.153274 0) -(-0.00881352 0.316591 0) -(0.00697105 0.54472 0) -(0.0683759 0.790587 0) -(0.0881708 0.875543 0) -(0.131051 0.8854 0) -(0.153055 0.843528 0) -(0.102832 0.667216 0) -(0.0100483 0.457964 0) -(-0.00472595 0.35735 0) -(-0.0704871 0.266542 0) -(-0.075944 0.162638 0) -(-0.134987 0.10004 0) -(-0.169857 0.0541053 0) -(-0.207495 0.0299362 0) -(-0.138875 0.161513 0) -(-0.0741671 0.297873 0) -(-0.0528094 0.349883 0) -(-0.0572178 0.283572 0) -(-0.0475208 0.28319 0) -(-0.0837696 0.21918 0) -(0.119373 -0.13034 0) -(0.0140292 -0.407655 0) -(0.0281799 -0.202569 0) -(0.0157554 0.0550778 0) -(-0.0407486 0.262239 0) -(-0.04835 0.338458 0) -(0.00184659 0.510997 0) -(0.107529 0.744421 0) -(0.13474 0.815296 0) -(0.180758 0.807629 0) -(0.216659 0.768895 0) -(0.242042 0.668272 0) -(0.178217 0.522521 0) -(0.145086 0.398864 0) -(0.111679 0.303903 0) -(0.0873781 0.258368 0) -(-0.0130921 0.160195 0) -(-0.123084 0.0292317 0) -(-0.154503 -0.0349541 0) -(-0.115384 0.0116656 0) -(-0.0448117 0.209472 0) -(-0.0254027 0.339661 0) -(-0.0205712 0.324028 0) -(-0.0782689 0.347256 0) -(-0.151594 0.0851155 0) -(0.161857 -0.159066 0) -(-0.00079583 -0.510744 0) -(0.0367659 -0.322731 0) -(0.00436837 -0.0601892 0) -(-0.00162217 0.217638 0) -(-0.042506 0.298305 0) -(-0.0209705 0.3821 0) -(0.0390537 0.623276 0) -(0.0572121 0.767531 0) -(0.109408 0.757204 0) -(0.163441 0.718129 0) -(0.212964 0.624803 0) -(0.223163 0.512125 0) -(0.224942 0.398333 0) -(0.209707 0.283173 0) -(0.199997 0.249508 0) -(0.179774 0.249769 0) -(0.1404 0.204056 0) -(0.0621226 0.173019 0) -(-0.0350832 0.128112 0) -(0.0651027 0.207725 0) -(0.0774832 0.365649 0) -(0.105103 0.406896 0) -(0.0139424 0.418387 0) -(-0.0534702 0.0236424 0) -(-0.0254968 -0.179775 0) -(-0.0197414 -0.523111 0) -(-0.0151767 -0.382117 0) -(-0.0652401 -0.152882 0) -(-0.131157 0.0127455 0) -(-0.127327 0.158798 0) -(-0.207669 0.304087 0) -(-0.214544 0.502758 0) -(-0.156959 0.613397 0) -(-0.0441714 0.605997 0) -(0.0694555 0.56978 0) -(0.175682 0.52382 0) -(0.234886 0.458995 0) -(0.293526 0.368076 0) -(0.315869 0.310514 0) -(0.320004 0.282308 0) -(0.320285 0.23218 0) -(0.310034 0.209118 0) -(0.285357 0.216183 0) -(0.18124 0.239452 0) -(0.154706 0.327359 0) -(0.104107 0.460736 0) -(0.127681 0.596384 0) -(0.0510406 0.550831 0) -(0.0306224 0.0289253 0) -(-0.149458 -0.312758 0) -(-0.0571538 -0.224533 0) -(-0.103833 -0.0821527 0) -(-0.0510103 0.0584673 0) -(-0.181429 0.178163 0) -(-0.229988 0.241476 0) -(-0.291735 0.279832 0) -(-0.283538 0.350373 0) -(-0.186892 0.40339 0) -(-0.0594935 0.366249 0) -(0.0451803 0.36991 0) -(0.172757 0.36527 0) -(0.244939 0.345462 0) -(0.323222 0.290138 0) -(0.36125 0.24977 0) -(0.363276 0.249649 0) -(0.34094 0.248581 0) -(0.310182 0.260333 0) -(0.285814 0.318668 0) -(0.195601 0.379669 0) -(0.121694 0.463151 0) -(0.0237203 0.587949 0) -(0.00940268 0.674559 0) -(0.00861108 0.515413 0) -(0.105533 0.0412871 0) -(-0.140579 -0.275062 0) -(-0.00876215 -0.107407 0) -(-0.0431207 0.164546 0) -(-0.020213 0.373575 0) -(-0.0400042 0.390338 0) -(-0.176577 0.366413 0) -(-0.231296 0.369062 0) -(-0.235105 0.376687 0) -(-0.167183 0.327083 0) -(-0.0749037 0.290792 0) -(0.00657539 0.294359 0) -(0.111368 0.279913 0) -(0.195217 0.271733 0) -(0.254655 0.249068 0) -(0.278169 0.250767 0) -(0.274064 0.283095 0) -(0.214829 0.321707 0) -(0.165297 0.378281 0) -(0.0980425 0.427816 0) -(0.0576529 0.47275 0) -(-0.0354664 0.552169 0) -(-0.119782 0.680849 0) -(-0.136409 0.742336 0) -(-0.085715 0.395962 0) -(0.168009 0.105932 0) -(-0.0908044 -0.0903563 0) -(0.00751634 -0.107811 0) -(0.0261208 0.105356 0) -(0.0155522 0.429857 0) -(0.029345 0.598991 0) -(-0.0304323 0.606508 0) -(-0.108105 0.425044 0) -(-0.148714 0.310853 0) -(-0.153614 0.249443 0) -(-0.111718 0.166168 0) -(-0.029903 0.13086 0) -(0.052302 0.140123 0) -(0.12806 0.161011 0) -(0.151882 0.196802 0) -(0.162078 0.232077 0) -(0.139486 0.336437 0) -(0.0828776 0.407984 0) -(0.0467674 0.422546 0) -(0.0174912 0.482975 0) -(-0.0207265 0.574779 0) -(-0.118092 0.710429 0) -(-0.169671 0.79938 0) -(-0.172639 0.65219 0) -(-0.11318 0.163768 0) -(0.0740119 0.0678705 0) -(-0.032643 -0.0496032 0) -(-0.00467146 -0.196429 0) -(0.0451271 0.0354147 0) -(-0.00981724 0.395284 0) -(0.00606257 0.570846 0) -(0.0515557 0.578723 0) -(0.0396863 0.49984 0) -(-0.00620084 0.334399 0) -(-0.0336259 0.149798 0) -(-0.0316543 0.0154754 0) -(0.0455227 -0.0230972 0) -(0.113372 0.0174697 0) -(0.129284 0.0963977 0) -(0.126463 0.210909 0) -(0.0852588 0.289155 0) -(0.0550623 0.410565 0) -(0.0195341 0.512649 0) -(-0.0181692 0.504224 0) -(-0.0149237 0.548821 0) -(-0.0923979 0.680424 0) -(-0.14648 0.781489 0) -(-0.18875 0.793219 0) -(-0.0995924 0.524549 0) -(-0.0040145 0.123256 0) -(-0.12727 0.0341329 0) -(0.0807081 -0.1467 0) -(-0.00076019 -0.220549 0) -(-0.013215 0.0105428 0) -(-0.0298836 0.380443 0) -(-0.0549821 0.471697 0) -(0.0210394 0.514742 0) -(0.0386774 0.436949 0) -(0.060202 0.289638 0) -(0.0838186 0.126877 0) -(0.127805 -0.0266268 0) -(0.137739 -0.0859074 0) -(0.154206 -0.0472625 0) -(0.132975 0.0591954 0) -(0.0577565 0.224334 0) -(-0.0213538 0.339879 0) -(-0.0332973 0.439851 0) -(-0.0337095 0.523317 0) -(-0.0384002 0.538151 0) -(-0.0543147 0.675268 0) -(-0.130406 0.822794 0) -(-0.140645 0.850869 0) -(-0.186935 0.754907 0) -(-0.0941667 0.359312 0) -(0.000341583 0.118548 0) -(-0.0837424 0.0538106 0) -(-0.0108504 -0.170567 0) -(0.00485081 -0.12704 0) -(-0.0652925 0.0601908 0) -(-0.0073192 0.379985 0) -(-0.044286 0.46143 0) -(-0.019585 0.403637 0) -(0.0148553 0.386601 0) -(0.0394496 0.267879 0) -(0.0689075 0.0881942 0) -(0.0927399 -0.0355481 0) -(0.121513 -0.0924899 0) -(0.0744564 -0.0575202 0) -(0.00203815 0.0792308 0) -(-0.0688985 0.280327 0) -(-0.0846886 0.331054 0) -(-0.0574481 0.394378 0) -(-0.046738 0.495183 0) -(-0.0569556 0.589143 0) -(-0.0488666 0.762575 0) -(-0.0837662 0.837151 0) -(-0.0362952 0.864824 0) -(-0.0872404 0.649347 0) -(-0.0930859 0.196317 0) -(-0.113837 0.0629803 0) -(-0.00634958 -0.0393083 0) -(-0.0939062 -0.248063 0) -(0.027026 -0.0449289 0) -(-0.0796617 0.10423 0) -(0.0481566 0.393231 0) -(-0.00985512 0.510459 0) -(-0.0512572 0.422027 0) -(-0.0186494 0.342818 0) -(-0.0211694 0.232334 0) -(0.0294272 0.124964 0) -(0.014583 0.0700108 0) -(-0.0550495 0.0357735 0) -(-0.107019 0.0359347 0) -(-0.139789 0.132879 0) -(-0.127426 0.231361 0) -(-0.0955142 0.249451 0) -(-0.0786527 0.289923 0) -(-0.0537554 0.444587 0) -(-0.0623488 0.568098 0) -(-0.0301118 0.713906 0) -(-0.0125989 0.789553 0) -(0.0365551 0.796701 0) -(0.0558399 0.599649 0) -(0.0385447 0.174216 0) -(-0.0856235 -0.0928018 0) -(0.0290259 -0.182754 0) -(-0.0410914 -0.319952 0) -(-0.00349083 -0.0217508 0) -(-0.0159245 0.100502 0) -(0.0344982 0.382244 0) -(0.0297407 0.644911 0) -(-0.0726894 0.479895 0) -(-0.0526846 0.355177 0) -(-0.0700315 0.256062 0) -(-0.0668595 0.189971 0) -(-0.117863 0.161359 0) -(-0.179612 0.09919 0) -(-0.211369 0.0868543 0) -(-0.215556 0.118227 0) -(-0.177735 0.203563 0) -(-0.133124 0.227237 0) -(-0.134022 0.267812 0) -(-0.100864 0.387906 0) -(-0.0866887 0.513985 0) -(-0.0417419 0.628328 0) -(0.0193697 0.680555 0) -(0.0710356 0.67808 0) -(0.0698951 0.464672 0) -(0.11105 0.244453 0) -(0.038762 0.135977 0) -(-0.00618444 -0.0741662 0) -(-0.0111672 -0.29923 0) -(-0.00883044 -0.0159959 0) -(0.0644642 0.0949305 0) -(0.0171104 0.37312 0) -(0.0470784 0.764826 0) -(-0.0441168 0.64005 0) -(-0.0764224 0.409611 0) -(-0.11031 0.312174 0) -(-0.145673 0.274772 0) -(-0.151255 0.253988 0) -(-0.17977 0.188627 0) -(-0.224372 0.128936 0) -(-0.244101 0.115674 0) -(-0.23125 0.129625 0) -(-0.181473 0.198005 0) -(-0.161137 0.233946 0) -(-0.07742 0.323917 0) -(-0.0167313 0.436184 0) -(0.0600125 0.512343 0) -(0.143579 0.574979 0) -(0.199178 0.574293 0) -(0.187832 0.441358 0) -(0.173177 0.232049 0) -(0.102517 0.0830313 0) -(0.00562395 -0.157521 0) -(0.0137379 -0.348099 0) -(-0.00209802 -0.126714 0) -(0.0579357 0.00341209 0) -(-0.00393709 0.30359 0) -(0.0129365 0.749648 0) -(0.00636471 0.717602 0) -(-0.0473581 0.491794 0) -(-0.0940097 0.314532 0) -(-0.120948 0.241443 0) -(-0.117316 0.222363 0) -(-0.0950772 0.249163 0) -(-0.143263 0.21708 0) -(-0.186579 0.146907 0) -(-0.186906 0.129444 0) -(-0.172615 0.132459 0) -(-0.141689 0.209054 0) -(-0.065028 0.288772 0) -(0.0109694 0.374736 0) -(0.107316 0.435624 0) -(0.205873 0.489364 0) -(0.241668 0.490961 0) -(0.261295 0.418904 0) -(0.208797 0.301695 0) -(0.14754 0.189503 0) -(0.052205 -0.0227262 0) -(-0.000226005 -0.20319 0) -(0.0149858 -0.11323 0) -(-0.0251609 -0.0172732 0) -(-0.0675066 0.234318 0) -(-0.0247121 0.61655 0) -(0.0346177 0.675542 0) -(0.0404307 0.495464 0) -(0.0301441 0.317745 0) -(-0.00145274 0.227923 0) -(-0.0079058 0.168486 0) -(0.00881478 0.178744 0) -(0.0142094 0.184652 0) -(0.0109365 0.183289 0) -(-0.0504834 0.143603 0) -(-0.0687759 0.102511 0) -(-0.0492016 0.084267 0) -(-0.0205119 0.145011 0) -(0.0207946 0.212318 0) -(0.103694 0.264198 0) -(0.124572 0.403862 0) -(0.118797 0.472333 0) -(0.135576 0.426056 0) -(0.102809 0.409622 0) -(0.090979 0.367401 0) -(0.0439372 0.239235 0) -(0.0228147 0.109459 0) -(0.000729784 -0.0150522 0) -(-0.06967 0.0854803 0) -(-0.101667 0.236864 0) -(-0.0786541 0.451445 0) -(0.0279657 0.538601 0) -(0.0720736 0.429777 0) -(0.0970121 0.304859 0) -(0.0832798 0.254486 0) -(0.0646138 0.230094 0) -(0.0526706 0.229286 0) -(0.0521812 0.222326 0) -(0.0524684 0.223521 0) -(0.028205 0.222374 0) -(-0.0120505 0.147458 0) -(-0.0247418 0.0926673 0) -(-0.0360528 0.0788476 0) -(-0.0034036 0.0951646 0) -(-0.0104874 0.166043 0) -(-0.0235465 0.334683 0) -(-0.0254866 0.420683 0) -(0.0140892 0.439067 0) -(0.00318077 0.423386 0) -(0.0406603 0.400135 0) -(0.0220917 0.267533 0) -(0.00419795 0.0769291 0) -(-0.0556798 0.221124 0) -(-0.111416 0.244073 0) -(-0.113138 0.29068 0) -(-0.084981 0.366281 0) -(0.0340627 0.390914 0) -(0.112319 0.349694 0) -(0.153546 0.285598 0) -(0.155711 0.257537 0) -(0.172464 0.234024 0) -(0.165254 0.227225 0) -(0.160556 0.229587 0) -(0.150373 0.232914 0) -(0.150369 0.243911 0) -(0.119925 0.267488 0) -(0.042383 0.237492 0) -(-0.0164234 0.217229 0) -(-0.057532 0.232229 0) -(-0.118922 0.271383 0) -(-0.118183 0.310308 0) -(-0.0826988 0.370053 0) -(-0.024234 0.379997 0) -(0.013069 0.377998 0) -(0.0649385 0.363736 0) -(0.0726979 0.330489 0) -(0.0372599 0.271168 0) -(-0.0227592 0.166587 0) -(-0.045109 0.162179 0) -(-0.057107 0.214093 0) -(-0.0355015 0.22262 0) -(0.00610955 0.217134 0) -(0.0318206 0.204924 0) -(0.0588701 0.187467 0) -(0.0567559 0.163217 0) -(0.0643046 0.126832 0) -(0.051835 0.11628 0) -(0.0491894 0.108254 0) -(0.0365407 0.106943 0) -(0.0338923 0.116717 0) -(0.0233242 0.152776 0) -(0.0192095 0.180815 0) -(-0.00187597 0.192335 0) -(-0.0265211 0.195875 0) -(-0.0372467 0.196655 0) -(-0.0502362 0.192021 0) -(-0.0304718 0.185786 0) -(-0.0135897 0.212906 0) -(0.00755532 0.221834 0) -(0.023687 0.239275 0) -(0.0393698 0.249142 0) -(0.0219197 0.218769 0) -(-0.000889062 0.0372328 0) -(-0.0109179 0.0361254 0) -(-0.0118703 0.00876492 0) -(-0.000399272 -0.000965297 0) -(0.00476532 0.00485894 0) -(0.0201189 -0.00846372 0) -(0.023538 -0.0184024 0) -(0.0329939 -0.0161307 0) -(0.0271365 -0.011824 0) -(0.0191704 -0.00626783 0) -(0.00721846 -0.00269044 0) -(-0.00380106 0.000204209 0) -(-0.0155682 0.0075794 0) -(-0.0166443 0.00969329 0) -(-0.0144695 -0.0106955 0) -(-0.017289 -0.00276448 0) -(-0.0203945 0.000486899 0) -(-0.0203629 0.0173321 0) -(-0.0173736 0.0131108 0) -(-0.0210876 0.0247896 0) -(-0.0200303 0.027252 0) -(-0.0163761 0.0280907 0) -(-0.0184973 0.0168725 0) -(-0.00814656 0.0214623 0) -(-0.00635894 0.0515029 0) -(0.00263785 0.105431 0) -(0.00784603 0.0774799 0) -(0.012794 0.0476885 0) -(0.0100005 0.0337762 0) -(0.00998213 0.0151447 0) -(0.013375 0.014538 0) -(0.01064 0.0243762 0) -(0.0108938 0.0333939 0) -(0.00708949 0.0599289 0) -(0.0063219 0.0752113 0) -(0.00352056 0.0902293 0) -(0.00303961 0.0930398 0) -(-0.000739618 0.0936394 0) -(0.00113638 0.102865 0) -(-0.0014072 0.129181 0) -(-0.00470629 0.142469 0) -(-0.00826279 0.13966 0) -(-0.00959612 0.119403 0) -(-0.00811088 0.102042 0) -(-0.0136462 0.0818668 0) -(-0.0104404 0.0797099 0) -(-0.0111963 0.0954558 0) -(-0.00904115 0.0998635 0) -(-0.00818974 0.111696 0) -(-0.00420239 0.0874926 0) -(0.00832122 0.0294026 0) -(0.0163569 0.0257081 0) -(0.0156461 0.0162097 0) -(0.0138831 0.0138027 0) -(0.00941427 0.00252724 0) -(9.23742e-05 -0.00317251 0) -(-0.00794842 -0.0030951 0) -(-0.0156632 0.00393349 0) -(-0.0202418 0.0137601 0) -(-0.0213532 0.0180685 0) -(-0.0213409 0.0215884 0) -(-0.0191931 0.0235439 0) -(-0.0195375 0.0252773 0) -(-0.0218451 0.0213986 0) -(-0.0223475 0.020223 0) -(-0.0169932 0.0275293 0) -(-0.0112268 0.0304899 0) -(-0.00801043 0.0289567 0) -(-0.0073384 0.0375701 0) -(-0.00492998 0.0398616 0) -(-0.00748991 0.0345227 0) -(-0.004897 0.0354485 0) -(-0.00389305 0.0275279 0) -(-0.00547738 0.0284404 0) -(-0.000114832 0.0422311 0) -(0.00323697 0.0418529 0) -(0.00693436 0.0541668 0) -(0.00533842 0.0458649 0) -(0.00464955 0.040595 0) -(0.00332081 0.0409023 0) -(-0.00143932 0.047033 0) -(-0.00665501 0.0519916 0) -(-0.0122429 0.0551032 0) -(-0.0151883 0.0621665 0) -(-0.0153335 0.069971 0) -(-0.0145141 0.075572 0) -(-0.0129823 0.0810442 0) -(-0.0122081 0.0901706 0) -(-0.0110202 0.102835 0) -(-0.0135107 0.108334 0) -(-0.0158171 0.109475 0) -(-0.0162267 0.109277 0) -(-0.0163757 0.102745 0) -(-0.0156424 0.0863168 0) -(-0.0130092 0.0736925 0) -(-0.0104344 0.0721 0) -(-0.00722615 0.0774299 0) -(-0.00555619 0.0914663 0) -(-0.00665705 0.0914474 0) -(-0.00388641 0.0642169 0) -(-0.000204964 0.0122315 0) -(-0.000228595 0.027382 0) -(-0.00242514 0.0268567 0) -(-0.00541226 0.0237125 0) -(-0.00911667 0.022152 0) -(-0.0132311 0.0244865 0) -(-0.0180855 0.0270152 0) -(-0.0230586 0.0292667 0) -(-0.0276128 0.0271902 0) -(-0.0307595 0.0236217 0) -(-0.0320236 0.0236937 0) -(-0.0338763 0.0249443 0) -(-0.0342174 0.0288376 0) -(-0.0335568 0.0313019 0) -(-0.030145 0.0383379 0) -(-0.025123 0.0410185 0) -(-0.0191966 0.0391962 0) -(-0.0134511 0.0351858 0) -(-0.00825613 0.0375324 0) -(-0.00659678 0.0355623 0) -(-0.00566839 0.0288518 0) -(-0.00426853 0.0328891 0) -(-0.00309202 0.0334201 0) -(-0.00129145 0.0336145 0) -(-0.000383509 0.026633 0) -(0.000388305 0.0381359 0) -(0.000140119 0.0543182 0) -(-0.00175165 0.0522751 0) -(-0.00495678 0.0506859 0) -(-0.00896256 0.0529871 0) -(-0.012648 0.0619988 0) -(-0.0161942 0.0682708 0) -(-0.0195339 0.0709862 0) -(-0.0214304 0.0734389 0) -(-0.0230337 0.0738665 0) -(-0.0240072 0.0763829 0) -(-0.0229048 0.0799903 0) -(-0.0218983 0.0828124 0) -(-0.0207069 0.0874317 0) -(-0.0196511 0.0831635 0) -(-0.0185951 0.0784909 0) -(-0.0173721 0.0769959 0) -(-0.0162813 0.0715107 0) -(-0.0147273 0.0647173 0) -(-0.0109883 0.0612385 0) -(-0.0070107 0.0604651 0) -(-0.00428308 0.0650219 0) -(-0.00210055 0.0782312 0) -(-0.00234165 0.0785294 0) -(-0.00068969 0.0538614 0) -(0.000768602 0.0152334 0) -(0.00101087 0.0362592 0) -(-0.0014709 0.0426089 0) -(-0.00432248 0.0439428 0) -(-0.00769063 0.043786 0) -(-0.00998155 0.0450119 0) -(-0.0118706 0.0469298 0) -(-0.0143337 0.0456528 0) -(-0.0159306 0.0397406 0) -(-0.0176695 0.0344576 0) -(-0.0189501 0.028382 0) -(-0.0196868 0.0257259 0) -(-0.0205149 0.0289217 0) -(-0.019904 0.0319103 0) -(-0.0173981 0.0391277 0) -(-0.0159314 0.0417027 0) -(-0.0145701 0.0395478 0) -(-0.0128388 0.0352527 0) -(-0.0116716 0.0312417 0) -(-0.00974169 0.0241002 0) -(-0.00760504 0.0194289 0) -(-0.00574268 0.0276763 0) -(-0.00450226 0.0347502 0) -(-0.00331936 0.0363018 0) -(-0.0015274 0.0255251 0) -(0.000759533 0.0305284 0) -(0.000211934 0.0555467 0) -(-0.00183273 0.0604757 0) -(-0.00302484 0.060675 0) -(-0.00550673 0.0617753 0) -(-0.0074195 0.0673607 0) -(-0.00973395 0.0739986 0) -(-0.0112497 0.0759676 0) -(-0.0121034 0.0766357 0) -(-0.0129594 0.0765552 0) -(-0.0135983 0.0761909 0) -(-0.0148322 0.0791906 0) -(-0.0148402 0.0790924 0) -(-0.0144451 0.0759001 0) -(-0.0140224 0.069556 0) -(-0.0133596 0.0676323 0) -(-0.012054 0.0651036 0) -(-0.011161 0.0603916 0) -(-0.00981228 0.0529708 0) -(-0.00828881 0.0475987 0) -(-0.0058001 0.04671 0) -(-0.00381277 0.0534496 0) -(-0.00172907 0.0678406 0) -(-0.00249782 0.0670913 0) -(-0.00141651 0.0382277 0) -(-0.000631535 0.0163944 0) -(0.00116823 0.0451877 0) -(-0.00048028 0.0531234 0) -(-0.00211115 0.0553757 0) -(-0.00426904 0.056869 0) -(-0.00556868 0.0578019 0) -(-0.00678294 0.0588073 0) -(-0.00734732 0.0544393 0) -(-0.00791982 0.0470128 0) -(-0.00816387 0.0414441 0) -(-0.00913804 0.0362031 0) -(-0.00924399 0.0321556 0) -(-0.00869927 0.0315201 0) -(-0.00804335 0.0340917 0) -(-0.00860439 0.0407039 0) -(-0.00962969 0.0411691 0) -(-0.0096443 0.0389076 0) -(-0.00954651 0.0341963 0) -(-0.00912947 0.0289834 0) -(-0.00888313 0.0191947 0) -(-0.00688196 0.0135823 0) -(-0.00507437 0.0227161 0) -(-0.00364652 0.0360645 0) -(-0.000977042 0.0399214 0) -(-0.000295946 0.0210058 0) -(0.000661274 0.0263467 0) -(0.00121277 0.0524322 0) -(0.00181305 0.0648208 0) -(0.00102348 0.0661749 0) -(-4.21879e-05 0.0665862 0) -(-0.00153058 0.0698841 0) -(-0.00269932 0.0750705 0) -(-0.00344427 0.0753113 0) -(-0.00410122 0.075549 0) -(-0.00529693 0.0759204 0) -(-0.00632764 0.0756554 0) -(-0.00857929 0.0748667 0) -(-0.00947641 0.0733598 0) -(-0.0107941 0.0722133 0) -(-0.010854 0.0697039 0) -(-0.0102928 0.0666245 0) -(-0.00963178 0.0614168 0) -(-0.00908917 0.0558574 0) -(-0.00837295 0.0478907 0) -(-0.00766772 0.0392212 0) -(-0.00585876 0.0344989 0) -(-0.00324352 0.0428294 0) -(-0.00206952 0.05481 0) -(-0.00192363 0.0560593 0) -(-0.000889134 0.0316408 0) -(-8.61034e-05 0.0148961 0) -(0.000634069 0.0452522 0) -(0.000627484 0.056128 0) -(-0.000661189 0.062166 0) -(-0.00211933 0.0651315 0) -(-0.00379582 0.0664434 0) -(-0.0049347 0.0656931 0) -(-0.00556715 0.0603197 0) -(-0.00621368 0.0539765 0) -(-0.0064416 0.0491056 0) -(-0.00665564 0.0462538 0) -(-0.00688395 0.0422472 0) -(-0.00716632 0.039176 0) -(-0.0071072 0.0404775 0) -(-0.00720542 0.0423664 0) -(-0.00652677 0.0416549 0) -(-0.00691073 0.0392317 0) -(-0.00706747 0.034473 0) -(-0.00778003 0.0291014 0) -(-0.0082399 0.0166819 0) -(-0.00590701 0.00709291 0) -(-0.0026857 0.0173647 0) -(0.000246555 0.0365611 0) -(0.000932857 0.040609 0) -(1.43618e-05 0.0181046 0) -(6.90221e-05 0.0227105 0) -(0.000972261 0.0483872 0) -(0.00210597 0.0653144 0) -(0.00177564 0.0698403 0) -(0.00179897 0.0711708 0) -(0.000282096 0.0736208 0) -(-0.000214332 0.0765497 0) -(-0.000617432 0.0756276 0) -(-0.000590557 0.0748067 0) -(-0.00166972 0.0742995 0) -(-0.00217442 0.0740852 0) -(-0.00362413 0.0730762 0) -(-0.00442812 0.071181 0) -(-0.00570316 0.0692549 0) -(-0.00662594 0.065727 0) -(-0.00929225 0.0628918 0) -(-0.0099458 0.0598605 0) -(-0.0102085 0.054762 0) -(-0.0101435 0.0476179 0) -(-0.00947758 0.0320287 0) -(-0.00795288 0.0192686 0) -(-0.00409102 0.0261446 0) -(-0.00136555 0.0437056 0) -(-0.000273246 0.0535679 0) -(-0.000468439 0.0307009 0) -(-0.000482653 0.0148155 0) -(-0.000210333 0.0430514 0) -(-0.000649454 0.0565092 0) -(-0.000709084 0.0651379 0) -(-0.00183836 0.0707304 0) -(-0.00260624 0.0731516 0) -(-0.00289267 0.0701625 0) -(-0.00297848 0.0635408 0) -(-0.00290129 0.0587764 0) -(-0.00246732 0.0553257 0) -(-0.00232053 0.0531068 0) -(-0.00202011 0.050043 0) -(-0.00239146 0.0464371 0) -(-0.00288795 0.0482332 0) -(-0.00358318 0.0530222 0) -(-0.00403609 0.0520443 0) -(-0.00461004 0.0438574 0) -(-0.00507318 0.0379698 0) -(-0.00487897 0.0300219 0) -(-0.00503163 0.0148737 0) -(-0.0044699 -0.00231427 0) -(-0.00180411 0.00560353 0) -(0.00111937 0.0307654 0) -(0.00137975 0.0415677 0) -(-6.5017e-05 0.0192573 0) -(0.000154227 0.0221408 0) -(0.000831073 0.0465661 0) -(0.00196378 0.0643843 0) -(0.000991177 0.0703509 0) -(0.00192951 0.0731564 0) -(0.00215767 0.0738976 0) -(0.00361954 0.0749689 0) -(0.0032643 0.0732098 0) -(0.00274641 0.0713266 0) -(0.00177121 0.0703531 0) -(0.00119458 0.0705353 0) -(0.000457795 0.0705964 0) -(-0.00105068 0.0704228 0) -(-0.00282823 0.0692495 0) -(-0.00283751 0.0655087 0) -(-0.00271662 0.0624402 0) -(-0.00394709 0.0594688 0) -(-0.00682997 0.0525935 0) -(-0.00896154 0.0449431 0) -(-0.0113863 0.0284452 0) -(-0.0101195 0.0094908 0) -(-0.00576168 0.0110592 0) -(-0.00141511 0.0339685 0) -(-0.000184051 0.0535972 0) -(-0.000390543 0.0309184 0) -(0.000250334 0.0146883 0) -(-0.00116077 0.0410085 0) -(-0.000607842 0.0583253 0) -(0.000623438 0.0670997 0) -(0.000626773 0.0703409 0) -(0.00102934 0.0714644 0) -(0.00101064 0.0699733 0) -(0.00215279 0.0679278 0) -(0.00194893 0.0644388 0) -(0.00224381 0.0613804 0) -(0.0018758 0.0585361 0) -(0.00225657 0.0575628 0) -(0.002201 0.056449 0) -(0.00257885 0.0546076 0) -(0.00194442 0.0556921 0) -(0.00137974 0.0567111 0) -(0.000790356 0.0559749 0) -(-0.000693834 0.0515105 0) -(-0.00246095 0.0426869 0) -(-0.00435634 0.0200381 0) -(-0.0046594 -0.0123244 0) -(-0.00240587 -0.0112653 0) -(0.000127061 0.0208291 0) -(0.00100678 0.0418954 0) -(0.000178237 0.0204995 0) -(-3.47705e-05 0.0221259 0) -(0.000168322 0.0466435 0) -(0.000606035 0.0581834 0) -(0.00209966 0.0658211 0) -(0.00291758 0.0700834 0) -(0.00373258 0.0710174 0) -(0.00465223 0.0702379 0) -(0.00542186 0.0688238 0) -(0.00634204 0.0688285 0) -(0.00646058 0.0680056 0) -(0.00635787 0.0680063 0) -(0.00541188 0.0674845 0) -(0.00480507 0.0670948 0) -(0.00347078 0.0674545 0) -(0.00225916 0.0654976 0) -(0.00185056 0.0628573 0) -(0.00145202 0.0612726 0) -(0.000794784 0.0576345 0) -(-0.000266685 0.050504 0) -(-0.00234926 0.0311307 0) -(-0.00389543 0.00262073 0) -(-0.0023423 -0.00187042 0) -(0.000792318 0.0238221 0) -(0.00177742 0.0512227 0) -(-0.000137857 0.0310889 0) -(-0.000341015 0.0163751 0) -(0.000693643 0.04145 0) -(0.00112016 0.0561378 0) -(0.00168389 0.0637979 0) -(0.00254669 0.0688043 0) -(0.00315952 0.0695811 0) -(0.00401955 0.0683637 0) -(0.00447847 0.0663724 0) -(0.00500263 0.0643315 0) -(0.00572865 0.0636441 0) -(0.006171 0.0632924 0) -(0.00667487 0.0633355 0) -(0.00676439 0.0631104 0) -(0.00689083 0.0627547 0) -(0.00700441 0.061495 0) -(0.00631699 0.0610127 0) -(0.00571111 0.0604527 0) -(0.00460875 0.0577279 0) -(0.0035155 0.0517286 0) -(0.00139706 0.0307053 0) -(-3.4248e-05 -0.0103453 0) -(-0.000763431 -0.0192348 0) -(-0.00137342 0.0137521 0) -(-0.000775117 0.0464732 0) -(-0.000315151 0.026368 0) -(-0.000277026 0.019399 0) -(-0.000208676 0.0414544 0) -(0.000588077 0.054035 0) -(0.00160943 0.0607068 0) -(0.002845 0.0648347 0) -(0.00427534 0.0657852 0) -(0.00542144 0.0652204 0) -(0.00659942 0.0646493 0) -(0.00707241 0.0638414 0) -(0.00775865 0.0633495 0) -(0.00813385 0.0635637 0) -(0.00860942 0.0640182 0) -(0.00878633 0.0642919 0) -(0.00906341 0.0647026 0) -(0.00889552 0.0644635 0) -(0.00871155 0.0635299 0) -(0.00877684 0.0627959 0) -(0.00864766 0.0604613 0) -(0.00854711 0.0552068 0) -(0.00812161 0.0370192 0) -(0.00666832 0.00536132 0) -(0.00188094 -0.000733165 0) -(-0.00110206 0.0218729 0) -(-0.000958377 0.0465305 0) -(-0.000114652 0.0263982 0) -) -; - -boundaryField -{ - inlet - { - type fixedValue; - value uniform (0 0.1 0); - } - - outlet - { - type inletOutlet; - inletValue uniform (0 0 0); - value nonuniform List<vector> -25 -( -(-0.000277026 0.019399 0) -(-0.000208676 0.0414544 0) -(0.000588077 0.054035 0) -(0.00160943 0.0607068 0) -(0.002845 0.0648347 0) -(0.00427534 0.0657852 0) -(0.00542144 0.0652204 0) -(0.00659942 0.0646493 0) -(0.00707241 0.0638414 0) -(0.00775865 0.0633495 0) -(0.00813385 0.0635637 0) -(0.00860942 0.0640182 0) -(0.00878633 0.0642919 0) -(0.00906341 0.0647026 0) -(0.00889552 0.0644635 0) -(0.00871155 0.0635299 0) -(0.00877684 0.0627959 0) -(0.00864766 0.0604613 0) -(0.00854711 0.0552068 0) -(0.00812161 0.0370192 0) -(0.00666832 0.00536132 0) -(0.00188094 -0.000733165 0) -(-0.00110206 0.0218729 0) -(-0.000958377 0.0465305 0) -(-0.000114652 0.0263982 0) -) -; - } - - walls - { - type fixedValue; - value uniform (0 0 0); - } - - defaultFaces - { - type empty; - } -} - -// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/U2 b/tutorials/multiphase/bubbleFoam/bubbleColumn/0/U2 deleted file mode 100644 index b77b5382110025b5a5f71caedc492c79a176ded3..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/U2 +++ /dev/null @@ -1,1956 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volVectorField; - object U2; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -1 0 0 0 0]; - -internalField nonuniform List<vector> -1875 -( -(0.141328 -0.587592 0) -(0.407198 -0.393846 0) -(0.471126 -0.270619 0) -(0.508946 -0.195538 0) -(0.523061 -0.14316 0) -(0.539622 -0.0977173 0) -(0.548878 -0.0659859 0) -(0.567946 -0.0430895 0) -(0.578326 -0.0279877 0) -(0.591975 -0.0173755 0) -(0.598382 -0.00543302 0) -(0.602371 0.00298469 0) -(0.602818 0.0244833 0) -(0.582319 0.0349973 0) -(0.557426 0.0670562 0) -(0.490779 0.104966 0) -(0.411761 0.121197 0) -(0.29205 0.167622 0) -(0.205957 0.357008 0) -(-0.0750581 0.261865 0) -(-0.182646 0.0455632 0) -(-0.234558 -0.0957123 0) -(-0.31884 -0.230828 0) -(-0.38533 -0.333269 0) -(-0.121762 -0.618504 0) -(0.0228774 -0.742864 0) -(0.082943 -0.271518 0) -(0.0359799 0.0416798 0) -(0.0442251 0.0662757 0) -(0.0605173 0.0354886 0) -(0.112994 -0.00478512 0) -(0.143369 -0.0322493 0) -(0.17737 -0.0416224 0) -(0.205379 -0.0435591 0) -(0.244187 -0.0337155 0) -(0.266524 -0.0279681 0) -(0.300861 -0.0269897 0) -(0.315941 -0.00488653 0) -(0.316896 0.0292872 0) -(0.304809 0.085202 0) -(0.295386 0.168277 0) -(0.247849 0.328991 0) -(0.18699 0.371779 0) -(0.162611 0.493281 0) -(0.164709 0.55336 0) -(0.0918576 0.406066 0) -(0.0830756 0.362236 0) -(0.00846045 0.465409 0) -(0.0191522 0.0169109 0) -(-0.0389573 -0.629635 0) -(0.00479983 -0.807249 0) -(0.00804917 -0.335873 0) -(-0.0174928 -0.134114 0) -(0.023681 -0.185376 0) -(0.0742247 -0.221152 0) -(0.121909 -0.203071 0) -(0.138184 -0.164171 0) -(0.144453 -0.147616 0) -(0.15823 -0.150581 0) -(0.167622 -0.130841 0) -(0.143162 -0.128813 0) -(0.102984 -0.0830639 0) -(0.0521285 0.0406228 0) -(0.0160529 0.0800667 0) -(-0.0390595 0.132918 0) -(-0.0287579 0.27406 0) -(0.0163274 0.310607 0) -(-0.00736691 0.323679 0) -(0.0418154 0.448216 0) -(-0.00262386 0.49017 0) -(0.055766 0.294311 0) -(0.0782353 0.0551085 0) -(0.0885758 0.187602 0) -(0.0850894 -0.0224171 0) -(-0.0188588 -0.690999 0) -(1.46791e-05 -0.803677 0) -(-0.00718855 -0.30425 0) -(0.00650334 -0.0529118 0) -(0.0244985 -0.195668 0) -(0.0281027 -0.235278 0) -(0.022556 -0.178575 0) -(-0.0117286 -0.0998749 0) -(-0.0290608 -0.096969 0) -(-0.0435147 -0.102997 0) -(-0.0768449 0.0108748 0) -(-0.114896 0.109529 0) -(-0.154653 0.112206 0) -(-0.165648 0.117244 0) -(-0.155625 0.135812 0) -(-0.154801 0.168179 0) -(-0.110043 0.210407 0) -(-0.0383216 0.235033 0) -(-0.0761922 0.282187 0) -(-0.0291805 0.463355 0) -(-0.0771569 0.473508 0) -(0.061873 0.172768 0) -(0.0389505 0.222105 0) -(0.0221948 0.353828 0) -(0.0386762 0.176293 0) -(-0.010499 -0.61329 0) -(-0.00189533 -0.781055 0) -(-0.0365181 -0.34555 0) -(-0.00588702 -0.228562 0) -(0.0160305 -0.292565 0) -(0.00260469 -0.28611 0) -(-0.0356617 -0.180758 0) -(-0.0873849 -0.103015 0) -(-0.124531 -0.113136 0) -(-0.185368 -0.0631684 0) -(-0.208621 0.0372702 0) -(-0.202716 0.0563095 0) -(-0.18878 0.0553577 0) -(-0.18201 0.0562007 0) -(-0.173468 0.0744435 0) -(-0.155375 0.104129 0) -(-0.134083 0.117301 0) -(-0.120484 0.202531 0) -(-0.162523 0.330437 0) -(-0.164869 0.456317 0) -(-0.113519 0.322577 0) -(-0.0114789 0.0362488 0) -(-0.000529388 0.136233 0) -(0.00244512 0.230692 0) -(0.027275 0.0872039 0) -(0.000467767 -0.633673 0) -(-0.00325022 -0.732094 0) -(-0.031785 -0.286604 0) -(-0.040756 -0.236432 0) -(-0.0579675 -0.268754 0) -(-0.0888941 -0.167478 0) -(-0.131313 -0.00881036 0) -(-0.147688 0.0451313 0) -(-0.175941 0.0333486 0) -(-0.207272 0.0367743 0) -(-0.20986 0.0381687 0) -(-0.187629 0.046922 0) -(-0.178911 0.052913 0) -(-0.175672 0.0812691 0) -(-0.177437 0.0960784 0) -(-0.166475 0.110874 0) -(-0.179492 0.172139 0) -(-0.207112 0.31274 0) -(-0.21512 0.359454 0) -(-0.213602 0.358721 0) -(-0.109787 0.0748308 0) -(-0.0314076 -0.127609 0) -(0.0103633 0.154496 0) -(0.0300304 0.266164 0) -(0.0196886 0.182605 0) -(-0.00295027 -0.595477 0) -(-0.00461531 -0.699854 0) -(-0.0335189 -0.245772 0) -(-0.0863643 -0.204575 0) -(-0.125782 -0.206756 0) -(-0.157489 -0.119514 0) -(-0.186664 -0.0151862 0) -(-0.196345 0.0207685 0) -(-0.217759 0.0158033 0) -(-0.223696 0.0115586 0) -(-0.230472 -0.00639501 0) -(-0.233823 -0.00520494 0) -(-0.239565 0.0418247 0) -(-0.241857 0.0782775 0) -(-0.239917 0.0984028 0) -(-0.242954 0.157943 0) -(-0.253126 0.249888 0) -(-0.249963 0.30908 0) -(-0.211175 0.327829 0) -(-0.154898 0.244763 0) -(-0.021435 -0.106602 0) -(-0.0262265 -0.215899 0) -(-0.0155256 0.0490102 0) -(0.0386338 0.237341 0) -(-0.0125229 0.217057 0) -(0.0248543 -0.648682 0) -(-0.00282494 -0.658135 0) -(-0.0281092 -0.118291 0) -(-0.108293 -0.0794797 0) -(-0.146892 -0.114212 0) -(-0.166241 -0.00993724 0) -(-0.199463 0.109011 0) -(-0.221044 0.127126 0) -(-0.262537 0.106789 0) -(-0.280071 0.0874168 0) -(-0.304304 0.0699351 0) -(-0.330763 0.0783221 0) -(-0.346742 0.102479 0) -(-0.350277 0.118439 0) -(-0.348213 0.149831 0) -(-0.342132 0.190307 0) -(-0.307604 0.226971 0) -(-0.238452 0.239965 0) -(-0.126559 0.14176 0) -(-0.00226976 -0.0514187 0) -(0.0715288 -0.205662 0) -(0.0457356 -0.154447 0) -(-0.0543987 0.033337 0) -(0.00153217 0.267173 0) -(-0.0523456 0.260674 0) -(0.0515815 -0.657791 0) -(-0.0042388 -0.641036 0) -(-0.0144542 -0.0231465 0) -(-0.0924468 0.0221748 0) -(-0.166495 -0.0535047 0) -(-0.17046 0.0113704 0) -(-0.187187 0.154589 0) -(-0.186326 0.186315 0) -(-0.22657 0.17605 0) -(-0.249646 0.147332 0) -(-0.282787 0.135649 0) -(-0.308191 0.133375 0) -(-0.320306 0.133493 0) -(-0.320954 0.135237 0) -(-0.316922 0.127562 0) -(-0.297588 0.0999883 0) -(-0.268281 0.0341976 0) -(-0.210512 -0.105244 0) -(-0.14677 -0.200443 0) -(-0.095961 -0.218758 0) -(-0.124224 -0.197037 0) -(-0.174899 0.0402852 0) -(-0.203208 0.187373 0) -(-0.163869 0.226427 0) -(-0.073401 0.125654 0) -(0.0648069 -0.651497 0) -(0.00963547 -0.636309 0) -(-0.021823 0.0202224 0) -(0.00442565 0.25421 0) -(-0.146693 0.0398455 0) -(-0.163799 0.050874 0) -(-0.158574 0.161816 0) -(-0.143021 0.234515 0) -(-0.149025 0.249563 0) -(-0.163294 0.23226 0) -(-0.187975 0.209808 0) -(-0.204073 0.183553 0) -(-0.21345 0.158689 0) -(-0.206414 0.127527 0) -(-0.200531 0.105585 0) -(-0.182087 0.0785725 0) -(-0.165823 0.0386821 0) -(-0.16238 -0.0363184 0) -(-0.206799 -0.138972 0) -(-0.232001 -0.165309 0) -(-0.315408 -0.075936 0) -(-0.350429 0.060434 0) -(-0.317785 0.0804353 0) -(-0.234297 -0.0199362 0) -(-0.0537424 -0.326032 0) -(0.0394164 -0.591598 0) -(0.0160432 -0.637747 0) -(-0.0167472 -0.0370706 0) -(0.0700601 0.319342 0) -(-0.00011737 0.305692 0) -(-0.123859 0.0752975 0) -(-0.129703 0.128666 0) -(-0.134618 0.210706 0) -(-0.115309 0.243918 0) -(-0.113484 0.245536 0) -(-0.105609 0.233929 0) -(-0.108059 0.197444 0) -(-0.103107 0.147911 0) -(-0.102882 0.111297 0) -(-0.100469 0.0834879 0) -(-0.10245 0.0281695 0) -(-0.110972 -0.00275163 0) -(-0.123564 -0.0202841 0) -(-0.171786 -0.0455071 0) -(-0.243411 0.00730176 0) -(-0.322536 0.0901807 0) -(-0.352229 0.0716724 0) -(-0.298381 -0.101472 0) -(-0.173246 -0.368227 0) -(-0.0958428 -0.534607 0) -(-0.0478101 -0.631696 0) -(-0.00605675 -0.678005 0) -(0.0600641 -0.0889499 0) -(0.0715667 0.140341 0) -(0.166609 0.523257 0) -(0.0131515 0.35006 0) -(-0.0831248 0.202151 0) -(-0.114929 0.226442 0) -(-0.117191 0.229745 0) -(-0.112581 0.218291 0) -(-0.0884068 0.202984 0) -(-0.0660003 0.170927 0) -(-0.0456544 0.134802 0) -(-0.0359376 0.104045 0) -(-0.0284461 0.0959227 0) -(-0.0375488 0.0978522 0) -(-0.0679028 0.0841385 0) -(-0.105408 0.0955035 0) -(-0.142601 0.113502 0) -(-0.227967 0.15778 0) -(-0.276289 0.172186 0) -(-0.290459 0.0160417 0) -(-0.217142 -0.32267 0) -(-0.179438 -0.481 0) -(-0.134738 -0.646593 0) -(-0.0527305 -0.898435 0) -(-0.00464843 -0.752723 0) -(0.0861668 -0.192141 0) -(0.0832924 -0.018079 0) -(0.167598 0.506777 0) -(0.0908788 0.568434 0) -(-0.0390154 0.433137 0) -(-0.0992553 0.333121 0) -(-0.0989457 0.277312 0) -(-0.117282 0.206658 0) -(-0.0896135 0.143976 0) -(-0.0698513 0.107515 0) -(-0.0283897 0.0784945 0) -(-0.00755728 0.0598762 0) -(0.017426 0.0799018 0) -(0.0281911 0.109849 0) -(0.0296122 0.148962 0) -(-0.00329769 0.163455 0) -(-0.0381909 0.212174 0) -(-0.134705 0.304022 0) -(-0.179129 0.27877 0) -(-0.175798 -0.0424924 0) -(-0.147938 -0.332053 0) -(-0.155526 -0.572853 0) -(-0.0742423 -0.827878 0) -(-0.031722 -1.06452 0) -(-0.00497943 -0.816896 0) -(0.0661569 -0.275501 0) -(0.0411654 -0.0723348 0) -(0.115296 0.521128 0) -(0.0499076 0.771648 0) -(-0.0285514 0.595736 0) -(-0.0954843 0.379592 0) -(-0.0800799 0.30071 0) -(-0.0779072 0.234122 0) -(-0.0679635 0.121367 0) -(-0.0531882 0.0465711 0) -(-0.0291629 0.00329654 0) -(0.0105907 -0.00501976 0) -(0.0266129 0.00723001 0) -(0.0711656 0.0576663 0) -(0.0715542 0.144507 0) -(0.0542078 0.240689 0) -(-0.0329753 0.395554 0) -(-0.0922822 0.461433 0) -(-0.11284 0.294822 0) -(-0.0661122 -0.0283381 0) -(-0.107186 -0.369281 0) -(-0.0681092 -0.692162 0) -(-0.0493278 -0.902297 0) -(-0.0131765 -1.15995 0) -(-0.00529396 -0.854041 0) -(0.0264625 -0.333988 0) -(0.0123356 -0.106993 0) -(0.0656379 0.532297 0) -(0.0548766 0.84728 0) -(0.0392556 0.717724 0) -(-0.0239426 0.456147 0) -(-0.0200907 0.246051 0) -(0.000158709 0.185387 0) -(0.00702713 0.115848 0) -(0.0302902 0.0329831 0) -(0.0363806 -0.0393656 0) -(0.0547254 -0.0522775 0) -(0.0663981 -0.0491431 0) -(0.085558 0.0132205 0) -(0.0840639 0.182426 0) -(0.0199625 0.395905 0) -(-0.0447644 0.518386 0) -(-0.0438389 0.47704 0) -(-0.0462442 0.253125 0) -(0.0190119 -0.0599265 0) -(-0.0211191 -0.32049 0) -(-0.00140919 -0.704402 0) -(-0.0296794 -0.934986 0) -(0.00294744 -1.20717 0) -(-0.00502847 -0.866074 0) -(0.00447177 -0.380753 0) -(0.009953 -0.13218 0) -(0.0151587 0.434369 0) -(0.0512587 0.824786 0) -(0.0503782 0.712343 0) -(0.0673933 0.50062 0) -(0.0554755 0.234709 0) -(0.0729832 0.155077 0) -(0.107537 0.0435273 0) -(0.145697 -0.0350085 0) -(0.158028 -0.0592425 0) -(0.155656 -0.0604752 0) -(0.153577 -0.0482091 0) -(0.147781 0.0343288 0) -(0.0778396 0.287788 0) -(0.0076784 0.526385 0) -(-0.0109194 0.541247 0) -(-0.00801424 0.440228 0) -(0.0447894 0.18005 0) -(0.0377121 -0.0511607 0) -(0.0501829 -0.342464 0) -(0.0466317 -0.675238 0) -(0.0138355 -0.915047 0) -(0.00526552 -1.21379 0) -(-0.00628324 -0.856036 0) -(-0.0382733 -0.375962 0) -(-0.0435875 -0.0466261 0) -(-0.0741799 0.426507 0) -(-0.0120238 0.767415 0) -(-0.00324379 0.653579 0) -(0.11478 0.444471 0) -(0.11688 0.226569 0) -(0.186479 0.0636765 0) -(0.231976 -0.0596767 0) -(0.259375 -0.0920622 0) -(0.260842 -0.087921 0) -(0.257013 -0.0706506 0) -(0.239437 -0.0273109 0) -(0.151717 0.164506 0) -(0.0384009 0.494848 0) -(-0.0110416 0.589157 0) -(0.00991454 0.526979 0) -(0.0389032 0.376089 0) -(0.113176 0.137369 0) -(0.0241961 -0.0703522 0) -(0.0761038 -0.363502 0) -(0.0738838 -0.651921 0) -(0.032841 -0.853651 0) -(0.0181681 -1.17048 0) -(-0.00912479 -0.760123 0) -(-0.0639007 -0.273429 0) -(-0.0836544 0.0186488 0) -(-0.0963249 0.416698 0) -(-0.0592642 0.680638 0) -(-0.0509097 0.397753 0) -(0.118176 0.247523 0) -(0.210302 0.0583809 0) -(0.31141 -0.0701555 0) -(0.344235 -0.101279 0) -(0.367075 -0.0873726 0) -(0.358033 -0.0784151 0) -(0.29556 -0.0338926 0) -(0.173658 0.163807 0) -(0.0323059 0.486972 0) -(-0.0393237 0.62878 0) -(-0.0361694 0.582835 0) -(0.0251427 0.428498 0) -(0.0981398 0.232815 0) -(0.0638067 0.11443 0) -(0.0294412 -0.0574359 0) -(0.095811 -0.414268 0) -(0.0853611 -0.602914 0) -(0.0413674 -0.801703 0) -(0.0203061 -1.10205 0) -(0.00450397 -0.705737 0) -(-0.060549 -0.222994 0) -(-0.0603627 0.0406057 0) -(-0.0604538 0.400014 0) -(0.010791 0.665055 0) -(0.0723317 0.176299 0) -(0.181287 -0.13286 0) -(0.293251 -0.210169 0) -(0.34435 -0.204318 0) -(0.345312 -0.18904 0) -(0.27979 -0.118427 0) -(0.196523 0.0848835 0) -(0.0751319 0.346971 0) -(-0.0523592 0.552147 0) -(-0.105607 0.626239 0) -(-0.107303 0.630356 0) -(-0.0409278 0.445805 0) -(0.0134773 0.223898 0) -(-0.00459444 0.164338 0) -(-0.0285914 0.130422 0) -(0.0795159 -0.15708 0) -(0.108017 -0.427057 0) -(0.0825904 -0.535547 0) -(0.0488153 -0.725901 0) -(0.0143886 -1.03967 0) -(0.0127417 -0.635874 0) -(-0.080797 -0.142085 0) -(-0.0676818 0.0221205 0) -(-0.087376 0.256627 0) -(0.0920228 0.441718 0) -(0.219453 0.0478658 0) -(0.275372 -0.239473 0) -(0.236792 -0.256197 0) -(0.175612 -0.148919 0) -(0.0419573 0.100826 0) -(-0.0159335 0.233402 0) -(-0.0821223 0.407673 0) -(-0.140316 0.537814 0) -(-0.153897 0.585894 0) -(-0.144673 0.59486 0) -(-0.130828 0.458913 0) -(-0.0506682 0.224733 0) -(-0.0588765 0.160775 0) -(-0.031821 0.070989 0) -(0.0335221 -0.00832151 0) -(0.119762 -0.260365 0) -(0.111941 -0.411091 0) -(0.080808 -0.485952 0) -(0.0415036 -0.669329 0) -(0.0239398 -0.969745 0) -(0.015765 -0.560772 0) -(-0.0796842 -0.0476543 0) -(-0.101823 0.0377204 0) -(-0.121939 0.0713156 0) -(0.0251774 -0.0280695 0) -(0.1003 -0.193856 0) -(0.0377616 -0.100762 0) -(-0.116086 0.0263818 0) -(-0.168487 0.114161 0) -(-0.162883 0.214738 0) -(-0.176459 0.33233 0) -(-0.187281 0.457423 0) -(-0.17636 0.527125 0) -(-0.155238 0.560162 0) -(-0.115171 0.553276 0) -(-0.0617492 0.377456 0) -(0.0110144 0.190905 0) -(0.0213497 0.13559 0) -(0.128768 0.0254199 0) -(0.134301 -0.0813305 0) -(0.175739 -0.271087 0) -(0.111957 -0.327556 0) -(0.0931212 -0.401658 0) -(0.0445862 -0.605137 0) -(0.0230658 -0.900848 0) -(0.0120065 -0.52165 0) -(-0.0465004 0.119645 0) -(-0.11873 0.119468 0) -(-0.15585 0.0526239 0) -(-0.162284 -0.030867 0) -(-0.246827 -0.00364903 0) -(-0.311299 0.039828 0) -(-0.31643 0.0947303 0) -(-0.306262 0.167069 0) -(-0.280234 0.242432 0) -(-0.257161 0.34134 0) -(-0.218908 0.423286 0) -(-0.1613 0.462913 0) -(-0.0962842 0.44693 0) -(0.00191533 0.396616 0) -(0.0875455 0.25258 0) -(0.131619 0.11575 0) -(0.146675 0.0541667 0) -(0.177877 -0.0084048 0) -(0.151416 -0.0631711 0) -(0.152428 -0.186928 0) -(0.0958256 -0.239872 0) -(0.0813998 -0.339693 0) -(0.0526949 -0.528782 0) -(0.0181482 -0.816406 0) -(-0.00990437 -0.512476 0) -(-0.00616312 0.257865 0) -(-0.0736314 0.297555 0) -(-0.123616 0.216202 0) -(-0.245059 0.0806595 0) -(-0.324357 0.0573919 0) -(-0.372728 0.0682567 0) -(-0.39257 0.076091 0) -(-0.389243 0.107371 0) -(-0.368765 0.147884 0) -(-0.332843 0.215465 0) -(-0.272673 0.255086 0) -(-0.198142 0.248497 0) -(-0.104689 0.198167 0) -(-0.0195644 0.145198 0) -(0.0523821 0.145558 0) -(0.0785321 0.136651 0) -(0.0912755 0.117247 0) -(0.0917151 0.0748145 0) -(0.0862369 -0.0415884 0) -(0.0852139 -0.162239 0) -(0.057173 -0.207596 0) -(0.0621046 -0.308446 0) -(0.0389606 -0.47988 0) -(0.0192977 -0.747278 0) -(-0.0323951 -0.526524 0) -(0.0287901 0.266351 0) -(-0.0114164 0.346555 0) -(0.0135635 0.413278 0) -(-0.0794306 0.355025 0) -(-0.152411 0.258917 0) -(-0.199423 0.201722 0) -(-0.25261 0.143251 0) -(-0.285052 0.116451 0) -(-0.304071 0.108053 0) -(-0.300215 0.103884 0) -(-0.286285 0.0988546 0) -(-0.249693 0.0525655 0) -(-0.219048 0.00257268 0) -(-0.198662 -0.0121167 0) -(-0.157317 -0.00979547 0) -(-0.0887329 0.0119922 0) -(-0.0370592 0.0207376 0) -(0.0254417 0.023543 0) -(0.0646955 -0.0377082 0) -(0.0674813 -0.127181 0) -(0.0553626 -0.193988 0) -(0.0600558 -0.291493 0) -(0.0491321 -0.431016 0) -(0.0138046 -0.684908 0) -(-0.0554377 -0.515715 0) -(0.0403631 0.198831 0) -(0.0170801 0.304054 0) -(0.0526324 0.373156 0) -(0.0649974 0.427363 0) -(0.0417311 0.363627 0) -(0.0561173 0.308784 0) -(0.0344024 0.252964 0) -(0.0240541 0.201931 0) -(-0.0113325 0.170132 0) -(-0.0205178 0.144001 0) -(-0.0501747 0.115041 0) -(-0.0555406 0.0542483 0) -(-0.0845445 0.0463893 0) -(-0.107912 -0.0105872 0) -(-0.126921 -0.0994882 0) -(-0.110383 -0.120981 0) -(-0.0740087 -0.138441 0) -(-0.0203488 -0.132262 0) -(0.0197271 -0.126592 0) -(0.0375504 -0.137954 0) -(0.0518819 -0.192512 0) -(0.0533115 -0.264374 0) -(0.0452728 -0.368829 0) -(0.01184 -0.608724 0) -(-0.0652443 -0.495563 0) -(0.0544782 0.106084 0) -(0.0641934 0.314641 0) -(0.0267499 0.295559 0) -(0.0609044 0.392867 0) -(0.0813812 0.329044 0) -(0.141386 0.277043 0) -(0.14439 0.242614 0) -(0.164484 0.215323 0) -(0.150891 0.195912 0) -(0.155656 0.17452 0) -(0.140921 0.16208 0) -(0.141963 0.126316 0) -(0.112746 0.0874115 0) -(0.121139 0.06641 0) -(0.097101 0.0130078 0) -(0.0387512 -0.0785452 0) -(0.014831 -0.153835 0) -(0.000194791 -0.174033 0) -(0.0124981 -0.178511 0) -(0.0213051 -0.193302 0) -(0.0444436 -0.226222 0) -(0.0363172 -0.26194 0) -(0.0350105 -0.33072 0) -(0.00231084 -0.562738 0) -(-0.00690599 -0.473525 0) -(0.0298961 -0.200657 0) -(0.160186 0.368583 0) -(0.0444242 0.35397 0) -(0.0722517 0.31122 0) -(0.0669161 0.189339 0) -(0.116539 0.200444 0) -(0.12591 0.218946 0) -(0.153887 0.207962 0) -(0.161991 0.196181 0) -(0.171775 0.171875 0) -(0.174727 0.156636 0) -(0.185728 0.134227 0) -(0.18249 0.0874118 0) -(0.195502 0.0530592 0) -(0.207473 0.0429468 0) -(0.197119 0.0167141 0) -(0.168999 -0.0636777 0) -(0.129633 -0.120225 0) -(0.107102 -0.153251 0) -(0.0844121 -0.185625 0) -(0.0764674 -0.218903 0) -(0.0497723 -0.239604 0) -(0.0347453 -0.297959 0) -(0.000835631 -0.526742 0) -(0.0434272 -0.508472 0) -(-0.00245697 -0.34179 0) -(0.140425 0.313556 0) -(0.139668 0.426683 0) -(0.132491 0.338531 0) -(0.0776437 0.19962 0) -(0.0508353 0.163614 0) -(0.0558915 0.160603 0) -(0.0811297 0.144092 0) -(0.114711 0.164357 0) -(0.13716 0.154078 0) -(0.161918 0.143056 0) -(0.182614 0.126522 0) -(0.202622 0.0771959 0) -(0.209639 0.0325766 0) -(0.22341 0.0210046 0) -(0.23117 0.00758103 0) -(0.224106 -0.0362851 0) -(0.192797 -0.0798443 0) -(0.155805 -0.0840634 0) -(0.118823 -0.112241 0) -(0.0969732 -0.143962 0) -(0.0631112 -0.165946 0) -(0.0382719 -0.226468 0) -(-0.00279704 -0.482966 0) -(0.0318007 -0.552667 0) -(0.0110758 -0.360617 0) -(0.055706 0.0106889 0) -(0.241117 0.337863 0) -(0.248953 0.407336 0) -(0.223642 0.341254 0) -(0.111755 0.217367 0) -(0.067144 0.154599 0) -(0.0409666 0.0877402 0) -(0.0675786 0.0889569 0) -(0.104083 0.0766849 0) -(0.138849 0.0661065 0) -(0.171811 0.062172 0) -(0.190036 0.038931 0) -(0.18998 0.0290067 0) -(0.187934 0.0351048 0) -(0.180689 0.0395141 0) -(0.176422 0.0256545 0) -(0.149298 0.0141135 0) -(0.120961 -0.00608253 0) -(0.0999667 -0.0621907 0) -(0.0829492 -0.0973883 0) -(0.0537402 -0.111246 0) -(0.0279118 -0.159416 0) -(-0.00348037 -0.450794 0) -(-0.00131269 -0.615393 0) -(0.0526006 -0.362766 0) -(0.0885479 -0.272343 0) -(0.198163 0.0127411 0) -(0.314129 0.321658 0) -(0.324467 0.472186 0) -(0.269044 0.459088 0) -(0.171737 0.304611 0) -(0.08092 0.137817 0) -(0.0402267 0.0394506 0) -(0.0595369 0.00723824 0) -(0.0665376 0.00767564 0) -(0.0739504 0.0324211 0) -(0.0768002 0.0528203 0) -(0.0813303 0.0567844 0) -(0.077895 0.0644389 0) -(0.0762383 0.0596264 0) -(0.0813588 0.0469026 0) -(0.086707 0.042376 0) -(0.0939943 0.0157405 0) -(0.0872962 -0.0382245 0) -(0.0726993 -0.048049 0) -(0.0398602 -0.0489157 0) -(0.0176133 -0.103853 0) -(-0.00235635 -0.433684 0) -(0.0108666 -0.683658 0) -(0.0587422 -0.533914 0) -(0.144533 -0.337999 0) -(0.165859 -0.175201 0) -(0.24986 0.154183 0) -(0.310588 0.416794 0) -(0.34105 0.555056 0) -(0.290969 0.524821 0) -(0.1991 0.369865 0) -(0.0781573 0.129703 0) -(0.0250862 0.0310259 0) -(0.00224413 0.0409705 0) -(-0.0227009 0.0511548 0) -(-0.0266613 0.0283099 0) -(-0.0260723 0.0301902 0) -(-0.0108984 0.0452663 0) -(0.0131347 0.0350406 0) -(0.0343355 0.00125637 0) -(0.0646541 -0.0130759 0) -(0.0849039 -0.0103723 0) -(0.0820883 -0.0161553 0) -(0.057671 0.00524627 0) -(0.0302551 0.00699213 0) -(0.0103747 -0.0659985 0) -(0.000714226 -0.423919 0) -(0.0245603 -0.78384 0) -(0.0613749 -0.650976 0) -(0.113691 -0.530118 0) -(0.16506 -0.213175 0) -(0.151863 0.026944 0) -(0.22399 0.334263 0) -(0.273741 0.533322 0) -(0.274904 0.603735 0) -(0.245253 0.556227 0) -(0.170789 0.395414 0) -(0.074067 0.170476 0) -(0.0321165 0.118241 0) -(-0.0098076 0.0955603 0) -(-0.0389737 0.0532779 0) -(-0.0577222 0.00609831 0) -(-0.0291821 -0.0273601 0) -(0.00208681 -0.0478301 0) -(0.0358219 -0.0705262 0) -(0.0562599 -0.0622995 0) -(0.072392 -0.0223857 0) -(0.060153 0.0252537 0) -(0.0331496 0.0670785 0) -(0.0264923 0.0484509 0) -(0.00443797 -0.0407328 0) -(0.00194611 -0.421197 0) -(0.00800689 -0.876982 0) -(0.0467447 -0.740743 0) -(0.0571526 -0.600843 0) -(0.0830832 -0.273779 0) -(0.0501711 0.0151921 0) -(0.0747706 0.221892 0) -(0.145479 0.470573 0) -(0.189759 0.602014 0) -(0.180918 0.571978 0) -(0.152343 0.477984 0) -(0.0747413 0.303399 0) -(0.0475676 0.223897 0) -(0.00239068 0.197412 0) -(-0.023737 0.121708 0) -(-0.0350205 8.64307e-06 0) -(-0.00430099 -0.0891615 0) -(0.0186832 -0.11216 0) -(0.045255 -0.113633 0) -(0.0521649 -0.081771 0) -(0.0542314 -0.00357292 0) -(0.0196266 0.072391 0) -(0.00643038 0.0854042 0) -(0.0275128 0.0653283 0) -(-0.00383825 -0.0173229 0) -(0.00389471 -0.422112 0) -(-0.00371036 -0.897268 0) -(0.00361706 -0.76279 0) -(-0.0214306 -0.612449 0) -(-0.0166473 -0.185119 0) -(-0.0574046 0.0833044 0) -(-0.0526381 0.189572 0) -(0.0296727 0.378627 0) -(0.102907 0.576425 0) -(0.0989364 0.639277 0) -(0.0867511 0.569991 0) -(0.0366425 0.365771 0) -(0.00842057 0.267055 0) -(-0.00865605 0.238615 0) -(-0.0184412 0.128305 0) -(0.00344795 -0.030025 0) -(0.027736 -0.138928 0) -(0.0445904 -0.153121 0) -(0.0595281 -0.135606 0) -(0.0481561 -0.0788869 0) -(0.00512038 0.0630083 0) -(-0.0238472 0.138237 0) -(-0.0128722 0.0512843 0) -(0.0186787 0.0579933 0) -(-0.00601231 -0.000103004 0) -(0.00202937 -0.427716 0) -(-0.013944 -0.878726 0) -(-0.0214961 -0.724682 0) -(-0.0541008 -0.58999 0) -(-0.0326117 -0.15975 0) -(-0.0338793 0.0513378 0) -(-0.0647639 0.0592487 0) -(-0.00426192 0.22268 0) -(0.0243695 0.498823 0) -(0.0303826 0.618095 0) -(0.0241493 0.573736 0) -(-0.0138117 0.438574 0) -(-0.037928 0.313887 0) -(-0.0389408 0.239907 0) -(-0.0243783 0.10198 0) -(0.0197862 -0.101906 0) -(0.0254727 -0.176428 0) -(0.0391877 -0.179607 0) -(0.0412259 -0.120853 0) -(-0.00834411 0.0475824 0) -(-0.0455479 0.155021 0) -(-0.0488253 0.113025 0) -(-0.033537 -0.01114 0) -(-0.00646106 0.0436291 0) -(-0.00400594 0.0071718 0) -(-0.0024336 -0.432948 0) -(-0.0115444 -0.831409 0) -(-0.0254689 -0.692633 0) -(-0.0575779 -0.575702 0) -(-0.0635187 -0.223816 0) -(-0.00450069 0.0388722 0) -(-0.0106727 0.00824413 0) -(-0.0808397 0.214504 0) -(-0.0612216 0.546008 0) -(-0.077674 0.662833 0) -(-0.0827792 0.625657 0) -(-0.105406 0.462827 0) -(-0.082612 0.310072 0) -(-0.0855179 0.199927 0) -(-0.029413 -0.0085088 0) -(-0.0189524 -0.138085 0) -(-0.0137388 -0.183792 0) -(-0.0174596 -0.183899 0) -(-0.00939243 -0.0299813 0) -(-0.0484137 0.117664 0) -(-0.0363218 0.161431 0) -(-0.0416913 0.10208 0) -(-0.0256862 -0.0545975 0) -(-0.0171822 -0.00708124 0) -(0.00130615 -0.0181004 0) -(-0.00813366 -0.441256 0) -(-0.0113373 -0.794453 0) -(-0.0340011 -0.630462 0) -(-0.0669113 -0.503886 0) -(-0.0982418 -0.246477 0) -(-0.0686895 0.0508848 0) -(-0.0637725 0.131868 0) -(-0.156454 0.366873 0) -(-0.162305 0.60152 0) -(-0.171395 0.653805 0) -(-0.153303 0.586602 0) -(-0.155853 0.403422 0) -(-0.120163 0.261761 0) -(-0.108468 0.119058 0) -(-0.0625624 -0.0568941 0) -(-0.0736803 -0.135465 0) -(-0.0610592 -0.179465 0) -(-0.0622254 -0.179759 0) -(-0.0418362 -0.0338903 0) -(-0.0215314 0.106747 0) -(-0.021664 0.144357 0) -(-0.0106339 0.0850826 0) -(-0.0296184 -0.0678458 0) -(-0.0241504 -0.0119647 0) -(0.00994749 -0.00549684 0) -(-0.00945753 -0.444521 0) -(-0.00903921 -0.731621 0) -(-0.0328939 -0.579268 0) -(-0.0472288 -0.438279 0) -(-0.11264 -0.223663 0) -(-0.089146 0.0597895 0) -(-0.0993074 0.274784 0) -(-0.1377 0.47224 0) -(-0.1371 0.615542 0) -(-0.134675 0.647399 0) -(-0.130044 0.567021 0) -(-0.131012 0.357687 0) -(-0.107551 0.206221 0) -(-0.0801345 0.0558088 0) -(-0.0828917 -0.0790453 0) -(-0.0928677 -0.145906 0) -(-0.082677 -0.201601 0) -(-0.0764561 -0.214669 0) -(-0.0580826 -0.120577 0) -(0.00502575 0.0765223 0) -(0.0136371 0.136203 0) -(0.0351002 0.119449 0) -(0.00909063 -0.0147364 0) -(-0.0138638 -0.0940196 0) -(0.00798782 -0.0423659 0) -(0.00483087 -0.44105 0) -(-0.00754343 -0.700847 0) -(-0.0103535 -0.536983 0) -(-0.0349301 -0.351701 0) -(-0.0764236 -0.146783 0) -(-0.0635204 0.0770318 0) -(-0.058244 0.286112 0) -(-0.0462264 0.496599 0) -(-0.0596256 0.604872 0) -(-0.0406096 0.628101 0) -(-0.0427286 0.568527 0) -(-0.0413914 0.334428 0) -(-0.0451454 0.166826 0) -(-0.0297369 0.0541 0) -(-0.0694415 -0.0226136 0) -(-0.0748563 -0.126135 0) -(-0.0867941 -0.205791 0) -(-0.0790539 -0.228993 0) -(-0.0785368 -0.208842 0) -(-0.0175675 -0.0498657 0) -(0.0213058 0.0731548 0) -(0.0316899 0.102643 0) -(0.041694 0.0540022 0) -(0.0231377 -0.0220054 0) -(-0.022522 -0.0353829 0) -(0.0339004 -0.431019 0) -(0.0035798 -0.693916 0) -(0.00575097 -0.529798 0) -(-0.00307455 -0.326742 0) -(-0.0136463 -0.1307 0) -(-0.0449139 -0.011883 0) -(0.0117614 0.242269 0) -(0.0149358 0.485398 0) -(0.0372402 0.59409 0) -(0.0560233 0.606059 0) -(0.0755244 0.571621 0) -(0.0825096 0.401326 0) -(0.0630843 0.200892 0) -(0.0419961 0.101282 0) -(0.0137639 0.0136154 0) -(-0.00524059 -0.108115 0) -(-0.0688746 -0.200168 0) -(-0.10708 -0.244701 0) -(-0.126544 -0.251069 0) -(-0.0905762 -0.147044 0) -(-0.0370766 0.0283424 0) -(-0.0308911 0.0745732 0) -(-0.0196483 0.0101632 0) -(-0.0436184 0.0253025 0) -(-0.0595427 -0.0680617 0) -(0.0454473 -0.43349 0) -(-0.000247182 -0.719786 0) -(0.00838669 -0.537378 0) -(0.00341359 -0.321243 0) -(-0.00337143 -0.0698042 0) -(-0.0259893 0.045169 0) -(0.00906771 0.17693 0) -(0.0791879 0.411716 0) -(0.109752 0.512161 0) -(0.137105 0.528732 0) -(0.163035 0.508789 0) -(0.181335 0.414123 0) -(0.178958 0.28085 0) -(0.160191 0.16842 0) -(0.159562 0.062993 0) -(0.142995 0.0322609 0) -(0.112776 0.00632181 0) -(0.0576062 -0.0888365 0) -(0.0172642 -0.219018 0) -(-0.0436172 -0.235461 0) -(-0.00623148 -0.0643457 0) -(-0.0046264 0.0782112 0) -(-0.000443009 0.0622652 0) -(-0.0822873 0.0587841 0) -(-0.0395527 -0.252374 0) -(-0.0071907 -0.445885 0) -(-0.0105171 -0.720536 0) -(-0.0285421 -0.540841 0) -(-0.0495969 -0.326955 0) -(-0.0428772 -0.157969 0) -(-0.000868744 -0.0738137 0) -(-0.032613 0.0113483 0) -(0.0217245 0.262471 0) -(0.0590134 0.444166 0) -(0.0972226 0.465512 0) -(0.134317 0.445024 0) -(0.176863 0.381532 0) -(0.194592 0.276271 0) -(0.210406 0.15524 0) -(0.217718 0.0515539 0) -(0.209083 0.0103244 0) -(0.222214 -0.0201371 0) -(0.22857 -0.0598267 0) -(0.206298 -0.0621933 0) -(0.157075 -0.0820821 0) -(0.115236 -0.0602465 0) -(0.101372 0.0804415 0) -(0.0807076 0.152177 0) -(-0.0314289 0.167626 0) -(0.00682663 -0.282176 0) -(-0.0426736 -0.504251 0) -(-0.0269745 -0.627012 0) -(-0.0914098 -0.432769 0) -(-0.17404 -0.248357 0) -(-0.191885 -0.122077 0) -(-0.182255 -0.00536862 0) -(-0.197483 0.104896 0) -(-0.167355 0.248493 0) -(-0.111003 0.353218 0) -(-0.0188841 0.349289 0) -(0.056297 0.316977 0) -(0.139111 0.27951 0) -(0.193062 0.21655 0) -(0.242326 0.130635 0) -(0.276056 0.07123 0) -(0.295915 0.0297194 0) -(0.314165 -0.0235287 0) -(0.321424 -0.0772776 0) -(0.296091 -0.0978562 0) -(0.257986 -0.0727345 0) -(0.186805 0.029846 0) -(0.130475 0.17157 0) -(0.0741811 0.318109 0) -(-0.0027529 0.25893 0) -(0.0558028 -0.227689 0) -(-0.024902 -0.515884 0) -(-0.0244759 -0.482004 0) -(-0.0652151 -0.267098 0) -(-0.162573 -0.0758743 0) -(-0.237181 -0.0292135 0) -(-0.259213 0.00958625 0) -(-0.256269 0.0543854 0) -(-0.220738 0.117731 0) -(-0.15044 0.124764 0) -(-0.0561576 0.0736206 0) -(0.0340867 0.0809769 0) -(0.109216 0.0689617 0) -(0.190585 0.0444365 0) -(0.240682 -0.0188093 0) -(0.285407 -0.0596636 0) -(0.304524 -0.0645571 0) -(0.29693 -0.0596631 0) -(0.26923 -0.00820226 0) -(0.213973 0.0824263 0) -(0.16186 0.126001 0) -(0.099846 0.193575 0) -(0.0493437 0.326624 0) -(-0.00527684 0.412709 0) -(-0.0212279 0.229601 0) -(0.0741937 -0.206354 0) -(0.00758996 -0.464096 0) -(-0.00638373 -0.43964 0) -(-0.00873959 -0.219817 0) -(-0.0382588 0.0634932 0) -(-0.094645 0.116707 0) -(-0.173019 0.0796797 0) -(-0.20443 0.0491172 0) -(-0.193938 0.0185246 0) -(-0.134463 -0.0275396 0) -(-0.0879747 -0.0654045 0) -(-0.00808231 -0.0655328 0) -(0.0563539 -0.0687485 0) -(0.123718 -0.0721122 0) -(0.160279 -0.0724736 0) -(0.168449 -0.0534129 0) -(0.161518 0.019943 0) -(0.117269 0.0737887 0) -(0.0742605 0.0982619 0) -(0.0475406 0.13413 0) -(0.0264541 0.191956 0) -(-0.0192247 0.286969 0) -(-0.0706652 0.409172 0) -(-0.106588 0.441353 0) -(-0.0399329 0.0512753 0) -(0.0468015 -0.228689 0) -(0.00195889 -0.402905 0) -(0.00441338 -0.446866 0) -(0.0130641 -0.243283 0) -(0.0200353 0.0805649 0) -(-0.0122968 0.271098 0) -(-0.0442404 0.282837 0) -(-0.0952864 0.119459 0) -(-0.114869 -0.0240157 0) -(-0.114487 -0.110129 0) -(-0.0797233 -0.198958 0) -(-0.0238056 -0.235138 0) -(0.0354068 -0.220393 0) -(0.0752814 -0.180147 0) -(0.100511 -0.111191 0) -(0.089732 -0.0557601 0) -(0.0768232 0.0600091 0) -(0.0473348 0.13096 0) -(0.0060725 0.145315 0) -(-0.00517386 0.199564 0) -(-0.0464532 0.290458 0) -(-0.095767 0.429543 0) -(-0.136434 0.490945 0) -(-0.133557 0.345665 0) -(-0.0243917 -0.166363 0) -(-0.0443889 -0.249286 0) -(0.00549513 -0.398134 0) -(-0.00217839 -0.477162 0) -(0.00200214 -0.264692 0) -(-0.00837839 0.0757573 0) -(-0.0139887 0.249649 0) -(0.0190361 0.273903 0) -(0.0243254 0.211448 0) -(0.0038123 0.0711044 0) -(0.00522994 -0.104554 0) -(0.0252126 -0.2646 0) -(0.0445795 -0.319625 0) -(0.0724582 -0.298821 0) -(0.0852656 -0.228057 0) -(0.0822151 -0.114058 0) -(0.0483237 -0.0104598 0) -(0.0256976 0.113382 0) -(0.0083102 0.215173 0) -(-0.0145197 0.209425 0) -(-0.0359861 0.264432 0) -(-0.106531 0.41087 0) -(-0.13283 0.485385 0) -(-0.156625 0.485253 0) -(-0.0825803 0.211999 0) -(0.00114434 -0.187567 0) -(-0.0546634 -0.269723 0) -(-0.000103809 -0.461229 0) -(-0.0088826 -0.44498 0) -(-0.0422454 -0.229585 0) -(-0.036049 0.100767 0) -(-0.0473325 0.191251 0) -(-0.0126067 0.214174 0) -(0.0197036 0.163584 0) -(0.0354901 0.0373241 0) -(0.057499 -0.139985 0) -(0.0708144 -0.283997 0) -(0.0679167 -0.359748 0) -(0.0629902 -0.319942 0) -(0.0339263 -0.229064 0) -(-0.00440347 -0.0678066 0) -(-0.0307507 0.0481003 0) -(-0.0395318 0.147007 0) -(-0.0264717 0.220144 0) -(-0.034644 0.247571 0) -(-0.0785572 0.402146 0) -(-0.1349 0.51369 0) -(-0.130908 0.529052 0) -(-0.16681 0.399229 0) -(-0.0513543 -0.0575074 0) -(-0.0507788 -0.233635 0) -(-0.00853716 -0.285726 0) -(-0.0216824 -0.485979 0) -(-0.00618738 -0.373833 0) -(-0.0466986 -0.211752 0) -(-0.0213357 0.107222 0) -(-0.0406577 0.179485 0) -(-0.0457251 0.127371 0) -(-0.01008 0.0980441 0) -(0.00998935 -0.0192561 0) -(0.0286711 -0.181355 0) -(0.0163512 -0.286631 0) -(-0.0315049 -0.310414 0) -(-0.0747321 -0.263968 0) -(-0.106994 -0.111561 0) -(-0.105139 0.019691 0) -(-0.0912111 0.0533672 0) -(-0.0745554 0.102086 0) -(-0.0463741 0.210867 0) -(-0.0639763 0.323273 0) -(-0.0809978 0.476543 0) -(-0.0927414 0.533241 0) -(-0.0817802 0.529529 0) -(-0.0842564 0.307821 0) -(-0.0207394 -0.125601 0) -(-0.0848337 -0.286324 0) -(-0.0160712 -0.372935 0) -(-0.00803756 -0.542753 0) -(0.000661295 -0.332266 0) -(-0.0248341 -0.205371 0) -(0.00802478 0.0905487 0) -(-0.0138493 0.228682 0) -(-0.0660189 0.138604 0) -(-0.0455257 0.0514042 0) -(-0.0375393 -0.0506919 0) -(-0.0386704 -0.141528 0) -(-0.0943103 -0.188558 0) -(-0.143807 -0.228424 0) -(-0.176979 -0.213718 0) -(-0.181054 -0.132914 0) -(-0.149546 -0.0332506 0) -(-0.124146 -0.0072303 0) -(-0.114721 0.0571358 0) -(-0.0844785 0.208492 0) -(-0.0837437 0.321873 0) -(-0.066615 0.45336 0) -(-0.0408406 0.507019 0) -(-0.0159356 0.50784 0) -(0.0162631 0.309693 0) -(0.0706292 -0.0416025 0) -(0.0174008 -0.247467 0) -(-0.0077547 -0.403622 0) -(0.00663491 -0.561562 0) -(-0.00241131 -0.318437 0) -(0.00862066 -0.212381 0) -(0.0159021 0.0336673 0) -(0.0227526 0.353997 0) -(-0.0676355 0.187302 0) -(-0.0819345 0.0536886 0) -(-0.0880494 -0.0341603 0) -(-0.113729 -0.0812094 0) -(-0.149277 -0.10933 0) -(-0.192909 -0.167289 0) -(-0.209018 -0.17937 0) -(-0.214942 -0.142385 0) -(-0.182388 -0.0533306 0) -(-0.148287 0.00171622 0) -(-0.143562 0.0321404 0) -(-0.121911 0.151426 0) -(-0.0981436 0.280654 0) -(-0.0726724 0.374286 0) -(-0.0277114 0.414466 0) -(0.00350035 0.400433 0) -(0.0603427 0.152085 0) -(0.0766169 -0.0277191 0) -(0.0649097 -0.179535 0) -(0.0129397 -0.364303 0) -(0.0169676 -0.547898 0) -(0.000539339 -0.34159 0) -(0.0230166 -0.232001 0) -(0.0150728 -0.00136642 0) -(0.0340591 0.420291 0) -(-0.0216603 0.346867 0) -(-0.0855472 0.109993 0) -(-0.105224 -0.00490669 0) -(-0.126908 -0.0387489 0) -(-0.128757 -0.047338 0) -(-0.138475 -0.0782259 0) -(-0.182742 -0.156013 0) -(-0.199755 -0.177724 0) -(-0.198264 -0.161577 0) -(-0.151292 -0.0900987 0) -(-0.117459 0.00998191 0) -(-0.0750318 0.110443 0) -(-0.0276301 0.215548 0) -(0.0297146 0.285159 0) -(0.0776065 0.32178 0) -(0.113088 0.315852 0) -(0.165767 0.174617 0) -(0.131059 -0.045947 0) -(0.1238 -0.147063 0) -(0.0834536 -0.314097 0) -(0.027128 -0.50773 0) -(-0.00640002 -0.372165 0) -(-0.0117612 -0.258491 0) -(-0.0304943 -0.00668444 0) -(0.0145426 0.403685 0) -(0.0160334 0.43392 0) -(-0.0245237 0.235324 0) -(-0.0478053 0.0588395 0) -(-0.0630521 -0.0432439 0) -(-0.0597772 -0.082151 0) -(-0.0539114 -0.0630726 0) -(-0.0621662 -0.0467709 0) -(-0.0857745 -0.101541 0) -(-0.117585 -0.15918 0) -(-0.119666 -0.180541 0) -(-0.0869873 -0.158768 0) -(-0.0411484 -0.0778545 0) -(0.0137862 0.0349159 0) -(0.0943465 0.113205 0) -(0.164047 0.215664 0) -(0.198379 0.224527 0) -(0.230619 0.166149 0) -(0.22042 0.0995013 0) -(0.170048 0.0356123 0) -(0.135754 -0.137244 0) -(0.0363462 -0.31685 0) -(-0.0222777 -0.307635 0) -(-0.0692958 -0.214394 0) -(-0.0858586 -0.00753762 0) -(-0.0324638 0.3158 0) -(0.0333185 0.399619 0) -(0.0454058 0.249106 0) -(0.0609184 0.0911454 0) -(0.0580292 0.00911912 0) -(0.049217 -0.0521658 0) -(0.0359809 -0.0614451 0) -(0.0423032 -0.0775769 0) -(0.0396083 -0.0886748 0) -(0.0181569 -0.105499 0) -(-0.0128982 -0.164222 0) -(-0.0255563 -0.185305 0) -(-0.0162336 -0.156808 0) -(0.0199099 -0.128244 0) -(0.0564693 -0.094351 0) -(0.087961 0.0463015 0) -(0.112073 0.15215 0) -(0.122365 0.134884 0) -(0.113548 0.116261 0) -(0.107645 0.0540692 0) -(0.0689118 -0.0764131 0) -(0.0209352 -0.192546 0) -(-0.0315332 -0.192412 0) -(-0.0686858 -0.137452 0) -(-0.10839 -0.0475914 0) -(-0.0718768 0.146592 0) -(0.00681437 0.232806 0) -(0.0602539 0.148317 0) -(0.0804995 0.0242004 0) -(0.0833183 -0.0280797 0) -(0.0811653 -0.0485993 0) -(0.0702633 -0.0487399 0) -(0.0733623 -0.0532095 0) -(0.0615789 -0.0525624 0) -(0.062682 -0.0524797 0) -(0.0338512 -0.0844732 0) -(0.00060668 -0.14277 0) -(-0.0210496 -0.152216 0) -(-0.0228933 -0.125481 0) -(-0.042061 -0.0421874 0) -(-0.0410915 0.0925423 0) -(-0.00875777 0.154263 0) -(0.00420971 0.151165 0) -(0.0252802 0.137326 0) -(0.0448454 0.118536 0) -(0.0383896 0.032904 0) -(0.0157797 -0.124157 0) -(-0.0331419 -0.128155 0) -(-0.067219 -0.07516 0) -(-0.0756359 0.0128783 0) -(-0.0529394 0.0590381 0) -(0.0142884 0.0740224 0) -(0.0696354 0.0487859 0) -(0.106539 0.00822998 0) -(0.118365 -0.0220742 0) -(0.129231 -0.0644743 0) -(0.128804 -0.087833 0) -(0.131305 -0.100756 0) -(0.124272 -0.103994 0) -(0.123365 -0.102886 0) -(0.111787 -0.0969681 0) -(0.0730541 -0.108822 0) -(0.0124598 -0.127882 0) -(-0.0406404 -0.118333 0) -(-0.0848876 -0.0882502 0) -(-0.0857036 -0.0301129 0) -(-0.0477335 0.022999 0) -(-0.0112728 0.0465895 0) -(0.0239885 0.02802 0) -(0.0521362 0.0261431 0) -(0.0701407 -0.0098629 0) -(0.0373998 -0.0786019 0) -(-0.00673444 -0.219765 0) -(-0.0283845 -0.227962 0) -(-0.0254797 -0.22985 0) -(-0.0140949 -0.228841 0) -(-0.0027639 -0.226439 0) -(0.0142837 -0.238473 0) -(0.0202837 -0.251975 0) -(0.0284937 -0.258172 0) -(0.0307065 -0.266238 0) -(0.0276889 -0.265341 0) -(0.0231221 -0.266062 0) -(0.0170449 -0.263633 0) -(0.0113536 -0.252913 0) -(0.0091503 -0.225332 0) -(0.00846185 -0.215207 0) -(0.000598205 -0.20281 0) -(-0.0100236 -0.199304 0) -(-0.0151417 -0.197846 0) -(-0.0149641 -0.215038 0) -(-0.0181196 -0.217788 0) -(-0.00745883 -0.207709 0) -(-0.00119304 -0.19937 0) -(0.00198995 -0.195376 0) -(0.00877605 -0.184208 0) -(0.00557262 -0.175093 0) -(0.000951616 -0.220817 0) -(0.000646376 -0.22906 0) -(-0.00175829 -0.252406 0) -(3.38655e-05 -0.261468 0) -(0.00432832 -0.263665 0) -(0.0113455 -0.271061 0) -(0.0145802 -0.272081 0) -(0.0185238 -0.267449 0) -(0.0138388 -0.257773 0) -(0.00775604 -0.247218 0) -(0.000442243 -0.238152 0) -(-0.00681317 -0.232969 0) -(-0.012252 -0.224375 0) -(-0.0119197 -0.215909 0) -(-0.0108175 -0.215361 0) -(-0.00999649 -0.207724 0) -(-0.011915 -0.210637 0) -(-0.0112612 -0.207572 0) -(-0.0104211 -0.217732 0) -(-0.0136991 -0.221705 0) -(-0.013851 -0.220209 0) -(-0.0140914 -0.212521 0) -(-0.0129349 -0.214773 0) -(-0.0118922 -0.206457 0) -(-0.00789114 -0.203976 0) -(0.00404495 -0.212872 0) -(0.00855767 -0.227665 0) -(0.0101335 -0.24553 0) -(0.00857478 -0.253505 0) -(0.00741543 -0.264429 0) -(0.00663235 -0.266613 0) -(0.00215682 -0.260369 0) -(-0.00399891 -0.253264 0) -(-0.00691501 -0.239346 0) -(-0.00889254 -0.231968 0) -(-0.00930327 -0.225252 0) -(-0.0104286 -0.223236 0) -(-0.0112378 -0.219375 0) -(-0.0119237 -0.213891 0) -(-0.0108453 -0.205467 0) -(-0.0099554 -0.197723 0) -(-0.00948263 -0.19721 0) -(-0.00884061 -0.205893 0) -(-0.00903542 -0.212123 0) -(-0.0102278 -0.220011 0) -(-0.0105138 -0.222248 0) -(-0.00828646 -0.213575 0) -(-0.00659857 -0.214629 0) -(-0.00703332 -0.209058 0) -(-0.00227453 -0.214454 0) -(0.00542109 -0.245926 0) -(0.0106032 -0.238634 0) -(0.010854 -0.249236 0) -(0.00876242 -0.252637 0) -(0.00453007 -0.257966 0) -(-0.00513822 -0.257207 0) -(-0.0114742 -0.25599 0) -(-0.0169037 -0.251318 0) -(-0.020266 -0.243234 0) -(-0.0219716 -0.237566 0) -(-0.0226626 -0.232553 0) -(-0.0223985 -0.22868 0) -(-0.0231117 -0.222302 0) -(-0.0241709 -0.217104 0) -(-0.0231922 -0.211435 0) -(-0.0203657 -0.20654 0) -(-0.0166632 -0.206571 0) -(-0.0135664 -0.21167 0) -(-0.0117394 -0.214821 0) -(-0.00879998 -0.220737 0) -(-0.0086934 -0.223367 0) -(-0.0056013 -0.220063 0) -(-0.00484241 -0.216812 0) -(-0.00426449 -0.216186 0) -(-0.000432306 -0.225821 0) -(0.00101988 -0.251804 0) -(0.00187509 -0.238421 0) -(0.000778526 -0.240542 0) -(-0.00148682 -0.244043 0) -(-0.00382411 -0.243968 0) -(-0.00654251 -0.239868 0) -(-0.01128 -0.235904 0) -(-0.0163584 -0.233219 0) -(-0.0195261 -0.231628 0) -(-0.0199146 -0.231773 0) -(-0.0203828 -0.229829 0) -(-0.0191604 -0.224491 0) -(-0.0189315 -0.219888 0) -(-0.0181255 -0.214507 0) -(-0.0191183 -0.211635 0) -(-0.0190925 -0.210557 0) -(-0.0182112 -0.209665 0) -(-0.017022 -0.214246 0) -(-0.0149553 -0.220472 0) -(-0.0122531 -0.225724 0) -(-0.00947732 -0.229517 0) -(-0.00727246 -0.224547 0) -(-0.00557617 -0.217101 0) -(-0.00463186 -0.217036 0) -(-0.00330665 -0.231921 0) -(8.25784e-05 -0.253848 0) -(-0.000268371 -0.238328 0) -(-0.00301136 -0.239058 0) -(-0.00647916 -0.241198 0) -(-0.0103013 -0.240858 0) -(-0.0142538 -0.235225 0) -(-0.0182661 -0.231072 0) -(-0.0218409 -0.229404 0) -(-0.0241709 -0.229872 0) -(-0.0295876 -0.230135 0) -(-0.031001 -0.229571 0) -(-0.0311472 -0.22868 0) -(-0.030436 -0.223805 0) -(-0.028412 -0.218443 0) -(-0.0263671 -0.215328 0) -(-0.0230363 -0.215668 0) -(-0.0185969 -0.219311 0) -(-0.0134096 -0.223808 0) -(-0.00999734 -0.227542 0) -(-0.00722822 -0.231166 0) -(-0.00551518 -0.234186 0) -(-0.0038587 -0.229493 0) -(-0.00282262 -0.221443 0) -(-0.00169673 -0.221114 0) -(2.06447e-05 -0.237812 0) -(0.000335563 -0.253489 0) -(0.000865174 -0.233776 0) -(-0.00146059 -0.230438 0) -(-0.00415664 -0.230431 0) -(-0.0074816 -0.229454 0) -(-0.0108598 -0.224791 0) -(-0.0134697 -0.220447 0) -(-0.0156702 -0.219528 0) -(-0.0175544 -0.22107 0) -(-0.0177251 -0.224193 0) -(-0.018488 -0.226349 0) -(-0.0190037 -0.225797 0) -(-0.0186123 -0.223764 0) -(-0.0177092 -0.221359 0) -(-0.0165239 -0.220859 0) -(-0.0155522 -0.221592 0) -(-0.015304 -0.223007 0) -(-0.015258 -0.227688 0) -(-0.0137041 -0.232161 0) -(-0.0112004 -0.236991 0) -(-0.00808428 -0.239237 0) -(-0.00485494 -0.232308 0) -(-0.00337747 -0.222952 0) -(-0.00296524 -0.222727 0) -(-0.00173884 -0.239798 0) -(0.000349145 -0.255939 0) -(0.00062909 -0.231933 0) -(-0.00102054 -0.227047 0) -(-0.00351247 -0.226384 0) -(-0.00590736 -0.225656 0) -(-0.00779789 -0.222142 0) -(-0.00952763 -0.21823 0) -(-0.0111687 -0.218456 0) -(-0.0124815 -0.221426 0) -(-0.0138324 -0.223488 0) -(-0.0148053 -0.22663 0) -(-0.0157874 -0.227884 0) -(-0.0167273 -0.226779 0) -(-0.0165335 -0.225205 0) -(-0.0150848 -0.224233 0) -(-0.0137614 -0.224532 0) -(-0.0124251 -0.226766 0) -(-0.0109831 -0.231256 0) -(-0.00997552 -0.237338 0) -(-0.00849914 -0.243503 0) -(-0.00679257 -0.245804 0) -(-0.0051098 -0.237961 0) -(-0.00416329 -0.226353 0) -(-0.00294021 -0.226083 0) -(-0.00108501 -0.247021 0) -(4.24721e-05 -0.256431 0) -(0.000304516 -0.230085 0) -(-0.000716007 -0.221956 0) -(-0.00221302 -0.220352 0) -(-0.00386584 -0.219108 0) -(-0.00617184 -0.216099 0) -(-0.00773335 -0.212464 0) -(-0.00875962 -0.213649 0) -(-0.00932796 -0.216741 0) -(-0.00984951 -0.219354 0) -(-0.0105588 -0.221952 0) -(-0.010929 -0.223515 0) -(-0.0109361 -0.224207 0) -(-0.0105392 -0.224616 0) -(-0.0107851 -0.224477 0) -(-0.0108553 -0.225027 0) -(-0.0104512 -0.227673 0) -(-0.00984337 -0.232456 0) -(-0.00898506 -0.238512 0) -(-0.00795746 -0.245588 0) -(-0.00587359 -0.248294 0) -(-0.00339441 -0.239864 0) -(-0.00227298 -0.227435 0) -(-0.00125421 -0.226667 0) -(-0.000871486 -0.249324 0) -(0.000409225 -0.257839 0) -(0.000711915 -0.230593 0) -(0.000793968 -0.220259 0) -(-0.000646462 -0.217923 0) -(-0.00232665 -0.216644 0) -(-0.00365784 -0.214334 0) -(-0.00441468 -0.211444 0) -(-0.0049945 -0.213907 0) -(-0.00553195 -0.217501 0) -(-0.00628806 -0.220309 0) -(-0.00731288 -0.222759 0) -(-0.00818725 -0.224717 0) -(-0.00825911 -0.225723 0) -(-0.00832097 -0.225249 0) -(-0.00826081 -0.224807 0) -(-0.00885666 -0.225891 0) -(-0.00879977 -0.229171 0) -(-0.00859457 -0.23418 0) -(-0.00836958 -0.240712 0) -(-0.00805374 -0.249818 0) -(-0.00641033 -0.254597 0) -(-0.00452138 -0.245245 0) -(-0.00293515 -0.231699 0) -(-0.00100869 -0.230221 0) -(-0.000420315 -0.252657 0) -(0.000118991 -0.259159 0) -(0.00127349 -0.231302 0) -(0.00120414 -0.219048 0) -(0.00120771 -0.214915 0) -(0.000153266 -0.213018 0) -(-0.00120494 -0.21076 0) -(-0.00246271 -0.208894 0) -(-0.00304297 -0.211621 0) -(-0.00366009 -0.214839 0) -(-0.00429086 -0.217177 0) -(-0.005503 -0.218977 0) -(-0.00687835 -0.221664 0) -(-0.00809126 -0.224044 0) -(-0.00898407 -0.223781 0) -(-0.00884368 -0.22305 0) -(-0.00846111 -0.225394 0) -(-0.00830692 -0.229215 0) -(-0.00808069 -0.234377 0) -(-0.00769128 -0.240892 0) -(-0.00759348 -0.251233 0) -(-0.0056055 -0.257743 0) -(-0.00277927 -0.248055 0) -(-0.000870318 -0.233306 0) -(-0.000791828 -0.23114 0) -(-0.000470737 -0.253708 0) -(-8.97735e-05 -0.260151 0) -(0.000271898 -0.232871 0) -(0.000601318 -0.218756 0) -(0.000149618 -0.213258 0) -(-0.00113219 -0.210678 0) -(-0.00226898 -0.208488 0) -(-0.00300058 -0.207744 0) -(-0.00326777 -0.210906 0) -(-0.00370789 -0.214189 0) -(-0.00399318 -0.21634 0) -(-0.00399851 -0.217676 0) -(-0.00436721 -0.220055 0) -(-0.00449099 -0.222919 0) -(-0.00504071 -0.223553 0) -(-0.00596975 -0.224086 0) -(-0.00633578 -0.225955 0) -(-0.00676778 -0.229212 0) -(-0.00722988 -0.234339 0) -(-0.00704433 -0.241286 0) -(-0.00763815 -0.25453 0) -(-0.00597556 -0.265033 0) -(-0.00289524 -0.256231 0) -(0.000268022 -0.237617 0) -(0.000444655 -0.231475 0) -(6.80294e-05 -0.25426 0) -(2.59183e-05 -0.260641 0) -(0.000661372 -0.233961 0) -(0.00124454 -0.218381 0) -(0.00130709 -0.212078 0) -(0.00089972 -0.208963 0) -(0.000335812 -0.206679 0) -(-9.93294e-05 -0.206662 0) -(9.75277e-05 -0.210224 0) -(-0.000192261 -0.213515 0) -(-0.000570344 -0.216128 0) -(-0.000943288 -0.217209 0) -(-0.00146038 -0.218996 0) -(-0.0026902 -0.221017 0) -(-0.00373599 -0.221005 0) -(-0.00485756 -0.220695 0) -(-0.00618773 -0.222617 0) -(-0.00729832 -0.228171 0) -(-0.00755772 -0.233526 0) -(-0.00804756 -0.240238 0) -(-0.00749901 -0.255866 0) -(-0.00685882 -0.269264 0) -(-0.00386096 -0.261344 0) -(-0.00127153 -0.240827 0) -(-6.19402e-05 -0.231727 0) -(-0.000121928 -0.254133 0) -(-0.000334361 -0.261047 0) -(-0.000555651 -0.235115 0) -(8.42401e-05 -0.218828 0) -(-0.000222396 -0.211752 0) -(-0.00118756 -0.207355 0) -(-0.00126687 -0.205858 0) -(-0.000523911 -0.20684 0) -(-2.23051e-05 -0.210451 0) -(-0.000233338 -0.213249 0) -(-0.000322883 -0.215214 0) -(-0.000280016 -0.216399 0) -(0.000265412 -0.217626 0) -(-0.000459861 -0.21987 0) -(-0.00117304 -0.219995 0) -(-0.00162353 -0.219525 0) -(-0.00186371 -0.221433 0) -(-0.00218427 -0.226117 0) -(-0.00363917 -0.232559 0) -(-0.00512323 -0.240734 0) -(-0.00583604 -0.256421 0) -(-0.00407282 -0.274961 0) -(-0.00187487 -0.270438 0) -(0.000943233 -0.246013 0) -(0.0006818 -0.231732 0) -(0.000446002 -0.254324 0) -(0.000105266 -0.26486 0) -(0.000818431 -0.238008 0) -(0.00127091 -0.2208 0) -(0.00133659 -0.211844 0) -(0.00282519 -0.208843 0) -(0.00364419 -0.208005 0) -(0.00413977 -0.208065 0) -(0.0034536 -0.21039 0) -(0.00375504 -0.213428 0) -(0.00354108 -0.215622 0) -(0.00305397 -0.216668 0) -(0.00188273 -0.21726 0) -(0.00120724 -0.217272 0) -(0.000119686 -0.2183 0) -(-4.59579e-06 -0.219973 0) -(-0.000665124 -0.220945 0) -(-0.00153237 -0.222927 0) -(-0.00389897 -0.228354 0) -(-0.00615498 -0.236754 0) -(-0.00802537 -0.257734 0) -(-0.00775732 -0.282832 0) -(-0.00482873 -0.280673 0) -(-0.0021193 -0.252462 0) -(2.37581e-05 -0.233025 0) -(-0.000242479 -0.256313 0) -(-0.000410047 -0.279599 0) -(-0.00116522 -0.250248 0) -(-0.00056507 -0.232974 0) -(0.000805405 -0.224412 0) -(0.00106032 -0.219207 0) -(0.00141604 -0.218008 0) -(0.00189483 -0.219389 0) -(0.0033373 -0.221184 0) -(0.00377824 -0.222702 0) -(0.00409683 -0.224417 0) -(0.00440499 -0.225721 0) -(0.0045489 -0.226336 0) -(0.00500349 -0.227307 0) -(0.00508704 -0.228103 0) -(0.004584 -0.228728 0) -(0.00343118 -0.229544 0) -(0.00315097 -0.230804 0) -(0.00276917 -0.234963 0) -(0.0014301 -0.243516 0) -(0.000212705 -0.266079 0) -(-0.000106209 -0.302699 0) -(-0.000436486 -0.305763 0) -(0.00070142 -0.273148 0) -(0.00100267 -0.246048 0) -(0.000716707 -0.270436 0) -(-0.000186106 -0.334395 0) -(0.000567537 -0.304298 0) -(0.00134348 -0.287237 0) -(0.00200479 -0.276983 0) -(0.00340998 -0.271015 0) -(0.00478347 -0.269762 0) -(0.00586136 -0.270887 0) -(0.00653161 -0.272742 0) -(0.00731399 -0.274183 0) -(0.00773051 -0.274997 0) -(0.00773219 -0.275196 0) -(0.00739855 -0.275048 0) -(0.00683331 -0.274963 0) -(0.00576939 -0.274721 0) -(0.00517722 -0.275994 0) -(0.00461468 -0.277796 0) -(0.00425723 -0.278949 0) -(0.00362898 -0.282514 0) -(0.00294761 -0.290478 0) -(0.00135822 -0.315832 0) -(0.000188657 -0.356588 0) -(-0.000693362 -0.363318 0) -(-0.000579133 -0.329156 0) -(0.000370275 -0.295812 0) -(0.000142979 -0.32205 0) -(-0.000238992 -0.455357 0) -(-0.000210256 -0.431043 0) -(0.000603566 -0.416188 0) -(0.00154886 -0.408621 0) -(0.00241357 -0.403684 0) -(0.00362173 -0.402728 0) -(0.00459904 -0.403658 0) -(0.00555617 -0.404891 0) -(0.00619993 -0.406272 0) -(0.00677634 -0.406889 0) -(0.00754734 -0.406879 0) -(0.00813509 -0.406534 0) -(0.00867538 -0.406434 0) -(0.00915111 -0.406293 0) -(0.00924917 -0.407097 0) -(0.00868431 -0.407916 0) -(0.00849393 -0.408459 0) -(0.00803176 -0.410955 0) -(0.00711471 -0.416901 0) -(0.00682252 -0.436721 0) -(0.00518893 -0.473387 0) -(0.00160235 -0.480504 0) -(-0.00114951 -0.452469 0) -(-0.00112515 -0.424892 0) -(8.57628e-05 -0.446071 0) -(-0.000315499 -0.550026 0) -(-0.000281919 -0.530282 0) -(0.000544145 -0.518278 0) -(0.00157615 -0.512034 0) -(0.0028261 -0.508069 0) -(0.00433169 -0.50725 0) -(0.00554652 -0.507934 0) -(0.00666509 -0.50883 0) -(0.00742123 -0.509938 0) -(0.00791445 -0.510405 0) -(0.008487 -0.510334 0) -(0.00884806 -0.509971 0) -(0.00920171 -0.509803 0) -(0.00930539 -0.509652 0) -(0.00920526 -0.510185 0) -(0.00872766 -0.510862 0) -(0.00878506 -0.511413 0) -(0.00869654 -0.513432 0) -(0.00844275 -0.518216 0) -(0.0082082 -0.53444 0) -(0.00632775 -0.564009 0) -(0.00218745 -0.569417 0) -(-0.000714079 -0.546426 0) -(-0.000766847 -0.524811 0) -(4.65096e-05 -0.542258 0) -) -; - -boundaryField -{ - inlet - { - type fixedValue; - value uniform (0 0 0); - } - - outlet - { - type inletOutlet; - inletValue uniform (0 0 0); - value nonuniform List<vector> -25 -( -(-0.000315499 -0.550026 0) -(-0.000281919 -0.530282 0) -(0.000544145 -0.518278 0) -(0.00157615 -0.512034 0) -(0.0028261 -0.508069 0) -(0.00433169 -0.50725 0) -(0.00554652 -0.507934 0) -(0.00666509 -0.50883 0) -(0.00742123 -0.509938 0) -(0.00791445 -0.510405 0) -(0.008487 -0.510334 0) -(0.00884806 -0.509971 0) -(0.00920171 -0.509803 0) -(0.00930539 -0.509652 0) -(0.00920526 -0.510185 0) -(0.00872766 -0.510862 0) -(0.00878506 -0.511413 0) -(0.00869654 -0.513432 0) -(0.00844275 -0.518216 0) -(0.0082082 -0.53444 0) -(0.00632775 -0.564009 0) -(0.00218745 -0.569417 0) -(-0.000714079 -0.546426 0) -(-0.000766847 -0.524811 0) -(4.65096e-05 -0.542258 0) -) -; - } - - walls - { - type fixedValue; - value uniform (0 0 0); - } - - defaultFaces - { - type empty; - } -} - -// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/alpha1 b/tutorials/multiphase/bubbleFoam/bubbleColumn/0/alpha1 deleted file mode 100644 index 1e96e5898358bb009cfc2d4b1e121816bcc02e14..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/alpha1 +++ /dev/null @@ -1,1926 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object alpha1; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField nonuniform List<scalar> -1875 -( -0.0548304 -0.0623421 -0.0794524 -0.0894836 -0.0869981 -0.0812588 -0.0751103 -0.074022 -0.0748355 -0.0763597 -0.0788793 -0.0792552 -0.0769845 -0.0688926 -0.0519894 --0.00753741 --0.0428937 --0.00611334 -0.048526 -0.0654223 -0.0534083 -0.0388266 -0.030309 -0.0906403 -0.0573169 -0.0677585 -0.0749894 -0.111227 -0.150629 -0.207244 -0.224638 -0.216721 -0.212082 -0.209764 -0.205933 -0.2054 -0.210627 -0.240833 -0.252489 -0.263075 -0.256311 -0.184737 -0.0647795 -0.0565476 -0.0705269 -0.0468687 -0.0503781 -0.447745 -0.228626 -0.0412855 -0.0765878 -0.0920896 -0.0945796 -0.0897102 -0.0908506 -0.108966 -0.11928 -0.122283 -0.129163 -0.133902 -0.148538 -0.147656 -0.208823 -0.287814 -0.392839 -0.432889 -0.179282 -0.0602057 -0.0490536 -0.06326 -0.0301004 -0.044322 -0.347753 -0.222614 -0.0580661 -0.0774311 -0.168999 -0.15296 -0.150495 -0.199711 -0.217948 -0.204586 -0.163955 -0.148388 -0.199424 -0.230525 -0.25015 -0.314607 -0.367503 -0.407244 -0.365514 -0.146976 -0.0600631 -0.0484226 -0.0589758 -0.0215465 -0.0713673 -0.383296 -0.252538 -0.084849 -0.0747927 -0.191497 -0.250551 -0.272281 -0.318538 -0.383113 -0.383273 -0.264682 -0.245327 -0.261841 -0.26286 -0.272433 -0.302876 -0.324439 -0.333574 -0.236679 -0.130168 -0.0519667 -0.0408861 -0.0403899 -0.0314694 -0.209634 -0.363462 -0.251125 -0.0990826 -0.0707352 -0.169339 -0.252151 -0.296879 -0.363435 -0.449059 -0.468992 -0.396875 -0.342303 -0.279122 -0.260497 -0.259759 -0.26695 -0.263158 -0.228365 -0.157612 -0.094658 -0.0450925 -0.0412135 -0.0406224 -0.0562977 -0.239062 -0.285406 -0.246931 -0.121172 -0.067325 -0.130564 -0.2262 -0.296236 -0.388328 -0.42684 -0.4202 -0.380098 -0.348687 -0.2758 -0.251542 -0.248472 -0.240963 -0.204851 -0.157356 -0.114521 -0.0636012 -0.0434253 -0.042109 -0.0439311 -0.0447382 -0.172608 -0.219094 -0.246152 -0.174903 -0.0710112 -0.119501 -0.215013 -0.253163 -0.339988 -0.391225 -0.391718 -0.352378 -0.321078 -0.250197 -0.217584 -0.198278 -0.149976 -0.0965145 -0.0715715 -0.0488777 -0.032089 -0.0278189 -0.0264319 -0.0373729 -0.0549931 -0.146785 -0.194982 -0.234741 -0.216862 -0.079705 -0.123036 -0.22043 -0.205523 -0.285796 -0.334684 -0.341156 -0.299131 -0.243703 -0.186723 -0.145023 -0.109432 -0.0675873 -0.0437774 -0.0351756 -0.029131 -0.0268031 -0.0263992 -0.0398214 -0.0861432 -0.186649 -0.206589 -0.184828 -0.177847 -0.216311 -0.0980646 -0.158972 -0.219526 -0.212652 -0.215522 -0.287711 -0.307771 -0.290046 -0.222114 -0.17485 -0.123933 -0.0765666 -0.049647 -0.0436035 -0.0419767 -0.0445667 -0.0455322 -0.0620655 -0.12025 -0.193307 -0.203171 -0.164683 -0.11598 -0.0515884 -0.124322 -0.122133 -0.166609 -0.187273 -0.260493 -0.156644 -0.227162 -0.264839 -0.26524 -0.220878 -0.183168 -0.141973 -0.0936408 -0.0553278 -0.0454663 -0.0444621 -0.0536388 -0.0678897 -0.0763383 -0.124482 -0.17042 -0.166777 -0.093375 -0.0531459 -0.0369463 -0.0793561 -0.135147 -0.14964 -0.130448 -0.232007 -0.152537 -0.144557 -0.21448 -0.227568 -0.210087 -0.180639 -0.151288 -0.119606 -0.0851365 -0.0636338 -0.0493 -0.0527713 -0.0651455 -0.0709015 -0.109781 -0.14225 -0.110684 -0.0638487 -0.0564369 -0.0660823 -0.0733794 -0.114427 -0.102706 -0.110863 -0.22586 -0.163777 -0.118543 -0.146743 -0.159867 -0.161461 -0.156442 -0.138646 -0.119527 -0.0931598 -0.0813179 -0.0691131 -0.0532866 -0.052539 -0.0552604 -0.0915788 -0.119602 -0.105888 -0.0744529 -0.0736707 -0.0851352 -0.0822765 -0.0935111 -0.0781043 -0.1283 -0.25283 -0.194458 -0.12161 -0.133576 -0.13755 -0.116304 -0.10647 -0.0959323 -0.0963314 -0.0859499 -0.0790304 -0.0798881 -0.0695575 -0.0468794 -0.045673 -0.0690178 -0.0987212 -0.108624 -0.115233 -0.105172 -0.0871229 -0.0928747 -0.0893538 -0.10332 -0.217173 -0.269753 -0.248991 -0.162985 -0.159579 -0.154646 -0.131756 -0.122903 -0.0967894 -0.0603195 -0.0536782 -0.0571817 -0.0700661 -0.0683329 -0.0501124 -0.0474957 -0.058922 -0.111262 -0.134974 -0.224772 -0.111677 -0.0843613 -0.0935528 -0.0966561 -0.145988 -0.238686 -0.255086 -0.298776 -0.278011 -0.267961 -0.225304 -0.192444 -0.173069 -0.150692 -0.0936343 -0.0556795 -0.0356709 -0.0357751 -0.0515386 -0.0498478 -0.0497518 -0.066669 -0.0985403 -0.167985 -0.369332 -0.132743 -0.0817724 -0.0929611 -0.09811 -0.139726 -0.223975 -0.284027 -0.343136 -0.299245 -0.300596 -0.238071 -0.214182 -0.184088 -0.149869 -0.108982 -0.0874414 -0.0491691 -0.0249572 -0.0408524 -0.0580323 -0.0612652 -0.0660238 -0.0811548 -0.331684 -0.403015 -0.168862 -0.0919107 -0.0962834 -0.0870445 -0.129929 -0.240926 -0.344756 -0.349775 -0.254159 -0.255671 -0.221588 -0.179509 -0.146754 -0.116876 -0.109119 -0.0955241 -0.0492485 -0.0267314 -0.0465165 -0.0728545 -0.0626188 -0.0637975 -0.179579 -0.587234 -0.392564 -0.170314 -0.104982 -0.101461 -0.082968 -0.138115 -0.221738 -0.359542 -0.38503 -0.230013 -0.157187 -0.126144 -0.110976 -0.110138 -0.100497 -0.107823 -0.0945146 -0.0389688 -0.0298509 -0.0547451 -0.0822809 -0.0999533 -0.251597 -0.579825 -0.545611 -0.2949 -0.155745 -0.117418 -0.105052 -0.0804842 -0.155847 -0.232088 -0.345762 -0.347085 -0.238022 -0.143914 -0.116049 -0.10605 -0.206644 -0.257038 -0.114064 -0.0612149 -0.0333713 -0.056496 -0.131705 -0.26974 -0.443914 -0.560254 -0.560335 -0.381546 -0.197076 -0.149187 -0.143069 -0.109416 -0.0749609 -0.160217 -0.199702 -0.280171 -0.152145 -0.0666199 -0.0664734 -0.246929 -0.411514 -0.232806 -0.138512 -0.0750425 -0.0472559 -0.0430703 -0.114505 -0.265859 -0.372059 -0.509452 -0.518379 -0.457894 -0.246365 -0.151931 -0.167832 -0.154085 -0.110464 -0.0735592 -0.146848 -0.116694 -0.112635 -0.0699891 -0.13673 -0.21846 -0.230052 -0.186718 -0.110921 -0.0628627 -0.0448772 -0.0383663 -0.039168 -0.0745422 -0.172378 -0.248831 -0.349149 -0.311709 -0.24349 -0.147145 -0.140529 -0.188856 -0.164601 -0.106747 -0.0790884 -0.153479 -0.0795915 -0.0781586 -0.120561 -0.181516 -0.179797 -0.121291 -0.0826141 -0.0589958 -0.0487892 -0.0403689 -0.0378203 -0.0379202 -0.0573637 -0.101884 -0.165751 -0.190452 -0.221 -0.194913 -0.133608 -0.159464 -0.203918 -0.167519 -0.101151 -0.09665 -0.210314 -0.0815409 -0.0744753 -0.116489 -0.206315 -0.208986 -0.135264 -0.0973566 -0.0747559 -0.0634323 -0.0596599 -0.0633453 -0.0828083 -0.113468 -0.145417 -0.162084 -0.163624 -0.167911 -0.144579 -0.151549 -0.169855 -0.191262 -0.161312 -0.0953067 -0.112863 -0.267305 -0.0989029 -0.0706988 -0.0990652 -0.182928 -0.212421 -0.195796 -0.165598 -0.146548 -0.143884 -0.151158 -0.142071 -0.130347 -0.116366 -0.115752 -0.124926 -0.131747 -0.125657 -0.120496 -0.172531 -0.160014 -0.148438 -0.131303 -0.0883712 -0.128229 -0.242534 -0.130967 -0.0742772 -0.0912205 -0.115682 -0.146866 -0.164485 -0.161747 -0.155232 -0.152602 -0.163635 -0.169006 -0.167986 -0.190025 -0.157539 -0.108648 -0.0985405 -0.103051 -0.131785 -0.167211 -0.142075 -0.128811 -0.111151 -0.0847732 -0.129201 -0.179547 -0.220509 -0.116071 -0.0958854 -0.0944166 -0.101064 -0.124314 -0.129561 -0.139907 -0.140398 -0.14653 -0.158682 -0.160032 -0.180787 -0.241484 -0.234778 -0.170716 -0.115324 -0.113047 -0.130376 -0.133579 -0.12739 -0.108146 -0.084428 -0.10362 -0.121922 -0.225395 -0.239289 -0.184898 -0.126716 -0.111901 -0.110005 -0.111768 -0.120903 -0.121045 -0.122699 -0.132938 -0.133927 -0.145275 -0.199037 -0.218323 -0.20341 -0.159977 -0.127579 -0.119277 -0.121591 -0.119737 -0.106927 -0.0821054 -0.0720205 -0.106533 -0.173912 -0.268948 -0.311379 -0.288807 -0.195192 -0.123459 -0.0796412 -0.0890668 -0.0922096 -0.0930014 -0.0982812 -0.0969353 -0.0980796 -0.120295 -0.151066 -0.157561 -0.152403 -0.147656 -0.130065 -0.121221 -0.116618 -0.107411 -0.0815869 -0.0676607 -0.107157 -0.0907348 -0.166579 -0.291194 -0.326016 -0.312991 -0.203253 -0.0925379 -0.0650276 -0.0614715 -0.0623592 -0.0661354 -0.0675073 -0.0754019 -0.104681 -0.122505 -0.135594 -0.156166 -0.153096 -0.138932 -0.126082 -0.115436 -0.108077 -0.0847511 -0.0743721 -0.0880376 -0.0701451 -0.0799815 -0.168513 -0.301919 -0.318485 -0.297068 -0.158781 -0.0713156 -0.0546533 -0.0561697 -0.0605606 -0.0671945 -0.0857768 -0.120043 -0.126673 -0.136642 -0.155562 -0.152807 -0.138254 -0.12699 -0.115136 -0.109868 -0.0943809 -0.0838388 -0.0792101 -0.0918152 -0.0912964 -0.101162 -0.209734 -0.299239 -0.295133 -0.242351 -0.117571 -0.0598923 -0.0525311 -0.0644173 -0.088498 -0.11878 -0.128214 -0.125473 -0.132328 -0.140341 -0.143864 -0.13048 -0.129544 -0.116245 -0.120045 -0.112124 -0.0836255 -0.0879137 -0.129468 -0.163628 -0.13205 -0.166991 -0.262016 -0.286284 -0.260528 -0.135244 -0.0622901 -0.0595454 -0.0879414 -0.118031 -0.125827 -0.120171 -0.117353 -0.11451 -0.110944 -0.118052 -0.117335 -0.126932 -0.122718 -0.130888 -0.131661 -0.0800041 -0.0946197 -0.14806 -0.362202 -0.130677 -0.118569 -0.229349 -0.257811 -0.242196 -0.130319 -0.0671586 -0.0819486 -0.115956 -0.141426 -0.11814 -0.103259 -0.106816 -0.10341 -0.108799 -0.107826 -0.104273 -0.116253 -0.165552 -0.140155 -0.140517 -0.0819721 -0.11019 -0.175134 -0.430433 -0.216516 -0.107979 -0.162629 -0.248259 -0.235117 -0.116561 -0.0626958 -0.104693 -0.137766 -0.132552 -0.111273 -0.099622 -0.105306 -0.103302 -0.11518 -0.113579 -0.104357 -0.122648 -0.176603 -0.148223 -0.14304 -0.0919238 -0.112423 -0.123886 -0.361632 -0.582615 -0.2652 -0.198887 -0.26463 -0.197837 -0.0842478 -0.0620283 -0.122689 -0.144344 -0.117382 -0.100239 -0.0937794 -0.0971306 -0.114798 -0.114548 -0.108852 -0.118169 -0.137958 -0.169438 -0.155229 -0.139919 -0.094834 -0.115104 -0.10249 -0.292801 -0.474725 -0.423076 -0.264832 -0.239504 -0.128072 -0.073392 -0.0725883 -0.131133 -0.135074 -0.103092 -0.0914723 -0.0833994 -0.07806 -0.1034 -0.112956 -0.109789 -0.131722 -0.141156 -0.142969 -0.157691 -0.123666 -0.0918485 -0.122871 -0.087835 -0.226215 -0.391053 -0.406831 -0.27239 -0.175651 -0.104971 -0.0796616 -0.106128 -0.156863 -0.130645 -0.0972547 -0.0838792 -0.0710501 -0.0627999 -0.0844029 -0.104839 -0.10565 -0.14044 -0.138959 -0.113898 -0.180972 -0.111637 -0.097422 -0.113604 -0.102632 -0.129757 -0.219307 -0.327667 -0.286688 -0.172195 -0.115668 -0.0954983 -0.142016 -0.178497 -0.134204 -0.0865106 -0.0631957 -0.057235 -0.0581712 -0.0776772 -0.0973227 -0.10738 -0.152177 -0.138453 -0.111105 -0.242982 -0.114065 -0.0982482 -0.125046 -0.136851 -0.0752342 -0.0976802 -0.248451 -0.272298 -0.200694 -0.13828 -0.120795 -0.150016 -0.178824 -0.149769 -0.0954581 -0.0738712 -0.0750659 -0.0733562 -0.0792874 -0.0922305 -0.12327 -0.158277 -0.127999 -0.136705 -0.207612 -0.129018 -0.102733 -0.151993 -0.187422 -0.113407 -0.0738066 -0.133507 -0.219951 -0.19558 -0.163204 -0.14757 -0.165432 -0.188831 -0.172178 -0.138631 -0.161668 -0.152498 -0.0774796 -0.0535821 -0.0646048 -0.113833 -0.157906 -0.133765 -0.16394 -0.112103 -0.120106 -0.102689 -0.162691 -0.2814 -0.311145 -0.154686 -0.121118 -0.184539 -0.204634 -0.193035 -0.182956 -0.186691 -0.190212 -0.187305 -0.160247 -0.164423 -0.166003 -0.149418 -0.0939451 -0.0597502 -0.0647413 -0.123263 -0.126259 -0.162135 -0.0974875 -0.0955192 -0.0952817 -0.141839 -0.312024 -0.351307 -0.290589 -0.215275 -0.206651 -0.201818 -0.188995 -0.177082 -0.177492 -0.178479 -0.173158 -0.155159 -0.154498 -0.154583 -0.156828 -0.160269 -0.118679 -0.0715912 -0.0918959 -0.118617 -0.170166 -0.179512 -0.0766929 -0.102228 -0.099936 -0.187074 -0.257043 -0.228663 -0.184211 -0.172626 -0.161297 -0.156115 -0.136871 -0.140182 -0.139453 -0.128013 -0.128491 -0.130873 -0.124411 -0.11945 -0.151349 -0.164335 -0.114861 -0.106773 -0.125989 -0.178082 -0.230365 -0.0867008 -0.104458 -0.117647 -0.0969655 -0.184994 -0.172864 -0.110369 -0.10045 -0.0894637 -0.0881788 -0.0857815 -0.0843227 -0.0866928 -0.0876044 -0.0909866 -0.109494 -0.122071 -0.139084 -0.178011 -0.16608 -0.121419 -0.128967 -0.166996 -0.14498 -0.205479 -0.130619 -0.102034 -0.167795 -0.112605 -0.156709 -0.187314 -0.111508 -0.0994387 -0.0907358 -0.0788382 -0.0753522 -0.0782186 -0.0848895 -0.0854934 -0.0885042 -0.111412 -0.135562 -0.153193 -0.172025 -0.164249 -0.150729 -0.174226 -0.144833 -0.0695522 -0.138636 -0.167467 -0.103535 -0.195937 -0.206743 -0.156178 -0.194497 -0.147236 -0.122842 -0.121623 -0.0824244 -0.0705113 -0.0885346 -0.106945 -0.103345 -0.0983153 -0.118606 -0.150526 -0.146847 -0.148472 -0.168906 -0.179927 -0.161697 -0.135224 -0.144459 -0.0956971 -0.124976 -0.107786 -0.208219 -0.296968 -0.164823 -0.187729 -0.167989 -0.137431 -0.108683 -0.0791975 -0.0805105 -0.102784 -0.183344 -0.231029 -0.160742 -0.134688 -0.148719 -0.128272 -0.153076 -0.181951 -0.184257 -0.166222 -0.136055 -0.215382 -0.140255 -0.104093 -0.109439 -0.20285 -0.275501 -0.186003 -0.170711 -0.167328 -0.134415 -0.0888649 -0.0708317 -0.0974769 -0.174393 -0.283963 -0.347231 -0.232965 -0.158663 -0.147479 -0.125899 -0.163708 -0.197109 -0.205366 -0.224018 -0.207064 -0.182863 -0.18699 -0.107881 -0.108852 -0.184169 -0.223735 -0.230926 -0.154129 -0.153713 -0.105787 -0.0738739 -0.104193 -0.178962 -0.214022 -0.244651 -0.265222 -0.206634 -0.156731 -0.147709 -0.132284 -0.18025 -0.209238 -0.217065 -0.267435 -0.339214 -0.177857 -0.163943 -0.118395 -0.101934 -0.15671 -0.221405 -0.248208 -0.148586 -0.119594 -0.104953 -0.110115 -0.176242 -0.19167 -0.181519 -0.178889 -0.183299 -0.162397 -0.153071 -0.15231 -0.163671 -0.178417 -0.208728 -0.234282 -0.254146 -0.242248 -0.223657 -0.200357 -0.119445 -0.0958487 -0.144491 -0.253086 -0.261182 -0.156351 -0.121613 -0.128773 -0.170507 -0.190858 -0.188049 -0.165656 -0.155113 -0.151492 -0.148501 -0.130312 -0.126454 -0.134026 -0.154681 -0.192332 -0.256064 -0.269837 -0.290542 -0.362155 -0.267312 -0.11689 -0.0932029 -0.169644 -0.352207 -0.319325 -0.211248 -0.139341 -0.148064 -0.176046 -0.197405 -0.216558 -0.206988 -0.151158 -0.140208 -0.139815 -0.130907 -0.126903 -0.130433 -0.135134 -0.149332 -0.215821 -0.25025 -0.31481 -0.347585 -0.265442 -0.0939545 -0.0964387 -0.236057 -0.382995 -0.38326 -0.301354 -0.222575 -0.201611 -0.196668 -0.1845 -0.197447 -0.218928 -0.208369 -0.174246 -0.143584 -0.141439 -0.157112 -0.157354 -0.163814 -0.186883 -0.226223 -0.264224 -0.317313 -0.319042 -0.239438 -0.0871377 -0.0973185 -0.242876 -0.361566 -0.377797 -0.326433 -0.293286 -0.268339 -0.271344 -0.239783 -0.216599 -0.218599 -0.23477 -0.226306 -0.151349 -0.120205 -0.117848 -0.137814 -0.193677 -0.258175 -0.25663 -0.281732 -0.295599 -0.277331 -0.177728 -0.0562367 -0.145285 -0.251732 -0.297866 -0.313549 -0.306309 -0.295189 -0.290474 -0.291793 -0.281567 -0.273813 -0.270739 -0.282995 -0.297537 -0.27172 -0.195667 -0.161762 -0.186161 -0.253705 -0.28154 -0.280162 -0.285981 -0.285637 -0.277834 -0.210687 -0.0871008 -0.784432 -0.702559 -0.641179 -0.595601 -0.584609 -0.59835 -0.648602 -0.681405 -0.740051 -0.787236 -0.820313 -0.8317 -0.852937 -0.877907 -0.869415 -0.864211 -0.846847 -0.823965 -0.74757 -0.696188 -0.660893 -0.67014 -0.682383 -0.738821 -0.77547 -0.992354 -0.991562 -0.989776 -0.989407 -0.988263 -0.99076 -0.992934 -0.994268 -0.996292 -0.99632 -0.996489 -0.996169 -0.995278 -0.993918 -0.993578 -0.992796 -0.992128 -0.99058 -0.989497 -0.988317 -0.986049 -0.985622 -0.985174 -0.985657 -0.986734 -0.9997 -0.999714 -0.999795 -0.999857 -0.999864 -0.999923 -0.999932 -0.999918 -0.999906 -0.999886 -0.999872 -0.999848 -0.999795 -0.999706 -0.999667 -0.999596 -0.999578 -0.999534 -0.999558 -0.999546 -0.999478 -0.999402 -0.999383 -0.999328 -0.99935 -0.99999 -0.999992 -0.999996 -0.999998 -0.999999 -0.999999 -0.999999 -0.999998 -0.999997 -0.999996 -0.999995 -0.999994 -0.999991 -0.999986 -0.999982 -0.999977 -0.999976 -0.999978 -0.99998 -0.999981 -0.999979 -0.999974 -0.999974 -0.999971 -0.999974 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999999 -0.999999 -0.999999 -0.999999 -0.999999 -0.999999 -0.999998 -0.999997 -0.999997 -0.999998 -0.999999 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999998 -0.999998 -0.999998 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999998 -0.999997 -0.999997 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999998 -0.999995 -0.999996 -0.999998 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999997 -0.999994 -0.999994 -0.999997 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999997 -0.999992 -0.999992 -0.999996 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999996 -0.99999 -0.999989 -0.999994 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999996 -0.999989 -0.999987 -0.999992 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999996 -0.999987 -0.999985 -0.999991 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999996 -0.999986 -0.999982 -0.999988 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999996 -0.999984 -0.999979 -0.999986 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999997 -0.999984 -0.999978 -0.999985 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999997 -0.999984 -0.999978 -0.999985 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999998 -0.999987 -0.999982 -0.999987 -0.999999 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0.999998 -0.999987 -0.999983 -0.999988 -0.999999 -1 -) -; - -boundaryField -{ - inlet - { - type fixedValue; - value uniform 0.5; - } - - outlet - { - type inletOutlet; - inletValue uniform 1; - value uniform 1; - } - - walls - { - type zeroGradient; - } - - defaultFaces - { - type empty; - } -} - -// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/p b/tutorials/multiphase/bubbleFoam/bubbleColumn/0/p deleted file mode 100644 index 5fffa73a19c7bb4636820cdc2558cd1f43b0429d..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/0/p +++ /dev/null @@ -1,1926 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object p; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [1 -1 -2 0 0 0 0]; - -internalField nonuniform List<scalar> -1875 -( -6296.13 -6183.25 -6130.53 -6102.97 -6085.59 -6070.83 -6056.52 -6042.12 -6032.24 -6023.39 -6020 -6019.35 -6022.8 -6035.92 -6058.4 -6096.69 -6151.53 -6194.63 -6220.36 -6227.39 -6190.28 -6200.25 -6159.79 -6145.34 -6239.45 -5932.88 -5894.83 -5896 -5896.13 -5896.42 -5893.93 -5892.58 -5888.84 -5884.44 -5877.96 -5872.77 -5864.16 -5858.72 -5859.75 -5863.29 -5874.06 -5903.63 -5933.39 -5949.13 -5948.76 -5936.64 -5920.16 -5894.61 -5887.73 -5904.59 -5829.55 -5827.28 -5827.17 -5826.79 -5820.6 -5810.48 -5802.08 -5795.34 -5787.03 -5775.04 -5773.95 -5776.62 -5774.94 -5777.31 -5779.57 -5787.46 -5807.7 -5827.9 -5860.51 -5895.43 -5910.03 -5904.37 -5908.12 -5902.27 -5915.81 -5680.23 -5677.28 -5676.59 -5674.62 -5670.55 -5664.23 -5662.59 -5662.65 -5654.98 -5651.9 -5655.82 -5654.19 -5660.21 -5667.38 -5675.59 -5686.03 -5699.99 -5707.47 -5731.06 -5747.04 -5757.95 -5746.13 -5751.94 -5752.54 -5756.48 -5596.51 -5594.34 -5595.28 -5587.93 -5584.85 -5580.19 -5581.94 -5583.69 -5581.75 -5582.87 -5588.62 -5593.54 -5600.08 -5606.28 -5613.47 -5620.91 -5626.09 -5639.9 -5656.52 -5690.9 -5692.53 -5685.55 -5691.46 -5690.28 -5692.68 -5500.77 -5499.4 -5498.12 -5490.19 -5484.73 -5481.73 -5483.39 -5482.97 -5483.81 -5486.56 -5489.45 -5492.85 -5498.29 -5502.79 -5509.32 -5513.74 -5523.43 -5538.03 -5541.75 -5560.77 -5558.05 -5558.63 -5564.38 -5561.96 -5569.11 -5429.77 -5429.37 -5425.69 -5419.15 -5415.38 -5412.85 -5412.65 -5411.07 -5410.11 -5408.78 -5409.05 -5408.7 -5412.7 -5415.54 -5421.1 -5425.72 -5431.77 -5440.25 -5439.18 -5444.29 -5457.33 -5463.86 -5472.09 -5470.76 -5481.47 -5339.81 -5337.93 -5335.2 -5328.01 -5325.1 -5320.24 -5318.66 -5315.69 -5313.67 -5312.31 -5310.7 -5311.52 -5313.88 -5317.44 -5323.51 -5333.7 -5347.39 -5349.64 -5342.77 -5322.66 -5327.03 -5336.54 -5355.71 -5357.95 -5365.12 -5251.22 -5257.02 -5245.19 -5241.32 -5235.96 -5230.82 -5224.79 -5220.71 -5215.58 -5212.63 -5208.81 -5207.86 -5209.49 -5211.23 -5215.25 -5217.38 -5227.33 -5236.75 -5234.3 -5218.38 -5221.33 -5238.35 -5270.98 -5297.32 -5285.38 -5134.78 -5141.28 -5129.11 -5125.34 -5118.41 -5113.56 -5104.26 -5098.63 -5091.73 -5085.87 -5080.29 -5076.67 -5075.57 -5074.74 -5078.38 -5083.91 -5093.59 -5100.11 -5107.38 -5107.94 -5122.84 -5155.95 -5184.47 -5216.19 -5206.06 -5029.85 -5023.59 -5029.5 -5013.09 -5006.47 -5001.87 -4991.19 -4982.46 -4973.99 -4966.68 -4961.15 -4956.84 -4956.99 -4958.22 -4962.14 -4968.3 -4976.1 -4986.28 -4991.41 -4991.3 -4995.3 -5013.36 -5037.47 -5054.9 -5054.19 -4890.06 -4882.82 -4894.45 -4873.06 -4880.32 -4867.96 -4857.91 -4849.54 -4841.6 -4834.95 -4830.57 -4826.25 -4825.98 -4826 -4828.43 -4831.83 -4833.12 -4837.79 -4826.5 -4809.86 -4805.99 -4807.58 -4826.08 -4838.35 -4849.96 -4714.62 -4711.97 -4714.51 -4705 -4712.73 -4717.07 -4710.49 -4705.38 -4701.03 -4698.8 -4697.36 -4696.05 -4695.76 -4695.5 -4695.28 -4694.77 -4692.61 -4684.45 -4666.01 -4637.19 -4617.3 -4609.3 -4624.85 -4629.39 -4642.5 -4523.06 -4524.71 -4511.18 -4518.2 -4532.12 -4535.39 -4532.36 -4536.62 -4540.76 -4541.39 -4546.94 -4550.14 -4553.57 -4554.46 -4552.79 -4548.86 -4539.3 -4524.99 -4496.6 -4460.83 -4442.56 -4425.45 -4434.71 -4439.78 -4450.38 -4371.81 -4372.7 -4361.27 -4367.5 -4369.38 -4376.32 -4375.22 -4378.42 -4383.14 -4389.68 -4398.4 -4408.96 -4416.32 -4420.86 -4420.99 -4416.68 -4401.43 -4378.84 -4354.01 -4322.2 -4302.78 -4293.71 -4296.25 -4303.54 -4305.22 -4239.77 -4240.95 -4230.58 -4241.42 -4249.56 -4255.4 -4253.65 -4259.03 -4262.5 -4269.1 -4276.6 -4286.18 -4297.58 -4303.77 -4311.08 -4299.92 -4285.78 -4267.75 -4237.04 -4223.55 -4200.59 -4202.11 -4196.31 -4204.32 -4206.45 -4146.5 -4145.49 -4139.78 -4144.33 -4155.96 -4170.77 -4169.64 -4166.97 -4162.64 -4164.54 -4168.33 -4176.24 -4182.78 -4189.55 -4185.86 -4184.88 -4173.3 -4158.6 -4140.45 -4133.47 -4115.66 -4121.51 -4116.35 -4120.3 -4121.23 -4102.95 -4103.86 -4099.71 -4102.17 -4104.47 -4111.01 -4105.54 -4100.41 -4083.36 -4078.2 -4069.78 -4064.79 -4065.88 -4070.09 -4072.82 -4073.35 -4070.25 -4064.82 -4062.31 -4042.21 -4043.05 -4042.59 -4045.18 -4046.01 -4048.13 -4032.15 -4035.14 -4028.68 -4028.22 -4014.15 -3997.14 -3996.25 -3976.92 -3959.31 -3938.8 -3934.92 -3934.92 -3946.84 -3949.95 -3958.19 -3964.72 -3973.8 -3972.13 -3963.12 -3956.34 -3965.47 -3964.16 -3969.75 -3970.48 -3972.74 -3971.33 -3971.63 -3969.38 -3967.06 -3968.39 -3943.28 -3910.35 -3884.37 -3861.89 -3837.93 -3827.63 -3826.91 -3837.33 -3850.34 -3860.21 -3865.31 -3871.77 -3866.62 -3871.02 -3875.25 -3884.01 -3887.22 -3893.04 -3893.8 -3896.7 -3917.09 -3913.8 -3913.32 -3912.68 -3912.47 -3896.81 -3850.81 -3796.7 -3778.85 -3771.98 -3774.64 -3779.2 -3787.05 -3791.83 -3794.09 -3791.58 -3795.13 -3799.01 -3801.91 -3808.11 -3808.81 -3814.53 -3815.73 -3818.71 -3819.36 -3828.46 -3820.53 -3819.93 -3814.39 -3808.93 -3766.04 -3739.6 -3724.01 -3718.07 -3712.81 -3714.72 -3721.59 -3733.84 -3739.77 -3740.59 -3734.56 -3737.28 -3743.07 -3745.23 -3751.77 -3749.9 -3751.12 -3747.66 -3749.18 -3748.73 -3723.23 -3711.43 -3717.34 -3704.45 -3691.91 -3677.36 -3662.34 -3653.8 -3648.59 -3646.73 -3652.46 -3662.08 -3676.04 -3684.36 -3684.74 -3678.21 -3672.87 -3671.25 -3667.14 -3666.07 -3660.68 -3657.48 -3655.93 -3655.47 -3655.5 -3586.18 -3578.34 -3582.86 -3572.31 -3567.65 -3550.99 -3537.87 -3525.19 -3518.27 -3514.63 -3520.79 -3525.1 -3534.78 -3538.86 -3539.29 -3543.13 -3550.55 -3556.94 -3559.06 -3560.38 -3555.81 -3556.85 -3555.01 -3557.07 -3556.94 -3476.58 -3473.6 -3467.31 -3457.76 -3442.56 -3431.12 -3420.39 -3411.43 -3407.71 -3404.13 -3401.26 -3396.55 -3393.36 -3401.61 -3406.07 -3412.62 -3422.58 -3432.15 -3440.88 -3445.51 -3446.08 -3449.24 -3451.23 -3453.74 -3454.4 -3386.34 -3401.96 -3377.92 -3367.15 -3351.35 -3343.8 -3330.12 -3321.91 -3312.27 -3306.28 -3300.42 -3296.61 -3292.69 -3293.58 -3289.36 -3294.53 -3300.53 -3308.72 -3317.27 -3322.27 -3328.25 -3333.22 -3337.59 -3341.61 -3342.04 -3270.33 -3282.79 -3257 -3254.74 -3237.46 -3236.79 -3224.97 -3223.1 -3214.92 -3209.14 -3204.8 -3201.41 -3198.47 -3196.71 -3195.02 -3193.94 -3194.86 -3199.83 -3210.11 -3216.96 -3222.33 -3226 -3228.96 -3231.36 -3231.97 -3145.06 -3139.47 -3141.64 -3132.87 -3117.15 -3108 -3107.7 -3103.41 -3104.14 -3103.49 -3103.4 -3102.11 -3100.75 -3100.69 -3100.05 -3100.91 -3102.12 -3104 -3108.52 -3112.94 -3117.37 -3120.48 -3123.25 -3125.06 -3125.64 -3039.03 -3034.71 -3044.89 -3028.17 -3014.83 -2998.54 -2991.82 -2988.31 -2990.89 -2990.76 -2992.82 -2992.71 -2992.91 -2993.55 -2993.93 -2996.52 -2998.77 -3001.81 -3003.8 -3006.3 -3008.47 -3010.71 -3013.02 -3013.98 -3014.73 -2908.73 -2907.67 -2915.01 -2902.96 -2883.11 -2870.53 -2861.82 -2861.77 -2858.11 -2866.01 -2868.24 -2871.95 -2874.15 -2877.48 -2879.23 -2881.94 -2885.54 -2888.54 -2889.22 -2891.04 -2892.59 -2894.76 -2896.72 -2897.24 -2898.08 -2743.7 -2742.01 -2738.5 -2725.55 -2717.81 -2712.86 -2711.05 -2715.87 -2724.18 -2734.62 -2743.94 -2749.05 -2753.75 -2756.91 -2760.57 -2764.19 -2768.42 -2770.96 -2772.39 -2774.26 -2775.19 -2776.7 -2779.08 -2778.79 -2779.65 -2565.53 -2560.37 -2552.02 -2536.37 -2538.07 -2543.7 -2562.95 -2577.19 -2589.69 -2603.57 -2622.53 -2629.62 -2635.93 -2638.27 -2641.85 -2646.21 -2650.1 -2652.23 -2654.12 -2654.38 -2656.38 -2656.95 -2658.31 -2658.33 -2659 -2389.07 -2379.85 -2367.53 -2354.3 -2366.15 -2384.52 -2405.82 -2433.43 -2462.89 -2488.05 -2504.2 -2511.52 -2516.4 -2518.23 -2521.69 -2525.69 -2529.22 -2531.56 -2533.69 -2534.55 -2536.77 -2538.52 -2538.07 -2539.44 -2539.43 -2273.44 -2271.89 -2265.88 -2258.46 -2270.69 -2284.82 -2303.38 -2320.92 -2344.94 -2368.77 -2388.71 -2394.95 -2400.64 -2402.63 -2405.76 -2407.81 -2409.72 -2410.94 -2410.53 -2414.6 -2417.09 -2418.33 -2418.34 -2420.27 -2419.98 -2185.65 -2185.04 -2177.85 -2185.4 -2179.64 -2198.58 -2203.6 -2217.85 -2237.88 -2261.45 -2281.47 -2286.63 -2291.77 -2295.98 -2295.29 -2295 -2293.4 -2291.66 -2293.09 -2294.87 -2299.02 -2301.11 -2301.98 -2303.28 -2302.96 -2091.49 -2091.8 -2084.97 -2086.93 -2079.18 -2084.09 -2087.53 -2100.32 -2126.33 -2149.78 -2166.81 -2172.17 -2178.09 -2182.93 -2181.73 -2179.44 -2176.5 -2174.1 -2177.42 -2178.54 -2180.89 -2182.27 -2186.01 -2185.47 -2186.4 -2019.46 -2019.6 -2015.77 -2015.14 -2013.82 -2011.58 -2012.35 -2017.51 -2024.81 -2034.17 -2042.04 -2045.58 -2054.16 -2056.02 -2060.91 -2061.06 -2061.84 -2065.31 -2067.03 -2067.91 -2068.01 -2069.22 -2074.55 -2072.99 -2075.21 -1941.72 -1942.55 -1944.6 -1944.6 -1943.14 -1940.45 -1935.96 -1930.74 -1921.85 -1910.23 -1906.16 -1907.96 -1916.47 -1922.35 -1930.54 -1936.69 -1942.73 -1948.6 -1953.45 -1955.74 -1957.09 -1958.79 -1964.58 -1962.03 -1967.35 -1859.93 -1862.27 -1867.44 -1868.49 -1871.4 -1864.79 -1856.13 -1837.86 -1816.62 -1792.52 -1776.69 -1780.67 -1786.01 -1795.7 -1805.76 -1816.65 -1826.23 -1832.42 -1841.3 -1846.17 -1853.55 -1857.44 -1862.73 -1864.65 -1867.63 -1742.2 -1743.56 -1744.86 -1750.46 -1751.86 -1752.18 -1744.94 -1730.61 -1713.95 -1693.05 -1674.63 -1672.45 -1671.49 -1678.13 -1685.56 -1695.24 -1704.8 -1715.69 -1731.89 -1744.37 -1749.79 -1759.79 -1761.02 -1770.11 -1765.85 -1624.33 -1621.69 -1621.28 -1623.55 -1629.86 -1634.84 -1629.82 -1625.27 -1615.57 -1605.67 -1593.17 -1587.41 -1583.62 -1584.26 -1588.12 -1596.64 -1605.76 -1628.49 -1642.54 -1656.53 -1655.76 -1659.92 -1648.25 -1661.23 -1652.41 -1502.84 -1498.24 -1494.11 -1489.61 -1491.48 -1495.03 -1499.24 -1513.36 -1522.63 -1525.6 -1522.69 -1517.07 -1510.85 -1506.74 -1505.54 -1505.4 -1510.6 -1521.74 -1541.45 -1558.61 -1552.85 -1551.76 -1535.75 -1530.96 -1532.7 -1438.35 -1431.98 -1423.78 -1418.2 -1414.02 -1410.95 -1421.88 -1440.09 -1454.87 -1458.63 -1455.01 -1445.78 -1434.66 -1425.7 -1419.12 -1415.68 -1415.72 -1417.64 -1423.6 -1431.4 -1433.84 -1435.92 -1428.46 -1424.99 -1425.27 -1387.36 -1391.52 -1382.5 -1371.77 -1362.64 -1361.03 -1365.55 -1375.58 -1381.01 -1381.31 -1373.07 -1361.69 -1345.78 -1330.35 -1319.62 -1310.89 -1308.23 -1306.43 -1305.91 -1307.7 -1313.27 -1327.02 -1336.01 -1327.81 -1331.15 -1271.79 -1273.08 -1271.98 -1264.17 -1251.26 -1244.99 -1245.76 -1252.42 -1257 -1256.72 -1250.08 -1237.94 -1222.68 -1208.14 -1196.98 -1192.02 -1186.21 -1184.68 -1188.51 -1191.85 -1205.01 -1215.73 -1233.25 -1224.72 -1226.75 -1127.1 -1125.64 -1124.39 -1121.85 -1113.42 -1103.67 -1098.39 -1099.57 -1105.61 -1109.52 -1106.77 -1098.48 -1089 -1080.43 -1073.92 -1073.24 -1072.25 -1071.29 -1071.75 -1074.4 -1078.62 -1085.51 -1095.53 -1095.67 -1096.26 -992.294 -991.13 -986.281 -990.794 -983.274 -976.232 -971.001 -968.971 -970.743 -974.382 -967.38 -958.104 -950.768 -948.08 -946.549 -948.871 -950.382 -951.44 -951.025 -953.739 -950.888 -963.575 -953.716 -963.393 -962.334 -890.836 -890.007 -886.517 -889.188 -888.797 -887.558 -882.258 -875.452 -866.168 -854.814 -842.425 -829.034 -823.448 -825.3 -826.065 -829.316 -832.018 -831.086 -828.139 -829.794 -822.199 -832.926 -830.89 -834.839 -836.224 -798.119 -798.959 -798.146 -794.879 -795.855 -790.952 -790.489 -782.988 -775.087 -756.826 -738.278 -726.414 -724.974 -724.246 -723.204 -723.369 -721.642 -719.099 -710.316 -697.385 -679.975 -674.28 -688.78 -688.589 -696.624 -694.405 -693.345 -698.272 -689.258 -690.501 -687.553 -687.301 -681.852 -671.592 -659.784 -649.31 -644.201 -642.081 -639.871 -634.96 -632.393 -627.156 -622.901 -613.168 -598.754 -587.397 -580.568 -587.953 -589.947 -592.531 -575.596 -574.55 -578.335 -571.262 -575.126 -570.818 -571.44 -565.333 -563.994 -557.653 -557.057 -557.073 -557.351 -557.971 -555.384 -555.633 -552.015 -548.591 -537.679 -522.905 -508.967 -504.995 -501.762 -502.865 -506.834 -448.634 -446.606 -441.379 -444.536 -445.296 -443.761 -444.059 -445.756 -447.579 -450.807 -450.866 -455.388 -461.553 -467.52 -474.518 -479.626 -477.622 -471.502 -455.883 -440.965 -425.702 -419.971 -419.591 -421.465 -426.135 -327.686 -323.738 -318.303 -321.504 -324.04 -322.727 -325.782 -330.743 -336.641 -341.885 -344.784 -352.115 -359.02 -367.046 -375.031 -383.301 -386.722 -384.298 -377.603 -369.778 -365.622 -363.641 -369.767 -373.676 -379.99 -241.456 -237.463 -233.772 -236.247 -235.733 -232.785 -232.205 -235.193 -239.329 -242.543 -242.908 -243.094 -245.917 -250.612 -255.394 -256.106 -257.516 -253.698 -252.154 -259.734 -270.969 -277.671 -284.418 -288.332 -290.567 -170.45 -169.594 -168.777 -170.885 -170.431 -166.804 -162.034 -160.137 -158.841 -159.069 -159.23 -158.955 -159.443 -159.867 -163.016 -164.058 -164.345 -161.325 -163.141 -170.599 -175.042 -179.359 -182.47 -184.371 -184.848 -69.1085 -73.6312 -78.3502 -83.8631 -83.2866 -79.7069 -70.8607 -65.196 -58.0552 -52.5698 -47.5432 -44.4013 -40.9971 -39.2168 -44.3652 -48.4222 -52.8974 -55.6685 -63.8615 -70.3526 -77.103 -79.0083 -80.6254 -78.5936 -78.1597 -5.21762 -5.54303 -6.21406 -6.5862 -6.97536 -6.04707 -5.1582 -4.67529 -3.96973 -3.91805 -3.85068 -3.97955 -4.24419 -4.60187 -4.58482 -4.73677 -4.97607 -5.56779 -5.98771 -6.44586 -7.31777 -7.4187 -7.38624 -6.79915 -6.2811 -2.60843 -2.60082 -2.59544 -2.574 -2.56327 -2.53915 -2.52407 -2.51319 -2.50267 -2.50354 -2.50313 -2.51034 -2.51996 -2.53785 -2.55085 -2.5752 -2.5913 -2.61602 -2.6272 -2.64475 -2.66551 -2.6892 -2.70386 -2.72564 -2.73192 -2.17545 -2.17432 -2.17254 -2.17118 -2.16971 -2.16884 -2.16875 -2.16917 -2.17074 -2.17198 -2.17338 -2.17488 -2.17495 -2.17499 -2.17384 -2.17487 -2.17478 -2.17659 -2.17631 -2.17759 -2.17752 -2.17913 -2.17829 -2.1787 -2.17787 -2.04089 -2.04068 -2.04118 -2.04152 -2.04136 -2.04222 -2.04304 -2.04335 -2.04473 -2.0445 -2.04444 -2.04311 -2.04132 -2.03846 -2.03706 -2.03531 -2.03452 -2.03333 -2.03303 -2.03251 -2.03159 -2.03142 -2.03102 -2.03115 -2.0311 -1.8995 -1.89922 -1.89946 -1.89964 -1.89961 -1.89979 -1.89968 -1.89943 -1.89907 -1.89835 -1.8975 -1.89651 -1.89491 -1.89377 -1.8926 -1.89154 -1.8906 -1.88973 -1.88905 -1.88848 -1.88785 -1.88711 -1.88686 -1.88627 -1.88633 -1.77653 -1.77666 -1.77687 -1.77695 -1.77713 -1.77716 -1.77724 -1.7771 -1.77697 -1.77662 -1.77613 -1.7756 -1.77522 -1.77457 -1.77389 -1.77326 -1.77257 -1.77208 -1.7714 -1.77091 -1.77041 -1.77005 -1.76976 -1.76958 -1.76941 -1.63781 -1.6378 -1.6377 -1.63767 -1.63752 -1.63738 -1.63715 -1.63682 -1.63643 -1.6359 -1.63542 -1.63483 -1.63445 -1.6338 -1.63323 -1.63265 -1.63219 -1.63165 -1.63134 -1.63099 -1.63071 -1.63038 -1.63013 -1.62993 -1.62988 -1.51282 -1.51284 -1.51282 -1.51284 -1.5128 -1.51277 -1.51267 -1.51255 -1.51241 -1.51221 -1.51213 -1.5117 -1.51131 -1.51112 -1.5109 -1.5106 -1.51038 -1.51 -1.50972 -1.50943 -1.50929 -1.50912 -1.50903 -1.50887 -1.5088 -1.37554 -1.37557 -1.37551 -1.37547 -1.37539 -1.37526 -1.37511 -1.37491 -1.37471 -1.37446 -1.37428 -1.37409 -1.37381 -1.3733 -1.37291 -1.37262 -1.37229 -1.37216 -1.37199 -1.37189 -1.37176 -1.37161 -1.37142 -1.37128 -1.37126 -1.24919 -1.24912 -1.24913 -1.24911 -1.24907 -1.24905 -1.24895 -1.2489 -1.24877 -1.24873 -1.24852 -1.24843 -1.24825 -1.24816 -1.24797 -1.24776 -1.24766 -1.24758 -1.24758 -1.24756 -1.24764 -1.2476 -1.24764 -1.2475 -1.24748 -1.11318 -1.1132 -1.1132 -1.11315 -1.1131 -1.113 -1.11293 -1.1128 -1.11269 -1.11263 -1.11246 -1.11222 -1.11212 -1.1119 -1.1119 -1.11173 -1.11166 -1.11156 -1.11144 -1.11144 -1.11139 -1.1114 -1.11126 -1.11117 -1.11112 -0.986047 -0.98605 -0.986021 -0.985994 -0.985958 -0.985953 -0.985902 -0.985882 -0.985862 -0.985753 -0.985696 -0.985757 -0.985718 -0.985741 -0.985653 -0.985684 -0.985621 -0.985668 -0.985679 -0.985742 -0.985764 -0.985816 -0.985801 -0.985722 -0.985683 -0.850852 -0.850828 -0.850842 -0.850796 -0.850764 -0.850715 -0.850595 -0.850523 -0.850386 -0.850218 -0.850163 -0.850059 -0.850021 -0.849933 -0.849904 -0.849827 -0.849897 -0.849844 -0.849967 -0.849956 -0.850129 -0.850129 -0.850119 -0.850004 -0.849993 -0.72322 -0.723219 -0.723168 -0.723188 -0.723205 -0.72319 -0.723291 -0.723312 -0.723289 -0.723364 -0.723374 -0.723393 -0.723413 -0.723427 -0.723469 -0.723464 -0.723433 -0.723435 -0.72342 -0.723495 -0.723593 -0.723675 -0.72367 -0.723614 -0.723624 -0.588544 -0.588553 -0.588524 -0.58856 -0.588456 -0.588381 -0.588228 -0.588079 -0.588023 -0.587939 -0.587933 -0.587901 -0.587847 -0.58787 -0.587778 -0.587892 -0.58775 -0.58788 -0.587929 -0.587983 -0.588115 -0.588224 -0.588247 -0.588184 -0.588176 -0.460733 -0.460707 -0.460783 -0.460706 -0.460777 -0.460789 -0.460852 -0.4609 -0.460948 -0.461034 -0.461033 -0.460993 -0.46101 -0.460953 -0.46097 -0.460876 -0.46099 -0.460862 -0.46089 -0.460867 -0.461056 -0.461141 -0.461208 -0.4611 -0.461116 -0.3263 -0.32631 -0.326259 -0.326284 -0.326204 -0.326162 -0.326065 -0.32599 -0.325944 -0.325867 -0.3258 -0.325803 -0.325782 -0.325739 -0.325783 -0.325732 -0.325814 -0.325752 -0.325748 -0.325634 -0.325831 -0.325858 -0.325945 -0.325862 -0.325925 -0.198387 -0.198387 -0.19838 -0.198379 -0.19838 -0.198385 -0.198408 -0.198401 -0.198452 -0.198453 -0.198529 -0.198519 -0.198553 -0.198528 -0.198507 -0.198412 -0.198322 -0.198197 -0.198173 -0.198015 -0.198055 -0.198112 -0.198217 -0.198335 -0.198368 -0.0639617 -0.0639706 -0.0639747 -0.0639733 -0.0639593 -0.0639489 -0.0639239 -0.0639184 -0.0638669 -0.0638353 -0.0637998 -0.0637847 -0.0637588 -0.0637369 -0.0637026 -0.063645 -0.0636016 -0.0635269 -0.06342 -0.0632935 -0.0631483 -0.0632062 -0.063256 -0.0633831 -0.0634023 -) -; - -boundaryField -{ - inlet - { - type fixedFluxPressure; - value uniform 0; - } - - outlet - { - type fixedValue; - value uniform 0; - } - - walls - { - type fixedFluxPressure; - value uniform 0; - } - - defaultFaces - { - type empty; - } -} - -// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/g b/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/g deleted file mode 100644 index e0ac2653b5b370ad62f6770588121d30cac51627..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/constant/g +++ /dev/null @@ -1,22 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class uniformDimensionedVectorField; - location "constant"; - object g; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 1 -2 0 0 0 0]; -value ( 0 -9.81 0 ); - - -// ************************************************************************* // diff --git a/tutorials/multiphase/bubbleFoam/bubbleColumn/system/controlDict b/tutorials/multiphase/bubbleFoam/bubbleColumn/system/controlDict deleted file mode 100644 index aa06cb9745dc90f07a5f0dd8586864c64cebb344..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/bubbleFoam/bubbleColumn/system/controlDict +++ /dev/null @@ -1,49 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "system"; - object controlDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -application bubbleFoam; - -startFrom startTime; - -startTime 0; - -stopAt endTime; - -endTime 20; - -deltaT 0.002; - -writeControl runTime; - -writeInterval 0.5; - -purgeWrite 0; - -writeFormat ascii; - -writePrecision 6; - -writeCompression uncompressed; - -timeFormat general; - -timePrecision 6; - -runTimeModifiable yes; - - -// ************************************************************************* // diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun b/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun index bdeacd7831d2a2c15696477e68478f10fb58ff2c..8d214a96af50508e27d18d8fe09993d254b2383e 100755 --- a/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun +++ b/tutorials/multiphase/cavitatingFoam/les/throttle/Allrun @@ -18,7 +18,7 @@ refineMeshByCellSet() topoSet > log.topoSet.$1 2>&1 echo "refining primary zone - $1" - refineMesh -dict -overwrite > log.refineMesh.$1 2>&1 + refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh.$1 2>&1 fi shift done diff --git a/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun b/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun index 213a2a5ecf094bfac092971663a6d716f15d619c..4314556cfc66040c96b55dda75e40488d46144d9 100755 --- a/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun +++ b/tutorials/multiphase/cavitatingFoam/les/throttle3D/Allrun @@ -18,7 +18,7 @@ refineMeshByCellSet() topoSet > log.topoSet.$1 2>&1 echo "refining primary zone - $1" - refineMesh -dict -overwrite > log.refineMesh.$1 2>&1 + refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh.$1 2>&1 fi shift done diff --git a/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun b/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun index 37600b5049bfd7d7ba5f66902446f4fe9df287cf..fb8009740b73608e7fe5994fef71b25e63915a9d 100755 --- a/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun +++ b/tutorials/multiphase/cavitatingFoam/ras/throttle/Allrun @@ -17,7 +17,7 @@ refineMeshByCellSet() topoSet > log.topoSet.$1 2>&1 echo "refining primary zone - $1" - refineMesh -dict -overwrite > log.refineMesh.$1 2>&1 + refineMesh -dict system/refineMeshDict -overwrite > log.refineMesh.$1 2>&1 fi shift done diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties similarity index 95% rename from tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..fd749d03963870c76ab4a9d85ad86bd95c33a71f 100644 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFZones +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/bubbleColumn/constant/MRFProperties @@ -11,10 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0() +// none // ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties similarity index 95% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties index de81c73439850dabae0c51d6f0b899921f752af6..fd749d03963870c76ab4a9d85ad86bd95c33a71f 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctImplicit/constant/MRFZones +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFProperties @@ -11,11 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0 -() +// none // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/fluidisedBed/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties similarity index 76% rename from tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones rename to tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties index 7c255d51dbd08c0f3030bc8a50faa4c1a4f6a28a..8712458a97f59faf84c16b1cfe8d6da06bd442b7 100644 --- a/tutorials/compressible/rhoPorousMRFPimpleFoam/mixerVessel2D/constant/MRFZones +++ b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); - origin (0 0 0); - axis (0 0 1); - omega constant 1047.2; - } -) + origin (0 0 0); + axis (0 0 1); + omega constant 10.472; +} // ************************************************************************* // diff --git a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index 7dd518ca65d8ab7e3c12ffd41ff52ad35244c701..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/compressibleTwoPhaseEulerFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 10.472; - } -) - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun b/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun index a66f56c1a7d5e33a012d58d0ae648d98715b26be..bdd17ed03350834cc6921cb53e2555ce1cf305fd 100755 --- a/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun +++ b/tutorials/multiphase/interFoam/les/nozzleFlow2D/Allrun @@ -10,7 +10,7 @@ application=`getApplication` runRefineMesh () { echo "Running refineMesh on $PWD" - refineMesh -dict > log.refineMesh 2>&1 + refineMesh -dict system/refineMeshDict > log.refineMesh 2>&1 } runApplication blockMesh diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun index 32c7e6f948157c416cccf020b8c874198ee1ddcc..2b6ce02153b902a2a04ad7030a6ffeeaa300bcc3 100755 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/Allrun @@ -10,15 +10,7 @@ application=`getApplication` runApplication blockMesh runApplication setFields -unset FOAM_SIGFPE -unset FOAM_SETNAN - -# Create faceZones for porous baffles -runApplication topoSet - -runApplication createBaffles cyclicZoneFaces '(porous_half0 porous_half1)' -overwrite - -runApplication changeDictionary +runApplication createBaffles -overwrite runApplication $application diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/blockMeshDict b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/blockMeshDict index a60b3257e3c88c12b795a7c30dc03c78c43b3a2e..11344be6ac848c78c9368b3e09948934cb22b570 100644 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/blockMeshDict +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/blockMeshDict @@ -99,20 +99,6 @@ boundary (10 22 23 11) ); } - - porous_half0 - { - type cyclic; - faces (); - neighbourPatch porous_half1; - } - - porous_half1 - { - type cyclic; - faces (); - neighbourPatch porous_half0; - } ); mergePatchPairs diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/boundary b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/boundary deleted file mode 100644 index de4cd8520029406fbdb234c90c8761f2e6e79695..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/constant/polyMesh/boundary +++ /dev/null @@ -1,68 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class polyBoundaryMesh; - location "constant/polyMesh"; - object boundary; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -7 -( - leftWall - { - type wall; - nFaces 50; - startFace 4419; - } - rightWall - { - type wall; - nFaces 50; - startFace 4469; - } - lowerWall - { - type wall; - nFaces 62; - startFace 4519; - } - atmosphere - { - type patch; - nFaces 46; - startFace 4581; - } - porous_half0 - { - type cyclic; - nFaces 13; - startFace 4627; - matchTolerance 0.0001; - neighbourPatch porous_half1; - } - porous_half1 - { - type cyclic; - nFaces 13; - startFace 4640; - matchTolerance 0.0001; - neighbourPatch porous_half0; - } - defaultFaces - { - type empty; - nFaces 4536; - startFace 4653; - } -) - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/controlDict b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/controlDict index e433c1ed6740b2dd4014f175e30d7354401fc20f..bf6c452b469351a246a3adaeb31b9349c3e281c7 100644 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/controlDict +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/controlDict @@ -55,6 +55,8 @@ maxDeltaT 1; libs ( "libturbulenceDerivedFvPatchFields.so" + "libincompressibleTurbulenceModel.so" + "libincompressibleRASModels.so" ); // ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/createBafflesDict b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/createBafflesDict new file mode 100644 index 0000000000000000000000000000000000000000..c127ff67d25c8e2175277ec631ffa86c6f6f7730 --- /dev/null +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/system/createBafflesDict @@ -0,0 +1,75 @@ +/*--------------------------------*- 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; + object createBafflesDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Whether to convert internal faces only (so leave boundary faces intact). +// This is only relevant if your face selection type can pick up boundary +// faces. +internalFacesOnly true; + + +// Baffles to create. +baffles +{ + cyclicFaces + { + //- Select faces and orientation through a searchableSurface + type searchableSurface; + surface searchablePlate; + origin (0.3042 0.0493 -100); + span (0 0.1584 200); + + patches + { + master + { + //- Master side patch + + name porous_half0; + type cyclic; + neighbourPatch porous_half1; + + //- Optional override of added patchfields. If not specified + // any added patchfields are of type calculated. + patchFields + { + p_rgh + { + type porousBafflePressure; + patchType cyclic; + D 700; + I 500; + length 1.05; + jump uniform 0; + value uniform 0; + } + } + } + slave + { + //- Slave side patch + + name porous_half1; + type cyclic; + neighbourPatch porous_half0; + + ${..master.patchFields} + } + } + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/ras/waterChannel/constant/RASProperties b/tutorials/multiphase/interFoam/ras/waterChannel/constant/RASProperties index e0e6b776a2718fb18c8fb279b523831255e7b3b3..34da39d900e58a47e81688d1a69958232b15cc58 100644 --- a/tutorials/multiphase/interFoam/ras/waterChannel/constant/RASProperties +++ b/tutorials/multiphase/interFoam/ras/waterChannel/constant/RASProperties @@ -21,5 +21,4 @@ turbulence on; printCoeffs on; - // ************************************************************************* // diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes index 44313d502d0f1656f7c94ed9109b2673d16b600c..9143f603f4b73ec4b100fd003d242e65af899c57 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes @@ -42,15 +42,15 @@ gradSchemes laplacianSchemes { - default Gauss linear limited 0.5; + default Gauss linear limited corrected 0.5; } snGradSchemes { default none; - snGrad(pd) limited 0.5; - snGrad(rho) limited 0.5; - snGrad(alpha1) limited 0.5; + snGrad(pd) limited corrected 0.5; + snGrad(rho) limited corrected 0.5; + snGrad(alpha1) limited corrected 0.5; } fluxRequired diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict index 5150850030ac242e598558d58da560e03415393c..48e88d648bd38daff282bbb43c88a35e286ae381 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/snappyHexMeshDict @@ -210,32 +210,32 @@ addLayersControls // Expansion factor for layer mesh expansionRatio 1.0; - //- Wanted thickness of final added cell layer. If multiple layers - // is the - // thickness of the layer furthest away from the wall. - // Relative to undistorted size of cell outside layer. + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. finalLayerThickness 0.3; - //- Minimum thickness of cell layer. If for any reason layer - // cannot be above minThickness do not add layer. - // Relative to undistorted size of cell outside layer. + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. minThickness 0.1; - //- If points get not extruded do nGrow layers of connected faces that are - // also not grown. This helps convergence of the layer addition process - // close to features. + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) nGrow 0; // Advanced settings - //- When not to extrude surface. 0 is flat surface, 90 is when two faces - // make straight angle. + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular featureAngle 30; - //- Maximum number of snapping relaxation iterations. Should stop - // before upon reaching a correct mesh. + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. nRelaxIter 3; // Number of smoothing iterations of surface normals diff --git a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties similarity index 95% rename from tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones rename to tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties index de81c73439850dabae0c51d6f0b899921f752af6..fd749d03963870c76ab4a9d85ad86bd95c33a71f 100644 --- a/tutorials/compressible/rhoPorousMRFSimpleFoam/angledDuctExplicitFixedCoeff/constant/MRFZones +++ b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFProperties @@ -11,11 +11,10 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -0 -() +// none // ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/bubbleColumn/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..fd749d03963870c76ab4a9d85ad86bd95c33a71f --- /dev/null +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFProperties @@ -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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phase/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..fd749d03963870c76ab4a9d85ad86bd95c33a71f --- /dev/null +++ b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFProperties @@ -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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/damBreak4phaseFine/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties similarity index 76% rename from tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones rename to tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties index d1c9dd95d9f98bd6f5052a6c28b7fff8d3edaba0..8712458a97f59faf84c16b1cfe8d6da06bd442b7 100644 --- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/MRFZones +++ b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); - origin (0 0 0); - axis (0 0 1); - omega constant 104.72; - } -) + origin (0 0 0); + axis (0 0 1); + omega constant 10.472; +} // ************************************************************************* // diff --git a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index 7dd518ca65d8ab7e3c12ffd41ff52ad35244c701..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/multiphaseEulerFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 10.472; - } -) - -// ************************************************************************* // diff --git a/tutorials/multiphase/settlingFoam/ras/dahl/0/alpha b/tutorials/multiphase/settlingFoam/ras/dahl/0/Alpha similarity index 98% rename from tutorials/multiphase/settlingFoam/ras/dahl/0/alpha rename to tutorials/multiphase/settlingFoam/ras/dahl/0/Alpha index 807802b1d15435b47f708ba6d7cb0b4416e12d16..2ed64edd595478df49049f5d4062ddb25c31310c 100644 --- a/tutorials/multiphase/settlingFoam/ras/dahl/0/alpha +++ b/tutorials/multiphase/settlingFoam/ras/dahl/0/Alpha @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha; + object Alpha; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/settlingFoam/ras/dahl/constant/polyMesh/boundary b/tutorials/multiphase/settlingFoam/ras/dahl/constant/polyMesh/boundary index 35adf2fb7d30e9777dab806fdd576bcdd37634cc..f460b43a07f06776c86cd1145e597f7ed83e4692 100644 --- a/tutorials/multiphase/settlingFoam/ras/dahl/constant/polyMesh/boundary +++ b/tutorials/multiphase/settlingFoam/ras/dahl/constant/polyMesh/boundary @@ -50,6 +50,7 @@ FoamFile frontAndBack { type empty; + inGroups 1(empty); nFaces 16000; startFace 16240; } diff --git a/tutorials/multiphase/settlingFoam/ras/tank3D/0/alpha b/tutorials/multiphase/settlingFoam/ras/tank3D/0/Alpha similarity index 98% rename from tutorials/multiphase/settlingFoam/ras/tank3D/0/alpha rename to tutorials/multiphase/settlingFoam/ras/tank3D/0/Alpha index 67aa1fa666a89cb66b1db8fccfb9f8120810ad88..6bbcf6c93bb5396b45f2824883be4f1b7fffc268 100644 --- a/tutorials/multiphase/settlingFoam/ras/tank3D/0/alpha +++ b/tutorials/multiphase/settlingFoam/ras/tank3D/0/Alpha @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha; + object Alpha; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..fd749d03963870c76ab4a9d85ad86bd95c33a71f --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFProperties @@ -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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..fd749d03963870c76ab4a9d85ad86bd95c33a71f --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFProperties @@ -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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/bed2/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties new file mode 100644 index 0000000000000000000000000000000000000000..fd749d03963870c76ab4a9d85ad86bd95c33a71f --- /dev/null +++ b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFProperties @@ -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 MRFProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// none + +// ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones deleted file mode 100644 index 0034a58c2293992131cec848f2dcb0f8ad50a0d4..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/bubbleColumn/constant/MRFZones +++ /dev/null @@ -1,20 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -0() - -// ************************************************************************* // diff --git a/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties similarity index 76% rename from tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFZones rename to tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties index ec52208dc086647fac0e39ddc1c8c7f582f549e7..8712458a97f59faf84c16b1cfe8d6da06bd442b7 100644 --- a/tutorials/multiphase/MRFInterFoam/mixerVessel2D/constant/MRFZones +++ b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFProperties @@ -11,21 +11,21 @@ FoamFile format ascii; class dictionary; location "constant"; - object MRFZones; + object MRFProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); +zone1 +{ + cellZone rotor; + active yes; + + // Fixed patches (by default they 'move' with the MRF zone) + nonRotatingPatches (); - origin (0 0 0); - axis (0 0 1); - omega constant 6.2831853; - } -) + origin (0 0 0); + axis (0 0 1); + omega constant 10.472; +} // ************************************************************************* // diff --git a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones b/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones deleted file mode 100644 index 7dd518ca65d8ab7e3c12ffd41ff52ad35244c701..0000000000000000000000000000000000000000 --- a/tutorials/multiphase/twoPhaseEulerFoam/mixerVessel2D/constant/MRFZones +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location "constant"; - object MRFZones; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -1 -( - rotor - { - // Fixed patches (by default they 'move' with the MRF zone) - nonRotatingPatches (); - - origin (0 0 0); - axis (0 0 1); - omega constant 10.472; - } -) - -// ************************************************************************* // diff --git a/wmake/rules/General/CGAL b/wmake/rules/General/CGAL index cfb02d716abda593740b3b21149e67ac1ffa9803..167a420ab6d938a0b176382123424ffc88b35576 100644 --- a/wmake/rules/General/CGAL +++ b/wmake/rules/General/CGAL @@ -7,4 +7,5 @@ CGAL_INC = \ CGAL_LIBS = \ -L$(MPFR_ARCH_PATH)/lib \ + -L$(GMP_ARCH_PATH)/lib \ -L$(BOOST_ARCH_PATH)/lib