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

access to setup and in file #9

Closed
cjfontec opened this issue Jan 10, 2020 · 5 comments
Closed

access to setup and in file #9

cjfontec opened this issue Jan 10, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@cjfontec
Copy link

I need access to some properties of the simulation itself (number of particles, accretion radius of the sinks, alpha_av etc).
For now, I just did a small function in order to extract this data and have it in a dictionary, but I think it would be useful to have it inside the simulation class, or just have a plonk function to take the .setup and .in file and load them.

@dmentipl dmentipl added the enhancement New feature or request label Jan 13, 2020
@dmentipl
Copy link
Owner

dmentipl commented Jan 13, 2020

Hi @cjfontec, thanks for the suggestion.

When you say that you would like it inside the simulation class, do you mean that you would like to access the properties like sim.properties rather than snap.properties?

This is possible but might cause some issues. For example, in Phantom output snapshots can be modified before continuing a simulation. Say, to add dust to a pre-settle gas calculation. So, then it might not make sense to have the properties on the simulation object as a whole.

With regards to the .setup and .in files from Phantom calculations, I'd prefer not to read them in Plonk. The .setup file is only to generate initial conditions and relies on the version of phantomsetup used. The .in file has Phantom run time options, which are not required for analysis of the data in the snapshots.

I wrote a small Python package for reading and writing Phantom .in and .setup files. See phantom-config.

The number of particles in easily accessed per snapshot via len(snap). And the sink accretion radii: snap.sinks['h'].

Hopefully that makes sense. Let me know if you think that's reasonable. I'm happy to discuss further. If not, I'll close this issue.

@cjfontec
Copy link
Author

Thanks for the answer, it makes perfect sense to not add it to the simulation class. For what I see, your other package does what I wanted. I still think it could be useful as a utility function inside plonk, in order to have the information available, but is fine as it is now. You can close this issue

@dmentipl
Copy link
Owner

When you say that it would be useful as a utility function inside Plonk, which part do you mean? Accessing the .in and .setup files? Or, being able to access properties, such as the artificial viscosity and so on, on the simulation object? I do think your idea of accessing more simulation-type properties on the simulation object makes sense.

@cjfontec
Copy link
Author

for the analysis, I don't think is necessary to have full access to the .in and .setup file, is enough to have the simulation properties in the simulation object.

@dmentipl
Copy link
Owner

dmentipl commented Mar 6, 2020

Hi @cjfontec.

I've implemented something like this in 0a950fb.

The idea is that the Simulation object has a properties attribute that has the same info as the Snap object. However, if there is an inconsistency, say udist is not the same in two snapshots then the value in sim.properties is set to '__inconsistent'. For some quantities, such as time, then it is set to a list of the values on the snapshots.

I hope this makes sense. Let me know what you think.

@dmentipl dmentipl closed this as completed Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants