release on 2013-04-23_12-50-50

This commit is contained in:
goniva
2013-04-23 12:50:51 +02:00
parent 244697d458
commit eb9c5c8071
28 changed files with 850 additions and 81 deletions

81
README Normal file
View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
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 the ESI Group.
This offering is not affiliated, approved or endorsed by ESI Group,
the producer of the OpenFOAM® software and owner of the OpenFOAM® trade mark.
\*---------------------------------------------------------------------------*/

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,6 @@ voidFractionModels = subModels/voidFractionModel
locateModels = subModels/locateModel
meshMotionModels = subModels/meshMotionModel
momCoupleModels = subModels/momCoupleModel
regionModels = subModels/regionModel
dataExchangeModels = subModels/dataExchangeModel
averagingModels = subModels/averagingModel
clockModels = subModels/clockModel
@ -21,18 +20,33 @@ $(forceModels)/forceModel/newForceModel.C
$(forceModels)/noDrag/noDrag.C
$(forceModels)/checkCouplingInterval/checkCouplingInterval.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
@ -62,21 +76,18 @@ $(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
$(dataExchangeModels)/dataExchangeModel/dataExchangeModel.C
$(dataExchangeModels)/dataExchangeModel/newDataExchangeModel.C
$(dataExchangeModels)/oneWayVTK/oneWayVTK.C
@ -102,4 +113,4 @@ $(liggghtsCommandModels)/runLiggghts/runLiggghts.C
$(liggghtsCommandModels)/writeLiggghts/writeLiggghts.C
$(liggghtsCommandModels)/readLiggghtsData/readLiggghtsData.C
LIB = $(FOAM_USER_LIBBIN)/lib$(CFDEM_LIB_NAME)
LIB = $(CFDEM_LIB_DIR)/lib$(CFDEM_LIB_NAME)

View File

@ -45,9 +45,6 @@ SourceFiles
// choose version
#include "OFversion.H"
// choose comp/incomp
//#define comp
#include "fvCFD.H"
#include "IFstream.H"

View File

@ -222,6 +222,9 @@ void Foam::cfdemCloudMS::setForces()
resetArray(impForces_,numberOfParticles(),3);
resetArray(expForces_,numberOfParticles(),3);
resetArray(DEMForces_,numberOfParticles(),3);
Info << "hallo1" << endl;
cfdemCloudMS::nrForceModels();
Info << "hallo2" << endl;
for (int i=0;i<cfdemCloudMS::nrForceModels();i++) cfdemCloudMS::forceM(i).setForce();
}
@ -254,7 +257,9 @@ label Foam::cfdemCloudMS::body(int index)
label Foam::cfdemCloudMS::nrigid(int index)
{
return nrigids_[0][index];
// return nrigids_[0][index];
Warning << "Foam::cfdemCloudMS::nrigid: assuming all clumps are equal - LIGGGHTS' nrigid is not transferred correctly! " << endl;
return nrigids_[0][0];
}
const forceModel& Foam::cfdemCloudMS::forceM(int i)

View File

@ -1,3 +1,6 @@
#define version21
//#define version16ext
//#define version15
// choose comp/incomp
//#define comp // if comp is on - you must use Make/options_comp!

View File

