- value_namereporter value name. This uses the reporter syntax
/ . C++ Type:ReporterName
Unit:(no unit assumed)
Controllable:No
Description:reporter value name. This uses the reporter syntax
/ . - variableThe name of the variable that this residual object operates on
C++ Type:NonlinearVariableName
Unit:(no unit assumed)
Controllable:No
Description:The name of the variable that this residual object operates on
ReporterPointSource
A ReporterPointSource
reads in multiple point sources from a Reporter
. The point source values and coordinates are updated as the Reporter
values are changed.
Duplicated points, i.e. points with the same xyz coordinates, are dropped by DiracKernels and applied as a single point. The input parameter "combine_duplicates" combines the values and weights of duplicated points when set to True
. Reporters containing duplicate points will produce an error when set to False
. The parameter drop_duplicate_points
used by other DiracKernels to handle duplicate points is suppressed for the ReporterPointSource
because it is expected that every duplicate point in a ReporterPointSource
will have different value and weight and are not just multiples of the sames value.
An example of a ReporterPointSource
using a ConstantReporter and a VectorPostprocessor
of type CSVReaderVectorPostprocessor is given by:
[DiracKernels]
[reporter_point_source]
type = ReporterPointSource
variable = u
value_name = 'reporterData/u'
x_coord_name = 'reporterData/x'
y_coord_name = 'reporterData/y'
z_coord_name = 'reporterData/z'
weight_name = 'reporterData/weight'
[]
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)The ConstantReporter provides the following data:
[Reporters]
[reporterData]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.0; 0.3 0.8 0.0; 0 0 0; 1 -.5 0; 1 1 1'
[]
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)The CSVReaderVectorPostprocessor
is given by:
[VectorPostprocessors]
[csv_reader]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)reading from the following csv file:
x,y,z,id,u,x3,y3,z3,value3
0.2,0.3,0.0,0,1.0,0.2,0.3,0,0.1
0.2,0.8,0.0,1,-0.5,0.2,0.8,0.0,-0.1
0.0,0.0,0.0,2,0.0,0.8,0.5,0.8,-1.0
(test/tests/dirackernels/reporter_point_source/point_value_file.csv)The Reporter
and VectorPostprocessor
for the above example produce the same ReporterPointSource
(e.g. same magnitude and location).
The next example applies a ReporterPointSource
in a transient simulation given by:
[DiracKernels]
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = point_sample_source/u
x_coord_name = point_sample_source/x
y_coord_name = point_sample_source/y
z_coord_name = point_sample_source/z
[]
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp_transient.i)using the following VectorPostprocessor
to provide x,y,z coordinates and value_name = u
[VectorPostprocessors]
[point_sample_out]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0'
sort_by = id
execute_on = 'timestep_begin'
contains_complete_history = true
outputs = 'csv'
[]
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp_transient.i)In the above input file, the ReporterPointSource
is applying loads at two different locations. Note that the PointValueSampler
has execute_on = timestep_begin
to force the VectorPostprocessor
to execute prior to being used by ReporterPointSource
.
It is important for the ReporterPointSource
to never use a VectorPostprocessor
with contains_complete_history = true
, as this can modify the ordering of the coordinates and points. In the above input file, two locations have loads applied to them by the ReporterPointSource
. The load values are given by the PointValueSampler
.
Input Parameters
- allow_moving_sourcesFalseIf true, allow Dirac sources to move, even if the mesh does not move, during the simulation.
Default:False
C++ Type:bool
Unit:(no unit assumed)
Controllable:No
Description:If true, allow Dirac sources to move, even if the mesh does not move, during the simulation.
- blockThe list of blocks (ids or names) that this object will be applied
C++ Type:std::vector<SubdomainName>
Unit:(no unit assumed)
Controllable:No
Description:The list of blocks (ids or names) that this object will be applied
- combine_duplicatesTrueWhether or not to combine duplicates internally by summing their values times their weights
Default:True
C++ Type:bool
Unit:(no unit assumed)
Controllable:No
Description:Whether or not to combine duplicates internally by summing their values times their weights
- point_namereporter point name. This uses the reporter syntax
/ . C++ Type:ReporterName
Unit:(no unit assumed)
Controllable:No
Description:reporter point name. This uses the reporter syntax
/ . - point_not_found_behaviorIGNOREBy default (IGNORE), it is ignored if an added point cannot be located in the specified subdomains. If this option is set to ERROR, this situation will result in an error. If this option is set to WARNING, then a warning will be issued.
Default:IGNORE
C++ Type:MooseEnum
Unit:(no unit assumed)
Options:ERROR, WARNING, IGNORE
Controllable:No
Description:By default (IGNORE), it is ignored if an added point cannot be located in the specified subdomains. If this option is set to ERROR, this situation will result in an error. If this option is set to WARNING, then a warning will be issued.
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Unit:(no unit assumed)
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
- use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Default:False
C++ Type:bool
Unit:(no unit assumed)
Controllable:No
Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
- weight_nameName of vector-postprocessor or reporter vector containing weights to scale value, default is assumed to be all 1s.
C++ Type:ReporterName
Unit:(no unit assumed)
Controllable:No
Description:Name of vector-postprocessor or reporter vector containing weights to scale value, default is assumed to be all 1s.
- x_coord_namereporter x-coordinate name. This uses the reporter syntax
/ . C++ Type:ReporterName
Unit:(no unit assumed)
Controllable:No
Description:reporter x-coordinate name. This uses the reporter syntax
/ . - y_coord_namereporter y-coordinate name. This uses the reporter syntax
/ . C++ Type:ReporterName
Unit:(no unit assumed)
Controllable:No
Description:reporter y-coordinate name. This uses the reporter syntax
/ . - z_coord_namereporter z-coordinate name. This uses the reporter syntax
/ . C++ Type:ReporterName
Unit:(no unit assumed)
Controllable:No
Description:reporter z-coordinate name. This uses the reporter syntax
/ .
Optional Parameters
- absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contribution
C++ Type:std::vector<TagName>
Unit:(no unit assumed)
Controllable:No
Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution
- extra_matrix_tagsThe extra tags for the matrices this Kernel should fill
C++ Type:std::vector<TagName>
Unit:(no unit assumed)
Controllable:No
Description:The extra tags for the matrices this Kernel should fill
- extra_vector_tagsThe extra tags for the vectors this Kernel should fill
C++ Type:std::vector<TagName>
Unit:(no unit assumed)
Controllable:No
Description:The extra tags for the vectors this Kernel should fill
- matrix_tagssystemThe tag for the matrices this Kernel should fill
Default:system
C++ Type:MultiMooseEnum
Unit:(no unit assumed)
Options:nontime, system
Controllable:No
Description:The tag for the matrices this Kernel should fill
- vector_tagsnontimeThe tag for the vectors this Kernel should fill
Default:nontime
C++ Type:MultiMooseEnum
Unit:(no unit assumed)
Options:nontime, time
Controllable:No
Description:The tag for the vectors this Kernel should fill
Tagging Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Unit:(no unit assumed)
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
Unit:(no unit assumed)
Controllable:Yes
Description:Set the enabled status of the MooseObject.
- implicitTrueDetermines whether this object is calculated using an implicit or explicit form
Default:True
C++ Type:bool
Unit:(no unit assumed)
Controllable:No
Description:Determines whether this object is calculated using an implicit or explicit form
- seed0The seed for the master random number generator
Default:0
C++ Type:unsigned int
Unit:(no unit assumed)
Controllable:No
Description:The seed for the master random number generator
- use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Unit:(no unit assumed)
Controllable:No
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Advanced Parameters
Input Files
- (test/tests/dirackernels/reporter_point_source/3d_vpp.i)
- (modules/optimization/test/tests/outputs/exodus_optimization_steady/forward_and_adjoint_iteration_output.i)
- (modules/optimization/test/tests/misc/scaling_test/scaling_test.i)
- (modules/optimization/test/tests/outputs/exodus_optimization_steady/adjoint_iteration_output.i)
- (modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward_and_adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/material/adjoint_explicit.i)
- (modules/combined/test/tests/optimization/invOpt_nonlinear/adjoint.i)
- (modules/porous_flow/examples/multiapp_fracture_flow/single_fracture_heat_transfer/matrix_app.i)
- (modules/combined/test/tests/optimization/invOpt_bc_convective/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/constant_heat_source/adjoint_nonLinear.i)
- (modules/porous_flow/examples/multiapp_fracture_flow/fracture_diffusion/matrix_app_nonconforming.i)
- (modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward_homogeneous.i)
- (modules/porous_flow/examples/multiapp_fracture_flow/fracture_diffusion/matrix_app_dirac.i)
- (modules/optimization/test/tests/optimizationreporter/mesh_source/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/bimaterial/grad.i)
- (modules/combined/test/tests/optimization/invOpt_mechanics/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/nonlinear_material/forward_and_adjoint.i)
- (modules/optimization/examples/materialFrequency/wave1D/model_grad.i)
- (modules/optimization/test/tests/optimizationreporter/material/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/point_loads/forward_homogeneous.i)
- (modules/optimization/test/tests/optimizationreporter/bc_load_linearFunction/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/point_loads/forward.i)
- (modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward_and_adjoint_transfer_data.i)
- (modules/optimization/test/tests/executioners/constrained/inequality/forward_and_adjoint.i)
- (modules/porous_flow/examples/multiapp_fracture_flow/3dFracture/matrix_app.i)
- (modules/optimization/test/tests/optimizationreporter/constant_heat_source/adjoint.i)
- (modules/combined/test/tests/optimization/invOpt_elasticity_modular/grad.i)
- (modules/combined/test/tests/optimization/invOpt_mechanics/forward_and_adjoint.i)
- (test/tests/dirackernels/block_restriction/skip.i)
- (modules/optimization/test/tests/optimizationreporter/bimaterial/model_and_adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward.i)
- (modules/optimization/test/tests/optimizationreporter/mesh_source/forward_and_adjoint.i)
- (test/tests/dirackernels/reporter_point_source/2d_vpp.i)
- (test/tests/dirackernels/reporter_point_source/2d_vpp_transient.i)
- (modules/optimization/test/tests/optimizationreporter/point_loads/forward_and_adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/point_loads/adjoint.i)
- (modules/optimization/test/tests/optimizationreporter/bc_load_linearFunction/forward_and_adjoint.i)
Child Objects
combine_duplicates
Default:True
C++ Type:bool
Unit:(no unit assumed)
Controllable:No
Description:Whether or not to combine duplicates internally by summing their values times their weights
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[DiracKernels]
inactive = 'reporter_point_source_err reporter_point_source_dup_err'
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = 'csv_reader/u'
x_coord_name = 'csv_reader/x'
y_coord_name = 'csv_reader/y'
z_coord_name = 'csv_reader/z'
[]
[reporter_point_source]
type = ReporterPointSource
variable = u
value_name = 'reporterData/u'
x_coord_name = 'reporterData/x'
y_coord_name = 'reporterData/y'
z_coord_name = 'reporterData/z'
weight_name = 'reporterData/weight'
[]
[reporter_point_source_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_err/u2'
x_coord_name = 'reporterData_err/x2'
y_coord_name = 'reporterData_err/y2'
z_coord_name = 'reporterData_err/z2'
[]
[reporter_point_source_dup_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=false
[]
[reporter_point_source_dup]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=true
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = 1
value = 1
[]
[]
[VectorPostprocessors]
[csv_reader]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
[Reporters]
[reporterData]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.0; 0.3 0.8 0.0; 0 0 0; 1 -.5 0; 1 1 1'
[]
[reporterData_err]
type = ConstantReporter
real_vector_names = 'x2 y2 z2 u2'
real_vector_values = '0.2 0.2; 0.3 0.8 0.0; 0 0 0; 1 -.5 0'
[]
[reporterData_dup]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.2 0.0; 0.3 0.3 0.8 0.0; 0 0 0 0; 2 1 -.5 0;0.25 0.5 1 1'
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[DiracKernels]
inactive = 'reporter_point_source_err reporter_point_source_dup_err'
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = 'csv_reader/u'
x_coord_name = 'csv_reader/x'
y_coord_name = 'csv_reader/y'
z_coord_name = 'csv_reader/z'
[]
[reporter_point_source]
type = ReporterPointSource
variable = u
value_name = 'reporterData/u'
x_coord_name = 'reporterData/x'
y_coord_name = 'reporterData/y'
z_coord_name = 'reporterData/z'
weight_name = 'reporterData/weight'
[]
[reporter_point_source_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_err/u2'
x_coord_name = 'reporterData_err/x2'
y_coord_name = 'reporterData_err/y2'
z_coord_name = 'reporterData_err/z2'
[]
[reporter_point_source_dup_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=false
[]
[reporter_point_source_dup]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=true
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = 1
value = 1
[]
[]
[VectorPostprocessors]
[csv_reader]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
[Reporters]
[reporterData]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.0; 0.3 0.8 0.0; 0 0 0; 1 -.5 0; 1 1 1'
[]
[reporterData_err]
type = ConstantReporter
real_vector_names = 'x2 y2 z2 u2'
real_vector_values = '0.2 0.2; 0.3 0.8 0.0; 0 0 0; 1 -.5 0'
[]
[reporterData_dup]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.2 0.0; 0.3 0.3 0.8 0.0; 0 0 0 0; 2 1 -.5 0;0.25 0.5 1 1'
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[DiracKernels]
inactive = 'reporter_point_source_err reporter_point_source_dup_err'
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = 'csv_reader/u'
x_coord_name = 'csv_reader/x'
y_coord_name = 'csv_reader/y'
z_coord_name = 'csv_reader/z'
[]
[reporter_point_source]
type = ReporterPointSource
variable = u
value_name = 'reporterData/u'
x_coord_name = 'reporterData/x'
y_coord_name = 'reporterData/y'
z_coord_name = 'reporterData/z'
weight_name = 'reporterData/weight'
[]
[reporter_point_source_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_err/u2'
x_coord_name = 'reporterData_err/x2'
y_coord_name = 'reporterData_err/y2'
z_coord_name = 'reporterData_err/z2'
[]
[reporter_point_source_dup_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=false
[]
[reporter_point_source_dup]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=true
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = 1
value = 1
[]
[]
[VectorPostprocessors]
[csv_reader]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
[Reporters]
[reporterData]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.0; 0.3 0.8 0.0; 0 0 0; 1 -.5 0; 1 1 1'
[]
[reporterData_err]
type = ConstantReporter
real_vector_names = 'x2 y2 z2 u2'
real_vector_values = '0.2 0.2; 0.3 0.8 0.0; 0 0 0; 1 -.5 0'
[]
[reporterData_dup]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.2 0.0; 0.3 0.3 0.8 0.0; 0 0 0 0; 2 1 -.5 0;0.25 0.5 1 1'
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(test/tests/dirackernels/reporter_point_source/point_value_file.csv)
x,y,z,id,u,x3,y3,z3,value3
0.2,0.3,0.0,0,1.0,0.2,0.3,0,0.1
0.2,0.8,0.0,1,-0.5,0.2,0.8,0.0,-0.1
0.0,0.0,0.0,2,0.0,0.8,0.5,0.8,-1.0
(test/tests/dirackernels/reporter_point_source/2d_vpp_transient.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[dot]
type = TimeDerivative
variable = u
[]
[]
[DiracKernels]
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = point_sample_source/u
x_coord_name = point_sample_source/x
y_coord_name = point_sample_source/y
z_coord_name = point_sample_source/z
[]
[]
[VectorPostprocessors]
[point_sample_source]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0 0.2 0.2 0.0'
sort_by = id
execute_on = 'timestep_begin'
outputs = none
[]
[point_sample_out]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0'
sort_by = id
execute_on = 'timestep_begin'
contains_complete_history = true
outputs = 'csv'
[]
[]
[Functions]
[left_bc_fn]
type = ParsedFunction
expression = 1+5*y*y
[]
[]
[BCs]
[left]
type = FunctionNeumannBC
variable = u
boundary = left
function = left_bc_fn
[]
[right]
type = DirichletBC
variable = u
boundary = right
value = 1
[]
[]
[Executioner]
type = Transient
dt = 0.01
num_steps = 5
solve_type = 'PJFNK'
nl_rel_tol = 1e-10
[]
[Outputs]
csv = true
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp_transient.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[dot]
type = TimeDerivative
variable = u
[]
[]
[DiracKernels]
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = point_sample_source/u
x_coord_name = point_sample_source/x
y_coord_name = point_sample_source/y
z_coord_name = point_sample_source/z
[]
[]
[VectorPostprocessors]
[point_sample_source]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0 0.2 0.2 0.0'
sort_by = id
execute_on = 'timestep_begin'
outputs = none
[]
[point_sample_out]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0'
sort_by = id
execute_on = 'timestep_begin'
contains_complete_history = true
outputs = 'csv'
[]
[]
[Functions]
[left_bc_fn]
type = ParsedFunction
expression = 1+5*y*y
[]
[]
[BCs]
[left]
type = FunctionNeumannBC
variable = u
boundary = left
function = left_bc_fn
[]
[right]
type = DirichletBC
variable = u
boundary = right
value = 1
[]
[]
[Executioner]
type = Transient
dt = 0.01
num_steps = 5
solve_type = 'PJFNK'
nl_rel_tol = 1e-10
[]
[Outputs]
csv = true
[]
(test/tests/dirackernels/reporter_point_source/3d_vpp.i)
[Mesh]
type = GeneratedMesh
dim = 3
nx = 10
ny = 10
nz = 10
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[DiracKernels]
[point_source]
type = ReporterPointSource
variable = u
x_coord_name = csv_reader/x3
y_coord_name = csv_reader/y3
z_coord_name = csv_reader/z3
value_name = csv_reader/value3
[]
[]
[VectorPostprocessors]
[csv_reader]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = right
value = 1
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(modules/optimization/test/tests/outputs/exodus_optimization_steady/forward_and_adjoint_iteration_output.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[misfit]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 300
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 300
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 300
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 300
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[gradient]
type = PointValueSampler
points = '0.2 0.2 0
0.7 0.56 0
0.4 1 0'
variable = temperature_adjoint
sort_by = id
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
objective_name = objective_value
variable = temperature
outputs = none
[]
[point_source]
type = ConstantReporter
real_vector_names = 'x y z value'
real_vector_values = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
[]
[]
[Outputs]
console = false
[exodus]
type = ExodusOptimizationSteady
execute_on = 'TIMESTEP_END'
[]
[]
(modules/optimization/test/tests/misc/scaling_test/scaling_test.i)
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 3
nx = 4
ny = 2
nz = 1
xmin = 9.4615
xmax = 92.0115
ymin = 3.175
ymax = 22.225
zmin = 0.489
zmax = 0.755
[]
[]
[Variables]
[T]
scaling = 10
[]
[lam_T]
solver_sys = adjoint
scaling = 1e3
[]
[]
[Kernels]
[heat_conduction]
type = ADMatDiffusion
variable = T
diffusivity = thermal_conductivity
[]
[heat_source]
type = ADBodyForce
function = src_fuel_function
variable = T
[]
[]
[BCs]
[dir_BC_front]
type = NeumannBC
variable = T
boundary = front
value = 2
[]
[dir_BC_back]
type = DirichletBC
variable = T
boundary = back
value = 300
[]
[]
[Materials]
# fuel properties
[fuel_thermal]
type = ADGenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 17.6e3
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'lu mumps'
line_search = 'none'
nl_rel_tol = 1e-6
nl_abs_tol = 1e-30
nl_max_its = 10
l_max_its = 10
[]
##---------Forward Optimization stuff------------------#
[Reporters]
[measure_data]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.0; 0.3 0.8 0.0; 0 0 0; 5 5 5; 1 1 1'
[]
[params_fuel]
type = ConstantReporter
real_vector_names = 'source'
real_vector_values = '5e7' # Dummy
[]
[]
[Functions]
[src_fuel_function]
type = ParsedOptimizationFunction
expression = q
param_symbol_names = 'q'
param_vector_name = 'params_fuel/source'
[]
[]
##---------Adjoint Optimization stuff------------------#
[DiracKernels]
[adjointLoad_T]
type = ReporterPointSource
variable = lam_T
x_coord_name = measure_data/x
y_coord_name = measure_data/y
z_coord_name = measure_data/z
value_name = measure_data/u
[]
[]
##--------- Outputs ------------------#
[Debug]
show_var_residual_norms = true
[]
(modules/optimization/test/tests/outputs/exodus_optimization_steady/adjoint_iteration_output.i)
[Mesh]
[]
[Variables]
[adjointVar]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjointVar
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjointVar
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'p1'
real_vector_values = '0' # Dummy value
[]
[]
[AuxVariables]
[temperature_forward]
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjointVar
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjointVar
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjointVar
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjointVar
boundary = top
value = 0
[]
[]
[Functions]
[thermo_conduct]
type = ParsedOptimizationFunction
expression = 'alpha'
param_symbol_names = 'alpha'
param_vector_name = 'params/p1'
[]
[]
[Materials]
[thermalProp]
type = GenericFunctionMaterial
prop_names = 'thermal_conductivity'
prop_values = 'thermo_conduct'
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[VectorPostprocessors]
[adjoint_grad]
type = ElementOptimizationDiffusionCoefFunctionInnerProduct
variable = adjointVar
forward_variable = temperature_forward
function = thermo_conduct
[]
[]
[Outputs]
console = false
file_base = 'adjoint'
[exodus]
type = ExodusOptimizationSteady
execute_on = 'TIMESTEP_END'
[]
[]
(modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward_and_adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[misfit]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 300
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 300
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 300
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 300
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[gradient]
type = PointValueSampler
points = '0.2 0.2 0
0.7 0.56 0
0.4 1 0'
variable = temperature_adjoint
sort_by = id
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
measurement_points = '0.5 0.28 0
0.5 0.6 0
0.5 0.8 0
0.5 1.1 0'
measurement_values = '293 304 315 320'
objective_name = misfit_norm
[]
[point_source]
type = ConstantReporter
real_vector_names = 'x y z value'
real_vector_values = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
[]
[]
[Outputs]
console = false
[]
(modules/optimization/test/tests/optimizationreporter/material/adjoint_explicit.i)
[Mesh]
[]
[Variables]
[adjoint_var]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint_var
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_var
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[]
[AuxVariables]
[temperature_forward]
[]
[grad_Tx]
order = CONSTANT
family = MONOMIAL
[]
[grad_Ty]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tz]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tfx]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tfy]
order = CONSTANT
family = MONOMIAL
[]
[grad_Tfz]
order = CONSTANT
family = MONOMIAL
[]
[negative_gradient]
order = CONSTANT
family = MONOMIAL
[]
[]
[AuxKernels]
[grad_Tx]
type = VariableGradientComponent
component = x
variable = grad_Tx
gradient_variable = adjoint_var
[]
[grad_Ty]
type = VariableGradientComponent
component = y
variable = grad_Ty
gradient_variable = adjoint_var
[]
[grad_Tz]
type = VariableGradientComponent
component = z
variable = grad_Tz
gradient_variable = adjoint_var
[]
[grad_Tfx]
type = VariableGradientComponent
component = x
variable = grad_Tfx
gradient_variable = temperature_forward
[]
[grad_Tfy]
type = VariableGradientComponent
component = y
variable = grad_Tfy
gradient_variable = temperature_forward
[]
[grad_Tfz]
type = VariableGradientComponent
component = z
variable = grad_Tfz
gradient_variable = temperature_forward
[]
[negative_gradient]
type = ParsedAux
variable = negative_gradient
args = 'grad_Tx grad_Ty grad_Tz grad_Tfx grad_Tfy grad_Tfz'
function = '-(grad_Tx*grad_Tfx+grad_Ty*grad_Tfy+grad_Tz*grad_Tfz)'
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjoint_var
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjoint_var
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint_var
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint_var
boundary = top
value = 0
[]
[]
[Functions]
[thermo_conduct]
type = ParsedFunction
value = alpha
vars = 'alpha'
vals = 'p1'
[]
[]
[Materials]
[thermalProp]
type = GenericFunctionMaterial
prop_names = 'thermal_conductivity'
prop_values = 'thermo_conduct'
[]
[thermalPropDeriv]
type = GenericFunctionMaterial
prop_names = 'thermal_conductivity_deriv'
prop_values = '1'
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[Postprocessors]
[pp_adjoint_grad_parsedFunc]
type = ElementIntegralVariablePostprocessor
variable = negative_gradient
execute_on = 'initial linear'
[]
[p1]
type = ConstantValuePostprocessor
value = 10
execute_on = 'initial linear'
[]
[]
[Controls]
[parameterReceiver]
type = ControlsReceiver
[]
[]
[VectorPostprocessors]
[adjoint_grad]
type = VectorOfPostprocessors
postprocessors = 'pp_adjoint_grad_parsedFunc'
[]
[]
[Outputs]
console = false
file_base = 'adjoint'
[]
(modules/combined/test/tests/optimization/invOpt_nonlinear/adjoint.i)
[Executioner]
type = Steady
solve_type = NEWTON
line_search = none
nl_abs_tol = 1e-12
nl_rel_tol = 1e-12
nl_max_its = 100
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Mesh]
[]
[Variables]
[adjointT]
[]
[]
[AuxVariables]
[forwardT]
[]
[dDdTgradT]
order = CONSTANT
family = MONOMIAL_VEC
[]
[]
[Kernels]
[heat_conduction]
type = ADHeatConduction
thermal_conductivity = 'linearized_conductivity'
variable = adjointT
[]
[advection]
type = LevelSetAdvection
velocity = dDdTgradT
variable = adjointT
[]
[]
[AuxKernels]
[dDdTgradT]
type = ADFunctorElementalGradientAux
functor = forwardT
variable = dDdTgradT
factor_matprop = 'dDdT'
[]
[]
[Materials]
[LinearizedConductivity]
type = ADParsedMaterial
f_name = 'linearized_conductivity'
function = '10+500*forwardT'
args = 'forwardT'
[]
[dDdT]
type = ADParsedMaterial
f_name = 'dDdT'
function = '500'
args = 'forwardT'
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjointT
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'heat_source'
real_vector_values = '0' # Dummy
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjointT
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjointT
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjointT
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjointT
boundary = top
value = 0
[]
[]
[VectorPostprocessors]
[gradient_vpp]
type = ElementOptimizationSourceFunctionInnerProduct
function = volumetric_heat_func
variable = adjointT
[]
[]
[Functions]
[volumetric_heat_func]
type = ParsedOptimizationFunction
expression = q
param_symbol_names = 'q'
param_vector_name = 'params/heat_source'
[]
[]
[Outputs]
console = false
[]
(modules/porous_flow/examples/multiapp_fracture_flow/single_fracture_heat_transfer/matrix_app.i)
# Matrix physics, which is just heat conduction. Heat energy comes from the fracture App
[Mesh]
[generate]
type = GeneratedMeshGenerator
dim = 2
nx = 20
xmin = 0
xmax = 100.0
ny = 9
ymin = -9
ymax = 9
[]
[]
[Variables]
[matrix_T]
initial_condition = 40 # degC
[]
[]
[Kernels]
[dot]
type = CoefTimeDerivative
variable = matrix_T
Coefficient = 1E5
[]
[matrix_diffusion]
type = AnisotropicDiffusion
variable = matrix_T
tensor_coeff = '1 0 0 0 1 0 0 0 1'
[]
[]
[DiracKernels]
[heat_from_fracture]
type = ReporterPointSource
variable = matrix_T
value_name = heat_transfer_rate/transferred_joules_per_s
x_coord_name = heat_transfer_rate/x
y_coord_name = heat_transfer_rate/y
z_coord_name = heat_transfer_rate/z
[]
[]
[VectorPostprocessors]
[heat_transfer_rate]
type = ConstantVectorPostprocessor
vector_names = 'transferred_joules_per_s x y z'
value = '0; 0; 0; 0'
outputs = none
[]
[]
[Preconditioning]
[entire_jacobian]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
dt = 1
end_time = 100
nl_abs_tol = 1E-3
[]
[Outputs]
print_linear_residuals = false
exodus = true
csv=true
[]
[MultiApps]
[fracture_app]
type = TransientMultiApp
input_files = fracture_app.i
execute_on = TIMESTEP_BEGIN
[]
[]
[Transfers]
[T_to_fracture]
type = MultiAppGeometricInterpolationTransfer
to_multi_app = fracture_app
source_variable = matrix_T
variable = transferred_matrix_T
[]
[heat_from_fracture]
type = MultiAppReporterTransfer
from_multi_app = fracture_app
from_reporters = 'heat_transfer_rate/joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
to_reporters = 'heat_transfer_rate/transferred_joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
[]
[]
(modules/combined/test/tests/optimization/invOpt_bc_convective/adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 20
xmax = 1
ymax = 2
[]
[]
[AuxVariables]
[temperature_forward]
[]
[T2]
[]
[]
[AuxKernels]
[TT]
type = ParsedAux
args = 'temperature temperature_forward'
variable = T2
function = 'temperature*(100-temperature_forward)'
[]
[]
[Variables]
[temperature]
[]
[]
[Kernels]
[heat_conduction]
type = ADHeatConduction
variable = temperature
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'vals'
real_vector_values = '0' # Dummy value
[]
[]
[BCs]
[left]
type = ConvectiveFluxFunction
variable = temperature
boundary = 'left'
T_infinity = 0.0
coefficient = function1
[]
[right]
type = NeumannBC
variable = temperature
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = ADGenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Functions]
[function1]
type = ParsedOptimizationFunction
expression = 'a'
param_symbol_names = 'a'
param_vector_name = 'params/vals'
[]
[]
[VectorPostprocessors]
[adjoint_pt]
type = SideOptimizationNeumannFunctionInnerProduct
variable = T2
function = function1
boundary = left
[]
[]
[Outputs]
console = false
exodus = false
file_base = 'adjoint'
[]
(modules/optimization/test/tests/optimizationreporter/constant_heat_source/adjoint_nonLinear.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
xmax = 2
ymax = 2
[]
[Variables]
[adjoint_T]
[]
[]
[AuxVariables]
[T]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint_T
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_T
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'q'
real_vector_values = '0' # Dummy value
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjoint_T
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjoint_T
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint_T
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint_T
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = ParsedMaterial
f_name = 'thermal_conductivity'
function = '.01*T'
args = 'T'
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[Functions]
[volumetric_heat_func]
type = ParsedOptimizationFunction
expression = q
param_symbol_names = 'q'
param_vector_name = 'params/q'
[]
[]
[VectorPostprocessors]
[gradient_vpp]
type = ElementOptimizationSourceFunctionInnerProduct
variable = adjoint_T
function = volumetric_heat_func
[]
[]
[Outputs]
console = false
file_base = 'adjoint_nl'
[]
(modules/porous_flow/examples/multiapp_fracture_flow/fracture_diffusion/matrix_app_nonconforming.i)
# A fracture, which is a 1D line of elements, is embedded in a matrix, which is a 2D surface of elements.
# The meshes conform: all fracture nodes are also matrix nodes (the fracture elements are sides of matrix elements).
#
# The heat equation governs temperature in the fracture and matrix system, and heat energy is transferred between the two using a MultiApp approach
[Mesh]
[generate]
type = GeneratedMeshGenerator
dim = 2
nx = 20
xmin = 0
xmax = 10.0
ny = 20
ymin = -1.9
ymax = 2.1
[]
[]
[Variables]
[matrix_T]
[]
[]
[Kernels]
[dot]
type = TimeDerivative
variable = matrix_T
[]
[matrix_diffusion]
type = AnisotropicDiffusion
variable = matrix_T
tensor_coeff = '1E-3 0 0 0 1E-3 0 0 0 1E-3'
[]
[]
[DiracKernels]
[heat_from_fracture]
type = ReporterPointSource
variable = matrix_T
value_name = heat_transfer_rate/transferred_joules_per_s
x_coord_name = heat_transfer_rate/x
y_coord_name = heat_transfer_rate/y
z_coord_name = heat_transfer_rate/z
[]
[]
[VectorPostprocessors]
[heat_transfer_rate]
type = ConstantVectorPostprocessor
vector_names = 'transferred_joules_per_s x y z'
value = '0; 0; 0; 0'
outputs = none
[]
[]
[Preconditioning]
[entire_jacobian]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
dt = 100
end_time = 100
[]
[Outputs]
print_linear_residuals = false
exodus = false
[]
[MultiApps]
[fracture_app]
type = TransientMultiApp
input_files = fracture_app_dirac.i
cli_args = 'Kernels/toMatrix/transfer_coefficient=0.01'
execute_on = TIMESTEP_BEGIN
[]
[]
[Transfers]
[T_to_fracture]
type = MultiAppGeometricInterpolationTransfer
to_multi_app = fracture_app
source_variable = matrix_T
variable = transferred_matrix_T
[]
[heat_from_fracture]
type = MultiAppReporterTransfer
from_multi_app = fracture_app
from_reporters = 'heat_transfer_rate/joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
to_reporters = 'heat_transfer_rate/transferred_joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
[]
[]
(modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward_homogeneous.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Variables]
[temperature]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[point_source]
type = ConstantVectorPostprocessor
vector_names = 'x y z value'
value = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
execute_on = LINEAR
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
measurement_points = ${measurement_points}
measurement_values = ${measurement_values}
[]
[]
[Outputs]
console = false
file_base = 'forward_homo'
[]
(modules/porous_flow/examples/multiapp_fracture_flow/fracture_diffusion/matrix_app_dirac.i)
# A fracture, which is a 1D line of elements, is embedded in a matrix, which is a 2D surface of elements.
# The meshes conform: all fracture nodes are also matrix nodes (the fracture elements are sides of matrix elements).
#
# The heat equation governs temperature in the fracture and matrix system, and heat energy is transferred between the two using a MultiApp approach
[Mesh]
[generate]
type = GeneratedMeshGenerator
dim = 2
nx = 20
xmin = 0
xmax = 10.0
ny = 20 # anything less than this produces over/under-shoots
ymin = -2
ymax = 2
[]
[]
[Variables]
[matrix_T]
[]
[]
[Kernels]
[dot]
type = TimeDerivative
variable = matrix_T
[]
[matrix_diffusion]
type = AnisotropicDiffusion
variable = matrix_T
tensor_coeff = '1E-3 0 0 0 1E-3 0 0 0 1E-3'
[]
[]
[DiracKernels]
[heat_from_fracture]
type = ReporterPointSource
variable = matrix_T
value_name = heat_transfer_rate/transferred_joules_per_s
x_coord_name = heat_transfer_rate/x
y_coord_name = heat_transfer_rate/y
z_coord_name = heat_transfer_rate/z
[]
[]
[VectorPostprocessors]
[heat_transfer_rate]
type = ConstantVectorPostprocessor
vector_names = 'transferred_joules_per_s x y z'
value = '0; 0; 0; 0'
outputs = none
[]
[]
[Preconditioning]
[entire_jacobian]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
dt = 100
end_time = 100
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'lu superlu_dist'
[]
[Outputs]
print_linear_residuals = false
exodus = false
csv=true
[]
[MultiApps]
[fracture_app]
type = TransientMultiApp
input_files = fracture_app_dirac.i
execute_on = TIMESTEP_BEGIN
[]
[]
[Transfers]
[T_to_fracture]
type = MultiAppGeometricInterpolationTransfer
to_multi_app = fracture_app
source_variable = matrix_T
variable = transferred_matrix_T
[]
[heat_from_fracture]
type = MultiAppReporterTransfer
from_multi_app = fracture_app
from_reporters = 'heat_transfer_rate/joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
to_reporters = 'heat_transfer_rate/transferred_joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
[]
[]
(modules/optimization/test/tests/optimizationreporter/mesh_source/adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
[]
[]
[Variables/adjoint_u]
[]
[Kernels]
[heat_conduction]
type = Diffusion
variable = adjoint_u
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_u
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[BCs]
[dirichlet]
type = DirichletBC
variable = adjoint_u
boundary = 'bottom left'
value = 0
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[src_rep]
type = ConstantReporter
real_vector_names = 'vals'
real_vector_values = '1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0'
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
[]
[Functions]
[src_func]
type = ParameterMeshFunction
exodus_mesh = parameter_mesh_in.e
parameter_name = src_rep/vals
[]
[]
[VectorPostprocessors]
[gradient_vpp]
type = ElementOptimizationSourceFunctionInnerProduct
variable = adjoint_u
function = src_func
[]
[]
[Outputs]
console = false
[]
(modules/optimization/test/tests/optimizationreporter/bimaterial/grad.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 16
ny = 16
xmin = -4
xmax = 4
ymin = -4
ymax = 4
[]
[]
[Variables]
[adjoint_T]
[]
[]
[Kernels]
[conduction]
type = MatDiffusion
diffusivity = diffusivity
variable = adjoint_T
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[data]
type = ConstantReporter
real_vector_names = 'coordx coordy diffusivity'
real_vector_values = '0 0; -2 2; 5 10'
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_T
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[BCs]
[bottom]
type = DirichletBC
variable = adjoint_T
boundary = bottom
value = 0
[]
[]
[AuxVariables]
[temperature_forward]
[]
[]
[Functions]
[diffusivity_function]
type = NearestReporterCoordinatesFunction
x_coord_name = data/coordx
y_coord_name = data/coordy
value_name = data/diffusivity
[]
[]
[Materials] #same material as what was used in the forward model
[mat]
type = GenericFunctionMaterial
prop_names = diffusivity
prop_values = diffusivity_function
[]
[]
[VectorPostprocessors]
[gradvec]
type = ElementOptimizationDiffusionCoefFunctionInnerProduct
variable = adjoint_T
forward_variable = temperature_forward
function = diffusivity_function
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_forced_its = 1
line_search = none
nl_abs_tol = 1e-8
[]
[Outputs]
console = false
file_base = 'adjoint'
[]
(modules/combined/test/tests/optimization/invOpt_mechanics/adjoint.i)
[Mesh]
[]
[Variables]
[disp_x]
[]
[disp_y]
[]
[]
[Kernels]
[TensorMechanics]
use_displaced_mesh = false
displacements ='disp_x disp_y'
[]
[]
#-----adjoint problem information------------------
[DiracKernels]
[pt]
type = ReporterPointSource
variable = disp_y
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type=OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'right_fy_value'
real_vector_values = '0' # Dummy value
[]
[]
[Functions]
[right_fy_func]
type = ParsedOptimizationFunction
expression = 'val'
param_symbol_names = 'val'
param_vector_name = 'params/right_fy_value'
[]
[]
[VectorPostprocessors]
[adjoint_pt]
type = SideOptimizationNeumannFunctionInnerProduct
variable = disp_y
function = right_fy_func
boundary = right
[]
[]
#---------------------------------------------------
[BCs]
[left_ux]
type = DirichletBC
variable = disp_x
boundary = left
value = 0
[]
[left_uy]
type = DirichletBC
variable = disp_y
boundary = left
value = 0
[]
[right_fy]
type = NeumannBC
variable = disp_y
boundary = right
value = 0 #2000
[]
[]
[Materials]
[elasticity]
type = ComputeIsotropicElasticityTensor
youngs_modulus = 10e3
poissons_ratio = 0.3
[]
[strain]
type = ComputeSmallStrain
displacements = 'disp_x disp_y'
[]
[stress]
type = ComputeLinearElasticStress
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Outputs]
csv = false
console = false
exodus = false
file_base = 'adjoint'
[]
(modules/optimization/test/tests/optimizationreporter/nonlinear_material/forward_and_adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 2
ymax = 2
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[forwardT]
[]
[adjointT]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = ADMatDiffusion
variable = forwardT
diffusivity = 'conductivity'
[]
[heat_source]
type = ADBodyForce
function = volumetric_heat_func
variable = forwardT
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjointT
x_coord_name = measurement_locations/measurement_xcoord
y_coord_name = measurement_locations/measurement_ycoord
z_coord_name = measurement_locations/measurement_zcoord
value_name = measurement_locations/misfit_values
[]
[]
[Materials]
[NonlinearConductivity]
type = ADParsedMaterial
property_name = conductivity
expression = '10+500*forwardT'
coupled_variables = 'forwardT'
[]
[]
[Functions]
[volumetric_heat_func]
type = ParsedOptimizationFunction
expression = q
param_symbol_names = 'q'
param_vector_name = 'params/heat_source'
[]
[]
[BCs]
[left]
type = NeumannBC
variable = forwardT
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = forwardT
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = forwardT
boundary = bottom
value = 2
[]
[top]
type = DirichletBC
variable = forwardT
boundary = top
value = 1
[]
[]
[Reporters]
[measurement_locations]
type = OptimizationData
objective_name = objective_value
variable = forwardT
[]
[params]
type = ConstantReporter
real_vector_names = 'heat_source'
real_vector_values = '0' # Dummy
[]
[]
[VectorPostprocessors]
[gradient_vpp]
type = ElementOptimizationSourceFunctionInnerProduct
function = volumetric_heat_func
variable = adjointT
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
line_search = none
nl_abs_tol = 1e-12
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[Outputs]
console = false
[]
(modules/optimization/examples/materialFrequency/wave1D/model_grad.i)
id = 1
frequencyHz = 1.0
omega = '${fparse 2*3.14159265359*frequencyHz}'
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
skip_nl_system_check = true
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_forced_its = 1
line_search = none
nl_abs_tol = 1e-8
[]
[Outputs]
csv = false
console = false
json = false
[]
[Mesh]
type = GeneratedMesh
dim = 1
nx = 200
xmax = 2
[]
[Variables]
[ur]
[]
[ui]
[]
[uradj]
initial_condition = 0
solver_sys = adjoint
[]
[uiadj]
initial_condition = 0
solver_sys = adjoint
[]
[]
[Kernels]
[stiff]
type = MatDiffusion
variable = ur
diffusivity = G
[]
[mass]
type = Reaction
variable = ur
rate = '${fparse -1.0*omega*omega}'
[]
[stiffV]
type = MatDiffusion
variable = ui
diffusivity = G
[]
[massV]
type = Reaction
variable = ui
rate = '${fparse -1.0*omega*omega}'
[]
[]
[BCs]
[leftU]
type = CoupledVarNeumannBC
boundary = left
variable = ur
coef = 2.0
v = ui
[]
[leftV]
type = CoupledVarNeumannBC
boundary = left
variable = ui
coef = -2.0
v = ur
[]
[right]
type = NeumannBC
variable = ur
boundary = right
value = 1
[]
[]
[Materials]
[G]
type = GenericFunctionMaterial
prop_names = G
prop_values = G_function
[]
[]
[Functions]
[G_function]
type = NearestReporterCoordinatesFunction
x_coord_name = parameters/coordx
value_name = parameters/G
[]
[]
[Reporters]
[parameters]
type = ConstantReporter
real_vector_names = 'coordx G'
# 'True value when used to generate synthetic data'
# real_vector_values = '5.0 15.0; 4.0 4.0'
real_vector_values = '1.0; 4.0'
[]
[]
[DiracKernels]
[misfit_ur]
type = ReporterPointSource
variable = uradj
x_coord_name = measure_data_ur/measurement_xcoord
y_coord_name = measure_data_ur/measurement_ycoord
z_coord_name = measure_data_ur/measurement_zcoord
value_name = measure_data_ur/misfit_values
[]
[misfit_ui]
type = ReporterPointSource
variable = uiadj
x_coord_name = measure_data_ui/measurement_xcoord
y_coord_name = measure_data_ui/measurement_ycoord
z_coord_name = measure_data_ui/measurement_zcoord
value_name = measure_data_ui/misfit_values
[]
[]
[VectorPostprocessors]
[gradient_from_real]
type = ElementOptimizationDiffusionCoefFunctionInnerProduct
variable = uradj
forward_variable = ur
function = G_function
execute_on = ADJOINT_TIMESTEP_END
# Just to confirm this happens BEFORE the gradient calcutions
execution_order_group = -1
[]
[gradient_from_imag]
type = ElementOptimizationDiffusionCoefFunctionInnerProduct
variable = uiadj
forward_variable = ui
function = G_function
execute_on = ADJOINT_TIMESTEP_END
# Just to confirm this happens BEFORE the gradient calcutions
execution_order_group = -1
[]
[]
[Reporters]
[measure_data_ur]
type = OptimizationData
objective_name = obj_val
variable = 'ur'
file_value = 'value'
measurement_file = 'measurement/frequency_ur_${id}.csv'
[]
[measure_data_ui]
type = OptimizationData
objective_name = obj_val
variable = 'ui'
file_value = 'value'
measurement_file = 'measurement/frequency_ui_${id}.csv'
[]
[gradient]
type = ParsedVectorReporter
name = gradient
reporter_names = 'gradient_from_real/inner_product gradient_from_imag/inner_product'
reporter_symbols = 'a b'
expression = 'a+b'
execute_on = ADJOINT_TIMESTEP_END
execution_order_group = 0
[]
[objective]
type = ParsedScalarReporter
name = objective
reporter_names = 'measure_data_ur/obj_val measure_data_ui/obj_val'
reporter_symbols = 'a b'
expression = 'a+b'
execute_on = ADJOINT_TIMESTEP_END
# Just to confirm this happens after the gradient calcutions
execution_order_group = 1
[]
[]
(modules/optimization/test/tests/optimizationreporter/material/adjoint.i)
[Mesh]
[]
[Variables]
[adjointVar]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjointVar
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjointVar
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'p1'
real_vector_values = '0' # Dummy value
[]
[]
[AuxVariables]
[temperature_forward]
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjointVar
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjointVar
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjointVar
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjointVar
boundary = top
value = 0
[]
[]
[Functions]
[thermo_conduct]
type = ParsedOptimizationFunction
expression = 'alpha'
param_symbol_names = 'alpha'
param_vector_name = 'params/p1'
[]
[]
[Materials]
[thermalProp]
type = GenericFunctionMaterial
prop_names = 'thermal_conductivity'
prop_values = 'thermo_conduct'
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[VectorPostprocessors]
[adjoint_grad]
type = ElementOptimizationDiffusionCoefFunctionInnerProduct
variable = adjointVar
forward_variable = temperature_forward
function = thermo_conduct
[]
[]
[Outputs]
console = false
file_base = 'adjoint'
[]
(modules/optimization/test/tests/optimizationreporter/point_loads/forward_homogeneous.i)
# DO NOT CHANGE THIS TEST
# this test is documented as an example in forceInv_pointLoads.md
# if this test is changed, the figures will need to be updated.
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Variables]
[temperature]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[point_source]
type = ConstantVectorPostprocessor
vector_names = 'x y z value'
value = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
execute_on = LINEAR
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
[]
[]
[Outputs]
console = false
file_base = 'forward_homo'
[]
(modules/optimization/test/tests/optimizationreporter/bc_load_linearFunction/adjoint.i)
[Mesh]
[]
[Variables]
[adjoint_T]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint_T
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_T
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
weight_name = misfit/weight
[]
[]
[Reporters]
[misfit]
type = OptimizationData
variable_weight_names = 'weight'
[]
[params_left]
type = ConstantReporter
real_vector_names = 'vals'
real_vector_values = '0 0' # Dummy
[]
[params_right]
type = ConstantReporter
real_vector_names = 'vals'
real_vector_values = '0' # Dummy
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjoint_T
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjoint_T
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint_T
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint_T
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
line_search = none
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[Functions]
[left_function]
type = ParsedOptimizationFunction
expression = 'a + b*y'
param_symbol_names = 'a b'
param_vector_name = 'params_left/vals'
[]
[right_function]
type = ParsedOptimizationFunction
expression = 'a'
param_symbol_names = 'a'
param_vector_name = 'params_right/vals'
[]
[]
[VectorPostprocessors]
[grad_bc_left]
type = SideOptimizationNeumannFunctionInnerProduct
variable = adjoint_T
function = left_function
boundary = left
[]
[grad_bc_right]
type = SideOptimizationNeumannFunctionInnerProduct
variable = adjoint_T
function = right_function
boundary = right
[]
[]
[Outputs]
console = false
exodus = false
file_base = 'adjoint'
[]
(modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/adjoint.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[Variables]
[adjoint]
[]
[]
[Problem]
extra_tag_vectors = 'ref'
[]
[AuxVariables]
[residual_src]
[]
[]
[AuxKernels]
[residual_src]
type = TagVectorAux
vector_tag = 'ref'
v = 'adjoint'
variable = 'residual_src'
[]
[]
[Variables]
[adjoint]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint
diffusivity = thermal_conductivity
[]
[]
#-----every adjoint problem should have these two
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
extra_vector_tags = 'ref'
[]
[]
[Reporters]
[misfit]
type = OptimizationData
measurement_points = ${measurement_points}
measurement_values = ${measurement_values}
[]
[]
[BCs]
[left]
type = DirichletBC
variable = adjoint
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = adjoint
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[gradient]
type = PointValueSampler
points = '0.2 0.2 0
0.7 0.56 0
0.4 1 0'
variable = adjoint
sort_by = id
[]
[]
[Outputs]
console = false
exodus = false
file_base = 'adjoint'
[]
(modules/optimization/test/tests/optimizationreporter/point_loads/forward.i)
# DO NOT CHANGE THIS TEST
# this test is documented as an example in forceInv_pointLoads.md
# if this test is changed, the figures will need to be updated.
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Variables]
[temperature]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 300
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 300
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 300
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 300
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[point_source]
type = ConstantVectorPostprocessor
vector_names = 'x y z value'
value = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
execute_on = LINEAR
[]
[vertical]
type = LineValueSampler
variable = 'temperature'
start_point = '0.5 0 0'
end_point = '0.5 1.4 0'
num_points = 21
sort_by = y
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
objective_name = objective_value
variable = temperature
[]
[]
[Outputs]
console = false
file_base = 'forward'
[]
(modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward_and_adjoint_transfer_data.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[misfit]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 300
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 300
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 300
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 300
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[gradient]
type = PointValueSampler
points = '0.2 0.2 0
0.7 0.56 0
0.4 1 0'
variable = temperature_adjoint
sort_by = id
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
objective_name = misfit_norm
[]
[point_source]
type = ConstantReporter
real_vector_names = 'x y z value'
real_vector_values = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
[]
[]
[Outputs]
console = false
[]
(modules/optimization/test/tests/executioners/constrained/inequality/forward_and_adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 20
xmax = 1
ymax = 1
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[BCs]
[left]
type = FunctionNeumannBC
variable = temperature
boundary = left
function = left_function
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 200
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 100
[]
[]
[Functions]
[left_function]
type = ParsedOptimizationFunction
expression = 'a + b*y'
param_symbol_names = 'a b'
param_vector_name = 'params/left'
[]
[dc_db]
type = ParsedFunction
expression = 'y'
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
line_search = none
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[VectorPostprocessors]
[grad_bc_left]
type = SideOptimizationNeumannFunctionInnerProduct
variable = temperature_adjoint
function = left_function
boundary = left
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Postprocessors]
[sum]
type = FunctionSideIntegral
boundary = left
function = left_function
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
objective_name = objective_value
[]
[params]
type = ConstantReporter
real_vector_names = 'left'
real_vector_values = '0 0' # Dummy
execute_on = NONE
[]
[]
[Outputs]
console = false
exodus = false
json = true
[]
#---------Inequality constraints------------#
[VectorPostprocessors]
[gradient_c]
type = VectorOfPostprocessors
postprocessors = 'dc_da dc_db'
[]
[ineq]
type = VectorOfPostprocessors
postprocessors = 'constraint'
[]
[]
[Postprocessors]
[constraint]
type = ParsedPostprocessor
expression = '150 - sum' # 150 is the constraint we want to satisfy
pp_names = sum
[]
[dc_da]
type = FunctionSideIntegral
boundary = left
function = -1
[]
[dc_db]
type = FunctionSideIntegral
boundary = left
function = '-y'
[]
[]
(modules/porous_flow/examples/multiapp_fracture_flow/3dFracture/matrix_app.i)
# 3D matrix app doing thermo-hydro PorousFlow and receiving heat energy via a VectorPostprocessor from the 2D fracture App
[Mesh]
uniform_refine = 0
[generate]
type = GeneratedMeshGenerator
dim = 3
nx = 11
xmin = -10
xmax = 210
ny = 9
ymin = -10
ymax = 160
nz = 11
zmin = -10
zmax = 210
[]
[]
[GlobalParams]
PorousFlowDictator = dictator
[]
[Variables]
[matrix_P]
scaling = 1E6
[]
[matrix_T]
initial_condition = 473
[]
[]
[ICs]
[frac_P]
type = FunctionIC
variable = matrix_P
function = insitu_pp
[]
[]
[Functions]
[insitu_pp]
type = ParsedFunction
expression = '10 - 0.847E-2 * z' # Approximate hydrostatic in MPa
[]
[]
[PorousFlowFullySaturated]
coupling_type = ThermoHydro
porepressure = matrix_P
temperature = matrix_T
fp = water
gravity = '0 0 -9.81E-6' # Note the value, because of pressure_unit
pressure_unit = MPa
[]
[DiracKernels]
[heat_from_fracture]
type = ReporterPointSource
variable = matrix_T
value_name = heat_transfer_rate/transferred_joules_per_s
x_coord_name = heat_transfer_rate/x
y_coord_name = heat_transfer_rate/y
z_coord_name = heat_transfer_rate/z
[]
[]
[FluidProperties]
[water]
type = SimpleFluidProperties # this is largely irrelevant here since we care about heat conduction only
thermal_expansion = 0 # to prevent depressurization as the reservoir is cooled
[]
[]
[Materials]
[porosity]
type = PorousFlowPorosityConst
porosity = 1E-3 # small porosity of rock
[]
[permeability]
type = PorousFlowPermeabilityConst
permeability = '1E-18 0 0 0 1E-18 0 0 0 1E-18'
[]
[internal_energy]
type = PorousFlowMatrixInternalEnergy
density = 2700 # kg/m^3
specific_heat_capacity = 800 # rough guess at specific heat capacity
[]
[aq_thermal_conductivity]
type = PorousFlowThermalConductivityIdeal
dry_thermal_conductivity = '5 0 0 0 5 0 0 0 5'
[]
[]
[VectorPostprocessors]
[heat_transfer_rate]
type = ConstantVectorPostprocessor
vector_names = 'transferred_joules_per_s x y z'
value = '0; 0; 0; 0'
outputs = none
[]
[]
[AuxVariables]
[normal_thermal_conductivity]
family = MONOMIAL
order = CONSTANT
[]
[fracture_normal_x]
family = MONOMIAL
order = CONSTANT
initial_condition = 0
[]
[fracture_normal_y]
family = MONOMIAL
order = CONSTANT
initial_condition = 1
[]
[fracture_normal_z]
family = MONOMIAL
order = CONSTANT
initial_condition = 0
[]
[element_normal_length]
family = MONOMIAL
order = CONSTANT
[]
[]
[AuxKernels]
[normal_thermal_conductivity_auxk]
type = ConstantAux
variable = normal_thermal_conductivity
value = 5 # very simple in this case
[]
[element_normal_length_auxk]
type = PorousFlowElementLength
variable = element_normal_length
direction = 'fracture_normal_x fracture_normal_y fracture_normal_z'
[]
[]
[Preconditioning]
[entire_jacobian]
type = SMP
full = true
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[]
[Executioner]
type = Transient
solve_type = NEWTON
[TimeStepper]
type = IterationAdaptiveDT
dt = 1
growth_factor = 1.1
optimal_iterations = 4
[]
dtmax = 1E8
end_time = 1E8
nl_abs_tol = 1E-2
[]
[Outputs]
print_linear_residuals = false
exodus = false
[]
[MultiApps]
[fracture_app]
type = TransientMultiApp
input_files = fracture_only_aperture_changing.i
cli_args = 'Outputs/ex/sync_only=false'
execute_on = TIMESTEP_BEGIN
sub_cycling = true
### catch_up = true
### max_catch_up_steps = 100
[]
[]
[Transfers]
[element_normal_length_to_fracture]
type = MultiAppNearestNodeTransfer
to_multi_app = fracture_app
source_variable = element_normal_length
variable = enclosing_element_normal_length
[]
[element_normal_thermal_cond_to_fracture]
type = MultiAppNearestNodeTransfer
to_multi_app = fracture_app
source_variable = normal_thermal_conductivity
variable = enclosing_element_normal_thermal_cond
[]
[T_to_fracture]
type = MultiAppGeometricInterpolationTransfer
to_multi_app = fracture_app
source_variable = matrix_T
variable = transferred_matrix_T
[]
[normal_x_from_fracture]
type = MultiAppNearestNodeTransfer
from_multi_app = fracture_app
source_variable = normal_dirn_x
variable = fracture_normal_x
[]
[normal_y_from_fracture]
type = MultiAppNearestNodeTransfer
from_multi_app = fracture_app
source_variable = normal_dirn_y
variable = fracture_normal_y
[]
[normal_z_from_fracture]
type = MultiAppNearestNodeTransfer
from_multi_app = fracture_app
source_variable = normal_dirn_z
variable = fracture_normal_z
[]
[heat_from_fracture]
type = MultiAppReporterTransfer
from_multi_app = fracture_app
from_reporters = 'heat_transfer_rate/joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
to_reporters = 'heat_transfer_rate/transferred_joules_per_s heat_transfer_rate/x heat_transfer_rate/y heat_transfer_rate/z'
[]
[]
(modules/optimization/test/tests/optimizationreporter/constant_heat_source/adjoint.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
xmax = 2
ymax = 2
[]
[Variables]
[adjoint_T]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint_T
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint_T
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[params]
type = ConstantReporter
real_vector_names = 'q'
real_vector_values = '0' # Dummy value
[]
[]
[BCs]
[left]
type = NeumannBC
variable = adjoint_T
boundary = left
value = 0
[]
[right]
type = NeumannBC
variable = adjoint_T
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint_T
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint_T
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
nl_abs_tol = 1e-8
nl_rel_tol = 1e-8
petsc_options_iname = '-ksp_type -pc_type -pc_factor_mat_solver_package'
petsc_options_value = 'preonly lu superlu_dist'
[]
[Functions]
[volumetric_heat_func]
type = ParsedOptimizationFunction
expression = q
param_symbol_names = 'q'
param_vector_name = 'params/q'
[]
[]
[VectorPostprocessors]
[gradient_vpp]
type = ElementOptimizationSourceFunctionInnerProduct
variable = adjoint_T
function = volumetric_heat_func
[]
[]
[Outputs]
console = false
file_base = 'adjoint'
[]
(modules/combined/test/tests/optimization/invOpt_elasticity_modular/grad.i)
[Mesh]
displacements = 'ux uy'
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 11
ny = 11
xmin = -4
xmax = 4
ymin = -4
ymax = 4
[]
[]
[Variables]
# adjoint
[ux]
[]
[uy]
[]
[]
[AuxVariables]
[dummy]
[]
[T]
[]
# displacement variables to be transferred from the forward app
# we use them to compute stress and stress derivative wrt E
[state_x]
[]
[state_y]
[]
[]
[DiracKernels]
[misfit_is_adjoint_force]
type = ReporterPointSource
variable = ux
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
[]
[]
[Physics]
[SolidMechanics]
[QuasiStatic]
[all]
strain = SMALL
new_system = true
add_variables = true
formulation = TOTAL
incremental = true
volumetric_locking_correction = false
displacements = 'ux uy'
# add base name to distinguish between forward and adjoint
# the total lagrangian formulation does not add base_name correctly without setting both, which should be improved
base_name = 'adjoint'
strain_base_name = 'adjoint'
[]
displacements = 'ux uy'
[]
[]
[]
[BCs]
[bottom_ux]
type = DirichletBC
variable = ux
boundary = bottom
value = 0.0
[]
[bottom_uy]
type = DirichletBC
variable = uy
boundary = bottom
value = 0.0
[]
[]
[NEML2]
# two elasticity models are listed inside "elasticity.i" for forward and adjoint, respectively
input = 'elasticity.i'
model = 'adjoint_elasticity_model'
verbose = false
temperature = 'T'
mode = PARSE_ONLY
device = 'cpu'
enable_AD = true
[]
[UserObjects]
[gather_E]
type = MOOSERealMaterialToNEML2Parameter
moose_material_property = E_material
neml2_parameter = E
execute_on = 'INITIAL TIMESTEP_BEGIN'
[]
# forward model
[forward_input_strain]
type = MOOSERankTwoTensorMaterialPropertyToNEML2
moose_material_property = forward_mechanical_strain
neml2_variable = forces/E
[]
[forward_model]
type = ExecuteNEML2Model
model = 'forward_elasticity_model'
# add other gatherers here if needed
enable_AD = true
gather_uos = 'forward_input_strain'
gather_param_uos = 'gather_E'
[]
# adjoint model
[adjoint_input_strain]
type = MOOSERankTwoTensorMaterialPropertyToNEML2
moose_material_property = adjoint_mechanical_strain
neml2_variable = forces/E
[]
[adjoint_model]
type = ExecuteNEML2Model
model = 'adjoint_elasticity_model'
# add other gatherers here if needed
enable_AD = true
gather_uos = 'adjoint_input_strain'
gather_param_uos = 'gather_E'
[]
[]
[Materials]
[adjoint_stress]
type = NEML2StressToMOOSE
execute_neml2_model_uo = adjoint_model
neml2_stress_output = state/S
neml2_strain_input = forces/E
base_name = 'adjoint'
[]
[forward_strain]
type = ComputeSmallStrain
displacements = 'state_x state_y'
base_name = 'forward'
[]
[forward_dstress_dE]
type = NEML2ParameterDerivativeToSymmetricRankTwoTensorMOOSEMaterialProperty
execute_neml2_model_uo = forward_model
moose_material_property = forward_dstress_dE
neml2_variable = state/S
neml2_parameter_derivative = E # young's modulus
[]
# adjoint and forward use the same young's modulus value
[E_material]
type = GenericFunctionMaterial
prop_names = 'E_material'
prop_values = E
[]
[]
[Functions]
[E]
type = NearestReporterCoordinatesFunction
x_coord_name = parametrization/coordx
y_coord_name = parametrization/coordy
value_name = parametrization/youngs_modulus
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = ux
[]
[misfit]
type = OptimizationData
[]
[parametrization]
type = ConstantReporter
real_vector_names = 'coordx coordy youngs_modulus'
real_vector_values = '0 0 0; ${fparse 8/3} 0 ${fparse -8/3}; 5 5 5'
[]
[]
[VectorPostprocessors]
[grad_youngs_modulus]
type = AdjointStrainSymmetricStressGradInnerProduct
stress_derivative_name = 'forward_dstress_dE'
adjoint_strain_name = 'adjoint_mechanical_strain'
variable = dummy
function = E
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
# we do not compute them together as this is overwritting DiracKernel's residual calculation, which should be improved
residual_and_jacobian_together = false
[]
[Outputs]
file_base = 'adjoint'
console = false
[]
(modules/combined/test/tests/optimization/invOpt_mechanics/forward_and_adjoint.i)
# DO NOT CHANGE THIS TEST
# this test is documented as an example in forceInv_NeumannBC.md
# if this test is changed, the figures will need to be updated.
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 2
xmin = 0.0
xmax = 5.0
ymin = 0.0
ymax = 1.0
use_displaced_mesh = false
[]
[Variables]
[disp_x]
[]
[disp_y]
[]
[]
[Physics]
[SolidMechanics]
[QuasiStatic]
displacements = 'disp_x disp_y'
[all]
displacements = 'disp_x disp_y'
strain = SMALL
[]
[]
[]
[]
[BCs]
[left_ux]
type = DirichletBC
variable = disp_x
boundary = left
value = 0
[]
[left_uy]
type = DirichletBC
variable = disp_y
boundary = left
value = 0
[]
[right_fy]
type = FunctionNeumannBC
variable = disp_y
boundary = right
function = right_fy_func
[]
[right_fx]
type = FunctionNeumannBC
variable = disp_x
boundary = right
function = right_fx_func
[]
[]
[Functions]
[right_fy_func]
type = ParsedOptimizationFunction
expression = 'val_y'
param_symbol_names = 'val_x val_y'
param_vector_name = 'params/right_values'
[]
[right_fx_func]
type = ParsedOptimizationFunction
expression = 'val_x'
param_symbol_names = 'val_x val_y'
param_vector_name = 'params/right_values'
[]
[]
[Materials]
[elasticity]
type = ComputeIsotropicElasticityTensor
youngs_modulus = 10e3
poissons_ratio = 0.3
[]
[stress]
type = ComputeLinearElasticStress
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[point_sample]
type = PointValueSampler
variable = 'disp_x disp_y'
points = '5.0 1.0 0'
sort_by = x
[]
[]
[Reporters]
[measure_data_x]
type = OptimizationData
objective_name = objective_value
variable = disp_x
measurement_points = '5.0 1.0 0.0'
measurement_values = '-13.00873469088'
[]
[measure_data_y]
type = OptimizationData
objective_name = objective_value
variable = disp_y
measurement_points = '5.0 1.0 0.0'
measurement_values = '85.008027719915'
[]
[params]
type = ConstantReporter
real_vector_names = 'right_values'
real_vector_values = '-1300 2100 ' # True Values
[]
[combined]
type = ParsedVectorReporter
name = gradient
reporter_names = 'adjoint_pt_x/inner_product adjoint_pt_y/inner_product'
reporter_symbols = 'a b'
expression = 'a+b'
execute_on = ADJOINT_TIMESTEP_END
# Just to confirm this happens after the gradient calcutions
execution_order_group = 1
[]
[obj]
type = ParsedScalarReporter
name = obj_val
reporter_names = 'measure_data_x/objective_value
measure_data_y/objective_value'
reporter_symbols = 'a b'
expression = 'a+b'
execute_on = ADJOINT_TIMESTEP_END
# Just to confirm this happens after the gradient calcutions
execution_order_group = 1
[]
[]
[Outputs]
csv = false
console = false
exodus = false
file_base = 'forward'
execute_on = 'FINAL'
json = false
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
skip_nl_system_check = true
[]
[Variables]
[adjoint_x]
initial_condition = 0
solver_sys = adjoint
outputs = none
[]
[adjoint_y]
initial_condition = 0
solver_sys = adjoint
outputs = none
[]
[]
[DiracKernels]
[pt_x]
type = ReporterPointSource
variable = adjoint_x
x_coord_name = measure_data_x/measurement_xcoord
y_coord_name = measure_data_x/measurement_ycoord
z_coord_name = measure_data_x/measurement_zcoord
value_name = measure_data_x/misfit_values
[]
[pt_y]
type = ReporterPointSource
variable = adjoint_y
x_coord_name = measure_data_y/measurement_xcoord
y_coord_name = measure_data_y/measurement_ycoord
z_coord_name = measure_data_y/measurement_zcoord
value_name = measure_data_y/misfit_values
[]
[]
[VectorPostprocessors]
[adjoint_pt_x]
type = SideOptimizationNeumannFunctionInnerProduct
variable = adjoint_x
function = right_fx_func
boundary = right
execute_on = ADJOINT_TIMESTEP_END
[]
[adjoint_pt_y]
type = SideOptimizationNeumannFunctionInnerProduct
variable = adjoint_y
function = right_fy_func
boundary = right
execute_on = ADJOINT_TIMESTEP_END
[]
[]
(test/tests/dirackernels/block_restriction/skip.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
[]
[left]
type = SubdomainBoundingBoxGenerator
input = square
block_id = 1
bottom_left = '0 0 0'
top_right = '0.5 1 0'
[]
[right]
type = SubdomainBoundingBoxGenerator
input = left
block_id = 2
bottom_left = '0.5 0 0'
top_right = '1 1 0'
[]
[]
[Variables]
[u]
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[VectorPostprocessors]
[source]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
[DiracKernels]
[point_source]
type = ReporterPointSource
variable = u
block = 1
value_name = source/value
x_coord_name = source/x
y_coord_name = source/y
z_coord_name = source/z
# The VPP contains the following information
# x,y,z,value
# 0.25,0.25,0.0,1
# 0.50,0.50,0.0,2
# 0.75,0.75,0.0,3
# The first point is in block 1.
# The second point is on the interface between blocks 1 and 2.
# The third point is in block 2.
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = 1
value = 1
[]
[]
[Executioner]
type = Steady
[]
[Outputs]
exodus = true
[]
(modules/optimization/test/tests/optimizationreporter/bimaterial/model_and_adjoint.i)
# Steady state Heat conduction in a 2D domain with two diffusivities
# The domain is -4 <= x <= 4 and -4 <= y <= 4
# The top-half of the domain (y > 0) has high diffusivity
# The bottom-half of the domain (y < 0) has low diffusivity
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 16
ny = 16
xmin = -4
xmax = 4
ymin = -4
ymax = 4
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = diffusivity
[]
[heat_source]
type = BodyForce
value = 100
variable = temperature
[]
[]
[BCs]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 0
[]
[]
[Functions]
[diffusivity_function]
type = NearestReporterCoordinatesFunction
x_coord_name = data/coordx
y_coord_name = data/coordy
value_name = data/diffusivity
[]
[]
[Materials]
[mat]
type = GenericFunctionMaterial
prop_names = diffusivity
prop_values = diffusivity_function
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
objective_name = objective_value
variable = temperature
[]
[data]
type = ConstantReporter
real_vector_names = 'coordx coordy diffusivity'
real_vector_values = '0 0; -2 2; 5 10'
[]
[]
[VectorPostprocessors]
[gradvec]
type = ElementOptimizationDiffusionCoefFunctionInnerProduct
variable = temperature_adjoint
forward_variable = temperature
function = diffusivity_function
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_forced_its = 1
line_search = none
nl_abs_tol = 1e-8
[]
[Outputs]
console = false
[]
(modules/optimization/test/tests/optimizationreporter/general_opt/point_loads_gen_opt/forward.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Variables]
[temperature]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 300
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 300
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 300
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 300
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[point_source]
type = ConstantVectorPostprocessor
vector_names = 'x y z value'
value = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
execute_on = LINEAR
[]
[vertical]
type = LineValueSampler
variable = 'temperature'
start_point = '0.5 0 0'
end_point = '0.5 1.4 0'
num_points = 21
sort_by = y
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
objective_name = misfit_norm
measurement_points = ${measurement_points}
measurement_values = ${measurement_values}
[]
[]
[Outputs]
console = false
file_base = 'forward'
[]
(modules/optimization/test/tests/optimizationreporter/mesh_source/forward_and_adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[u]
[]
[u_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[src]
type = BodyForce
variable = u
function = src_func
[]
[]
[BCs]
[dirichlet]
type = DirichletBC
variable = u
boundary = 'bottom left'
value = 0
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = u_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[Functions]
[src_func]
type = ParameterMeshFunction
exodus_mesh = parameter_mesh_in.e
parameter_name = src_rep/vals
[]
[]
[Reporters]
[src_rep]
type = ConstantReporter
real_vector_names = 'vals'
real_vector_values = '1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0'
[]
[measure_data]
type = OptimizationData
variable = u
objective_name = objective_value
outputs = none
[]
[]
[VectorPostprocessors]
[gradient_vpp]
type = ElementOptimizationSourceFunctionInnerProduct
variable = u_adjoint
function = src_func
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
nl_rel_tol = 1e-12
l_tol = 1e-12
[]
[AuxVariables]
[source]
[]
[]
[AuxKernels]
[source_aux]
type = FunctionAux
variable = source
function = src_func
[]
[]
[Outputs]
exodus = true
console = true
execute_on = timestep_end
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[]
[DiracKernels]
inactive = 'reporter_point_source_err reporter_point_source_dup_err'
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = 'csv_reader/u'
x_coord_name = 'csv_reader/x'
y_coord_name = 'csv_reader/y'
z_coord_name = 'csv_reader/z'
[]
[reporter_point_source]
type = ReporterPointSource
variable = u
value_name = 'reporterData/u'
x_coord_name = 'reporterData/x'
y_coord_name = 'reporterData/y'
z_coord_name = 'reporterData/z'
weight_name = 'reporterData/weight'
[]
[reporter_point_source_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_err/u2'
x_coord_name = 'reporterData_err/x2'
y_coord_name = 'reporterData_err/y2'
z_coord_name = 'reporterData_err/z2'
[]
[reporter_point_source_dup_err]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=false
[]
[reporter_point_source_dup]
type = ReporterPointSource
variable = u
value_name = 'reporterData_dup/u'
x_coord_name = 'reporterData_dup/x'
y_coord_name = 'reporterData_dup/y'
z_coord_name = 'reporterData_dup/z'
weight_name = 'reporterData_dup/weight'
combine_duplicates=true
[]
[]
[BCs]
[left]
type = DirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = DirichletBC
variable = u
boundary = 1
value = 1
[]
[]
[VectorPostprocessors]
[csv_reader]
type = CSVReader
csv_file = point_value_file.csv
[]
[]
[Reporters]
[reporterData]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.0; 0.3 0.8 0.0; 0 0 0; 1 -.5 0; 1 1 1'
[]
[reporterData_err]
type = ConstantReporter
real_vector_names = 'x2 y2 z2 u2'
real_vector_values = '0.2 0.2; 0.3 0.8 0.0; 0 0 0; 1 -.5 0'
[]
[reporterData_dup]
type = ConstantReporter
real_vector_names = 'x y z u weight'
real_vector_values = '0.2 0.2 0.2 0.0; 0.3 0.3 0.8 0.0; 0 0 0 0; 2 1 -.5 0;0.25 0.5 1 1'
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(test/tests/dirackernels/reporter_point_source/2d_vpp_transient.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
uniform_refine = 4
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = Diffusion
variable = u
[]
[dot]
type = TimeDerivative
variable = u
[]
[]
[DiracKernels]
[vpp_point_source]
type = ReporterPointSource
variable = u
value_name = point_sample_source/u
x_coord_name = point_sample_source/x
y_coord_name = point_sample_source/y
z_coord_name = point_sample_source/z
[]
[]
[VectorPostprocessors]
[point_sample_source]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0 0.2 0.2 0.0'
sort_by = id
execute_on = 'timestep_begin'
outputs = none
[]
[point_sample_out]
type = PointValueSampler
variable = u
points = '0.2 0.8 0.0'
sort_by = id
execute_on = 'timestep_begin'
contains_complete_history = true
outputs = 'csv'
[]
[]
[Functions]
[left_bc_fn]
type = ParsedFunction
expression = 1+5*y*y
[]
[]
[BCs]
[left]
type = FunctionNeumannBC
variable = u
boundary = left
function = left_bc_fn
[]
[right]
type = DirichletBC
variable = u
boundary = right
value = 1
[]
[]
[Executioner]
type = Transient
dt = 0.01
num_steps = 5
solve_type = 'PJFNK'
nl_rel_tol = 1e-10
[]
[Outputs]
csv = true
[]
(modules/optimization/test/tests/optimizationreporter/point_loads/forward_and_adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature
x_coord_name = 'point_source/x'
y_coord_name = 'point_source/y'
z_coord_name = 'point_source/z'
value_name = 'point_source/value'
[]
[misfit]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
[]
[]
[BCs]
[left]
type = DirichletBC
variable = temperature
boundary = left
value = 300
[]
[right]
type = DirichletBC
variable = temperature
boundary = right
value = 300
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 300
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 300
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[gradient]
type = PointValueSampler
points = '0.2 0.2 0
0.7 0.56 0
0.4 1 0'
variable = temperature_adjoint
sort_by = id
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
objective_name = objective_value
variable = temperature
[]
[point_source]
type = ConstantReporter
real_vector_names = 'x y z value'
real_vector_values = '0.2 0.7 0.4;
0.2 0.56 1;
0 0 0;
-1000 120 500'
[]
[]
[Outputs]
console = false
[]
(modules/optimization/test/tests/optimizationreporter/point_loads/adjoint.i)
# DO NOT CHANGE THIS TEST
# this test is documented as an example in forceInv_pointLoads.md
# if this test is changed, the figures will need to be updated.
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
xmax = 1
ymax = 1.4
[]
[Variables]
[adjoint]
[]
[]
[Problem]
extra_tag_vectors = 'ref'
[]
[AuxVariables]
[residual_src]
[]
[]
[AuxKernels]
[residual_src]
type = TagVectorAux
vector_tag = 'ref'
v = 'adjoint'
variable = 'residual_src'
[]
[]
[Variables]
[adjoint]
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = adjoint
diffusivity = thermal_conductivity
[]
[]
#-----every adjoint problem should have these two
[DiracKernels]
[pt]
type = ReporterPointSource
variable = adjoint
x_coord_name = misfit/measurement_xcoord
y_coord_name = misfit/measurement_ycoord
z_coord_name = misfit/measurement_zcoord
value_name = misfit/misfit_values
extra_vector_tags = 'ref'
[]
[]
[Reporters]
[misfit]
type = OptimizationData
[]
[]
[BCs]
[left]
type = DirichletBC
variable = adjoint
boundary = left
value = 0
[]
[right]
type = DirichletBC
variable = adjoint
boundary = right
value = 0
[]
[bottom]
type = DirichletBC
variable = adjoint
boundary = bottom
value = 0
[]
[top]
type = DirichletBC
variable = adjoint
boundary = top
value = 0
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
nl_abs_tol = 1e-6
nl_rel_tol = 1e-8
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[VectorPostprocessors]
[gradient]
type = PointValueSampler
points = '0.2 0.2 0
0.7 0.56 0
0.4 1 0'
variable = adjoint
sort_by = id
[]
[]
[Outputs]
console = false
exodus = false
file_base = 'adjoint'
[]
(modules/optimization/test/tests/optimizationreporter/bc_load_linearFunction/forward_and_adjoint.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 20
xmax = 1
ymax = 2
bias_x = 1.1
bias_y = 1.1
[]
[]
[Problem]
nl_sys_names = 'nl0 adjoint'
kernel_coverage_check = false
[]
[Variables]
[temperature]
[]
[temperature_adjoint]
solver_sys = adjoint
[]
[]
[Kernels]
[heat_conduction]
type = MatDiffusion
variable = temperature
diffusivity = thermal_conductivity
[]
[]
[BCs]
[left]
type = FunctionNeumannBC
variable = temperature
boundary = left
function = left_function
[]
[right]
type = FunctionNeumannBC
variable = temperature
boundary = right
function = right_function
[]
[bottom]
type = DirichletBC
variable = temperature
boundary = bottom
value = 200
[]
[top]
type = DirichletBC
variable = temperature
boundary = top
value = 100
[]
[]
[Functions]
[left_function]
type = ParsedOptimizationFunction
expression = 'a + b*y'
param_symbol_names = 'a b'
param_vector_name = 'params/left'
[]
[right_function]
type = ParsedOptimizationFunction
expression = 'a'
param_symbol_names = 'a'
param_vector_name = 'params/right'
[]
[]
[Materials]
[steel]
type = GenericConstantMaterial
prop_names = thermal_conductivity
prop_values = 5
[]
[]
[Executioner]
type = SteadyAndAdjoint
forward_system = nl0
adjoint_system = adjoint
line_search = none
nl_rel_tol = 1e-12
l_tol = 1e-12
petsc_options_iname = '-pc_type'
petsc_options_value = 'lu'
[]
[DiracKernels]
[pt]
type = ReporterPointSource
variable = temperature_adjoint
x_coord_name = measure_data/measurement_xcoord
y_coord_name = measure_data/measurement_ycoord
z_coord_name = measure_data/measurement_zcoord
value_name = measure_data/misfit_values
weight_name = measure_data/weight
[]
[]
[VectorPostprocessors]
[grad_bc_left]
type = SideOptimizationNeumannFunctionInnerProduct
variable = temperature_adjoint
function = left_function
boundary = left
execute_on = ADJOINT_TIMESTEP_END
[]
[grad_bc_right]
type = SideOptimizationNeumannFunctionInnerProduct
variable = temperature_adjoint
function = right_function
boundary = right
execute_on = ADJOINT_TIMESTEP_END
[]
[]
[Reporters]
[measure_data]
type = OptimizationData
variable = temperature
measurement_file = 'measurementData.csv'
file_xcoord = 'coordx'
file_ycoord ='y'
file_zcoord = 'z'
file_value = 'weightedMeasurement'
file_variable_weights = 'weight'
variable_weight_names = 'weight'
[]
[params]
type = ConstantReporter
real_vector_names = 'left right'
real_vector_values = '0 0; 0' # Dummy
[]
[vector_sqsum]
type = ParsedVectorRealReductionReporter
name = sqsum
reporter_name= 'measure_data/misfit_values'
initial_value = 0
expression = 'reduction_value+indexed_value*indexed_value'
outputs=none
[]
[obj_sum]
type = ParsedScalarReporter
name = value
reporter_names = 'vector_sqsum/sqsum'
reporter_symbols = 'a'
expression = '0.5*a'
[]
[]
[Outputs]
console = false
exodus = true
[]
(modules/optimization/include/dirackernels/ReporterTimePointSource.h)
// This file is part of the MOOSE framework
// https://www.mooseframework.org
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
// Moose Includes
#include "ReporterPointSource.h"
/**
* Apply a time dependent point load defined by Reporters.
*/
class ReporterTimePointSource : public ReporterPointSource
{
public:
static InputParameters validParams();
ReporterTimePointSource(const InputParameters & parameters);
virtual void addPoints() override;
protected:
/// time-coordinates from reporter
const std::vector<Real> & _coordt;
private:
/// The final time when we want to reverse the time index in function evaluation
const Real & _reverse_time_end;
};