stranskyjan / dem-fem-coupling

Open source codes for coupling of Finite Element Method and Discrete Element Method using YADE, and OOFEM softwares.
43 stars 24 forks source link

run the oofem module alone #14

Closed wcc201834748 closed 4 years ago

wcc201834748 commented 4 years ago

Dear Jan, sorry to bother you again. I want to change the model in oofem, but i don't know how to run the software. I know it may be more suitable to consult the oofem forum, i tried but nobody answer me yet. So i have to bother you, the oofem is not very friendly to beginners. I hope you may provide some suggestions about learning the oofem. Best regards.

stranskyjan commented 4 years ago

Hello,

I want to change the model in oofem

please be more specific.

i don't know how to run the software

there are several possible ways:

oofem is not very friendly to beginners

it is a complex program with complex documentation and complex input, but to make it work with an example script should be ok

I hope you may provide some suggestions about learning the oofem

See:

cheers Jan

wcc201834748 commented 4 years ago

Thank you Jan, i want to change the model in the fem part and increase the particle numbers,.And the help info what you talk about are those manuals? like input ,element ? And how to run the software by python ? Maybe by the python binding? What embarrasses me most is that i am not familiar with the Linux systerm.

stranskyjan commented 4 years ago

i want to change the model in the fem part

yes, this is clear from the first post :-) but please be more specific, as it can have many meanings..

the help info what you talk about are those manuals? like input ,element ?

yes, those links after "See:"

how to run the software by python ?

simply python script.py, where script.py is the script with your simulation, e.g. demfem/oofem/source/bindings/python/test2.py

What embarrasses me most is that i am not familiar with the Linux systerm.

yes, coming to Linux takes some time to feel comfortable..

cheers Jan

wcc201834748 commented 4 years ago

Thank you Jan, At this initial stage, i want to change the geometry of the model, and after I mastered these two softwares, i may use the you coupling module to simulate the water inrush in tunnel construction. And after i run the test, how can i see the animation of the simulation? By oofeg? or using Paraview?

stranskyjan commented 4 years ago

i want to change the geometry of the model

then you have to modify the nodes and elements in the *_oofem.py part. One option is to load the mesh from en externally prepared file (created by a meshing program). In the examples, the meshes are very simple, prepared "manually" in the script, but for more complicated geometries, the externally created mesh is probably the preferable way.

how can i see the animation of the simulation? By oofeg? or using Paraview?

I suggest paraview. Both oofem and yade support vtk output, paraview is a powerful tool with many users so one can find helps on the internet. In the examples, pvpython (paraview python) is used to create the output images.

Jan

wcc201834748 commented 4 years ago

Dear Jan, I read the 'Running the code 'part of the oofeminput manual, it said that 'the program can be executed by typing oofem [option [parameter]] ...', but when i type 'oofem -v' or 'oofem -filename' , It didn't work. Does there exist a exe like yade that i can run the software dirctly in oofem. And i can run the vol1 coupling example, does it means that i had installed the oofem already, that i need not to install oofem again. By the way, thank you Jan sincerely, i know the problem that i ask may be very elementary, and you still answer me patientfully, that really inspire me.

stranskyjan commented 4 years ago

It didn't work.

please be more specific. (e.g. paste here an error if you get some)

e.g. oofem has to be in the path (where Linux can find it), or you have to type full exe name, in this case .../oofem/build/oofem, where ... is where you have compiled oofem using make command

i can run the vol1 coupling example, does it means that i had installed the oofem already

yes.

i know the problem that i ask may be very elementary, and you still answer me patientfully, that really inspire me.

"elementary" is very relative :-) I was in the same situation and remember the difficulties

Jan

wcc201834748 commented 4 years ago

Dear Jan, every time i input 'oofem -f ' in the teminal, it returned 'oofem: Command not found '. I try the command in the path: /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/builde or source or source-orig but still return the error 'Command not found'.

stranskyjan commented 4 years ago

/home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/builde

it should be .../oofem/build/oofem

wcc201834748 commented 4 years ago

....i tried, but still return the error 'oofem: command not find' /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem

