mirror of
https://github.com/ParticulateFlow/CFDEMcoupling-PFM.git
synced 2025-12-08 06:37:44 +00:00
Merge pull request #96 from ParticulateFlow/feature/adaptive_resolution_universe
Merge some general mods from feature/adaptive_resolution_universe
This commit is contained in:
@ -523,7 +523,7 @@ void cfdemCloud::checkCG(bool ok)
|
||||
if(!ok) cgOK_ = ok;
|
||||
}
|
||||
|
||||
void cfdemCloud::setPos(double**& pos)
|
||||
void cfdemCloud::setPos(const double *const * pos)
|
||||
{
|
||||
for(int index = 0; index < numberOfParticles(); ++index)
|
||||
{
|
||||
@ -556,11 +556,6 @@ vector cfdemCloud::expForce(int index) const
|
||||
return vector(DEMForces()[index][0],DEMForces()[index][1],DEMForces()[index][2]);
|
||||
}
|
||||
|
||||
vector cfdemCloud::fluidVel(int index) const
|
||||
{
|
||||
return vector(fluidVels()[index][0],fluidVels()[index][1],fluidVels()[index][2]);
|
||||
}
|
||||
|
||||
const forceModel& cfdemCloud::forceM(int i)
|
||||
{
|
||||
return forceModel_[i];
|
||||
|
||||
@ -106,13 +106,13 @@ protected:
|
||||
|
||||
const word modelType_;
|
||||
|
||||
double **positions_;
|
||||
double **positions_; // particle positions
|
||||
|
||||
double **velocities_;
|
||||
double **velocities_; // particle velocities
|
||||
|
||||
double **fluidVel_;
|
||||
double **fluidVel_; // fluid velocities at particle positions
|
||||
|
||||
double **fAcc_;
|
||||
double **fAcc_; // accumulated implicit forces on particles (only used in Koch Hill drag model)
|
||||
|
||||
double **impForces_;
|
||||
|
||||
@ -120,25 +120,25 @@ protected:
|
||||
|
||||
double **DEMForces_;
|
||||
|
||||
double **Cds_;
|
||||
double **Cds_; // Ksl
|
||||
|
||||
double **radii_;
|
||||
double **radii_; // particle radii
|
||||
|
||||
double **voidfractions_;
|
||||
|
||||
int **cellIDs_;
|
||||
int **cellIDs_; // ID of cell each particle is in
|
||||
|
||||
double **particleDensities_;
|
||||
double **particleDensities_; // particle densities
|
||||
|
||||
double **particleEffVolFactors_;
|
||||
double **particleEffVolFactors_; // per particle volume factor
|
||||
|
||||
int **particleTypes_;
|
||||
int **particleTypes_; // per particle type
|
||||
|
||||
double **particleWeights_;
|
||||
double **particleWeights_; // particle weights
|
||||
|
||||
double **particleVolumes_;
|
||||
double **particleVolumes_; // particle volumes with subcell information
|
||||
|
||||
double **particleV_;
|
||||
double **particleV_; // particle total volumes
|
||||
|
||||
int numberOfParticles_;
|
||||
|
||||
@ -211,8 +211,6 @@ protected:
|
||||
|
||||
virtual void giveDEMdata();
|
||||
|
||||
virtual void setNumberOfParticles(int);
|
||||
|
||||
virtual void findCells();
|
||||
|
||||
virtual void setForces();
|
||||
@ -225,11 +223,6 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
friend class dataExchangeModel;
|
||||
friend class voidFractionModel;
|
||||
friend class forceModel;
|
||||
friend class forceSubModel;
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and a list of particles
|
||||
@ -248,9 +241,11 @@ public:
|
||||
|
||||
void setAllowCFDsubTimestep(bool b) { allowCFDsubTimestep_ = b; }
|
||||
|
||||
virtual void setNumberOfParticles(int numberOfParticles);
|
||||
|
||||
void checkCG(bool);
|
||||
|
||||
void setPos(double **&);
|
||||
void setPos(const double *const *);
|
||||
|
||||
const word& modelType() const { return modelType_; }
|
||||
|
||||
@ -262,8 +257,6 @@ public:
|
||||
|
||||
vector expForce(int) const;
|
||||
|
||||
vector fluidVel(int) const;
|
||||
|
||||
virtual const forceModel& forceM(int);
|
||||
|
||||
virtual label nrForceModels() const;
|
||||
@ -405,6 +398,12 @@ public:
|
||||
// Write
|
||||
|
||||
// write cfdemCloud internal data
|
||||
inline void setPositions(label n,double* pos);
|
||||
inline void setCellIDs(label n,int* ID);
|
||||
inline void setCellIDs(DynamicList<label> const& IDs);
|
||||
inline void setImpDEMdrag(bool flag) { impDEMdrag_ = flag; }
|
||||
inline void setImpDEMdragAcc(bool flag) { impDEMdragAcc_ = flag; }
|
||||
|
||||
virtual bool evolve(volScalarField&,volVectorField&,volVectorField&);
|
||||
|
||||
virtual void postFlow() {}
|
||||
@ -412,9 +411,9 @@ public:
|
||||
virtual bool reAllocArrays();
|
||||
|
||||
// IO
|
||||
void writeScalarFieldToTerminal(double**&) const;
|
||||
void writeScalarFieldToTerminal(const double *const *) const;
|
||||
|
||||
void writeVectorFieldToTerminal(double**&) const;
|
||||
void writeVectorFieldToTerminal(const double *const *) const;
|
||||
|
||||
// functions
|
||||
tmp<fvVectorMatrix> divVoidfractionTau(volVectorField& ,volScalarField&) const;
|
||||
|
||||
@ -50,6 +50,25 @@ inline void cfdemCloud::setCG(double cg)
|
||||
Info << "cg is set to: " << cg_ << endl;
|
||||
}
|
||||
|
||||
inline void cfdemCloud::setPositions(label n,double* pos)
|
||||
{
|
||||
for (int i=0; i<n; ++i)
|
||||
for (int j=0; j<3; ++j)
|
||||
positions_[i][j]=pos[i*3+j];
|
||||
}
|
||||
|
||||
inline void cfdemCloud::setCellIDs(label n,int* ID)
|
||||
{
|
||||
for (int i=0; i<n; ++i)
|
||||
cellIDs_[i][0]=ID[i];
|
||||
}
|
||||
|
||||
inline void cfdemCloud::setCellIDs(DynamicList<label> const& IDs)
|
||||
{
|
||||
for (int i=0; i<IDs.size(); ++i)
|
||||
cellIDs_[i][0] = IDs[i];
|
||||
}
|
||||
|
||||
inline bool cfdemCloud::impDEMdrag() const
|
||||
{
|
||||
return impDEMdrag_;
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * IO * * * * * * * * * * * * * //
|
||||
|
||||
void cfdemCloud::writeScalarFieldToTerminal(double**& array) const
|
||||
void cfdemCloud::writeScalarFieldToTerminal(const double *const * array) const
|
||||
{
|
||||
// init double array
|
||||
for (int i=0; i<numberOfParticles(); i++)
|
||||
@ -57,7 +57,7 @@ void cfdemCloud::writeScalarFieldToTerminal(double**& array) const
|
||||
}
|
||||
}
|
||||
|
||||
void cfdemCloud::writeVectorFieldToTerminal(double**& array) const
|
||||
void cfdemCloud::writeVectorFieldToTerminal(const double *const * array) const
|
||||
{
|
||||
// init double array
|
||||
for (int i=0; i<numberOfParticles(); i++)
|
||||
|
||||
@ -95,7 +95,6 @@ private:
|
||||
// Private member functions
|
||||
void getDEMdata();
|
||||
void giveDEMdata();
|
||||
void setNumberOfParticles(int);
|
||||
void findCells();
|
||||
void setForces();
|
||||
void setParticleForceField();
|
||||
@ -117,6 +116,8 @@ public:
|
||||
|
||||
// Member Functions
|
||||
// Access
|
||||
void setNumberOfParticles(int);
|
||||
|
||||
inline label body(int) const;
|
||||
|
||||
inline double particleVolume(int) const;
|
||||
|
||||
@ -43,13 +43,6 @@ defineTypeNameAndDebug(dataExchangeModel, 0);
|
||||
|
||||
defineRunTimeSelectionTable(dataExchangeModel, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void dataExchangeModel::setNumberOfParticles(int numberOfParticles) const
|
||||
{
|
||||
particleCloud_.setNumberOfParticles(numberOfParticles);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * public Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
//====
|
||||
|
||||
@ -123,7 +123,6 @@ public:
|
||||
|
||||
|
||||
// Member Function
|
||||
void setNumberOfParticles(int) const;
|
||||
|
||||
inline const int& maxNumberOfParticles() const { return maxNumberOfParticles_; }
|
||||
|
||||
@ -250,27 +249,6 @@ public:
|
||||
virtual int getNumberOfTypes() const;
|
||||
virtual double* getTypeVol() const;
|
||||
|
||||
inline void setPositions(label n,double* pos)
|
||||
{
|
||||
for (int i=0;i<n;i++)
|
||||
for (int j=0;j<3;j++)
|
||||
particleCloud_.positions_[i][j]=pos[i*3+j];
|
||||
}
|
||||
|
||||
inline void setCellIDs(label n,int* ID)
|
||||
{
|
||||
for (int i=0;i<n;i++)
|
||||
particleCloud_.cellIDs_[i][0]=ID[i];
|
||||
}
|
||||
|
||||
inline void setCellIDs(DynamicList<label> const& ids)
|
||||
{
|
||||
for (int i = 0; i < ids.size(); i++)
|
||||
{
|
||||
particleCloud_.cellIDs_[i][0] = ids[i];
|
||||
}
|
||||
}
|
||||
|
||||
virtual scalar getCG() const { Warning << "getCG() not executed correctly!" << endl; return 1.; }
|
||||
};
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ oneWayVTK::oneWayVTK
|
||||
|
||||
// set max nr of particles from dict
|
||||
maxNumberOfParticles_ = readScalar(propsDict_.lookup("maxNumberOfParticles"));
|
||||
setNumberOfParticles(maxNumberOfParticles_);
|
||||
particleCloud_.setNumberOfParticles(maxNumberOfParticles_);
|
||||
|
||||
Info << "relativePath_" << relativePath_ << endl;
|
||||
}
|
||||
@ -156,7 +156,7 @@ void oneWayVTK::getData
|
||||
input >> just_read; // skip text for dataType
|
||||
|
||||
// give nr of particles to cloud
|
||||
setNumberOfParticles(numberOfParticles);
|
||||
particleCloud_.setNumberOfParticles(numberOfParticles);
|
||||
|
||||
// re-allocate arrays of cloud
|
||||
particleCloud_.reAllocArrays();
|
||||
|
||||
@ -68,7 +68,7 @@ twoWayFiles::twoWayFiles
|
||||
maxNumberOfParticles_ = readScalar(propsDict_.lookup("maxNumberOfParticles"));
|
||||
|
||||
// give max nr of particles to cloud (corrected later)
|
||||
setNumberOfParticles(maxNumberOfParticles_);
|
||||
particleCloud_.setNumberOfParticles(maxNumberOfParticles_);
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ void twoWayFiles::getData
|
||||
/*if(name != "outRegion1" && name != "inRegion1")*/ *inputPtr >> numberOfParticles;
|
||||
|
||||
// give nr of particles to cloud
|
||||
setNumberOfParticles(numberOfParticles);
|
||||
particleCloud_.setNumberOfParticles(numberOfParticles);
|
||||
|
||||
// re-allocate arrays of cloud
|
||||
particleCloud_.reAllocArrays();
|
||||
|
||||
@ -344,7 +344,7 @@ bool twoWayMPI::couple(int i)
|
||||
// give nr of particles to cloud
|
||||
double newNpart = liggghts_get_maxtag(lmp);
|
||||
|
||||
setNumberOfParticles(newNpart);
|
||||
particleCloud_.setNumberOfParticles(newNpart);
|
||||
|
||||
// re-allocate arrays of cloud
|
||||
particleCloud_.clockM().start(4,"LIGGGHTS_reallocArrays");
|
||||
|
||||
@ -6,7 +6,7 @@ SHELL = /bin/sh
|
||||
|
||||
CC = mpic++
|
||||
CCFLAGS = -O2 -fPIC \
|
||||
-funroll-loops -fstrict-aliasing -Wall -Wextra -Wno-unused-result -Wno-literal-suffix
|
||||
-funroll-loops -fstrict-aliasing -Wall -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-literal-suffix
|
||||
DEPFLAGS = -M
|
||||
LINK = mpic++
|
||||
LINKFLAGS = -O -fPIC
|
||||
|
||||
@ -417,7 +417,7 @@ bool twoWayMany2Many::couple(int i)
|
||||
}
|
||||
|
||||
double newNpart = liggghts_get_maxtag(lmp);
|
||||
setNumberOfParticles(newNpart);
|
||||
particleCloud_.setNumberOfParticles(newNpart);
|
||||
|
||||
if (Npart_ != newNpart)
|
||||
{
|
||||
@ -430,13 +430,13 @@ bool twoWayMany2Many::couple(int i)
|
||||
firstRun_=false;
|
||||
particleCloud_.clockM().stop("CoupleSyncIDs()");
|
||||
|
||||
setNumberOfParticles(nlocal_foam_);
|
||||
particleCloud_.setNumberOfParticles(nlocal_foam_);
|
||||
|
||||
// re-allocate arrays of cloud
|
||||
particleCloud_.reAllocArrays();
|
||||
|
||||
setPositions(nlocal_foam_,pos_foam_);
|
||||
setCellIDs(nlocal_foam_,cellID_foam_);
|
||||
particleCloud_.setPositions(nlocal_foam_,pos_foam_);
|
||||
particleCloud_.setCellIDs(nlocal_foam_,cellID_foam_);
|
||||
|
||||
Info <<"Foam::twoWayMany2Many::couple(i) done." << endl;
|
||||
}
|
||||
|
||||
@ -819,7 +819,7 @@ void twoWayOne2One::locateParticles()
|
||||
}
|
||||
}
|
||||
|
||||
setNumberOfParticles(n_located);
|
||||
particleCloud_.setNumberOfParticles(n_located);
|
||||
particleCloud_.reAllocArrays();
|
||||
|
||||
reduce(n_located, sumOp<label>());
|
||||
@ -846,11 +846,11 @@ void twoWayOne2One::locateParticles()
|
||||
extracted_flattened_positions,
|
||||
3
|
||||
);
|
||||
setPositions(getNumberOfParticles(), extracted_flattened_positions);
|
||||
particleCloud_.setPositions(getNumberOfParticles(), extracted_flattened_positions);
|
||||
delete [] extracted_flattened_positions;
|
||||
destroy(collected_flattened_positions);
|
||||
|
||||
setCellIDs(cellIds);
|
||||
particleCloud_.setCellIDs(cellIds);
|
||||
}
|
||||
|
||||
void twoWayOne2One::setupFoam2LigCommunication()
|
||||
|
||||
@ -209,7 +209,7 @@ void forceSubModel::readSwitches()
|
||||
if(switches_[SW_IMPL_FORCE_DEM]) // implForceDEM=true
|
||||
{
|
||||
// communicate implForceDEM to particleCloud
|
||||
particleCloud_.impDEMdrag_ = true;
|
||||
particleCloud_.setImpDEMdrag(true);
|
||||
|
||||
// do sanity check
|
||||
// This can work if the accumulator is used, but is explicitely applied on the CFD side
|
||||
@ -232,7 +232,7 @@ void forceSubModel::readSwitches()
|
||||
switches_[SW_VERBOSE] = false;
|
||||
}else
|
||||
{
|
||||
particleCloud_.impDEMdragAcc_ = true;
|
||||
particleCloud_.setImpDEMdragAcc(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user