diff --git a/README b/README new file mode 100755 index 0000000..fd2ca75 --- /dev/null +++ b/README @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM. Note: this code is not part of OpenFOAM (see DISCLAIMER). +\*---------------------------------------------------------------------------*/ + + +CFDEM coupling provides an open source parallel coupled CFD-DEM framework +combining the strengths of LIGGGHTS DEM code and the Open Source +CFD package OpenFOAM(R)(*). The CFDEMcoupling toolbox allows to expand +standard CFD solvers of OpenFOAM(R)(*) to include a coupling to the DEM +code LIGGGHTS. In this toolbox the particle representation within the +CFD solver is organized by "cloud" classes. Key functionalities are organised +in sub-models (e.g. force models, data exchange models, etc.) which can easily +be selected and combined by dictionary settings. + +The coupled solvers run fully parallel on distributed-memory clusters. + +Features are: + +- its modular approach allows users to easily implement new models +- its MPI parallelization enables to use it for large scale problems +- the "forum"_lws on CFD-DEM gives the possibility to exchange with other + users / developers +- the use of GIT allows to easily update to the latest version +- basic documentation is provided + +The file structure: + +- "src" directory including the source files of the coupling toolbox and models +- "applications" directory including the solver files for coupled CFD-DEM simulations +- "doc" directory including the documentation of CFDEMcoupling +- "tutorials" directory including basic tutorial cases showing the functionality + + + +Details on installation are given on the "www.cfdem.com" + +The functionality of this CFD-DEM framwork is described via "tutorial cases" showing +how to use different solvers and models. + +CFDEMcoupling stands for Computational Fluid Dynamics (CFD) - +Discrete Element Method (DEM) coupling. + +CFDEMcoupling is an open-source code, distributed freely under the terms of the +GNU Public License (GPL). + +Core development of CFDEMcoupling is done by +Christoph Goniva and Christoph Kloss, both at DCS Computing GmbH, 2012 + + +\*---------------------------------------------------------------------------*/ +(*) "OpenFOAM(R)"_of is a registered trade mark of the ESI Group. +This offering is not affiliated, approved or endorsed by ESI Group, +the producer of the OpenFOAMĀ® software and owner of the OpenFOAMĀ® trade mark. +\*---------------------------------------------------------------------------*/ diff --git a/applications/solvers/cfdemSolverIB/Make/options b/applications/solvers/cfdemSolverIB/Make/options index fe83ef9..b16906e 100755 --- a/applications/solvers/cfdemSolverIB/Make/options +++ b/applications/solvers/cfdemSolverIB/Make/options @@ -3,11 +3,14 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(CFDEM_SRC_DIR)/lnInclude \ + -I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude + -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/fvOptions/lnInclude EXE_LIBS = \ -L$(FOAM_USER_LIBBIN)\ @@ -17,4 +20,5 @@ EXE_LIBS = \ -lfiniteVolume \ -ldynamicFvMesh \ -ldynamicMesh \ - -l$(CFDEM_LIB_NAME) + -lfvOptions \ + -l$(CFDEM_LIB_NAME) diff --git a/applications/solvers/cfdemSolverIB/cfdemSolverIB.C b/applications/solvers/cfdemSolverIB/cfdemSolverIB.C index 2a091c1..834d096 100755 --- a/applications/solvers/cfdemSolverIB/cfdemSolverIB.C +++ b/applications/solvers/cfdemSolverIB/cfdemSolverIB.C @@ -50,6 +50,10 @@ Contributions #include "dynamicFvMesh.H" //dyM +#include "cellSet.H" +#include "meshToMeshNew.H" +#include "fvIOoptionList.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // int main(int argc, char *argv[]) @@ -64,6 +68,8 @@ int main(int argc, char *argv[]) #include "initContinuityErrs.H" + #include "createFvOptions.H" + // create cfdemCloud #include "readGravitationalAcceleration.H" cfdemCloudIB particleCloud(mesh); @@ -96,10 +102,14 @@ int main(int argc, char *argv[]) fvm::ddt(voidfraction,U) + fvm::div(phi, U) + turbulence->divDevReff(U) + == + fvOptions(U) ); UEqn.relax(); + fvOptions.constrain(UEqn); + if (momentumPredictor) { solve(UEqn == -fvc::grad(p)); @@ -116,6 +126,8 @@ int main(int argc, char *argv[]) adjustPhi(phi, U, p); + fvOptions.relativeFlux(phi); + // Non-orthogonal pressure corrector loop for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { @@ -160,6 +172,8 @@ int main(int argc, char *argv[]) volScalarField voidfractionNext=mesh.lookupObject("voidfractionNext"); particleCloud.calcVelocityCorrection(p,U,phiIB,voidfractionNext); + fvOptions.correct(U); + runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/solvers/cfdemSolverPiso/Make/options b/applications/solvers/cfdemSolverPiso/Make/options index d095bc8..a8a6f52 100644 --- a/applications/solvers/cfdemSolverPiso/Make/options +++ b/applications/solvers/cfdemSolverPiso/Make/options @@ -3,8 +3,8 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(CFDEM_SRC_DIR)/lnInclude \ - -I$(CFDEM_SRC_DIR)/cfdTools \ + -I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \ + -I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \ EXE_LIBS = \ -L$(FOAM_USER_LIBBIN)\ diff --git a/applications/solvers/cfdemSolverPiso/cfdemSolverPiso.C b/applications/solvers/cfdemSolverPiso/cfdemSolverPiso.C index d5fb52d..73c97d6 100644 --- a/applications/solvers/cfdemSolverPiso/cfdemSolverPiso.C +++ b/applications/solvers/cfdemSolverPiso/cfdemSolverPiso.C @@ -73,9 +73,9 @@ int main(int argc, char *argv[]) // do particle stuff particleCloud.clockM().start(2,"Coupling"); particleCloud.evolve(voidfraction,Us,U); - + Info << "update Ksl.internalField()" << endl; - Ksl.oldTime().internalField() = particleCloud.momCoupleM(0).impMomSource(); + Ksl = particleCloud.momCoupleM(0).impMomSource(); particleCloud.smoothingM().smoothen(Ksl); Ksl.correctBoundaryConditions(); @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) // Momentum predictor fvVectorMatrix UEqn ( - fvm::ddt(voidfraction,U) + fvm::ddt(voidfraction,U) //particleCloud.ddtVoidfractionU(U,voidfraction) // + fvm::div(phi, U) // + turbulence->divDevReff(U) + particleCloud.divVoidfractionTau(U, voidfraction) @@ -120,8 +120,8 @@ int main(int argc, char *argv[]) U = rUA*UEqn.H(); - phi = (fvc::interpolate(U*voidfraction) & mesh.Sf() ) - + fvc::ddtPhiCorr(rUAvoidfraction, U, phi); + phi = (fvc::interpolate(U*voidfraction) & mesh.Sf() ); + //+ fvc::ddtPhiCorr(rUAvoidfraction, U, phi); surfaceScalarField phiS(fvc::interpolate(Us*voidfraction) & mesh.Sf()); surfaceScalarField phiGes = phi + rUAf*(fvc::interpolate(Ksl/rho) * phiS); diff --git a/applications/solvers/cfdemSolverPisoScalar/Make/options b/applications/solvers/cfdemSolverPisoScalar/Make/options index d095bc8..a8a6f52 100644 --- a/applications/solvers/cfdemSolverPisoScalar/Make/options +++ b/applications/solvers/cfdemSolverPisoScalar/Make/options @@ -3,8 +3,8 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(CFDEM_SRC_DIR)/lnInclude \ - -I$(CFDEM_SRC_DIR)/cfdTools \ + -I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \ + -I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/cfdTools \ EXE_LIBS = \ -L$(FOAM_USER_LIBBIN)\ diff --git a/applications/solvers/cfdemSolverPisoScalar/cfdemSolverPisoScalar.C b/applications/solvers/cfdemSolverPisoScalar/cfdemSolverPisoScalar.C index b238a08..af3134d 100644 --- a/applications/solvers/cfdemSolverPisoScalar/cfdemSolverPisoScalar.C +++ b/applications/solvers/cfdemSolverPisoScalar/cfdemSolverPisoScalar.C @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) Info << "- evolve()" << endl; particleCloud.evolve(voidfraction,Us,U); - Ksl.oldTime().internalField() = particleCloud.momCoupleM(0).impMomSource(); + Ksl.internalField() = particleCloud.momCoupleM(0).impMomSource(); particleCloud.smoothingM().smoothen(Ksl); Ksl.correctBoundaryConditions(); diff --git a/applications/utilities/cfdemPostproc/Make/options b/applications/utilities/cfdemPostproc/Make/options index 05cb305..3fb8d05 100644 --- a/applications/utilities/cfdemPostproc/Make/options +++ b/applications/utilities/cfdemPostproc/Make/options @@ -3,7 +3,7 @@ EXE_INC = \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(CFDEM_SRC_DIR)/lnInclude \ + -I$(CFDEM_SRC_DIR)/lagrangian/cfdemParticle/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ diff --git a/doc/CFDEMcoupling_Manual.html b/doc/CFDEMcoupling_Manual.html index f5c61fb..54ca18f 100644 --- a/doc/CFDEMcoupling_Manual.html +++ b/doc/CFDEMcoupling_Manual.html @@ -206,33 +206,34 @@ listing below of styles within certain commands. IOModelIOModel_basicIO IOModel_noIOIOModel_sophIO IOModel_trackIOaveragingModel -averagingModel_dilutecfdemSolverIB -cfdemSolverPisocfdemSolverPisoScalar -clockModelclockModel_noClock -clockModel_standardClockdataExchangeModel -dataExchangeModel_noDataExchangedataExchangeModel_oneWayVTK -dataExchangeModel_twoWayFilesdataExchangeModel_twoWayMPI -forceModelforceModel_Archimedes -forceModel_ArchimedesIBforceModel_DiFeliceDrag -forceModel_GidaspowDragforceModel_KochHillDrag -forceModel_LaEuScalarTempforceModel_MeiLift -forceModel_SchillerNaumannDragforceModel_ShirgaonkarIB -forceModel_gradPForceforceModel_noDrag -forceModel_particleCellVolumeforceModel_virtualMassForce -forceModel_viscForceliggghtsCommandModel -liggghtsCommandModel_executeliggghtsCommandModel_readLiggghtsData -liggghtsCommandModel_runLiggghtsliggghtsCommandModel_writeLiggghts -locateModellocateModel_engineSearch -locateModel_engineSearchIBlocateModel_standardSearch -meshMotionModelmeshMotionModel_noMeshMotion -momCoupleModelmomCoupleModel_explicitCouple -momCoupleModel_implicitCouplemomCoupleModel_noCouple -regionModelregionModel_allRegion -smoothingModelsmoothingModel_constDiffSmoothing -smoothingModel_noSmoothingvoidfractionModel -voidfractionModel_GaussVoidFractionvoidfractionModel_IBVoidFraction -voidfractionModel_bigParticleVoidFractionvoidfractionModel_centreVoidFraction -voidfractionModel_dividedVoidFraction +averagingModel_denseaveragingModel_dilute +cfdemSolverIBcfdemSolverPiso +cfdemSolverPisoScalarclockModel +clockModel_noClockclockModel_standardClock +dataExchangeModeldataExchangeModel_noDataExchange +dataExchangeModel_oneWayVTKdataExchangeModel_twoWayFiles +dataExchangeModel_twoWayMPIforceModel +forceModel_ArchimedesforceModel_ArchimedesIB +forceModel_DiFeliceDragforceModel_GidaspowDrag +forceModel_KochHillDragforceModel_LaEuScalarTemp +forceModel_MeiLiftforceModel_SchillerNaumannDrag +forceModel_ShirgaonkarIBforceModel_gradPForce +forceModel_noDragforceModel_particleCellVolume +forceModel_virtualMassForceforceModel_viscForce +liggghtsCommandModelliggghtsCommandModel_execute +liggghtsCommandModel_readLiggghtsDataliggghtsCommandModel_runLiggghts +liggghtsCommandModel_writeLiggghtslocateModel +locateModel_engineSearchlocateModel_engineSearchIB +locateModel_standardSearchmeshMotionModel +meshMotionModel_noMeshMotionmomCoupleModel +momCoupleModel_explicitCouplemomCoupleModel_implicitCouple +momCoupleModel_noCoupleprobeModel +probeModel_noProberegionModel +regionModel_allRegionsmoothingModel +smoothingModel_constDiffSmoothingsmoothingModel_noSmoothing +voidfractionModelvoidfractionModel_GaussVoidFraction +voidfractionModel_IBVoidFractionvoidfractionModel_bigParticleVoidFraction +voidfractionModel_centreVoidFractionvoidfractionModel_dividedVoidFraction diff --git a/doc/CFDEMcoupling_Manual.pdf b/doc/CFDEMcoupling_Manual.pdf index d229095..4f17eab 100644 Binary files a/doc/CFDEMcoupling_Manual.pdf and b/doc/CFDEMcoupling_Manual.pdf differ diff --git a/doc/CFDEMcoupling_Manual.txt b/doc/CFDEMcoupling_Manual.txt index 509199d..655f96f 100644 --- a/doc/CFDEMcoupling_Manual.txt +++ b/doc/CFDEMcoupling_Manual.txt @@ -185,6 +185,30 @@ Reasonable example settings for the "liggghtsCommands" dictionary are given in t + + + + + + + + + + + + + + + + + + + + + + + + @@ -214,6 +238,7 @@ listing below of styles within certain commands. "IOModel_sophIO"_IOModel_sophIO.html, "IOModel_trackIO"_IOModel_trackIO.html, "averagingModel"_averagingModel.html, +"averagingModel_dense"_averagingModel_dense.html, "averagingModel_dilute"_averagingModel_dilute.html, "cfdemSolverIB"_cfdemSolverIB.html, "cfdemSolverPiso"_cfdemSolverPiso.html, @@ -256,6 +281,8 @@ listing below of styles within certain commands. "momCoupleModel_explicitCouple"_momCoupleModel_explicitCouple.html, "momCoupleModel_implicitCouple"_momCoupleModel_implicitCouple.html, "momCoupleModel_noCouple"_momCoupleModel_noCouple.html, +"probeModel"_probeModel.html, +"probeModel_noProbe"_probeModel_noProbe.html, "regionModel"_regionModel.html, "regionModel_allRegion"_regionModel_allRegion.html, "smoothingModel"_smoothingModel.html, diff --git a/doc/averagingModel_dense.html b/doc/averagingModel_dense.html index 3f86770..239c82d 100644 --- a/doc/averagingModel_dense.html +++ b/doc/averagingModel_dense.html @@ -21,17 +21,14 @@

Description:

-

The averaging model performs the Lagrangian->Eulerian mapping of data (e.g. particle velocities). -In the "cfdemParticle cloud" this averaging model is used to calculate the average particle velocity inside a CFD cell. The "dense" model is supposed to be applied to cases where the granular regime is rather dense. The particle velocity inside a CFD cell is evaluated as an ensemble average of the particle velocities. +

The averaging model performs the Lagrangian->Eulerian mapping of data (e.g. particle velocities). In the "cfdemParticle cloud" this averaging model is used to calculate the average particle velocity inside a CFD cell. The "dense" model is supposed to be applied to cases where the granular regime is rather dense.

Restrictions:

-

None. +

No known restrictions.

Related commands:

averagingModel, dilute

-

Default: none -

diff --git a/doc/averagingModel_dense.txt b/doc/averagingModel_dense.txt new file mode 100644 index 0000000..52da602 --- /dev/null +++ b/doc/averagingModel_dense.txt @@ -0,0 +1,31 @@ +"CFDEMproject WWW Site"_lws - "CFDEM Commands"_lc :c + +:link(lws,http://www.cfdem.com) +:link(lc,CFDEMcoupling_Manual.html#comm) + +:line + +averagingModel_dense command :h3 + +[Syntax:] + +Defined in couplingProperties dictionary. + +averagingModel dense; :pre + +[Examples:] + +averagingModel dense; :pre + +[Description:] + +The averaging model performs the Lagrangian->Eulerian mapping of data (e.g. particle velocities). In the "cfdemParticle cloud" this averaging model is used to calculate the average particle velocity inside a CFD cell. The "dense" model is supposed to be applied to cases where the granular regime is rather dense. + +[Restrictions:] + +No known restrictions. + +[Related commands:] + +"averagingModel"_averagingModel.html, "dilute"_averagingModel_dilute.html + diff --git a/doc/forceModel_GidaspowDrag.html b/doc/forceModel_GidaspowDrag.html index bb400d2..197227a 100644 --- a/doc/forceModel_GidaspowDrag.html +++ b/doc/forceModel_GidaspowDrag.html @@ -21,12 +21,15 @@ GidaspowDragProps { velFieldName "U"; densityFieldName "density"; + phi "scalar"; };

Examples: diff --git a/doc/forceModel_GidaspowDrag.txt b/doc/forceModel_GidaspowDrag.txt index 0f6938c..9a5af51 100644 --- a/doc/forceModel_GidaspowDrag.txt +++ b/doc/forceModel_GidaspowDrag.txt @@ -19,10 +19,12 @@ GidaspowDragProps \{ velFieldName "U"; densityFieldName "density"; + phi "scalar"; \}; :pre {U} = name of the finite volume fluid velocity field :ulb,l {density} = name of the finite volume gravity field :l +{phi} = drag correction factor (in doubt 1) :l :ule [Examples:] diff --git a/doc/forceModel_MeiLift.html b/doc/forceModel_MeiLift.html index c5bef7a..b1045e5 100644 --- a/doc/forceModel_MeiLift.html +++ b/doc/forceModel_MeiLift.html @@ -21,12 +21,21 @@ MeiLiftProps { velFieldName "U"; densityFieldName "density"; + useSecondOrderTerms; + interpolation; + verbose; };

Examples: @@ -39,11 +48,14 @@ MeiLiftProps { velFieldName "U"; densityFieldName "rho"; + useSecondOrderTerms; + interpolation; + verbose; }

Description:

-

The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The MeiLift model calculates the lift force for each particle based on Loth and Dorgan (2009) +

The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The MeiLift model calculates the lift force for each particle based on Loth and Dorgan (2009). In case the keyword "useSecondOrderTerms" is not specified, this lift force model uses the expression of McLaughlin (1991, Journal of Fluid Mechanics 224:261-274).

Restrictions:

diff --git a/doc/forceModel_MeiLift.txt b/doc/forceModel_MeiLift.txt index 9ebb590..4513065 100644 --- a/doc/forceModel_MeiLift.txt +++ b/doc/forceModel_MeiLift.txt @@ -19,10 +19,16 @@ MeiLiftProps \{ velFieldName "U"; densityFieldName "density"; + useSecondOrderTerms; + interpolation; + verbose; \}; :pre {U} = name of the finite volume fluid velocity field :ulb,l {density} = name of the finite volume fluid density field :l +{useSecondOrderTerms} = switch to activate second order terms in the lift force model :l +{interpolation} = switch to activate tri-linear interpolation of the flow quantities at the particle position :l +{verbose} = switch to activate the report of per-particle quantities to the screen :l :ule [Examples:] @@ -35,11 +41,14 @@ MeiLiftProps \{ velFieldName "U"; densityFieldName "rho"; + useSecondOrderTerms; + interpolation; + verbose; \} :pre [Description:] -The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The MeiLift model calculates the lift force for each particle based on Loth and Dorgan (2009) +The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The MeiLift model calculates the lift force for each particle based on Loth and Dorgan (2009). In case the keyword "useSecondOrderTerms" is not specified, this lift force model uses the expression of McLaughlin (1991, Journal of Fluid Mechanics 224:261-274). [Restrictions:] diff --git a/doc/forceModel_noDrag.html b/doc/forceModel_noDrag.html index 4bba14a..9baaa53 100644 --- a/doc/forceModel_noDrag.html +++ b/doc/forceModel_noDrag.html @@ -15,19 +15,24 @@

forceModels
 (
-    off
+    noDrag
 ); 
 

Examples:

forceModels
 (
-    off
+    noDrag
 ); 
 
+
noDragProps (optional)
+{
+    noDEMForce; (optional)
+}; 
+

Description:

-

The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The noDrag model sets the forces acting on the particle to zero. If several force models are selected and noDrag is the last model being executed, the fluid particle force will be set to zero. +

The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The noDrag model sets the forces acting on the particle to zero. If several force models are selected and noDrag is the last model being executed, the fluid particle force will be set to zero. If the variable noDEMForce is set, then the forces communicated to the DEM solver are also set to zero.

Restrictions:

diff --git a/doc/forceModel_noDrag.txt b/doc/forceModel_noDrag.txt index a8838e2..ec43c19 100644 --- a/doc/forceModel_noDrag.txt +++ b/doc/forceModel_noDrag.txt @@ -13,19 +13,24 @@ Defined in couplingProperties dictionary. forceModels ( - off + noDrag ); :pre [Examples:] forceModels ( - off + noDrag ); :pre +noDragProps (optional) +\{ + noDEMForce; (optional) +\}; :pre + [Description:] -The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The noDrag model sets the forces acting on the particle to zero. If several force models are selected and noDrag is the last model being executed, the fluid particle force will be set to zero. +The force model performs the calculation of forces (e.g. fluid-particle interaction forces) acting on each DEM particle. The noDrag model sets the forces acting on the particle to zero. If several force models are selected and noDrag is the last model being executed, the fluid particle force will be set to zero. If the variable noDEMForce is set, then the forces communicated to the DEM solver are also set to zero. [Restrictions:] diff --git a/doc/forceModel_particleCellVolume.html b/doc/forceModel_particleCellVolume.html index b834c3f..d906882 100644 --- a/doc/forceModel_particleCellVolume.html +++ b/doc/forceModel_particleCellVolume.html @@ -45,8 +45,8 @@ particleCellVolumeProps

Description:

-

This "forceModel" does not influence the particles or the simulation - it is a postprocessing tool! The total volume of the particles as they are represented on the CFD mesh is calculated. -At "writeTime" a field named particleCellVolume , where scalarField is the name of the original field, is written. This can be can the be probed using standard function object probes. Using the verbous option a screen output is given. +

This "forceModel" does not influence the particles or the simulation - it is a postprocessing tool! The total volume of the particles as they are represented on the CFD mesh is calculated. Further the total volume of the cells particles are in is calculated. +At "writeTime" a field named particleCellVolume , where scalarField is the name of the original field, is written. This can be can the be probed using standard function object probes. Analogously a field named cellVolume is written. Using the verbose option a screen output is given.

Restrictions:

diff --git a/doc/forceModel_particleCellVolume.txt b/doc/forceModel_particleCellVolume.txt index f60eb48..21bc23d 100644 --- a/doc/forceModel_particleCellVolume.txt +++ b/doc/forceModel_particleCellVolume.txt @@ -41,8 +41,8 @@ particleCellVolumeProps [Description:] -This "forceModel" does not influence the particles or the simulation - it is a postprocessing tool! The total volume of the particles as they are represented on the CFD mesh is calculated. -At "writeTime" a field named particleCellVolume , where scalarField is the name of the original field, is written. This can be can the be probed using standard function object probes. Using the verbous option a screen output is given. +This "forceModel" does not influence the particles or the simulation - it is a postprocessing tool! The total volume of the particles as they are represented on the CFD mesh is calculated. Further the total volume of the cells particles are in is calculated. +At "writeTime" a field named particleCellVolume , where scalarField is the name of the original field, is written. This can be can the be probed using standard function object probes. Analogously a field named cellVolume is written. Using the verbose option a screen output is given. [Restrictions:] diff --git a/doc/githubAccess_public.pdf b/doc/githubAccess_public.pdf index efef258..7362b4a 100644 Binary files a/doc/githubAccess_public.pdf and b/doc/githubAccess_public.pdf differ diff --git a/doc/momCoupleModel_implicitCouple.html b/doc/momCoupleModel_implicitCouple.html index b51420b..ca70b2c 100644 --- a/doc/momCoupleModel_implicitCouple.html +++ b/doc/momCoupleModel_implicitCouple.html @@ -22,6 +22,7 @@ implicitCoupleProps velFieldName "U"; granVelFieldName "Us"; voidfractionFieldName "voidfraction"; + minAlphaP number; }