stranskyjan commented 4 years ago

so step by step :-) what is the output of ls /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem ?

wcc201834748 commented 4 years ago

it return 'build oofem.zip source source-orig'

stranskyjan commented 4 years ago

ok, if you type /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/build/oofem to the console, what happens?

wcc201834748 commented 4 years ago

it output options: Options: -v prints oofem version -f (string) input file name -r (int) restarts analysis from given step -ar (int) restarts adaptive analysis from given step -l (int) sets treshold for log messages (Errors=0, Warnings=1, Relevant=2, Info=3, Debug=4) -rn turns on renumbering -qo (string) redirects the standard output stream to given file -qe (string) redirects the standard error stream to given file -c creates context file for each solution step

stranskyjan commented 4 years ago

that's it :-) now you can add -f fileName, e.g. the example file

Jan

wcc201834748 commented 4 years ago

that failed Jan, i first print the command 'cd home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/build' , then i tried the command 'oofem -f patch100.out' and 'oofem -f beam2d_1.in' or 'oofem -v'. but the output is still the 'oofem: command not find'. I enter it father file '.../oofem', and tried the same command but still the same error.

stranskyjan commented 4 years ago

then ./oofem -f ... instead of oofem -f ...

or /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/build/oofem -f ...

wcc201834748 commented 4 years ago

oh! it work, it is successful when i print ./oofem -v , and when i tried run the test files like 'patch100.out' or 'beam2d_1.in', it return : Error: (/home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/source/src/oofemlib/oofemtxtdatareader.C:49) In OOFEMTXTDataReader: Can't open input stream (beam2d_1.in) Does it means that i need copy the file to the 'build file'?

stranskyjan commented 4 years ago

Does it means that i need copy the file to the 'build file'?

it is one option. Preferable way is to save the file to some reasonable directory (e.g. home/weicc/tests/oofem or something like that) and run the examples from that directory, meaning using /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/build/oofem -f ...

not to write the full path every time, one option is to create a $HOME/bin, add it to PATH environment variable and create a symbolic link: mkdir -p $HOME/bin echo 'export PATH=$HOME/bin:$PATH' > $HOME/.bashrc ln -s /home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/build/oofem $HOME/bin/oofem

wcc201834748 commented 4 years ago

Thank you so much Jan, By your command i successful run the software, i will try my best to master the oofem and yade. But it may meet some problems during this process, and i may disturb you from time to time. I hope it would not influence you daily life and work, very sorry to you. Thank you Jan. Best regards.

wcc201834748 commented 4 years ago

Dear Jan, i want to install oofeg for post-processing, because now it a little hard for me to use VTK to deal with the oofem simulation, does the oofeg existed in oofem software as one part module or i need download from the official website?Or the oofeg is just existing Windows system?

stranskyjan commented 4 years ago

I haven't used oofeg, because it is way harder to use then paraview :-) see wiki page. Oofem has to be compiled with some special flags to enable oofeg, see installation instructions if you are interested.

But i strongly suggest to use paraview

stranskyjan commented 4 years ago

echo 'export PATH=$HOME/bin:$PATH' > $HOME/.bashrc

sorry, this one should have been echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bashrc otherwise it rewrites .bashrc file completely. If you have done it, consider its restore by cp /etc/skel/.bashrc $HOME/.bashrc

wcc201834748 commented 4 years ago

thanks Jan, i correct that mistake, and i will forget oofeg and try to get use to paraview. Sorry Jan, I acted a little anxious about the software, because i have only one year to finish the ralative simulation that i need, I will graduate with a master's degree next year. But it is totally a new filed to me. thank you

wcc201834748 commented 4 years ago

