PrincetonUniversity / athena

Athena++ radiation GRMHD code and adaptive mesh refinement (AMR) framework
https://www.athena-astro.app
BSD 3-Clause "New" or "Revised" License
226 stars 122 forks source link

Access ParameterInput instance from user boundary conditions #563

Closed kyriakosTapinou closed 8 months ago

kyriakosTapinou commented 8 months ago

In assigning time varying boundary conditions there may be several required parameters that change with each simulation setup. Accessing the ParameterInput instance from the input file would avoid hard coding variable boundary condition parameters.

Access to the input parameters in UserBoundaryFunction would be a useful feature for complex custom boundary conditions.

I haven't found useful links in the documentation but I may have missed something.

For reference the problem problem I am working on is the case by Fan and Gibson, 2003, THE EMERGENCE OF A TWISTED MAGNETIC FLUX TUBE INTO A PREEXISTING CORONAL ARCADE.

tomidakn commented 8 months ago

You can simply declare global variables (with unnamed namespace if you care) within your problem generator file, and set them at the beginning of a simulation in Mesh::InitUserMeshData where you can use ParameterInput.

kyriakosTapinou commented 8 months ago

@tomidakn Good idea, thank you!