fvOptions isn't working in CFDEM coupling

Submitted by yeting on Wed, 06/06/2018 - 04:24

hi,everyone !
I'm a newcomer to CFDEM. I try to amend a case for FSI.I want to add fvOptions to drive fluid,but fvOptions isn't working.so i want to know why .I use interDyMFoam solver in CFD side. who can help me? Thanks for you help. Here is a part of log file:

// run_parallel_cfdemSolverPiso_cylinderCase1_CFDDEM //

/home/yt/CFDEM/yt-PUBLIC-5.0/pipe1/CFD

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 5.x-197d9d3bf20a
Exec : cfdemSolverIB -parallel
Date : Jun 06 2018
Time : 08:53:19
Host : "yt-Super-Server"
PID : 30805
I/O : uncollated
Case : /home/yt/CFDEM/yt-PUBLIC-5.0/pipe1/CFD
nProcs : 4
Slaves :
3
(
"yt-Super-Server.30806"
"yt-Super-Server.30807"
"yt-Super-Server.30808"
)

Pstream initialized with:
floatTransfer : 0
nProcsSimpleSum : 0
commsType : nonBlocking
polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Selecting dynamicFvMesh dynamicRefineFvMesh
Detected 8000 cells that are protected from refinement. Writing these to cellSet protectedCells.

PISO: Operating solver in PISO mode

Reading field p

Reading physical velocity field U
Note: only if voidfraction at boundary is 1, U is superficial velocity!!!

Reading physical velocity field U
Note: only if voidfraction at boundary is 1, U is superficial velocity!!!

Creating dummy density field rho = 1

Reading field phiIB

Reading field phiIB

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type laminar
Selecting laminar stress model Stokes
Reading field interFace

Reading g
Selecting locateModel engineIB
Selecting dataExchangeModel twoWayMPI
Starting up LIGGGHTS for first time execution
Executing input script '../DEM/in.liggghts_init'
LIGGGHTS (Version LIGGGHTS-PUBLIC 3.8.0, compiled 2018-04-05-17:18:05 by yt, git commit 28301df8853491784b1d8b90533ea89b8c6af1e8)
atom_style granular
atom_modify map array
communicate single vel yes
atom_modify map hash sort 10000 2.0
boundary p f f
newton off

units si
processors 4 1 1

region reg block 0.003 0.097 -0.004 0.004 -0.004 0.004 units box
create_box 1 reg
Created orthogonal box = (0.003 -0.004 -0.004) to (0.097 0.004 0.004)
4 by 1 by 1 MPI processor grid

#read_data ../DEM/initial.configuration

#insertion particles
create_atoms 1 single .01 .0025 .0025 units box
Created 1 atoms
#create_atoms 1 single .03 .002 .002 units box
set atom 1 diameter 0.0009 density 1.5 vx 0 vy 0 vz 0
Setting atom values ...
1 settings made for diameter
1 settings made for density
1 settings made for vx
1 settings made for vy
1 settings made for vz
#set atom 2 diameter 0.0009 density 1.5 vx 0 vy 0 vz 0

neighbor 0.003 bin #d/3
neigh_modify delay 0
#neighbor 0.3 bin
#neigh_modify delay 0 binsize 0.01

#material properties required for new pair styles
fix m1 all property/global youngsModulus peratomtype 5.e6
fix m2 all property/global poissonsRatio peratomtype 0.45
fix m3 all property/global coefficientRestitution peratomtypepair 1 0.3
fix m4 all property/global coefficientFriction peratomtypepair 1 0.5

#pair style
pair_style gran model hertz tangential history
pair_coeff * *

#timestep, gravity
timestep 0.00003
#fix gravi all gravity 9.81 vector 0.0 0.0 -1.0
fix gravi all gravity 0 vector -1.0 0.0 0.0

fix cad1 all mesh/surface file ../DEM/cylinder.stl type 1 scale 1 curvature 1e-5

Reading STL file '../DEM/cylinder.stl' (mesh processing step 1/3)
# create single partciles

#use the imported mesh as granular wall
fix geometry all wall/gran model hertz tangential history mesh n_meshes 1 meshes cad1

#particle insertion
#region regIns cylinder x 0. 0. 0.0004 0.0035 0.0965 units box
#fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 1050 radius constant 0.00045
#fix pdd1 all particledistribution/discrete 6778 1 pts1 1.0
#fix ins1 all insert/pack seed 1000 distributiontemplate pdd1 insert_every once overlapcheck yes vel constant 0. 0. 0 region regIns particles_in_region 1 ntry_mc 1000
#fix ins1 all insert/pack seed 1000 distributiontemplate pdd1 insert_every once overlapcheck yes vel constant 0. 0. -0.02 region regIns volumefraction_region 0.005 ntry_mc 1000

