diff --git a/README b/README new file mode 100644 index 00000000..a677e0a8 --- /dev/null +++ b/README @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + CFDEMcoupling - Open Source CFD-DEM coupling + + CFDEMcoupling is part of the CFDEMproject + www.cfdem.com + Christoph Goniva, christoph.goniva@cfdem.com + Copyright 2009-2012 JKU Linz + Copyright 2012- DCS Computing GmbH, Linz +------------------------------------------------------------------------------- +License + This file is part of CFDEMcoupling. + + CFDEMcoupling is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + CFDEMcoupling is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with CFDEMcoupling; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Description + This code is designed to realize coupled CFD-DEM simulations using LIGGGHTS + and OpenFOAM. Note: this code is not part of OpenFOAM (see DISCLAIMER). +\*---------------------------------------------------------------------------*/ + + +CFDEM coupling provides an open source parallel coupled CFD-DEM framework +combining the strengths of LIGGGHTS DEM code and the Open Source +CFD package OpenFOAM(R)(*). The CFDEMcoupling toolbox allows to expand +standard CFD solvers of OpenFOAM(R)(*) to include a coupling to the DEM +code LIGGGHTS. In this toolbox the particle representation within the +CFD solver is organized by "cloud" classes. Key functionalities are organised +in sub-models (e.g. force models, data exchange models, etc.) which can easily +be selected and combined by dictionary settings. + +The coupled solvers run fully parallel on distributed-memory clusters. + +Features are: + +- its modular approach allows users to easily implement new models +- its MPI parallelization enables to use it for large scale problems +- the "forum"_lws on CFD-DEM gives the possibility to exchange with other + users / developers +- the use of GIT allows to easily update to the latest version +- basic documentation is provided + +The file structure: + +- "src" directory including the source files of the coupling toolbox and models +- "applications" directory including the solver files for coupled CFD-DEM simulations +- "doc" directory including the documentation of CFDEMcoupling +- "tutorials" directory including basic tutorial cases showing the functionality + + + +Details on installation are given on the "www.cfdem.com" + +The functionality of this CFD-DEM framwork is described via "tutorial cases" showing +how to use different solvers and models. + +CFDEMcoupling stands for Computational Fluid Dynamics (CFD) - +Discrete Element Method (DEM) coupling. + +CFDEMcoupling is an open-source code, distributed freely under the terms of the +GNU Public License (GPL). + +Core development of CFDEMcoupling is done by +Christoph Goniva and Christoph Kloss, both at DCS Computing GmbH, 2012 + + +\*---------------------------------------------------------------------------*/ +(*) "OpenFOAM(R)"_of is a registered trade mark of Silicon Graphics +International Corp. This offering is not affiliated, approved or endorsed by +Silicon Graphics International Corp., the producer of the OpenFOAM(R) software +and owner of the OpenFOAM(R) trademark. +\*---------------------------------------------------------------------------*/ diff --git a/doc/CFDEMcoupling_Manual.pdf b/doc/CFDEMcoupling_Manual.pdf index 91265556..2ef1ad41 100644 Binary files a/doc/CFDEMcoupling_Manual.pdf and b/doc/CFDEMcoupling_Manual.pdf differ diff --git a/doc/githubAccess_public.pdf b/doc/githubAccess_public.pdf index a03509e9..58a90235 100644 Binary files a/doc/githubAccess_public.pdf and b/doc/githubAccess_public.pdf differ diff --git a/doc/locateModel_turboEngineSearchM2M.html b/doc/locateModel_turboEngineSearchM2M.html index e6f89b6a..5082aaa7 100644 --- a/doc/locateModel_turboEngineSearchM2M.html +++ b/doc/locateModel_turboEngineSearchM2M.html @@ -33,7 +33,7 @@ turboEngineM2MProps { turboEngineProps { - treeSearch false; + treeSearch true; } } diff --git a/doc/locateModel_turboEngineSearchM2M.txt b/doc/locateModel_turboEngineSearchM2M.txt index 9e074348..c126f9f3 100644 --- a/doc/locateModel_turboEngineSearchM2M.txt +++ b/doc/locateModel_turboEngineSearchM2M.txt @@ -30,7 +30,7 @@ turboEngineM2MProps \{ turboEngineProps \{ - treeSearch false; + treeSearch true; \} \} :pre diff --git a/src/lagrangian/cfdemParticle/Make/files b/src/lagrangian/cfdemParticle/Make/files index b26fe6cd..e2411291 100644 --- a/src/lagrangian/cfdemParticle/Make/files +++ b/src/lagrangian/cfdemParticle/Make/files @@ -20,18 +20,33 @@ $(forceModels)/forceModel/forceModel.C $(forceModels)/forceModel/newForceModel.C $(forceModels)/noDrag/noDrag.C $(forceModels)/DiFeliceDrag/DiFeliceDrag.C +$(forceModels)/DiFeliceDragNLift/DiFeliceDragNLift.C $(forceModels)/GidaspowDrag/GidaspowDrag.C $(forceModels)/SchillerNaumannDrag/SchillerNaumannDrag.C $(forceModels)/Archimedes/Archimedes.C $(forceModels)/ArchimedesIB/ArchimedesIB.C $(forceModels)/interface/interface.C $(forceModels)/ShirgaonkarIB/ShirgaonkarIB.C +$(forceModels)/fieldTimeAverage/fieldTimeAverage.C +$(forceModels)/fieldBound/fieldBound.C +$(forceModels)/volWeightedAverage/volWeightedAverage.C +$(forceModels)/totalMomentumExchange/totalMomentumExchange.C $(forceModels)/KochHillDrag/KochHillDrag.C +$(forceModels)/BeetstraDrag/multiphaseFlowBasic/multiphaseFlowBasic.C +$(forceModels)/BeetstraDrag/BeetstraDrag.C +$(forceModels)/LaEuScalarLiquid/LaEuScalarLiquid.C $(forceModels)/LaEuScalarTemp/LaEuScalarTemp.C +$(forceModels)/LaEuScalarDust/LaEuScalarDust.C $(forceModels)/virtualMassForce/virtualMassForce.C $(forceModels)/gradPForce/gradPForce.C +$(forceModels)/gradULiftForce/gradULiftForce.C $(forceModels)/viscForce/viscForce.C $(forceModels)/MeiLift/MeiLift.C +$(forceModels)/KochHillDragNLift/KochHillDragNLift.C +$(forceModels)/solidsPressureForce/solidsPressureForce.C +$(forceModels)/periodicPressure/periodicPressure.C +$(forceModels)/periodicPressureControl/periodicPressureControl.C +$(forceModels)/averageSlipVel/averageSlipVel.C $(forceModelsMS)/forceModelMS/forceModelMS.C $(forceModelsMS)/forceModelMS/newForceModelMS.C @@ -42,6 +57,7 @@ $(IOModels)/IOModel/newIOModel.C $(IOModels)/noIO/noIO.C $(IOModels)/basicIO/basicIO.C $(IOModels)/trackIO/trackIO.C +$(IOModels)/sophIO/sophIO.C $(voidFractionModels)/voidFractionModel/voidFractionModel.C $(voidFractionModels)/voidFractionModel/newVoidFractionModel.C @@ -57,22 +73,25 @@ $(locateModels)/locateModel/newLocateModel.C $(locateModels)/standardSearch/standardSearch.C $(locateModels)/engineSearch/engineSearch.C $(locateModels)/turboEngineSearch/turboEngineSearch.C +$(locateModels)/turboEngineSearchM2M/turboEngineSearchM2M.C $(locateModels)/engineSearchIB/engineSearchIB.C - $(meshMotionModels)/meshMotionModel/meshMotionModel.C $(meshMotionModels)/meshMotionModel/newMeshMotionModel.C $(meshMotionModels)/noMeshMotion/noMeshMotion.C +$(meshMotionModels)/DEMdrivenMeshMotion/DEMdrivenMeshMotion.C $(momCoupleModels)/momCoupleModel/momCoupleModel.C $(momCoupleModels)/momCoupleModel/newMomCoupleModel.C $(momCoupleModels)/explicitCouple/explicitCouple.C +$(momCoupleModels)/explicitCoupleSource/explicitCoupleSource.C $(momCoupleModels)/implicitCouple/implicitCouple.C $(momCoupleModels)/noCouple/noCouple.C $(regionModels)/regionModel/regionModel.C $(regionModels)/regionModel/newRegionModel.C $(regionModels)/allRegion/allRegion.C +$(regionModels)/differentialRegion/differentialRegion.C $(dataExchangeModels)/dataExchangeModel/dataExchangeModel.C $(dataExchangeModels)/dataExchangeModel/newDataExchangeModel.C @@ -80,6 +99,7 @@ $(dataExchangeModels)/oneWayVTK/oneWayVTK.C $(dataExchangeModels)/twoWayFiles/twoWayFiles.C $(dataExchangeModels)/noDataExchange/noDataExchange.C $(dataExchangeModels)/twoWayMPI/twoWayMPI.C +$(dataExchangeModels)/twoWayM2M/twoWayM2M.C $(averagingModels)/averagingModel/averagingModel.C $(averagingModels)/averagingModel/newAveragingModel.C diff --git a/src/lagrangian/cfdemParticle/Make/options b/src/lagrangian/cfdemParticle/Make/options index e24e4695..eb5d1463 100644 --- a/src/lagrangian/cfdemParticle/Make/options +++ b/src/lagrangian/cfdemParticle/Make/options @@ -13,6 +13,7 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/OpenFOAM/containers/HashTables/labelHashSet \ -I$(CFDEM_LIGGGHTS_SRC_DIR) \ + -I$(CFDEM_M2MLIB_PATH) \ LIB_LIBS = \ $(PLIBS) \ @@ -24,4 +25,6 @@ LIB_LIBS = \ -llagrangian \ -lmpi_cxx \ -L$(CFDEM_LIGGGHTS_SRC_DIR) \ - -l$(CFDEM_LIGGGHTS_LIB_NAME) + -l$(CFDEM_LIGGGHTS_LIB_NAME) \ + -L$(CFDEM_M2MLIB_PATH) \ + -lcouple diff --git a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library/libcouple.a b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library/libcouple.a index b68d5eb3..b9aa4517 100644 Binary files a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library/libcouple.a and b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/library/libcouple.a differ diff --git a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.C b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.C index 6298d243..1102ad66 100644 --- a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.C +++ b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.C @@ -112,16 +112,18 @@ twoWayM2M::twoWayM2M checkTSsize(); // m2m stuff + firstRun_=true; lmp2foam_ = new Many2Many(MPI_COMM_WORLD); lmp2foam_vec_ = new Many2Many(MPI_COMM_WORLD); foam2lmp_vec_ = new Many2Many(MPI_COMM_WORLD); nlocal_lammps_ = -1; id_lammps_ = NULL; - id_lammpsComm_ = NULL; + //id_lammpsComm_ = NULL; id_lammps_vec_ = NULL; nlocal_foam_ = -1; id_foam_ = NULL; id_foam_vec_ = NULL; + pos_lammps_=NULL; nlocal_foam_lost_ = -1; id_foam_lost_ = NULL; id_foam_lost_all = NULL; @@ -130,7 +132,6 @@ twoWayM2M::twoWayM2M lost_pos_all = NULL; cellID_foam_ = NULL; pos_foam_ = NULL; - //Foam::dataExchangeModel::allocateArray(idHashTable_,0,100000);//liggghts_get_maxtag(lmp)); // define idHashTable } @@ -139,7 +140,7 @@ twoWayM2M::twoWayM2M twoWayM2M::~twoWayM2M() { free(id_lammps_); - delete[] id_lammpsComm_; + //delete[] id_lammpsComm_; delete[] id_lammps_vec_; delete[] id_foam_vec_; delete[] id_foam_; @@ -170,7 +171,7 @@ void twoWayM2M::getData ) const { char* charName = wordToChar(name); - if ( type == "vector-atom" && name != "x") + if ( type == "vector-atom")// && name != "x") { //if (nlocal_lammps_>0){ double **tata_ = (double **) lammps_extract_atom(lmp,charName); @@ -181,8 +182,9 @@ void twoWayM2M::getData lmp2foam_vec_->exchange(tata_, &(field[0][0])); }*/ //for (int i = 0; i < nlocal_foam_; i++) + // Pout << "hihi getData: " << name <<"=" << field[i][0]<<","<exchange(tmp_, &(field[0][0])); //for (int i = 0; i < nlocal_foam_; i++) @@ -320,6 +322,7 @@ bool Foam::twoWayM2M::couple() const // m2m stuff particleCloud_.clockM().start(4,"CoupleSyncIDs()"); syncIDs(); + firstRun_=false; particleCloud_.clockM().stop("CoupleSyncIDs()"); // give nr of particles to cloud @@ -349,54 +352,180 @@ int Foam::twoWayM2M::getNumberOfClumps() const void Foam::twoWayM2M::syncIDs() const { + //MPI_Barrier(MPI_COMM_WORLD); + //Pout << "== syncIDs " << endl; + particleCloud_.clockM().start(5,"recv_DEM_ids"); // get data from lammps + int nlocal_lammps_old=nlocal_lammps_; nlocal_lammps_ = *((int *) lammps_extract_global(lmp,"nlocal")); - id_lammps_ = (int *) lammps_extract_atom(lmp,"id"); + + // weak form to detect lmp proc change - this will cause problems!!! + //bool comRun=false; + //if(nlocal_lammps_old != nlocal_lammps_) comRun=true; + //MPI_Allreduce(&comRun, &firstRun_, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); + + int* id_lammps_sync; + double** pos_lammps_sync; + if(firstRun_) // do not forget iterator ! + { + // IDs for vectors + id_lammps_ = (int *) lammps_extract_atom(lmp,"id"); + + delete [] id_lammps_vec_; + Foam::dataExchangeModel::allocateArray(id_lammps_vec_,0,nlocal_lammps_*3); + for (int i = 0; i < nlocal_lammps_; i++) + for (int j=0;j<3;j++) + id_lammps_vec_[i*3+j] = id_lammps_[i]*3+j; + + Foam::dataExchangeModel::allocateArray(pos_lammps_,-1.,3,nlocal_lammps_); // do I need this??? + pos_lammps_ = (double **) lammps_extract_atom(lmp,"x"); + + //for (int i = 0; i < nlocal_lammps_; i++){ + // vector pp; + // for (int j = 0; j < 3; j++) pp[j]=pos_lammps_[i][j]; + // Pout << "pp=" << pp << endl; + //} + + }else + { + // re-arrange data using map + Foam::dataExchangeModel::allocateArray(id_lammps_sync,-1.,nlocal_lammps_); + id_lammps_sync = (int *) lammps_extract_atom(lmp,"id"); + + delete [] id_lammps_vec_; + Foam::dataExchangeModel::allocateArray(id_lammps_vec_,0,nlocal_lammps_*3); + for (int i = 0; i < nlocal_lammps_; i++) + for (int j=0;j<3;j++) + id_lammps_vec_[i*3+j] = id_lammps_sync[i]*3+j; + + // make setup of m2m + lmp2foam_->setup(nlocal_lammps_,id_lammps_sync,nlocal_foam_,id_foam_); + lmp2foam_vec_->setup(nlocal_lammps_*3,id_lammps_vec_,nlocal_foam_*3,id_foam_vec_); + foam2lmp_vec_->setup(nlocal_foam_*3,id_foam_vec_,nlocal_lammps_*3,id_lammps_vec_); + + Foam::dataExchangeModel::allocateArray(id_lammps_,-1,nlocal_foam_); // probably not necessary + lmp2foam_->exchange(id_lammps_sync, id_lammps_); + + + Foam::dataExchangeModel::allocateArray(pos_lammps_sync,-1.,3,nlocal_lammps_); // probably not necessary + pos_lammps_sync = (double **) lammps_extract_atom(lmp,"x"); + + // find better solution here!!! + double** gugu; + Foam::dataExchangeModel::allocateArray(gugu,-1.,3*nlocal_foam_,1); + Foam::dataExchangeModel::allocateArray(pos_lammps_,-1.,3,nlocal_foam_); + lmp2foam_vec_->exchange(&(pos_lammps_sync[0][0]), &(gugu[0][0])); + + // try the same with getData + //double** gugu; + //Foam::dataExchangeModel::allocateArray(gugu,-1.,3,nlocal_foam_); + //Foam::dataExchangeModel::allocateArray(pos_lammps_,-1.,3,nlocal_foam_); + //getData("x","vector-atom",gugu,1); + + // conversion of array (should not be necessary if above problem is solved) + for (int i = 0; i < nlocal_foam_; i++) + for (int j = 0; j < 3; j++) + pos_lammps_[i][j]=gugu[0][i*3+j]; + + /*// test communication - works!!! + int* llv; + int* ovv; + Many2Many* l2f = new Many2Many(MPI_COMM_WORLD); + double** gaga; + if(Pstream::myProcNo()==0) + { + Foam::dataExchangeModel::allocateArray(llv,0,6); + Foam::dataExchangeModel::allocateArray(ovv,0,1); + for(int i=0;i<6;i++) + llv[i]=i+1; + ovv[0]=-1; + l2f->setup(6,llv,0,ovv); + l2f->exchange(&(pos_lammps_sync[0][0]), &(gaga[0][0])); + }else{ + Foam::dataExchangeModel::allocateArray(llv,0,1); + Foam::dataExchangeModel::allocateArray(ovv,0,6); + for(int i=0;i<6;i++) + ovv[i]=i+1; + llv[0]=-1; + l2f->setup(0,llv,6,ovv); + + double** gugu; + Foam::dataExchangeModel::allocateArray(gaga,-1.,3,2); + Foam::dataExchangeModel::allocateArray(gugu,-1.,3,2); + l2f->exchange(&(pos_lammps_sync[0][0]), &(gugu[0][0])); + + // this does not work! -conversion needed! + //for (int i = 0; i < 2; i++) + // Pout << "getDataXX: " << "v" <<"=" << gugu[i][0]<<","<< gugu[i][1]<<","<< gugu[i][2]<setup(nlocal_lammps_,id_lammpsComm_,nlocal_foam_,id_foam_); - lmp2foam_vec_->setup(nlocal_lammps_*3,id_lammps_vec_,nlocal_foam_*3,id_foam_vec_); - foam2lmp_vec_->setup(nlocal_foam_*3,id_foam_vec_,nlocal_lammps_*3,id_lammps_vec_); + if(firstRun_) + { + //lmp2foam_->setup(nlocal_lammps_,id_lammpsComm_,nlocal_foam_,id_foam_); + lmp2foam_->setup(nlocal_lammps_,id_lammps_,nlocal_foam_,id_foam_); + lmp2foam_vec_->setup(nlocal_lammps_*3,id_lammps_vec_,nlocal_foam_*3,id_foam_vec_); + foam2lmp_vec_->setup(nlocal_foam_*3,id_foam_vec_,nlocal_lammps_*3,id_lammps_vec_); + }else + { + //lmp2foam_->setup(nlocal_lammps_,id_lammpsComm_,nlocal_foam_,id_foam_); + lmp2foam_->setup(nlocal_lammps_,id_lammps_sync,nlocal_foam_,id_foam_); + lmp2foam_vec_->setup(nlocal_lammps_*3,id_lammps_vec_,nlocal_foam_*3,id_foam_vec_); + foam2lmp_vec_->setup(nlocal_foam_*3,id_foam_vec_,nlocal_lammps_*3,id_lammps_vec_); + } particleCloud_.clockM().stop("setup_Comm"); } @@ -428,9 +557,6 @@ void Foam::twoWayM2M::locateParticle() const delete [] id_foam_vec_; Foam::dataExchangeModel::allocateArray(id_foam_vec_,0,nop*3); - delete [] id_lammps_vec_; - Foam::dataExchangeModel::allocateArray(id_lammps_vec_,0,nop*3); - delete [] cellID_foam_; Foam::dataExchangeModel::allocateArray(cellID_foam_,0,nop); delete [] pos_foam_; @@ -446,10 +572,11 @@ void Foam::twoWayM2M::locateParticle() const } } - // if global nr of particles changed: - // realloc idHashTable_ - // loop all lmp particles + int iterate; + if(firstRun_) iterate=nlocal_lammps_; + else iterate=nlocal_foam_; + nlocal_foam_ = 0; nlocal_foam_lost_ = 0; vector pos; @@ -457,16 +584,15 @@ void Foam::twoWayM2M::locateParticle() const label searchCellID; particleCloud_.clockM().start(7,"locate_Stage1"); - for (int i = 0; i < nlocal_lammps_; i++) + + for (int i = 0; i < iterate; i++) { pos = vector(pos_lammps_[i][0],pos_lammps_[i][1],pos_lammps_[i][2]); - searchCellID = -1;//idHashTable_[id_lammps_[i]]; + searchCellID = -1; + //Pout << "stage1 looking for particle pos="<< pos << endl; + cellID = particleCloud_.locateM().findSingleCell(pos,searchCellID); - // IDs for vectors - for (int j=0;j<3;j++) - id_lammps_vec_[i*3+j] = id_lammps_[i]*3+j; - // found particle on cfd proc if (cellID >= 0) { @@ -481,11 +607,8 @@ void Foam::twoWayM2M::locateParticle() const } cellID_foam_[nlocal_foam_] = cellID; - // cell id hash table - //idHashTable_[id_lammps_[i]]=cellID; - nlocal_foam_ += 1; - //Pout << "found particle at pos=" << pos << endl; + //Pout << "stage1 found particle at pos=" << pos << endl; } else { @@ -502,14 +625,23 @@ void Foam::twoWayM2M::locateParticle() const // using allgather to allreduce lost particles particleCloud_.clockM().start(8,"locate_Stage2"); + + // we could add this here - but some arrays must be init + //int lost_all; + //MPI_Allreduce(&nlocal_foam_lost_, &lost_all, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); + //if(lost_all>0) + + int nlocal_foam_lost_all = LAMMPS_NS::MPI_Allgather_Vector(lost_pos_, nlocal_foam_lost_*3, lost_pos_all, MPI_COMM_WORLD)/3; LAMMPS_NS::MPI_Allgather_Vector(id_foam_lost_, nlocal_foam_lost_, id_foam_lost_all, MPI_COMM_WORLD); + Info << couplingStep_ << "st nlocal_foam_lost_all=" << nlocal_foam_lost_all << endl; // locate lost particles for (int i = 0; i < nlocal_foam_lost_all; i++) { pos = vector(lost_pos_all[i*3+0],lost_pos_all[i*3+1],lost_pos_all[i*3+2]); - searchCellID = -1;//idHashTable_[id_foam_lost_all[i]]; + //Pout << "stage2 looking for particle pos="<< pos << endl; + searchCellID = -1; particleCloud_.clockM().start(9,"findSingleCell"); cellID = particleCloud_.locateM().findSingleCell(pos,searchCellID); particleCloud_.clockM().stop("findSingleCell"); @@ -531,10 +663,8 @@ void Foam::twoWayM2M::locateParticle() const // mark that ID was finally found id_foam_lost_all[i]=-1; - // cell id hash table - //idHashTable_[id_foam_lost_all[i]]=cellID; - nlocal_foam_ += 1; + //Pout << "stage2 found particle at pos=" << pos << endl; } } particleCloud_.clockM().stop("locate_Stage2"); @@ -560,7 +690,7 @@ void Foam::twoWayM2M::locateParticle() const // re-arrange IDs for vectors for (int k=0;k<3;k++) { - id_lammps_vec_[j*3+k] = id_lammps_vec_[(nlocal_lammps_-1)*3+k]; + id_lammps_vec_[j*3+k] = id_lammps_vec_[nlocal_lammps_*3+k]; } nlocal_lammps_ -= 1; @@ -570,7 +700,7 @@ void Foam::twoWayM2M::locateParticle() const } i++; } - particleCloud_.clockM().stop("locate_Stage3");*/ + particleCloud_.clockM().stop("locate_Stage3");*/ /*int gaga; MPI_Allreduce(&nlocal_foam_, &gaga, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); diff --git a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.H b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.H index 68441ac7..8c9be08b 100644 --- a/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.H +++ b/src/lagrangian/cfdemParticle/subModels/dataExchangeModel/twoWayM2M/twoWayM2M.H @@ -89,12 +89,13 @@ private: dictionary propsDict_; // new vars + mutable bool firstRun_; mutable Many2Many *lmp2foam_; mutable Many2Many *lmp2foam_vec_; mutable Many2Many *foam2lmp_vec_; mutable int nlocal_lammps_; mutable int *id_lammps_; - mutable int *id_lammpsComm_; + //mutable int *id_lammpsComm_; mutable int *id_lammps_vec_; mutable int nlocal_foam_; mutable int *id_foam_; @@ -110,9 +111,6 @@ private: mutable int *cellID_foam_; mutable double *pos_foam_; - // optimization - //mutable int *idHashTable_; - // variables int me;