ParameterMeshFunction

Optimization function with parameters represented by a mesh and finite-element shape functions.

Overview

This function is similar to NearestReporterCoordinatesFunction, except it uses an inputted exodus mesh ("exodus_mesh") to represent the parameter field and uses finite-element shape functions (defined with "family" and "order") to perform spatial interpolation. This function also interpolates in time using "time_name", which can be a vector-postprocessor or a vector reporter. The parameter data is specified using "parameter_name", which can be a vector-postprocessor or a vector reporter. Table 1 shows common interpolation types for the parameters.

Table 1: Common interpolation type with associated finite-element function

Interpolation TypeFamilyOrder
Piecewise constantMONOMIALCONSTANT
LinearLAGRANGEFIRST
QuadraticLAGRANGESECOND

The "project_points" allows for parameter mesh to be an any linear element mesh that doesn't fully encompass the simulation mesh. A point not encompassed by the parameter mesh will be projected onto the nearest mesh element on the parameter mesh to determine the function value. This method will not work with quad4 that are not coplanar, including other volume elements that may not have coplanar sides.

When using point projection, the "kdtree_candidates" parameter controls the efficiency of the closest point search algorithm. This parameter determines how many nearest mesh nodes are considered when finding the optimal element for projection. The default value of 5 is sufficient for most cases and provides a good balance between accuracy and performance. Users can increase this value (e.g., to 10-20) for complex geometries where higher accuracy is needed, though values above 10 typically provide diminishing returns while increasing computational cost.

warningwarning

The mesh created must be replicated. Ensure this by having Mesh/parallel_type=REPLICATED when creating the mesh.

Example Input File Syntax

First step is to define a mesh for the parameters, which is most easily done by creating a separate input file. The following creates a two-by-two mesh and sets an auxiliary variable to , which is then outputted using NodalValueSampler.

[Mesh<<<{"href": "../../syntax/Mesh/index.html"}>>>]
  [gmg]
    type = GeneratedMeshGenerator<<<{"description": "Create a line, square, or cube mesh with uniformly spaced or biased elements.", "href": "../meshgenerators/GeneratedMeshGenerator.html"}>>>
    dim<<<{"description": "The dimension of the mesh to be generated"}>>> = 2
    nx<<<{"description": "Number of elements in the X direction"}>>> = 2
    ny<<<{"description": "Number of elements in the Y direction"}>>> = 2
  []
  parallel_type = REPLICATED
[]

[AuxVariables<<<{"href": "../../syntax/AuxVariables/index.html"}>>>/params]
[]

[ICs<<<{"href": "../../syntax/ICs/index.html"}>>>/params_ic]
  type = FunctionIC<<<{"description": "An initial condition that uses a normal function of x, y, z to produce values (and optionally gradients) for a field variable.", "href": "../ics/FunctionIC.html"}>>>
  function<<<{"description": "The initial condition function."}>>> = params_fun
  variable<<<{"description": "The variable this initial condition is supposed to provide values for."}>>> = params
[]

[Functions<<<{"href": "../../syntax/Functions/index.html"}>>>]
  [params_fun]
    type = ParsedFunction<<<{"description": "Function created by parsing a string", "href": "MooseParsedFunction.html"}>>>
    value<<<{"description": "The user defined function."}>>> = 'x*(x-1)*y*(y-1)'
  []
[]

[VectorPostprocessors<<<{"href": "../../syntax/VectorPostprocessors/index.html"}>>>]
  [param_vec]
    type = NodalValueSampler<<<{"description": "Samples values of nodal variable(s).", "href": "../vectorpostprocessors/NodalValueSampler.html"}>>>
    sort_by<<<{"description": "What to sort the samples by"}>>> = id
    variable<<<{"description": "The names of the variables that this VectorPostprocessor operates on"}>>> = params
  []
[]

[Outputs<<<{"href": "../../syntax/Outputs/index.html"}>>>]
  csv<<<{"description": "Output the scalar variable and postprocessors to a *.csv file using the default CSV output."}>>> = true
  exodus<<<{"description": "Output the results using the default settings for Exodus output."}>>> = true
  execute_on<<<{"description": "The list of flag(s) indicating when this object should be executed. For a description of each flag, see https://mooseframework.inl.gov/source/interfaces/SetupInterface.html."}>>> = timestep_end