#cfd coupling
fix cfd all couple/cfd couple_every 10 mpi
couple_every as specified in LIGGGHTS is overriden by calling external program (../fix_cfd_coupling.cpp:114)
fix cfd2 all couple/cfd/force

#apply nve integration to all particles that are inserted as single particles
fix integr all nve/sphere

#screen output
compute 1 all erotate/sphere
thermo_style custom step atoms ke c_1 vol
thermo 1000
thermo_modify lost ignore norm no
compute_modify thermo_temp dynamic yes
WARNING: Changing thermo_temp compute object. This object is deprecated and will be removed in the future. (../compute.cpp:161)

#insert the first particles so that dump is not empty

run 1
Setting up run at Wed Jun 6 08:53:20 2018

Mesh cad1: 202 elements have high aspect ratio (soft limit: smallest angle > 0.500000 ° required)
WARNING: Fix mesh: Mesh contains highly skewed element, moving mesh (if used) will not parallelize well (../surface_mesh_I.h:657)
WARNING: Not all nodes of fix mesh inside simulation box, elements will be deleted or wrapped around periodic boundary conditions (../fix_mesh.cpp:531)
Import and parallelization of mesh cad1 containing 202 triangle(s) successful
Memory usage per processor = 6.73311 Mbytes
Step Atoms KinEng 1 Volume
0 1 0 0 6.016e-06
1 1 0 0 6.016e-06
Loop time of 5.22137e-05 on 4 procs for 1 steps with 1 atoms, finish time Wed Jun 6 08:53:20 2018

Pair time (%) = 1.19209e-06 (2.28311)
Neigh time (%) = 0 (0)
Comm time (%) = 1.66893e-06 (3.19635)
Outpt time (%) = 1.68085e-05 (32.1918)
Other time (%) = 3.25441e-05 (62.3288)

Nlocal: 0.25 ave 1 max 0 min
Histogram: 3 0 0 0 0 0 0 0 0 1
Nghost: 0 ave 0 max 0 min
Histogram: 4 0 0 0 0 0 0 0 0 0
Neighs: 0 ave 0 max 0 min
Histogram: 4 0 0 0 0 0 0 0 0 0

Total # of neighbors = 0
Ave neighs/atom = 0
Neighbor list builds = 0
Dangerous builds = 0
dump dmp all custom 10000 ../DEM/post/dump*.particles id type density x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius
dump dmpcylinder all mesh/vtk 330000 ../DEM/post/dump*.cad.vtk id cad1

run 333334 upto
Setting up run at Wed Jun 6 08:53:20 2018

paul | Wed, 06/06/2018 - 08:27

cfdemSolverIB should be fvOptions-enabled, judging by the source.
Maybe try to put #define version22 somewhere in the start of cfdemSolverIB.C and recompile.

Also, good luck with doing FSI.

yeting | Thu, 06/07/2018 - 08:25

Thanks for your help!
I find this cfdemSolverIB.C and look it.it use 'if....else...' to define . According to your answer, I'm just going to add '#define version22' here, does that mean that?There are 22 and 30,does this mean the version number of cfdem?(Now,i use OF-5.x + liggghts-3.8.0 + CFDEM-3.8.0) If not, what exactly does it mean? Thanks again ! here is a part of cfdemIB.C code:
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "OFversion.H"

#if defined(version30)
#include "turbulentTransportModel.H"
#include "pisoControl.H"
#else
#include "turbulenceModel.H"
#endif
#include "cfdemCloudIB.H"
#if defined(superquadrics_flag)
#include "cfdemCloudIBSuperquadric.H"
#endif
#include "implicitCouple.H"

#include "averagingModel.H"
#include "voidFractionModel.H"

#include "dynamicFvMesh.H"

#include "cellSet.H"

#if defined(version22)
#include "meshToMeshNew.H"
#include "fvIOoptionList.H"
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"

#include "createTime.H"

#include "createDynamicFvMesh.H"

#if defined(version30)
pisoControl piso(mesh);
#include "createTimeControls.H"
#endif

#include "createFields.H"

#include "initContinuityErrs.H"

#if defined(version22)
#include "createFvOptions.H"
#endif

// create cfdemCloud
#include "readGravitationalAcceleration.H"
#if defined(superquadrics_flag)
cfdemCloudIBSuperquadric particleCloud(mesh);
#else
cfdemCloudIB particleCloud(mesh);
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

//=== dyM ===================
interFace = mag(mesh.lookupObject("voidfractionNext"));
particleCloud.setMeshHasUpdatedFlag(mesh.update()); //dyM

#if defined(version30)
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
#else
#include "readPISOControls.H"
#include "CourantNo.H"
#endif

// do particle stuff
Info << "- evolve()" << endl;
particleCloud.evolve(voidfraction, interFace);

