mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
release on 2013-01-07_19-24-25
This commit is contained in:
82
README
82
README
@ -1,82 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
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.
|
||||
\*---------------------------------------------------------------------------*/
|
||||
Binary file not shown.
@ -433,6 +433,8 @@ Reasonable example settings for the "liggghtsCommands" dictionary are given in t
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -166,4 +166,10 @@ CFDEMcoupling-PUBLIC-$WM_PROJECT_VERSION
|
||||
</P>
|
||||
<P>(see http://stackoverflow.com/questions/3777075/https-github-access)
|
||||
</P>
|
||||
<P><B>c)</B> If you face the error: "Agent admitted failure to sign using the key. Permission denied (publickey).", after ssh -T git@github.com
|
||||
</P>
|
||||
<P>please type: "ssh-add"
|
||||
</P>
|
||||
<P>(see: https://help.github.com/articles/error-agent-admitted-failure-to-sign)
|
||||
</P>
|
||||
</HTML>
|
||||
|
||||
Binary file not shown.
@ -150,3 +150,9 @@ please use: env GIT_SSL_NO_VERIFY=true git clone https://github...
|
||||
|
||||
(see http://stackoverflow.com/questions/3777075/https-github-access)
|
||||
|
||||
|
||||
[c)] If you face the error: "Agent admitted failure to sign using the key. Permission denied (publickey).", after ssh -T git@github.com
|
||||
|
||||
please type: "ssh-add"
|
||||
|
||||
(see: https://help.github.com/articles/error-agent-admitted-failure-to-sign)
|
||||
|
||||
@ -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
|
||||
@ -60,20 +76,22 @@ $(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
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
word CFDEMversion="cfdem-2.4.4";
|
||||
word CFDEMversion="cfdem-2.4.5";
|
||||
word compatibleLIGGGHTSversion="2.0.4";
|
||||
|
||||
Info << "\nCFDEMcoupling version: " << CFDEMversion << "\n" << endl;
|
||||
|
||||
@ -230,18 +230,24 @@ Foam::cfdemCloud::cfdemCloud
|
||||
Foam::cfdemCloud::~cfdemCloud()
|
||||
{
|
||||
clockM().evalPar();
|
||||
free(positions_);
|
||||
free(velocities_);
|
||||
free(impForces_);
|
||||
free(expForces_);
|
||||
free(DEMForces_);
|
||||
free(radii_);
|
||||
free(voidfractions_);
|
||||
free(cellIDs_);
|
||||
free(particleWeights_);
|
||||
free(particleVolumes_);
|
||||
free2D(positions_);
|
||||
free2D(velocities_);
|
||||
free2D(impForces_);
|
||||
free2D(expForces_);
|
||||
free2D(DEMForces_);
|
||||
free2D(radii_);
|
||||
free2D(voidfractions_);
|
||||
free2D(cellIDs_);
|
||||
free2D(particleWeights_);
|
||||
free2D(particleVolumes_);
|
||||
}
|
||||
// * * * * * * * * * * * * * * * private Member Functions * * * * * * * * * * * * * //
|
||||
inline void Foam::cfdemCloud::free2D(double** array)
|
||||
{
|
||||
free(array[0]);
|
||||
free(array);
|
||||
}
|
||||
|
||||
void Foam::cfdemCloud::getDEMdata()
|
||||
{
|
||||
dataExchangeM().getData("radius","scalar-atom",radii_);
|
||||
|
||||
@ -165,6 +165,8 @@ protected:
|
||||
autoPtr<liggghtsCommandModel>* liggghtsCommand_;
|
||||
|
||||
// Private member functions
|
||||
inline void free2D(double**);
|
||||
|
||||
virtual void getDEMdata();
|
||||
|
||||
virtual void giveDEMdata();
|
||||
|
||||
@ -107,6 +107,9 @@ alias cfdemCompM2M='bash $CFDEM_SRC_DIR/etc/compileM2Mlib.sh'
|
||||
#- shortcut to test basic tutorials
|
||||
alias cfdemTestTUT='bash $CFDEM_SRC_DIR/etc/testTutorials.sh'
|
||||
|
||||
#- recursive touch of current directory
|
||||
alias touchRec='find ./* -exec touch {} \;'
|
||||
|
||||
#- shortcut to run liggghts in serial
|
||||
cfdemLiggghts() { $CFDEM_LIGGGHTS_SRC_DIR/lmp_$CFDEM_LIGGGHTS_MAKEFILE_NAME < $1; }
|
||||
export -f cfdemLiggghts
|
||||
|
||||
@ -313,6 +313,8 @@ parCFDDEMrun()
|
||||
|
||||
if [ $debugMode == "on" ]; then
|
||||
debugMode="valgrind"
|
||||
elif [ $debugMode == "strict" ]; then
|
||||
debugMode="valgrind --leak-check=full -v --trace-children=yes --track-origins=yes"
|
||||
else
|
||||
debugMode=""
|
||||
fi
|
||||
|
||||
@ -62,13 +62,16 @@ basicIO::basicIO
|
||||
:
|
||||
IOModel(dict,sm),
|
||||
//propsDict_(dict.subDict(typeName + "Props")),
|
||||
dirName_("particles"),
|
||||
dirName_("lagrangian"),
|
||||
path_("dev/null"),
|
||||
m2mComm_(false),
|
||||
lagPath_("dev/null")
|
||||
{
|
||||
if (particleCloud_.dataExchangeM().myType()=="twoWayM2M"){m2mComm_=true;} //typeName did not work
|
||||
Info << "particleCloud_.dataExchangeM().typeName=" << particleCloud_.dataExchangeM().myType() << endl;
|
||||
|
||||
//if (propsDict_.found("dirName")) dirName_=word(propsDict_.lookup("dirName"));
|
||||
path_ = buildFilePath(dirName_);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -87,8 +90,12 @@ void basicIO::dumpDEMdata() const
|
||||
if (time_.outputTime())
|
||||
{
|
||||
// make time directory
|
||||
if (m2mComm_) lagPath_=buildFilePath(dirName_);
|
||||
else
|
||||
{
|
||||
lagPath_=createTimeDir(path_);
|
||||
lagPath_=createTimeDir(fileName(lagPath_/"lagrangian"));
|
||||
}
|
||||
|
||||
// stream data to file
|
||||
streamDataToPath(lagPath_, particleCloud_.positions(), particleCloud_.numberOfParticles(), "positions","vector","Cloud<passiveParticle>","0");
|
||||
@ -102,11 +109,19 @@ void basicIO::dumpDEMdata() const
|
||||
fileName basicIO::buildFilePath(word dirName) const
|
||||
{
|
||||
// create file structure
|
||||
fileName path("."/dirName);
|
||||
fileName path("");
|
||||
if(m2mComm_)
|
||||
{
|
||||
path=fileName(particleCloud_.mesh().time().path()/particleCloud_.mesh().time().timeName()/dirName/"particleCloud");
|
||||
mkDir(path,0777);
|
||||
} else
|
||||
{
|
||||
path=fileName("."/dirName);
|
||||
mkDir(path,0777);
|
||||
mkDir(fileName(path/"constant"),0777);
|
||||
OFstream* stubFile = new OFstream(fileName(path/"particles.foam"));
|
||||
delete stubFile;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#define basicIO_H
|
||||
|
||||
#include "IOModel.H"
|
||||
#include "dataExchangeModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -63,6 +64,8 @@ private:
|
||||
|
||||
fileName path_;
|
||||
|
||||
bool m2mComm_;
|
||||
|
||||
// Member Functions
|
||||
fileName buildFilePath(word) const;
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ void Foam::dataExchangeModel::allocateArray
|
||||
int length
|
||||
) const
|
||||
{
|
||||
// allocate and init double array
|
||||
// allocate and init int array
|
||||
array = new int[length];
|
||||
for (int i=0; i<length; i++)
|
||||
array[i] = initVal;
|
||||
|
||||
@ -237,6 +237,7 @@ public:
|
||||
particleCloud_.cellIDs_[i][0]=ID[i];
|
||||
};
|
||||
|
||||
virtual word myType() const=0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -100,6 +100,7 @@ public:
|
||||
const char* datatype = ""
|
||||
) const {};
|
||||
|
||||
word myType() const{return typeName; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -112,6 +112,7 @@ public:
|
||||
const char* datatype = ""
|
||||
) const;
|
||||
|
||||
word myType() const{return typeName; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -117,6 +117,8 @@ public:
|
||||
double ** const& field,
|
||||
const char* datatype = ""
|
||||
) const;
|
||||
|
||||
word myType() const{return typeName; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@ -33,6 +33,7 @@ Description
|
||||
#include "twoWayM2M.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "clockModel.H"
|
||||
#include "memory.h"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -134,6 +135,8 @@ twoWayM2M::twoWayM2M
|
||||
nlocal_foam_ = -1;
|
||||
id_foam_ = NULL;
|
||||
id_foam_vec_ = NULL;
|
||||
tmp_ = NULL;
|
||||
tmpI_ = NULL;
|
||||
pos_lammps_=NULL;
|
||||
nlocal_foam_lost_ = -1;
|
||||
id_foam_lost_ = NULL;
|
||||
@ -152,20 +155,22 @@ twoWayM2M::~twoWayM2M()
|
||||
{
|
||||
//delete[] id_lammps_; // does not work?
|
||||
//delete[] id_lammpsComm_;
|
||||
delete[] id_lammps_vec_;
|
||||
delete[] id_foam_vec_;
|
||||
delete[] id_foam_;
|
||||
delete[] id_foam_lost_;
|
||||
delete[] lost_pos_;
|
||||
delete[] cellID_foam_;
|
||||
delete[] pos_foam_;
|
||||
free(id_lammps_vec_);
|
||||
free(id_foam_vec_);
|
||||
free(id_foam_);
|
||||
free(id_foam_lost_);
|
||||
free(lost_pos_);
|
||||
free(cellID_foam_);
|
||||
free(pos_foam_);
|
||||
//delete& lmp2foam_; // suitable for m2m&
|
||||
//delete& lmp2foam_vec_;
|
||||
//delete& foam2lmp_vec_;
|
||||
delete[] lmp2foam_;
|
||||
delete[] lmp2foam_vec_;
|
||||
delete[] foam2lmp_vec_;
|
||||
//delete lmp;
|
||||
lmp->memory->destroy(tmpI_);
|
||||
lmp->memory->destroy(tmp_);
|
||||
delete lmp2foam_;
|
||||
delete lmp2foam_vec_;
|
||||
delete foam2lmp_vec_;
|
||||
delete lmp;
|
||||
}
|
||||
|
||||
|
||||
@ -191,21 +196,14 @@ void twoWayM2M::getData
|
||||
{
|
||||
double **tata_ = (double **) lammps_extract_atom(lmp,charName);
|
||||
lmp2foam_vec_->exchange(&(tata_[0][0]), &(field[0][0]));
|
||||
//for (int i = 0; i < nlocal_foam_; i++)
|
||||
// Pout << "hihi getData: " << name <<"=" << field[i][0]<<","<<field[i][1]<<","<<field[i][2] <<endl;
|
||||
// Pout << name <<"=" << tata_[i][0]<<","<<tata_[i][1]<<","<<tata_[i][2] <<endl;
|
||||
}else if (name != "x"){
|
||||
//if(nlocal_lammps_>0){
|
||||
tmp_ = (double *) lammps_extract_atom(lmp,charName);
|
||||
/*}else{
|
||||
// might use the fct from dataExchangeModel mother class
|
||||
tmp_=new double[1];
|
||||
tmp_[0]=0;
|
||||
}*/
|
||||
//tmp_ = (double *) lammps_extract_atom(lmp,charName); // funct nicht?
|
||||
double *tmp_ = (double *) lammps_extract_atom(lmp,charName);
|
||||
|
||||
//if(nlocal_lammps_>0)
|
||||
// for (int i = 0; i < nlocal_lammps_; i++)
|
||||
// Pout << couplingStep_ << "st tmp_[" << i << "]=" << tmp_[i] << " - "<<endl;
|
||||
lmp2foam_->exchange(tmp_, &(field[0][0]));
|
||||
//for (int i = 0; i < nlocal_foam_; i++)
|
||||
// Pout << name <<"[0][i]=" << field[0][i] <<endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,6 +253,8 @@ void twoWayM2M::giveData
|
||||
}
|
||||
}
|
||||
|
||||
//============
|
||||
// double **
|
||||
void Foam::twoWayM2M::allocateArray
|
||||
(
|
||||
double**& array,
|
||||
@ -263,8 +263,11 @@ void Foam::twoWayM2M::allocateArray
|
||||
int length
|
||||
) const
|
||||
{
|
||||
//if(length==-1) then LIGGGHTS uses own length data
|
||||
allocate_external_double(array, width,max(length,1),initVal,lmp);
|
||||
int len = max(length,1);
|
||||
lmp->memory->grow(array, len, width, "m2m:data");
|
||||
for (int i = 0; i < len; i++)
|
||||
for (int j = 0; j < width; j++)
|
||||
array[i][j] = initVal;
|
||||
}
|
||||
|
||||
void Foam::twoWayM2M::allocateArray
|
||||
@ -275,7 +278,11 @@ void Foam::twoWayM2M::allocateArray
|
||||
const char* length
|
||||
) const
|
||||
{
|
||||
allocate_external_double(array, width,max(particleCloud_.numberOfParticles(),1),initVal,lmp);
|
||||
int len = max(particleCloud_.numberOfParticles(),1);
|
||||
lmp->memory->grow(array, len, width, "m2m:data");
|
||||
for (int i = 0; i < len; i++)
|
||||
for (int j = 0; j < width; j++)
|
||||
array[i][j] = initVal;
|
||||
}
|
||||
|
||||
//============
|
||||
@ -288,8 +295,11 @@ void Foam::twoWayM2M::allocateArray
|
||||
int length
|
||||
) const
|
||||
{
|
||||
//if(length==-1) then LIGGGHTS uses own length data
|
||||
allocate_external_int(array, width,max(length,1),initVal,lmp);
|
||||
int len = max(length,1);
|
||||
lmp->memory->grow(array, len, width, "m2m:data");
|
||||
for (int i = 0; i < len; i++)
|
||||
for (int j = 0; j < width; j++)
|
||||
array[i][j] = initVal;
|
||||
}
|
||||
|
||||
void Foam::twoWayM2M::allocateArray
|
||||
@ -300,9 +310,32 @@ void Foam::twoWayM2M::allocateArray
|
||||
const char* length
|
||||
) const
|
||||
{
|
||||
allocate_external_int(array, width,max(particleCloud_.numberOfParticles(),1),initVal,lmp);
|
||||
int len = max(particleCloud_.numberOfParticles(),1);
|
||||
lmp->memory->grow(array, len, width, "m2m:data");
|
||||
for (int i = 0; i < len; i++)
|
||||
for (int j = 0; j < width; j++)
|
||||
array[i][j] = initVal;
|
||||
}
|
||||
//============
|
||||
// double *
|
||||
void Foam::twoWayM2M::allocateArray(double*& array, double initVal, int length) const
|
||||
{
|
||||
int len = max(length,1);
|
||||
lmp->memory->grow(array, len, "m2m:data");
|
||||
for (int i = 0; i < len; i++)
|
||||
array[i] = initVal;
|
||||
}
|
||||
//==============
|
||||
// int *
|
||||
void Foam::twoWayM2M::allocateArray(int*& array, int initVal, int length) const
|
||||
{
|
||||
int len = max(length,1);
|
||||
lmp->memory->grow(array, len, "m2m:data");
|
||||
for (int i = 0; i < len; i++)
|
||||
array[i] = initVal;
|
||||
}
|
||||
//==============
|
||||
|
||||
|
||||
bool Foam::twoWayM2M::couple() const
|
||||
{
|
||||
@ -381,48 +414,29 @@ void Foam::twoWayM2M::syncIDs() const
|
||||
|
||||
// get data from lammps
|
||||
nlocal_lammps_ = *((int *) lammps_extract_global(lmp,"nlocal"));
|
||||
int* id_lammps_sync;
|
||||
double** pos_lammps_sync;
|
||||
int* id_lammps_sync=NULL;
|
||||
double** pos_lammps_sync=NULL;
|
||||
if(firstRun_)
|
||||
{
|
||||
// IDs for vectors
|
||||
if(nlocal_lammps_>0){
|
||||
id_lammps_ = (int *) lammps_extract_atom(lmp,"id");
|
||||
}else{
|
||||
// might use the fct from dataExchangeModel mother class
|
||||
id_lammps_=new int[1];
|
||||
id_lammps_[0]=0;
|
||||
}
|
||||
|
||||
//delete [] id_lammps_vec_;
|
||||
Foam::dataExchangeModel::allocateArray(id_lammps_vec_,0,nlocal_lammps_*3);
|
||||
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???
|
||||
if(nlocal_lammps_>0){
|
||||
pos_lammps_ = (double **) lammps_extract_atom(lmp,"x");
|
||||
}else{
|
||||
// might use the fct from dataExchangeModel mother class
|
||||
pos_lammps_ = new double*[1];
|
||||
pos_lammps_[0] = new double [1];
|
||||
pos_lammps_[0][0] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// re-arrange data using map
|
||||
//Foam::dataExchangeModel::allocateArray(id_lammps_sync,-1.,nlocal_lammps_); // probably not necessary
|
||||
if(nlocal_lammps_>0){
|
||||
|
||||
// make a copy of id array
|
||||
id_lammps_sync = (int *) lammps_extract_atom(lmp,"id");
|
||||
}else{
|
||||
// might use the fct from dataExchangeModel mother class
|
||||
id_lammps_sync=new int[1];
|
||||
id_lammps_sync[0]=10;
|
||||
}
|
||||
//extract_save(id_lammps_sync,"id"); // in future it should look like this!!!
|
||||
Foam::dataExchangeModel::allocateArray(id_lammps_vec_,0,nlocal_lammps_*3);
|
||||
|
||||
// genereate vector IDs
|
||||
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;
|
||||
@ -433,31 +447,18 @@ void Foam::twoWayM2M::syncIDs() const
|
||||
foam2lmp_vec_->setup(nlocal_foam_*3,id_foam_vec_,nlocal_lammps_*3,id_lammps_vec_);
|
||||
|
||||
// map data according to last TS
|
||||
Foam::dataExchangeModel::allocateArray(id_lammps_,0,nlocal_foam_);
|
||||
lmp2foam_->exchange(id_lammps_sync, id_lammps_);
|
||||
allocateArray(tmpI_,-1.,nlocal_foam_);
|
||||
lmp2foam_->exchange(id_lammps_sync, tmpI_);
|
||||
for(int i=0;i<nlocal_foam_;i++)
|
||||
id_lammps_[i]=tmpI_[i];
|
||||
|
||||
if(nlocal_lammps_>0){
|
||||
// get access to "x"
|
||||
pos_lammps_sync = (double **) lammps_extract_atom(lmp,"x");
|
||||
}else{
|
||||
// might use the fct from dataExchangeModel mother class
|
||||
pos_lammps_sync = new double*[1];
|
||||
pos_lammps_sync[0] = new double [3];
|
||||
pos_lammps_sync[0][0] = 0;
|
||||
pos_lammps_sync[0][1] = 0;
|
||||
pos_lammps_sync[0][2] = 0;
|
||||
}
|
||||
// find better solution here!!!
|
||||
//Foam::dataExchangeModel::allocateArray(pos_lammps_,-1.,3,nlocal_foam_);
|
||||
//lmp2foam_vec_->exchange(&(pos_lammps_sync[0][0]), &(pos_lammps_[0][0]));
|
||||
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]));
|
||||
|
||||
// conversion of array (should not be necessary if above problem is solved)
|
||||
allocateArray(tmp_,-1.,nlocal_foam_*3);
|
||||
lmp2foam_vec_->exchange(pos_lammps_sync[0], tmp_);
|
||||
for(int i=0;i<nlocal_foam_;i++)
|
||||
for(int j=0;j<3;j++)
|
||||
pos_lammps_[i][j]=gugu[0][i*3+j];
|
||||
pos_lammps_[i][j]=tmp_[i*3+j];
|
||||
}
|
||||
particleCloud_.clockM().stop("recv_DEM_ids");
|
||||
|
||||
@ -465,17 +466,14 @@ void Foam::twoWayM2M::syncIDs() const
|
||||
locateParticle();
|
||||
particleCloud_.clockM().stop("locateParticle()");
|
||||
|
||||
//for (int i = 0; i < nlocal_lammps_; i++)
|
||||
// Pout << "getData3: " << "v" <<"=" << pos_lammps_[i][0]<<","<<pos_lammps_[i][1]<<","<<pos_lammps_[i][2] <<endl;
|
||||
|
||||
//MPI_Barrier(MPI_COMM_WORLD);
|
||||
//Pout << couplingStep_ << "st == syncIDs " << endl;
|
||||
//if(couplingStep_==30){
|
||||
//FatalError<<"stop!!!"<< abort(FatalError);
|
||||
//}
|
||||
|
||||
// output
|
||||
/*Info << "LAMMPS " << endl;
|
||||
/*// output
|
||||
Info << "LAMMPS " << endl;
|
||||
for (int i = 0; i < nlocal_lammps_; i++)
|
||||
{
|
||||
if(firstRun_)
|
||||
@ -484,22 +482,25 @@ void Foam::twoWayM2M::syncIDs() const
|
||||
}else{
|
||||
Pout << couplingStep_ << "st id_lammps_sync[" << i << "]=" << id_lammps_sync[i] << " - "<<endl;
|
||||
}
|
||||
}*/
|
||||
/*for (int i = 0; i < nlocal_lammps_*3; i++)
|
||||
}
|
||||
for (int i = 0; i < nlocal_lammps_*3; i++)
|
||||
{
|
||||
Pout << couplingStep_ << "st id_lammps_vec_[" << i << "]=" << id_lammps_vec_[i] << " - "<<endl;
|
||||
}*/
|
||||
/*Info << "FOAM "<< endl;
|
||||
}
|
||||
if (nlocal_foam_>0)
|
||||
for (int i = 0; i < nlocal_foam_; i++)
|
||||
Pout << couplingStep_ << "st pos:" <<"=" << pos_lammps_[i][0]<<","<<pos_lammps_[i][1]<<","<<pos_lammps_[i][2] <<endl;
|
||||
Info << "FOAM "<< endl;
|
||||
for (int i = 0; i < nlocal_foam_; i++)
|
||||
{
|
||||
Pout << couplingStep_ << "st id_foam_[" << i << "]=" << id_foam_[i] << " - "<<endl;
|
||||
}*/
|
||||
/*for (int i = 0; i < nlocal_foam_*3; i++)
|
||||
}
|
||||
for (int i = 0; i < nlocal_foam_*3; i++)
|
||||
{
|
||||
Pout << couplingStep_ << "st id_foam_vec_[" << i << "]=" << id_foam_vec_[i] << " - "<<endl;
|
||||
}*/
|
||||
//Pout << couplingStep_ << "st nlocal_lammps_=" << nlocal_lammps_ << endl;
|
||||
//Pout << couplingStep_ << "st nlocal_foam_=" << nlocal_foam_ << endl;
|
||||
}
|
||||
Pout << couplingStep_ << "st nlocal_lammps_=" << nlocal_lammps_ << endl;
|
||||
Pout << couplingStep_ << "st nlocal_foam_=" << nlocal_foam_ << endl;*/
|
||||
|
||||
// correct mapping
|
||||
particleCloud_.clockM().start(11,"setup_Comm");
|
||||
@ -532,36 +533,13 @@ void Foam::twoWayM2M::locateParticle() const
|
||||
{
|
||||
int nop = particleCloud_.numberOfParticles();
|
||||
|
||||
// realloc array of lost particles
|
||||
if (particleCloud_.numberOfParticlesChanged())
|
||||
{
|
||||
// these arrays will be to long, but we do not know their length a priori
|
||||
//delete[] id_foam_lost_;
|
||||
Foam::dataExchangeModel::allocateArray(id_foam_lost_,0,nop);
|
||||
|
||||
//delete [] lost_pos_;
|
||||
Foam::dataExchangeModel::allocateArray(lost_pos_,0.,nop*3);
|
||||
|
||||
//delete [] id_foam_;
|
||||
Foam::dataExchangeModel::allocateArray(id_foam_,0,nop);
|
||||
|
||||
//delete [] id_foam_vec_;
|
||||
Foam::dataExchangeModel::allocateArray(id_foam_vec_,0,nop*3);
|
||||
|
||||
//delete [] cellID_foam_;
|
||||
Foam::dataExchangeModel::allocateArray(cellID_foam_,0,nop);
|
||||
//delete [] pos_foam_;
|
||||
Foam::dataExchangeModel::allocateArray(pos_foam_,0,nop*3);
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset array to zero
|
||||
for (int i=0; i<nop; i++)
|
||||
{
|
||||
id_foam_lost_[i] = 0;
|
||||
for (int j=0; j<3; j++) lost_pos_[i*3+j] = 0.;
|
||||
}
|
||||
}
|
||||
// realloc array of lost particles // these arrays will be too long, but we do not know their length a priori???
|
||||
allocateArray(id_foam_lost_,0,nop);
|
||||
allocateArray(lost_pos_,0.,nop*3);
|
||||
allocateArray(id_foam_,0,nop);
|
||||
allocateArray(id_foam_vec_,0,nop*3);
|
||||
allocateArray(cellID_foam_,0,nop);
|
||||
allocateArray(pos_foam_,0,nop*3);
|
||||
|
||||
// stage 1 - look on proc or send or prepare for all-to-all
|
||||
particleCloud_.clockM().start(7,"locate_Stage1");
|
||||
@ -695,7 +673,7 @@ void Foam::twoWayM2M::locateParticle() const
|
||||
|
||||
forAll(recvParticleTransferID,i)
|
||||
{
|
||||
//Pout << "received id="<<recvParticleTransferID[i] << "received pos="<<recvParticleTransferPos[i] << endl;
|
||||
//Pout << couplingStep_ << " stage 2 received id="<<recvParticleTransferID[i] << "received pos="<<recvParticleTransferPos[i] << endl;
|
||||
pos = recvParticleTransferPos[i];
|
||||
cellID = particleCloud_.locateM().findSingleCell(pos,searchCellID);
|
||||
|
||||
@ -717,6 +695,7 @@ void Foam::twoWayM2M::locateParticle() const
|
||||
//id_foam_lost_all[i]=-1;
|
||||
|
||||
nlocal_foam_ += 1;
|
||||
//Pout << couplingStep_ << "st stage2 found particle at pos=" << pos << " ,id_foam_[i]=" << id_foam_[i] << endl;
|
||||
}
|
||||
else // might have been comm to wrong proc
|
||||
{
|
||||
@ -743,8 +722,13 @@ void Foam::twoWayM2M::locateParticle() const
|
||||
|
||||
if (nlocal_foam_lost_all > 0)
|
||||
{
|
||||
//Info << "all-to-all necessary: nlocal_foam_lost_all=" << nlocal_foam_lost_all << endl;
|
||||
int nlocal_foam_lost_all = LAMMPS_NS::MPI_Allgather_Vector(lost_pos_, nlocal_foam_lost_*3, lost_pos_all, MPI_COMM_WORLD)/3;
|
||||
Info << "all-to-all necessary: nlocal_foam_lost_all=" << nlocal_foam_lost_all << endl;
|
||||
/*if(lost_pos_all)
|
||||
{
|
||||
delete[] lost_pos_all;
|
||||
lost_pos_all = NULL;
|
||||
}*/
|
||||
int nlocal_foam_lost_all = LAMMPS_NS::MPI_Allgather_Vector(lost_pos_, nlocal_foam_lost_*3, lost_pos_all, MPI_COMM_WORLD)/3; // new[] für lost_pos_all!!!
|
||||
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;
|
||||
|
||||
@ -822,7 +806,7 @@ Info << "nlocal_lammps_ALL=" << gugu << endl;*/
|
||||
|
||||
//delete[] id_foam_nowhere_all;
|
||||
//delete[] id_foam_lost_all;
|
||||
//delete[] lost_pos_all;
|
||||
//delete[] lost_pos_all; // gives invalid free() ...
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -101,6 +101,7 @@ private:
|
||||
mutable int *id_foam_;
|
||||
mutable int *id_foam_vec_;
|
||||
mutable double *tmp_;
|
||||
mutable int *tmpI_;
|
||||
mutable double **pos_lammps_;
|
||||
mutable int nlocal_foam_lost_;
|
||||
mutable int *id_foam_lost_;
|
||||
@ -191,6 +192,15 @@ public:
|
||||
void allocateArray(int**&, int, int,const char* ="nparticles") const;
|
||||
//==============
|
||||
|
||||
//==============
|
||||
// double *
|
||||
void allocateArray(double*&, double, int) const;
|
||||
|
||||
//==============
|
||||
// int *
|
||||
void allocateArray(int*&, int, int) const;
|
||||
//==============
|
||||
|
||||
bool couple() const;
|
||||
|
||||
int getNumberOfParticles() const;
|
||||
@ -198,6 +208,7 @@ public:
|
||||
|
||||
void syncIDs() const;
|
||||
void locateParticle() const;
|
||||
word myType() const{return typeName; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -156,6 +156,8 @@ public:
|
||||
|
||||
int getNumberOfParticles() const;
|
||||
int getNumberOfClumps() const;
|
||||
|
||||
word myType() const{return typeName; };
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ logfileName="log_$headerText"
|
||||
solverName="cfdemSolverIB"
|
||||
nrProcs="4"
|
||||
machineFileName="none" # yourMachinefileName | none
|
||||
debugMode="off" # on | off | prof
|
||||
debugMode="off" # on | off| strict
|
||||
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
|
||||
runOctave="true"
|
||||
postproc="false"
|
||||
|
||||
@ -32,15 +32,15 @@ couplingInterval 100;
|
||||
|
||||
voidFractionModel divided;
|
||||
|
||||
locateModel turboEngineM2M;//engine;//
|
||||
locateModel engine;//turboEngineM2M;//
|
||||
|
||||
meshMotionModel noMeshMotion;
|
||||
|
||||
regionModel allRegion;
|
||||
|
||||
IOModel "off";
|
||||
IOModel "basicIO";
|
||||
|
||||
dataExchangeModel twoWayM2M;//twoWayMPI;//twoWayFiles;//oneWayVTK;//
|
||||
dataExchangeModel twoWayMPI;//twoWayM2M;//twoWayFiles;//oneWayVTK;//
|
||||
|
||||
averagingModel dense;//dilute;//
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ logfileName="log_$headerText"
|
||||
solverName="cfdemSolverPiso"
|
||||
nrProcs="4"
|
||||
machineFileName="none" # yourMachinefileName | none
|
||||
debugMode="off" # on | off | prof
|
||||
debugMode="off" # on | off| strictdebugMode="off" # on | off| strict
|
||||
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
|
||||
runOctave="true"
|
||||
postproc="false"
|
||||
@ -94,7 +94,7 @@ rm -r $casePath/DEM/post/*
|
||||
rm -r $casePath/DEM/log.*
|
||||
rm -r $casePath/DEM/liggghts.restartCFDEM*
|
||||
rm -r $casePath/CFD/probes
|
||||
rm -r $casePath/CFD/particles
|
||||
rm -r $casePath/CFD/lagrangian
|
||||
rm -r $casePath/CFD/clockData
|
||||
echo "done"
|
||||
|
||||
|
||||
@ -26,3 +26,4 @@ dummyfile
|
||||
dummyfile
|
||||
dummyfile
|
||||
dummyfile
|
||||
dummyfile
|
||||
|
||||
@ -21,7 +21,7 @@ logfileName="log_$headerText"
|
||||
solverName="cfdemSolverPiso"
|
||||
nrProcs="2"
|
||||
machineFileName="none" # yourMachinefileName | none
|
||||
debugMode="off" # on | off | prof
|
||||
debugMode="off" # on | off| strict
|
||||
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
|
||||
#--------------------------------------------------------------------------------#
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ logfileName="log_$headerText"
|
||||
solverName="cfdemSolverPiso"
|
||||
nrProcs="2"
|
||||
machineFileName="none" # yourMachinefileName | none
|
||||
debugMode="off" # on | off | prof
|
||||
debugMode="off" # on | off| strict
|
||||
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
|
||||
runOctave="true"
|
||||
postproc="false"
|
||||
|
||||
@ -21,7 +21,7 @@ logfileName="log_$headerText"
|
||||
solverName="cfdemSolverPisoScalar"
|
||||
nrProcs="2"
|
||||
machineFileName="none" # yourMachinefileName | none
|
||||
debugMode="off" # on | off | prof
|
||||
debugMode="off" # on | off| strict
|
||||
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
|
||||
runOctave="true"
|
||||
postproc="false"
|
||||
|
||||
Reference in New Issue
Block a user