@ -507,32 +507,32 @@ void Foam::twoWayM2M::syncIDs() const
//FatalError<<"stop!!!"<< abort(FatalError);
//}
// output
/*Info << "LAMMPS " << endl;
for (int i = 0; i < nlocal_lammps_; i++)
{
if(firstRun_)
{
Pout << couplingStep_ << "st id_lammps_[" << i << "]=" << id_lammps_[i] << " - "<<endl;
}else{
Pout << couplingStep_ << "st id_lammpsSync[" << i << "]=" << id_lammpsSync[i] << " - "<<endl;
}
}
for (int i = 0; i < nlocal_lammps_*3; i++)
{
Pout << couplingStep_ << "st id_lammpsVec_[" << i << "]=" << id_lammpsVec_[i] << " - "<<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++)
{
Pout << couplingStep_ << "st id_foamVec_[" << i << "]=" << id_foamVec_[i] << " - "<<endl;
}
Pout << couplingStep_ << "st nlocal_lammps_=" << nlocal_lammps_ << endl;
Pout << couplingStep_ << "st nlocal_foam_=" << nlocal_foam_ << endl;*/
// // output
// Info << "LAMMPS " << endl;
// for (int i = 0; i < nlocal_lammps_; i++)
// {
// if(firstRun_)
// {
// Pout << couplingStep_ << "st id_lammps_[" << i << "]=" << id_lammps_[i] << " - "<<endl;
// }else{
// Pout << couplingStep_ << "st id_lammpsSync[" << i << "]=" << id_lammpsSync[i] << " - "<<endl;
// }
// }
// for (int i = 0; i < nlocal_lammps_*3; i++)
// {
// Pout << couplingStep_ << "st id_lammpsVec_[" << i << "]=" << id_lammpsVec_[i] << " - "<<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++)
// {
// Pout << couplingStep_ << "st id_foamVec_[" << i << "]=" << id_foamVec_[i] << " - "<<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");
@ -563,6 +563,8 @@ void Foam::twoWayM2M::syncIDs() const
void Foam::twoWayM2M::locateParticle() const
{
#if defined(version21)
int nop = particleCloud_.numberOfParticles();
// realloc array of lost particles // these arrays will be too long, but we do not know their length a priori???
@ -807,46 +809,51 @@ void Foam::twoWayM2M::locateParticle() const
}
particleCloud_.clockM().stop("locate_Stage3");
/* // check if really all particles were found
particleCloud_.clockM().start(10,"locate_Stage3");
Foam::dataExchangeModel::allocateArray(id_foam_nowhere_all,1,nlocal_foam_lostAll);
MPI_Allreduce(id_foamLostAll, id_foam_nowhere_all, nlocal_foam_lostAll, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
// // check if really all particles were found
// particleCloud_.clockM().start(10,"locate_Stage3");
// Foam::dataExchangeModel::allocateArray(id_foam_nowhere_all,1,nlocal_foam_lostAll);
// MPI_Allreduce(id_foamLostAll, id_foam_nowhere_all, nlocal_foam_lostAll, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
int i=0;
while (i < nlocal_foam_lostAll)
{
// these particles where found nowhere
if (id_foam_nowhere_all[i] > 0)
{
for (int j=0;j<nlocal_lammps_;j++)
{
if (id_lammpsComm_[j]==id_foam_nowhere_all[i])
{
// re-arrange IDs
id_lammpsComm_[j] = id_lammpsComm_[nlocal_lammps_-1];
// int i=0;
// while (i < nlocal_foam_lostAll)
// {
// // these particles where found nowhere
// if (id_foam_nowhere_all[i] > 0)
// {
// for (int j=0;j<nlocal_lammps_;j++)
// {
// if (id_lammpsComm_[j]==id_foam_nowhere_all[i])
// {
// // re-arrange IDs
// id_lammpsComm_[j] = id_lammpsComm_[nlocal_lammps_-1];
// re-arrange IDs for vectors
for (int k=0;k<3;k++)
{
id_lammpsVec_[j*3+k] = id_lammpsVec_[nlocal_lammps_*3+k];
}
nlocal_lammps_ -= 1;
break;
}
}
}
i++;
}
particleCloud_.clockM().stop("locate_Stage3");*/
// // re-arrange IDs for vectors
// for (int k=0;k<3;k++)
// {
// id_lammpsVec_[j*3+k] = id_lammpsVec_[nlocal_lammps_*3+k];
// }
//
// nlocal_lammps_ -= 1;
// break;
// }
// }
// }
// i++;
// }
// particleCloud_.clockM().stop("locate_Stage3");
/*int gaga;
MPI_Allreduce(&nlocal_foam_, &gaga, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
Info << "nlocal_foam_ALL=" << gaga << endl;
//int gaga;
//MPI_Allreduce(&nlocal_foam_, &gaga, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
//Info << "nlocal_foam_ALL=" << gaga << endl;
//int gugu;
//MPI_Allreduce(&nlocal_lammps_, &gugu, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
//Info << "nlocal_lammps_ALL=" << gugu << endl;
#elif defined(version16ext)
Info << "M2M does not work with 1.6.x" << endl;
#endif
int gugu;
MPI_Allreduce(&nlocal_lammps_, &gugu, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
Info << "nlocal_lammps_ALL=" << gugu << endl;*/
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -318,9 +318,7 @@ int Foam::twoWayMPI::getNumberOfParticles() const
int Foam::twoWayMPI::getNumberOfClumps() const
{
Warning << "Foam::twoWayMPI::getNumberOfClumps() - changes necessary here" << endl;
//return liggghts_get_maxtag_ms(lmp);
return 1;
return liggghts_get_maxtag_ms(lmp);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,188 @@
/*---------------------------------------------------------------------------*\
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(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER).
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "fieldTimeAverage.H"
#include "addToRunTimeSelectionTable.H"
#include "dataExchangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(fieldTimeAverage, 0);
addToRunTimeSelectionTable
(
forceModel,
fieldTimeAverage,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
fieldTimeAverage::fieldTimeAverage
(
const dictionary& dict,
cfdemCloud& sm
)
:
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
mesh_(particleCloud_.mesh()),
startTime_(0.),
scalarFieldNames_(propsDict_.lookup("scalarFieldNames")),
vectorFieldNames_(propsDict_.lookup("vectorFieldNames")),
scalarFields_(NULL),
vectorFields_(NULL),
nrAverages_(0.0)
{
// create time average scalar fields
scalarFields_.setSize(scalarFieldNames_.size());
if (propsDict_.found("startTime")){
startTime_=readScalar(propsDict_.lookup("startTime"));
}
for (int i=0;i < scalarFieldNames_.size(); i++)
{
word fieldName = "timeAverage_" + scalarFieldNames_[i];
Info<< "Creating field " << fieldName << endl;
scalarFields_.set
(
i,
new volScalarField
(
IOobject
(
fieldName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("0", mesh_.lookupObject<volScalarField>(scalarFieldNames_[i]).dimensions(), 0)
)
);
}
// create time average vector fields
vectorFields_.setSize(vectorFieldNames_.size());
for (int i=0;i < vectorFieldNames_.size(); i++)
{
word fieldName = "timeAverage_" + vectorFieldNames_[i];
Info<< "Creating field " << fieldName << endl;
vectorFields_.set
(
i,
new volVectorField
(
IOobject
(
fieldName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedVector("0", mesh_.lookupObject<volVectorField>(vectorFieldNames_[i]).dimensions(), vector::zero)
)
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
fieldTimeAverage::~fieldTimeAverage()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void fieldTimeAverage::setForce() const
{
if(mesh_.time().value() >= startTime_)
{
if(particleCloud_.verbose()) Info << "fieldTimeAverage.C - setForce()" << endl;
for (int i=0;i < scalarFieldNames_.size(); i++)
{
// get reference to actual field
volScalarField& field = (volScalarField&) mesh_.lookupObject<volScalarField>(scalarFieldNames_[i]);
// first entry in this field
if(nrAverages_ == 0)
{
scalarFields_[i] = field;
}
else
{
scalarFields_[i] = (scalarFields_[i]*nrAverages_+field*1)/(nrAverages_+1);
}
}
for (int i=0;i < vectorFieldNames_.size(); i++)
{
// get reference to actual field
volVectorField& field = (volVectorField&) mesh_.lookupObject<volVectorField>(vectorFieldNames_[i]);
// first entry in this field
if(nrAverages_ == 0)
{
vectorFields_[i] = field;
}
else
{
vectorFields_[i] = (vectorFields_[i]*nrAverages_+field*1)/(nrAverages_+1);
}
}
nrAverages_++;
}// end if time >= startTime_
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,111 @@
/*---------------------------------------------------------------------------*\
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(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER).
calc time average of scalar or vector field
Class
fieldTimeAverage
SourceFiles
fieldTimeAverage.C
\*---------------------------------------------------------------------------*/
#ifndef fieldTimeAverage_H
#define fieldTimeAverage_H
#include "forceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class fieldTimeAverage Declaration
\*---------------------------------------------------------------------------*/
class fieldTimeAverage
:
public forceModel
{
private:
dictionary propsDict_;
const fvMesh& mesh_;
scalar startTime_;
const wordList scalarFieldNames_;
const wordList vectorFieldNames_;
mutable PtrList<volScalarField> scalarFields_;
mutable PtrList<volVectorField> vectorFields_;
mutable double nrAverages_;
public:
//- Runtime type information
TypeName("fieldTimeAverage");
// Constructors
//- Construct from components
fieldTimeAverage
(
const dictionary& dict,
cfdemCloud& sm
);
// Destructor
~fieldTimeAverage();
// Member Functions
void setForce() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,241 @@
/*---------------------------------------------------------------------------*\
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(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER).
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "volWeightedAverage.H"
#include "addToRunTimeSelectionTable.H"
#include "dataExchangeModel.H"
#include "mpi.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(volWeightedAverage, 0);
addToRunTimeSelectionTable
(
forceModel,
volWeightedAverage,
dictionary
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
volWeightedAverage::volWeightedAverage
(
const dictionary& dict,
cfdemCloud& sm
)
:
forceModel(dict,sm),
propsDict_(dict.subDict(typeName + "Props")),
mesh_(particleCloud_.mesh()),
startTime_(0.),
scalarFieldNames_(propsDict_.lookup("scalarFieldNames")),
vectorFieldNames_(propsDict_.lookup("vectorFieldNames")),
scalarFields_(NULL),
vectorFields_(NULL),
upperThreshold_(readScalar(propsDict_.lookup("upperThreshold"))),
lowerThreshold_(readScalar(propsDict_.lookup("lowerThreshold"))),
verbose_(false)
{
if (propsDict_.found("startTime")){
startTime_=readScalar(propsDict_.lookup("startTime"));
}
if (propsDict_.found("verbose")){
verbose_ = true;
}
// create vol weighted average scalar fields
scalarFields_.setSize(scalarFieldNames_.size());
for (int i=0;i < scalarFieldNames_.size(); i++)
{
word fieldName = "volAverage_" + scalarFieldNames_[i];
Info<< "Creating field " << fieldName << endl;
scalarFields_.set
(
i,
new volScalarField
(
IOobject
(
fieldName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("0", mesh_.lookupObject<volScalarField>(scalarFieldNames_[i]).dimensions(), 0)
)
);
}
// create vol weighted average vector fields
vectorFields_.setSize(vectorFieldNames_.size());
for (int i=0;i < vectorFieldNames_.size(); i++)
{
word fieldName = "volAverage_" + vectorFieldNames_[i];
Info<< "Creating field " << fieldName << endl;
vectorFields_.set
(
i,
new volVectorField
(
IOobject
(
fieldName,
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedVector("0", mesh_.lookupObject<volVectorField>(vectorFieldNames_[i]).dimensions(), vector::zero)
)
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
volWeightedAverage::~volWeightedAverage()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void volWeightedAverage::setForce() const
{
if(mesh_.time().value() >= startTime_)
{
if(verbose_) Info << "volWeightedAverage.C - setForce()" << endl;
for (int i=0;i < scalarFieldNames_.size(); i++)
{
// get reference to actual field
volScalarField& field = (volScalarField&) mesh_.lookupObject<volScalarField>(scalarFieldNames_[i]);
scalar fieldValue=-1;
scalar volWeightedAverage=-1;
scalar cellVol=-1;
scalar totVol=0;
scalar totVol_all=0;
forAll(field,cellI)
{
fieldValue = field[cellI];
if(fieldValue < upperThreshold_ && fieldValue > lowerThreshold_)
{
cellVol = mesh_.V()[cellI];
scalarFields_[i][cellI] = fieldValue * cellVol;
totVol += cellVol;
}
else
{
scalarFields_[i][cellI] = 0.;
}
}
MPI_Allreduce(&totVol, &totVol_all, 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
volWeightedAverage = gSum(scalarFields_[i]) / (totVol_all+SMALL);
scalarFields_[i].internalField() = volWeightedAverage;
if(verbose_)
{
Info << "calculated vol. weighted average of field: " << scalarFieldNames_[i]
<< " = " << volWeightedAverage
<< ",\n considering cells where the field < " << upperThreshold_
<< ", and > " << lowerThreshold_ << endl;
}
}
for (int i=0;i < vectorFieldNames_.size(); i++)
{
// get reference to actual field
volVectorField& field = (volVectorField&) mesh_.lookupObject<volVectorField>(vectorFieldNames_[i]);
vector fieldValue(-1,-1,-1);
vector volWeightedAverage(-1,-1,-1);
scalar magvolWeightedAverage=-1;
scalar cellVol=-1;
scalar totVol=0;
scalar totVol_all=0;
forAll(field,cellI)
{
fieldValue = field[cellI];
magvolWeightedAverage = mag(fieldValue);
if(magvolWeightedAverage < upperThreshold_ && magvolWeightedAverage > lowerThreshold_)
{
cellVol = mesh_.V()[cellI];
vectorFields_[i][cellI] = fieldValue * cellVol;
totVol += cellVol;
}
else
{
vectorFields_[i][cellI] = vector::zero;
}
}
MPI_Allreduce(&totVol, &totVol_all, 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
volWeightedAverage = gSum(vectorFields_[i]) / (totVol_all+SMALL);
vectorFields_[i].internalField() = volWeightedAverage;
if(verbose_)
{
Info << "calculated vol. weighted average of field: " << vectorFieldNames_[i]
<< " = " << volWeightedAverage
<< ",\n considering cells where the mag(field) < " << upperThreshold_
<< ", and > " << lowerThreshold_ << endl;
}
}
}// end if time >= startTime_
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,112 @@
/*---------------------------------------------------------------------------*\
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(R). Note: this code is not part of OpenFOAM(R) (see DISCLAIMER).
calc time average of scalar or vector field
Class
volWeightedAverage
SourceFiles
volWeightedAverage.C
\*---------------------------------------------------------------------------*/
#ifndef volWeightedAverage_H
#define volWeightedAverage_H
#include "forceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class volWeightedAverage Declaration
\*---------------------------------------------------------------------------*/
class volWeightedAverage
:
public forceModel
{
private:
dictionary propsDict_;
const fvMesh& mesh_;
scalar startTime_;
const wordList scalarFieldNames_;
const wordList vectorFieldNames_;
mutable PtrList<volScalarField> scalarFields_;
mutable PtrList<volVectorField> vectorFields_;
mutable scalar upperThreshold_;
mutable scalar lowerThreshold_;
Switch verbose_;
public:
//- Runtime type information
TypeName("volWeightedAverage");
// Constructors
//- Construct from components
volWeightedAverage
(
const dictionary& dict,
cfdemCloud& sm
);
// Destructor
~volWeightedAverage();
// Member Functions
void setForce() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -171,7 +171,6 @@ bool liggghtsCommandModel::runThisCommand(int couplingStep)
lastRun_=couplingStep;
}
}
return runIt;
}