// Pressure-velocity PISO corrector
if(particleCloud.solveFlow())
{
// Momentum predictor

fvVectorMatrix UEqn
(
fvm::ddt(U) //fvm::ddt(voidfraction,U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
#if defined(version22)
==
fvOptions(U)
#endif
);

UEqn.relax();

#if defined(version22)
fvOptions.constrain(UEqn);
#endif

#if defined(version30)
if (piso.momentumPredictor())
#else
if (momentumPredictor)
#endif
{
solve(UEqn == -fvc::grad(p));
}

// --- PISO loop
#if defined(version30)
while (piso.correct())
#else
for (int corr=0; corrcorrect();

Info << "particleCloud.calcVelocityCorrection() " << endl;
volScalarField voidfractionNext=mesh.lookupObject("voidfractionNext");
particleCloud.calcVelocityCorrection(p,U,phiIB,voidfractionNext);

#if defined(version22)
fvOptions.correct(U);
#endif

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}

paul | Thu, 06/07/2018 - 10:12

version22 and version30 refer to the version of OpenFOAM, the preprocessor macros are used to account for changes in the API - and it's a mess, but there is no better option if backwards compatibility is to be preserved.
A #define was probably forgotten in https://github.com/CFDEMproject/CFDEMcoupling-PUBLIC/blob/master/src/lag...

Just either
remove the #if defined(version22) and #endif around the each wrapped statement
OR
#define version22 before the first occurence of #if defined(version22)

yeting | Thu, 06/07/2018 - 16:02

Thanks for your help again !
I've tried both in my case.
I go to remove the #if defined(version22)and #endif. Then i recomplie my case,and it do not pass.The following error occurred ,like@1. After that, I logged out #include "meshToMeshNew.H". Yet again there is an error,like @2.They all said there was no such document. I looked in the source file, but there was nothing in it. now i have no idea. What should I do next ? I appreciate your helping me.

@1:
Making dependency list for source file my_cfdemSolverIB.C
could not open file omp.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pmpicxx.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pop_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pgroup_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pstatus_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/prequest_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file math.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file cfdemCloudIBSuperquadric.H for source file my_cfdemSolverIB.C due to No such file or directory
could not open file meshToMeshNew.H for source file my_cfdemSolverIB.C due to No such file or directory
could not open file fvIOoptionList.H for source file my_cfdemSolverIB.C due to No such file or directory
could not open file readPISOControls.H for source file my_cfdemSolverIB.C due to No such file or directory
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -DOMPI_SKIP_MPICXX -DSUPERQUADRIC_ACTIVE_FLAG -DNONSPHERICAL_ACTIVE_FLAG -DCFDEMWMPROJECTVERSION="50" -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread -I/opt/openfoam5/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam5/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam5/src/fvOptions/lnInclude -I/opt/openfoam5/src/transportModels -I/opt/openfoam5/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam5/src/finiteVolume/lnInclude -I/home/yt/CFDEM/CFDEMcoupling-PUBLIC-3.8.0/src/lagrangian/cfdemParticle/lnInclude -I/opt/openfoam5/src/meshTools/lnInclude -I/opt/openfoam5/src/sampling/lnInclude -I/opt/openfoam5/src/dynamicFvMesh/lnInclude -I/opt/openfoam5/src/dynamicMesh/lnInclude -I/opt/openfoam5/src/dynamicMesh/dynamicFvMesh/lnInclude -I/opt/openfoam5/src/dynamicMesh/dynamicMesh/lnInclude -I/home/yt/LIGGGHTS1/LIGGGHTS-PUBLIC/src -IlnInclude -I. -I/opt/openfoam5/src/OpenFOAM/lnInclude -I/opt/openfoam5/src/OSspecific/POSIX/lnInclude -fPIC -c my_cfdemSolverIB.C -o Make/linux64GccDPInt32Opt/my_cfdemSolverIB.o
my_cfdemSolverIB.C:64:31: fatal error: meshToMeshNew.H: No such file or directory
#include "meshToMeshNew.H"
^
compilation terminated.
make: *** [Make/linux64GccDPInt32Opt/my_cfdemSolverIB.o] Error 1

@2:

Making dependency list for source file my_cfdemSolverIB.C
could not open file omp.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pmpicxx.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pop_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pgroup_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/pstatus_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file ompi/mpi/cxx/prequest_inln.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file math.h for source file my_cfdemSolverIB.C due to No such file or directory
could not open file cfdemCloudIBSuperquadric.H for source file my_cfdemSolverIB.C due to No such file or directory
could not open file fvIOoptionList.H for source file my_cfdemSolverIB.C due to No such file or directory
could not open file readPISOControls.H for source file my_cfdemSolverIB.C due to No such file or directory
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3 -DNoRepository -ftemplate-depth-100 -DOMPI_SKIP_MPICXX -DSUPERQUADRIC_ACTIVE_FLAG -DNONSPHERICAL_ACTIVE_FLAG -DCFDEMWMPROJECTVERSION="50" -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread -I/opt/openfoam5/src/TurbulenceModels/turbulenceModels/lnInclude -I/opt/openfoam5/src/TurbulenceModels/incompressible/lnInclude -I/opt/openfoam5/src/fvOptions/lnInclude -I/opt/openfoam5/src/transportModels -I/opt/openfoam5/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam5/src/finiteVolume/lnInclude -I/home/yt/CFDEM/CFDEMcoupling-PUBLIC-3.8.0/src/lagrangian/cfdemParticle/lnInclude -I/opt/openfoam5/src/meshTools/lnInclude -I/opt/openfoam5/src/sampling/lnInclude -I/opt/openfoam5/src/dynamicFvMesh/lnInclude -I/opt/openfoam5/src/dynamicMesh/lnInclude -I/opt/openfoam5/src/dynamicMesh/dynamicFvMesh/lnInclude -I/opt/openfoam5/src/dynamicMesh/dynamicMesh/lnInclude -I/home/yt/LIGGGHTS1/LIGGGHTS-PUBLIC/src -IlnInclude -I. -I/opt/openfoam5/src/OpenFOAM/lnInclude -I/opt/openfoam5/src/OSspecific/POSIX/lnInclude -fPIC -c my_cfdemSolverIB.C -o Make/linux64GccDPInt32Opt/my_cfdemSolverIB.o
my_cfdemSolverIB.C:65:32: fatal error: fvIOoptionList.H: No such file or directory
#include "fvIOoptionList.H"
^
compilation terminated.
make: *** [Make/linux64GccDPInt32Opt/my_cfdemSolverIB.o] Error 1

paul | Sun, 06/10/2018 - 16:45

This works for me:

#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "OFversion.H"

#include "fvOptions.H" // added!

#if defined(version30)
#include "turbulentTransportModel.H"
#include "pisoControl.H"
#else
#include "turbulenceModel.H"
#endif
#include "cfdemCloudIB.H"
#if defined(superquadrics_flag)
#include "cfdemCloudIBSuperquadric.H"
#endif
#include "implicitCouple.H"

#include "averagingModel.H"
#include "voidFractionModel.H"

#include "dynamicFvMesh.H"

#include "cellSet.H"

#if defined(version22)
#include "meshToMeshNew.H"
#include "fvIOoptionList.H"
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCase.H"

#include "createTime.H"

#include "createDynamicFvMesh.H"

#if defined(version30)
pisoControl piso(mesh);
#include "createTimeControls.H"
#endif

#include "createFields.H"

#include "initContinuityErrs.H"

#include "createFvOptions.H"

// create cfdemCloud
#include "readGravitationalAcceleration.H"
#if defined(superquadrics_flag)
cfdemCloudIBSuperquadric particleCloud(mesh);
#else
cfdemCloudIB particleCloud(mesh);
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nStarting time loop\n" << endl;

while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

//=== dyM ===================
interFace = mag(mesh.lookupObject("voidfractionNext"));
particleCloud.setMeshHasUpdatedFlag(mesh.update()); //dyM

#if defined(version30)
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
#else
#include "readPISOControls.H"
#include "CourantNo.H"
#endif

// do particle stuff
Info << "- evolve()" << endl;
particleCloud.evolve(voidfraction, interFace);

// Pressure-velocity PISO corrector
if(particleCloud.solveFlow())
{
// Momentum predictor

fvVectorMatrix UEqn
(
fvm::ddt(U) //fvm::ddt(voidfraction,U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
==
fvOptions(U)
);

UEqn.relax();

fvOptions.constrain(UEqn);

#if defined(version30)
if (piso.momentumPredictor())
#else
if (momentumPredictor)
#endif
{
solve(UEqn == -fvc::grad(p));
}

// --- PISO loop
#if defined(version30)
while (piso.correct())
#else
for (int corr=0; corrcorrect();

Info << "particleCloud.calcVelocityCorrection() " << endl;
volScalarField voidfractionNext=mesh.lookupObject("voidfractionNext");
particleCloud.calcVelocityCorrection(p,U,phiIB,voidfractionNext);

fvOptions.correct(U);

runTime.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}

Info<< "End\n" << endl;

return 0;
}

Add -lfvOptions to Make/options for linking. This is unvalidated though. Make sure to do a few validation cases.

yeting | Mon, 06/11/2018 - 10:17

Thanks for your help ! it works ! This problem has been bothering me for a long time.Now that it's working, I'm happy.thank you again.
I run my case ,i find a question. The source term provided in CFDEM, its class term is meanSupVelocityForce, but there is not found .There is meanVelocityForce.What are the difference both?