diff --git a/README b/README index fd2ca756..2a7f869c 100755 --- a/README +++ b/README @@ -25,16 +25,17 @@ License 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). + This code provides models and solvers 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 +CFDEM(R) coupling provides an open source parallel coupled CFD-DEM framework +combining the strengths of LIGGGHTS(R) DEM code and the Open Source +CFD package OpenFOAM(R)(*). The CFDEM(R)coupling 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 +code LIGGGHTS(R). 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. @@ -54,7 +55,7 @@ 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 +- "doc" directory including the documentation of CFDEM(R)coupling - "tutorials" directory including basic tutorial cases showing the functionality @@ -64,18 +65,17 @@ 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) - +CFDEM(R)coupling stands for Computational Fluid Dynamics (CFD) - Discrete Element Method (DEM) coupling. -CFDEMcoupling is an open-source code, distributed freely under the terms of the +CFDEM(R)coupling is an open-source code, distributed freely under the terms of the GNU Public License (GPL). -Core development of CFDEMcoupling is done by +Core development of CFDEM(R)coupling 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. +(*) "OpenFOAM(R)"_of is a registered trade mark of OpenCFD Limited, a wholly owned subsidiary of the ESI Group. +This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks. \*---------------------------------------------------------------------------*/ diff --git a/applications/.gitignore b/applications/.gitignore new file mode 100644 index 00000000..44599544 --- /dev/null +++ b/applications/.gitignore @@ -0,0 +1,7 @@ +*.o +*.d +*.a +*.dep +log_* +log.* +*~ diff --git a/applications/solvers/cfdemSolverIB/cfdemSolverIB.C b/applications/solvers/cfdemSolverIB/cfdemSolverIB.C index 93f0d41d..9c930e63 100755 --- a/applications/solvers/cfdemSolverIB/cfdemSolverIB.C +++ b/applications/solvers/cfdemSolverIB/cfdemSolverIB.C @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) #include "initContinuityErrs.H" #if defined(version22) - #include "createFvOptions.H" + #include "createFvOptions.H" #endif // create cfdemCloud @@ -128,10 +128,12 @@ int main(int argc, char *argv[]) for (int corr=0; corrdivDevReff(U) - == - - fvm::Sp(Ksl/rho,U) - ); - - UEqn.relax(); - - if (momentumPredictor) + // Pressure-velocity PISO corrector { - //solve UEqn - if (modelType=="B" || modelType=="Bfull") + // Momentum predictor + fvVectorMatrix UEqn + ( + fvm::ddt(voidfraction,U) - fvm::Sp(fvc::ddt(voidfraction),U) + + fvm::div(phi,U) - fvm::Sp(fvc::div(phi),U) +// + turbulence->divDevReff(U) + + particleCloud.divVoidfractionTau(U, voidfraction) + == + - fvm::Sp(Ksl/rho,U) + ); + + UEqn.relax(); + if (momentumPredictor && (modelType=="B" || modelType=="Bfull")) solve(UEqn == - fvc::grad(p) + Ksl/rho*Us); - else + else if (momentumPredictor) solve(UEqn == - voidfraction*fvc::grad(p) + Ksl/rho*Us); + + // --- PISO loop + + //for (int corr=0; corrcorrect(); + }// end solveFlow + else + { + Info << "skipping flow solution." << endl; } - turbulence->correct(); - runTime.write(); Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 00000000..44599544 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1,7 @@ +*.o +*.d +*.a +*.dep +log_* +log.* +*~ diff --git a/doc/CFDEMcoupling_Manual.html b/doc/CFDEMcoupling_Manual.html index 5f120f05..30e06ab6 100644 --- a/doc/CFDEMcoupling_Manual.html +++ b/doc/CFDEMcoupling_Manual.html @@ -218,25 +218,25 @@ listing below of styles within certain commands. forceModel_GidaspowDragforceModel_KochHillDrag forceModel_LaEuScalarTempforceModel_MeiLift forceModel_SchillerNaumannDragforceModel_ShirgaonkarIB -forceModel_gradPForceforceModel_noDrag -forceModel_particleCellVolumeforceModel_virtualMassForce -forceModel_viscForceforceSubModel -forceSubModel_ImExforceSubModel_ImExCorr -liggghtsCommandModelliggghtsCommandModel_execute -liggghtsCommandModel_readLiggghtsDataliggghtsCommandModel_runLiggghts -liggghtsCommandModel_writeLiggghtslocateModel -locateModel_engineSearchlocateModel_engineSearchIB -locateModel_standardSearchlocateModel_turboEngineSearch -meshMotionModelmeshMotionModel_noMeshMotion -momCoupleModelmomCoupleModel_explicitCouple -momCoupleModel_implicitCouplemomCoupleModel_noCouple -probeModelprobeModel_noProbe -regionModelregionModel_allRegion -smoothingModelsmoothingModel_constDiffSmoothing -smoothingModel_noSmoothingvoidfractionModel -voidfractionModel_GaussVoidFractionvoidfractionModel_IBVoidFraction -voidfractionModel_bigParticleVoidFractionvoidfractionModel_centreVoidFraction -voidfractionModel_dividedVoidFraction +forceModel_fieldStoreforceModel_gradPForce +forceModel_noDragforceModel_particleCellVolume +forceModel_virtualMassForceforceModel_viscForce +forceSubModelforceSubModel_ImEx +forceSubModel_ImExCorrliggghtsCommandModel +liggghtsCommandModel_executeliggghtsCommandModel_readLiggghtsData +liggghtsCommandModel_runLiggghtsliggghtsCommandModel_writeLiggghts +locateModellocateModel_engineSearch +locateModel_engineSearchIBlocateModel_standardSearch +locateModel_turboEngineSearchmeshMotionModel +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 2f6afc0c..1ba7d809 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 6e0f2156..638b2f95 100644 --- a/doc/CFDEMcoupling_Manual.txt +++ b/doc/CFDEMcoupling_Manual.txt @@ -266,6 +266,7 @@ listing below of styles within certain commands. "forceModel_MeiLift"_forceModel_MeiLift.html, "forceModel_SchillerNaumannDrag"_forceModel_SchillerNaumannDrag.html, "forceModel_ShirgaonkarIB"_forceModel_ShirgaonkarIB.html, +"forceModel_fieldStore"_forceModel_fieldStore.html, "forceModel_gradPForce"_forceModel_gradPForce.html, "forceModel_noDrag"_forceModel_noDrag.html, "forceModel_particleCellVolume"_forceModel_particleCellVolume.html, diff --git a/doc/cfdemSolverPisoScalar.html b/doc/cfdemSolverPisoScalar.html index 599a2194..191cd84a 100644 --- a/doc/cfdemSolverPisoScalar.html +++ b/doc/cfdemSolverPisoScalar.html @@ -11,12 +11,14 @@

Description:

-

"cfdemSolverPisoScalar" is a coupled CFD-DEM solver using CFDEMcoupling, an open source parallel coupled CFD-DEM framework. Based on pisoFoam(R)(*), a finite volume based solver for turbulent Navier-Stokes equations applying PISO algorithm, "cfdemSolverPisoScalar" has additional functionality for a coupling to the DEM code "LIGGGHTS" as well as a scalar transport equation. The volume averaged Navier-Stokes Equations are solved accounting for momentum exchange and volume displacement of discrete particles whose trajectories are calculated in the DEM code LIGGGHTS. The scalar transport equation is coupled to scalar properties of the particle phase, thus convective heat transfer in a fluid granular system can be modeled with "cfdemSolverPisoScalar". +

