From 8df363cf97826b03f2923c9b0bf91a378853bb7c Mon Sep 17 00:00:00 2001 From: danielque Date: Thu, 24 Aug 2017 17:06:23 +0200 Subject: [PATCH 01/18] add some mathematical constants cf. OpenFOAM mathematicalConstants.H --- .../cfdemParticle/cfdTools/mathExtra.H | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H b/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H index fb45ecfd..a48893ef 100644 --- a/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H +++ b/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H @@ -44,6 +44,28 @@ Description #define TOLERANCE_ORTHO 1e-10 +namespace Foam +{ +namespace constant +{ +namespace mathematical +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + const scalar piByFour(0.25*pi); + const scalar fourPiByThree(4.0*pi/3.0); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace mathematical +} // End namespace constant + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + namespace MathExtra { From 9a1abb5f1990fa1037433d4c3f0aceeae4a4e086 Mon Sep 17 00:00:00 2001 From: danielque Date: Thu, 24 Aug 2017 17:07:33 +0200 Subject: [PATCH 02/18] clean up whitespaces in mathExtra.H --- .../cfdemParticle/cfdTools/mathExtra.H | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H b/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H index a48893ef..2699627d 100644 --- a/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H +++ b/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H @@ -27,7 +27,7 @@ License 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). - + Copyright of this contribution: Copyright 2014- TU Graz, IPPT ------------------------------------------------------------------------- */ @@ -66,7 +66,7 @@ namespace mathematical } // End namespace Foam -namespace MathExtra +namespace MathExtra { // inline void outerProduct(double *vec1, double *vec2, double **m); @@ -103,13 +103,13 @@ inline bool spheroidGeometry(double radius, double aspectRatio, //inputs //INPUT // radius ...volume-equivalent radius of the spheroid // aspectRatio ...major/minor aspect ratio - + //OUTPUT - // ai ... - // bi ... - // ei ... - // Le ... - + // ai ... + // bi ... + // ei ... + // Le ... + if(radius<=0.0) //avoid troubles in case radius is 0 or negative return false; @@ -141,7 +141,7 @@ inline bool spheroidGeometry2(double radius, double aspectRatio, //inputs //INPUT // radius ...volume-equivalent radius of the spheroid // aspectRatio ...major/minor aspect ratio - + //OUTPUT // XAe ...Eccentricity dependet parameter // YAe ...Eccentricity dependet parameter @@ -234,7 +234,7 @@ inline bool permutationDotDyadic( //Generate permutation tensor double permutationT[3][3][3]; permutationTensor(permutationT); - + //Step 1: compute dot prodcut of permutation tensor double permutationDotProd[3][3]; zeroize33(permutationDotProd); @@ -249,7 +249,7 @@ inline bool permutationDotDyadic( for(int iY=0; iY<3; iY++) for(int iZ=0; iZ<3; iZ++) tensor[iX][iY][iZ] = permutationDotProd[iX][iY] - * vector[iZ]; + * vector[iZ]; return true; } @@ -262,7 +262,7 @@ inline bool doubleDotTensor333Tensor33(double tensor333[3][3][3], ) { result[0]=0.0;result[1]=0.0;result[2]=0.0; - + for(int iX=0; iX<3; iX++) for(int iY=0; iY<3; iY++) for(int iZ=0; iZ<3; iZ++) From e6d12f6790cbef913dd291a074d37502a81f7702 Mon Sep 17 00:00:00 2001 From: danielque Date: Thu, 24 Aug 2017 17:18:40 +0200 Subject: [PATCH 03/18] make debug info live in separate block --- src/lagrangian/cfdemParticle/cfdTools/debugInfo.H | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H b/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H index e2071fbc..5586cf51 100755 --- a/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H +++ b/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H @@ -1,4 +1,4 @@ - +{ //========================================================================// scalar countCell=0; // number of cells touched by particles int points=0; // number of particles and sub-points @@ -93,3 +93,4 @@ Info <<"meanR_array = "<< meanR_array << endl; Info <<"=============================================================================" << endl; Info << endl; +} From bf0ff235b63030a11cf16b43064e5f718b37202e Mon Sep 17 00:00:00 2001 From: danielque Date: Thu, 24 Aug 2017 17:19:24 +0200 Subject: [PATCH 04/18] use proper data type for counters --- src/lagrangian/cfdemParticle/cfdTools/debugInfo.H | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H b/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H index 5586cf51..285e291f 100755 --- a/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H +++ b/src/lagrangian/cfdemParticle/cfdTools/debugInfo.H @@ -1,7 +1,7 @@ { //========================================================================// - scalar countCell=0; // number of cells touched by particles - int points=0; // number of particles and sub-points + label countCell=0; // number of cells touched by particles + label points=0; // number of particles and sub-points scalar totalParticleWeights=0; // total weight of all particles and sub-points vector totalForce_array(0,0,0); // total force on particles based on particle array vector totalForce_field(0,0,0); // forceField of forceM(), used to calc Ksl From 6e23baba7ff2b3d8bbb4311b4f9b63990f113a1e Mon Sep 17 00:00:00 2001 From: danielque Date: Fri, 25 Aug 2017 14:33:50 +0200 Subject: [PATCH 05/18] fix Mei lift force The equation was probably taken from the paper of Kurose and Komori 1999, which does not repoduce the original formula given by Mei 1992 correctly (which itself is missing a left parenthesis). The correct formula can be looked up for example in Mei and Klausner 1994 or Loth and Dorgan 2009 --- .../cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C index 0dca7e3b..98b3f05e 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C @@ -190,12 +190,8 @@ void MeiLift::setForce() const else { J_star = 0.3 - *( 1.0 - +tanh( 2.5 * log10(epsilon+0.191) ) - ) - *( 0.667 - +tanh( 6.0 * (epsilon-0.32) ) - ); + * (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 From 2230dcaa57a27949b9d612b2c62e386fa113f19f Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 12:32:11 +0200 Subject: [PATCH 06/18] rearrange code in MeiLift to save some operations --- .../subModels/forceModel/MeiLift/MeiLift.C | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C index 98b3f05e..aa184dc0 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C @@ -124,6 +124,7 @@ void MeiLift::setForce() const scalar J_star(0); scalar Omega_eq(0); scalar alphaStar(0); + scalar epsilonSqr(0.0); scalar epsilon(0); scalar omega_star(0); vector vorticity(0,0,0); @@ -172,16 +173,16 @@ void MeiLift::setForce() const 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; + omega_star = magVorticity * ds / magUr; + alphaStar = 0.5 * omega_star; + epsilonSqr = omega_star / Rep; + epsilon = sqrt(epsilonSqr); //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) ); + J_star = -140.0 * epsilonSqr * epsilonSqr * epsilon * log(1. / (epsilonSqr+SMALL)); } else if(epsilon > 20) { @@ -198,9 +199,10 @@ void MeiLift::setForce() const //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; + scalar sqrtRep = sqrt(Rep); + Cl_star = 1.0 - (0.675 + 0.15 * (1.0 + tanh(0.28 * (alphaStar - 2.0)))) * tanh(0.18 * sqrtRep); + Omega_eq = alphaStar * (1.0 - 0.0075 * Rew) * (1.0 - 0.062 * sqrtRep - 0.001 * Rep); + Cl += Omega_eq * Cl_star; } lift = 0.125*M_PI From 68d90352255c49d1dd92e42c0e5b26cb869f14df Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 14:20:51 +0200 Subject: [PATCH 07/18] clean up formatting, add some comments --- .../subModels/forceModel/MeiLift/MeiLift.C | 76 ++++++++++++------- .../subModels/forceModel/MeiLift/MeiLift.H | 25 +++--- 2 files changed, 64 insertions(+), 37 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C index aa184dc0..c753e8c1 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.C @@ -5,7 +5,8 @@ www.cfdem.com Christoph Goniva, christoph.goniva@cfdem.com Copyright 2009-2012 JKU Linz - Copyright 2012- DCS Computing GmbH, Linz + Copyright 2012-2015 DCS Computing GmbH, Linz + Copyright 2015- JKU Linz ------------------------------------------------------------------------------- License This file is part of CFDEMcoupling. @@ -27,6 +28,20 @@ License 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). + + This function is based on the derivation in R. Mei, + An approximate expression for shear lift force on a spherical particle at a + finite Reynolds number, + Int. J. Multiph. Flow 18 (1992) 145–147 + + 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 E. Loth and A. J. Dorgan, + An equation of motion for particles of finite Reynolds number and size, + Environ. Fluid Mech. 9 (2009) 187–206 + and can be added to the lift coefficient if desired \*---------------------------------------------------------------------------*/ #include "error.H" @@ -84,11 +99,11 @@ MeiLift::MeiLift //Append the field names to be probed particleCloud_.probeM().initialize(typeName, typeName+".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().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(); } @@ -135,7 +150,7 @@ void MeiLift::setForce() const #include "setupProbeModel.H" - for(int index = 0; index < particleCloud_.numberOfParticles(); ++index) + for (int index = 0; index < particleCloud_.numberOfParticles(); ++index) { //if(mask[index][0]) //{ @@ -146,18 +161,16 @@ void MeiLift::setForce() const { Us = particleCloud_.velocity(index); - if( forceSubM(0).interpolation() ) + if (forceSubM(0).interpolation()) { position = particleCloud_.position(index); - Ur = UInterpolator_.interpolate(position,cellI) - - Us; + Ur = UInterpolator_.interpolate(position,cellI) - Us; vorticity = VorticityInterpolator_.interpolate(position,cellI); } else { - Ur = U_[cellI] - - Us; - vorticity=vorticityField[cellI]; + Ur = U_[cellI] - Us; + vorticity = vorticityField[cellI]; } magUr = mag(Ur); @@ -165,7 +178,7 @@ void MeiLift::setForce() const if (magUr > 0 && magVorticity > 0) { - ds = 2*particleCloud_.radius(index); + ds = 2. * particleCloud_.radius(index); nuf = nufField[cellI]; rho = rhoField[cellI]; @@ -179,37 +192,48 @@ void MeiLift::setForce() const epsilon = sqrt(epsilonSqr); //Basic model for the correction to the Saffman lift - //Based on McLaughlin (1991) - if(epsilon < 0.1) + //McLaughlin (1991), Mei (1992), Loth and Dorgan (2009) + //J_star = 0.443 * J + if (epsilon < 0.1) //epsilon << 1 { + //McLaughlin (1991), Eq (3.27): J = 32 * pi^2 * epsilon^5 * ln(1 / epsilon^2) J_star = -140.0 * epsilonSqr * epsilonSqr * epsilon * log(1. / (epsilonSqr+SMALL)); } - else if(epsilon > 20) + else if (epsilon > 20.0) //epsilon >> 1 { - J_star = 1.0-0.287/(epsilon*epsilon+SMALL); + //McLaughlin (1991), Eq (3.26): J = 2.255 - 0.6463 / epsilon^2 + J_star = 1.0 - 0.287 / epsilonSqr; } else { + //Mei (1992), Eq (10) + //Loth and Dorgan (2009), Eq (32) 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 + //Loth and Dorgan (2009), Eq (31): Saffman lift-coefficient: ClSaff = 12.92 / pi * epsilon ~ 4.11 * epsilon + //Loth and Dorgan (2009), Eq (32) + Cl = J_star * 4.11 * epsilon; //multiply correction to the basic Saffman model - //Second order terms given by Loth and Dorgan 2009 - if(useSecondOrderTerms_) + //Second order terms given by Loth and Dorgan (2009) + if (useSecondOrderTerms_) { scalar sqrtRep = sqrt(Rep); + //Loth and Dorgan (2009), Eq (34) Cl_star = 1.0 - (0.675 + 0.15 * (1.0 + tanh(0.28 * (alphaStar - 2.0)))) * tanh(0.18 * sqrtRep); + //Loth and Dorgan (2009), Eq (38) Omega_eq = alphaStar * (1.0 - 0.0075 * Rew) * (1.0 - 0.062 * sqrtRep - 0.001 * Rep); + //Loth and Dorgan (2009), Eq (39) Cl += Omega_eq * Cl_star; } - lift = 0.125*M_PI - *rho - *Cl - *magUr*Ur^vorticity/magVorticity - *ds*ds; + //Loth and Dorgan (2009), Eq (27) + lift = 0.125 * constant::mathematical::pi + * rho + * Cl + * magUr * Ur ^ vorticity / magVorticity + * ds * ds; if (modelType_ == "B") { diff --git a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H index 6a6016b9..81ecfaee 100644 --- a/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H +++ b/src/lagrangian/cfdemParticle/subModels/forceModel/MeiLift/MeiLift.H @@ -5,7 +5,8 @@ www.cfdem.com Christoph Goniva, christoph.goniva@cfdem.com Copyright 2009-2012 JKU Linz - Copyright 2012- DCS Computing GmbH, Linz + Copyright 2012-2015 DCS Computing GmbH, Linz + Copyright 2015- JKU Linz ------------------------------------------------------------------------------- License This file is part of CFDEMcoupling. @@ -28,18 +29,20 @@ 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). - 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. + This function is based on the derivation in R. Mei, + An approximate expression for shear lift force on a spherical particle at a + finite Reynolds number, + Int. J. Multiph. Flow 18 (1992) 145–147 - 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 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) + The second order terms are based on E. Loth and A. J. Dorgan, + An equation of motion for particles of finite Reynolds number and size, + Environ. Fluid Mech. 9 (2009) 187–206 + 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) From 1b9f7020ac5cd2253606ef3b9e8566e13decb06c Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:30:51 +0200 Subject: [PATCH 08/18] fix parameter in function call --- .../subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C index 5e016a19..ffe1e65e 100755 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C @@ -249,7 +249,7 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction label partCellId = particleCloud_.mesh().findNearestCell(particlePosList[iPeriodicImage]); particleLabelList.append(partCellId); - buildLabelHashSet(radius, particlePosList[iPeriodicImage], particleLabelList[iPeriodicImage], hashSett, false); + buildLabelHashSet(index, particlePosList[iPeriodicImage], particleLabelList[iPeriodicImage], hashSett, false); } } //end checkPeriodicCells_ From d5fbf402cbd138154c51e0c220f9dd1578023a38 Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:37:16 +0200 Subject: [PATCH 09/18] fix missing include --- src/lagrangian/cfdemParticle/cfdTools/mathExtra.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H b/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H index 2699627d..ee946de0 100644 --- a/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H +++ b/src/lagrangian/cfdemParticle/cfdTools/mathExtra.H @@ -36,11 +36,11 @@ Description #define CFDEM_MATH_EXTRA_H #include -//#include "math.h" #include #include #include #include +#include "mathematicalConstants.H" #define TOLERANCE_ORTHO 1e-10 From 9650aff31800bebde2e62535a666e364c8456f21 Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:40:23 +0200 Subject: [PATCH 10/18] protect against division by zero merged from PUBLIC --- .../voidFractionModel/IBVoidFraction/IBVoidFraction.C | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C index ffe1e65e..59283ac5 100755 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C @@ -129,7 +129,9 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction scalar centreDist = mag(cellCentrePosition - minPeriodicParticlePos); scalar corona = 0.5 * sqrt(3.0) * pow(particleCloud_.mesh().V()[particleCenterCellID], 1./3.); - vector coronaPoint = cellCentrePosition + (cellCentrePosition - minPeriodicParticlePos) * (corona / centreDist); + vector coronaPoint = cellCentrePosition; + if(centreDist > 0.0) + coronaPoint += (cellCentrePosition - minPeriodicParticlePos) * (corona / centreDist); if (pointInParticle(index, minPeriodicParticlePos, coronaPoint) < 0.0) { @@ -317,7 +319,9 @@ void IBVoidFraction::buildLabelHashSet scalar fc = pointInParticle(index, position, cellCentrePosition); scalar corona = 0.5 * sqrt(3.0) * pow(particleCloud_.mesh().V()[neighbor], 1./3.); - vector coronaPoint = cellCentrePosition + (cellCentrePosition - position) * (corona / centreDist); + vector coronaPoint = cellCentrePosition; + if (centreDist > 0.0) + coronaPoint += (cellCentrePosition - position) * (corona / centreDist); if (!hashSett.found(neighbor) && pointInParticle(index, position, coronaPoint) < 0.0) { From 683fd04828cce2eb69762e7132118c4eb0ddd67f Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:42:13 +0200 Subject: [PATCH 11/18] pre-calculate sqrt(3.0) merged from PUBLIC --- .../voidFractionModel/IBVoidFraction/IBVoidFraction.C | 7 ++++--- .../voidFractionModel/IBVoidFraction/IBVoidFraction.H | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C index 59283ac5..4bfadbd0 100755 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.C @@ -66,7 +66,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"))), + sqrtThree_(sqrt(3.0)) { Info << "\n\n W A R N I N G - do not use in combination with differentialRegion model!\n\n" << endl; maxCellsPerParticle_ = readLabel(propsDict_.lookup("maxCellsPerParticle")); @@ -128,7 +129,7 @@ void IBVoidFraction::setvoidFraction(double** const& mask,double**& voidfraction } scalar centreDist = mag(cellCentrePosition - minPeriodicParticlePos); - scalar corona = 0.5 * sqrt(3.0) * pow(particleCloud_.mesh().V()[particleCenterCellID], 1./3.); + scalar corona = 0.5 * sqrtThree_ * pow(particleCloud_.mesh().V()[particleCenterCellID], 1./3.); vector coronaPoint = cellCentrePosition; if(centreDist > 0.0) coronaPoint += (cellCentrePosition - minPeriodicParticlePos) * (corona / centreDist); @@ -318,7 +319,7 @@ void IBVoidFraction::buildLabelHashSet scalar centreDist = mag(cellCentrePosition-position); scalar fc = pointInParticle(index, position, cellCentrePosition); - scalar corona = 0.5 * sqrt(3.0) * pow(particleCloud_.mesh().V()[neighbor], 1./3.); + scalar corona = 0.5 * sqrtThree_ * pow(particleCloud_.mesh().V()[neighbor], 1./3.); vector coronaPoint = cellCentrePosition; if (centreDist > 0.0) coronaPoint += (cellCentrePosition - position) * (corona / centreDist); diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.H b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.H index e2072025..0e430dc9 100755 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.H +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/IBVoidFraction/IBVoidFraction.H @@ -68,6 +68,8 @@ private: const scalar scaleUpVol_; //NP scaling radius, keeping volume of particle + const scalar sqrtThree_; + public: //- Runtime type information From f946c5765f113d63de854702e1a21199ae4b6bfb Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:43:19 +0200 Subject: [PATCH 12/18] use const variable from mathExtra.H --- .../voidFractionModel/GaussVoidFraction/GaussVoidFraction.C | 4 ++-- .../bigParticleVoidFraction/bigParticleVoidFraction.C | 4 ++-- .../centreVoidFraction/centreVoidFraction.C | 4 ++-- .../dividedVoidFraction/dividedVoidFraction.H | 5 +++-- .../trilinearVoidFraction/trilinearVoidFraction.C | 5 ++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C index 231e7e97..3553decf 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C @@ -30,7 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - +#include "mathExtra.H" #include "GaussVoidFraction.H" #include "addToRunTimeSelectionTable.H" #include "locateModel.H" @@ -115,7 +115,7 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract label particleCenterCellID=particleCloud_.cellIDs()[index][0]; radius = particleCloud_.radius(index); - volume = 4.188790205*radius*radius*radius*scaleVol; + volume = constant::mathematical::fourPiByThree*radius*radius*radius*scaleVol; radius *= scaleRadius; vector positionCenter=particleCloud_.position(index); diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/bigParticleVoidFraction/bigParticleVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/bigParticleVoidFraction/bigParticleVoidFraction.C index 63405dca..d176668f 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/bigParticleVoidFraction/bigParticleVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/bigParticleVoidFraction/bigParticleVoidFraction.C @@ -30,7 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - +#include "mathExtra.H" #include "bigParticleVoidFraction.H" #include "addToRunTimeSelectionTable.H" #include "locateModel.H" @@ -113,7 +113,7 @@ void bigParticleVoidFraction::setvoidFraction(double** const& mask,double**& voi //collecting data label particleCenterCellID=particleCloud_.cellIDs()[index][0]; radius = particleCloud_.radius(index); - volume = 4.188790205*radius*radius*radius*scaleVol; + volume = constant::mathematical::fourPiByThree*radius*radius*radius*scaleVol; radius *= scaleRadius; vector positionCenter=particleCloud_.position(index); diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/centreVoidFraction/centreVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/centreVoidFraction/centreVoidFraction.C index a9237811..0f1fb2bf 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/centreVoidFraction/centreVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/centreVoidFraction/centreVoidFraction.C @@ -30,8 +30,8 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "centreVoidFraction.H" +#include "mathExtra.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -101,7 +101,7 @@ void centreVoidFraction::setvoidFraction(double** const& mask,double**& voidfrac { cellVol = voidfractionNext_.mesh().V()[cellI]; radius = particleCloud_.radius(index); - volume = 4.188790205*radius*radius*radius*scaleVol; + volume = constant::mathematical::fourPiByThree*radius*radius*radius*scaleVol; // store volume for each particle particleVolumes[index][0] = volume; diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.H b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.H index 9f4d91a4..e14062fb 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.H +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/dividedVoidFraction/dividedVoidFraction.H @@ -39,6 +39,7 @@ SourceFiles #ifndef dividedVoidFraction_H #define dividedVoidFraction_H +#include "mathExtra.H" #include "voidFractionModel.H" #include "interpolationCellPoint.H" @@ -79,8 +80,8 @@ private: virtual inline scalar Vp(int index, scalar radius, scalar scaleVol) const { - return 4.188790205*radius*radius*radius*scaleVol; //4/3*pi=4.188790205 - }; + return constant::mathematical::fourPiByThree*radius*radius*radius*scaleVol; + } public: diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/trilinearVoidFraction/trilinearVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/trilinearVoidFraction/trilinearVoidFraction.C index b58e6ad7..5e395e31 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/trilinearVoidFraction/trilinearVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/trilinearVoidFraction/trilinearVoidFraction.C @@ -29,7 +29,7 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - +#include "mathExtra.H" #include "trilinearVoidFraction.H" #include "addToRunTimeSelectionTable.H" @@ -95,7 +95,6 @@ void trilinearVoidFraction::setvoidFraction(double** const& mask,double**& voidf scalar radius(-1.); scalar volume(0.); const scalar scaleVol = weight(); - const scalar fourPiByThree = 4.0*constant::mathematical::pi/3.0; vector partPos(0.,0.,0.); vector pt(0.,0.,0.); @@ -141,7 +140,7 @@ void trilinearVoidFraction::setvoidFraction(double** const& mask,double**& voidf if (cellI >= 0) // particel centre is in domain { radius = particleCloud_.radius(index); - volume = fourPiByThree * radius * radius * radius * scaleVol; + volume = constant::mathematical::fourPiByThree * radius * radius * radius * scaleVol; // store volume for each particle particleVolumes[index][0] = volume; From 8b3878de653c20a3d1a83c5b61a1216d74f95e1a Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:57:22 +0200 Subject: [PATCH 13/18] abort on Gauss void fraction model merged from PUBLIC --- .../voidFractionModel/GaussVoidFraction/GaussVoidFraction.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C index 3553decf..41dcc94a 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C @@ -69,7 +69,7 @@ GaussVoidFraction::GaussVoidFraction alphaLimited_(0) { 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; + FatalError << "\n\n This model does not yet work properly! \n\n" << endl; //reading maxCellsPerParticle from dictionary maxCellsPerParticle_=readLabel(propsDict_.lookup("maxCellsPerParticle")); From 4e50b3e06c470b9326783fc6bd21554dd88728e6 Mon Sep 17 00:00:00 2001 From: danielque Date: Mon, 28 Aug 2017 15:57:45 +0200 Subject: [PATCH 14/18] clean up whitespaces --- .../GaussVoidFraction/GaussVoidFraction.C | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C index 41dcc94a..3964b074 100644 --- a/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C +++ b/src/lagrangian/cfdemParticle/subModels/voidFractionModel/GaussVoidFraction/GaussVoidFraction.C @@ -119,8 +119,8 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract radius *= scaleRadius; vector positionCenter=particleCloud_.position(index); - scalar core; - scalar dist; + scalar core; + scalar dist; if (particleCenterCellID >= 0) { @@ -151,8 +151,8 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract //==========================// //setting the voidfractions - dist = mag(particleCloud_.mesh().C()[particleCenterCellID]-particleCloud_.position(index)); - core = pow(2.0/radius/radius/M_PI,1.5)*exp(-dist*dist/2.0/radius/radius)*particleCloud_.mesh().V()[particleCenterCellID]; + dist = mag(particleCloud_.mesh().C()[particleCenterCellID]-particleCloud_.position(index)); + core = pow(2.0/radius/radius/M_PI,1.5)*exp(-dist*dist/2.0/radius/radius)*particleCloud_.mesh().V()[particleCenterCellID]; // volume occupied in every covered cell scalar occupiedVolume = volume*core; @@ -164,8 +164,8 @@ void GaussVoidFraction::setvoidFraction(double** const& mask,double**& voidfract particleVolumes[index][0] += occupiedVolume; particleV[index][0] += occupiedVolume; - //Info << "Centre:set voidfraction in cellI=" << particleCenterCellID - // << ", voidfraction =" << voidfractionNext_[particleCenterCellID] << endl; + //Info << "Centre:set voidfraction in cellI=" << particleCenterCellID + // << ", voidfraction =" << voidfractionNext_[particleCenterCellID] << endl; // correct volumefraction of sub-cells for(label i=0;i Date: Mon, 28 Aug 2017 18:01:56 +0200 Subject: [PATCH 17/18] pre-generate satellite points in engineSearchIB mostly merged from PUBLIC --- .../engineSearchIB/engineSearchIB.C | 63 +++++++++++-------- .../engineSearchIB/engineSearchIB.H | 18 ++++++ 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C index e1876bb7..7450514b 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C @@ -67,8 +67,16 @@ 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"))), + thetaSize_(180./zSplit_), + phiSize_(360./xySplit_), + deg2rad_(constant::mathematical::pi/180.), + numberOfSatellitePoints_((zSplit_-1)*xySplit_ + 2) { + for(int countPoints = 0; countPoints < numberOfSatellitePoints_; ++countPoints) + { + satellitePoints_.push_back(generateSatellitePoint(countPoints)); + } } @@ -111,34 +119,11 @@ label engineSearchIB::findCell //mod by alice upon from here if(cellIDs[index][0] < 0) { - vector pos = position; label altStartPos = -1; - label numberOfPoints = (zSplit_-1)*xySplit_ + 2; // 1 point at bottom, 1 point at top - label thetaLevel = 0; - scalar theta, phi; - const scalar thetaSize = 180./zSplit_, phiSize = 360./xySplit_; - const scalar deg2rad = M_PI/180.; - for(int countPoints = 0; countPoints < numberOfPoints; ++countPoints) + for(int countPoints = 0; countPoints < numberOfSatellitePoints_; ++countPoints) { - pos = position; - if(countPoints == 0) - { - pos[2] += radius; - } - else if(countPoints == 1) - { - pos[2] -= radius; - } - else - { - thetaLevel = (countPoints - 2) / xySplit_; - theta = deg2rad * thetaSize * (thetaLevel+1); - phi = deg2rad * phiSize * (countPoints - 2 - thetaLevel*xySplit_); - pos[0] += radius * sin(theta) * cos(phi); - pos[1] += radius * sin(theta) * sin(phi); - pos[2] += radius * cos(theta); - } + vector pos = getSatellitePoint(index, countPoints); altStartPos=findSingleCell(pos,oldID); //particleCloud_.mesh().findCell(pos);// //check for periodic domains @@ -171,6 +156,32 @@ label engineSearchIB::findCell return 1; } +vector engineSearchIB::generateSatellitePoint(int countPoints) const +{ + // 1 point at bottom, 1 point at top + if(countPoints == 0) + { + return vector(0., 0., 1.); + } + else if(countPoints == 1) + { + return vector(0., 0., -1.); + } + else + { + const scalar thetaLevel = (countPoints - 2) / xySplit_; + const scalar theta = deg2rad_ * thetaSize_ * (thetaLevel + 1); + const scalar phi = deg2rad_ * phiSize_ * (countPoints - 2 - thetaLevel * xySplit_); + return vector(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta)); + } +} + +vector engineSearchIB::getSatellitePoint(int index, int countPoints) const +{ + return particleCloud_.position(index) + + particleCloud_.radius(index) * satellitePoints_[countPoints]; +} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H index 7faf6785..25ce9c6b 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H @@ -63,6 +63,13 @@ private: const label xySplit_; + const scalar thetaSize_; + const scalar phiSize_; + const scalar deg2rad_; + + const label numberOfSatellitePoints_; + + std::vector satellitePoints_; public: @@ -93,6 +100,17 @@ public: int size ) const; +private: + vector generateSatellitePoint + ( + int countPoints + ) const; + + vector getSatellitePoint + ( + int index, + int countPoints + ) const; }; From c4bb208a6aedfe6634ce3adc232b0f061939ba1c Mon Sep 17 00:00:00 2001 From: danielque Date: Tue, 29 Aug 2017 09:26:24 +0200 Subject: [PATCH 18/18] remove unneeded include and clean up whitespaces --- .../engineSearchIB/engineSearchIB.C | 58 +++++++++---------- .../engineSearchIB/engineSearchIB.H | 8 +-- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C index 7450514b..a4b95a3f 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.C @@ -30,14 +30,10 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - - #include "engineSearchIB.H" #include "addToRunTimeSelectionTable.H" #include "mathematicalConstants.H" -#include - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -64,16 +60,16 @@ engineSearchIB::engineSearchIB cfdemCloud& sm ) : - engineSearch(dict.subDict(typeName + "Props"),sm), + engineSearch(dict.subDict(typeName + "Props"), sm), propsDict_(dict.subDict(typeName + "Props")), zSplit_(readLabel(propsDict_.lookup("zSplit"))), xySplit_(readLabel(propsDict_.lookup("xySplit"))), thetaSize_(180./zSplit_), phiSize_(360./xySplit_), deg2rad_(constant::mathematical::pi/180.), - numberOfSatellitePoints_((zSplit_-1)*xySplit_ + 2) + numberOfSatellitePoints_((zSplit_-1)*xySplit_+2) { - for(int countPoints = 0; countPoints < numberOfSatellitePoints_; ++countPoints) + for (int countPoints = 0; countPoints < numberOfSatellitePoints_; ++countPoints) { satellitePoints_.push_back(generateSatellitePoint(countPoints)); } @@ -101,69 +97,70 @@ label engineSearchIB::findCell const boundBox& globalBb = particleCloud_.mesh().bounds(); vector position; - for(int index = 0;index < size; ++index) + for (int index = 0; index < size; ++index) { - cellIDs[index][0]=-1; - double radius=particleCloud_.radius(index); - //if(mask[index][0] && radius > SMALL) - if(radius > SMALL) + cellIDs[index][0] = -1; + double radius = particleCloud_.radius(index); + + if (radius > SMALL) { // create pos vector - for(int i=0;i<3;i++) position[i] = positions[index][i]; + for (int i = 0; i < 3; i++) position[i] = positions[index][i]; // find cell label oldID = cellIDs[index][0]; - cellIDs[index][0] = findSingleCell(position,oldID); - //cellIDs[index][0] = particleCloud_.mesh().findCell(position); + cellIDs[index][0] = findSingleCell(position, oldID); - //mod by alice upon from here - if(cellIDs[index][0] < 0) + if (cellIDs[index][0] < 0) { label altStartPos = -1; - for(int countPoints = 0; countPoints < numberOfSatellitePoints_; ++countPoints) + for (int countPoints = 0; countPoints < numberOfSatellitePoints_; ++countPoints) { vector pos = getSatellitePoint(index, countPoints); - altStartPos=findSingleCell(pos,oldID); //particleCloud_.mesh().findCell(pos);// + altStartPos = findSingleCell(pos,oldID); + //check for periodic domains - if(checkPeriodicCells) + if (checkPeriodicCells) { - for(int iDir=0;iDir<3;iDir++) + for (int iDir = 0; iDir < 3; iDir++) { - if( pos[iDir] > globalBb.max()[iDir] ) + if (pos[iDir] > globalBb.max()[iDir]) { - pos[iDir]-=globalBb.max()[iDir]-globalBb.min()[iDir]; + pos[iDir] -= globalBb.max()[iDir] - globalBb.min()[iDir]; } - else if( pos[iDir] < globalBb.min()[iDir] ) + else if (pos[iDir] < globalBb.min()[iDir]) { - pos[iDir]+=globalBb.max()[iDir]-globalBb.min()[iDir]; + pos[iDir] += globalBb.max()[iDir] - globalBb.min()[iDir]; } } - altStartPos=findSingleCell(pos,oldID); //particleCloud_.mesh().findCell(pos);// + + altStartPos = findSingleCell(pos, oldID); } - if(altStartPos >= 0) // found position, we're done + if (altStartPos >= 0) // found position, we're done { cellIDs[index][0] = altStartPos; break; } - } + } } } } + return 1; } vector engineSearchIB::generateSatellitePoint(int countPoints) const { // 1 point at bottom, 1 point at top - if(countPoints == 0) + if (countPoints == 0) { return vector(0., 0., 1.); } - else if(countPoints == 1) + else if (countPoints == 1) { return vector(0., 0., -1.); } @@ -182,7 +179,6 @@ vector engineSearchIB::getSatellitePoint(int index, int countPoints) const + particleCloud_.radius(index) * satellitePoints_[countPoints]; } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H index 25ce9c6b..8dbdb4e7 100644 --- a/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H +++ b/src/lagrangian/cfdemParticle/subModels/locateModel/engineSearchIB/engineSearchIB.H @@ -47,7 +47,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noDrag Declaration + Class engineSearchIB Declaration \*---------------------------------------------------------------------------*/ class engineSearchIB @@ -59,10 +59,10 @@ private: dictionary propsDict_; - const label zSplit_; + const label zSplit_; + + const label xySplit_; - const label xySplit_; - const scalar thetaSize_; const scalar phiSize_; const scalar deg2rad_;