diff --git a/applications/solvers/combustion/fireFoam/Make/options b/applications/solvers/combustion/fireFoam/Make/options index 87e841be8e..bdf679ccde 100644 --- a/applications/solvers/combustion/fireFoam/Make/options +++ b/applications/solvers/combustion/fireFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -22,7 +23,9 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ - -I$(LIB_SRC)/ODE/lnInclude + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -49,4 +52,7 @@ EXE_LIBS = \ -llagrangian \ -llagrangianIntermediate \ -llagrangianTurbulence \ - -lODE + -lODE \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/Make/options index 2118219cfe..717240ffec 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/Make/options @@ -8,7 +8,8 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/regionFaModels\lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -23,4 +24,5 @@ EXE_LIBS = \ -ldynamicFvMesh \ -ltopoChangerFvMesh \ -lsampling \ - -latmosphericModels + -latmosphericModels \ + -lregionFaModels diff --git a/applications/solvers/compressible/rhoSimpleFoam/Make/options b/applications/solvers/compressible/rhoSimpleFoam/Make/options index 806154972b..dd872bce90 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoSimpleFoam/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/regionFaModels\lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -18,4 +19,5 @@ EXE_LIBS = \ -lspecie \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ - -latmosphericModels + -latmosphericModels \ + -lregionFaModels diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options index 519e80ffe2..d3224df411 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options @@ -6,7 +6,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/regionFaModels\lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -19,4 +20,5 @@ EXE_LIBS = \ -lspecie \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ - -latmosphericModels + -latmosphericModels \ + -lregionFaModels diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options index 40ada6b54a..322b0c4488 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/Make/options @@ -6,7 +6,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/regionFaModels\lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -19,4 +20,5 @@ EXE_LIBS = \ -lradiationModels \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ - -latmosphericModels + -latmosphericModels \ + -lregionFaModels diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options index 4a527e03e6..0a16d78b2f 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options @@ -18,7 +18,8 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ - -I$(LIB_SRC)/regionModels/regionModel/lnInclude + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionFaModels\lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -36,4 +37,5 @@ EXE_LIBS = \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ -lradiationModels \ - -lregionModels + -lregionModels \ + -lregionFaModels diff --git a/applications/solvers/incompressible/pimpleFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/Make/options index 584c27112d..2525075dd7 100644 --- a/applications/solvers/incompressible/pimpleFoam/Make/options +++ b/applications/solvers/incompressible/pimpleFoam/Make/options @@ -7,7 +7,8 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels\lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -20,4 +21,5 @@ EXE_LIBS = \ -ldynamicMesh \ -ldynamicFvMesh \ -ltopoChangerFvMesh \ - -latmosphericModels + -latmosphericModels \ + -lregionFaModels diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options index 03b1e8a243..eca5c04b54 100644 --- a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/MPPICDyMFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I../.. \ -I../../DPMTurbulenceModels \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -19,7 +20,9 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -39,4 +42,7 @@ EXE_LIBS = \ -ldynamicMesh \ -ldynamicFvMesh \ -ltopoChangerFvMesh \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options index 14fd3e8bf1..a1f3342a0d 100644 --- a/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options +++ b/applications/solvers/lagrangian/DPMFoam/DPMDyMFoam/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I.. \ -I../DPMTurbulenceModels \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -18,7 +19,9 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -38,4 +41,7 @@ EXE_LIBS = \ -ldynamicMesh \ -ldynamicFvMesh \ -ltopoChangerFvMesh \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options index 419d56725a..2b9bf8a79b 100644 --- a/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options +++ b/applications/solvers/lagrangian/DPMFoam/MPPICFoam/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I.. \ -I../DPMTurbulenceModels \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -17,6 +18,8 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -33,4 +36,7 @@ EXE_LIBS = \ -lDPMTurbulenceModels \ -lregionModels \ -lsurfaceFilmModels \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/DPMFoam/Make/options b/applications/solvers/lagrangian/DPMFoam/Make/options index e16be0b444..8d87d5e8fd 100644 --- a/applications/solvers/lagrangian/DPMFoam/Make/options +++ b/applications/solvers/lagrangian/DPMFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I./DPMTurbulenceModels \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -14,7 +15,9 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -31,4 +34,7 @@ EXE_LIBS = \ -lDPMTurbulenceModels \ -lregionModels \ -lsurfaceFilmModels \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options index 3b3ee4cabc..3fa33f6364 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options +++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ @@ -17,6 +18,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/combustion/reactingFoam \ @@ -44,4 +47,7 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -lODE \ -lcombustionModels \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options index 96f1493726..1c5d6ac4c7 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -13,7 +14,9 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -30,4 +33,7 @@ EXE_LIBS = \ -lincompressibleTurbulenceModels \ -lincompressibleTransportModels \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options index 61823c498c..5efb8a48e4 100644 --- a/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options +++ b/applications/solvers/lagrangian/icoUncoupledKinematicParcelFoam/icoUncoupledKinematicParcelDyMFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I.. \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -16,7 +17,9 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -36,4 +39,7 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -ldynamicMesh \ -ldynamicFvMesh \ - -ltopoChangerFvMesh + -ltopoChangerFvMesh \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/Make/files b/applications/solvers/lagrangian/kinematicParcelFoam/Make/files new file mode 100644 index 0000000000..a63fc64fa7 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/Make/files @@ -0,0 +1,3 @@ +kinematicParcelFoam.C + +EXE = $(FOAM_APPBIN)/kinematicParcelFoam diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/Make/options b/applications/solvers/lagrangian/kinematicParcelFoam/Make/options new file mode 100644 index 0000000000..d7531a9d73 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/Make/options @@ -0,0 +1,42 @@ +EXE_INC = \ + -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude + + +EXE_LIBS = \ + -lfiniteVolume \ + -lfvOptions \ + -lmeshTools \ + -lsampling \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -ldynamicMesh \ + -ldynamicFvMesh \ + -ltopoChangerFvMesh \ + -latmosphericModels \ + -lregionModels \ + -lsurfaceFilmModels \ + -lsurfaceFilmDerivedFvPatchFields \ + -llagrangian \ + -llagrangianIntermediate \ + -llagrangianTurbulence \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/UEqn.H b/applications/solvers/lagrangian/kinematicParcelFoam/UEqn.H new file mode 100644 index 0000000000..0e4177b8e1 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/UEqn.H @@ -0,0 +1,22 @@ + MRF.correctBoundaryVelocity(U); + + fvVectorMatrix UEqn + ( + fvm::ddt(U) + fvm::div(phi, U) + + MRF.DDt(U) + + turbulence->divDevReff(U) + == + parcels.SU(U, true) + + fvOptions(U) + ); + + UEqn.relax(); + + fvOptions.constrain(UEqn); + + if (pimple.momentumPredictor()) + { + solve(UEqn == -fvc::grad(p)); + + fvOptions.correct(U); + } diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/createClouds.H b/applications/solvers/lagrangian/kinematicParcelFoam/createClouds.H new file mode 100644 index 0000000000..c2d9dd8d6b --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/createClouds.H @@ -0,0 +1,16 @@ +const word kinematicCloudName +( + args.getOrDefault("cloud", "kinematicCloud") +); + +Info<< "Constructing kinematicCloud " << kinematicCloudName << endl; + +basicKinematicCloud parcels +( + kinematicCloudName, + rhoInf, + U, + muc, + g +); + diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/createFieldRefs.H b/applications/solvers/lagrangian/kinematicParcelFoam/createFieldRefs.H new file mode 100644 index 0000000000..7a0c96f071 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/createFieldRefs.H @@ -0,0 +1 @@ +regionModels::surfaceFilmModel& surfaceFilm = tsurfaceFilm(); diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/createFields.H b/applications/solvers/lagrangian/kinematicParcelFoam/createFields.H new file mode 100644 index 0000000000..0182144d86 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/createFields.H @@ -0,0 +1,85 @@ +#include "readGravitationalAcceleration.H" + +Info<< "Reading field p\n" << endl; +volScalarField p +( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +Info<< "\nReading field U\n" << endl; +volVectorField U +( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh +); + +#include "createPhi.H" + +singlePhaseTransportModel laminarTransport(U, phi); + +dimensionedScalar rhoInfValue +( + "rhoInf", + dimDensity, + laminarTransport +); + +volScalarField rhoInf +( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + rhoInfValue +); + +volScalarField muc +( + IOobject + ( + "muc", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + rhoInf*laminarTransport.nu() +); + +Info<< "Creating turbulence model\n" << endl; +autoPtr turbulence +( + incompressible::turbulenceModel::New(U, phi, laminarTransport) +); + +label pRefCell = 0; +scalar pRefValue = 0.0; +setRefCell(p, pimple.dict(), pRefCell, pRefValue); +mesh.setFluxRequired(p.name()); + +#include "createMRF.H" +#include "createClouds.H" +#include "createSurfaceFilmModel.H" +#include "createFvOptions.H" + + diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/kinematicParcelFoam.C b/applications/solvers/lagrangian/kinematicParcelFoam/kinematicParcelFoam.C new file mode 100644 index 0000000000..8fa73e53e5 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/kinematicParcelFoam.C @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Application + kinematicParcelFoam + +Group + grpLagrangianSolvers + +Description + Transient solver for incompressible, turbulent flow with kinematic, + particle cloud, and surface film modelling. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "dynamicFvMesh.H" +#include "singlePhaseTransportModel.H" +#include "turbulentTransportModel.H" +#include "surfaceFilmModel.H" +#include "basicKinematicCloud.H" +#include "fvOptions.H" +#include "pimpleControl.H" +#include "CorrectPhi.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::addNote + ( + "Transient solver for incompressible, turbulent flow" + " with kinematic particle clouds" + " and surface film modelling." + ); + + #define CREATE_MESH createMeshesPostProcess.H + #include "postProcess.H" + + #include "addCheckCaseOptions.H" + #include "setRootCaseLists.H" + #include "createTime.H" + #include "createDynamicFvMesh.H" + #include "initContinuityErrs.H" + #include "createDyMControls.H" + #include "createFields.H" + #include "createFieldRefs.H" + #include "createRegionControls.H" + #include "createUfIfPresent.H" + + turbulence->validate(); + + #include "CourantNo.H" + #include "setInitialDeltaT.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readDyMControls.H" + #include "CourantNo.H" + #include "setMultiRegionDeltaT.H" + + ++runTime; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + // Store the particle positions + parcels.storeGlobalPositions(); + + // Do any mesh changes + mesh.update(); + + if (solvePrimaryRegion && mesh.changing()) + { + MRF.update(); + + if (correctPhi) + { + // Calculate absolute flux + // from the mapped surface velocity + phi = mesh.Sf() & Uf(); + + #include "../../incompressible/pimpleFoam/correctPhi.H" + + // Make the fluxes relative to the mesh-motion + fvc::makeRelative(phi, U); + } + + if (checkMeshCourantNo) + { + #include "meshCourantNo.H" + } + } + + parcels.evolve(); + surfaceFilm.evolve(); + + if (solvePrimaryRegion) + { + // --- PIMPLE loop + while (pimple.loop()) + { + #include "UEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + laminarTransport.correct(); + turbulence->correct(); + } + } + } + + runTime.write(); + + runTime.printExecutionTime(Info); + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/solvers/lagrangian/kinematicParcelFoam/pEqn.H b/applications/solvers/lagrangian/kinematicParcelFoam/pEqn.H new file mode 100644 index 0000000000..631df1b4a8 --- /dev/null +++ b/applications/solvers/lagrangian/kinematicParcelFoam/pEqn.H @@ -0,0 +1,62 @@ + +volScalarField rAU(1.0/UEqn.A()); +volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); + +surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); + +if (pimple.ddtCorr()) +{ + phiHbyA += MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf)); +} +else +{ + phiHbyA += MRF.zeroFilter(fvc::interpolate(rAU)); +} + +MRF.makeRelative(phiHbyA); + +if (p.needReference()) +{ + fvc::makeRelative(phiHbyA, U); + adjustPhi(phiHbyA, U, p); + fvc::makeAbsolute(phiHbyA, U); +} + + +// Update the pressure BCs to ensure flux consistency +constrainPressure(p, U, phiHbyA, rAU, MRF); + +// Non-orthogonal pressure corrector loop +while (pimple.correctNonOrthogonal()) +{ + fvScalarMatrix pEqn + ( + fvm::laplacian(rAU, p) + == + fvc::div(phiHbyA) + ); + + pEqn.setReference(pRefCell, pRefValue); + + pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); + + if (pimple.finalNonOrthogonalIter()) + { + phi = phiHbyA - pEqn.flux(); + } +} + +#include "continuityErrs.H" + +p.relax(); + +U = HbyA - rAU*fvc::grad(p); +U.correctBoundaryConditions(); +fvOptions.correct(U); + +// Correct rhoUf if the mesh is moving +fvc::correctUf(Uf, U, phi); + +// Make the fluxes relative to the mesh motion +fvc::makeRelative(phi, U); + diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index 34adc463dd..70ec7ed080 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I../reactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ @@ -18,6 +19,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ @@ -48,4 +51,7 @@ EXE_LIBS = \ -llagrangianIntermediate \ -llagrangianTurbulence \ -lODE \ - -lcombustionModels + -lcombustionModels \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H index eee7772c23..6984cc6178 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createFields.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createFields.H @@ -11,7 +11,11 @@ basicSpecieMixture& composition = thermo.composition(); PtrList& Y = composition.Y(); const word inertSpecie(thermo.get("inertSpecie")); -if (!composition.species().found(inertSpecie)) +if +( + !composition.species().found(inertSpecie) + && composition.species().size() > 0 +) { FatalIOErrorIn(args.executable().c_str(), thermo) << "Inert specie " << inertSpecie << " not found in available species " diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options index 9afe29d442..d307b5260c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingHeterogenousParcelFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I.. \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ @@ -18,6 +19,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/ODE/lnInclude \ @@ -47,4 +50,7 @@ EXE_LIBS = \ -llagrangianIntermediate \ -llagrangianTurbulence \ -lODE \ - -lcombustionModels + -lcombustionModels \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options index fee9c9890e..6b2a725729 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/simpleReactingParcelFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -19,6 +20,8 @@ EXE_INC = \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(FOAM_SOLVERS)/combustion/reactingFoam @@ -43,4 +46,7 @@ EXE_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -lcombustionModels \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options b/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options index 0942257a8e..8612aedf9c 100644 --- a/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options +++ b/applications/solvers/lagrangian/simpleCoalParcelFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -20,7 +21,9 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -43,4 +46,7 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -lcombustionModels \ -lsampling \ - -lcoalCombustion + -lcoalCombustion \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options index 3e7fecf2e1..1d71196306 100644 --- a/applications/solvers/lagrangian/sprayFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I../reactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -20,6 +21,8 @@ EXE_INC = \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ -I$(LIB_SRC)/combustionModels/lnInclude EXE_LIBS = \ @@ -44,4 +47,7 @@ EXE_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -lcombustionModels \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/sprayFoam/engineFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/engineFoam/Make/options index e036f2a908..7a8c521c90 100644 --- a/applications/solvers/lagrangian/sprayFoam/engineFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/engineFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I.. \ -I../../reactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -23,7 +24,9 @@ EXE_INC = \ -I$(LIB_SRC)/engine/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/combustionModels/lnInclude + -I$(LIB_SRC)/combustionModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -48,4 +51,7 @@ EXE_LIBS = \ -lengine \ -lregionModels \ -lsurfaceFilmModels \ - -lcombustionModels + -lcombustionModels \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options index 565af71908..151225cb07 100644 --- a/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/simpleSprayFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam/simpleReactingParcelFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -20,7 +21,9 @@ EXE_INC = \ -I$(LIB_SRC)/ODE/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/combustionModels/lnInclude + -I$(LIB_SRC)/combustionModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -44,4 +47,7 @@ EXE_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -lcombustionModels \ - -lsampling + -lsampling \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options index cd6c9ef7b8..c7501564d2 100644 --- a/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options +++ b/applications/solvers/lagrangian/sprayFoam/sprayDyMFoam/Make/options @@ -3,6 +3,7 @@ EXE_INC = \ -I../../reactingParcelFoam \ -I../../../compressible/rhoPimpleFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I${LIB_SRC}/meshTools/lnInclude \ -I${LIB_SRC}/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ @@ -25,7 +26,9 @@ EXE_INC = \ -I$(LIB_SRC)/combustionModels/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -51,4 +54,7 @@ EXE_LIBS = \ -lcombustionModels \ -ldynamicFvMesh \ -ltopoChangerFvMesh \ - -ldynamicMesh + -ldynamicMesh \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options index 1bab76259c..18c419a495 100644 --- a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options +++ b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -11,7 +12,9 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude \ EXE_LIBS = \ -lfiniteVolume \ @@ -27,4 +30,7 @@ EXE_LIBS = \ -lturbulenceModels \ -lcompressibleTurbulenceModels \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelDyMFoam/Make/options b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelDyMFoam/Make/options index f41d858bf7..067d0c0311 100644 --- a/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelDyMFoam/Make/options +++ b/applications/solvers/lagrangian/uncoupledKinematicParcelFoam/uncoupledKinematicParcelDyMFoam/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I.. \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ @@ -14,7 +15,9 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -33,4 +36,7 @@ EXE_LIBS = \ -lsurfaceFilmModels \ -ldynamicMesh \ -ldynamicFvMesh \ - -ltopoChangerFvMesh + -ltopoChangerFvMesh \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions diff --git a/applications/solvers/multiphase/MPPICInterFoam/Make/options b/applications/solvers/multiphase/MPPICInterFoam/Make/options index 337f90f686..078ccece86 100644 --- a/applications/solvers/multiphase/MPPICInterFoam/Make/options +++ b/applications/solvers/multiphase/MPPICInterFoam/Make/options @@ -2,6 +2,7 @@ EXE_INC = \ -I../VoF \ -I$(FOAM_SOLVERS)/multiphase/interFoam \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/fvOptions/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ @@ -20,7 +21,9 @@ EXE_INC = \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude EXE_LIBS = \ -lfiniteVolume \ @@ -38,3 +41,4 @@ EXE_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -lcompressibleTwoPhaseMixtureTurbulenceModels + diff --git a/src/Allwmake b/src/Allwmake index e488f93978..0af702324e 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -83,14 +83,18 @@ wmake $targetType ODE thermophysicalModels/Allwmake $targetType $* TurbulenceModels/Allwmake $targetType $* wmake $targetType combustionModels + +wmakeLnInclude -u regionFaModels +wmakeLnInclude -u faOptions regionModels/Allwmake $targetType $* -lagrangian/Allwmake $targetType $* wmake $targetType fvOptions wmake $targetType faOptions wmake $targetType fvMotionSolver wmake $targetType regionFaModels +lagrangian/Allwmake $targetType $* + wmake $targetType overset # snappyHexMesh uses overset voxelMesh diff --git a/src/faOptions/corrections/limitVelocity/limitVelocity.C b/src/faOptions/corrections/limitVelocity/limitVelocity.C new file mode 100644 index 0000000000..fa2f484fab --- /dev/null +++ b/src/faOptions/corrections/limitVelocity/limitVelocity.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "limitVelocity.H" +#include "areaFields.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fa +{ + defineTypeNameAndDebug(limitVelocity, 0); + addToRunTimeSelectionTable + ( + option, + limitVelocity, + dictionary + ); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fa::limitVelocity::limitVelocity +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvPatch& patch +) +: + faceSetOption(name, modelType, dict, patch), + UName_(coeffs_.getOrDefault("U", "U")), + max_(coeffs_.get("max")) +{ + fieldNames_.setSize(1, UName_); + applied_.setSize(1, false); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::fa::limitVelocity::read(const dictionary& dict) +{ + if (faceSetOption::read(dict)) + { + coeffs_.readEntry("max", max_); + + return true; + } + + return false; +} + + +void Foam::fa::limitVelocity::correct(areaVectorField& U) +{ + const scalar maxSqrU = sqr(max_); + + vectorField& Uif = U.primitiveFieldRef(); + + for (const label facei : faces_) + { + const scalar magSqrUi = magSqr(Uif[facei]); + + if (magSqrUi > maxSqrU) + { + Uif[facei] *= sqrt(maxSqrU/max(magSqrUi, SMALL)); + } + } + + // handle boundaries in the case of 'all' + if (selectionMode_ == smAll) + { + areaVectorField::Boundary& Ubf = U.boundaryFieldRef(); + + forAll(Ubf, patchi) + { + faPatchVectorField& Up = Ubf[patchi]; + + if (!Up.fixesValue()) + { + forAll(Up, facei) + { + const scalar magSqrUi = magSqr(Up[facei]); + + if (magSqrUi > maxSqrU) + { + Up[facei] *= sqrt(maxSqrU/max(magSqrUi, SMALL)); + } + } + } + } + } + + // We've changed internal values so give boundary conditions opportunity + // to correct. + U.correctBoundaryConditions(); +} + + +// ************************************************************************* // diff --git a/src/faOptions/corrections/limitVelocity/limitVelocity.H b/src/faOptions/corrections/limitVelocity/limitVelocity.H new file mode 100644 index 0000000000..e5da8a400a --- /dev/null +++ b/src/faOptions/corrections/limitVelocity/limitVelocity.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fa::limitVelocity + +Description + Limits the maximum velocity magnitude to the specified \c max value. + +Usage + Minimal example by using \c constant/faOptions: + \verbatim + + { + // Mandatory entries + type limitVelocity; + active yes; + selectionMode all; + max ; + + // Optional entries + U ; + + // Inherited entries + ... + } + \endverbatim + + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: limitVelocity | word | yes | - + max | Maximum velocity limit [m/s] | scalar | yes | - + U | Name of operand velocity field | word | no | U + \endtable + + The inherited entries are elaborated in: + - \link fvOption.H \endlink + - \link faceSetOption.H \endlink + +SourceFiles + limitVelocity.C + +\*---------------------------------------------------------------------------*/ + +#ifndef limitVelocity_H +#define limitVelocity_H + +#include "faceSetOption.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fa +{ + +/*---------------------------------------------------------------------------*\ + Class limitVelocity Declaration +\*---------------------------------------------------------------------------*/ + +class limitVelocity +: + public faceSetOption +{ +protected: + + // Protected Data + + //- Name of operand velocity field + word UName_; + + //- Maximum velocity magnitude + scalar max_; + + +private: + + // Private Member Functions + + //- No copy construct + limitVelocity(const limitVelocity&) = delete; + + //- No copy assignment + void operator=(const limitVelocity&) = delete; + + +public: + + //- Runtime type information + TypeName("limitVelocity"); + + + // Constructors + + //- Construct from components + limitVelocity + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvPatch& patch + ); + + + //- Destructor + virtual ~limitVelocity() = default; + + + // Member Functions + + //- Read dictionary + virtual bool read(const dictionary& dict); + + //- Correct the velocity field + virtual void correct(areaVectorField& U); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.C b/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.C index e812353649..01bc10a050 100644 --- a/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.C +++ b/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -65,6 +65,36 @@ Foam::tmp> Foam::volSurfaceMapping::mapToSurface } +template +Foam::tmp> Foam::volSurfaceMapping::mapToSurface +( + const Field& f +) const +{ + const labelList& faceLabels = mesh_.faceLabels(); + + auto tresult = tmp>::New(faceLabels.size(), Zero); + auto& result = tresult.ref(); + + const polyMesh& pMesh = mesh_(); + const polyBoundaryMesh& bm = pMesh.boundaryMesh(); + label patchID, faceID; + + forAll(faceLabels, i) + { + if (faceLabels[i] < pMesh.nFaces()) + { + patchID = bm.whichPatch(faceLabels[i]); + faceID = bm[patchID].whichFace(faceLabels[i]); + + result[i] = f[faceID]; + } + } + + return tresult; +} + + template Foam::tmp> Foam::volSurfaceMapping::mapInternalToSurface ( @@ -151,6 +181,19 @@ void Foam::volSurfaceMapping::mapToField const GeometricField& af, Field& f ) const +{ + const Field& afi = af.internalField(); + + mapToField(afi, f); +} + + +template +void Foam::volSurfaceMapping::mapToField +( + const Field& af, + Field& f +) const { const labelList& faceLabels = mesh_.faceLabels(); @@ -158,15 +201,13 @@ void Foam::volSurfaceMapping::mapToField const polyBoundaryMesh& bm = pMesh.boundaryMesh(); label patchID, faceID; - const Field& afi = af.internalField(); - forAll(faceLabels, i) { if (faceLabels[i] < pMesh.nFaces()) { patchID = bm.whichPatch(faceLabels[i]); faceID = bm[patchID].whichFace(faceLabels[i]); - f[faceID] = afi[i]; + f[faceID] = af[i]; } } } diff --git a/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.H b/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.H index 5b428f099c..f5908f04a4 100644 --- a/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.H +++ b/src/finiteArea/interpolation/volSurfaceMapping/volSurfaceMapping.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,6 +42,7 @@ SourceFiles #define volSurfaceMapping_H #include "faMesh.H" +#include "volMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -85,7 +86,7 @@ public: // Member Functions - //- Map droplet cloud sources to surface + //- Map Boundary field to surface template tmp> mapToSurface ( @@ -93,6 +94,9 @@ public: GeometricField::Boundary& df ) const; + //- Map vol Field to surface Field + template + tmp> mapToSurface(const Field& f) const; //- Map patch internal field to surface template @@ -118,14 +122,23 @@ public: typename GeometricField::Boundary& bf ) const; - //- Map surface field to field assumes Field - //- faces in the same order as Boundary + //- Map surface field to field + // Assumes Field faces in the same order as Boundary template void mapToField ( const GeometricField& af, Field& f ) const; + + //- Map surface field to volume field + // Assumes Field faces in the same order as Boundary + template + void mapToField + ( + const Field& af, + Field& f + ) const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C index 1592f3f382..7a9c170d7a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -92,6 +93,38 @@ movingWallVelocityFvPatchVectorField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::tmp +Foam::movingWallVelocityFvPatchVectorField::Uwall() const +{ + const fvMesh& mesh = internalField().mesh(); + const fvPatch& p = patch(); + const polyPatch& pp = p.patch(); + const pointField& oldPoints = mesh.oldPoints(); + + vectorField oldFc(pp.size()); + + forAll(oldFc, i) + { + oldFc[i] = pp[i].centre(oldPoints); + } + + const scalar deltaT = mesh.time().deltaTValue(); + + const vectorField Up((pp.faceCentres() - oldFc)/deltaT); + + const auto& U = static_cast(internalField()); + + tmp phip = + p.patchField(fvc::meshPhi(U)); + + const vectorField n(p.nf()); + const scalarField& magSf = p.magSf(); + tmp Un = phip/(magSf + VSMALL); + + return (Up + n*(Un - (n & Up))); +} + + void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs() { if (updated()) @@ -103,35 +136,7 @@ void Foam::movingWallVelocityFvPatchVectorField::updateCoeffs() if (mesh.moving()) { - const fvPatch& p = patch(); - const polyPatch& pp = p.patch(); - const pointField& oldPoints = mesh.oldPoints(); - - vectorField oldFc(pp.size()); - - forAll(oldFc, i) - { - oldFc[i] = pp[i].centre(oldPoints); - } - - const scalar deltaT = mesh.time().deltaTValue(); - - const vectorField Up((pp.faceCentres() - oldFc)/deltaT); - - const volVectorField& U = - static_cast(internalField()); - - scalarField phip - ( - p.patchField(fvc::meshPhi(U)) - ); - - const vectorField n(p.nf()); - const scalarField& magSf = p.magSf(); - tmp Un = phip/(magSf + VSMALL); - - - vectorField::operator=(Up + n*(Un - (n & Up))); + vectorField::operator=(Uwall()()); } fixedValueFvPatchVectorField::updateCoeffs(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H index bd272e9317..9b5b05cd7e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/movingWallVelocity/movingWallVelocityFvPatchVectorField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,7 +71,6 @@ class movingWallVelocityFvPatchVectorField : public fixedValueFvPatchVectorField { - public: //- Runtime type information @@ -140,7 +139,10 @@ public: } - // Member functions + // Member Functions + + //- Return wall velocity field + tmp Uwall() const; //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/src/functionObjects/lagrangian/Make/options b/src/functionObjects/lagrangian/Make/options index 26e35a3df7..c1d04b6d14 100644 --- a/src/functionObjects/lagrangian/Make/options +++ b/src/functionObjects/lagrangian/Make/options @@ -1,5 +1,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/conversion/lnInclude \ @@ -9,7 +10,9 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ -I$(LIB_SRC)/lagrangian/DSMC/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -21,4 +24,8 @@ LIB_LIBS = \ -llagrangianIntermediate \ -llagrangianTurbulence \ -lregionModels \ - -lsurfaceFilmModels + -lsurfaceFilmModels \ + -lregionFaModels \ + -lfiniteArea \ + -lfaOptions + diff --git a/src/lagrangian/coalCombustion/Make/options b/src/lagrangian/coalCombustion/Make/options index 25ee31bf7d..5947708176 100644 --- a/src/lagrangian/coalCombustion/Make/options +++ b/src/lagrangian/coalCombustion/Make/options @@ -18,7 +18,10 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -41,4 +44,6 @@ LIB_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -ldynamicMesh \ - -ldynamicFvMesh + -ldynamicFvMesh \ + -lregionFaModels \ + -lfiniteArea diff --git a/src/lagrangian/intermediate/Make/options b/src/lagrangian/intermediate/Make/options index d972d5b034..74eb95ca4c 100644 --- a/src/lagrangian/intermediate/Make/options +++ b/src/lagrangian/intermediate/Make/options @@ -16,7 +16,10 @@ EXE_INC = \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ + -I$(LIB_SRC)/regionFaModels/lnInclude \ + -I$(LIB_SRC)/finiteArea/lnInclude \ + -I$(LIB_SRC)/faOptions/lnInclude LIB_LIBS = \ -lfiniteVolume \ @@ -36,4 +39,6 @@ LIB_LIBS = \ -lregionModels \ -lsurfaceFilmModels \ -ldynamicMesh \ - -ldynamicFvMesh + -ldynamicFvMesh \ + -lregionFaModels \ + -lfiniteArea diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 788aa175e8..288c7ec747 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -534,8 +534,12 @@ public: inline const volScalarField::Internal& UCoeff() const; - //- Return tmp momentum source term - inline tmp SU(volVectorField& U) const; + //- Return tmp momentum source term (compressible) + inline tmp SU + ( + volVectorField& U, + bool incompressible = false + ) const; // Check diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 6e4a017bdb..b3e903aa94 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -468,7 +468,8 @@ Foam::KinematicCloud::UCoeff() const template inline Foam::tmp -Foam::KinematicCloud::SU(volVectorField& U) const +Foam::KinematicCloud::SU(volVectorField& U, bool incompressible) +const { if (debug) { @@ -478,18 +479,29 @@ Foam::KinematicCloud::SU(volVectorField& U) const << max(UCoeff()).value() << endl; } + dimensionSet dim(dimForce); + if (incompressible) + { + dim.reset(dimForce/dimDensity); + } + if (solution_.coupled()) { if (solution_.semiImplicit("U")) { - const volScalarField::Internal + volScalarField::Internal Vdt(mesh_.V()*this->db().time().deltaT()); + if (incompressible) + { + Vdt.dimensions() *= dimDensity; + } + return UTrans()/Vdt - fvm::Sp(UCoeff()/Vdt, U) + UCoeff()/Vdt*U; } else { - tmp tfvm(new fvVectorMatrix(U, dimForce)); + tmp tfvm(new fvVectorMatrix(U, dim)); fvVectorMatrix& fvm = tfvm.ref(); fvm.source() = -UTrans()/(this->db().time().deltaT()); @@ -498,7 +510,7 @@ Foam::KinematicCloud::SU(volVectorField& U) const } } - return tmp::New(U, dimForce); + return tmp::New(U, dim); } diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelSurfaceFilmModels.H index 7e2b1f9c73..de67215d6a 100644 --- a/src/lagrangian/intermediate/parcels/include/makeParcelSurfaceFilmModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeParcelSurfaceFilmModels.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,14 +32,15 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "NoSurfaceFilm.H" +#include "KinematicSurfaceFilm.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #define makeParcelSurfaceFilmModels(CloudType) \ \ makeSurfaceFilmModel(CloudType); \ - makeSurfaceFilmModelType(NoSurfaceFilm, CloudType); - + makeSurfaceFilmModelType(NoSurfaceFilm, CloudType); \ + makeSurfaceFilmModelType(KinematicSurfaceFilm, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H index 67dfb49a75..cdd181b255 100644 --- a/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeReactingParcelSurfaceFilmModels.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +33,7 @@ License #include "NoSurfaceFilm.H" #include "ThermoSurfaceFilm.H" +#include "KinematicSurfaceFilm.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,7 +41,8 @@ License \ makeSurfaceFilmModel(CloudType); \ makeSurfaceFilmModelType(NoSurfaceFilm, CloudType); \ - makeSurfaceFilmModelType(ThermoSurfaceFilm, CloudType); + makeSurfaceFilmModelType(ThermoSurfaceFilm, CloudType); \ + makeSurfaceFilmModelType(KinematicSurfaceFilm, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H b/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H index 57e4cfc689..4ba044be13 100644 --- a/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H +++ b/src/lagrangian/intermediate/parcels/include/makeThermoParcelSurfaceFilmModels.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,6 +33,7 @@ License #include "NoSurfaceFilm.H" #include "ThermoSurfaceFilm.H" +#include "KinematicSurfaceFilm.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,7 +42,8 @@ License makeSurfaceFilmModel(CloudType); \ \ makeSurfaceFilmModelType(NoSurfaceFilm, CloudType); \ - makeSurfaceFilmModelType(ThermoSurfaceFilm, CloudType); + makeSurfaceFilmModelType(ThermoSurfaceFilm, CloudType); \ + makeSurfaceFilmModelType(KinematicSurfaceFilm, CloudType); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C index 35076e8718..a610389b91 100644 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C +++ b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -85,11 +86,11 @@ void Foam::phaseProperties::reorder(const wordList& specieNames) if (!found) { - FatalErrorInFunction + WarningInFunction << "Could not find specie " << names0[i] << " in list " << names_ << " for phase " << phaseTypeNames[phase_] - << exit(FatalError); + << nl; } } } @@ -114,11 +115,11 @@ void Foam::phaseProperties::setCarrierIds } if (carrierIds_[i] == -1) { - FatalErrorInFunction + WarningInFunction << "Could not find carrier specie " << names_[i] << " in species list" << nl << "Available species are: " << nl << carrierNames << nl - << exit(FatalError); + << nl; } } } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 923af2c002..94e4961ca8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -5,8 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/KinematicSurfaceFilm/KinematicSurfaceFilm.C b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/KinematicSurfaceFilm/KinematicSurfaceFilm.C new file mode 100644 index 0000000000..a08e87e5c5 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/Kinematic/SurfaceFilmModel/KinematicSurfaceFilm/KinematicSurfaceFilm.C @@ -0,0 +1,823 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "KinematicSurfaceFilm.H" +#include "surfaceFilmRegionModel.H" +#include "liquidFilmModel.H" +#include "addToRunTimeSelectionTable.H" +#include "unitConversion.H" +#include "Pstream.H" + +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template +Foam::wordList Foam::KinematicSurfaceFilm::interactionTypeNames_ +{ + "absorb", "bounce", "splashBai" +}; + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +template +typename Foam::KinematicSurfaceFilm::interactionType +Foam::KinematicSurfaceFilm::interactionTypeEnum(const word& it) const +{ + forAll(interactionTypeNames_, i) + { + if (interactionTypeNames_[i] == it) + { + return interactionType(i); + } + } + + FatalErrorInFunction + << "Unknown interaction type " << it + << ". Valid interaction types include: " << interactionTypeNames_ + << abort(FatalError); + + return interactionType(0); +} + + +template +Foam::word Foam::KinematicSurfaceFilm::interactionTypeStr +( + const interactionType& it +) const +{ + if (it >= interactionTypeNames_.size()) + { + FatalErrorInFunction + << "Unknown interaction type enumeration" << abort(FatalError); + } + + return interactionTypeNames_[it]; +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template +Foam::vector Foam::KinematicSurfaceFilm::tangentVector +( + const vector& v +) const +{ + vector tangent(Zero); + scalar magTangent = 0.0; + + while (magTangent < SMALL) + { + const vector vTest(rndGen_.sample01()); + tangent = vTest - (vTest & v)*v; + magTangent = mag(tangent); + } + + return tangent/magTangent; +} + + +template +Foam::vector Foam::KinematicSurfaceFilm::splashDirection +( + const vector& tanVec1, + const vector& tanVec2, + const vector& nf +) const +{ + // Azimuthal angle [rad] + const scalar phiSi = twoPi*rndGen_.sample01(); + + // Ejection angle [rad] + const scalar thetaSi = degToRad(rndGen_.sample01()*(50 - 5) + 5); + + // Direction vector of new parcel + const scalar alpha = sin(thetaSi); + const scalar dcorr = cos(thetaSi); + const vector normal(alpha*(tanVec1*cos(phiSi) + tanVec2*sin(phiSi))); + vector dirVec(dcorr*nf); + dirVec += normal; + + return dirVec/mag(dirVec); +} + + +template +void Foam::KinematicSurfaceFilm::initFilmModels() +{ + const fvMesh& mesh = this->owner().mesh(); + + // set up filmModel pointer + if (!filmModel_) + { + filmModel_ = + const_cast + ( + mesh.time().objectRegistry::template findObject + < + regionFilm + > + ( + "surfaceFilmProperties" + ) + ); + } + + if (areaFilms_.size() == 0) + { + // set up areaFilms + const wordList names = + mesh.time().objectRegistry::template + sortedNames(); + + forAll(names, i) + { + const regionModels::regionFaModel* regionFa = + mesh.time().objectRegistry::template findObject + < + regionModels::regionFaModel + >(names[i]); + + if (regionFa && isA(*regionFa)) + { + areaFilm& film = + const_cast(refCast(*regionFa)); + areaFilms_.append(&film); + } + } + } +} + + +template +void Foam::KinematicSurfaceFilm::init(bool binitThermo) +{ + if (binitThermo) + { + this->coeffDict().readEntry("pRef", pRef_); + this->coeffDict().readEntry("TRef", TRef_); + thermo_ = new liquidMixtureProperties(this->coeffDict().subDict("thermo")); + } +} + + +template +template +void Foam::KinematicSurfaceFilm::absorbInteraction +( + filmType& film, + const parcelType& p, + const polyPatch& pp, + const label facei, + const scalar mass, + bool& keepParticle +) +{ + if (debug) + { + Info<< "Parcel " << p.origId() << " absorbInteraction" << endl; + } + + // Patch face normal + const vector& nf = pp.faceNormals()[facei]; + + // Patch velocity + const vector& Up = this->owner().U().boundaryField()[pp.index()][facei]; + + // Relative parcel velocity + const vector Urel(p.U() - Up); + + // Parcel normal velocity + const vector Un(nf*(Urel & nf)); + + // Parcel tangential velocity + const vector Ut(Urel - Un); + + film.addSources + ( + pp.index(), + facei, + mass, // mass + mass*Ut, // tangential momentum + mass*mag(Un), // impingement pressure + 0 // energy + ); + + this->nParcelsTransferred()++; + + this->totalMassTransferred() += mass; + + keepParticle = false; +} + + +template +void Foam::KinematicSurfaceFilm::bounceInteraction +( + parcelType& p, + const polyPatch& pp, + const label facei, + bool& keepParticle +) const +{ + if (debug) + { + Info<< "Parcel " << p.origId() << " bounceInteraction" << endl; + } + + // Patch face normal + const vector& nf = pp.faceNormals()[facei]; + + // Patch velocity + const vector& Up = this->owner().U().boundaryField()[pp.index()][facei]; + + // Relative parcel velocity + const vector Urel(p.U() - Up); + + // Flip parcel normal velocity component + p.U() -= 2.0*nf*(Urel & nf); + + keepParticle = true; +} + + +template +template +void Foam::KinematicSurfaceFilm::drySplashInteraction +( + filmType& filmModel, + const scalar sigma, + const scalar mu, + const parcelType& p, + const polyPatch& pp, + const label facei, + bool& keepParticle +) +{ + if (debug) + { + Info<< "Parcel " << p.origId() << " drySplashInteraction" << endl; + } + + // Patch face velocity and normal + const vector& Up = this->owner().U().boundaryField()[pp.index()][facei]; + const vector& nf = pp.faceNormals()[facei]; + + // Local pressure + //const scalar pc = thermo_.thermo().p()[p.cell()]; + + // Retrieve parcel properties + const scalar m = p.mass()*p.nParticle(); + const scalar rho = p.rho(); + const scalar d = p.d(); + const vector Urel(p.U() - Up); + const vector Un(nf*(Urel & nf)); + + // Laplace number + const scalar La = rho*sigma*d/sqr(mu); + + // Weber number + const scalar We = rho*magSqr(Un)*d/sigma; + + // Critical Weber number + const scalar Wec = Adry_*pow(La, -0.183); + + if (We < Wec) // Adhesion - assume absorb + { + absorbInteraction + (filmModel, p, pp, facei, m, keepParticle); + } + else // Splash + { + // Ratio of incident mass to splashing mass + const scalar mRatio = 0.2 + 0.6*rndGen_.sample01(); + splashInteraction + (filmModel, p, pp, facei, mRatio, We, Wec, sigma, keepParticle); + } +} + + +template +template +void Foam::KinematicSurfaceFilm::wetSplashInteraction +( + filmType& filmModel, + const scalar sigma, + const scalar mu, + parcelType& p, + const polyPatch& pp, + const label facei, + bool& keepParticle +) +{ + if (debug) + { + Info<< "Parcel " << p.origId() << " wetSplashInteraction" << endl; + } + + // Patch face velocity and normal + const vector& Up = this->owner().U().boundaryField()[pp.index()][facei]; + const vector& nf = pp.faceNormals()[facei]; + + // Retrieve parcel properties + const scalar m = p.mass()*p.nParticle(); + const scalar rho = p.rho(); + const scalar d = p.d(); + vector& U = p.U(); + const vector Urel(p.U() - Up); + const vector Un(nf*(Urel & nf)); + const vector Ut(Urel - Un); + + // Laplace number + const scalar La = rho*sigma*d/sqr(mu); + + // Weber number + const scalar We = rho*magSqr(Un)*d/sigma; + + // Critical Weber number + const scalar Wec = Awet_*pow(La, -0.183); + + if (We < 2) // Adhesion - assume absorb + { + absorbInteraction + (filmModel, p, pp, facei, m, keepParticle); + } + else if ((We >= 2) && (We < 20)) // Bounce + { + // Incident angle of impingement + const scalar theta = piByTwo - acos(U/mag(U) & nf); + + // Restitution coefficient + const scalar epsilon = 0.993 - theta*(1.76 - theta*(1.56 - theta*0.49)); + + // Update parcel velocity + U = -epsilon*(Un) + 5.0/7.0*(Ut); + + keepParticle = true; + return; + } + else if ((We >= 20) && (We < Wec)) // Spread - assume absorb + { + absorbInteraction + (filmModel, p, pp, facei, m, keepParticle); + } + else // Splash + { + // Ratio of incident mass to splashing mass + // splash mass can be > incident mass due to film entrainment + const scalar mRatio = 0.2 + 0.9*rndGen_.sample01(); + splashInteraction + (filmModel, p, pp, facei, mRatio, We, Wec, sigma, keepParticle); + } +} + + +template +template +void Foam::KinematicSurfaceFilm::splashInteraction +( + filmType& filmModel, + const parcelType& p, + const polyPatch& pp, + const label facei, + const scalar mRatio, + const scalar We, + const scalar Wec, + const scalar sigma, + bool& keepParticle +) +{ + // Patch face velocity and normal + const fvMesh& mesh = this->owner().mesh(); + const vector& Up = this->owner().U().boundaryField()[pp.index()][facei]; + const vector& nf = pp.faceNormals()[facei]; + + // Determine direction vectors tangential to patch normal + const vector tanVec1(tangentVector(nf)); + const vector tanVec2(nf^tanVec1); + + // Retrieve parcel properties + const scalar np = p.nParticle(); + const scalar m = p.mass()*np; + const scalar d = p.d(); + const vector Urel(p.U() - Up); + const vector Un(nf*(Urel & nf)); + const vector Ut(Urel - Un); + const vector& posC = mesh.C()[p.cell()]; + const vector& posCf = mesh.Cf().boundaryField()[pp.index()][facei]; + + // Total mass of (all) splashed parcels + const scalar mSplash = m*mRatio; + + // Number of splashed particles per incoming particle + const scalar Ns = 5.0*(We/Wec - 1.0); + + // Average diameter of splashed particles + const scalar dBarSplash = 1/cbrt(6.0)*cbrt(mRatio/Ns)*d + ROOTVSMALL; + + // Cumulative diameter splash distribution + const scalar dMax = 0.9*cbrt(mRatio)*d; + const scalar dMin = 0.1*dMax; + const scalar K = exp(-dMin/dBarSplash) - exp(-dMax/dBarSplash); + + // Surface energy of secondary parcels [J] + scalar ESigmaSec = 0; + + // Sample splash distribution to determine secondary parcel diameters + scalarList dNew(parcelsPerSplash_); + scalarList npNew(parcelsPerSplash_); + forAll(dNew, i) + { + const scalar y = rndGen_.sample01(); + dNew[i] = -dBarSplash*log(exp(-dMin/dBarSplash) - y*K); + npNew[i] = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_; + ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]); + } + + // Incident kinetic energy [J] + const scalar EKIn = 0.5*m*magSqr(Un); + + // Incident surface energy [J] + const scalar ESigmaIn = np*sigma*p.areaS(d); + + // Dissipative energy + const scalar Ed = max(0.8*EKIn, np*Wec/12*pi*sigma*sqr(d)); + + // Total energy [J] + const scalar EKs = EKIn + ESigmaIn - ESigmaSec - Ed; + + // Switch to absorb if insufficient energy for splash + if (EKs <= 0) + { + absorbInteraction + (filmModel, p, pp, facei, m, keepParticle); + return; + } + + // Helper variables to calculate magUns0 + const scalar logD = log(d); + const scalar coeff2 = log(dNew[0]) - logD + ROOTVSMALL; + scalar coeff1 = 0.0; + forAll(dNew, i) + { + coeff1 += sqr(log(dNew[i]) - logD); + } + + // Magnitude of the normal velocity of the first splashed parcel + const scalar magUns0 = + sqrt(2.0*parcelsPerSplash_*EKs/mSplash/(1.0 + coeff1/sqr(coeff2))); + + // Set splashed parcel properties + forAll(dNew, i) + { + const vector dirVec = splashDirection(tanVec1, tanVec2, -nf); + + // Create a new parcel by copying source parcel + parcelType* pPtr = new parcelType(p); + + pPtr->origId() = pPtr->getNewParticleID(); + + pPtr->origProc() = Pstream::myProcNo(); + + if (splashParcelType_ >= 0) + { + pPtr->typeId() = splashParcelType_; + } + + // Perturb new parcels towards the owner cell centre + pPtr->track(0.5*rndGen_.sample01()*(posC - posCf), 0); + + pPtr->nParticle() = npNew[i]; + + pPtr->d() = dNew[i]; + + pPtr->U() = dirVec*(mag(Cf_*Ut) + magUns0*(log(dNew[i]) - logD)/coeff2); + + // Apply correction to velocity for 2-D cases + meshTools::constrainDirection(mesh, mesh.solutionD(), pPtr->U()); + + // Add the new parcel + this->owner().addParticle(pPtr); + + nParcelsSplashed_++; + } + + // Transfer remaining part of parcel to film 0 - splashMass can be -ve + // if entraining from the film + const scalar mDash = m - mSplash; + absorbInteraction + (filmModel, p, pp, facei, mDash, keepParticle); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::KinematicSurfaceFilm::KinematicSurfaceFilm +( + const dictionary& dict, + CloudType& owner, + const word& type, + bool initThermo +) +: + SurfaceFilmModel(dict, owner, type), + rndGen_(owner.rndGen()), + thermo_(nullptr), + filmModel_(nullptr), + areaFilms_(0), + interactionType_ + ( + interactionTypeEnum(this->coeffDict().getWord("interactionType")) + ), + deltaWet_(0.0), + splashParcelType_(0), + parcelsPerSplash_(0), + Adry_(0.0), + Awet_(0.0), + Cf_(0.0), + nParcelsSplashed_(0) +{ + Info<< " Applying " << interactionTypeStr(interactionType_) + << " interaction model" << endl; + + if (interactionType_ == itSplashBai) + { + this->coeffDict().readEntry("deltaWet", deltaWet_); + splashParcelType_ = + this->coeffDict().getOrDefault("splashParcelType", -1); + parcelsPerSplash_ = + this->coeffDict().getOrDefault("parcelsPerSplash", 2); + this->coeffDict().readEntry("Adry", Adry_); + this->coeffDict().readEntry("Awet", Awet_); + this->coeffDict().readEntry("Cf", Cf_); + init(initThermo); + } +} + + +template +Foam::KinematicSurfaceFilm::KinematicSurfaceFilm +( + const KinematicSurfaceFilm& sfm, + bool initThermo +) +: + SurfaceFilmModel(sfm), + rndGen_(sfm.rndGen_), + thermo_(nullptr), + filmModel_(nullptr), + areaFilms_(0), + interactionType_(sfm.interactionType_), + deltaWet_(sfm.deltaWet_), + splashParcelType_(sfm.splashParcelType_), + parcelsPerSplash_(sfm.parcelsPerSplash_), + Adry_(sfm.Adry_), + Awet_(sfm.Awet_), + Cf_(sfm.Cf_), + nParcelsSplashed_(sfm.nParcelsSplashed_) +{ + if (interactionType_ == itSplashBai) + { + init(initThermo); + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +bool Foam::KinematicSurfaceFilm::transferParcel +( + parcelType& p, + const polyPatch& pp, + bool& keepParticle +) +{ + const label patchi = pp.index(); + + bool bInteraction(false); + + initFilmModels(); + + // Check the singleLayer film models + if (filmModel_) + { + if (filmModel_->isRegionPatch(patchi)) + { + const label facei = pp.whichFace(p.face()); + + switch (interactionType_) + { + case itBounce: + { + bounceInteraction(p, pp, facei, keepParticle); + + break; + } + case itAbsorb: + { + const scalar m = p.nParticle()*p.mass(); + + absorbInteraction + (*filmModel_, p, pp, facei, m, keepParticle); + + break; + } + case itSplashBai: + { + bool dry = this->deltaFilmPatch_[patchi][facei] < deltaWet_; + + const scalarField X(thermo_->size(), 1); + const scalar mu = thermo_->mu(pRef_, TRef_, X); + const scalar sigma = thermo_->sigma(pRef_, TRef_, X); + + if (dry) + { + drySplashInteraction + (*filmModel_, sigma, mu, p, pp, facei, keepParticle); + } + else + { + wetSplashInteraction + (*filmModel_, sigma, mu, p, pp, facei, keepParticle); + } + + break; + } + default: + { + FatalErrorInFunction + << "Unknown interaction type enumeration" + << abort(FatalError); + } + } + + // Transfer parcel/parcel interactions complete + bInteraction = true; + } + } + + + for (areaFilm& film : areaFilms_) + { + if (patchi == film.patchID()) + { + const label facei = pp.whichFace(p.face()); + + switch (interactionType_) + { + // It only supports absorp model + case itAbsorb: + { + const scalar m = p.nParticle()*p.mass(); + + absorbInteraction + ( + film, p, pp, facei, m, keepParticle + ); + break; + } + case itBounce: + { + bounceInteraction(p, pp, facei, keepParticle); + + break; + } + case itSplashBai: + { + bool dry = film.h()[facei] < deltaWet_; + + regionModels::areaSurfaceFilmModels::liquidFilmModel& liqFilm = + refCast + < regionModels::areaSurfaceFilmModels::liquidFilmModel + >(film); + + const scalarField X(liqFilm.thermo().size(), 1); + const scalar pRef = film.pRef(); + const scalar TRef = liqFilm.Tref(); + + const scalar mu = liqFilm.thermo().mu(pRef, TRef, X); + const scalar sigma = + liqFilm.thermo().sigma(pRef, TRef, X); + + if (dry) + { + drySplashInteraction + (film, sigma, mu, p, pp, facei, keepParticle); + } + else + { + wetSplashInteraction + (film, sigma, mu, p, pp, facei, keepParticle); + } + + break; + } + default: + { + FatalErrorInFunction + << "Unknown interaction type enumeration" + << abort(FatalError); + } + } + // Transfer parcel/parcel interactions complete + bInteraction = true; + } + } + + // Parcel not interacting with film + return bInteraction; +} + + +template +void Foam::KinematicSurfaceFilm::cacheFilmFields +( + const label filmPatchi, + const label primaryPatchi, + const regionModels::surfaceFilmModels::surfaceFilmRegionModel& filmModel +) +{ + SurfaceFilmModel::cacheFilmFields + ( + filmPatchi, + primaryPatchi, + filmModel + ); +} + + +template +void Foam::KinematicSurfaceFilm::cacheFilmFields +( + const label filmPatchi, + const areaFilm& filmModel +) +{ + SurfaceFilmModel::cacheFilmFields + ( + filmPatchi, + filmModel + ); +} + + +template +void Foam::KinematicSurfaceFilm::setParcelProperties +( + parcelType& p, + const label filmFacei +) const +{ + SurfaceFilmModel::setParcelProperties(p, filmFacei); +} + + +template +void Foam::KinematicSurfaceFilm::info(Ostream& os) +{ + SurfaceFilmModel::info(os); + + label nSplash0 = this->template getModelProperty