From 4ddf691936fe0bd7173ea2ba6415bea203184b33 Mon Sep 17 00:00:00 2001 From: tmjnijssen Date: Thu, 14 Apr 2022 15:29:10 +0200 Subject: [PATCH] add transfer of fluid properties to LIGGGHTS --- src/lagrangian/cfdemParticle/Make/files | 1 + .../transferFluidProperties.C | 108 ++++++++++++++++++ .../transferFluidProperties.H | 80 +++++++++++++ src/lagrangian/cfdemParticleComp/Make/files | 1 + 4 files changed, 190 insertions(+) create mode 100644 src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.C create mode 100644 src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.H diff --git a/src/lagrangian/cfdemParticle/Make/files b/src/lagrangian/cfdemParticle/Make/files index 00d33dbd..b0f4449f 100644 --- a/src/lagrangian/cfdemParticle/Make/files +++ b/src/lagrangian/cfdemParticle/Make/files @@ -96,6 +96,7 @@ $(forceModels)/potentialRelaxation/potentialRelaxation.C $(forceModels)/BeetstraDrag/BeetstraDrag.C $(forceModels)/BeetstraDragPoly/BeetstraDragPoly.C $(forceModels)/dSauter/dSauter.C +$(forceModels)/transferFluidProperties/transferFluidProperties.C $(forceModels)/Fines/Fines.C $(forceModels)/Fines/FinesFields.C $(forceModels)/Fines/FanningDynFines.C diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.C b/src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.C new file mode 100644 index 00000000..5faf375d --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ +License + This 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. + This code 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 this code. If not, see . + + Copyright (C) 2015- Thomas Lichtenegger, JKU Linz, Austria + +Description + transfer fluid properties to LIGGGHTS + +SourceFiles + transferFluidProperties.C +\*---------------------------------------------------------------------------*/ + +#include "error.H" + +#include "transferFluidProperties.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(transferFluidProperties, 0); + +addToRunTimeSelectionTable +( + forceModel, + transferFluidProperties, + dictionary +); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +// Construct from components +transferFluidProperties::transferFluidProperties +( + const dictionary& dict, + cfdemCloud& sm +) +: + forceModel(dict,sm), + propsDict_(dict.subDict(typeName + "Props")), + verbose_(propsDict_.lookupOrDefault("verbose",false)) +{ + particleCloud_.registerParticleProperty("fluidDensity",1); + particleCloud_.registerParticleProperty("fluidViscosity",1); + + // init force sub model + setForceSubModels(propsDict_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +transferFluidProperties::~transferFluidProperties() +{ +} + +// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * // + +void transferFluidProperties::setForce() const +{ + double**& fluidDensity_ = particleCloud_.getParticlePropertyRef("fluidDensity"); + double**& fluidViscosity_ = particleCloud_.getParticlePropertyRef("fluidViscosity"); + + const volScalarField& rhoField = forceSubM(0).rhoField(); + const volScalarField& nufField = forceSubM(0).nuField(); + + label cellI = 0; + + for(int index = 0; index < particleCloud_.numberOfParticles(); ++index) + { + cellI = particleCloud_.cellIDs()[index][0]; + if (cellI >= 0) + { + fluidDensity_[index][0] = rhoField[cellI]; + fluidViscosity_[index][0] = nufField[cellI] * rhoField[cellI]; + } + } + + particleCloud_.dataExchangeM().giveData("fluidDensity","scalar-atom",fluidDensity_); + particleCloud_.dataExchangeM().giveData("fluidViscosity","scalar-atom",fluidViscosity_); + + if (verbose_) Info << "give data done" << endl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.H b/src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.H new file mode 100644 index 00000000..9a2853ae --- /dev/null +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/transferFluidProperties/transferFluidProperties.H @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ +License + This 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. + This code 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 this code. If not, see . + + Copyright (C) 2015- Thomas Lichtenegger, JKU Linz, Austria + +Description + transfer fluid properties to LIGGGHTS + +SourceFiles + transferFluidProperties.C +\*---------------------------------------------------------------------------*/ + +#ifndef transferFluidProperties_H +#define transferFluidProperties_H + +#include "forceModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class transferFluidProperties Declaration +\*---------------------------------------------------------------------------*/ + +class transferFluidProperties +: + public forceModel +{ +private: + + dictionary propsDict_; + + bool verbose_; + +public: + + //- Runtime type information + TypeName("transferFluidProperties"); + + // Constructors + + //- Construct from components + transferFluidProperties + ( + const dictionary& dict, + cfdemCloud& sm + ); + + // Destructor + + ~transferFluidProperties(); + + + // Member Functions + void setForce() const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/cfdemParticleComp/Make/files b/src/lagrangian/cfdemParticleComp/Make/files index 2907a3ea..dfccc6e6 100644 --- a/src/lagrangian/cfdemParticleComp/Make/files +++ b/src/lagrangian/cfdemParticleComp/Make/files @@ -90,6 +90,7 @@ $(forceModels)/directedDiffusiveRelaxation/directedDiffusiveRelaxation.C $(forceModels)/BeetstraDrag/BeetstraDrag.C $(forceModels)/BeetstraDragPoly/BeetstraDragPoly.C $(forceModels)/dSauter/dSauter.C +$(forceModels)/transferFluidProperties/transferFluidProperties.C $(forceModels)/Fines/Fines.C $(forceModels)/Fines/FinesFields.C $(forceModels)/Fines/FanningDynFines.C