Dear Jan, now i get a little familiar with yade and oofem, and i try to change the model of the coupling examples, like extend the element of the model, but after i change the code, and print 'make all', it return the error: python -m cProfile -o /tmp/vol1.pro vol1.py Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/lib/python2.7/cProfile.py", line 200, in main() File "/usr/lib/python2.7/cProfile.py", line 193, in main runctx(code, globs, None, options.outfile, options.sort) File "/usr/lib/python2.7/cProfile.py", line 49, in runctx prof = prof.runctx(statement, globals, locals) File "/usr/lib/python2.7/cProfile.py", line 140, in runctx exec cmd in globals, locals File "vol1.py", line 8, in import liboofem ImportError: No module named liboofem Makefile:41: recipe for target 'example' failed make: *** [example] Error 1 how can i finish the error? thank you Jan.

stranskyjan commented 4 years ago

Could be related to the deletion of .bashrc file. Try make all in installation directory

wcc201834748 commented 4 years ago

Jan, you suggestion seems like to re-install the module again?

stranskyjan commented 4 years ago

you can try make install first

wcc201834748 commented 4 years ago

i try the make all ,and can i stop it after it finish the oofem part?

stranskyjan commented 4 years ago

you can stop it, but run make install afterwards

wcc201834748 commented 4 years ago

Jan, after i run the make install,it return: Now everything should be compiled and prepared for use. Try out some examples :-)

There is no need to run this script any more

If you want to run examples directly in this terminal, execute the following command: export PYTHONPATH=$PYTHONPATH:/home/weicc/下载/dem-fem-coupling-master/installation/_build/install:

and i then use the make all commend in multi1 but still show the error: python -m cProfile -o /tmp/multi1.pro multi1.py /home/weicc/下载/dem-fem-coupling-master/installation/_build/yade/install/lib/x86_64-linux-gnu/yade/py/yade/system.py:9: RuntimeWarning: to-Python converter for std::vector<int, std::allocator > already registered; second conversion method ignored. from yade._customConverters import /home/weicc/下载/dem-fem-coupling-master/installation/_build/yade/install/lib/x86_64-linux-gnu/yade/py/yade/system.py:9: RuntimeWarning: to-Python converter for std::vector<double, std::allocator > already registered; second conversion method ignored. from yade._customConverters import Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/lib/python2.7/cProfile.py", line 200, in main() File "/usr/lib/python2.7/cProfile.py", line 193, in main runctx(code, globs, None, options.outfile, options.sort) File "/usr/lib/python2.7/cProfile.py", line 49, in runctx prof = prof.runctx(statement, globals, locals) File "/usr/lib/python2.7/cProfile.py", line 140, in runctx exec cmd in globals, locals File "multi1.py", line 20, in fem = OofemInterface(femName,liboofem) File "/home/weicc/下载/dem-fem-coupling-master/installation/_build/install/demfemcoupling.py", line 121, in init m = import(self.fileName) File "multi1_oofem.py", line 63 liboofem.element("lspace", , domain, nodes=(13 ,14,15,16,17,18,19,20), mat=4, crosssect=4) ^ SyntaxError: invalid syntax Makefile:41: recipe for target 'example' failed make: *** [example] Error 1

stranskyjan commented 4 years ago

liboofem.element("lspace", , domain, nodes=(13 ,14,15,16,17,18,19,20), mat=4, crosssect=4) ^ SyntaxError: invalid syntax

it means that line is invalid syntax for Python (two commas and nothing/just space between them I guess).

wcc201834748 commented 4 years ago

ok, thank you Jan , i know the problem may be where i change the model , i will change the syntax of the commend.Thank you Jan

wcc201834748 commented 4 years ago

Dear Jan i get confuse of you code about the ' bc' . I don't understand the meaning of the coords of the 'bc'

liboofem.node( 1, domain, coords=(0,0,3), bc=(1,1,2))

and the difference between nodes' bc coords.

wcc201834748 commented 4 years ago

i know bc is the meaning of boundary condition. But i don't understand the meaning of

bc=(1,1,2) thank you Jan

Dez2018 commented 4 years ago

Dear Jan i get confuse of you code about the ' bc' . I don't understand the meaning of the coords of the 'bc' liboofem.node( 1, domain, coords=(0,0,3), bc=(1,1,2)) and the difference between nodes' bc coords.

'bc' means boundary condition :) 0 means free; 1means fixed. 2 means translation and rotation fixed?

wcc201834748 commented 4 years ago

