How to define a new drag model and use it in CFDEM Coupling simulation?

Submitted by emmscfd on Wed, 11/14/2012 - 17:48

Hi,everyone!
I want to define a new drag model and use it in my simulation.

here's my steps:

1 I made a new directory named 'Newdrag' in ../submodels/forcemodel, and wrote my Newdrag.C and Newdrag.H there.

2 Then I modifiled 'files' in ~/CFDEM/CFDEMcoupling-PUBLIC-2.1.1/src/lagrangian/cfdemParticle/Make(just add an item '$(forceModels)/NewDrag/NewDrag.C' after item '$(forceModels)/GidaspowDrag/GidaspowDrag.C )', and ran 'wmake' at ../~/CFDEM/CFDEMcoupling-PUBLIC-2.1.1/src/lagrangian /cfdemParticle to compile the NewDrag.C.

3 So far all things went all right, then I modified the 'couplingProperties' at '../CFD/contant', changed the 'GidaspowDrag' to 'NewDrag' and ran 'Allrun.sh' , then things went wrong , it returned error message "unknown forceModelType type NewDrag, constructor not in hash table".

4 Then I found the directory '~/CFDEM/CFDEMcoupling-PUBLIC-2.1.1/src/lagrangian/cfdemParticle/lnInclude' , and I made links of NewDrag.C and NewDrag.H and copied the links to '~/CFDEM/CFDEMcoupling-PUBLIC-2.1.1/src/lagrangian/cfdemParticle /lnInclude'. After doing that ,I thought that I might compile the NewDrag.C again , and I indeed did that.

5 I tried again to change 'GidaspowDrag' to 'NewDrag' and ran again as decribed above, but the problem was still there,'unknown forceModelType type NewDrag, constructor not in hash table' . I kown it means that the 'NewDrag' drag model cannot be found,maybe that's because 'NewDrag' is not included in the dictionary .

So what should I do now?May I refresh the dictionary?If so ,how?

Thanks for the help.

alice's picture

alice | Mon, 11/19/2012 - 07:57

Good morning,
did you already try to complie with "wmake libso" instead of "wmake"? This is used when compiling libraries....
Cheers,
Alice

emmscfd | Thu, 11/22/2012 - 08:05

Thanks,Alice!
I tried "wmake libso",and after the compilation , it returned "liblagrangianCFDEM-PUBLIC-2.1.1.so" is up to date.But I still failed to use my NewDrag.Then I tried this way:
1 Make a new directory nameed ‘NewDrag’,and put my source files in it.
2 Rewrite Makefile , and in the 'files' file , I write like this "NewDrag.C
LIB = $(FOAM_USER_LIBBIN)/libNewDrag "
3 run wmake libso, and a new 'libNewDrag.so' file generated at $FOAM_USER_LIBBIN. Then I add a new line
libs ("libNewDrag.so");
in the' ../system/controldict' file.
And finally , it works!
Is my operation the right way to add new Submodels?Any mistake there?
Cheers

alice's picture

alice | Thu, 11/22/2012 - 08:30

Good morning!
When adding a new force model, the following steps should be sufficient: Create a folder with the name of the model (e.g., myNewModel) in subModels/forceModel and copy your model there (usually myNewModel.C and myNewModel.H). Modify the files file in the Make-folder by including the new model following scheme of the already existing ones ($(forceModels)/myNewModel/myNewModel.C). Then recompile the source with "wmake libso". Go to the solver and recompile it (wclean, rmdepall, wmake). Finally you have to modify your case by plugging in the new model in ./CFD/constant/couplingProperties (dont forget about the myNewModelProps!).
The goal is not to create a library of your own, containing your drag model only, but to modify the existing library (CFDEMcoupling) accordingly, therefore it is not necessary to create a libNewDrag.so!
Cheers,
Alice

emmscfd | Thu, 11/22/2012 - 12:30

Hi, Alice.
Thanks for your help! That's really a very detailed and helpful answer.
At my first try, I just didn't know I should recompile the solvers after the recompilation of submodels. Now I'm gonna try again.

Cheers,
emmscfd