View File

@ -83,12 +83,11 @@ writeLiggghts::writeLiggghts
overwrite_=Switch(propsDict_.lookup("overwrite"));
}
}
if(writeLast_)
runLast_=true;
else
{
Warning << "Using invalid options of writeLiggghts, please use 'writeLast' option." << endl;
//Warning << "Using invalid options of writeLiggghts, please use 'writeLast' option." << endl;
runEveryWriteStep_=true;
}

View File

@ -47,7 +47,7 @@ fix pdd1 all particledistribution/discrete 1. 1 pts1 1.0
group rigid_group region reg
region bc cylinder z 0.0 0.0 0.012 0.001 0.055 units box
fix ins rigid_group insert/pack seed 100001 distributiontemplate pdd1 vel constant 0. 0. 0. insert_every once overlapcheck yes region bc ntry_mc 10000 particles_in_region 2500 # volumefraction_region 0.01 #
fix ins rigid_group insert/pack seed 100001 distributiontemplate pdd1 vel constant 0. 0. 0. insert_every once overlapcheck yes region bc ntry_mc 10000 particles_in_region 1 #2500 # volumefraction_region 0.01 #
#integrator for multisphere rigid bodies
fix integr rigid_group multisphere

View File

@ -7,3 +7,20 @@ dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile
dummyfile

View File

@ -21,7 +21,7 @@ logfileName="log_$headerText"
solverName="cfdemSolverPisoMS"
nrProcs="2"
machineFileName="none" # yourMachinefileName | none
debugMode="off" # on | off
debugMode="on" # on | off
testHarnessPath="$CFDEM_TEST_HARNESS_PATH"
cleanUp="true"