"cfdemSolverPisoScalar" is a coupled CFD-DEM solver using CFDEMcoupling, an open source parallel coupled CFD-DEM framework. Based on pisoFoam(R)(*), a finite volume based solver for turbulent Navier-Stokes equations applying PISO algorithm, "cfdemSolverPisoScalar" has additional functionality for a coupling to the DEM code "LIGGGHTS" as well as a scalar transport equation. The volume averaged Navier-Stokes Equations are solved accounting for momentum exchange and volume displacement of discrete particles, whose trajectories are calculated in the DEM code LIGGGHTS. The scalar transport equation is coupled to scalar properties of the particle phase, thus convective heat transfer in a fluid granular system can be modeled with "cfdemSolverPisoScalar".

see:

GONIVA, C., KLOSS, C., HAGER,A. and PIRKER, S. (2010): "An Open Source CFD-DEM Perspective", Proc. of OpenFOAM Workshop, Göteborg, June 22.-24.

+

The heat transfer equation is implemented according to Nield & Bejan (2013), Convection in Porous Media, DOI 10.1007/978-1-4614-5541-7_2, Springer +


(*) This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks. OPENFOAM® is a registered trade mark of OpenCFD Limited, a wholly owned subsidiary of the ESI Group. diff --git a/doc/cfdemSolverPisoScalar.txt b/doc/cfdemSolverPisoScalar.txt index 41126c41..f05ca932 100644 --- a/doc/cfdemSolverPisoScalar.txt +++ b/doc/cfdemSolverPisoScalar.txt @@ -9,12 +9,15 @@ cfdemSolverPisoScalar command :h3 [Description:] -"cfdemSolverPisoScalar" is a coupled CFD-DEM solver using CFDEMcoupling, an open source parallel coupled CFD-DEM framework. Based on pisoFoam(R)(*), a finite volume based solver for turbulent Navier-Stokes equations applying PISO algorithm, "cfdemSolverPisoScalar" has additional functionality for a coupling to the DEM code "LIGGGHTS" as well as a scalar transport equation. The volume averaged Navier-Stokes Equations are solved accounting for momentum exchange and volume displacement of discrete particles whose trajectories are calculated in the DEM code LIGGGHTS. The scalar transport equation is coupled to scalar properties of the particle phase, thus convective heat transfer in a fluid granular system can be modeled with "cfdemSolverPisoScalar". +"cfdemSolverPisoScalar" is a coupled CFD-DEM solver using CFDEMcoupling, an open source parallel coupled CFD-DEM framework. Based on pisoFoam(R)(*), a finite volume based solver for turbulent Navier-Stokes equations applying PISO algorithm, "cfdemSolverPisoScalar" has additional functionality for a coupling to the DEM code "LIGGGHTS" as well as a scalar transport equation. The volume averaged Navier-Stokes Equations are solved accounting for momentum exchange and volume displacement of discrete particles, whose trajectories are calculated in the DEM code LIGGGHTS. The scalar transport equation is coupled to scalar properties of the particle phase, thus convective heat transfer in a fluid granular system can be modeled with "cfdemSolverPisoScalar". see: GONIVA, C., KLOSS, C., HAGER,A. and PIRKER, S. (2010): "An Open Source CFD-DEM Perspective", Proc. of OpenFOAM Workshop, Göteborg, June 22.-24. +The heat transfer equation is implemented according to Nield & Bejan (2013), Convection in Porous Media, DOI 10.1007/978-1-4614-5541-7_2, Springer + + :line (*) This offering is not approved or endorsed by OpenCFD Limited, the producer of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks. OPENFOAM® is a registered trade mark of OpenCFD Limited, a wholly owned subsidiary of the ESI Group. diff --git a/doc/forceModel_LaEuScalarTemp.html b/doc/forceModel_LaEuScalarTemp.html index 2e936521..778d3e32 100644 --- a/doc/forceModel_LaEuScalarTemp.html +++ b/doc/forceModel_LaEuScalarTemp.html @@ -21,7 +21,6 @@ LaEuScalarTempProps { velFieldName "U"; tempFieldName "T"; - tempSourceFieldName "Tsource"; voidfractionFieldName "voidfraction"; partTempName "Temp"; partHeatFluxName "convectiveHeatFlux"; @@ -35,8 +34,6 @@ LaEuScalarTempProps

  • T = name of the finite volume scalar temperature field -
  • Tsource = name of the finite volume scalar temperature source field -
  • voidfraction = name of the finite volume voidfraction field
  • Temp = name of the DEM data representing the particles temperature @@ -63,7 +60,6 @@ LaEuScalarTempProps { velFieldName "U"; tempFieldName "T"; - tempSourceFieldName "Tsource"; voidfractionFieldName "voidfraction"; partTempName "Temp"; partHeatFluxName "convectiveHeatFlux"; @@ -77,7 +73,7 @@ LaEuScalarTempProps

    Restrictions:

    -

    Goes only with cfdemSolverScalar. +

    Goes only with cfdemSolverScalar. The force model has to be the second (!!!) model in the forces list.

    Related commands:

    diff --git a/doc/forceModel_LaEuScalarTemp.txt b/doc/forceModel_LaEuScalarTemp.txt index 9558d2cf..307693c7 100644 --- a/doc/forceModel_LaEuScalarTemp.txt +++ b/doc/forceModel_LaEuScalarTemp.txt @@ -19,7 +19,6 @@ LaEuScalarTempProps \{ velFieldName "U"; tempFieldName "T"; - tempSourceFieldName "Tsource"; voidfractionFieldName "voidfraction"; partTempName "Temp"; partHeatFluxName "convectiveHeatFlux"; @@ -31,7 +30,6 @@ LaEuScalarTempProps {U} = name of the finite volume fluid velocity field :ulb,l {T} = name of the finite volume scalar temperature field :l -{Tsource} = name of the finite volume scalar temperature source field :l {voidfraction} = name of the finite volume voidfraction field :l {Temp} = name of the DEM data representing the particles temperature :l {convectiveHeatFlux} = name of the DEM data representing the particle-fluid convective heat flux :l @@ -51,7 +49,6 @@ LaEuScalarTempProps \{ velFieldName "U"; tempFieldName "T"; - tempSourceFieldName "Tsource"; voidfractionFieldName "voidfraction"; partTempName "Temp"; partHeatFluxName "convectiveHeatFlux"; @@ -65,7 +62,7 @@ This "forceModel" does not influence the particles or the fluid flow! Using the [Restrictions:] -Goes only with cfdemSolverScalar. +Goes only with cfdemSolverScalar. The force model has to be the second (!!!) model in the forces list. [Related commands:] diff --git a/doc/forceModel_fieldStore.html b/doc/forceModel_fieldStore.html new file mode 100644 index 00000000..d21cbcb9 --- /dev/null +++ b/doc/forceModel_fieldStore.html @@ -0,0 +1,68 @@ + +
    CFDEMproject WWW Site - CFDEM Commands +
    + + + + +
    + +

    forceModel_fieldStore command +

    +

    Syntax: +

    +

    Defined in couplingProperties dictionary. +

    +
    forceModels
    +(
    +    fieldStore
    +);
    +fieldStoreProps
    +{
    +    scalarFieldNames
    +    (
    +        "scalarField"
    +    );
    +    vectorFieldNames
    +    (
    +        "vectorField"
    +    );
    +}; 
    +
    +
    • scalarField = names of the finite volume scalar fields to be stored + +
    • vectorField = names of the finite volume vector fields to be stored + + +
    +

    Examples: +

    +
    forceModels
    +(
    +    fieldStore
    +);
    +fieldStoreProps
    +{
    +    scalarFieldNames
    +    (
    +        "voidfraction"
    +    );
    +    vectorFieldNames
    +    (
    +        "U"
    +    );
    +} 
    +
    +

    Description: +

    +

    This "forceModel" does not influence the particles or the flow - it is a tool to store a scalar/vector field! This is especially useful if you use a boundary condition which cannot interpreted correctly in your postporcessor (e.g. paraview). +

    +

    Restrictions: +

    +

    none. +

    +

    Related commands: +

    +

    forceModel +

    + diff --git a/doc/forceModel_fieldStore.txt b/doc/forceModel_fieldStore.txt new file mode 100644 index 00000000..2e8af443 --- /dev/null +++ b/doc/forceModel_fieldStore.txt @@ -0,0 +1,63 @@ +"CFDEMproject WWW Site"_lws - "CFDEM Commands"_lc :c + +:link(lws,http://www.cfdem.com) +:link(lc,CFDEMcoupling_Manual.html#comm) + +:line + +forceModel_fieldStore command :h3 + +[Syntax:] + +Defined in couplingProperties dictionary. + +forceModels +( + fieldStore +); +fieldStoreProps +\{ + scalarFieldNames + ( + "scalarField" + ); + vectorFieldNames + ( + "vectorField" + ); +\}; :pre + +{scalarField} = names of the finite volume scalar fields to be stored :ulb,l +{vectorField} = names of the finite volume vector fields to be stored :l +:ule + +[Examples:] + +forceModels +( + fieldStore +); +fieldStoreProps +\{ + scalarFieldNames + ( + "voidfraction" + ); + vectorFieldNames + ( + "U" + ); +\} :pre + +[Description:] + +This "forceModel" does not influence the particles or the flow - it is a tool to store a scalar/vector field! This is especially useful if you use a boundary condition which cannot interpreted correctly in your postporcessor (e.g. paraview). + +[Restrictions:] + +none. + +[Related commands:] + +"forceModel"_forceModel.html + diff --git a/doc/githubAccess_public.pdf b/doc/githubAccess_public.pdf index ef054d06..13f6bb53 100644 Binary files a/doc/githubAccess_public.pdf and b/doc/githubAccess_public.pdf differ diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 00000000..44599544 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,7 @@ +*.o +*.d +*.a +*.dep +log_* +log.* +*~ diff --git a/src/lagrangian/cfdemParticle/cfdTools/global.C b/src/lagrangian/cfdemParticle/cfdTools/global.C new file mode 100644 index 00000000..1e97aecf --- /dev/null +++ b/src/lagrangian/cfdemParticle/cfdTools/global.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + 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 "global.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(global, 0); + +defineRunTimeSelectionTable(global, dictionary); + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void global::info() +{ + Info << "\nYou are currently using:" << endl; + Info << "OF version: " << FOAMversion << endl; + Info << "OF build: " << FOAMbuild << endl; + Info << "CFDEM build: " << CFDEMversion << "\n" << endl; +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +global::global +( + const dictionary& dict, + cfdemCloud& sm +) +: + dict_(dict), + particleCloud_(sm), + CFDEMversion(GITVERSION) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +global::~global() +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/cfdTools/global.H b/src/lagrangian/cfdemParticle/cfdTools/global.H new file mode 100644 index 00000000..afaaf449 --- /dev/null +++ b/src/lagrangian/cfdemParticle/cfdTools/global.H @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + 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 + global + +SourceFiles + global.Cver + +\*---------------------------------------------------------------------------*/ + +#ifndef global_H +#define global_H + +#include "fvCFD.H" +#include "cfdemCloud.H" +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class global Declaration +\*---------------------------------------------------------------------------*/ + +class global +{ + +protected: + + // Protected data + const dictionary& dict_; + + cfdemCloud& particleCloud_; + + const char* const CFDEMversion; + + + // Protected member functions + +public: + + //- Runtime type information + TypeName("global"); + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + global, + dictionary, + ( + const dictionary& dict, + cfdemCloud& sm + ), + (dict,sm) + ); + + + // Constructors + + //- Construct from components + global + ( + const dictionary& dict, + cfdemCloud& sm + ); + + + // Destructor + + virtual ~global(); + + + // Selector + + static autoPtr New + ( + const dictionary& dict, + cfdemCloud& sm + ); + + // Member Function + + void info(); + + // Access + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/cfdTools/newGlobal.C b/src/lagrangian/cfdemParticle/cfdTools/newGlobal.C new file mode 100644 index 00000000..73c4eac1 --- /dev/null +++ b/src/lagrangian/cfdemParticle/cfdTools/newGlobal.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + 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 "global.H" +#include "dilute.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +autoPtr global::New +( + const dictionary& dict, + cfdemCloud& sm +) +{ + word globalType + ( + dict.lookup("global") + ); + + Info<< "Selecting global " + << globalType << endl; + + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(globalType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalError + << "global::New(const dictionary&, const spray&) : " + << endl + << " unknown globalType type " + << globalType + << ", constructor not in hash table" << endl << endl + << " Valid global types are :" + << endl; + Info<< dictionaryConstructorTablePtr_->toc() + << abort(FatalError); + } + + return autoPtr(cstrIter()(dict,sm)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H b/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H index eeec5b55..ae743253 100755 --- a/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H +++ b/src/lagrangian/cfdemParticle/cfdTools/versionInfo.H @@ -1,9 +1,44 @@ -word CFDEMversion="cfdem-2.7.9"; -word compatibleLIGGGHTSversion="3.0.3"; +/*---------------------------------------------------------------------------*\ + 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). + +\*---------------------------------------------------------------------------*/ + +#ifndef versionInfo_H +#define versionInfo_H + +word CFDEMversion="cfdem-2.8.2"; +word compatibleLIGGGHTSversion="3.0.6"; word OFversion="2.3.x-commit-4d6f4a3115ff76ec4154c580eb041bc95ba4ec09"; -Info << "\nCFDEMcoupling version: " << CFDEMversion << "\n" << endl; -Info << "\n, compatible to LIGGGHTS version: " << compatibleLIGGGHTSversion << "\n" << endl; -Info << "\n, compatible to OF version: " << OFversion << "\n" << endl; - +Info << "\nCFDEMcoupling version: " << CFDEMversion << endl; +Info << ", compatible to LIGGGHTS version: " << compatibleLIGGGHTSversion << endl; +Info << ", compatible to OF version and build: " << OFversion << endl; +#endif diff --git a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C index 1e6da060..a913c413 100644 --- a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C +++ b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.C @@ -31,6 +31,7 @@ Description #include "fileName.H" #include "cfdemCloud.H" +#include "global.H" #include "forceModel.H" #include "locateModel.H" #include "momCoupleModel.H" @@ -121,7 +122,7 @@ Foam::cfdemCloud::cfdemCloud turbulence_ ( #if defined(version21) || defined(version16ext) - #ifdef comp + #ifdef compre mesh.lookupObject #else mesh.lookupObject @@ -217,6 +218,8 @@ Foam::cfdemCloud::cfdemCloud ) { #include "versionInfo.H" + global buildInfo(couplingProperties_,*this); + buildInfo.info(); Info << "If BC are important, please provide volScalarFields -imp/expParticleForces-" << endl; if (couplingProperties_.found("solveFlow")) @@ -453,6 +456,16 @@ label Foam::cfdemCloud::liggghtsCommandModelIndex(word name) return index; } +std::vector* Foam::cfdemCloud::getVprobe() +{ + return probeModel_->getVprobe(); +} + +std::vector* Foam::cfdemCloud::getSprobe() +{ + return probeModel_->getSprobe(); +} + // * * * * * * * * * * * * * * * WRITE * * * * * * * * * * * * * // // * * * write cfdemCloud internal data * * * // @@ -467,6 +480,7 @@ bool Foam::cfdemCloud::evolve numberOfParticlesChanged_ = false; arraysReallocated_=false; bool doCouple=false; + probeModel_->clearProbes(); if(!ignore()) { @@ -516,6 +530,7 @@ bool Foam::cfdemCloud::evolve clockM().start(20,"setVectorAverage"); setVectorAverages(); + //Smoothen "next" fields smoothingM().dSmoothing(); smoothingM().smoothen(voidFractionM().voidFractionNext()); @@ -617,6 +632,29 @@ bool Foam::cfdemCloud::reAllocArrays() const return false; } +bool Foam::cfdemCloud::reAllocArrays(int nP, bool forceRealloc) const +{ + if( (numberOfParticlesChanged_ && !arraysReallocated_) || forceRealloc) + { + // get arrays of new length + dataExchangeM().allocateArray(positions_,0.,3,nP); + dataExchangeM().allocateArray(velocities_,0.,3,nP); + dataExchangeM().allocateArray(fluidVel_,0.,3,nP); + dataExchangeM().allocateArray(impForces_,0.,3,nP); + dataExchangeM().allocateArray(expForces_,0.,3,nP); + dataExchangeM().allocateArray(DEMForces_,0.,3,nP); + dataExchangeM().allocateArray(Cds_,0.,1,nP); + dataExchangeM().allocateArray(radii_,0.,1,nP); + dataExchangeM().allocateArray(voidfractions_,1.,voidFractionM().maxCellsPerParticle(),nP); + dataExchangeM().allocateArray(cellIDs_,0.,voidFractionM().maxCellsPerParticle(),nP); + dataExchangeM().allocateArray(particleWeights_,0.,voidFractionM().maxCellsPerParticle(),nP); + dataExchangeM().allocateArray(particleVolumes_,0.,voidFractionM().maxCellsPerParticle(),nP); + arraysReallocated_ = true; + return true; + } + return false; +} + tmp cfdemCloud::divVoidfractionTau(volVectorField& U,volScalarField& voidfraction) const { return @@ -659,7 +697,7 @@ tmp cfdemCloud::voidfractionNuEff(volScalarField& voidfraction) { return tmp ( - #ifdef comp + #ifdef compre new volScalarField("viscousTerm", (turbulence_.mut() + turbulence_.mu())) #else new volScalarField("viscousTerm", (turbulence_.nut() + turbulence_.nu())) @@ -670,7 +708,7 @@ tmp cfdemCloud::voidfractionNuEff(volScalarField& voidfraction) { return tmp ( - #ifdef comp + #ifdef compre new volScalarField("viscousTerm", voidfraction*(turbulence_.mut() + turbulence_.mu())) #else new volScalarField("viscousTerm", voidfraction*(turbulence_.nut() + turbulence_.nu())) diff --git a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H index cafdfec4..a9a35ba6 100644 --- a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H +++ b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloud.H @@ -44,6 +44,7 @@ SourceFiles // choose version #include "OFversion.H" +#include #include "fvCFD.H" #include "IFstream.H" @@ -155,7 +156,7 @@ protected: mutable volScalarField ddtVoidfraction_; #if defined(version21) || defined(version16ext) - #ifdef comp + #ifdef compre const compressible::turbulenceModel& turbulence_; #else const incompressible::turbulenceModel& turbulence_; @@ -323,6 +324,9 @@ public: virtual inline double ** exArray() const {return NULL;}; virtual vector ex(int) const {return Foam::vector(0,0,0);}; + //Detector if SRF module is enable or not + virtual inline bool SRFOn(){return false;} + inline int numberOfParticles() const; inline bool numberOfParticlesChanged() const; @@ -358,7 +362,7 @@ public: inline autoPtr* liggghtsCommand() const; #if defined(version21) || defined(version16ext) - #ifdef comp + #ifdef compre inline const compressible::turbulenceModel& turbulence() const; #else inline const incompressible::turbulenceModel& turbulence() const; @@ -374,6 +378,9 @@ public: virtual bool reAllocArrays() const; + virtual bool reAllocArrays(int nP, bool forceRealloc) const; //force number of particles during reallocation + + // IO void writeScalarFieldToTerminal(double**&); @@ -391,6 +398,10 @@ public: tmp voidfractionNuEff(volScalarField&) const; void resetArray(double**&,int,int,double resetVal=0.); + + std::vector* getVprobe(); + + std::vector* getSprobe(); }; diff --git a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H index fcdaae2c..8549060d 100644 --- a/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H +++ b/src/lagrangian/cfdemParticle/cfdemCloud/cfdemCloudI.H @@ -284,7 +284,7 @@ inline autoPtr* cfdemCloud::liggghtsCommand() const } #if defined(version21) || defined(version16ext) - #ifdef comp + #ifdef compre inline const compressible::turbulenceModel& cfdemCloud::turbulence() const #else inline const incompressible::turbulenceModel& cfdemCloud::turbulence() const diff --git a/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H b/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H index aa7bbb96..ba6a30dd 100644 --- a/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H +++ b/src/lagrangian/cfdemParticle/etc/OFversion/OFversion.H @@ -5,10 +5,10 @@ //#define version15 // choose comp/incomp -//#define comp // if comp is on - you must use Make/options_comp! +//#define compre // if comp is on - you must use Make/options_comp! //define multi sphere -#define multisphere +//#define multisphere // features of 2.1 work also in 2.3 #if defined(version23) diff --git a/src/lagrangian/cfdemParticle/etc/bashrc b/src/lagrangian/cfdemParticle/etc/bashrc index abef2168..48a0424b 100755 --- a/src/lagrangian/cfdemParticle/etc/bashrc +++ b/src/lagrangian/cfdemParticle/etc/bashrc @@ -50,6 +50,9 @@ export CFDEM_LIGGGHTS_LIB_NAME=lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME #- CFDEM lib name export CFDEM_LIB_NAME=lagrangianCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION +#- CFDEM compressible lib name +export CFDEM_LIB_COMP_NAME=lagrangianCFDEMcomp-$CFDEM_VERSION-$WM_PROJECT_VERSION + #----------------------------------------------------- # additional libraries @@ -68,6 +71,9 @@ export CFDEM_POEMSLIB_MAKEFILENAME=g++ #- LMP ASPHERE lib path and makefile export CFDEM_ASPHERELIB_PATH=$CFDEM_LAMMPS_LIB_DIR/poems export CFDEM_ASPHERELIB_MAKEFILENAME=g++ + +#-C3PO library +export C3PO_SRC_DIR=$CFDEM_SRC_DIR/c3po #----------------------------------------------------- #- path to test harness @@ -178,6 +184,11 @@ export -f cfdemLiggghtsPar cfdemGrep() { grep -rl "$1" ./* | xargs gedit; } export -f cfdemGrep +#- shortcut lo list files in a directory +#cfdemListFiles() { find $1 | sed s:""$1"":: > listOfFiles.txt; } #leave out the dir iteslf in list +cfdemListFiles() { find $1 > listOfFiles.txt; } #keep the dir in list +export -f cfdemListFiles + # check if the run directory exists if [ -d "$CFDEM_PROJECT_USER_DIR" ]; then : diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh index a763dace..a4b531c3 100755 --- a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_src.sh @@ -20,48 +20,48 @@ 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." +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 +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)"" - casePath="$path" - headerText="$logfileName""-$NOW" - #--------------------------------------------------------------------------------# - # remove old log file - rm "$logpath/$logfileName"* - compileLib $logpath $logfileName $casePath $headerText - done +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)"" + casePath="$path" + headerText="$logfileName""-$NOW" + #--------------------------------------------------------------------------------# + # remove old log file + rm "$logpath/$logfileName"* + compileLib $logpath $logfileName $casePath $headerText +done diff --git a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh index 8b91bfeb..d4e0306e 100644 --- a/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh +++ b/src/lagrangian/cfdemParticle/etc/compileCFDEMcoupling_uti.sh @@ -1,36 +1,115 @@ #!/bin/bash #===================================================================# -# compile routine for CFDEMcoupling solvers, part of CFDEMproject +# compile routine for CFDEMcoupling utilities, part of CFDEMproject # Christoph Goniva - May. 2012, DCS Computing GmbH #===================================================================# +whitelist="utilities-list.txt" + #- 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 utilities -#================================================================================# +CWD="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")" +NOW="$(date +"%Y-%m-%d-%H:%M")" +echo "" +echo "This routine will compile the utilities specified in utilities-list.txt" +echo "" +#echo "Are the variables CFDEM_UT_DIR=$CFDEM_UT_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 + +echo "" +echo "Please provide the utilities to be compiled in the $CWD/$whitelist file." +echo "structure:" +echo "path to provide the path relative to CFDEM_UT_DIR" +echo "" +echo "example:" +echo "cfdemPostproc/dir" +echo "" + +if [ ! -f "$CWD/$whitelist" ];then + echo "$whitelist does not exist in $CWD" +else + njobs=`wc -l < $CWD/$whitelist` + echo "" + echo "running compilation in pseudo-parallel mode of $njobs utilities" -for utName in "cfdemPostproc" -do #--------------------------------------------------------------------------------# - #- define variables logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" - logfileName="log_compileCFDEMcoupling""_$utName" - casePath="$CFDEM_UT_DIR/$utName" - headerText="$logfileName""_$utName""-$NOW" - #--------------------------------------------------------------------------------# - compileSolver $logpath $logfileName $casePath $headerText -done -echo "Note: the list of utilities compiled might be incomplete." -echo "please check $CFDEM_UT_DIR for more utilities available" + ##number of utilities compiled at a time + + if [[ $WM_NCOMPPROCS == "" ]] || [ $WM_NCOMPPROCS -eq 1 ]; then + nsteps=1 + let nchunk=$njobs+1 # +1, to wait for the last compilation too + echo "do compilation in serial" + else + nsteps=$WM_NCOMPPROCS + nchunk=`echo $njobs/$nsteps+1 | bc` + echo "do compilation on $nsteps procs in $nchunk chunks" + let nchunk++ # +1, to wait for the last compilation too + fi + + counter=0 + for i in `seq $nchunk` + do + + #wait until prev. compilation is finished + echo "waiting..." + until [ `ps -C make | wc -l` -eq 1 ]; + do + sleep 2 + done + + for j in `seq $nsteps` + do + let solNr=($i-1)*$nsteps+$j + LINE=`head -n $solNr $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_UT_DIR/$LINE" + #cd $path + let solNr++ + fi + + if [[ "$counter" -lt "$njobs" ]]; then + #--------------------------------------------------------------------------------# + #- define variables + #logpath="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")/$logDir" + logfileName="log_compileCFDEMcoupling""_$LINE" + casePath="$CFDEM_UT_DIR/$LINE" + headerText="$logfileName""_$LINE""-$NOW" + parallel="true" + #--------------------------------------------------------------------------------# + + #echo "compiling $LINE" + compileSolver $logpath $logfileName $casePath $headerText $parallel + let counter++ + fi + done + + sleep 1 # wait a second until compilation starts + done + + echo "compilation done." +fi + + diff --git a/src/lagrangian/cfdemParticle/etc/cshrc b/src/lagrangian/cfdemParticle/etc/cshrc index 351de826..4e07778e 100755 --- a/src/lagrangian/cfdemParticle/etc/cshrc +++ b/src/lagrangian/cfdemParticle/etc/cshrc @@ -43,6 +43,9 @@ setenv CFDEM_LIGGGHTS_LIB_NAME lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME #- CFDEM lib name setenv CFDEM_LIB_NAME lagrangianCFDEM-$CFDEM_VERSION-$WM_PROJECT_VERSION +#- CFDEM compressible lib name +setenv CFDEM_LIB_COMP_NAME lagrangianCFDEMcomp-$CFDEM_VERSION-$WM_PROJECT_VERSION + #- LMP Many2Many lib path and makefile setenv CFDEM_Many2ManyLIB_PATH $CFDEM_SRC_DIR/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayMany2Many/library setenv CFDEM_Many2ManyLIB_MAKEFILENAME $CFDEM_LIGGGHTS_MAKEFILE_NAME diff --git a/src/lagrangian/cfdemParticle/etc/functions.sh b/src/lagrangian/cfdemParticle/etc/functions.sh index 526221aa..e89fa54b 100755 --- a/src/lagrangian/cfdemParticle/etc/functions.sh +++ b/src/lagrangian/cfdemParticle/etc/functions.sh @@ -71,6 +71,21 @@ compileLib() #- wclean and wmake #if [ $doClean != "noClean" ]; then + # check library to compile is compressible + str=$casePath + i=$((${#str}-4)) + ending=${str:$i:4} + if [[ $ending == "Comp" ]]; then + echo "Compiling a compressible library - so doing an rmdepall of incomp library first." + echo "Please make sure to have the compressible libraries first in the library-list.txt!" + cd $CFDEM_SRC_DIR/lagrangian/cfdemParticle + echo "changing to $PWD" + rmdepall 2>&1 | tee -a $logpath/$logfileName + cd $casePath + echo "changing to $PWD" + else + echo "Compiling a incompressible library." + fi rmdepall 2>&1 | tee -a $logpath/$logfileName wclean 2>&1 | tee -a $logpath/$logfileName #fi diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/Archimedes/Archimedes.C b/src/lagrangian/cfdemParticle/subModels/forceModel/Archimedes/Archimedes.C index 42416b79..05120cec 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/Archimedes/Archimedes.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/Archimedes/Archimedes.C @@ -101,7 +101,7 @@ Archimedes::Archimedes if (modelType_=="B"){ if(forceSubM(0).switches()[1]) // treatDEM = true { - Warning << "Usually model type B needs Archimedes only on CFD and DEM side (treatForceDEM=false)! are you sure about your settings?" << endl; + Warning << "Usually model type B needs Archimedes on CFD and DEM side (treatForceDEM=false)! are you sure about your settings?" << endl; } } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C index 5684071d..da0a465b 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/KochHillDrag/KochHillDrag.C @@ -187,7 +187,7 @@ void KochHillDrag::setForce() const magUr = mag(Ur); Rep = 0; Vs = ds*ds*ds*M_PI/6; - volumefraction = 1-voidfraction+SMALL; + volumefraction = max(SMALL,min(1-SMALL,1-voidfraction)); if (magUr > 0) { diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C b/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C index 1fdccec8..57a5da65 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/LaEuScalarTemp/LaEuScalarTemp.C @@ -138,8 +138,6 @@ void LaEuScalarTemp::manipulateScalarField(volScalarField& EuField) const const volScalarField& nufField = forceSubM(0).nuField(); const volScalarField& rhoField = forceSubM(0).rhoField(); -Info << "nufField=" << nufField << endl; - // calc La based heat flux vector position(0,0,0); scalar voidfraction(1); @@ -160,6 +158,8 @@ Info << "nufField=" << nufField << endl; interpolationCellPoint UInterpolator_(U_); interpolationCellPoint TInterpolator_(tempField_); + scalar h1(0); + scalar h2(0); for(int index = 0;index < particleCloud_.numberOfParticles(); ++index) { //if(particleCloud_.regionM().inRegion()[index][0]) @@ -187,7 +187,7 @@ Info << "nufField=" << nufField << endl; As = ds*ds*M_PI; nuf = nufField[cellI]; Rep = ds*magUr/nuf; - Pr = Cp_*nuf*rhoField[cellI]/lambda_; + Pr = max(SMALL,Cp_*nuf*rhoField[cellI]/lambda_); if (Rep < 200) { @@ -195,8 +195,9 @@ Info << "nufField=" << nufField << endl; } else if (Rep < 1500) { - Nup = 2+0.5*pow(voidfraction,n)*sqrt(Rep)*pow(Pr,0.33) - +0.02*pow(voidfraction,n)*pow(Rep,0.8)*pow(Pr,0.33); + h1=pow(voidfraction,n); + h2=pow(Pr,0.33); + Nup = 2+0.5*h1*sqrt(Rep)*h2+0.02*h1*pow(Rep,0.8)*h2; } else { diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C index 310783ff..59569a45 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C @@ -112,14 +112,7 @@ void ShirgaonkarIB::setForce() const label cellI; vector drag; - #ifdef comp - const volScalarField& mufField = forceSubM(0).muField(); - volVectorField h = (mufField*fvc::laplacian(U_)-fvc::grad(p_)); - #else - const volScalarField& nufField = forceSubM(0).nuField(); - const volScalarField& rhoField = forceSubM(0).rhoField(); - volVectorField h = rhoField*(nufField*fvc::laplacian(U_)-fvc::grad(p_)); - #endif + volVectorField h=forceSubM(0).IBDragPerV(U_,p_); #include "setupProbeModel.H" diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/checkCouplingInterval/checkCouplingInterval.C b/src/lagrangian/cfdemParticle/subModels/forceModel/checkCouplingInterval/checkCouplingInterval.C index ab50686c..a226d82b 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/checkCouplingInterval/checkCouplingInterval.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/checkCouplingInterval/checkCouplingInterval.C @@ -65,7 +65,13 @@ checkCouplingInterval::checkCouplingInterval forceModel(dict,sm), propsDict_(dict.subDict(typeName + "Props")), rhoP_(readScalar(propsDict_.lookup("rhoP"))) -{} +{ + // init force sub model + setForceSubModels(propsDict_); + + // read those switches defined above, if provided in dict + forceSubM(0).readSwitches(); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -108,7 +114,8 @@ void checkCouplingInterval::setForce() const double accNrAll=-1.; MPI_Allreduce(&accNr, &accNrAll, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD); - + Info << "min. occurring particle relaxation time [s]: " << minTauP << endl; + Info << "coupling interval [s]: " << DEMtime << endl; Info << "max. occurring acceleration nr: " << accNrAll << endl; if(accNrAll > 0.1) Warning << "you should use a smaller coupling interval!" << endl; } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/fieldStore/fieldStore.C b/src/lagrangian/cfdemParticle/subModels/forceModel/fieldStore/fieldStore.C new file mode 100644 index 00000000..24a299b8 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/fieldStore/fieldStore.C @@ -0,0 +1,164 @@ +/*---------------------------------------------------------------------------*\ + 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 "fieldStore.H" +#include "addToRunTimeSelectionTable.H" +#include "dataExchangeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(fieldStore, 0); + +addToRunTimeSelectionTable +( + forceModel, + fieldStore, + dictionary +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +fieldStore::fieldStore +( + const dictionary& dict, + cfdemCloud& sm +) +: + forceModel(dict,sm), + propsDict_(dict.subDict(typeName + "Props")), + mesh_(particleCloud_.mesh()), + scalarFieldNames_(propsDict_.lookup("scalarFieldNames")), + vectorFieldNames_(propsDict_.lookup("vectorFieldNames")), + scalarFields_(NULL), + vectorFields_(NULL) +{ + // create time average scalar fields + scalarFields_.setSize(scalarFieldNames_.size()); + + for (int i=0;i < scalarFieldNames_.size(); i++) + { + word fieldName = "stored_" + scalarFieldNames_[i]; + + Info<< "Creating field " << fieldName << endl; + scalarFields_.set + ( + i, + new volScalarField + ( + IOobject + ( + fieldName, + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh_, + dimensionedScalar("0", mesh_.lookupObject(scalarFieldNames_[i]).dimensions(), 0) + ) + ); + } + + // create time average vector fields + vectorFields_.setSize(vectorFieldNames_.size()); + + for (int i=0;i < vectorFieldNames_.size(); i++) + { + word fieldName = "stored_" + vectorFieldNames_[i]; + + Info<< "Creating field " << fieldName << endl; + vectorFields_.set + ( + i, + new volVectorField + ( + IOobject + ( + fieldName, + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh_, + dimensionedVector("0", mesh_.lookupObject(vectorFieldNames_[i]).dimensions(), vector::zero) + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +fieldStore::~fieldStore() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void fieldStore::setForce() const +{ + if(particleCloud_.verbose()) Info << "fieldStore.C - setForce()" << endl; + + for (int i=0;i < scalarFieldNames_.size(); i++) + { + // get reference to actual field + volScalarField& field = (volScalarField&) mesh_.lookupObject(scalarFieldNames_[i]); + + // save field + scalarFields_[i] = field; + } + + for (int i=0;i < vectorFieldNames_.size(); i++) + { + // get reference to actual field + volVectorField& field = (volVectorField&) mesh_.lookupObject(vectorFieldNames_[i]); + + // save field + vectorFields_[i] = field; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/fieldStore/fieldStore.H b/src/lagrangian/cfdemParticle/subModels/forceModel/fieldStore/fieldStore.H new file mode 100644 index 00000000..f9caf1d6 --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/fieldStore/fieldStore.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + 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). + + calc time average of scalar or vector field + +Class + fieldStore + +SourceFiles + fieldStore.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fieldStore_H +#define fieldStore_H + +#include "forceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fieldStore Declaration +\*---------------------------------------------------------------------------*/ + +class fieldStore +: + public forceModel +{ +private: + + dictionary propsDict_; + + const fvMesh& mesh_; + + const wordList scalarFieldNames_; + + const wordList vectorFieldNames_; + + mutable PtrList scalarFields_; + + mutable PtrList vectorFields_; + +public: + + //- Runtime type information + TypeName("fieldStore"); + + + // Constructors + + //- Construct from components + fieldStore + ( + const dictionary& dict, + cfdemCloud& sm + ); + + // Destructor + + ~fieldStore(); + + + // Member Functions + void setForce() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.C b/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.C index ba1aaa9d..a1cce23c 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.C @@ -76,7 +76,32 @@ forceSubModel::forceSubModel sm.mesh(), dimensionedScalar("nu0", dimensionSet(0, 2, -1, 0, 0), 1.) ), - nuField_(sm.turbulence().nu()), + divTau_ + ( + IOobject + ( + "divTau", + sm.mesh().time().timeName(), + sm.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + sm.mesh(), + dimensionedVector("divTau", dimensionSet(1, -2, -2, 0, 0), vector::zero) + ), + IBDragPerV_ + ( + IOobject + ( + "IBDragPerV", + sm.mesh().time().timeName(), + sm.mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + sm.mesh(), + dimensionedVector("IBDragPerV", dimensionSet(1, -2, -2, 0, 0), vector::zero) + ), densityFieldName_(dict_.lookupOrDefault("densityFieldName","rho")), rho_(sm.mesh().lookupObject (densityFieldName_)) { @@ -246,8 +271,9 @@ void forceSubModel::readSwitches() const const volScalarField& forceSubModel::nuField() const { - #ifdef comp - return particleCloud_.turbulence().mu() / rho_; + #ifdef compre + nu_=particleCloud_.turbulence().mu() / rho_; + return nu_; #else if(switches_[8]) // scalarViscosity=true return nu_; @@ -258,9 +284,12 @@ const volScalarField& forceSubModel::nuField() const const volScalarField& forceSubModel::muField() const { - #ifdef comp + #ifdef compre return particleCloud_.turbulence().mu(); #else + // passing the ref to nu*rho will not work->generate a mu_ field like nu_ + FatalError<< "implementation not complete!" << abort(FatalError); + if(switches_[8]) // scalarViscosity=true return nu_*rho_; else @@ -270,7 +299,32 @@ const volScalarField& forceSubModel::muField() const const volScalarField& forceSubModel::rhoField() const { - return rho_; + return rho_; +} + +const volVectorField& forceSubModel::divTauField(const volVectorField& U) const +{ + // calc div(Tau) + #ifdef compre + const volScalarField& mu_ = muField(); + divTau_ = -fvc::laplacian(mu_, U) - fvc::div(mu_*dev(fvc::grad(U)().T())); + return divTau_; + #else + const volScalarField& nu_ = nuField(); + const volScalarField& rho_ = rhoField(); + divTau_ = -fvc::laplacian(nu_*rho_, U)- fvc::div(nu_*rho_*dev(fvc::grad(U)().T())); + return divTau_; + #endif +} + +const volVectorField& forceSubModel::IBDragPerV(const volVectorField& U,const volScalarField& p) const +{ + #ifdef compre + IBDragPerV_ = muField()*fvc::laplacian(U)-fvc::grad(p) + #else + IBDragPerV_ = rhoField()*(nuField()*fvc::laplacian(U)-fvc::grad(p)); + #endif + return IBDragPerV_; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.H b/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.H index 59d80a73..e4cc63e5 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/forceSubModels/forceSubModel/forceSubModel.H @@ -73,7 +73,9 @@ protected: mutable volScalarField nu_; - const volScalarField& nuField_; + mutable volVectorField divTau_; + + mutable volVectorField IBDragPerV_; word densityFieldName_; @@ -163,6 +165,10 @@ public: const volScalarField& muField() const; const volScalarField& rhoField() const; + + const volVectorField& divTauField(const volVectorField&) const; + + const volVectorField& IBDragPerV(const volVectorField&,const volScalarField&) const; }; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C b/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C index b53af340..571915ab 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/viscForce/viscForce.C @@ -126,21 +126,7 @@ viscForce::~viscForce() void viscForce::setForce() const { - const volScalarField& nufField = forceSubM(0).nuField(); - const volScalarField& rhoField = forceSubM(0).rhoField(); - - // get viscosity field - #ifdef comp - // calc div(Tau) - volVectorField divTauField = - - fvc::laplacian(forceSubM(0).muField(), U_) - - fvc::div(forceSubM(0).muField()*dev(fvc::grad(U_)().T())); - #else - // calc div(Tau) - volVectorField divTauField = - - fvc::laplacian(nufField*rhoField, U_) - - fvc::div(nufField*rhoField*dev(fvc::grad(U_)().T())); - #endif + const volVectorField& divTauField = forceSubM(0).divTauField(U_); vector divTau; scalar Vs; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.C b/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.C index 691b61e3..35a0386d 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.C @@ -64,12 +64,10 @@ DiFeliceDragMS::DiFeliceDragMS : forceModelMS(dict,sm), propsDict_(dict.subDict(typeName + "Props")), - verbose_(false), velFieldName_(propsDict_.lookup("velFieldName")), U_(sm.mesh().lookupObject (velFieldName_)), voidfractionFieldName_(propsDict_.lookup("voidfractionFieldName")), voidfraction_(sm.mesh().lookupObject (voidfractionFieldName_)), - interpolation_(false), splitImplicitExplicit_(false), UsFieldName_(propsDict_.lookup("granVelFieldName")), UsField_(sm.mesh().lookupObject (UsFieldName_)) @@ -85,28 +83,26 @@ DiFeliceDragMS::DiFeliceDragMS particleCloud_.probeM().scalarFields_.append("voidfraction"); //other are debug particleCloud_.probeM().writeHeader(); - if (propsDict_.found("verbose")) verbose_=true; - // init force sub model setForceSubModels(propsDict_); // define switches which can be read from dict forceSubM(0).setSwitchesList(0,true); // activate treatExplicit switch + forceSubM(0).setSwitchesList(3,true); // activate search for verbose switch + forceSubM(0).setSwitchesList(4,true); // activate search for interpolate switch // read those switches defined above, if provided in dict forceSubM(0).readSwitches(); - if (propsDict_.found("interpolation")) + if (forceSubM(0).interpolation()) { - Info << "using interpolated value of U." << endl; - interpolation_=true; Warning << " interpolation is commented for this force model - it seems to be unstable with AMI!" << endl; } if (propsDict_.found("splitImplicitExplicit")) { Info << "will split implicit / explicit force contributions." << endl; splitImplicitExplicit_ = true; - if(!interpolation_) + if(!forceSubM(0).interpolation()) Info << "WARNING: will only consider fluctuating particle velocity in implicit / explicit force split!" << endl; } particleCloud_.checkCG(false); @@ -163,7 +159,7 @@ void DiFeliceDragMS::setForce() const if (cellI > -1) // particle Found { - //if(interpolation_) + //if(forceSubM(0).interpolation()) //{ // position = cloudRefMS().positionCM(index); // voidfraction = voidfractionInterpolator_.interpolate(position,cellI); @@ -218,7 +214,7 @@ void DiFeliceDragMS::setForce() const } } - if(verbose_ && index >=0 && index <10) + if(forceSubM(0).verbose() && index >=0 && index <10) { Pout << "index = " << index << endl; Pout << "Us = " << Us << endl; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.H b/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.H index dd31d9ac..27bc6275 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModelMS/DiFeliceDragMS/DiFeliceDragMS.H @@ -61,8 +61,6 @@ class DiFeliceDragMS private: dictionary propsDict_; - bool verbose_; - word velFieldName_; const volVectorField& U_; @@ -71,8 +69,6 @@ private: const volScalarField& voidfraction_; - bool interpolation_; // use interpolated U field values - bool splitImplicitExplicit_; // use splitting of implicit and explict force contribution word UsFieldName_; diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C index ae85ed1c..73c93e16 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C @@ -115,14 +115,14 @@ void liggghtsCommandModel::checkTimeSettings(const dictionary& propsDict) if(runLast_) // last run { // read time options from subdict - endTime_ = particleCloud_.mesh().time().endTime().value(); + endTime_ = particleCloud_.mesh().time().endTime().value()-particleCloud_.mesh().time().startTime().value(); startTime_ = endTime_; - timeInterval_ = 1; + timeInterval_ = -1; // calculate coupling times firstCouplingStep_ = floor(startTime_/DEMts/couplingInterval); lastCouplingStep_ = floor(endTime_/DEMts/couplingInterval); - couplingStepInterval_ = floor(timeInterval_/DEMts/couplingInterval); + couplingStepInterval_ = -1; } else //runEveryCouplingStep of every n steps or every writeStep { @@ -150,7 +150,7 @@ void liggghtsCommandModel::checkTimeSettings(const dictionary& propsDict) { firstCouplingStep_ =1; lastCouplingStep_ =1; - couplingStepInterval_ =1; + couplingStepInterval_ =-1; } if(verbose_){ diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C index dc480bdc..96affbed 100644 --- a/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.C @@ -204,7 +204,7 @@ void particleProbe::writeHeader() const *sPtr<<"|| scalarData: " << " "; forAll(scalarFields_, iter) { - *sPtr << scalarFields_(iter) << " "; + *sPtr << scalarFields_(iter) << " "; } } @@ -214,8 +214,20 @@ void particleProbe::writeHeader() const } +void particleProbe::clearProbes() const +{ + for (unsigned int i=0; i sValues, Field vValues) const { + + if(printNow_ && checkIDForPrint(index) && verboseToFile_) { @@ -224,15 +236,34 @@ void particleProbe::writeProbe(int index, Field sValues, Field v *sPtr << index << tab << particleCloud_.mesh().time().value() << " " ; *sPtr << "|| "; - + + int vsize_=vProbes_.size(); //vectorFields *sPtr << setprecision(writePrecision_) ; forAll(vValues, iter) { - if(!probeDebug_ && iter>0) break; + // if(!probeDebug_ && iter>0) break; *sPtr << vValues[iter][0] << " "; *sPtr << vValues[iter][1] << " "; *sPtr << vValues[iter][2] << " "; + + + if(index sValues, Field v forAll(sValues, iter) { *sPtr << sValues[iter] << " "; + sProbes_.push_back(sValues[iter]); } } diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H index 6d07f239..043bf2c8 100644 --- a/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/particleProbe/particleProbe.H @@ -44,7 +44,7 @@ SourceFiles #include "polyMesh.H" #include "cfdemCloud.H" #include "OFstream.H" - +#include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -101,6 +101,10 @@ private: mutable bool printNow_; + mutable std::vector sProbes_; + + mutable std::vector vProbes_; + public: //- Runtime type information @@ -129,6 +133,9 @@ public: void writeProbe(int index, Field sValues, Field vValues) const; bool checkIDForPrint(int) const; void setCounter() const; + void clearProbes() const; + std::vector* getVprobe() {return &vProbes_; }; + std::vector* getSprobe() {return &sProbes_; }; }; diff --git a/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H index 0330dc1c..54e57735 100644 --- a/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H +++ b/src/lagrangian/cfdemParticle/subModels/probeModel/probeModel/probeModel.H @@ -41,6 +41,7 @@ SourceFiles #include "fvCFD.H" #include "cfdemCloud.H" +#include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -139,6 +140,9 @@ public: virtual bool checkIDForPrint(int) const {return false;}; virtual void setCounter() const {}; virtual bool active() const {return true;}; + virtual std::vector* getVprobe() {return NULL;}; + virtual std::vector* getSprobe() {return NULL;}; + virtual void clearProbes() const {}; const char* wordToChar(word&) const; // Access diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.C index 14d1bdbe..88ba06a7 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.C @@ -69,7 +69,8 @@ dividedVoidFraction::dividedVoidFraction alphaMin_(readScalar(propsDict_.lookup("alphaMin"))), alphaLimited_(0), tooMuch_(0.0), - interpolation_(false) + interpolation_(false), + cfdemUseOnly_(false) { maxCellsPerParticle_ = 29; @@ -83,6 +84,11 @@ dividedVoidFraction::dividedVoidFraction checkWeightNporosity(propsDict_); if (propsDict_.found("verbose")) verbose_=true; + + if (propsDict_.found("cfdemUseOnly")) + { + cfdemUseOnly_ = readBool(propsDict_.lookup("cfdemUseOnly")); + } } @@ -96,7 +102,11 @@ dividedVoidFraction::~dividedVoidFraction() void dividedVoidFraction::setvoidFraction(double** const& mask,double**& voidfractions,double**& particleWeights,double**& particleVolumes, double**& particleV) const { - reAllocArrays(); + + if(cfdemUseOnly_) + reAllocArrays(particleCloud_.numberOfParticles()); + else + reAllocArrays(); scalar pi = M_PI; vector position(0,0,0); @@ -114,6 +124,7 @@ void dividedVoidFraction::setvoidFraction(double** const& mask,double**& voidfra //if(mask[index][0]) //{ // reset + for(int subcell=0;subcell