Version 6 (modified by jmstone, 4 years ago) (diff)


Problem Generators


A large number of problem generators are included in the  ./athena/src/prob directory. The purposes of the problem generator are to

  • set initial conditions for all variables, in a function that must be called problem and has the following prototype
    void problem(DomainS *pDomain)
  • enroll any problem-specific boundary conditions, if required. See Boundary Conditions.
  • enroll any problem-specific user-defined history outputs, if required. See User-defined Output Variables.
  • enroll any problem-specific physics controlled by function pointers, like forces due to a static gravitational potential, or optically-thin cooling.

It will probably be necessary to read the Programmer Guide in order to understand the data structures and Mesh in Athena well enough to write a new problem generator. The existing files in the /src/prob directory can be used as starting templates.

In addition, the file containing the problem() function must also contain a number of other required functions

 * problem_write_restart() - writes problem-specific user data to restart files
 * problem_read_restart()  - reads problem-specific user data from restart files
 * get_usr_expr()          - sets pointer to expression for special output data
 * get_usr_out_fun()       - returns a user defined output function pointer
 * Userwork_in_loop        - problem specific work IN     main loop
 * Userwork_after_loop     - problem specific work AFTER  main loop

In particular, see User-defined Output Variables for a description of how to use the function get_usr_expr() to add new user-defined output variables using one of the existing file formats.

It may also be necessary to include special user-defined functions in the same file that contains the problem generator if new output variables, or new output formats, are used.