Closed wsrosent closed 5 years ago
Can you please specify which version of PyGran you're using? Currently on github v1.2.0 is undergoing major changes and the online documentation (still being updated) is for v1.2.0 and above. Version 1.1 (available from pip) works fine with the hopper flow (tests/scripts/DEM/flow.py). PyGran will be available via conda starting v1.2, which will be released in few weeks. The DEM class should be successfully instantiated with **params in v1.1 and above. It seems the script you're running is from older versions? Can you please specify where you got the script from / attack the file here? Thank you.
I have updated the installation doc to reflect the submodular change in PyGran's design. Plz make sure to follow the instructions, and you should be able to get both the simulation and analysis tests completed. The missing modules you encountered is because git requires explicit submodule commands to clone the simulation/analysis/params modules. This is now reflected here. I have successfully tested v1.2.0-prealpha (master branch on github) on Ubuntu 18.04 with pipenv and LIGGGHTS 3.8.0. If you encounter any bugs, plz do report them here.
I have also realized you were referring to the hopper demo show on PyGran webpage. Unfortunately, that was not up to date, but that has been fixed. Thanks for pointing it out.
Thanks for your help. I have pasted below the script I ran which produced the cohesionEnergyDensity bug. This was after installing PyGran using pip in a fresh Anaconda environment. I also copied and tried your most recent hopper demo script (i.e. without model key in param) and got the same key error for cohesionEnergyDensity. I'll try your updated installation instructions for the submodules next.
=======================================
from PyGran import simulation
from PyGran import params
# Create a DEM parameter dictionary
param = {
'model': simulation.models.SpringDashpot,
'boundary': ('f','f','f'),
'box': (-1.e-3, 1.e-3, -1.e-3, 1.e-3, 0., 4.e-3),
'species': ({'material': params.stearicAcid, 'radius': 5.e-5,},
),
'gravity': (9.81, 0., 0., -1.),
'mesh': { 'hopper': {'file': 'silo.stl', 'mtype': 'mesh/surface', \
'material': params.steel}, },
}
# Instantiate a DEM class
sim = simulation.DEM(**param)
# Insert 1000 particles for species 1 (stearic acid)
insert = sim.insert(species=1, value=1000)
# Evolve the system in time
sim.run(nsteps=1e6, dt=1.e-6)
Plz make sure your pygran installation is up to date. Clone the PyGran src code from github then run from the PyGran dir:
git submodule init
git submodule update
pip install . --upgrade
If it does not work, remove the PyGran package completely via: pip uninstall pygran
then plz reinstall the package from its source by following the instructions here.
If this fails then plz run the following and attach the output in a file:
from PyGran import params
import inspect
inspect.getmembers(params)
Thanks. I was able to get the test "python3 -m tests DEM flow" to run on an Ubuntu 18.04 system with the following procedure:
sudo apt-get update && sudo apt-get install gcc libopenmpi-dev python3-setuptools python3-pip ipython3 git python3-matplotlib libvtk6-dev -y
# git clone git@github.com:Andrew-AbiMansour/PyGran.git # FAILED: insufficient access permissions
git clone https://github.com/Andrew-AbiMansour/PyGran.git
cd PyGran
git pull origin master
git submodule init
git submodule update
# pip3 install cython pygran --user # FAILED: crashes with segmentation fault
pip3 install -e .[extra] --user # does not install cython
# pip3 install cython -e .[extra] --user # alternative to include cython
python3 setup.py build_liggghts # builds LIGGGHTS .so, but could not cythonize. cython not properly installed? also results in some ISO C++1z register warnings.
pip3 install . --upgrade
python3 -m tests DEM flow
python3 tests/scripts/Particle-Analysis/basics/basics.py "DEM_flow/traj/particles*.dump"
Still having trouble with the hopper. Cannot open the silo.stl mesh file (located in another directory?). Here is the output:
Model <class 'PyGran.simulation.PyGranSim.models.SpringDashpot'> does not yet support estimation of contact period. Using a default value of 1e-06
Using /home/rose396/PyGran/LIGGGHTS-PUBLIC/src/libliggghts.so as a shared library for DEM computations
LIGGGHTS (Version LIGGGHTS-PUBLIC 3.8.0, compiled 2019-10-11-15:49:19 by rose396, git commit ce1931e377a2945e3fa25dae0eebc1f697009a32)
Created orthogonal box = (-0.001 -0.001 0) to (0.001 0.001 0.004)
1 by 1 by 1 MPI processor grid
0 atoms in group group0
Fix particledistribution/discrete (id pdd33395468): distribution based on mass%:
39683678: d=1.000000e-04 (max. bounding sphere) mass%=100.000000%
Fix particledistribution/discrete (id pdd33395468): distribution based on number%:
39683678: d=1.000000e-04 (max. bounding sphere) number%=100.000000%
ERROR on proc 0: Cannot open mesh file /home/rose396/PyGran/silo.stl (../input_mesh_tri.cpp:105)
(../input_mesh_tri.cpp:105)
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI COMMUNICATOR 3 SPLIT FROM 0
with errorcode 1.
NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
I will look into the segmentation fault. For the missing stl file, you are running a sample script from the website without any input files. You need to supply one yourself or just run the provided scripts with their input files available from the demo page.
git clone git@github.com .. fails with permission denied when you have not configured your git username/email. I will update the online tutorial to use the https link instead. Thank you for your input.
I could not find any problem with "pip3 install cython pygran --user". Plz provide additional info on your system specs (OS/version) and software used (pip version) and any pkg/environment management tools (such as conda). I will be closing this as a resolved issue. Plz open a new one for cython / any other specific problem you encounter.
I tried to run the basic hopper simulation demo on the installation page, and it immediately caused errors. I had to change param['model'] to param in the DEM instantiation in order to get the input parameters to expand correctly, and to be safe ensured a float type for parameter values that were intended to be floats. (Note: I also had to try to install PyGran using Anaconda (Ubuntu 18.04) and pip, since the pip-only installation example for Ubuntu 18.04 (LTS) resulted in an empty PyGran module being installed, with no parameters or methods, and no "simulation", etc. submodules or demo scripts.) Installation by Anaconda appeared to go well until I tried to validate the code using the basic hopper simulation. The DEM object instantiation failed with the following error trace:
Traceback (most recent call last): File "hopper_demo.py", line 23, in
sim = simulation.DEM( model=param['model'], boundary=param['boundary'], box=param['box'], species=param['species'], gravity=param['gravity'], mesh=param['mesh'])
File "/home/rose396/.local/lib/python3.7/site-packages/PyGran/simulation/dem.py", line 48, in init
pargs = pargs'model'.params
File "/home/rose396/.local/lib/python3.7/site-packages/PyGran/simulation/models.py", line 439, in init
super(SpringDashpot, self).init(params)
File "/home/rose396/.local/lib/python3.7/site-packages/PyGran/simulation/models.py", line 166, in init
if type(ss['material'][item]) is not float:
KeyError: 'cohesionEnergyDensity'
(PyGran) rose396@we36233:~/PyGran$ gedit hopper_demo.py
(PyGran) rose396@we36233:~/PyGran$ python3 hopper_demo.py
Traceback (most recent call last):
File "hopper_demo.py", line 23, in
sim = simulation.DEM( model=param['model'], boundary=param['boundary'], box=param['box'], species=param['species'], gravity=param['gravity'], mesh=param['mesh'])
File "/home/rose396/.local/lib/python3.7/site-packages/PyGran/simulation/dem.py", line 48, in init
pargs = pargs['model']( pargs).params
File "/home/rose396/.local/lib/python3.7/site-packages/PyGran/simulation/models.py", line 439, in init
super(SpringDashpot, self).init(**params)
File "/home/rose396/.local/lib/python3.7/site-packages/PyGran/simulation/models.py", line 166, in init
if type(ss['material'][item]) is not float:
KeyError: 'cohesionEnergyDensity'