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

Map mesh quantity to tracer particles in output HDF5 snapshot #336

Merged
merged 22 commits into from
Oct 22, 2024

Conversation

hfhsieh
Copy link
Contributor

@hfhsieh hfhsieh commented Jul 17, 2024

Usage:

  • Set OPT__OUTPUT_PAR_MESH = 1 in Input__Parameter
  • Add the labels of the fields to be outputted in the file Input__Par_Mesh
    • An example of Input__Par_Mesh is located in example/input

Done:

  • Add four data members Mesh_Attr_* in the Particle structure
  • Add a runtime parameter OPT__OUTPUT_PAR_MESH controlling whether to dump additional attributes mapped from mesh for tracer particles
  • The target fields are specified in the file Input__Par_Mesh at runtime
    • Supports the active, passive, and derived fields available in Prepare_PatchData()
  • Only support HDF5 snapshots
    • The data are in the Particle group with name in the format of Mesh[FieldLabel]
    • For non-tracer particles, the value is set to __FLT_MAX__
  • Update Makefile_base to include the new file Particle/Par_Output_TracerParticle_Mesh.cpp

Future works:

  • Update the doc/wiki
  • Support derived fields defined Flu_DerivedField_BuiltIn.cpp and Flu_DerivedField_User.cpp
  • (Optional) Support separate interpolation schemes used in Par_UpdateTracerParticle() and Par_Output_TracerParticle_Mesh()

Related Issues: #334 #361

@hyschive hyschive requested a review from ChunYen-Chen July 20, 2024 08:20
@hyschive hyschive added enhancement particle Particles hydro Hydrodynamics test Test problems output Data output and log labels Jul 20, 2024
@hyschive
Copy link
Contributor

@hfhsieh Thanks for the contribution! Before review, can you add a test problem (or modify ParticleTest) to validate this new functionality? For example, you can apply different analytical functions to different gas fields F and then compare the (F, r) plot between the values recorded by tracer particles and the analytical solutions. Here I have assumed that the analytical function is spherically symmetric but I'm sure you can have some better ideas. Make sure that the test is 3D with AMR to make it more comprehensive.

@hyschive
Copy link
Contributor

@ChunYen-Chen Could you help review it after @hfhsieh adds a unit test for this new feature? Thanks!

@hfhsieh hfhsieh force-pushed the main_dumpmesh2par branch from 4b84778 to 26208e6 Compare July 21, 2024 07:55
Copy link
Collaborator

@ChunYen-Chen ChunYen-Chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks great. I only have some minor comments.

Copy link
Collaborator

@ChunYen-Chen ChunYen-Chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated test problem looks great. I only left some minor comments.

@hfhsieh hfhsieh force-pushed the main_dumpmesh2par branch from 2af387c to 3e71223 Compare August 4, 2024 04:41
Copy link
Contributor

@hyschive hyschive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hfhsieh This PR looks great! I only have some minor comments. Once they are addressed, I would be happy to merge it right away.

  • Update ../doc/wiki (this will be used to update the online wiki page directly; please consult @ChunYen-Chen if you need any help)
  • Mention OPT__OUTPUT_PAR_MESH in the ParticleTest/README

@hfhsieh
Copy link
Contributor Author

hfhsieh commented Oct 18, 2024

@hyschive I have updated the PR based on your suggestions, except for the one regarding enabling OPT__OUTPUT_PAR_MESH by default.

I have also updated the doc/wiki/Outputs.md and the README for the ParticleTest problem. @ChunYen-Chen, Could you revise the changes in Outputs.md to ensure they are correct?

Copy link
Contributor

@hyschive hyschive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hfhsieh Minor comments added.

@hyschive
Copy link
Contributor

@hfhsieh Everything looks good. Thanks for the contribution!

Next, I'll review #348 and #351 to fully support tracer particles.

@hyschive hyschive merged commit 810ff3b into gamer-project:main Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement hydro Hydrodynamics output Data output and log particle Particles test Test problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants