From 4bb95e66a899c15e581d2124335c2c5153c454d1 Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 14 Feb 2022 14:15:04 +0100 Subject: [PATCH] merge ShirgaonkarIB and ShirgaonkarIBTorque models reduce code duplication --- src/lagrangian/cfdemParticle/Make/files | 1 - .../forceModel/ShirgaonkarIB/ShirgaonkarIB.C | 15 ++ .../forceModel/ShirgaonkarIB/ShirgaonkarIB.H | 2 + .../ShirgaonkarIBTorque/ShirgaonkarIBTorque.C | 171 ------------------ .../ShirgaonkarIBTorque/ShirgaonkarIBTorque.H | 112 ------------ .../CFD/constant/couplingProperties | 4 +- 6 files changed, 19 insertions(+), 286 deletions(-) delete mode 100644 src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIBTorque/ShirgaonkarIBTorque.C delete mode 100644 src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIBTorque/ShirgaonkarIBTorque.H diff --git a/src/lagrangian/cfdemParticle/Make/files b/src/lagrangian/cfdemParticle/Make/files index 2215c72e..31ef62b4 100644 --- a/src/lagrangian/cfdemParticle/Make/files +++ b/src/lagrangian/cfdemParticle/Make/files @@ -102,7 +102,6 @@ $(forceModels)/Fines/FinesFields.C $(forceModels)/Fines/FanningDynFines.C $(forceModels)/Fines/ErgunStatFines.C $(forceModels)/granKineticEnergy/granKineticEnergy.C -$(forceModels)/ShirgaonkarIBTorque/ShirgaonkarIBTorque.C $(forceModels)/pdCorrelation/pdCorrelation.C $(forceModels)/surfaceTensionForce/surfaceTensionForce.C $(forceModels)/gradPForceSmooth/gradPForceSmooth.C diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C index 824cdbfe..a8076ca4 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.C @@ -68,6 +68,7 @@ ShirgaonkarIB::ShirgaonkarIB twoDimensional_(propsDict_.found("twoDimensional")), depth_(1), multisphere_(propsDict_.found("multisphere")), // drag for a multisphere particle + useTorque_(propsDict_.found("useTorque")), velFieldName_(propsDict_.lookup("velFieldName")), U_(sm.mesh().lookupObject (velFieldName_)), pressureFieldName_(propsDict_.lookup("pressureFieldName")), @@ -113,6 +114,7 @@ void ShirgaonkarIB::setForce() const label cellI; vector drag; + vector torque; volVectorField h=forceSubM(0).IBDragPerV(U_,p_); @@ -123,6 +125,7 @@ void ShirgaonkarIB::setForce() const //if(mask[index][0]) //{ drag=vector::zero; + torque=vector::zero; for(int subCell=0;subCell -1) // particle Found { drag += h[cellI]*h.mesh().V()[cellI]; + if(useTorque_) + { + vector rc = particleCloud_.mesh().C()[cellI]; + vector positionCenter = particleCloud_.position(index); + torque += (rc - positionCenter)^h[cellI]*h.mesh().V()[cellI]; + } } } @@ -154,6 +163,12 @@ void ShirgaonkarIB::setForce() const << "," << particleCloud_.impForces()[index][1] << "," << particleCloud_.impForces()[index][2] << endl; + + if(useTorque_) + { + for(int j=0;j<3;j++) particleCloud_.DEMTorques()[index][j] = torque[j]; // Adding to the particle torque; + if(verbose_) Info << "DEMTorques = " << particleCloud_.DEMTorques()[index][0] << "," << particleCloud_.DEMTorques()[index][1] << "," << particleCloud_.DEMTorques()[index][2] << endl; + } //} } diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.H b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.H index 939e08f6..4c7c6969 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIB/ShirgaonkarIB.H @@ -69,6 +69,8 @@ private: const bool multisphere_; + const bool useTorque_; + word velFieldName_; const volVectorField& U_; diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIBTorque/ShirgaonkarIBTorque.C b/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIBTorque/ShirgaonkarIBTorque.C deleted file mode 100644 index b5515115..00000000 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/ShirgaonkarIBTorque/ShirgaonkarIBTorque.C +++ /dev/null @@ -1,171 +0,0 @@ -/*---------------------------------------------------------------------------*\ - CFDEMcoupling - Open Source CFD-DEM coupling - - CFDEMcoupling is part of the CFDEMproject - www.cfdem.com - Copyright 2009-2012 JKU Linz - Copyright 2012-2015 DCS Computing GmbH, Linz - Copyright 2015- JKU 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 "ShirgaonkarIBTorque.H" -#include "addToRunTimeSelectionTable.H" -#include "voidFractionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(ShirgaonkarIBTorque, 0); - -addToRunTimeSelectionTable -( - forceModel, - ShirgaonkarIBTorque, - dictionary -); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -ShirgaonkarIBTorque::ShirgaonkarIBTorque -( - const dictionary& dict, - cfdemCloud& sm -) -: - forceModel(dict,sm), - propsDict_(dict.subDict(typeName + "Props")), - verbose_(propsDict_.found("verbose")), - twoDimensional_(propsDict_.found("twoDimensional")), - depth_(1), - velFieldName_(propsDict_.lookup("velFieldName")), - U_(sm.mesh().lookupObject (velFieldName_)), - pressureFieldName_(propsDict_.lookup("pressureFieldName")), - p_(sm.mesh().lookupObject (pressureFieldName_)), - useTorque_(propsDict_.found("useTorque")) -{ - //Append the field names to be probed - particleCloud_.probeM().initialize(typeName, typeName+".logDat"); - particleCloud_.probeM().vectorFields_.append("dragForce"); //first entry must the be the force - particleCloud_.probeM().writeHeader(); - - if (twoDimensional_) - { - depth_ = propsDict_.lookup("depth"); - Info << "2-dimensional simulation - make sure DEM side is 2D" << endl; - Info << "depth of domain is assumed to be :" << depth_ << endl; - } - - // init force sub model - setForceSubModels(propsDict_); - - // define switches which can be read from dict - forceSubM(0).setSwitchesList(SW_TREAT_FORCE_EXPLICIT,true); // activate treatExplicit switch - - // read those switches defined above, if provided in dict - forceSubM(0).readSwitches(); - - particleCloud_.checkCG(false); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -ShirgaonkarIBTorque::~ShirgaonkarIBTorque() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void ShirgaonkarIBTorque::setForce() const -{ - - label cellI; - vector drag; - vector torque; - - volVectorField h=forceSubM(0).IBDragPerV(U_,p_); - - #include "setupProbeModel.H" - - for(int index=0; index< particleCloud_.numberOfParticles(); index++) - { - drag=vector::zero; - torque=vector::zero; - vector positionCenter = particleCloud_.position(index); - - for(int subCell=0;subCell