Examples: diff --git a/doc/momCoupleModel_implicitCouple.txt b/doc/momCoupleModel_implicitCouple.txt index e7954f3..e46a35c 100644 --- a/doc/momCoupleModel_implicitCouple.txt +++ b/doc/momCoupleModel_implicitCouple.txt @@ -20,11 +20,13 @@ implicitCoupleProps velFieldName "U"; granVelFieldName "Us"; voidfractionFieldName "voidfraction"; + minAlphaP number; \} :pre {U} = name of the finite volume fluid velocity field :ulb,l {Us} = name of the finite volume granular velocity field :l {voidfraction} = name of the finite volume voidfraction field :l +{number} = min value for local particle volume fraction to calculate the exchange filed (default SMALL):l :ule [Examples:] diff --git a/doc/probeModel.html b/doc/probeModel.html new file mode 100644 index 0000000..3871fe4 --- /dev/null +++ b/doc/probeModel.html @@ -0,0 +1,42 @@ + +

CFDEMproject WWW Site - CFDEM Commands +
+ + + + +
+ +

probeModel command +

+

Syntax: +

+

To be activated via couplingProperties dictionary. +

+
probeModel myProbeModel; 
+
+

Use probe model "off" to disable this feature. +

+
myProbeModelProps 
+
+
{ 
+
+
}; 
+
+

Examples: +

+

See particleProbe +

+

Note: This examples list might not be complete - please check below for the list of force models that can perform particle probing. +

+

Description: +

+

The probeModel feature allows one to implement various probing features in CFDEM. Currently, only the particleProbe model is implemented, that performs probing of particle forces. +

+

Restrictions: +

+

None. +

+

Default: none. +

+ diff --git a/doc/probeModel.txt b/doc/probeModel.txt new file mode 100644 index 0000000..5e10acf --- /dev/null +++ b/doc/probeModel.txt @@ -0,0 +1,38 @@ +"CFDEMproject WWW Site"_lws - "CFDEM Commands"_lc :c + +:link(lws,http://www.cfdem.com) +:link(lc,CFDEMcoupling_Manual.html#comm) + +:line + +probeModel command :h3 + +[Syntax:] + +To be activated via couplingProperties dictionary. + +probeModel myProbeModel; :pre + +Use probe model "off" to disable this feature. + +myProbeModelProps :pre +\{ :pre + +\}; :pre + + +[Examples:] + +See "particleProbe"_probeModel_particleProbe.html + +Note: This examples list might not be complete - please check below for the list of force models that can perform particle probing. + +[Description:] + +The probeModel feature allows one to implement various probing features in CFDEM. Currently, only the "particleProbe"_probeModel_particleProbe.html model is implemented, that performs probing of particle forces. + +[Restrictions:] + +None. + +[Default:] none. diff --git a/doc/probeModel_noProbe.html b/doc/probeModel_noProbe.html new file mode 100644 index 0000000..6302111 --- /dev/null +++ b/doc/probeModel_noProbe.html @@ -0,0 +1,43 @@ + +
CFDEMproject WWW Site - CFDEM Commands +
+ + + + +
+ +

probeModel_noProbe command +

+

Syntax: +

+

To be activated via couplingProperties dictionary. +

+
forceModels
+{
+    myForceModel1
+    myForceModel2
+    myForceModel3
+}; 
+
+

Examples: +

+
probeModel off; 
+
+

Note: This examples list might not be complete - please check below for the list of force models that can perform particle probing. +

+

Description: +

+

Does not perform any probing. +

+

Restrictions: +

+

None. +

+

Related commands which are currently enabled for particle probing: +

+

particleProbe +

+

Default: none. +

+ diff --git a/doc/probeModel_noProbe.txt b/doc/probeModel_noProbe.txt new file mode 100644 index 0000000..b36c75e --- /dev/null +++ b/doc/probeModel_noProbe.txt @@ -0,0 +1,39 @@ +"CFDEMproject WWW Site"_lws - "CFDEM Commands"_lc :c + +:link(lws,http://www.cfdem.com) +:link(lc,CFDEMcoupling_Manual.html#comm) + +:line + +probeModel_noProbe command :h3 + +[Syntax:] + +To be activated via couplingProperties dictionary. + +forceModels +\{ + myForceModel1 + myForceModel2 + myForceModel3 +\}; :pre + +[Examples:] + +probeModel off; :pre + +Note: This examples list might not be complete - please check below for the list of force models that can perform particle probing. + +[Description:] + +Does not perform any probing. + +[Restrictions:] + +None. + +[Related commands which are currently enabled for particle probing:] + +"particleProbe"_probeModel_particleProbe.html + +[Default:] none. diff --git a/doc/smoothingModel.html b/doc/smoothingModel.html index 7d7617b..9aace85 100644 --- a/doc/smoothingModel.html +++ b/doc/smoothingModel.html @@ -27,6 +27,8 @@

Note: This examples list might not be complete - please look for other models (smoothingModel_XY) in this documentation.

+

ATTENTION: In case a smoothing model is used in conjunction with "PimpleImEx" solvers, the fields "f" and "fSmooth" must be placed in the initial time directory! This is because zeroGradient boundary conditions for the fields "f" and "fSmooth" must be specified, otherwise the smoothing operation will give an Error. +

Description:

The smoothingModel is the base class for models that smoothen the exchange fields (i.e., voidfraction and the Ksl field in case of implicit force coupling). This is relevant in case one uses a small grid resolution compared to the local particle diameter (or parcel diameter in case one uses a parcel approach). diff --git a/doc/smoothingModel.txt b/doc/smoothingModel.txt index a0bb706..77561ba 100644 --- a/doc/smoothingModel.txt +++ b/doc/smoothingModel.txt @@ -23,6 +23,8 @@ smoothingModel localPSizeDiffSmoothing; :pre Note: This examples list might not be complete - please look for other models (smoothingModel_XY) in this documentation. +ATTENTION: In case a smoothing model is used in conjunction with "PimpleImEx" solvers, the fields "f" and "fSmooth" must be placed in the initial time directory! This is because zeroGradient boundary conditions for the fields "f" and "fSmooth" must be specified, otherwise the smoothing operation will give an Error. + [Description:] The smoothingModel is the base class for models that smoothen the exchange fields (i.e., voidfraction and the Ksl field in case of implicit force coupling). This is relevant in case one uses a small grid resolution compared to the local particle diameter (or parcel diameter in case one uses a parcel approach). diff --git a/doc/smoothingModel_constDiffSmoothing.html b/doc/smoothingModel_constDiffSmoothing.html index edfb3fb..faf3f45 100644 --- a/doc/smoothingModel_constDiffSmoothing.html +++ b/doc/smoothingModel_constDiffSmoothing.html @@ -19,6 +19,7 @@ constDiffSmoothingProps lowerLimit number1; upperLimit number2; smoothingLength lengthScale; + smoothingLengthReferenceField lengthScaleRefField; }

Examples: @@ -36,15 +39,17 @@ constDiffSmoothingProps lowerLimit 0.1; upperLimit 1e10; smoothingLength 1500e-6; + smoothingLengthReferenceField 9000e-6; }

Description:

-

The "constDiffSmoothing" model is a basic smoothingModel model which reads a smoothing length scale being used for smoothening the exchange fields (voidfraction, Ksl, f if present). This model can be used for smoothing explicit force coupling fields, as well as implicit fource coupling algorithms -(see solver "cfdemSolverPisoImEx"). +

The "constDiffSmoothing" model is a basic smoothingModel model which reads a smoothing length scale being used for smoothening the exchange fields (voidfraction, Ksl, f if present). This model can be used for smoothing explicit force coupling fields, as well as implicit fource coupling algorithms. +Smoothing for reference fields is performed to "fill in" values in cells in which these reference fields are not specified. Values calculated in the cells (via Lagrangian-To-Euler mapping) are NOT changed! These reference fields are, e.g., the average particle velocity, which are not specified in all cells in case the flow is rather dilute.

-

Restrictions: Should be used for monodisperse cases only. -Time derivatives of the voidfraction field are calculated incorrectly, so don't use them in your solver when smoothing is applied. +

Restrictions: This model is tested in a limited number of flow situations. +

+

ATTENTION: In case a smoothing model is used in conjunction with "PimpleImEx" solvers, the fields "f" and "fSmooth" must be placed in the initial time directory! This is because zeroGradient boundary conditions for the fields "f" and "fSmooth" must be specified, otherwise the smoothing operation will give an Error.

Related commands:

diff --git a/doc/smoothingModel_constDiffSmoothing.txt b/doc/smoothingModel_constDiffSmoothing.txt index 3fe9c8d..b6dc6db 100644 --- a/doc/smoothingModel_constDiffSmoothing.txt +++ b/doc/smoothingModel_constDiffSmoothing.txt @@ -17,11 +17,13 @@ constDiffSmoothingProps lowerLimit number1; upperLimit number2; smoothingLength lengthScale; + smoothingLengthReferenceField lengthScaleRefField; \} :pre {number1} = scalar fields will be bound to this lower value :ulb,l {number2} = scalar fields will be bound to this upper value :l {lengthScale} = length scale over which the exchange fields will be smoothed out :l +{lengthScaleRefField} = length scale over which reference fields (e.g., the average particle velocity) will be smoothed out. Should be always larger than lengthScale. If not specified, will be equal to lengthScale. :l :ule [Examples:] @@ -31,15 +33,18 @@ constDiffSmoothingProps lowerLimit 0.1; upperLimit 1e10; smoothingLength 1500e-6; + smoothingLengthReferenceField 9000e-6; \} :pre [Description:] -The "constDiffSmoothing" model is a basic smoothingModel model which reads a smoothing length scale being used for smoothening the exchange fields (voidfraction, Ksl, f if present). This model can be used for smoothing explicit force coupling fields, as well as implicit fource coupling algorithms -(see solver "cfdemSolverPisoImEx"). +The "constDiffSmoothing" model is a basic smoothingModel model which reads a smoothing length scale being used for smoothening the exchange fields (voidfraction, Ksl, f if present). This model can be used for smoothing explicit force coupling fields, as well as implicit fource coupling algorithms. +Smoothing for reference fields is performed to "fill in" values in cells in which these reference fields are not specified. Values calculated in the cells (via Lagrangian-To-Euler mapping) are NOT changed! These reference fields are, e.g., the average particle velocity, which are not specified in all cells in case the flow is rather dilute. + +[Restrictions:] This model is tested in a limited number of flow situations. + +ATTENTION: In case a smoothing model is used in conjunction with "PimpleImEx" solvers, the fields "f" and "fSmooth" must be placed in the initial time directory! This is because zeroGradient boundary conditions for the fields "f" and "fSmooth" must be specified, otherwise the smoothing operation will give an Error. -[Restrictions:] Should be used for monodisperse cases only. -Time derivatives of the voidfraction field are calculated incorrectly, so don't use them in your solver when smoothing is applied. [Related commands:] diff --git a/doc/voidFractionModel_dividedVoidFraction.html b/doc/voidFractionModel_dividedVoidFraction.html index 9583b06..818c931 100644 --- a/doc/voidFractionModel_dividedVoidFraction.html +++ b/doc/voidFractionModel_dividedVoidFraction.html @@ -50,6 +50,9 @@ dividedProps

The particle volume occupied in the CFD domain can be adjusted by the parameter "weight", using Vparticle=dsphere^3*pi/6*weight.

+

In the basic implementation of solvers, the void fraction is calculated based on all particles. Depending on the solver used, the void fraction calculation is also performed for a certain type of particles. +The void fraction calculation is based on a three-step approach (reset, set and interpolate), i.e., the void fraction is time interpolated from a previous and a next void fraction field. Appropriate names for these fields have to be specified in the sub-dictionaries voidFracFieldNamesPrev and voidFracFieldNamesNext in the couplingProperties dictionary. +

Restrictions: none.