Thank you Dez2018, the code is from the multiscale coupling; oofem part , and all the upper node's bc is 1 ,1, 2, and the middle 8 nodes' s bc are 1,1,0 ,all these node's translation of z coordinate are no limited. I don't understand the difference of it.

Dez2018 commented 4 years ago

0 means free of translation and rotation. 1 means fixed of translation. I think the code may fixed all movement of the upper nodes at the Z direction as the boundary condition. :)

wcc201834748 commented 4 years ago

师姐,你有中文邮箱吗?我能发邮件给你,请教下相关的问题吗?英文不太好。。。 @Dez2018

Dez2018 commented 4 years ago

师姐,你有中文邮箱吗?我能发邮件给你,请教下相关的问题吗?英文不太好。。。 @Dez2018

Ha ha, I'm a boy. This is the picture of my girlfriend. My QQ number is 852321355. :)哈哈 我是男生,这是我女朋友的头像。我的QQ是 852321355 可以交流

stranskyjan commented 4 years ago

for "ordinary nodes", bc array corresponds to x, y, z boundary condition.

in the cases mentiones:

Also have a look at manual

cheers Jan

wcc201834748 commented 4 years ago

Thank you Jan, i have looked the input manual,but a little misunderstand about it. And when i want to use the vtkxml module to get the data of simulation , but it return the error:

Error: (/home/weicc/下载/dem-fem-coupling-master/installation/_build/oofem/source/src/oofemlib/domain.C:487) Input error on line 7: "Missing Keyword", field keyword "domain" In function Domain::instanciateYourself Record:"vtkxml tstep_all domain_all primvars 1 vars 1 2 3 4 cellvars 1 46"

i use the text example in sm part of oofem , named beam2d_1.in, this is part of it's code :

beam2d_1.out Homework www sm40 no. 1

only momentum influence to the displacements is taken into account

beamShearCoeff is artificially enlarged.

StaticStructural nsteps 3 nmodules 1 errorcheck vtkxml tstep_all domain_all primvars 1 vars 1 2 cellvars 1 46 domain 2dBeam OutputManager tstep_all dofman_all element_all ndofman 6 nelem 5 ncrosssect 1 nmat 1 nbc 6 nic 0 nltf 3 nset 7

and can i directly open the output file in paraview to finish the post-processing .

stranskyjan commented 4 years ago

Do you use a text input file or a python script?

wcc201834748 commented 4 years ago

i use the text input file.

stranskyjan commented 4 years ago

you have added a new module (VTKExportModule), you have to update nmodules value.

This worked for me (with cellvars and primvars I got some errors):

...
StaticStructural nsteps 3 nmodules 2
errorcheck
vtkxml tstep_all domain_all vars 1 2
...
wcc201834748 commented 4 years ago

Thank you Jan, I tried it again,and successed. And the output file can be read in paraview directly. And i wonder that if i want to simulate a huge engneering scale problem, and the element number is also very large , should i input all nodes information, maybe 10000 nodes? Or there is a way to fast modeling?

stranskyjan commented 4 years ago

In the input text file, you have to include all nodes and elements. Of course, you can use some preprocessing / conversion, e.g. Unv2oofem convertor (I have no experience with it) or some "one purpose" script creating the input file (this is how I used to do it) cheers Jan

wcc201834748 commented 4 years ago

Dear Jan, i wonder that can i directly run the python script in paraview to finish the oofem part model's visualization, for example : i try to run the multi_oofem.py in paraview's tool- python shell. I am sorry for that it may be very easy to write the relate code in python file to solve the problem , i still not master the python language very will. That is also the reason that i use the oofem input file rather than the python file.

stranskyjan commented 4 years ago

multi_oofem.py is a script dedicated for oofem part of the simulation. For paraview, there is multi1_pv.py. I think it should be possible to run it directly in paraview (haven't tried, let me know :-)

wcc201834748 commented 4 years ago

Dear Jan, when i tried the example, it appear the error again, No module named liboofem and i tried the make install command. It shows that 'Now everything should be compiled and prepared for use.' What should i do to solve the problem?