The SolutionUserObject is a GeneralUserObject for accessing solution data from existing files, either in Exodus II (*.e), XDA (*.xda), or XDR (*.xdr) formats.


Reading XDA/XDR Files

The basic SolutionUserObject input file syntax for reading an auxiliary variable from an existing XDA or XDR files is as follows.

[UserObjects]
  [./soln]
    type = SolutionUserObject
    system = aux0
    mesh = filename_out_0004_mesh.xda
    es = filename_out_0004.xda
    system_variables = u_aux
    execute_on = initial
  [../]
[]

XDA/R file are generated by using "xda = true" or "xdr = true" in the [Outputs] block, for additional details see the Outputs documentation. The "systems" parameter is required and is typically either "nl0" (the default) or "aux0".

  • "nl0" refers to the NonlinearSystem which includes non-linear variables, those created inside the [Variables] block in the input file.
  • "aux0" refers to the AuxiliarySystem which includes auxiliary variables, those created inside the [AuxVariables] block in the input file.

When using XDA/R both the "mesh" and equations systems ("es") parameters must be provided with filenames. The "system_variables" parameter is optional, if not included all variables from the supplied system will be loaded and available. The "execute_on" in most cases will be set to "initial" and/or "timestep", to load the data initially and on each timestep during the solve, respectively.


Reading Exodus II Files

Reading Exodus II files (*.e) is also possible with SolutionUserObject, these are may be created with MOOSE using "exodus = true" in the [Outputs] block, see Outputs documentation for additional details. The following snippet demonstrates the use of SolutionUserObject with an Exdous II file.

[UserObjects]
  [./soln]
    type = SolutionUserObject
    mesh = cubesource.e
    system_variables = source_nodal
    timestep = 2
    execute_on = initial
  [../]
[]

The "mesh" parameter is required and specifies the Exodus II file to read. This snippet also uses the "timestep" parameter to explicitly extract the second timestep from the supplied file, using -1 automatically reads the last timestep. The remaining parameters behave as explained in the previous section. However, note that "timestep" does not work for XDA/R files because each timestep is written to a seperate file. Also, this functionality is limited in Exodus II results that utilize adaptivity since each change in the mesh also results in a seperate file.

Usage

Generally, the SolutionUserObject is utilized via the SolutionAux AuxKernel or the SolutionFunction Function.

  • SolutionAux: This object is an AuxKernel, thus it operates to populate AuxVariables to explicitly compute field data at the nodal or elemental level. For various examples of utlizing SolutionAux refer to the tests in https://github.com/idaholab/moose/tree/devel/test/tests/auxkernels/solution_aux.
  • FunctionAux: This object is a Function, so it behaves as such. Functions operate by calling the value method that takes a location and time at which to extract data. In the case of FunctionAux, this evaluation includes a spatial and temporal interpolation of the underlying data that was read from the a file for the given variable defined in the FunctionAux parameters. For examples of using the FunctionAux see the tests in https://github.com/idaholab/moose/tree/devel/test/tests/functions/solution_function.

It is also possible to utilize the SolutionUserObject directly inside a custom object, accessing the SolutionUserObject using the MOOSE API is described above in the "Using a UserObject" section. When using the object directly there are three main methods for accesing the data:

  • pointValue((Real t, const Point & p, const std::string & var_name)) is the most generic method for accessing data. Given a time (t), a spatial location (p), and a variable name (var_name) the solution data is interpolated temporally and spatially and returns a scalar (Real).
  • directValue(const Node * node, const std::string & var_name) is utlized when the files being read by the object are identical to the mesh of the current simulations (i.e., the mesh in the [Mesh] block). In this case, a direct extraction from a nodal variable is gathered from the stored solution given the supplied node pointer (node) and the variable name (var_name).
  • directValue(const Elem * elem, const std::string & var_name) operates the same as above, execpt this method is for direct extraction of an elemental variable for the given element pointer (elem).

Example

The second part of Example 14 demonstrates one common use case for the SolutionUserObject: comparison of solutions against a fine-grid solution for a mesh convergence study.