Related commands: diff --git a/doc/voidFractionModel_dividedVoidFraction.txt b/doc/voidFractionModel_dividedVoidFraction.txt index 7b2657c..48bb600 100644 --- a/doc/voidFractionModel_dividedVoidFraction.txt +++ b/doc/voidFractionModel_dividedVoidFraction.txt @@ -44,6 +44,9 @@ The region of influence of a particle can be increased artificially by "scaleUpV The particle volume occupied in the CFD domain can be adjusted by the parameter "weight", using Vparticle=dsphere^3*pi/6*weight. +In the basic implementation of solvers, the void fraction is calculated based on all particles. Depending on the solver used, the void fraction calculation is also performed for a certain type of particles. +The void fraction calculation is based on a three-step approach (reset, set and interpolate), i.e., the void fraction is time interpolated from a previous and a next void fraction field. Appropriate names for these fields have to be specified in the sub-dictionaries voidFracFieldNamesPrev and voidFracFieldNamesNext in the couplingProperties dictionary. + [Restrictions:] none. [Related commands:] diff --git a/src/lagrangian/cfdemParticle/Make/files b/src/lagrangian/cfdemParticle/Make/files index 52f9480..302c93a 100644 --- a/src/lagrangian/cfdemParticle/Make/files +++ b/src/lagrangian/cfdemParticle/Make/files @@ -1,39 +1,70 @@ cfdemCloud = cfdemCloud forceModels = subModels/forceModel +forceModelsMS = subModels/forceModelMS IOModels = subModels/IOModel voidFractionModels = subModels/voidFractionModel locateModels = subModels/locateModel meshMotionModels = subModels/meshMotionModel momCoupleModels = subModels/momCoupleModel -regionModels = subModels/regionModel dataExchangeModels = subModels/dataExchangeModel averagingModels = subModels/averagingModel clockModels = subModels/clockModel liggghtsCommandModels = subModels/liggghtsCommandModel smoothingModels = subModels/smoothingModel +probeModels = subModels/probeModel $(cfdemCloud)/cfdemCloud.C +derived/cfdemCloudBiDisperse/cfdemCloudBiDisperse.C derived/cfdemCloudIB/cfdemCloudIB.C +derived/cfdemCloudMS/cfdemCloudMS.C $(forceModels)/forceModel/forceModel.C $(forceModels)/forceModel/newForceModel.C $(forceModels)/noDrag/noDrag.C $(forceModels)/checkCouplingInterval/checkCouplingInterval.C $(forceModels)/DiFeliceDrag/DiFeliceDrag.C +$(forceModels)/DiFeliceDragNLift/DiFeliceDragNLift.C $(forceModels)/GidaspowDrag/GidaspowDrag.C $(forceModels)/SchillerNaumannDrag/SchillerNaumannDrag.C $(forceModels)/Archimedes/Archimedes.C $(forceModels)/ArchimedesIB/ArchimedesIB.C $(forceModels)/interface/interface.C $(forceModels)/ShirgaonkarIB/ShirgaonkarIB.C +$(forceModels)/fieldTimeAverage/fieldTimeAverage.C +$(forceModels)/fieldBound/fieldBound.C +$(forceModels)/volWeightedAverage/volWeightedAverage.C +$(forceModels)/totalMomentumExchange/totalMomentumExchange.C $(forceModels)/KochHillDrag/KochHillDrag.C +$(forceModels)/KochHillRWDrag/KochHillRWDrag.C +$(forceModels)/BeetstraDrag/multiphaseFlowBasic/multiphaseFlowBasic.C +$(forceModels)/BeetstraDrag/BeetstraDrag.C +$(forceModels)/LaEuScalarLiquid/LaEuScalarLiquid.C $(forceModels)/LaEuScalarTemp/LaEuScalarTemp.C +$(forceModels)/LaEuScalarDust/LaEuScalarDust.C $(forceModels)/virtualMassForce/virtualMassForce.C $(forceModels)/gradPForce/gradPForce.C +$(forceModels)/gradULiftForce/gradULiftForce.C +$(forceModels)/HollowayDrag/HollowayDrag.C $(forceModels)/viscForce/viscForce.C $(forceModels)/MeiLift/MeiLift.C +$(forceModels)/melting/melting.C +$(forceModels)/KochHillDragNLift/KochHillDragNLift.C +$(forceModels)/solidsPressureForce/solidsPressureForce.C +$(forceModels)/periodicPressure/periodicPressure.C +$(forceModels)/periodicPressureControl/periodicPressureControl.C +$(forceModels)/averageSlipVel/averageSlipVel.C $(forceModels)/particleCellVolume/particleCellVolume.C +$(forceModelsMS)/forceModelMS/forceModelMS.C +$(forceModelsMS)/forceModelMS/newForceModelMS.C +$(forceModelsMS)/DiFeliceDragMS/DiFeliceDragMS.C +$(forceModelsMS)/noDragMS/noDragMS.C + +$(probeModels)/probeModel/probeModel.C +$(probeModels)/probeModel/newProbeModel.C +$(probeModels)/noProbe/noProbe.C +$(probeModels)/particleProbe/particleProbe.C + $(IOModels)/IOModel/IOModel.C $(IOModels)/IOModel/newIOModel.C $(IOModels)/noIO/noIO.C @@ -45,42 +76,46 @@ $(voidFractionModels)/voidFractionModel/voidFractionModel.C $(voidFractionModels)/voidFractionModel/newVoidFractionModel.C $(voidFractionModels)/centreVoidFraction/centreVoidFraction.C $(voidFractionModels)/dividedVoidFraction/dividedVoidFraction.C +$(voidFractionModels)/dividedVoidFractionBiDi/dividedVoidFractionBiDi.C +$(voidFractionModels)/dividedVoidFractionMS/dividedVoidFractionMS.C $(voidFractionModels)/bigParticleVoidFraction/bigParticleVoidFraction.C $(voidFractionModels)/GaussVoidFraction/GaussVoidFraction.C $(voidFractionModels)/IBVoidFraction/IBVoidFraction.C +$(voidFractionModels)/weightedNeigbhorsVoidFraction/weightedNeigbhorsVoidFraction.C $(locateModels)/locateModel/locateModel.C $(locateModels)/locateModel/newLocateModel.C $(locateModels)/standardSearch/standardSearch.C $(locateModels)/engineSearch/engineSearch.C +$(locateModels)/turboEngineSearch/turboEngineSearch.C +$(locateModels)/turboEngineSearchM2M/turboEngineSearchM2M.C $(locateModels)/engineSearchIB/engineSearchIB.C - $(meshMotionModels)/meshMotionModel/meshMotionModel.C $(meshMotionModels)/meshMotionModel/newMeshMotionModel.C $(meshMotionModels)/noMeshMotion/noMeshMotion.C +$(meshMotionModels)/DEMdrivenMeshMotion/DEMdrivenMeshMotion.C $(momCoupleModels)/momCoupleModel/momCoupleModel.C $(momCoupleModels)/momCoupleModel/newMomCoupleModel.C $(momCoupleModels)/explicitCouple/explicitCouple.C +$(momCoupleModels)/explicitCoupleSource/explicitCoupleSource.C $(momCoupleModels)/implicitCouple/implicitCouple.C $(momCoupleModels)/noCouple/noCouple.C -$(regionModels)/regionModel/regionModel.C -$(regionModels)/regionModel/newRegionModel.C -$(regionModels)/allRegion/allRegion.C - $(dataExchangeModels)/dataExchangeModel/dataExchangeModel.C $(dataExchangeModels)/dataExchangeModel/newDataExchangeModel.C $(dataExchangeModels)/oneWayVTK/oneWayVTK.C $(dataExchangeModels)/twoWayFiles/twoWayFiles.C $(dataExchangeModels)/noDataExchange/noDataExchange.C $(dataExchangeModels)/twoWayMPI/twoWayMPI.C +$(dataExchangeModels)/twoWayM2M/twoWayM2M.C $(averagingModels)/averagingModel/averagingModel.C $(averagingModels)/averagingModel/newAveragingModel.C $(averagingModels)/dilute/dilute.C $(averagingModels)/dense/dense.C +$(averagingModels)/denseBiDi/denseBiDi.C $(clockModels)/clockModel/clockModel.C $(clockModels)/clockModel/newClockModel.C @@ -98,5 +133,6 @@ $(smoothingModels)/smoothingModel/smoothingModel.C $(smoothingModels)/smoothingModel/newSmoothingModel.C $(smoothingModels)/noSmoothing/noSmoothing.C $(smoothingModels)/constDiffSmoothing/constDiffSmoothing.C +$(smoothingModels)/localPSizeDiffSmoothing/localPSizeDiffSmoothing.C -LIB = $(FOAM_USER_LIBBIN)/lib$(CFDEM_LIB_NAME) +LIB = $(CFDEM_LIB_DIR)/lib$(CFDEM_LIB_NAME) diff --git a/src/lagrangian/cfdemParticle/Make/options b/src/lagrangian/cfdemParticle/Make/options index e24e469..29b3e02 100644 --- a/src/lagrangian/cfdemParticle/Make/options +++ b/src/lagrangian/cfdemParticle/Make/options @@ -13,6 +13,8 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/OpenFOAM/containers/HashTables/labelHashSet \ -I$(CFDEM_LIGGGHTS_SRC_DIR) \ + -I$(CFDEM_M2MLIB_PATH) \ + -I$(CFDEM_SRC_DIR)/cfdTools \ LIB_LIBS = \ $(PLIBS) \ @@ -24,4 +26,6 @@ LIB_LIBS = \ -llagrangian \ -lmpi_cxx \ -L$(CFDEM_LIGGGHTS_SRC_DIR) \ - -l$(CFDEM_LIGGGHTS_LIB_NAME) + -l$(CFDEM_LIGGGHTS_LIB_NAME) \ + -L$(CFDEM_M2MLIB_PATH) \ + -lcouple diff --git a/src/lagrangian/cfdemParticle/cfdTools/setupProbeModel.H b/src/lagrangian/cfdemParticle/cfdTools/setupProbeModel.H new file mode 100644 index 0000000..d94133e --- /dev/null +++ b/src/lagrangian/cfdemParticle/cfdTools/setupProbeModel.H @@ -0,0 +1,3 @@ + //set probeModel parameters for this force model + particleCloud_.probeM().setOutputFile(); + particleCloud_.probeM().setCounter(); diff --git a/src/lagrangian/cfdemParticle/cfdTools/setupProbeModelfields.H b/src/lagrangian/cfdemParticle/cfdTools/setupProbeModelfields.H new file mode 100644 index 0000000..484e2ca --- /dev/null +++ b/src/lagrangian/cfdemParticle/cfdTools/setupProbeModelfields.H @@ -0,0 +1,4 @@ +Field vValues; +vValues.clear(); +Field sValues; +sValues.clear(); diff --git a/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H b/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H index 3ea3da7..062f4d9 100755 --- a/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H +++ b/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H @@ -1,6 +1,6 @@ -word CFDEMversion="cfdem-2.5.5"; -word compatibleLIGGGHTSversion="2.3.5"; -word OFversion="2.1.x"; +word CFDEMversion="cfdem-2.5.8"; +word compatibleLIGGGHTSversion="2.3.7"; +word OFversion="2.2.x"; Info << "\nCFDEMcoupling version: " << CFDEMversion << "\n" << endl; Info << "\n, compatible to LIGGGHTS version: " << compatibleLIGGGHTSversion << "\n" << endl; diff --git a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C index e193561..a713045 100644 --- a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C +++ b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C @@ -38,6 +38,7 @@ Description #include "voidFractionModel.H" #include "dataExchangeModel.H" #include "IOModel.H" +#include "probeModel.H" #include "averagingModel.H" #include "clockModel.H" #include "smoothingModel.H" @@ -157,6 +158,16 @@ Foam::cfdemCloud::cfdemCloud *this ) ), + probeModel_ + ( + probeModel::New + ( + couplingProperties_, + *this, + "none", + "none" + ) + ), voidFractionModel_ ( voidFractionModel::New @@ -320,6 +331,19 @@ void Foam::cfdemCloud::setForces() for (int i=0;i cfdemCloud::divVoidfractionTau(volVectorField& U,volScalarFi tmp cfdemCloud::ddtVoidfraction() const { - if (dataExchangeM().couplingStep() <= 2 || !useDDTvoidfraction_) + if (!useDDTvoidfraction_) { Info << "suppressing ddt(voidfraction)" << endl; return tmp (ddtVoidfraction_ * 0.); } - return tmp (ddtVoidfraction_) ; + return tmp (ddtVoidfraction_ * 1.) ; } void cfdemCloud::calcDdtVoidfraction(volScalarField& voidfraction) const { - Info << "calculating ddt(voidfraction) based on couplingTime" << endl; - scalar scale=mesh().time().deltaT().value()/dataExchangeM().couplingTime(); - ddtVoidfraction_ = fvc::ddt(voidfraction) * scale; + // version if ddt is calculated only at coupling time + //Info << "calculating ddt(voidfraction) based on couplingTime" << endl; + //scalar scale=mesh().time().deltaT().value()/dataExchangeM().couplingTime(); + //ddtVoidfraction_ = fvc::ddt(voidfraction) * scale; + + ddtVoidfraction_ = fvc::ddt(voidfraction); } +/*tmp cfdemCloud::ddtVoidfractionU(volVectorField& U,volScalarField& voidfraction) const +{ + if (dataExchangeM().couplingStep() <= 2) return fvm::ddt(U); + + return fvm::ddt(voidfraction,U); +}*/ + tmp cfdemCloud::voidfractionNuEff(volScalarField& voidfraction) const { if (modelType_=="A") diff --git a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H index 4635df6..893a64e 100644 --- a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H +++ b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H @@ -65,6 +65,7 @@ class locateModel; class voidFractionModel; class dataExchangeModel; class IOModel; +class probeModel; class averagingModel; class clockModel; class smoothingModel; @@ -159,6 +160,8 @@ protected: autoPtr IOModel_; + autoPtr probeModel_; + autoPtr voidFractionModel_; autoPtr averagingModel_; @@ -182,6 +185,8 @@ protected: virtual void setForces(); + virtual void setVectorAverages(); + public: friend class dataExchangeModel; @@ -264,6 +269,16 @@ public: inline double ** particleVolumes() const; + virtual inline double dMin() {return -1;} + virtual inline double dMax() {return -1;} + virtual inline int minType() {return -1;} + virtual inline int maxType() {return -1;} + virtual inline bool multipleTypesDMax() {return false;} + virtual inline bool multipleTypesDMin() {return false;} + virtual inline double ** particleDensity() const {return NULL;}; + virtual inline int ** particleTypes() const {return NULL;}; + virtual label particleType(label index) const {return -1;}; + inline int numberOfParticles() const; inline bool numberOfParticlesChanged() const; @@ -284,6 +299,8 @@ public: inline const IOModel& IOM() const; + inline const probeModel& probeM() const; + inline const averagingModel& averagingM() const; inline const clockModel& clockM() const; @@ -325,6 +342,8 @@ public: void calcDdtVoidfraction(volScalarField& voidfraction) const; + //tmp ddtVoidfractionU(volVectorField& ,volScalarField&) const; + tmp voidfractionNuEff(volScalarField&) const; void resetArray(double**&,int,int,double resetVal=0.); diff --git a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H index 77ea4bf..d13046f 100644 --- a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H +++ b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H @@ -177,6 +177,11 @@ inline const IOModel& cfdemCloud::IOM() const return IOModel_; } +inline const probeModel& cfdemCloud::probeM() const +{ + return probeModel_; +} + inline const voidFractionModel& cfdemCloud::voidFractionM() const { return voidFractionModel_; diff --git a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C index ce4162c..6b889df 100644 --- a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C +++ b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.C @@ -53,7 +53,9 @@ cfdemCloudIB::cfdemCloudIB ) : cfdemCloud(mesh), - angularVelocities_(NULL) + angularVelocities_(NULL), + pRefCell_(readLabel(mesh.solutionDict().subDict("PISO").lookup("pRefCell"))), + pRefValue_(readScalar(mesh.solutionDict().subDict("PISO").lookup("pRefValue"))) {} @@ -146,6 +148,7 @@ void Foam::cfdemCloudIB::calcVelocityCorrection vector rVec(0,0,0); vector velRot(0,0,0); vector angVel(0,0,0); + for(int index=0; index< numberOfParticles(); index++) { //if(regionM().inRegion()[index][0]) @@ -170,8 +173,17 @@ void Foam::cfdemCloudIB::calcVelocityCorrection //} } - // make field divergence free - solve(fvm::laplacian(phiIB) == fvc::div(U) + fvc::ddt(voidfraction)); + // make field divergence free - set reference value in case it is needed + fvScalarMatrix phiIBEqn + ( + fvm::laplacian(phiIB) == fvc::div(U) + fvc::ddt(voidfraction) + ); + if(phiIB.needReference()) + { + phiIBEqn.setReference(pRefCell_, pRefValue_); + } + + phiIBEqn.solve(); U=U-fvc::grad(phiIB); U.correctBoundaryConditions(); diff --git a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H index 8492a62..06756b3 100644 --- a/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H +++ b/src/lagrangian/cfdemParticle/derived/cfdemCloudIB/cfdemCloudIB.H @@ -59,6 +59,8 @@ class cfdemCloudIB protected: mutable double **angularVelocities_; + label pRefCell_; + scalar pRefValue_; public: diff --git a/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H b/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H index 53e1269..864dd64 100644 --- a/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H +++ b/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H @@ -1,6 +1,16 @@ -#define version21 +#define version22 // currently being tested +//#define version21 //#define version16ext //#define version15 // choose comp/incomp //#define comp // if comp is on - you must use Make/options_comp! + +//define multi sphere +#define multisphere + +// features of 2.1 work also in 2.2 +#if defined(version22) + #define version21 + #define version221 +#endif diff --git a/src/lagrangian/cfdemParticle/etc/bashrc b/src/lagrangian/cfdemParticle/etc/bashrc index 2d58994..e5e2142 100755 --- a/src/lagrangian/cfdemParticle/etc/bashrc +++ b/src/lagrangian/cfdemParticle/etc/bashrc @@ -24,7 +24,7 @@ #export CFDEM_UT_DIR=$CFDEM_PROJECT_DIR/applications/utilities #export CFDEM_TUT_DIR=$CFDEM_PROJECT_DIR/tutorials #export CFDEM_PROJECT_USER_DIR=$HOME/CFDEM/$LOGNAME-$CFDEM_VERSION-$WM_PROJECT_VERSION -#export CFDEM_bashrc=$CFDEM_SRC_DIR/etc/bashrc +#export CFDEM_bashrc=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/bashrc #export CFDEM_LIGGGHTS_SRC_DIR=$HOME/LIGGGHTS/LIGGGHTS-PUBLIC/src #export CFDEM_LIGGGHTS_MAKEFILE_NAME=fedora_fpic #export CFDEM_LPP_DIR=$HOME/LIGGGHTS/mylpp/src @@ -44,7 +44,7 @@ export CFDEM_LIGGGHTS_LIB_NAME=lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME export CFDEM_LIB_NAME=lagrangianCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION #- LMP M2M lib path -export CFDEM_M2MLIB_PATH=$CFDEM_SRC_DIR/subModels/dataExchangeModel/twoWayM2M/library +export CFDEM_M2MLIB_PATH=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library #- path to test harness export CFDEM_TEST_HARNESS_PATH=$CFDEM_PROJECT_USER_DIR/log/logFilesCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION @@ -56,7 +56,7 @@ export CFDEM_LIB_DIR=$FOAM_USER_LIBBIN export CFDEM_APP_DIR=$FOAM_USER_APPBIN #- path to OF version flag file -export CFDEM_OFVERSION_DIR=$CFDEM_SRC_DIR/etc/OFversion +export CFDEM_OFVERSION_DIR=$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/OFversion #------------------------------------------------------------------------------ #- settings for lpp postproc tool #------------------------------------------------------------------------------ @@ -101,28 +101,40 @@ alias cfdemDox='firefox $CFDEM_DOC_DIR/doxygen/html/index.html' alias cfdemLIG='cd $CFDEM_LIGGGHTS_SRC_DIR' #- shortcut to system test -alias cfdemSysTest='bash $CFDEM_SRC_DIR/etc/cfdemSystemTest.sh' +alias cfdemSysTest='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh' + +#- shortcut to pull LIGGGHTS +alias cfdemPullLIG='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/pullLIGGGHTS.sh' + +#- shortcut to pull CFDEMcoupling +alias cfdemPullCFDEMcoupling='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/pullCFDEMcoupling.sh' + +#- shortcut to clean CFDEM +alias cfdemCleanCFDEM='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cleanCFDEMcoupling.sh' #- shortcut to compile LIGGGHTS -alias cfdemCompLIG='bash $CFDEM_SRC_DIR/etc/compileLIGGGHTS.sh' +alias cfdemCompLIG='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh' + +#- shortcut to compile CFDEMcoupling +LIGGGHTS +alias cfdemCompCFDEMall='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_all.sh' #- shortcut to compile CFDEMcoupling (src+solvers) -alias cfdemCompCFDEM='bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling.sh' +alias cfdemCompCFDEM='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh' #- shortcut to compile CFDEMcoupling src -alias cfdemCompCFDEMsrc='bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_src.sh' +alias cfdemCompCFDEMsrc='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh' #- shortcut to compile CFDEMcoupling solvers -alias cfdemCompCFDEMsol='bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_sol.sh' +alias cfdemCompCFDEMsol='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh' #- shortcut to compile CFDEMcoupling utilities -alias cfdemCompCFDEMuti='bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_uti.sh' +alias cfdemCompCFDEMuti='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh' #- shortcut to compile couple library -alias cfdemCompM2M='bash $CFDEM_SRC_DIR/etc/compileM2Mlib.sh' +alias cfdemCompM2M='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileM2Mlib.sh' #- shortcut to test basic tutorials -alias cfdemTestTUT='bash $CFDEM_SRC_DIR/etc/testTutorials.sh' +alias cfdemTestTUT='bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/testTutorials.sh' #- recursive touch of current directory alias touchRec='find ./* -exec touch {} \;' diff --git a/src/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh b/src/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh index 6a211c2..9c508c8 100755 --- a/src/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh +++ b/src/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh @@ -6,7 +6,7 @@ #===================================================================# #- include functions -source $CFDEM_SRC_DIR/etc/functions.sh +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh #- show gcc settings checkGPP="true" @@ -18,6 +18,7 @@ echo "*******************" echo "CFDEM_VERSION=$CFDEM_VERSION" echo "couple to OF_VERSION=$WM_PROJECT_VERSION" +echo "compile option=$WM_COMPILE_OPTION" echo echo "check if paths are set correctly" diff --git a/src/lagrangian/cfdemParticle/etc/cleanCFDEMcoupling.sh b/src/lagrangian/cfdemParticle/etc/cleanCFDEMcoupling.sh new file mode 100644 index 0000000..99008b3 --- /dev/null +++ b/src/lagrangian/cfdemParticle/etc/cleanCFDEMcoupling.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +#===================================================================# +# clean routine for CFDEMcoupling, part of CFDEMproject +# Christoph Goniva - Sept. 2013, DCS Computing GmbH +#===================================================================# + +#- include functions +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh + +#================================================================================# +# clean src remove object files +#================================================================================# +cleanCFDEM + + diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh index 7642719..9792a1a 100755 --- a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh @@ -6,27 +6,26 @@ #===================================================================# #- include functions -source $CFDEM_SRC_DIR/etc/functions.sh +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh NOW="$(date +"%Y-%m-%d-%H:%M")" logDir="log" -cd $CFDEM_SRC_DIR/etc +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc mkdir -p $logDir - #================================================================================# # compile src #================================================================================# -bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_src.sh +bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh #================================================================================# # compile solvers #================================================================================# -bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_sol.sh +bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh #================================================================================# # compile utilities #================================================================================# -bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_uti.sh +bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_all.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_all.sh new file mode 100755 index 0000000..f841216 --- /dev/null +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_all.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +#===================================================================# +# compile routine for CFDEMcoupling + LIGGGHTS, part of CFDEMproject +# Christoph Goniva - May. 2012, DCS Computing GmbH +#===================================================================# + +#- include functions +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh + +NOW="$(date +"%Y-%m-%d-%H:%M")" +logDir="log" + + +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc +mkdir -p $logDir + +#================================================================================# +# compile LIGGGHTS +#================================================================================# +bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh + +#================================================================================# +# compile CFDEMcoupling +#================================================================================# +bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh index b6ec976..2938863 100755 --- a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh @@ -5,32 +5,81 @@ # Christoph Goniva - May. 2012, DCS Computing GmbH #===================================================================# +whitelist="solver-list.txt" + #- include functions -source $CFDEM_SRC_DIR/etc/functions.sh - -NOW="$(date +"%Y-%m-%d-%H:%M")" +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh logDir="log" - - -cd $CFDEM_SRC_DIR/etc +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc mkdir -p $logDir -#================================================================================# -# compile solvers -#================================================================================# +CWD="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")" +NOW="$(date +"%Y-%m-%d-%H:%M")" +echo "" +echo "This routine will compile the solvers specified in solver-list.txt" +echo "" +#echo "Are the variables CFDEM_SOLVER_DIR=$CFDEM_SOLVER_DIR" +#echo "and CFDEM_SRC_DIR=$CFDEM_SRC_DIR/lagrangian/cfdemParticle correct? (y/n)" +#read YN +#if [ "$YN" != "y" ];then +# echo "Aborted by user." +# exit 1 +#fi -for solverName in "cfdemSolverPiso" "cfdemSolverIB" "cfdemSolverPisoScalar" -do - #--------------------------------------------------------------------------------# - #- define variables - logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" - logfileName="log_compileCFDEMcoupling""_$solverName" - casePath="$CFDEM_SOLVER_DIR/$solverName" - headerText="$logfileName""_$solverName""-$NOW" - #--------------------------------------------------------------------------------# - compileSolver $logpath $logfileName $casePath $headerText -done +echo "" +echo "Please provide the solvers to be compiled in the $CWD/$whitelist file." +echo "structure:" +echo "path to provide the path relative to CFDEM_SOLVER_DIR" +echo "" +echo "example:" +echo "cfdemSolverPiso/dir" +echo "" -#echo "Note: the list of solvers compiled might be incomplete." -#echo "please check $CFDEM_SOLVER_DIR for more solvers available" +if [ ! -f "$CWD/$whitelist" ];then + echo "$whitelist does not exist in $CWD" +else + NLINES=`wc -l < $CWD/$whitelist` + COUNT=0 + + for masterLogFile in "$masterLogName" + do + + while [ $COUNT -lt $NLINES ] + do + let COUNT++ + LINE=`head -n $COUNT $CWD/$whitelist | tail -1` + + # white lines + if [[ "$LINE" == "" ]]; then + continue + # comments + elif [[ "$LINE" == \#* ]]; then + continue + # paths + elif [[ "$LINE" == */dir ]]; then + echo "change path" + LINE=$(echo "${LINE%????}") + path="$CFDEM_SOLVER_DIR/$LINE" + cd $path + #continue + fi + + #- execute tutorial + echo "running testcase $path" + #bash Allrun.sh + + #--------------------------------------------------------------------------------# + #- define variables + logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" + logfileName="log_compileCFDEMcoupling""_$LINE" + casePath="$CFDEM_SOLVER_DIR/$LINE" + headerText="$logfileName""_$LINE""-$NOW" + #--------------------------------------------------------------------------------# + compileSolver $logpath $logfileName $casePath $headerText + + #echo "did the solvers compile correcty? - press enter to proceed." + #read + done + done +fi diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh index 09ec125..2663b2b 100755 --- a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh @@ -3,28 +3,63 @@ #===================================================================# # compile routine for CFDEMcoupling source, part of CFDEMproject # Christoph Goniva - May. 2012, DCS Computing GmbH +# update: Stefan Radl (TU Graz, Jan 2014) #===================================================================# - + #- include functions -source $CFDEM_SRC_DIR/etc/functions.sh +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh NOW="$(date +"%Y-%m-%d-%H:%M")" logDir="log" -cd $CFDEM_SRC_DIR/etc +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc mkdir -p $logDir #================================================================================# # compile src #================================================================================# + whitelist="$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/library-list.txt" + echo "" + echo "Please provide the libraries to be compiled in the $CWD/$whitelist file." + + if [ ! -f "$CWD/$whitelist" ];then + echo "$whitelist does not exist in $CWD. Nothing will be done." + NLINES=0 + COUNT=0 + else + NLINES=`wc -l < $CWD/$whitelist` + COUNT=0 + fi + + while [ $COUNT -lt $NLINES ] + do + let COUNT++ + LINE=`head -n $COUNT $CWD/$whitelist | tail -1` + + # white lines + if [[ "$LINE" == "" ]]; then + echo "compile $LINE" + continue + # comments + elif [[ "$LINE" == \#* ]]; then + continue + # paths + elif [[ "$LINE" == */dir ]]; then + echo "will change path..." + LINE=$(echo "${LINE%????}") + path="$CFDEM_SRC_DIR/$LINE" + cd $path + #continue + fi + #--------------------------------------------------------------------------------# + #- define variables + logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" + logfileName="log_compileCFDEMcoupling_"$(basename $LINE)"-$NOW" + casePath="$path" + headerText="$logfileName""-$NOW" + #--------------------------------------------------------------------------------# + compileLib $logpath $logfileName $casePath $headerText + done -#--------------------------------------------------------------------------------# -#- define variables -logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" -logfileName="log_compileCFDEMcoupling_src" #alternative: logfileName="log_compileLIGGGHTS_$NOW" -casePath="$CFDEM_SRC_DIR" -headerText="$logfileName""-$NOW" -#--------------------------------------------------------------------------------# -compileLib $logpath $logfileName $casePath $headerText diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh index 423843f..8b91bfe 100644 --- a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh @@ -6,13 +6,13 @@ #===================================================================# #- include functions -source $CFDEM_SRC_DIR/etc/functions.sh +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh NOW="$(date +"%Y-%m-%d-%H:%M")" logDir="log" -cd $CFDEM_SRC_DIR/etc +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc mkdir -p $logDir #================================================================================# diff --git a/src/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh b/src/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh index 58e3d65..6914f31 100755 --- a/src/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh +++ b/src/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh @@ -6,12 +6,12 @@ #=================================================================== #- include functions -source $CFDEM_SRC_DIR/etc/functions.sh +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh NOW="$(date +"%Y-%m-%d-%H:%M")" logDir="log" -cd $CFDEM_SRC_DIR/etc +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc mkdir -p $logDir #--------------------------------------------------------------------------------# diff --git a/src/lagrangian/cfdemParticle/etc/controlDict_cgs_2.2.x b/src/lagrangian/cfdemParticle/etc/controlDict_cgs_2.2.x new file mode 100644 index 0000000..2922de2 --- /dev/null +++ b/src/lagrangian/cfdemParticle/etc/controlDict_cgs_2.2.x @@ -0,0 +1,1031 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 2.2.1 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} + +// NB: the #functions do not work here +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Documentation +{ + docBrowser "firefox %f"; + doxyDocDirs + ( + "$WM_PROJECT_USER_DIR/html" + "~OpenFOAM/html" + "$WM_PROJECT_DIR/doc/Doxygen/html" + ); + doxySourceFileExts + ( + "App_8C.html" + "_8C.html" + ); +} + + +InfoSwitches +{ + writePrecision 6; + writeJobInfo 0; + writeDictionaries 0; + + // Allow case-supplied C++ code (#codeStream, codedFixedValue) + allowSystemOperations 0; +} + + +OptimisationSwitches +{ + // On NFS mounted file system: maximum wait for files to appear/get + // updated. Set to 0 on distributed case. + fileModificationSkew 30; + + //- Modification checking: + // - timeStamp : use modification time on file + // - inotify : use inotify framework + // - timeStampMaster : do time stamp (and file reading) only on master. + // - inotifyMaster : do inotify (and file reading) only on master. + fileModificationChecking timeStampMaster;//inotify;timeStamp;inotifyMaster; + + commsType nonBlocking; //scheduled; //blocking; + floatTransfer 0; + nProcsSimpleSum 0; + + // Force dumping (at next timestep) upon signal (-1 to disable) + writeNowSignal -1; //10; + // Force dumping (at next timestep) upon signal (-1 to disable) and exit + stopAtWriteNowSignal -1; +} + + +DebugSwitches +{ + Analytical 0; + APIdiffCoefFunc 0; + Ar 0; + BICCG 0; + BirdCarreau 0; + C10H22 0; + C12H26 0; + C13H28 0; + C14H30 0; + C16H34 0; + C2H5OH 0; + C2H6 0; + C2H6O 0; + C3H6O 0; + C3H8 0; + C4H10O 0; + C6H14 0; + C6H6 0; + C7H16 0; + C7H8 0; + C8H10 0; + C8H18 0; + C9H20 0; + CH3OH 0; + CH4N2O 0; + CarnahanStarling 0; + CallbackRegistry 0; + CentredFitData 0; + CentredFitData 0; + CentredFitData 0; + CentredFitData 0; + ChomiakInjector 0; + Cloud 0; + Cloud 0; + Cloud 0; + Cloud 0; + Cloud 0; + Cloud 0; + Cloud 0; + CoEuler 0; + CompositionModel 0; + ConeInjection 0; + Constant 0; + ConstantRateDevolatilisation 0; + CrankNicolson 0; + CrossPowerLaw 0; + Cs 0; + DIC 0; + DICGaussSeidel 0; + DILU 0; + DILUGaussSeidel 0; + DataEntry 0; + DeardorffDiffStress 0; + DispersionModel 0; + DispersionRASModel 0; + DragModel 0; + ETAB 0; + Ergun 0; + Euler 0; + EulerImplicit 0; + EulerRotation 0; + extendedCellToFaceStencil 0; + FDIC 0; + FaceCellWave 0; + GAMG 0; + GAMGAgglomeration 0; + GAMGInterface 0; + GAMGInterfaceField 0; + Gamma 0; + Gamma01 0; + GammaV 0; + Gauss 0; + GaussSeidel 0; + Gibilaro 0; + Gidaspow 0; + GidaspowErgunWenYu 0; + GidaspowSchillerNaumann 0; + GradientDispersionRAS 0; + Gulders 0; + GuldersEGR 0; + H2O 0; + HashTable 0; + HeatTransferModel 0; + HerschelBulkley 0; + HrenyaSinclair 0; + IC8H18 0; + ICCG 0; + IDDESDelta 0; + IDEA 0; + IFstream 0; + IOMap 0; + IOPtrList 0; + IOPtrList 0; + IOPtrList 0; + IOPtrList 0; + IOobject 0; + InjectionModel 0; + IntegrationScheme 0; + JohnsonJackson 0; + KRR4 0; + KinematicCloud 0; + KinematicCloud 0; + KinematicCloud 0; + KinematicParcel 0; + KinematicParcel 0; + LESModel 0; + LESdelta 0; + LESfilter 0; + LISA 0; + LRR 0; + LRRDiffStress 0; + LamBremhorstKE 0; + LaunderGibsonRSTM 0; + LaunderSharmaKE 0; + LienCubicKE 0; + LienCubicKELowRe 0; + LienLeschzinerLowRe 0; + MB 0; + MC 0; + MCV 0; + MUSCL 0; + MUSCL01 0; + MUSCLV 0; + ManualInjection 0; + MarshakRadiation 0; + MarshakRadiationFixedT 0; + MassTransferModel 0; + MeshWave 0; + Minmod 0; + MinmodV 0; + N2 0; + NSRDSfunc0 0; + NSRDSfunc1 0; + NSRDSfunc14 0; + NSRDSfunc2 0; + NSRDSfunc3 0; + NSRDSfunc4 0; + NSRDSfunc5 0; + NSRDSfunc6 0; + NSRDSfunc7 0; + Newtonian 0; + NoDispersion 0; + NoDrag 0; + NoHeatTransfer 0; + NoInjection 0; + NoMassTransfer 0; + NoSurfaceReaction 0; + NonlinearKEShih 0; + ODE 0; + ODESolver 0; + OFstream 0; + ORourke 0; + OSPRE 0; + OSPREV 0; + P1 0; + PBiCG 0; + PCG 0; + PackedList 0; + ParSortableList 0; + PatchToPatchInterpolation 0; + Phi 0; + PointEdgeWave 0; + POSIX 0; + Prandtl 0; + PrimitivePatch 0; + Pstream 0; + QUICK 0; + QUICKV 0; + QZeta 0; + RASModel 0; + RK 0; + RNGkEpsilon 0; + RanzMarshall 0; + ReactingCloud 0; + ReactingParcel 0; + Rebound 0; + ReitzDiwakar 0; + ReitzKHRT 0; + RosinRammler 0; + RutlandFlashBoil 0; + SDA 0; + SFCD 0; + SFCDV 0; + SHF 0; + SIBS 0; + SKA 0; + SLTS 0; + SRFModel 0; + SRFVelocity 0; + STARCDRotation 0; + Schaeffer 0; + SchillerNaumann 0; + SinclairJackson 0; + SingleKineticRateDevolatilisation 0; + SingleMixtureFraction 0; + Smagorinsky 0; + SolverPerformance 1; + SpalartAllmaras 0; + SpalartAllmarasDDES 0; + SpalartAllmarasIDDES 0; + SphereDrag 0; + StandardWallInteraction 0; + StaticHashTable 0; + StochasticDispersionRAS 0; + SuperBee 0; + SuperBeeV 0; + SurfaceReactionModel 0; + Syamlal 0; + SyamlalOBrien 0; + SyamlalRogersOBrien 0; + TAB 0; + Table 0; + ThermoCloud 0; + ThermoCloud 0; + ThermoParcel 0; + ThermoParcel 0; + UMIST 0; + UMISTV 0; + UpwindFitData 0; + UpwindFitData 0; + UpwindFitData 0; + WallInteractionModel 0; + WenYu 0; + aC11H10 0; + absorptionEmissionModel 0; + addCell 0; + addFace 0; + addPatchCellLayer 0; + addPoint 0; + advective 0; + algebraicPair 0; + alphaContactAngle 0; + alphaFixedPressure 0; + alphatWallFunction 0; + angularOscillatingDisplacement 0; + angularOscillatingVelocity 0; + anisotropic 0; + ash 0; + atomizationModel 0; + attachDetach 0; + autoDensity 0; + autoHexMeshDriver 0; + autoLayerDriver 0; + autoRefineDriver 0; + autoSnapDriver 0; + bC11H10 0; + backgroundMeshDecomposition 0; + backward 0; + basePatch 0; + basicKinematicCloud 0; + basicKinematicParcel 0; + basicMixture 0; + basicReactingCloud 0; + basicReactingParcel 0; + fluidThermo 0; + fluidThermoCloud 0; + fluidThermoParcel 0; + biLinearFit 0; + binaryAbsorptionEmission 0; + blended 0; + blobsSheetAtomization 0; + blobsSwirlInjector 0; + booleanSurface 0; + boundaryCutter 0; + boundaryMesh 0; + boundaryToFace 0; + boundedBackward 0; + boxToCell 0; + boxToFace 0; + boxToPoint 0; + breakupModel 0; + calculated 0; + cell 0; + cellClassification 0; + cellCuts 0; + cellDistFuncs 0; + cellLimited 0; + cellList 0; + cellLooper 0; + cellMDLimited 0; + cellMotion 0; + cellPoint 0; + cellPointFace 0; + cellPointWeight 0; + cellSet 0; + cellSizeControlSurfaces 0; + cellToCell 0; + cellToFace 0; + cellToPoint 0; + cellZone 0; + centredCECStencil 0; + centredCFCStencil 0; + chemistryReader 0; + chemistrySolver 0; + chemkinReader 0; + clippedLinear 0; + cloud 0; + cloudAbsorptionEmission 0; + cloudScatter 0; + collisionModel 0; + combineFaces 0; + commSchedule 0; + commonRailInjector 0; + compound 0; + constInjector 0; + constant 0; + constantAbsorptionEmission 0; + constantAlphaContactAngle 0; + constantScatter 0; + coordinateRotation 0; + coordinateSystem 0; + coordinateSystems 0; + corrected 0; + coupled 0; + cubeRootVol 0; + cubic 0; + cubicUpwindFit 0; + curve 0; + cyclic 0; + cyclicLduInterface 0; + cyclicLduInterfaceField 0; + cylinderToCell 0; + cylindrical 0; + decompositionMethod 0; + definedHollowConeInjector 0; + definedInjector 0; + definedPressureSwirlInjector 0; + diagTensorField 0; + diagonal 0; + dictionary 0; + dimensionSet 1; + mappedBase 0; + mappedPatch 0; + mappedVelocityFlux 0; + directionMixed 0; + directional 0; + disallowGenericFvPatchField 0; + disallowGenericPointPatchField 0; + disallowGenericPolyPatch 0; + dispersionLESModel 0; + dispersionModel 0; + dispersionRASModel 0; + displacementComponentLaplacian 0; + displacementInterpolation 0; + displacementLaplacian 0; + displacementSBRStress 0; + distanceSurface 0; + Distribution 0; + downwind 0; + dragModel 0; + duplicatePoints 0; + dx 0; + dynMixedSmagorinsky 0; + dynOneEqEddy 0; + dynSmagorinsky 0; + dynamicAlphaContactAngle 0; + dynamicFvMesh 0; + dynamicInkJetFvMesh 0; + dynamicMotionSolverFvMesh 0; + dynamicRefineFvMesh 0; + edgeIntersections 0; + edgeList 0; + edgeSurface 0; + empty 0; + engineMesh 0; + enrichedPatch 0; + epsilonWallFunction 0; + errorDrivenRefinement 0; + evaporationModel 0; + exponential 0; + extendedLeastSquares 0; + extendedLeastSquaresVectors 0; + face 0; + faceAreaPair 0; + faceCoupleInfo 0; + faceLimited 0; + faceList 0; + faceMDLimited 0; + faceSet 0; + faceToCell 0; + faceToFace 0; + faceToPoint 0; + faceZone 0; + fan 0; + featureEdgeMesh 0; + fieldToCell 0; + file 0; + fileName 2; + filteredLinear 0; + filteredLinear2 0; + filteredLinear2V 0; + filteredLinear3 0; + filteredLinear3V 0; + fixedEnthalpy 0; + buoyantPressure 0; + fixedFluxBoussinesqBuoyantPressure 0; + fixedFluxPressure 0; + fixedGradient 0; + fixedInternalEnergy 0; + fixedInternalValue 0; + fixedNormalSlip 0; + fixedPressureCompressibleDensity 0; + fixedUnburntEnthalpy 0; + fixedValue 0; + flowRateInletVelocity 0; + fluxCorrectedVelocity 0; + foamChemistryReader 0; + foamFile 0; + forceCoeffs 0; + forces 0; + fourth 0; + freestream 0; + freestreamPressure 0; + frictionalStressModel 0; + functionObject 0; + fv 0; + fvMesh 0; + fvMeshDistribute 0; + fvMotionSolver 0; + fvPatchField 0; + fvScalarMatrix 0; + fvSchemes 0; + fvSphericalTensorMatrix 0; + fvSymmTensorMatrix 0; + fvTensorMatrix 0; + fvVectorMatrix 0; + fvsPatchField 0; + general 0; + generic 0; + genericPatch 0; + geomCellLooper 0; + geometricSurfacePatch 0; + global 0; + globalIndexAndTransform 0; + globalMeshData 0; + globalPoints 0; + gnuplot 0; + gradientDispersionRAS 0; + gradientEnthalpy 0; + gradientInternalEnergy 0; + gradientUnburntEnthalpy 0; + granularPressureModel 0; + hCombustionThermo 0; + hMixtureThermo>>>> 0; + hMixtureThermo>>>> 0; + hMixtureThermo>>>> 0; + hMixtureThermo>>>> 0; + hMixtureThermo>>>> 0; + hMixtureThermo 0; + hMixtureThermo>>>> 0; + hMixtureThermo>>>> 0; + hThermo>>>> 0; + hThermo>>>> 0; + hThermo>>>> 0; + harmonic 0; + heatTransferModel 0; + hexCellLooper 0; + hexRef8 0; + hhuCombustionThermo 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hhuMixtureThermo>>>> 0; + hierarchical 0; + hollowConeInjector 0; + iC3H8O 0; + indexedOctree 0; + indexedParticle 0; + injectorModel 0; + injectorType 0; + inletOutlet 0; + inletOutletTotalTemperature 0; + interfaceCompression 0; + intersectedSurface 0; + inverseDistance 0; + inverseFaceDistance 0; + inversePointDistance 0; + inverseVolume 0; + isoSurface 0; + isoSurfaceCell 0; + jplot 0; + jumpCyclic 0; + kEpsilon 0; + kOmega 0; + kOmegaSST 0; + kOmegaSSTSAS 0; + kqRWallFunction 0; + kinematicCloud 0; + labelField 0; + labelList 0; + labelListList 0; + labelToCell 0; + labelToFace 0; + labelToPoint 0; + laminar 0; + laminarFlameSpeed 0; + laplace 0; + layerAdditionRemoval 0; + layered 0; + lduInterface 0; + lduInterfaceField 0; + lduMatrix 1; + lduMesh 0; + leastSquares 0; + leastSquaresVectors 0; + level 2; + limitWith 0; + limited 0; + limitedCubic 0; + limitedCubic01 0; + limitedCubicV 0; + limitedGamma 0; + limitedLimitedCubic 0; + limitedLimitedLinear 0; + limitedLinear 0; + limitedLinear01 0; + limitedLinearV 0; + limitedMUSCL 0; + limitedSurfaceInterpolationScheme 0; + limitedVanLeer 0; + linear 0; + linearFit 0; + linearUpwind 0; + linearUpwindV 0; + liquid 0; + locDynOneEqEddy 0; + localBlended 0; + localMax 0; + localMin 0; + localPointRegion 0; + lowReOneEqEddy 0; + manual 0; + meshCutAndRemove 0; + meshCutter 0; + meshModifier 0; + meshRefinement 0; + meshSearch 0; + meshToMesh 0; + metis 0; + midPoint 0; + midPointAndFace 0; + mixed 0; + mixedEnthalpy 0; + mixedInternalEnergy 0; + mixedSmagorinsky 0; + mixedUnburntEnthalpy 0; + mixerFvMesh 0; + modifyCell 0; + modifyFace 0; + modifyPoint 0; + motionDiffusivity 0; + motionDirectional 0; + motionSmoother 0; + motionSolver 0; + movingConeTopoFvMesh 0; + movingWallVelocity 0; + muSgsSpalartAllmarasWallFunction 0; + multiDirRefinement 0; + multiHoleInjector 0; + multiLevel 0; + multivariateSelection 0; + mutRoughWallFunction 0; + mutSpalartAllmarasStandardRoughWallFunction 0; + mutSpalartAllmarasStandardWallFunction 0; + mutSpalartAllmarasWallFunction 0; + mutWallFunction 0; + nC3H8O 0; + nbrToCell 0; + nearestToCell 0; + nearestToPoint 0; + noAbsorptionEmission 0; + noDragModel 0; + noRadiation 0; + none 0; + normal 0; + normalToFace 0; + nuSgsSpalartAllmarasWallFunction 0; + nutRoughWallFunction 0; + nutSpalartAllmarasStandardRoughWallFunction 0; + nutSpalartAllmarasStandardWallFunction 0; + nutSpalartAllmarasWallFunction 0; + nutWallFunction 0; + obj 0; + objectRegistry 0; + off 0; + omegaWallFunction 0; + oneEqEddy 0; + orientedSurface 0; + oscillatingDisplacement 0; + oscillatingFixedValue 0; + oscillatingVelocity 0; + outletInlet 0; + outletStabilised 0; + pair 0; + parabolicCylindrical 0; + parcel 0; + partialSlip 0; + passiveParticle 0; + patch 0; + patchToFace 0; + patchZones 0; + pdf 0; + perfectInterface 0; + pointIndexHitList 0; + pointPatchField 0; + pointScalarField 0; + pointScalarField::DimensionedInternalField 0; + pointSet 0; + pointSphericalTensorField 0; + pointSphericalTensorField::DimensionedInternalField 0; + pointSymmTensorField 0; + pointSymmTensorField::DimensionedInternalField 0; + pointTensorField 0; + pointTensorField::DimensionedInternalField 0; + pointToCell 0; + pointToFace 0; + pointToPoint 0; + pointVectorField 0; + pointVectorField::DimensionedInternalField 0; + pointZone 0; + polyBoundaryMesh 0; + polyMesh 0; + polyMeshGeometry 0; + polyMeshInfo 0; + polyTopoChange 0; + polyTopoChanger 0; + powerLaw 0; + pressureDirectedInletOutletVelocity 0; + pressureDirectedInletVelocity 0; + pressureInletOutletVelocity 0; + pressureInletUniformVelocity 0; + pressureInletVelocity 0; + pressureNormalInletOutletVelocity 0; + pressureSwirlInjector 0; + primitiveMesh 0; + primitiveMeshGeometry 0; + probes 0; + processor 0; + processorLduInterface 0; + processorLduInterfaceField 0; + pureMixture>>> 0; + pureMixture>>> 0; + pureMixture>>> 0; + quadratic 0; + quadraticFit 0; + quadraticLinearFit 0; + quadraticLinearUpwindFit 0; + quadraticUpwindFit 0; + radiationModel 0; + raw 0; + reactingCloud 0; + reaction 0; + realizableKE 0; + refinementHistory 0; + refinementIterator 0; + reflect 0; + regIOobject 0; + regionSplit 0; + regionToCell 0; + remove 0; + removeCell 0; + removeCells 0; + removeFace 0; + removeFaces 0; + removePoint 0; + removePoints 0; + reverseLinear 0; + rotatedBoxToCell 0; + rotatingPressureInletOutletVelocity 0; + rotatingTotalPressure 0; + sampledPatch 0; + sampledPlane 0; + sampledSet 0; + sampledSurface 0; + saturateEvaporationModel 0; + scalarAverageField 0; + scalarField 0; + scalarRange 0; + scaleSimilarity 0; + scatterModel 0; + searchableBox 0; + searchableSurface 0; + sequential 0; + setUpdater 0; + sets 0; + shapeList 0; + shapeToCell 0; + simple 0; + sixDoFRigidBodyMotionConstraint 0; + skewCorrected 0; + skewCorrectionVectors 0; + sliced 0; + slidingInterface 0; + slip 0; + smooth 0; + smoothSolver 0; + solid 0; + solidBodyMotionFunction 0; + solidBodyMotionFvMesh 0; + solution 0; + spectEddyVisc 0; + sphereToCell 0; + spherical 0; + sphericalTensorAverageField 0; + sphericalTensorField 0; + standardDragModel 0; + standardEvaporationModel 0; + staticFvMesh 0; + steadyState 0; + stl 0; + string 0; + stochasticDispersionRAS 0; + supersonicFreestream 0; + surfaceFeatures 0; + surfaceInterpolation 0; + surfaceInterpolationScheme 0; + surfaceIntersection 0; + surfaceNormalFixedValue 0; + surfacePatch 0; + surfacePatchIOList 0; + surfaceScalarField 0; + surfaceScalarField::DimensionedInternalField 0; + surfaceSlipDisplacement 0; + surfaceSphericalTensorField 0; + surfaceSphericalTensorField::DimensionedInternalField 0; + surfaceSymmTensorField 0; + surfaceSymmTensorField::DimensionedInternalField 0; + surfaceTensorField 0; + surfaceTensorField::DimensionedInternalField 0; + surfaceToCell 0; + surfaceToPoint 0; + surfaceVectorField 0; + surfaceVectorField::DimensionedInternalField 0; + surfaceWriter 0; + surfaces 0; + swirlInjector 0; + symmTensorAverageField 0; + symmTensorField 0; + symmetryPlane 0; + syringePressure 0; + tensorAverageField 0; + tensorField 0; + tetDecomposedPolyMesh 0; + thermoCloud 0; + thermophysicalFunction 0; + time 0; + timeVaryingAlphaContactAngle 0; + timeVaryingFlowRateInletVelocity 0; + timeVaryingMappedFixedValue 0; + timeVaryingTotalPressure 0; + timeVaryingUniformFixedValue 0; + timer 0; + topoAction 0; + topoCellLooper 0; + topoChangerFvMesh 0; + topoSet 0; + topoSetSource 0; + toroidal 0; + totalPressure 0; + totalTemperature 0; + trackedParticle 0; + trajectory 0; + transform 0; + treeDataCell 0; + treeDataFace 0; + treeDataTriSurface 0; + treeLeaf 0; + treeNode 0; + triSurface 0; + triSurfaceMesh 0; + turbulenceModel 0; + turbulentHeatFluxTemperature 0; + turbulentInlet 0; + turbulentIntensityKineticEnergyInlet 0; + turbulentMixingLengthDissipationRateInlet 0; + turbulentMixingLengthFrequencyInlet 0; + uncorrected 0; + undoableMeshCutter 0; + uniform 0; + uniformFixedValue 0; + unitInjector 0; + upwind 0; + upwindCFCStencil 0; + value 0; + vanAlbada 0; + vanAlbadaV 0; + vanDriest 0; + vanLeer 0; + vanLeer01 0; + vanLeerV 0; + vector2DField 0; + vectorAverageField 0; + vectorField 0; + velocityComponentLaplacian 0; + velocityLaplacian 0; + viscosityModel 0; + volPointInterpolation 0; + volScalarField 0; + volScalarField::DimensionedInternalField 0; + volSphericalTensorField 0; + volSphericalTensorField::DimensionedInternalField 0; + volSymmTensorField 0; + volSymmTensorField::DimensionedInternalField 0; + volTensorField 0; + volTensorField::DimensionedInternalField 0; + volVectorField 0; + volVectorField::DimensionedInternalField 0; + vtk 0; + walkPatch 0; + wall 0; + wallHeatTransfer 0; + wallLayerCells 0; + wallModel 0; + warnUnboundedGauss 1; + waveTransmissive 0; + wedge 0; + weighted 0; + word 2; + writer 0; + xmgr 0; + zeroGradient 0; + zoneToCell 0; + zoneToFace 0; + zoneToPoint 0; +} + + +DimensionedConstants +{ + unitSet CGS; // SI; // USCS + + SICoeffs + { + universal + { + c c [ 0 1 -1 0 0 0 0 ] 2.99792e+08; + G G [ -1 3 -2 0 0 0 0 ] 6.67429e-11; + h h [ 1 2 -1 0 0 0 0 ] 6.62607e-34; + } + electromagnetic + { + e e [ 0 0 1 0 0 1 0 ] 1.60218e-19; + } + atomic + { + me me [ 1 0 0 0 0 0 0 ] 9.10938e-31; + mp mp [ 1 0 0 0 0 0 0 ] 1.67262e-27; + } + physicoChemical + { + mu mu [ 1 0 0 0 0 0 0 ] 1.66054e-27; + k k [ 1 2 -2 -1 0 0 0 ] 1.38065e-23; + } + standard + { + //- Standard pressure [Pa] + Pstd Pstd [ 1 -1 -2 0 0 0 0 ] 100000; + //- Standard temperature [degK] + Tstd Tstd [ 0 0 0 1 0 0 0 ] 298.15; + } + } + USCSCoeffs + { + universal + { + c c [ 0 1 -1 0 0 0 0 ] 9.83558e+08; + G G [ -1 3 -2 0 0 0 0 ] 1.06909e-09; + h h [ 1 2 -1 0 0 0 0 ] 1.57234e-32; + } + electromagnetic + { + e e [ 0 0 1 0 0 1 0 ] 1.60218e-19; + } + atomic + { + me me [ 1 0 0 0 0 0 0 ] 2.00825e-30; + mp mp [ 1 0 0 0 0 0 0 ] 3.68746e-27; + } + physicoChemical + { + mu mu [ 1 0 0 0 0 0 0 ] 3.66083e-27; + k k [ 1 2 -2 -1 0 0 0 ] 1.82012e-22; + } + standard + { + //- Standard pressure [lbm/ft^2] + Pstd Pstd [ 1 -1 -2 0 0 0 0 ] 2088.6; + //- Standard temperature [degR] + Tstd Tstd [ 0 0 0 1 0 0 0 ] 536.67; + } + } +} + + +DimensionSets +{ + unitSet SI; // USCS + + SICoeffs + { + // Basic units + kg kg [ 1 0 0 0 0 0 0 ] 1.0; + m m [ 0 1 0 0 0 0 0 ] 1.0; + s s [ 0 0 1 0 0 0 0 ] 1.0; + K K [ 0 0 0 1 0 0 0 ] 1.0; + mol mol [ 0 0 0 0 1 0 0 ] 1.0; + A A [ 0 0 0 0 0 1 0 ] 1.0; + Cd Cd [ 0 0 0 0 0 0 1 ] 1.0; + + // Derived units + Hz Hz [ s^-1 ] 1.0; + N N [ kg m s^-2 ] 1.0; + Pa Pa [ N m^-2 ] 1.0; + J J [ N m ] 1.0; + W W [ J s^-1 ] 1.0; + + // Some non-symbolic ones + area area [m^2] 1.0; + volume volume [m^3] 1.0; + density density [ kg m^-3 ] 1.0; + acceleration acceleration [ m s^-2 ] 1.0; + kinematicPressure kinematicPressure [ Pa density^-1 ] 1.0; + + // Scaled units. Only allowed in dimensionedType (dimensionedScalar, + // dimensionedVector etc.) and UniformDimensionedField, not + // in DimensionedField or GeometricField + cm cm [ m ] 1e-2; + mm mm [ m ] 1e-3; + km km [ m ] 1e3; + + // Set of units used for printing. Can be any basic or derived + // but not scaled (only supported for dimensionedScalar, etc) + //writeUnits (kg m s K mol A Cd); + } + + USCSCoeffs + { + // Basic units + lb lb [ 1 0 0 0 0 0 0 ] 1.0; + ft ft [ 0 1 0 0 0 0 0 ] 1.0; + s s [ 0 0 1 0 0 0 0 ] 1.0; + R R [ 0 0 0 1 0 0 0 ] 1.0; + mol mol [ 0 0 0 0 1 0 0 ] 1.0; + A A [ 0 0 0 0 0 1 0 ] 1.0; + Cd Cd [ 0 0 0 0 0 0 1 ] 1.0; + + // Set of units used for printing. Can be any basic or derived + // but not scaled (only supported for dimensionedScalar, etc) + //writeUnits (lb ft s R mol A Cd); + } +} + + + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/etc/cshrc b/src/lagrangian/cfdemParticle/etc/cshrc index 8e69416..0e30c68 100755 --- a/src/lagrangian/cfdemParticle/etc/cshrc +++ b/src/lagrangian/cfdemParticle/etc/cshrc @@ -24,7 +24,7 @@ #setenv CFDEM_UT_DIR $CFDEM_PROJECT_DIR/applications/utilities #setenv CFDEM_TUT_DIR $CFDEM_PROJECT_DIR/tutorials #setenv CFDEM_PROJECT_USER_DIR $HOME/CFDEM/$LOGNAME-$CFDEM_VERSION-$WM_PROJECT_VERSION -#setenv CFDEM_bashrc $CFDEM_SRC_DIR/etc/cshrc +#setenv CFDEM_bashrc $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cshrc #setenv CFDEM_LIGGGHTS_SRC_DIR $HOME/LIGGGHTS/LIGGGHTS-PUBLIC/src #setenv CFDEM_LIGGGHTS_MAKEFILE_NAME fedora_fpic #setenv CFDEM_LPP_DIR $HOME/LIGGGHTS/mylpp/src @@ -44,7 +44,7 @@ setenv CFDEM_LIGGGHTS_LIB_NAME lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME setenv CFDEM_LIB_NAME lagrangianCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION #- LMP M2M lib path -setenv CFDEM_M2MLIB_PATH $CFDEM_SRC_DIR/subModels/dataExchangeModel/twoWayM2M/library +setenv CFDEM_M2MLIB_PATH $CFDEM_SRC_DIR/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library #- path to test harness setenv CFDEM_TEST_HARNESS_PATH $CFDEM_PROJECT_USER_DIR/log/logFilesCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION @@ -99,28 +99,40 @@ alias cfdemDox 'firefox $CFDEM_DOC_DIR/doxygen/html/index.html' alias cfdemLIG 'cd $CFDEM_LIGGGHTS_SRC_DIR' #- shortcut to system test -alias cfdemSysTest 'bash $CFDEM_SRC_DIR/etc/cfdemSystemTest.sh' +alias cfdemSysTest 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cfdemSystemTest.sh' + +#- shortcut to pull LIGGGHTS +alias cfdemPullLIG 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/pullLIGGGHTS.sh' + +#- shortcut to pull CFDEMcoupling +alias cfdemPullCFDEMcoupling 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/pullCFDEMcoupling.sh' + +#- shortcut to clean CFDEM +alias cfdemCleanCFDEM 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/cleanCFDEMcoupling.sh' #- shortcut to compile LIGGGHTS -alias cfdemCompLIG 'bash $CFDEM_SRC_DIR/etc/compileLIGGGHTS.sh' +alias cfdemCompLIG 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileLIGGGHTS.sh' + +#- shortcut to compile CFDEMcoupling +LIGGGHTS +alias cfdemCompCFDEMall 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_all.sh' #- shortcut to compile CFDEMcoupling (src+solvers) -alias cfdemCompCFDEM 'bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling.sh' +alias cfdemCompCFDEM 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling.sh' #- shortcut to compile CFDEMcoupling src -alias cfdemCompCFDEMsrc 'bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_src.sh' +alias cfdemCompCFDEMsrc 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh' #- shortcut to compile CFDEMcoupling solvers -alias cfdemCompCFDEMsol 'bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_sol.sh' +alias cfdemCompCFDEMsol 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_sol.sh' #- shortcut to compile CFDEMcoupling utilities -alias cfdemCompCFDEMuti 'bash $CFDEM_SRC_DIR/etc/compileCFDEMcoupling_uti.sh' +alias cfdemCompCFDEMuti 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh' #- shortcut to compile couple library -alias cfdemCompM2M 'bash $CFDEM_SRC_DIR/etc/compileM2Mlib.sh' +alias cfdemCompM2M 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/compileM2Mlib.sh' #- shortcut to test basic tutorials -alias cfdemTestTUT 'bash $CFDEM_SRC_DIR/etc/testTutorials.sh' +alias cfdemTestTUT 'bash $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/testTutorials.sh' #- shortcut to run liggghts in serial alias cfdemLiggghts '$CFDEM_LIGGGHTS_SRC_DIR/lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME' diff --git a/src/lagrangian/cfdemParticle/etc/functions.sh b/src/lagrangian/cfdemParticle/etc/functions.sh index 25444b0..b2b6a74 100755 --- a/src/lagrangian/cfdemParticle/etc/functions.sh +++ b/src/lagrangian/cfdemParticle/etc/functions.sh @@ -6,6 +6,39 @@ # Christoph Goniva - June. 2011, DCS Computing GmbH #===================================================================# +#==================================# +#- function to pull from a repo + +pullRepo() +{ + #--------------------------------------------------------------------------------# + #- define variables + logpath="$1" + logfileName="$2" + casePath="$3" + headerText="$4" + #--------------------------------------------------------------------------------# + + #- clean up old log file + rm $logpath/$logfileName + + #- change path + cd $casePath + + #- header + echo 2>&1 | tee -a $logpath/$logfileName + echo 2>&1 | tee -a $logpath/$logfileName + echo "//=== $headerText ===//" 2>&1 | tee -a $logpath/$logfileName + echo 2>&1 | tee -a $logpath/$logfileName + + #- write path + pwd 2>&1 | tee -a $logpath/$logfileName + echo 2>&1 | tee -a $logpath/$logfileName + + #- pull + git pull 2>&1 | tee -a $logpath/$logfileName +} +#==================================# #==================================# #- function to compile a cfdem library @@ -117,6 +150,8 @@ compileLIGGGHTS() echo 2>&1 | tee -a $logpath/$logfileName #- wclean and wmake + rm $CFDEM_LIGGGHTS_SRC_DIR/"lmp_"$CFDEM_LIGGGHTS_MAKEFILE_NAME + rm $CFDEM_LIGGGHTS_SRC_DIR/"lib"$CFDEM_LIGGGHTS_LIB_NAME".a" make clean-all 2>&1 | tee -a $logpath/$logfileName make $CFDEM_LIGGGHTS_MAKEFILE_NAME -j $WM_NCOMPPROCS 2>&1 | tee -a $logpath/$logfileName make makelib 2>&1 | tee -a $logpath/$logfileName @@ -165,6 +200,112 @@ compileLMPlib() } #==================================# +#==================================# +#- function to clean CFDEMcoupling solvers and src + +cleanCFDEM() +{ + echo "do you really want to clean CFDEM src?" + echo "if not, abort with ctrl-C" + read + + #********************************************** + #cleaning libraries + whitelist="$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/library-list.txt" + echo "" + echo "Please provide the libraries to be cleaned in the $CWD/$whitelist file." + + if [ ! -f "$CWD/$whitelist" ];then + echo "$whitelist does not exist in $CWD. Nothing will be done." + NLINES=0 + COUNT=0 + else + NLINES=`wc -l < $CWD/$whitelist` + COUNT=0 + fi + + while [ $COUNT -lt $NLINES ] + do + let COUNT++ + LINE=`head -n $COUNT $CWD/$whitelist | tail -1` + + # white lines + if [[ "$LINE" == "" ]]; then + continue + # comments + elif [[ "$LINE" == \#* ]]; then + continue + # paths + elif [[ "$LINE" == */dir ]]; then + echo "will change path..." + LINE=$(echo "${LINE%????}") + path="$CFDEM_PROJECT_DIR/src/$LINE" + cd $path + #continue + fi + + cd $path + echo "cleaning library $PWD" + rmdepall + wclean + rm -r ./Make/linux* + rm -r ./lnInclude + done + + + #********************************************** + #cleaning utilities + echo "removing object files in" + echo " $CFDEM_UT_DIR" + rm -r $CFDEM_UT_DIR/*/Make/linux* + rm -r $CFDEM_UT_DIR/*/Make/linux* + rm -r $CFDEM_UT_DIR/*/*.dep + + + + #********************************************** + #cleaning solvers + whitelist="$CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/solver-list.txt" + echo "" + echo "Please provide the solvers to be cleaned in the $CWD/$whitelist file." + + if [ ! -f "$CWD/$whitelist" ];then + echo "$whitelist does not exist in $CWD. Nothing will be done." + NLINES=0 + COUNT=0 + else + NLINES=`wc -l < $CWD/$whitelist` + COUNT=0 + fi + + while [ $COUNT -lt $NLINES ] + do + let COUNT++ + LINE=`head -n $COUNT $CWD/$whitelist | tail -1` + + # white lines + if [[ "$LINE" == "" ]]; then + continue + # comments + elif [[ "$LINE" == \#* ]]; then + continue + # paths + elif [[ "$LINE" == */dir ]]; then + echo "will change path..." + LINE=$(echo "${LINE%????}") + path="$CFDEM_SOLVER_DIR/$LINE" + cd $path + #continue + fi + + cd $path + echo "cleaning solver $PWD" + rmdepall + wclean + done +} +#==================================# + #==================================# #- function to run a DEM case diff --git a/src/lagrangian/cfdemParticle/etc/library-list.txt b/src/lagrangian/cfdemParticle/etc/library-list.txt new file mode 100644 index 0000000..e97f7fe --- /dev/null +++ b/src/lagrangian/cfdemParticle/etc/library-list.txt @@ -0,0 +1,3 @@ +cylPorousMedia/dir +finiteVolume/dir +lagrangian/cfdemParticle/dir diff --git a/src/lagrangian/cfdemParticle/etc/pullLIGGGHTS.sh b/src/lagrangian/cfdemParticle/etc/pullLIGGGHTS.sh new file mode 100644 index 0000000..c21b979 --- /dev/null +++ b/src/lagrangian/cfdemParticle/etc/pullLIGGGHTS.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +#===================================================================# +# pull routine for LIGGGHTS, part of CFDEMproject +# Christoph Goniva - August. 2013, DCS Computing GmbH +#=================================================================== + +#- include functions +source $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc/functions.sh + +NOW="$(date +"%Y-%m-%d-%H:%M")" +logDir="log" + +cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle/etc +mkdir -p $logDir + +#--------------------------------------------------------------------------------# +#- define variables +logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" +logfileName="log_pullLIGGGHTS" +casePath="$CFDEM_LIGGGHTS_SRC_DIR" +headerText="$logfileName""-$NOW" +#--------------------------------------------------------------------------------# + +pullRepo $logpath $logfileName $casePath $headerText diff --git a/src/lagrangian/cfdemParticle/etc/solver-list.txt b/src/lagrangian/cfdemParticle/etc/solver-list.txt new file mode 100644 index 0000000..5c50d46 --- /dev/null +++ b/src/lagrangian/cfdemParticle/etc/solver-list.txt @@ -0,0 +1,4 @@ +cfdemSolverPiso/dir +cfdemSolverIB/dir +cfdemSolverPisoScalar/dir +cfdemSolverPimpleDyM_22x/dir diff --git a/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.C b/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.C index c0fc932..170180e 100644 --- a/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.C +++ b/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.C @@ -32,6 +32,7 @@ Description #include "error.H" #include "averagingModel.H" #include "voidFractionModel.H" +#include "forceModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -199,6 +200,80 @@ void averagingModel::setScalarSum field.correctBoundaryConditions(); } +void averagingModel::setDSauter +( + volScalarField& dSauter, + double**& weight, + volScalarField& weightField, + label myParticleType +) const +{ + label cellI; + scalar valueScal; + scalar weightP; + scalar radius(-1); + scalar radiusPow2(-1); + scalar radiusPow3(-1); + scalar volume(-1); + + scalar scale_ = particleCloud_.forceM(0).cg(); //scaling of parcel vs. primary particle diameter + dSauter = 0.0 * dSauter; //set to zero, because we will use it to calc sum(wi*ri^3) + volScalarField riPower2 + ( + IOobject + ( + "dummy2", + particleCloud_.mesh().time().timeName(), + particleCloud_.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + particleCloud_.mesh(), + dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0),0) + ); + + for(int index=0; index< particleCloud_.numberOfParticles(); index++) + { + if(myParticleType!=0) //in case a particle type is specified, only consider particles of the right type + if(myParticleType != particleCloud_.particleType(index)) continue; + + radius = particleCloud_.radii()[index][0] / scale_; //the primary particle diameter + radiusPow2 = radius*radius; + radiusPow3 = radiusPow2*radius; + weightP = weight[index][0]; + + for(int subCell=0;subCell= 0) + { + // first entry in this cell + if(weightField[cellI] == 0) + { + dSauter[cellI] = radiusPow3; //use dSauter to store sum(ri^3) + riPower2[cellI] = radiusPow2; + weightField[cellI] = weightP; + } + else + { + dSauter[cellI] = (dSauter[cellI]*weightField[cellI]+radiusPow3*weightP) + /(weightField[cellI]+weightP); + riPower2[cellI] = (riPower2[cellI]*weightField[cellI]+radiusPow2*weightP) + /(weightField[cellI]+weightP); + weightField[cellI] += weightP; + } + } + } + } + + // set value and correct cell values to patches + dSauter=2.0*dSauter / (riPower2+1e-99); + dSauter.correctBoundaryConditions(); + + return; +} + void averagingModel::resetVectorAverage(volVectorField& prev,volVectorField& next,bool single) const { if(!single) prev.internalField() = next.internalField(); diff --git a/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.H b/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.H index 4e9c411..70021ae 100644 --- a/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.H +++ b/src/lagrangian/cfdemParticle/subModels/averagingModel/averagingModel/averagingModel.H @@ -168,6 +168,14 @@ public: double**const& mask ) const; + void setDSauter + ( + volScalarField& dSauter, + double**& weight, + volScalarField& weightField, + label myParticleType = 0 // can be evaluated for a special type + ) const; + void resetVectorAverage(volVectorField& prev,volVectorField& next,bool single=false) const; void resetWeightFields() const; @@ -176,6 +184,10 @@ public: tmp UsInterp() const; + virtual void setParticleType(label type) const {}; + + virtual bool checkParticleType(label) const {return true;}; //consider all particles by default + // Access inline volVectorField& UsPrev() const {return UsPrev_;}; diff --git a/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C b/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C index f9d134f..374ef8e 100644 --- a/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C +++ b/src/lagrangian/cfdemParticle/subModels/averagingModel/dense/dense.C @@ -89,6 +89,8 @@ void dense::setScalarAverage for(int index=0; index< particleCloud_.numberOfParticles(); index++) { + if(!checkParticleType(index)) continue; //skip this particle if not correct type + //if(mask[index][0]) //{ for(int subCell=0;subCell couplingInterval_ * DEMts_ + SMALL) @@ -202,6 +210,11 @@ public: } } + inline bool checkExactTiming() const + { + + } + //void checkNClumpTypes() const {}; inline void readDEMtsfromDict(dictionary& propsDict) diff --git a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C index 9b8b937..8bc84fc 100644 --- a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C +++ b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayMPI/twoWayMPI.C @@ -273,25 +273,119 @@ bool Foam::twoWayMPI::couple() const // start liggghts if (liggghts == 1) { - /*// hardcoded run commands - char lammpsRunCommand[80]; - if (couplingStep()==1) sprintf(lammpsRunCommand,"run %d",int(couplingInterval_)); - else sprintf(lammpsRunCommand,"run %d pre no",int(couplingInterval_)); - Info << "old script would Executing command: '"<input->one(lammpsRunCommand);*/ - // run commands from liggghtsCommands dict Info<<"Starting up LIGGGHTS" << endl; particleCloud_.clockM().start(3,"LIGGGHTS"); + + // check if liggghtsCommandModels with exaxt timing are being run + bool exactTiming(false); + int runComNr = -10; + DynamicList interruptTimes(0); + DynamicList DEMstepsToInterrupt(0); + DynamicList lcModel(0); + scalar interruptTime = -1; + forAll(particleCloud_.liggghtsCommandModelList(),i) { - if(particleCloud_.liggghtsCommand()[i]().runCommand(couplingStep())) + // Check if exact timing is needed + // get time for execution + // store time for execution in list + if(particleCloud_.liggghtsCommand()[i]().exactTiming()) { - const char* command = particleCloud_.liggghtsCommand()[i]().command(); + exactTiming = true; + DynamicList h = particleCloud_.liggghtsCommand()[i]().executionsWithinPeriod(TSstart(),TSend()); + + forAll(h,j) + { + // save interrupt times (is this necessary) + interruptTimes.append(h[j]); + + // calc stepsToInterrupt + DEMstepsToInterrupt.append(DEMstepsTillT(h[j])); + + // remember which liggghtsCommandModel to run + lcModel.append(i); + } + + // make cumulative + label len = DEMstepsToInterrupt.size(); + label ind(0); + forAll(DEMstepsToInterrupt,i) + { + ind = len-i-1; + if(ind>0) + DEMstepsToInterrupt[ind] -= DEMstepsToInterrupt[ind-1]; + } + + Info << "Foam::twoWayMPI::couple(): interruptTimes=" << interruptTimes << endl; + Info << "Foam::twoWayMPI::couple(): DEMstepsToInterrupt=" << DEMstepsToInterrupt << endl; + Info << "Foam::twoWayMPI::couple(): lcModel=" << lcModel << endl; + } + + if(particleCloud_.liggghtsCommand()[i]().type()=="runLiggghts") + runComNr=i; + } + + // models with exact timing exists + if(exactTiming) + { + // extension for more liggghtsCommands active the same time: + // sort interrupt list within this run period + // keep track of corresponding liggghtsCommand + int DEMstepsRun(0); + forAll(interruptTimes,j) + { + // set run command till interrupt + DEMstepsRun += DEMstepsToInterrupt[j]; + particleCloud_.liggghtsCommand()[runComNr]().set(DEMstepsToInterrupt[j]); + const char* command = particleCloud_.liggghtsCommand()[runComNr]().command(); + Info << "Executing run command: '"<< command <<"'"<< endl; + lmp->input->one(command); + + // run liggghts command with exact timing + command = particleCloud_.liggghtsCommand()[lcModel[j]]().command(); Info << "Executing command: '"<< command <<"'"<< endl; lmp->input->one(command); } + + // do the run + if(particleCloud_.liggghtsCommand()[runComNr]().runCommand(couplingStep())) + { + particleCloud_.liggghtsCommand()[runComNr]().set(couplingInterval() - DEMstepsRun); + const char* command = particleCloud_.liggghtsCommand()[runComNr]().command(); + Info << "Executing run command: '"<< command <<"'"<< endl; + lmp->input->one(command); + } + + // do the other non exact timing models + forAll(particleCloud_.liggghtsCommandModelList(),i) + { + if + ( + ! particleCloud_.liggghtsCommand()[i]().exactTiming() && + particleCloud_.liggghtsCommand()[i]().runCommand(couplingStep()) + ) + { + const char* command = particleCloud_.liggghtsCommand()[i]().command(); + Info << "Executing command: '"<< command <<"'"<< endl; + lmp->input->one(command); + } + } } + // no model with exact timing exists + else + { + forAll(particleCloud_.liggghtsCommandModelList(),i) + { + if(particleCloud_.liggghtsCommand()[i]().runCommand(couplingStep())) + { + const char* command = particleCloud_.liggghtsCommand()[i]().command(); + Info << "Executing command: '"<< command <<"'"<< endl; + lmp->input->one(command); + } + } + } + particleCloud_.clockM().stop("LIGGGHTS"); Info<<"LIGGGHTS finished"<("environmentalProperties").lookup(gravityFieldName_)).value()) #endif { + + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "archimedesF.logDat"); + particleCloud_.probeM().vectorFields_.append("archimedesForce"); //first entry must the be the force + particleCloud_.probeM().scalarFields_.append("Vp"); + particleCloud_.probeM().writeHeader(); + + if (propsDict_.found("twoDimensional")) { twoDimensional_=true; @@ -104,6 +112,8 @@ void Archimedes::setForce() const { vector force(0,0,0); + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { //if(mask[index][0]) @@ -121,6 +131,15 @@ void Archimedes::setForce() const }else{ force = -g_.value()*rho_[cellI]*pow(dp,3)/6*M_PI; } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(force); //first entry must the be the force + sValues.append(pow(dp,3)/6*M_PI); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } if(!treatDEM_) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/ArchimedesIB/ArchimedesIB.C b/src/lagrangian/cfdemParticle/subModels/forceModel/ArchimedesIB/ArchimedesIB.C index 5b03824..d2ab3da 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/ArchimedesIB/ArchimedesIB.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/ArchimedesIB/ArchimedesIB.C @@ -74,6 +74,11 @@ ArchimedesIB::ArchimedesIB g_(dimensionedVector(sm.mesh().lookupObject("environmentalProperties").lookup(gravityFieldName_)).value()) #endif { + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "archimedesIBF.logDat"); + particleCloud_.probeM().vectorFields_.append("archimedesIBForce"); //first entry must the be the force + particleCloud_.probeM().writeHeader(); + if (propsDict_.found("twoDimensional")) { twoDimensional_=true; @@ -98,6 +103,9 @@ ArchimedesIB::~ArchimedesIB() void ArchimedesIB::setForce() const { vector force; + + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { //if(mask[index][0]) @@ -112,6 +120,15 @@ void ArchimedesIB::setForce() const force += -g_.value()*rho_[cellI]*rho_.mesh().V()[cellI]*(1-voidfractions_[cellI]);//mod by alice } } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(force); //first entry must the be the force + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } + // set force on particle if(twoDimensional_) Warning<<"ArchimedesIB model doesn't work for 2D right now!!\n"<< endl; if(!treatDEM_) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/DiFeliceDrag/DiFeliceDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/DiFeliceDrag/DiFeliceDrag.C index 447727c..0ac76c3 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/DiFeliceDrag/DiFeliceDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/DiFeliceDrag/DiFeliceDrag.C @@ -73,6 +73,15 @@ DiFeliceDrag::DiFeliceDrag voidfraction_(sm.mesh().lookupObject (voidfractionFieldName_)), interpolation_(false) { + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "diFeliceDrag.logDat"); + particleCloud_.probeM().vectorFields_.append("dragForce"); //first entry must the be the force + particleCloud_.probeM().vectorFields_.append("Urel"); //other are debug + particleCloud_.probeM().scalarFields_.append("Rep"); //other are debug + particleCloud_.probeM().scalarFields_.append("Cd"); //other are debug + particleCloud_.probeM().scalarFields_.append("voidfraction"); //other are debug + particleCloud_.probeM().writeHeader(); + if (propsDict_.found("verbose")) verbose_=true; if (propsDict_.found("treatExplicit")) treatExplicit_=true; if (propsDict_.found("interpolation")) @@ -119,6 +128,8 @@ void DiFeliceDrag::setForce() const interpolationCellPoint voidfractionInterpolator_(voidfraction_); interpolationCellPoint UInterpolator_(U_); + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) @@ -136,7 +147,7 @@ void DiFeliceDrag::setForce() const Ufluid = UInterpolator_.interpolate(position,cellI); }else { - voidfraction = particleCloud_.voidfraction(index); + voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } @@ -169,16 +180,28 @@ void DiFeliceDrag::setForce() const if(verbose_ && index >100 && index <102) { - Info << "index = " << index << endl; - Info << "Us = " << Us << endl; - Info << "Ur = " << Ur << endl; - Info << "ds = " << ds << endl; - Info << "rho = " << rho << endl; - Info << "nuf = " << nuf << endl; - Info << "voidfraction = " << voidfraction << endl; - Info << "Rep = " << Rep << endl; - Info << "Cd = " << Cd << endl; - Info << "drag = " << drag << endl; + Pout << "index = " << index << endl; + Pout << "Us = " << Us << endl; + Pout << "Ur = " << Ur << endl; + Pout << "ds = " << ds << endl; + Pout << "rho = " << rho << endl; + Pout << "nuf = " << nuf << endl; + Pout << "voidfraction = " << voidfraction << endl; + Pout << "Rep = " << Rep << endl; + Pout << "Cd = " << Cd << endl; + Pout << "drag = " << drag << endl; + } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(drag); //first entry must the be the force + vValues.append(Ur); + sValues.append(Rep); + sValues.append(Cd); + sValues.append(voidfraction); + particleCloud_.probeM().writeProbe(index, sValues, vValues); } } // set force on particle diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.C index 95a8d00..f6c91a9 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.C @@ -67,8 +67,17 @@ GidaspowDrag::GidaspowDrag velFieldName_(propsDict_.lookup("velFieldName")), U_(sm.mesh().lookupObject (velFieldName_)), densityFieldName_(propsDict_.lookup("densityFieldName")), - rho_(sm.mesh().lookupObject (densityFieldName_)) + rho_(sm.mesh().lookupObject (densityFieldName_)), + phi_(readScalar(propsDict_.lookup("phi"))) { + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "gidaspowDrag.logDat"); + particleCloud_.probeM().vectorFields_.append("dragForce"); //first entry must the be the force + particleCloud_.probeM().vectorFields_.append("Urel"); //other are debug + particleCloud_.probeM().scalarFields_.append("KslLag"); //other are debug + particleCloud_.probeM().scalarFields_.append("voidfraction"); //other are debug + particleCloud_.probeM().writeHeader(); + if (propsDict_.found("verbose")) verbose_=true; if (propsDict_.found("treatExplicit")) treatExplicit_=true; particleCloud_.checkCG(false); @@ -92,6 +101,8 @@ void GidaspowDrag::setForce() const const volScalarField& nufField = particleCloud_.turbulence().nu(); #endif + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { //if(mask[index][0]) @@ -130,10 +141,22 @@ void GidaspowDrag::setForce() const //divide by number of particles per unit volume - Enwald (Int J Multiphase Flow, 22, 21-61, pp39 KslLag /= (particleCloud_.averagingM().UsWeightField()[cellI]/particleCloud_.mesh().V()[cellI]); - drag = KslLag*Ur; + drag = KslLag*Ur*phi_; if (modelType_=="B") drag /= voidfraction; + + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(drag); //first entry must the be the force + vValues.append(Ur); + sValues.append(KslLag); + sValues.append(voidfraction); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } // set force on particle diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.H b/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.H index 44319b4..c8c0ef1 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/GidaspowDrag/GidaspowDrag.H @@ -69,6 +69,8 @@ private: const volScalarField& rho_; + const scalar phi_; + public: //- Runtime type information diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C index 869731b..56652ce 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C @@ -74,6 +74,15 @@ KochHillDrag::KochHillDrag interpolation_(false), scale_(1.) { + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "kochHillDrag.logDat"); + particleCloud_.probeM().vectorFields_.append("dragForce"); //first entry must the be the force + particleCloud_.probeM().vectorFields_.append("Urel"); //other are debug + particleCloud_.probeM().scalarFields_.append("Rep"); //other are debug + particleCloud_.probeM().scalarFields_.append("beta"); //other are debug + particleCloud_.probeM().scalarFields_.append("voidfraction"); //other are debug + particleCloud_.probeM().writeHeader(); + if (propsDict_.found("verbose")) verbose_=true; if (propsDict_.found("treatExplicit")) treatExplicit_=true; if (propsDict_.found("interpolation")) interpolation_=true; @@ -135,6 +144,8 @@ void KochHillDrag::setForce() const interpolationCellPoint voidfractionInterpolator_(voidfraction_); interpolationCellPoint UInterpolator_(U_); + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) @@ -158,7 +169,7 @@ void KochHillDrag::setForce() const if(voidfraction<0.40) voidfraction = 0.40; }else { - voidfraction = particleCloud_.voidfraction(index); + voidfraction = voidfraction_[cellI]; Ufluid = U_[cellI]; } @@ -209,6 +220,7 @@ void KochHillDrag::setForce() const if(verbose_ && index >=0 && index <2) { + Pout << "cellI = " << cellI << endl; Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; @@ -220,6 +232,18 @@ void KochHillDrag::setForce() const Pout << "Rep = " << Rep << endl; Pout << "drag = " << drag << endl; } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(drag); //first entry must the be the force + vValues.append(Ur); + sValues.append(Rep); + sValues.append(betaP); + sValues.append(voidfraction); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } // set force on particle if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j]; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C index cd95965..38d5527 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C @@ -64,24 +64,42 @@ MeiLift::MeiLift : forceModel(dict,sm), propsDict_(dict.subDict(typeName + "Props")), - verbose_(false), velFieldName_(propsDict_.lookup("velFieldName")), U_(sm.mesh().lookupObject (velFieldName_)), densityFieldName_(propsDict_.lookup("densityFieldName")), - rho_(sm.mesh().lookupObject (densityFieldName_))/*, + rho_(sm.mesh().lookupObject (densityFieldName_)), + useSecondOrderTerms_(false), + interpolation_(false), + verbose_(false) +/*, vorticityFieldName_(propsDict_.lookup("vorticityFieldName")), vorticity_(sm.mesh().lookupObject (vorticityFieldName_))*/ { - if (propsDict_.found("verbose")) verbose_=true; + if (propsDict_.found("useSecondOrderTerms")) useSecondOrderTerms_=true; if (propsDict_.found("treatExplicit")) treatExplicit_=true; - particleCloud_.checkCG(false); + + if (propsDict_.found("interpolation")) interpolation_=true; + if (propsDict_.found("verbose")) verbose_=true; + + particleCloud_.checkCG(false); + + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "meiLift.logDat"); + particleCloud_.probeM().vectorFields_.append("liftForce"); //first entry must the be the force + particleCloud_.probeM().vectorFields_.append("Urel"); //other are debug + particleCloud_.probeM().vectorFields_.append("vorticity"); //other are debug + particleCloud_.probeM().scalarFields_.append("Rep"); //other are debug + particleCloud_.probeM().scalarFields_.append("Rew"); //other are debug + particleCloud_.probeM().scalarFields_.append("J_star"); //other are debug + particleCloud_.probeM().writeHeader(); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // MeiLift::~MeiLift() -{} +{ +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -95,10 +113,12 @@ void MeiLift::setForce() const const volScalarField& nufField = particleCloud_.turbulence().nu(); #endif + vector position(0,0,0); vector lift(0,0,0); vector Us(0,0,0); vector Ur(0,0,0); scalar magUr(0); + scalar magVorticity(0); scalar ds(0); scalar nuf(0); scalar rho(0); @@ -109,63 +129,141 @@ void MeiLift::setForce() const scalar Cl_star(0); scalar J_star(0); scalar Omega_eq(0); + scalar alphaStar(0); + scalar epsilon(0); scalar omega_star(0); vector vorticity(0,0,0); volVectorField vorticityField = fvc::curl(U_); + interpolationCellPoint UInterpolator_(U_); + interpolationCellPoint VorticityInterpolator_(vorticityField); + + #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) //{ - lift=vector::zero; + lift = vector::zero; label cellI = particleCloud_.cellIDs()[index][0]; if (cellI > -1) // particle Found { - //NP note: one could add pointInterpolated values instead of cell centered Us = particleCloud_.velocity(index); - Ur = U_[cellI]-Us; - magUr = mag(Ur); - vorticity=vorticityField[cellI]; - if (magUr > 0 && mag(vorticity) > 0) + if(interpolation_) { - ds = 2*particleCloud_.radius(index); - nuf = nufField[cellI]; - rho = rho_[cellI]; - voidfraction = particleCloud_.voidfraction(index); - omega_star=mag(vorticity)*ds/magUr; - - // calc particle Re Nr - Rep = ds*magUr/nuf; - Rew = mag(vorticity)*ds*ds/nuf; - - Omega_eq = omega_star/2.0*(1.0-0.0075*Rew)*(1.0-0.062*sqrt(Rep)-0.001*Rep); - J_star = 0.3*(1.0+tanh(2.5*(log10(sqrt(omega_star/Rep))+0.191))) - *(2.0/3.0+tanh(6.0*sqrt(omega_star/Rep)-1.92)); - Cl_star=1.0-(0.675+0.15*(1.0+tanh(0.28*(omega_star/2.0-2.0))))*tanh(0.18*sqrt(Rep)); - Cl=J_star*12.92/M_PI*sqrt(omega_star/Rep)+Omega_eq*Cl_star; - lift = 0.125*rho*M_PI*Cl*magUr*Ur^vorticity/mag(vorticity)*ds*ds; - - if (modelType_=="B") - lift /= voidfraction; + position = particleCloud_.position(index); + Ur = UInterpolator_.interpolate(position,cellI) + - Us; + vorticity = VorticityInterpolator_.interpolate(position,cellI); + } + else + { + Ur = U_[cellI] + - Us; + vorticity=vorticityField[cellI]; } - if(verbose_ && index >100 && index <102) + magUr = mag(Ur); + magVorticity = mag(vorticity); + + if (magUr > 0 && magVorticity > 0) { + ds = 2*particleCloud_.radius(index); + nuf = nufField[cellI]; + rho = rho_[cellI]; + + // calc dimensionless properties + Rep = ds*magUr/nuf; + Rew = magVorticity*ds*ds/nuf; + + alphaStar = magVorticity*ds/magUr/2.0; + epsilon = sqrt(2.0*alphaStar /Rep ); + omega_star=2.0*alphaStar; + + //Basic model for the correction to the Saffman lift + //Based on McLaughlin (1991) + if(epsilon < 0.1) + { + J_star = -140 *epsilon*epsilon*epsilon*epsilon*epsilon + *log( 1./(epsilon*epsilon+SMALL) ); + } + else if(epsilon > 20) + { + J_star = 1.0-0.287/(epsilon*epsilon+SMALL); + } + else + { + J_star = 0.3 + *( 1.0 + +tanh( 2.5 * log10(epsilon+0.191) ) + ) + *( 0.667 + +tanh( 6.0 * (epsilon-0.32) ) + ); + } + Cl=J_star*4.11*epsilon; //multiply McLaughlin's correction to the basic Saffman model + + //Second order terms given by Loth and Dorgan 2009 + if(useSecondOrderTerms_) + { + Omega_eq = omega_star/2.0*(1.0-0.0075*Rew)*(1.0-0.062*sqrt(Rep)-0.001*Rep); + Cl_star=1.0-(0.675+0.15*(1.0+tanh(0.28*(omega_star/2.0-2.0))))*tanh(0.18*sqrt(Rep)); + Cl += Omega_eq*Cl_star; + } + + lift = 0.125*M_PI + *rho + *Cl + *magUr*Ur^vorticity/magVorticity + *ds*ds; + + if (modelType_=="B") + { + voidfraction = particleCloud_.voidfraction(index); + lift /= voidfraction; + } + } + + //********************************** + //SAMPLING AND VERBOSE OUTOUT + if(verbose_ ) + { Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; Pout << "Ur = " << Ur << endl; + Pout << "vorticity = " << vorticity << endl; Pout << "ds = " << ds << endl; Pout << "rho = " << rho << endl; Pout << "nuf = " << nuf << endl; Pout << "Rep = " << Rep << endl; + Pout << "Rew = " << Rew << endl; + Pout << "alphaStar = " << alphaStar << endl; + Pout << "epsilon = " << epsilon << endl; + Pout << "J_star = " << J_star << endl; Pout << "lift = " << lift << endl; } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(lift); //first entry must the be the force + vValues.append(Ur); + vValues.append(vorticity); + sValues.append(Rep); + sValues.append(Rew); + sValues.append(J_star); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } + // END OF SAMPLING AND VERBOSE OUTOUT + //********************************** + } // set force on particle - if(!treatDEM_){ + if(!treatDEM_) + { if(!treatExplicit_) for(int j=0;j<3;j++) impForces()[index][j] += lift[j]; else for(int j=0;j<3;j++) expForces()[index][j] += lift[j]; } @@ -175,7 +273,6 @@ void MeiLift::setForce() const } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H index 6d58f00..86eb066 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H @@ -28,8 +28,22 @@ Description This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). - Mei Lift force following Loth and Dorgan 2009 - contribution from RQ + This function is based on the derivation in R. Kurose, S. Komori, + Drag and lift forces on a rotating sphere in a linear shear flow, + Journal of Fluid Mechanics. 384 (1999) 183-206. + + The data for this functions is based on J.B. Mclaughlin, + Inertial migration of a small sphere in linear shear flows, + Journal of Fluid Mechanics. 224 (1991) 261-274. + + The second order terms are based on: + Mei Lift force following Loth and Dorgan 2009, + and can be added to the lift coefficient if desired + (contribution from RQ) + + - including interpolation of the velocity to the particle position (optional) + - including output to file for testing/data analysis (optional) + Class MeiLift @@ -43,6 +57,8 @@ SourceFiles #define MeiLift_H #include "forceModel.H" +#include "IOList.H" +#include "interpolationCellPoint.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,8 +76,6 @@ class MeiLift private: dictionary propsDict_; - bool verbose_; - word velFieldName_; const volVectorField& U_; @@ -70,11 +84,16 @@ private: const volScalarField& rho_; + bool useSecondOrderTerms_; + + bool interpolation_; + + bool verbose_; + /*word vorticityFieldName_; volVectorField& vorticity_;*/ - public: //- Runtime type information @@ -97,6 +116,7 @@ public: // Member Functions void setForce() const; + }; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/SchillerNaumannDrag/SchillerNaumannDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/SchillerNaumannDrag/SchillerNaumannDrag.C index c926270..0630b0f 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/SchillerNaumannDrag/SchillerNaumannDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/SchillerNaumannDrag/SchillerNaumannDrag.C @@ -70,6 +70,14 @@ SchillerNaumannDrag::SchillerNaumannDrag densityFieldName_(propsDict_.lookup("densityFieldName")), rho_(sm.mesh().lookupObject (densityFieldName_)) { + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "schillerNaumannDrag.logDat"); + particleCloud_.probeM().vectorFields_.append("dragForce"); //first entry must the be the force + particleCloud_.probeM().vectorFields_.append("Urel"); //other are debug + particleCloud_.probeM().scalarFields_.append("Rep"); //other are debug + particleCloud_.probeM().scalarFields_.append("Cd"); //other are debug + particleCloud_.probeM().writeHeader(); + if (propsDict_.found("verbose")) verbose_=true; if (propsDict_.found("treatExplicit")) treatExplicit_=true; particleCloud_.checkCG(false); @@ -93,6 +101,8 @@ void SchillerNaumannDrag::setForce() const const volScalarField& nufField = particleCloud_.turbulence().nu(); #endif + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) @@ -141,6 +151,17 @@ void SchillerNaumannDrag::setForce() const Info << "Cd = " << Cd << endl; Info << "drag = " << drag << endl; } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(drag); //first entry must the be the force + vValues.append(Ur); + sValues.append(Rep); + sValues.append(Cd); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } // set force on particle if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j]; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C index cd7fd5d..4396869 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C @@ -73,6 +73,11 @@ ShirgaonkarIB::ShirgaonkarIB pressureFieldName_(propsDict_.lookup("pressureFieldName")), p_(sm.mesh().lookupObject (pressureFieldName_)) { + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "shirgaonkarIB.logDat"); + particleCloud_.probeM().vectorFields_.append("dragForce"); //first entry must the be the force + particleCloud_.probeM().writeHeader(); + if (propsDict_.found("verbose")) verbose_=true; if (propsDict_.found("twoDimensional")) { @@ -110,6 +115,8 @@ void ShirgaonkarIB::setForce() const volVectorField h = rho_*(nufField*fvc::laplacian(U_)-fvc::grad(p_)); #endif + #include "setupProbeModel.H" + for(int index=0; index< particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) @@ -130,6 +137,15 @@ void ShirgaonkarIB::setForce() const // set force on particle if(twoDimensional_) drag /= depth_; + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(drag); //first entry must the be the force + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } + if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += drag[j]; else for(int j=0;j<3;j++) impForces()[index][j] += drag[j]; for(int j=0;j<3;j++) DEMForces()[index][j] += drag[j]; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.C b/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.C index ab00f0a..d4b94e3 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.C @@ -85,7 +85,8 @@ forceModel::forceModel ), coupleForce_(true), modelType_(sm.modelType()), - cg_(1.) + cg_(1.), + probeIt_(sm.probeM().active()) {} diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.H b/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.H index 172d6a2..82ebb0a 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/forceModel/forceModel.H @@ -41,6 +41,7 @@ SourceFiles #include "fvCFD.H" #include "cfdemCloud.H" +#include "probeModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -75,6 +76,9 @@ protected: const word modelType_; mutable scalar cg_; + + bool probeIt_; + public: //- Runtime type information diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/gradPForce/gradPForce.C b/src/lagrangian/cfdemParticle/subModels/forceModel/gradPForce/gradPForce.C index f70e5ae..4bddbff 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/gradPForce/gradPForce.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/gradPForce/gradPForce.C @@ -94,6 +94,12 @@ gradPForce::gradPForce useRho_ = true; particleCloud_.checkCG(true); + + particleCloud_.probeM().initialize(typeName, "gradP.logDat"); + particleCloud_.probeM().vectorFields_.append("gradPForce"); //first entry must the be the force + particleCloud_.probeM().scalarFields_.append("Vs"); + particleCloud_.probeM().scalarFields_.append("rho"); + particleCloud_.probeM().writeHeader(); } @@ -127,6 +133,7 @@ void gradPForce::setForce() const interpolationCellPoint gradPInterpolator_(gradPField); + #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { @@ -163,6 +170,16 @@ void gradPForce::setForce() const Info << "gradP = " << gradP << endl; Info << "force = " << force << endl; } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(force); //first entry must the be the force + sValues.append(Vs); + sValues.append(rho); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } // set force on particle diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.C index a4cf37f..29b0490 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.C @@ -60,8 +60,16 @@ noDrag::noDrag cfdemCloud& sm ) : - forceModel(dict,sm) + forceModel(dict,sm), + propsDict_(dict), + verbose_(false), + noDEMForce_(false) { + if(dict.found(word(typeName + "Props"))) + propsDict_=dictionary(dict.subDict(typeName + "Props")); + + if (propsDict_.found("noDEMForce")) noDEMForce_=true; + coupleForce_=false; } @@ -85,6 +93,7 @@ void noDrag::setForce() const // set force on particle if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] = 0.; else for(int j=0;j<3;j++) impForces()[index][j] = 0.; + if(noDEMForce_)for(int j=0;j<3;j++) DEMForces()[index][j] = 0.; //} } } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.H b/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.H index e07fc37..7b00511 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/noDrag/noDrag.H @@ -54,11 +54,17 @@ class noDrag : public forceModel { +private: + dictionary propsDict_; + + bool verbose_; + + bool noDEMForce_; public: //- Runtime type information - TypeName("off"); + TypeName("noDrag"); // Constructors diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C index 21ae1c0..5ea9811 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.C @@ -79,6 +79,19 @@ particleCellVolume::particleCellVolume mesh_, dimensionedScalar("zero", dimensionSet(0,0,0,0,0), 0) ), + scalarField2_ + ( + IOobject + ( + "cellVolume", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh_, + dimensionedScalar("zero", dimensionSet(0,0,0,0,0), 0) + ), upperThreshold_(readScalar(propsDict_.lookup("upperThreshold"))), lowerThreshold_(readScalar(propsDict_.lookup("lowerThreshold"))), verbose_(false) @@ -122,20 +135,26 @@ void particleCellVolume::setForce() const { cellVol = mesh_.V()[cellI]; scalarField_[cellI] = (1-fieldValue) * cellVol; + scalarField2_[cellI] = cellVol; } else { scalarField_[cellI] = 0.; + scalarField2_[cellI] = 0.; } } scalarField_.internalField() = gSum(scalarField_); + scalarField2_.internalField() = gSum(scalarField2_); if(verbose_) { - Info << "calculated integral of field: " << scalarFieldName_ + Info << "calculated integral particle volume " << " = " << scalarField_[0] << ",\n considering cells where the field < " << upperThreshold_ - << ", and > " << lowerThreshold_ << endl; + << ", and > " << lowerThreshold_ + << ",\n the total volume of cells holding particles = " << scalarField2_[0] + << ",\n this results in an average volume fraction of:" << scalarField_[0]/(scalarField2_[0]+SMALL) + << endl; } }// end if time >= startTime_ } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H index 1b0e317..4beb226 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/particleCellVolume/particleCellVolume.H @@ -66,6 +66,8 @@ private: mutable volScalarField scalarField_; + mutable volScalarField scalarField2_; + mutable scalar upperThreshold_; mutable scalar lowerThreshold_; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C b/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C index 6457d5e..89ab4a7 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/virtualMassForce/virtualMassForce.C @@ -79,6 +79,15 @@ virtualMassForce::virtualMassForce } if (propsDict_.found("treatExplicit")) treatExplicit_=true; particleCloud_.checkCG(true); + + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "virtualMass.logDat"); + particleCloud_.probeM().vectorFields_.append("virtualMassForce"); //first entry must the be the force + particleCloud_.probeM().vectorFields_.append("Urel"); + particleCloud_.probeM().vectorFields_.append("UrelOld"); + particleCloud_.probeM().scalarFields_.append("Vs"); + particleCloud_.probeM().scalarFields_.append("rho"); + particleCloud_.probeM().writeHeader(); } @@ -98,6 +107,8 @@ void virtualMassForce::setForce() const scalar dt = U_.mesh().time().deltaT().value(); + #include "setupProbeModel.H" + for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { //if(mask[index][0]) @@ -123,6 +134,17 @@ void virtualMassForce::setForce() const virtualMassForce = 0.5 * rho * Vs * ddtUrel; + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(virtualMassForce); //first entry must the be the force + vValues.append(Ur); + vValues.append(UrelOld); + sValues.append(Vs); + sValues.append(rho); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } // set force on particle if(treatExplicit_) for(int j=0;j<3;j++) expForces()[index][j] += virtualMassForce[j]; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C b/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C index cd14959..85a47d9 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C @@ -85,6 +85,12 @@ viscForce::viscForce interpolation_=true; } particleCloud_.checkCG(true); + + //Append the field names to be probed + particleCloud_.probeM().initialize(typeName, "visc.logDat"); + particleCloud_.probeM().vectorFields_.append("viscForce"); //first entry must the be the force + particleCloud_.probeM().scalarFields_.append("Vs"); + particleCloud_.probeM().writeHeader(); } @@ -125,6 +131,7 @@ void viscForce::setForce() const interpolationCellPoint divTauInterpolator_(divTauField); + #include "setupProbeModel.H" for(int index = 0;index < particleCloud_.numberOfParticles(); index++) { @@ -149,7 +156,8 @@ void viscForce::setForce() const ds = 2*particleCloud_.radius(index); Vs = ds*ds*ds*M_PI/6; - // calc particle's pressure gradient force + // calc the contribution of the deviatoric stress + // to the generalized buoyancy force force = -Vs*divTau; if(verbose_ && index >0 && index <2) @@ -158,6 +166,15 @@ void viscForce::setForce() const Info << "gradP = " << divTau << endl; Info << "force = " << force << endl; } + + //Set value fields and write the probe + if(probeIt_) + { + #include "setupProbeModelfields.H" + vValues.append(force); //first entry must the be the force + sValues.append(Vs); + particleCloud_.probeM().writeProbe(index, sValues, vValues); + } } // set force on particle @@ -171,7 +188,6 @@ void viscForce::setForce() const } } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C index 3d17aee..55d98a2 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C @@ -69,7 +69,8 @@ liggghtsCommandModel::liggghtsCommandModel timeInterval_(0.), firstCouplingStep_(-1), lastCouplingStep_(-1), - couplingStepInterval_(0) + couplingStepInterval_(0), + exactTiming_(false) {} @@ -182,6 +183,55 @@ string liggghtsCommandModel::addTimeStamp(word command) return string(command+add); } +DynamicList liggghtsCommandModel::executionsWithinPeriod(scalar TSstart,scalar TSend) +{ + Info << "liggghtsCommandModel::executionsWithinPeriod TSstart" << TSstart << endl; + Info << "liggghtsCommandModel::executionsWithinPeriod TSend" << TSend << endl; + Info << "startTime =" << startTime_ << endl; + Info << "endTime =" << endTime_ << endl; + + // init exec times array + DynamicList executions(0); + + // current TS within active period + if(startTime_=TSstart ) + { + Info << "working time within this TS" << endl; + + // find first execution within TS (better routine with modulo) + int startNr = 0; + scalar t = startTime_ + startNr * timeInterval_; + + if(timeInterval_ > SMALL) + { + while (TSend - t > SMALL) + { + t = startTime_ + startNr * timeInterval_; + startNr++; + } + t -= timeInterval_; + } + // check if first exec found within TS + if(TSstart <= t && t < TSend) + { + // check for more executions + while (t <= endTime_ && TSend - t > SMALL) + { + executions.append(t); + t += timeInterval_; + } + } + //else + // Info << "liggghtsCommandModel::executionsWithinPeriod error???" << endl; + + // debug + Info << "liggghtsCommandModel::executionsWithinPeriod executions=" << executions << endl; + } + + // return dummy + + return executions; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.H b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.H index 2b27a5c..394108a 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.H +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.H @@ -87,6 +87,8 @@ protected: int couplingStepInterval_; + bool exactTiming_; + public: //- Runtime type information @@ -150,6 +152,10 @@ public: string addTimeStamp(word); + virtual void set(int){}; + + DynamicList executionsWithinPeriod(scalar,scalar); + // Access int nextRun(){return nextRun_;}; @@ -158,6 +164,8 @@ public: virtual word name()=0; + bool exactTiming(){return exactTiming_;}; + }; diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C index fe4a562..2bf614e 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C @@ -75,6 +75,10 @@ readLiggghtsData::readLiggghtsData myName_=word(typeName + "Props" + h); propsDict_=dictionary(dict.subDict(myName_)); + if (propsDict_.found("exactTiming")) + exactTiming_=true; + Info << "exactTiming==" << exactTiming_ << endl; + // read first index of data file to be injected insertionNr_=readScalar(propsDict_.lookup("startIndex")); @@ -95,48 +99,7 @@ readLiggghtsData::readLiggghtsData command_ += add; } - // check if being run only at first coupling step - runFirst_=Switch(propsDict_.lookup("runFirst")); - - if(!runFirst_) - { - // check if being run every coupling step - runEveryCouplingStep_=Switch(propsDict_.lookup("runEveryCouplingStep")); - - scalar DEMts = particleCloud_.dataExchangeM().DEMts(); - scalar couplingInterval = particleCloud_.dataExchangeM().couplingInterval(); - - if (!runEveryCouplingStep_) - { - // read time options - startTime_ = readScalar(propsDict_.lookup("startTime")); - endTime_ = readScalar(propsDict_.lookup("endTime")); - timeInterval_ = readScalar(propsDict_.lookup("timeInterval")); - - // calculate coupling times - firstCouplingStep_ = floor(startTime_/DEMts/couplingInterval); - lastCouplingStep_ = floor(endTime_/DEMts/couplingInterval); - couplingStepInterval_ = floor(timeInterval_/DEMts/couplingInterval); - } - else - { - firstCouplingStep_ =1; - lastCouplingStep_ =1e9; - couplingStepInterval_ =1; - } - } - else - { - firstCouplingStep_ =1; - lastCouplingStep_ =1; - couplingStepInterval_ =1; - } - - nextRun_ = firstCouplingStep_; - - Info << "firstCouplingStep = " << firstCouplingStep_ << endl; - Info << "lastCouplingStep = " << lastCouplingStep_ << endl; - Info << "couplingStepInterval = " << couplingStepInterval_ << endl; + checkTimeSettings(propsDict_); } @@ -160,9 +123,7 @@ const char* readLiggghtsData::command() bool readLiggghtsData::runCommand(int couplingStep) { - checkTimeSettings(propsDict_); - - return runCommand(couplingStep); + return runThisCommand(couplingStep); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C index 6668e57..283aafc 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C @@ -64,7 +64,8 @@ runLiggghts::runLiggghts liggghtsCommandModel(dict,sm,i), propsDict_(dict), command_("run"), - preNo_(true) + preNo_(true), + stdInterval_(0) { word myName=word(typeName + "Props"); if (dict.found(myName)) @@ -94,11 +95,11 @@ const char* runLiggghts::command() return strCommand_.c_str(); } -string runLiggghts::createCommand(word command, word appendix, word appendix2, word appendix3, word appendix4) +string runLiggghts::createCommand( word command, int interval, word appendix, word appendix2, word appendix3, word appendix4) { fileName add; char h[50]; - sprintf(h,"%d",particleCloud_.dataExchangeM().couplingInterval()); + sprintf(h,"%d",interval); add = h; command += " " + add + " " + appendix + " " + appendix2 + " " + appendix3 + " " + appendix4; @@ -109,11 +110,21 @@ bool runLiggghts::runCommand(int couplingStep) { //change command to "run xxx pre no" if (preNo_ && (couplingStep > firstCouplingStep_)) - strCommand_=createCommand(command_,"pre","no","post","no"); + strCommand_=createCommand(command_, particleCloud_.dataExchangeM().couplingInterval(),"pre","no","post","no"); + else + strCommand_=createCommand(command_, particleCloud_.dataExchangeM().couplingInterval()); return runThisCommand(couplingStep); } +void runLiggghts::set(int interval) +{ + if (preNo_) + strCommand_ = createCommand(command_, interval,"pre","no","post","no"); + else + strCommand_ = createCommand(command_, interval); +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H index 81e2537..e226c84 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H @@ -63,6 +63,8 @@ private: bool preNo_; + int stdInterval_; + public: //- Runtime type information @@ -88,11 +90,13 @@ public: const char* command(); - string createCommand(word="",word="",word="",word="",word=""); + string createCommand(word="",int=0,word="",word="",word="",word=""); bool runCommand(int); word name(){return "runLiggghts";}; + + void set(int); }; diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearch/engineSearch.C b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearch/engineSearch.C index 762eefa..b3c38d4 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearch/engineSearch.C +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearch/engineSearch.C @@ -96,9 +96,9 @@ label engineSearch::findCell //if(mask[index][0] && particleCloud_.radius(index) > SMALL) if(particleCloud_.radius(index) > SMALL) { - // create pos vector for(int i=0;i<3;i++) position[i] = positions[index][i]; + // find cell cellIDs[index][0] =searchEngine_.findCell(position,cellIDs[index][0],treeSearch_); } diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C index 0b97a82..64dd4cc 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C @@ -36,6 +36,7 @@ Description #include "addToRunTimeSelectionTable.H" #include "mathematicalConstants.H" +#include "mpi.h" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,8 +67,13 @@ engineSearchIB::engineSearchIB engineSearch(dict.subDict(typeName + "Props"),sm), propsDict_(dict.subDict(typeName + "Props")), zSplit_(readLabel(propsDict_.lookup("zSplit"))), - xySplit_(readLabel(propsDict_.lookup("xySplit"))) -{} + xySplit_(readLabel(propsDict_.lookup("xySplit"))), + checkPeriodicCells_(false) +{ + + if(propsDict_.found("checkPeriodicCells")) checkPeriodicCells_=true; + +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -87,6 +93,13 @@ label engineSearchIB::findCell int size ) const { + + int numprocs, me; + MPI_Comm_size(MPI_COMM_WORLD, &numprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &me); + const boundBox& globalBb = particleCloud_.mesh().bounds(); + + vector position; for(int index = 0;index < size; ++index) { @@ -118,7 +131,8 @@ label engineSearchIB::findCell pos[2]+=radius; else if(countPoints==1) pos[2]-=radius; - else { + else + { thetaLevel=(countPoints-2)/xySplit_; theta=factor*thetaSize*thetaLevel; phi=factor*phiSize*(countPoints-2-thetaLevel*xySplit_); @@ -128,6 +142,23 @@ label engineSearchIB::findCell } altStartPos=findSingleCell(pos,oldID); //particleCloud_.mesh().findCell(pos);// + //check for periodic domains + if(checkPeriodicCells_) + { + for(int iDir=0;iDir<3;iDir++) + { + if( pos[iDir] > globalBb.max()[iDir] ) + { + pos[iDir]-=globalBb.max()[iDir]-globalBb.min()[iDir]; + } + else if( pos[iDir] < globalBb.min()[iDir] ) + { + pos[iDir]+=globalBb.max()[iDir]-globalBb.min()[iDir]; + } + } + altStartPos=findSingleCell(pos,oldID); //particleCloud_.mesh().findCell(pos);// + } + if(altStartPos>=0) foundPos=1; countPoints++; } diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H index 0ef6f11..ad65d01 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H @@ -62,6 +62,8 @@ private: const label zSplit_; const label xySplit_; + + bool checkPeriodicCells_; public: diff --git a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C index 4e446d3..88b9631 100644 --- a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C +++ b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/implicitCouple/implicitCouple.C @@ -104,6 +104,11 @@ implicitCouple::implicitCouple KslLimit_=readScalar(propsDict_.lookup ("KslLimit")); Info << "implicit momentum exchange field is limited to : " << KslLimit_ << endl; } + + if (propsDict_.found("minAlphaP")) + maxAlpha_ = 1-readScalar(propsDict_.lookup ("minAlphaP")); + + Info << "implicit momentum exchange field calculate if alphaP larger than : " << maxAlpha_ << endl; } @@ -150,7 +155,7 @@ tmp implicitCouple::impMomSource() const { Ur = mag(U_[cellI] - Us_[cellI]); - if(Ur > SMALL && (1.-alpha_[cellI]) > SMALL) //momentum exchange switched off if alphaMin=1 + if(Ur > SMALL && alpha_[cellI] < maxAlpha_) //momentum exchange switched off if alpha too big { KslNext_[cellI] = mag(particleCloud_.forceM(0).impParticleForces()[cellI]) / Ur diff --git a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.C b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.C index 737f161..9478883 100644 --- a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.C +++ b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.C @@ -79,7 +79,8 @@ momCoupleModel::momCoupleModel ) : dict_(dict), - particleCloud_(sm) + particleCloud_(sm), + maxAlpha_(1-SMALL) {} diff --git a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.H b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.H index 53aa3d7..7e66ec7 100644 --- a/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.H +++ b/src/lagrangian/cfdemParticle/subModels/momCoupleModel/momCoupleModel/momCoupleModel.H @@ -61,6 +61,8 @@ protected: cfdemCloud& particleCloud_; + scalar maxAlpha_; // max fluid volume fraction to calculate exchange field + public: //- Runtime type information diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/noProbe/noProbe.C b/src/lagrangian/cfdemParticle/subModels/probeModel/noProbe/noProbe.C new file mode 100644 index 0000000..b954207 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/noProbe/noProbe.C @@ -0,0 +1,83 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "noProbe.H" +#include "addToRunTimeSelectionTable.H" +#include "mpi.h" +#include "IOmanip.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(noProbe, 0); + +addToRunTimeSelectionTable +( + probeModel, + noProbe, + dictionary +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +noProbe::noProbe +( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName +) +: + probeModel(dict,sm,typeName,logFileName) +{} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +noProbe::~noProbe() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/noProbe/noProbe.H b/src/lagrangian/cfdemParticle/subModels/probeModel/noProbe/noProbe.H new file mode 100644 index 0000000..789b8ff --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/noProbe/noProbe.H @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). + +Class + noProbe + +SourceFiles + noProbe.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noProbe_H +#define noProbe_H + +#include "probeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class noDrag Declaration +\*---------------------------------------------------------------------------*/ + +class noProbe +: + public probeModel +{ + +private: + + +public: + + //- Runtime type information + TypeName("off"); + + + // Constructors + + //- Construct from components + noProbe + ( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName + ); + + // Destructor + + ~noProbe(); + + // Member Functions + bool active() const {return false;}; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C new file mode 100644 index 0000000..dc480bd --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C @@ -0,0 +1,302 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "particleProbe.H" +#include "addToRunTimeSelectionTable.H" +#include "mpi.h" +#include "IOmanip.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(particleProbe, 0); + +addToRunTimeSelectionTable +( + probeModel, + particleProbe, + dictionary +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +particleProbe::particleProbe +( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName +) +: + probeModel(dict,sm,typeName,logFileName), + propsDict_(dict.subDict(typeName + "Props")), + name_(typeName), + particleCloud_(sm), + verbose_(false), + verboseToFile_(false), + writePrecision_(3), + dirName_("particleProbes"), + rank_(-1), + sPtr(NULL), + printEvery_(1), + sampleAll_(false), + probeDebug_(false), + includePosition_(false), + particleIDsToSample_(propsDict_.lookup("particleIDsToSample")), + itemsToSample_(NULL), + sPtrList_(NULL), + itemCounter_(0), + currItemId_(0), + printCounter_(0), + printNow_(false) +{ + if (propsDict_.found("verbose")) verbose_=true; + if (propsDict_.found("verboseToFile")) verboseToFile_=true; + + if (propsDict_.found("printEvery")) printEvery_= readScalar(propsDict_.lookup("printEvery")); + if (propsDict_.found("sampleAll")) sampleAll_=true; + if (propsDict_.found("probeDebug")) probeDebug_=true; + if (propsDict_.found("includePosition")) includePosition_=true; + + if (propsDict_.found("writePrecision")) writePrecision_= readScalar(propsDict_.lookup("writePrecision")); + +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +particleProbe::~particleProbe() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void particleProbe::setOutputFile() const +{ + //set the current item ID + if(currItemId_== itemCounter_) + currItemId_=1; + else + currItemId_+=1; + sPtr = sPtrList_[currItemId_-1]; //set the pointer to the output file from list +} + + +void particleProbe::initialize(word typeName, word logFileName) const +{ + //update the list of items to be sampled + itemCounter_ += 1; + itemsToSample_.append(logFileName); + + // init environment + //propsDict_ = particleCloud_.couplingProperties().subDict(typeName + "Props"); + name_ = typeName; + const char* fileNameOut_ = wordToChar(logFileName); + + if(verboseToFile_) + { + + Info << "Will sample these particle IDs: " << particleIDsToSample_ << " every " << printEvery_ << endl; + + //initialize the output files + int myrank_(-1); + int numprocs_(-1); + MPI_Comm_rank(MPI_COMM_WORLD,&myrank_); + MPI_Comm_size(MPI_COMM_WORLD, &numprocs_); + rank_=myrank_; + + //open a separate file for each processor + char* filecurrent_; + filecurrent_= new char[strlen(fileNameOut_) + 4]; //reserve 4 chars for processor name + if (myrank_ < numprocs_) + sprintf(filecurrent_,"%s%s%d", fileNameOut_, ".", myrank_); + else //open one file for proc 0 + sprintf(filecurrent_,"%s", fileNameOut_); + word file_(filecurrent_); + Info << "particleProbe for model " << name_ << " will write to file " << file_ << endl; + + //generate the file streams + fileName probeSubDir = dirName_; + if (particleCloud_.mesh().name() != polyMesh::defaultRegion) + { + probeSubDir = probeSubDir/particleCloud_.mesh().name(); + } + probeSubDir = probeSubDir/particleCloud_.mesh().time().timeName(); + + fileName probeDir_; + if (Pstream::parRun()) + { + // Put in undecomposed case + // (Note: gives problems for distributed data running) + probeDir_ = particleCloud_.mesh().time().path()/".."/probeSubDir; + } + else + { + probeDir_ = particleCloud_.mesh().time().path()/probeSubDir; + } + + //manage files and OFstreams + mkDir(probeDir_); + sPtr = new OFstream(probeDir_/file_); + sPtrList_.append(sPtr); + + //Clear the containers for the fields to be probed + scalarFields_.clear(); + vectorFields_.clear(); + } + return; + +} +void particleProbe::writeHeader() const +{ + + if(verboseToFile_ ) + { + *sPtr<<"#processor: " << rank_ << endl; + *sPtr<<"#index time " << " "; + + + *sPtr<<"|| vectorData: " << " "; + + forAll(vectorFields_, iter) + { + if(!probeDebug_ && iter>0) break; + *sPtr << vectorFields_(iter) << " "; + } + + if(probeDebug_) + { + *sPtr<<"|| scalarData: " << " "; + forAll(scalarFields_, iter) + { + *sPtr << scalarFields_(iter) << " "; + } + } + + if(includePosition_) *sPtr<<" || position" << endl; + else *sPtr << endl; + } + +} + +void particleProbe::writeProbe(int index, Field sValues, Field vValues) const +{ + if(printNow_ && checkIDForPrint(index) && verboseToFile_) + { + + //index and time + *sPtr << setprecision(IOstream::defaultPrecision()+7) ; + *sPtr << index << tab + << particleCloud_.mesh().time().value() << " " ; + *sPtr << "|| "; + + //vectorFields + *sPtr << setprecision(writePrecision_) ; + forAll(vValues, iter) + { + if(!probeDebug_ && iter>0) break; + *sPtr << vValues[iter][0] << " "; + *sPtr << vValues[iter][1] << " "; + *sPtr << vValues[iter][2] << " "; + } + + //scalarFields + if(probeDebug_) + { + *sPtr << "|| "; + forAll(sValues, iter) + { + *sPtr << sValues[iter] << " "; + } + } + + if(includePosition_) + { + *sPtr << "|| "; + *sPtr << particleCloud_.position(index)[0] << " " + << particleCloud_.position(index)[1] << " " + << particleCloud_.position(index)[2] + << endl; + } + else *sPtr << endl; + + } + + return; +} + +bool particleProbe::checkIDForPrint(int index) const +{ + + bool sampleThisId_ = false; + if(sampleAll_) sampleThisId_ = true; + else + { + forAll(particleIDsToSample_, iSample) + { + if(index==particleIDsToSample_[iSample]) sampleThisId_ = true; + } + } + return sampleThisId_; +} + +void particleProbe::setCounter() const +{ + + //reset or increment counter for printing to file + //Do only if called by first item in the list of items! + if(currItemId_==1) + { + printCounter_++; + if( printCounter_ >= printEvery_ ) + { + printCounter_=0; + printNow_ = true; + } + else printNow_ = false; + + } + return; + +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H new file mode 100644 index 0000000..73f1d30 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H @@ -0,0 +1,143 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). + +Class + particleProbe + +SourceFiles + particleProbe.C + +\*---------------------------------------------------------------------------*/ + +#ifndef particleProbe_H +#define particleProbe_H + +#include "probeModel.H" +#include "fvCFD.H" +#include "polyMesh.H" +#include "cfdemCloud.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class noDrag Declaration +\*---------------------------------------------------------------------------*/ + +class particleProbe +: + public probeModel +{ + +private: + + dictionary propsDict_; + + mutable word name_; + + cfdemCloud& particleCloud_; + + bool verbose_; + + bool verboseToFile_; + + int writePrecision_; + + word dirName_; + + mutable int rank_; + + mutable OFstream* sPtr; + + int printEvery_; + + bool sampleAll_; + + bool probeDebug_; + + bool includePosition_; + + const labelList particleIDsToSample_; + + mutable wordList itemsToSample_; + + mutable List sPtrList_; + + mutable int itemCounter_; + + mutable int currItemId_; + + mutable int printCounter_; + + mutable bool printNow_; + +public: + + //- Runtime type information + TypeName("particleProbe"); + + + // Constructors + + //- Construct from components + particleProbe + ( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName + ); + + // Destructor + + ~particleProbe(); + + // Member Functions + void initialize(word typeName, word logFileName) const; + void setOutputFile() const; + void writeHeader() const; + void writeProbe(int index, Field sValues, Field vValues) const; + bool checkIDForPrint(int) const; + void setCounter() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/newProbeModel.C b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/newProbeModel.C new file mode 100644 index 0000000..304e836 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/newProbeModel.C @@ -0,0 +1,86 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "probeModel.H" +#include "particleProbe.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +autoPtr probeModel::New +( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName +) +{ + word probeModelType + ( + dict.lookup("probeModel") + ); + + Info<< "Selecting probeModel " + << probeModelType << endl; + + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(probeModelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "probeModel::New(const dictionary&, const spray&) : " + << endl + << " unknown probeModelType type " + << probeModelType + << ", constructor not in hash table" << endl << endl + << " Valid probeModel types are :" + << endl; + Info<< dictionaryConstructorTablePtr_->toc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict,sm,probeModelType,logFileName)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.C b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.C new file mode 100644 index 0000000..f0fafc7 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). +\*---------------------------------------------------------------------------*/ + +#include "error.H" +#include "probeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(probeModel, 0); + +defineRunTimeSelectionTable(probeModel, dictionary); + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const char* probeModel::wordToChar(word& inWord) const +{ + string HH = string(inWord); + return HH.c_str(); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +probeModel::probeModel +( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName +) +: + dict_(dict), + particleCloud_(sm) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +probeModel::~probeModel(){} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H new file mode 100644 index 0000000..0330dc1 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling 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. + + CFDEMcoupling 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 CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER). + +Class + probeModel + +SourceFiles + probeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef probeModel_H +#define probeModel_H + +#include "fvCFD.H" +#include "cfdemCloud.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class probeModel Declaration +\*---------------------------------------------------------------------------*/ + +class probeModel +{ + +protected: + + // Protected data + const dictionary& dict_; + + cfdemCloud& particleCloud_; + + //- Class used for grouping field types + template + class fieldGroup + : + public DynamicList + { + public: + //- Construct null + fieldGroup() + : + DynamicList(0) + {} + + }; + + +public: + + // Variables + //- Categorized scalar/vector/tensor vol fields + mutable fieldGroup scalarFields_; + mutable fieldGroup vectorFields_; + + //- Runtime type information + TypeName("probeModel"); + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + probeModel, + dictionary, + ( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName + ), + (dict,sm,typeName,logFileName) + ); + + + // Constructors + + //- Construct from components + probeModel + ( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName + ); + + + // Destructor + + virtual ~probeModel(); + + + // Selector + + static autoPtr New + ( + const dictionary& dict, + cfdemCloud& sm, + word typeName, + char* logFileName + ); + + // Member Functions + + virtual void initialize(word typeName, word logFileName) const {}; + virtual void setOutputFile() const {}; + virtual void writeHeader() const {}; + virtual void writeProbe(int index, Field sValues, Field vValues) const {}; + virtual bool checkIDForPrint(int) const {return false;}; + virtual void setCounter() const {}; + virtual bool active() const {return true;}; + const char* wordToChar(word&) const; + + // Access + +}; +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.C b/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.C index 81171d5..c1adbc0 100644 --- a/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.C +++ b/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.C @@ -66,9 +66,13 @@ constDiffSmoothing::constDiffSmoothing lowerLimit_(readScalar(propsDict_.lookup("lowerLimit"))), upperLimit_(readScalar(propsDict_.lookup("upperLimit"))), smoothingLength_(dimensionedScalar("smoothingLength",dimensionSet(0,1,0,0,0,0,0), readScalar(propsDict_.lookup("smoothingLength")))), + smoothingLengthReferenceField_(dimensionedScalar("smoothingLengthReferenceField",dimensionSet(0,1,0,0,0,0,0), readScalar(propsDict_.lookup("smoothingLength")))), DT_("DT", dimensionSet(0,2,-1,0,0), 0.) { + if(propsDict_.found("smoothingLengthReferenceField")) + smoothingLengthReferenceField_.value() = double(readScalar(propsDict_.lookup("smoothingLengthReferenceField"))); + } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -83,7 +87,7 @@ bool constDiffSmoothing::doSmoothing() const return true; } -void constDiffSmoothing::dSmoothing(volScalarField& dSmooth) const +/*void constDiffSmoothing::dSmoothing(volScalarField& dSmooth) const { tmp dSmooth0 @@ -104,10 +108,16 @@ void constDiffSmoothing::dSmoothing(volScalarField& dSmooth) const ); dSmooth.internalField() = dSmooth0; -} +}*/ -void Foam::constDiffSmoothing::smoothen(volScalarField& field) const +void Foam::constDiffSmoothing::smoothen(volScalarField& fieldSrc) const { + // transfer data to working field to not mess up ddt + volScalarField field=fieldSrc; + field.correctBoundaryConditions(); + field.oldTime()=fieldSrc; + field.oldTime().correctBoundaryConditions(); + double deltaT = field.mesh().time().deltaTValue(); DT_.value() = smoothingLength_.value() * smoothingLength_.value() / deltaT; @@ -123,6 +133,10 @@ void Foam::constDiffSmoothing::smoothen(volScalarField& field) const { field[cellI]=max(lowerLimit_,min(upperLimit_,field[cellI])); } + + // get data from working field + fieldSrc=field; + fieldSrc.correctBoundaryConditions(); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void Foam::constDiffSmoothing::smoothen(volVectorField& field) const @@ -141,8 +155,11 @@ void Foam::constDiffSmoothing::smoothen(volVectorField& field) const // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // void Foam::constDiffSmoothing::smoothenReferenceField(volVectorField& field) const { - dimensionedScalar deltaT = particleCloud_.mesh().time().deltaT(); - DT_.value() = smoothingLength_.value() * smoothingLength_.value() / deltaT.value(); + double sourceStrength = 1e5; //Should be a large numbe to keep reference values constant + + dimensionedScalar deltaT = field.mesh().time().deltaT(); + DT_.value() = smoothingLengthReferenceField_.value() + * smoothingLengthReferenceField_.value() / deltaT.value(); tmp NLarge ( @@ -165,21 +182,19 @@ void Foam::constDiffSmoothing::smoothenReferenceField(volVectorField& field) con //loop over particles and map max particle diameter to Euler Grid for(int cellI = 0; cellI < field.mesh().nCells(); cellI++) { - if ( mag(field.internalField()[cellI]) > 0) // have a vector in the field, so keep it! + if ( mag(field.oldTime().internalField()[cellI]) > 0) // have a vector in the OLD field, so keep it! { - NLarge()[cellI] = 1e5; //use large value here to keep cell values constant + NLarge()[cellI] = sourceStrength; } } - // do smoothing - fvVectorMatrix dSmoothEqn + // do the smoothing + solve ( fvm::ddt(field) == fvm::laplacian( DT_, field) + NLarge() / deltaT * field.oldTime() //add source to keep cell values constant - - fvm::Sp( NLarge() / deltaT, field) //add sink to keep cell values constant - ); - dSmoothEqn.solve(); - + - fvm::Sp( NLarge() / deltaT, field) //add sink to keep cell values constant + ); } diff --git a/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.H b/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.H index a33d751..b93bdbf 100644 --- a/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.H +++ b/src/lagrangian/cfdemParticle/subModels/smoothingModel/constDiffSmoothing/constDiffSmoothing.H @@ -63,6 +63,7 @@ private: scalar lowerLimit_; scalar upperLimit_; dimensionedScalar smoothingLength_; + dimensionedScalar smoothingLengthReferenceField_; mutable dimensionedScalar DT_; public: @@ -88,7 +89,7 @@ public: // Member Functions bool doSmoothing() const; - void dSmoothing(volScalarField&) const; + //void dSmoothing(volScalarField&) const; void smoothen(volScalarField&) const; diff --git a/src/lagrangian/cfdemParticle/subModels/smoothingModel/noSmoothing/noSmoothing.C b/src/lagrangian/cfdemParticle/subModels/smoothingModel/noSmoothing/noSmoothing.C index febfdf3..01a73ab 100644 --- a/src/lagrangian/cfdemParticle/subModels/smoothingModel/noSmoothing/noSmoothing.C +++ b/src/lagrangian/cfdemParticle/subModels/smoothingModel/noSmoothing/noSmoothing.C @@ -71,19 +71,13 @@ noSmoothing::~noSmoothing() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::noSmoothing::smoothen(volScalarField& field) const -{ - field=field.oldTime(); -} +{} void Foam::noSmoothing::smoothen(volVectorField& field) const -{ - field=field.oldTime(); -} +{} void Foam::noSmoothing::smoothenReferenceField(volVectorField& field) const -{ - field=field.oldTime(); -} +{} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.C b/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.C index 6f08fb6..6eb3407 100644 --- a/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.C +++ b/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.C @@ -75,9 +75,10 @@ bool smoothingModel::doSmoothing() const return false; } -void smoothingModel::dSmoothing(volScalarField& dSmooth) const +void smoothingModel::dSmoothing() const { - dSmooth *= 0.0; + // do nothing + //dSmooth *= 0.0; } } // End namespace Foam diff --git a/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.H b/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.H index 545cd3e..336bf75 100644 --- a/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.H +++ b/src/lagrangian/cfdemParticle/subModels/smoothingModel/smoothingModel/smoothingModel.H @@ -104,7 +104,7 @@ public: virtual bool doSmoothing() const; // the particle diameter for smoothing - virtual void dSmoothing(volScalarField&) const; + virtual void dSmoothing() const; virtual void smoothen(volScalarField&) const=0; diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C index f78fdb4..25888f0 100755 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C @@ -36,6 +36,7 @@ Description #include "locateModel.H" #include "dataExchangeModel.H" +#include "mpi.h" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,7 +68,8 @@ IBVoidFraction::IBVoidFraction propsDict_(dict.subDict(typeName + "Props")), alphaMin_(readScalar(propsDict_.lookup("alphaMin"))), alphaLimited_(0), - scaleUpVol_(readScalar(propsDict_.lookup("scaleUpVol"))) + scaleUpVol_(readScalar(propsDict_.lookup("scaleUpVol"))), + checkPeriodicCells_(false) { Info << "\n\n W A R N I N G - do not use in combination with differentialRegion model! \n\n" << endl; //Info << "\n\n W A R N I N G - this model does not yet work properly! \n\n" << endl; @@ -75,6 +77,8 @@ IBVoidFraction::IBVoidFraction if(scaleUpVol_ < 1){ FatalError<< "scaleUpVol shloud be > 1."<< abort(FatalError); } if(alphaMin_ > 1 || alphaMin_ < 0.01){ FatalError<< "alphaMin shloud be > 1 and < 0.01." << abort(FatalError); } + + if(propsDict_.found("checkPeriodicCells")) checkPeriodicCells_=true; } @@ -88,6 +92,12 @@ IBVoidFraction::~IBVoidFraction() void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes) const { + + int numprocs, me; + MPI_Comm_size(MPI_COMM_WORLD, &numprocs); + MPI_Comm_rank(MPI_COMM_WORLD, &me); + const boundBox& globalBb = particleCloud_.mesh().bounds(); + reAllocArrays(); voidfractionNext_.internalField()=1; @@ -117,55 +127,186 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction vector cellCentrePosition = particleCloud_.mesh().C()[particleCenterCellID]; scalar centreDist=mag(cellCentrePosition-positionCenter); - if(centreDist + 0.5*sqrt(3.0)*pow(particleCloud_.mesh().V()[particleCenterCellID],0.33333) < radius){ + vector minPeriodicParticlePos; + if(checkPeriodicCells_) //consider minimal distance to all periodic images of this particle + { + centreDist = minPeriodicDistance(cellCentrePosition, positionCenter, globalBb, + minPeriodicParticlePos); + } + + if(centreDist + 0.5*sqrt(3.0)*pow(particleCloud_.mesh().V()[particleCenterCellID],0.33333) < radius) + { voidfractionNext_[particleCenterCellID] = 0; } - else { + else + { const labelList& vertices = particleCloud_.mesh().cellPoints()[particleCenterCellID]; - forAll(vertices, i){ + forAll(vertices, i) + { vector vertexPosition = particleCloud_.mesh().points()[vertices[i]]; - if(centreDist < radius && mag(vertexPosition-positionCenter) < radius){ + scalar centreVertexDist = mag(vertexPosition-positionCenter); + if(checkPeriodicCells_) //consider minimal distance to all periodic images of this particle + { + centreVertexDist = minPeriodicDistance(vertexPosition, positionCenter, globalBb, + minPeriodicParticlePos); + } + + if(centreDist radius){ + else if(centreDistradius) + { //compute lambda - scalar a = (vertexPosition - cellCentrePosition)&(vertexPosition - cellCentrePosition); - scalar b = 2.* (vertexPosition - cellCentrePosition)&(cellCentrePosition-positionCenter); - scalar c = ((cellCentrePosition-positionCenter)&(cellCentrePosition-positionCenter))-radius*radius; + if(!checkPeriodicCells_) //set if no periodic check of cells + { + minPeriodicParticlePos = positionCenter; + } + + scalar a = (vertexPosition - cellCentrePosition) + & (vertexPosition - cellCentrePosition); + scalar b = 2. * (vertexPosition - cellCentrePosition) + & (cellCentrePosition-minPeriodicParticlePos); + scalar c = ((cellCentrePosition-minPeriodicParticlePos) + & (cellCentrePosition-minPeriodicParticlePos) + ) + - radius*radius; + scalar lambda = 0.; - if(b*b-4*a*c>=0) lambda = (-b+sqrt(b*b-4*a*c))/(2*a); - if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID] -=lambda*.125; - else { + if (b*b-4*a*c>=0) lambda = (-b+sqrt(b*b-4*a*c))/(2*a); + if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID]-=lambda*.125; + else + { lambda = (-b-sqrt(b*b-4*a*c))/(2*a); - if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID] -=lambda * 0.125; + if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID]-=lambda*.125; } } - else if(centreDist > radius && mag(vertexPosition-positionCenter) < radius){ + else if(centreDist>radius && centreVertexDist=0) lambda = (-b+sqrt(b*b-4*a*c))/(2*a); - if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID] -=(1-lambda) * 0.125; - else { + if(lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID]-=(1-lambda)*0.125; + else + { lambda = (-b-sqrt(b*b-4*a*c))/(2*a); - if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID] -=(1-lambda) * 0.125; + if (lambda > 0 && lambda <=1) voidfractionNext_[particleCenterCellID]-=(1-lambda)*0.125; } } } } - buildLabelHashSet(radius, positionCenter, particleCenterCellID, hashSett); - //generating list with cell and subcells + buildLabelHashSet(radius, minPeriodicParticlePos, particleCenterCellID, hashSett, true); + + //Add cells of periodic particle images on same processor + if(checkPeriodicCells_) + { + int doPeriodicImage[3]; + for(int iDir=0;iDir<3;iDir++) + { + doPeriodicImage[iDir]= 0; + if( (minPeriodicParticlePos[iDir]+radius)>globalBb.max()[iDir] ) + { + doPeriodicImage[iDir] =-1; + } + if( (minPeriodicParticlePos[iDir]-radius) particlePosList; //List of particle center position + List