Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading plotfiles from boosted frame examples - ds.field_list error message #190

Closed
LDAmorim opened this issue Jun 27, 2019 · 8 comments
Closed

Comments

@LDAmorim
Copy link
Member

Hi all,

I am opening this issue, just in case any of you have encountered a similar error message before (and also if I find out what mistake I am making, by writing it here no one will repeat it!).

I am trying to change one function (warpx_copy_attribs - which affects back transformed diagnostics) from Fortran to CPP. When I tested the changes in my fork and branch, with the boosted frame examples of the repo, I wasn't able to read the plotfiles information with yt.

Using a jupyter notebook with commandsds=yt.load(f) and then reading the ds.domain_... worked well, but the commandds.field_list would lead to the following errors:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-29-373a8b1d101f> in <module>
      1 # Reading and storing the data
      2 for dirn in range(ldirs):
----> 3     read_data(dirn)

<ipython-input-28-7d03cadc1e74> in read_data(dirn)
     26         print(extent[dirn][iterf])
     27 
---> 28         print(ds.field_list)
     29 
     30         for pn in part_name:

~/anaconda2/lib/python3.7/site-packages/yt/data_objects/static_output.py in field_list(self)
    544     @property
    545     def field_list(self):
--> 546         return self.index.field_list
    547 
    548     def create_field_info(self):

~/anaconda2/lib/python3.7/site-packages/yt/data_objects/static_output.py in index(self)
    502                 raise RuntimeError("You should not instantiate Dataset.")
    503             self._instantiated_index = self._index_class(
--> 504                 self, dataset_type=self.dataset_type)
    505             # Now we do things that we need an instantiated index for
    506             # ...first off, we create our field_info now.

~/anaconda2/lib/python3.7/site-packages/yt/frontends/boxlib/data_structures.py in __init__(self, ds, dataset_type)
   1468                 mass_name = 'particle%.1d_mass' % i
   1469                 self.parameters[charge_name] = val[0]
-> 1470                 self.parameters[mass_name] = val[1]
   1471 
   1472     def _detect_output_fields(self):

IndexError: list index out of range

Although the command ad = ds.all_data() wouldn't lead to any error message, I was unable to load 'electrons' data, getting a similar error message as the one above.

Did any of you ever encounter this error message before?

I tested the same inputs with the dev branch (updated) and I still got the same issue. I didn't have any problem opening the plot files when they resulted from the example input file for modeling the uniform plasma.

I have been (and will keep) trying to figure out my mistake that is causing this. But decided to write it down here in case any of you have any suggestions of how to diagnose it. Right now my plan is to start adding details from the boosted frame in the uniform plasma input until it "breaks".

Thanks,
Diana

@atmyers
Copy link
Member

atmyers commented Jun 27, 2019

I think this is a problem I introduced when I added information about the rigid injected species into WarpXHeader, to fix the restart when those were used.

I am leaving for vacation today, and I'll fix this for real when I get back. In the meantime, you can delete the lines at the end of WarpXHeader that have to do with the rigid injected species, leaving only the species charges and masses, and it should work.

@LDAmorim
Copy link
Member Author

LDAmorim commented Jun 27, 2019 via email

@LDAmorim
Copy link
Member Author

Hi Andrew,

You are right, the attached input file without the beam-rigid-injection lines:

particles.rigid_injected_species = beam
beam.zinject_plane = 20.e-6
beam.rigid_advance = true

Works well and I can get all the data:
electrons-beam-00000

When I introduce the injection lines, it leads to the error above.
So I will work on my fork and branch without the part you mentioned in WarpXHeader.

inputs_2d.txt

Thanks,
Diana

@atmyers
Copy link
Member

atmyers commented Jul 8, 2019

FYI I have made a pull request to yt that fixes this issue: yt-project/yt#2289

@LDAmorim
Copy link
Member Author

LDAmorim commented Jul 8, 2019

Thanks!!

@LDAmorim
Copy link
Member Author

Just in case anyone else wants to model beams with the rigid option, until yt merges Andrew's PR, I decided to do the attached small bash script to remove the additional header lines automatically (to avoid making mistakes). So far it works for my runs.

To run it, first change it to ".sh", adapt the directory paths and confirm the WarpXHeader line numbers to be removed. Then use the command "bash rm_rigid_header.sh".

rm_rigid_header.txt

The original header files are stored in the new files WarpXHeader-stored, so you can double-check the changes.

@LDAmorim
Copy link
Member Author

Note that if you are running an input with multiple beams with the rigid option, you will have to remove multiple "sets" of lines in the WarpXHeader files.

@MaxThevenet
Copy link
Member

pip install git+https://github.com/yt-project/yt.git

installs yt including @atmyers's fix to this problem, so we can close the issue.

roelof-groenewald added a commit to roelof-groenewald/WarpX that referenced this issue Sep 22, 2022
* build image - test for non-corrupt checkpoints before starting simulation

* build image - only delete checkpoints if a restart was successful from an earlier checkpoint

* only clean possibly corrupt checkpoints when restarting

* Revise handling of corrupted checkpoints.

This attempts to be relatively cautious/fail-safe by at most removing
one corrupt checkpoint (and two are always kept by default so removing
one will leave another), and erroring out if two or more appear to be
corrupt.

* suggested changes from PM code review

* updated version and changelog

Co-authored-by: Peter Scherpelz <peter.scherpelz@modernelectron.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants