Changes between Version 9 and Version 10 of AthenaDocsUGUserExpress


Ignore:
Timestamp:
Jun 8, 2010 4:50:44 PM (7 years ago)
Author:
jmstone
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AthenaDocsUGUserExpress

    v9 v10  
    22
    33'''[wiki:AthenaDocs Documentation]/[wiki:AthenaDocsUG UserGuide]/User Variables'''
     4
     5== New Variables added to .tab, .bin, .vtk, or image (.ppm or .pgm) outputs ==
    46
    57Often it is useful to output a variable other than the pre-defined values accessed by the
     
    1012following steps are required.
    1113
    12 First, write a function that computes the desired variable, and add it to the file that contains the
     141. Write a function that computes the desired variable, and add it to the file that contains the
    1315problem generator.  The function must be of
    1416type {{{Real}}}, and the argument list must contain the {{{GridS}}}
     
    2527}}}
    2628
    27 Next, use the function {{{get_usr_expr()}}} in the
     292. Use the function {{{get_usr_expr()}}} in the
    2830problem generator file to set a pointer to this new function if the
    2931string in {{{<output>/out}}} has the appropriate value.  As an example, the following code sets the output variable to be
     
    3840}}}
    3941
    40 Finally, to create a movie of the current density, use an output block in the input
     423. To create a movie of the current density, use an output block in the input
    4143file in which {{{<output>/out=J3}}}, and {{{<output>/usr_expr_flag=1}}},
    4244with the other valid parameters set as appropriate (to control, for
     
    5557Alternatively, one could output the current density as floating-point numbers in vtk format using {{{out_fmt=vtk}}}, or as a formatted table using
    5658{{{out_fmt=tab}}}.
     59
     60== New Variables added to .hst dumps ==
     61
     62It is also possible to add new volume-averaged quantities that are output as additional columns in history (.hst) dumps.
     63To add a new, user-defined history variable, use the following steps.
     64
     651. Write a function that computes the desired variable, and add it to the file that contains the
     66problem generator, identical to step 1 above for all other output types.
     67
     682. Enroll this new function by adding a call to {{{dump_history_enroll()}}} anywhere in the problem generator.  This function has two arguments,
     69the first is the name of the function created in step 1, the second is a string used as a header for the new column in the history file.  For example,
     70the following four lines of code in the problem generator enroll four new history variables.
     71{{{
     72  dump_history_enroll(hst_Bx, "<Bx>");
     73  dump_history_enroll(hst_By, "<By>");
     74  dump_history_enroll(hst_Bz, "<Bz>");
     75  dump_history_enroll(hst_BxBy, "<-Bx By>");
     76}}}
     77These variables are computed by the user-defined functions {{{hst_Bx()}}}, {{{hst_By()}}}, {{{hst_Bz()}}}, and {{{hst_BxBy()}}} respectively,
     78and create new columns with headers {{{<Bx>}}}, {{{<By>}}}, {{{<Bz>}}}, and {{{<-Bx By>}}} respectively.