phantom icon indicating copy to clipboard operation
phantom copied to clipboard

Issue regarding reading the simulation output files using python readers

Open auratrik opened this issue 2 years ago • 2 comments

Hello, I am new to Phantom. I have managed to successfully run the simulation. The output files I got after running the simulation are the standard output files.

I need to read the output files using the python codes. I followed the instructions on the bitbucket documentation for Analysis with Python. I followed these steps for that: make pyanalysis After this step I am getting the files libphantom.so and libanalysis.py

However then when I am opening a python script and using the below command:

from libanalysis import PhantomAnalysis as pa

I am getting the following error:

Traceback (most recent call last): File "", line 1, in File "/home/auratrik/phantom-master/mhd_turb/libanalysis.py", line 3, in from phantomanalysis import PhantomAnalysis File "/home/auratrik/phantom-master//scripts/pyphantom/phantomanalysis.py", line 44 print "Unable to load uterm, likely the quantity is not stored." ^ The simulation ran perfectly and I am able to produce the outputs using splash. However, for the python codes I am getting the error.

Could I please get some help on this?

Cheers Auratrik

auratrik avatar Aug 09 '21 13:08 auratrik

I guess your simulation is isothermal but it is trying to read the thermal energy for some reason, which does not exist

danieljprice avatar Aug 11 '21 23:08 danieljprice

Hi So, I checked my simulation again. It is isothermal. But also I went to the source code where the error is occuring. The file is located in phantom-master/scripts/pyphantom and is named phantomanalysis.py

Here the code snippet causing the problem is: try: self.utherm = self.get_part_u(npart)/(udist2/utime2) except: print "Unable to load uterm, likely the quantity is not stored." try: self.temperature = self.get_part_temp(npart) except: print "Unable to load temperature, likely the quantity is not stored." try: self.bxyz = self.get_part_bxyz(npart)/umagfd except: print "Unable to load magnetic field, likely the quantity is not stored."

For checking purposes I temporarily removed the thermal energy part from the code to check the temperature and magnetic field code. But for both temperature and magnetic field the same problem is coming, ie, it is telling that the quantity is not stored. However, in the simulation I used mhd so both temperature and magnetic field data should be there.

Is there some way to fix this problem ? Cheers Auratrik

auratrik avatar Aug 12 '21 15:08 auratrik

These issues are solved by https://github.com/ttricco/sarracen

danieljprice avatar Mar 08 '23 23:03 danieljprice