[]

[Executioner<<<{"href": "../../syntax/Executioner/index.html"}>>>]
  type = Steady
[]

[Problem<<<{"href": "../../syntax/Problem/index.html"}>>>]
  solve = false
[]
(moose/modules/optimization/test/tests/functions/parameter_mesh/create_mesh.i)

Running this input will create a create_mesh_out.e exodus file and create_mesh_out_param_vec_0001.csv CSV file. The CSV file is read by a CSVReaderVectorPostprocessor to create a vector-postprocessor of the parameter data. A ParameterMeshFunction then reads in the exodus file and retrieves the vector for the interpolation.

[VectorPostprocessors<<<{"href": "../../syntax/VectorPostprocessors/index.html"}>>>]
  [param_vec]
    type = CSVReader<<<{"description": "Converts columns of a CSV file into vectors of a VectorPostprocessor.", "href": "../vectorpostprocessors/CSVReaderVectorPostprocessor.html"}>>>
    csv_file<<<{"description": "The name of the CSV file to read. Currently, with the exception of the header row, only numeric values are supported."}>>> = create_mesh_out_param_vec_0001.csv
  []
[]

[Functions<<<{"href": "../../syntax/Functions/index.html"}>>>]
  [parameter_mesh]
    type = ParameterMeshFunction<<<{"description": "Optimization function with parameters represented by a mesh and finite-element shape functions.", "href": "ParameterMeshFunction.html"}>>>
    exodus_mesh<<<{"description": "File containing parameter mesh."}>>> = create_mesh_out.e
    parameter_name<<<{"description": "Reporter or VectorPostprocessor vector containing parameter values."}>>> = param_vec/params
  []
[]
(moose/modules/optimization/test/tests/functions/parameter_mesh/parameter_mesh.i)

Input Parameters

  • exodus_meshFile containing parameter mesh.

    C++ Type:FileName

    Controllable:No

    Description:File containing parameter mesh.

  • parameter_nameReporter or VectorPostprocessor vector containing parameter values.

    C++ Type:ReporterName

    Controllable:No

    Description:Reporter or VectorPostprocessor vector containing parameter values.

Required Parameters

  • familyLAGRANGEFamily of FE shape functions for parameter.

    Default:LAGRANGE

    C++ Type:MooseEnum

    Options:LAGRANGE, MONOMIAL, HERMITE, SCALAR, HIERARCHIC, CLOUGH, XYZ, SZABAB, BERNSTEIN, L2_LAGRANGE, L2_HIERARCHIC, NEDELEC_ONE, LAGRANGE_VEC, MONOMIAL_VEC, RAVIART_THOMAS, RATIONAL_BERNSTEIN, SIDE_HIERARCHIC, L2_HIERARCHIC_VEC, L2_LAGRANGE_VEC, L2_RAVIART_THOMAS

    Controllable:No

    Description:Family of FE shape functions for parameter.

  • kdtree_candidates5Number of nearest node candidates to consider when projecting points to parameter mesh.

    Default:5

    C++ Type:unsigned int

    Controllable:No

    Description:Number of nearest node candidates to consider when projecting points to parameter mesh.

  • orderFIRSTOrder of FE shape functions for parameter.

    Default:FIRST

    C++ Type:MooseEnum

    Options:CONSTANT, FIRST, SECOND, THIRD, FOURTH

    Controllable:No

    Description:Order of FE shape functions for parameter.

  • project_pointsFalseWhether to find the closest point on parameter mesh.

    Default:False

    C++ Type:bool

    Controllable:No

    Description:Whether to find the closest point on parameter mesh.

  • time_nameName of vector-postprocessor or reporter vector containing time, default assumes time independence.

    C++ Type:ReporterName

    Controllable:No

    Description:Name of vector-postprocessor or reporter vector containing time, default assumes time independence.

Optional Parameters

  • control_tagsAdds user-defined labels for accessing object parameters via control logic.

    C++ Type:std::vector<std::string>

    Controllable:No

    Description:Adds user-defined labels for accessing object parameters via control logic.

  • enableTrueSet the enabled status of the MooseObject.

    Default:True

    C++ Type:bool

    Controllable:No

    Description:Set the enabled status of the MooseObject.

Advanced Parameters