12 #include "libmesh/libmesh_common.h" 23 "Computes the misfit and misfit gradient materials for inverse optimizations problems.");
26 "Variable that is being used for the forward simulation.");
28 "Reporter with measurement data.");
36 _sim_var(this->template coupledGenericValue<is_ad>(
"forward_variable")),
38 this->template declareGenericProperty<
Real, is_ad>(_prop_name +
"_gradient")),
39 _measurement_values(this->template getReporterValue<
std::vector<
Real>>(
49 _mat_prop_gradient[_qp] = 0.0;
50 auto num_pts = _read_in_points ? _points.size() : _coordx.size();
52 mooseAssert((_coordx.size() == _coordy.size()) && (_coordx.size() == _coordz.size()),
53 "Size of the coordinate offsets don't match.");
55 mooseAssert(num_pts == _measurement_values.size(),
56 "Number of offsets doesn't match the number of measurements.");
61 _read_in_points ? _points[
idx] : Point(_coordx[
idx], _coordy[
idx], _coordz[
idx]);
63 const Real measurement_value = _measurement_values[
idx];
64 const auto simulation_value = _sim_var[_qp];
67 const Real weighting = computeOffsetFunction(offset);
71 Utility::pow<2>(weighting) * Utility::pow<2>(measurement_value - simulation_value);
72 _mat_prop_gradient[_qp] -=
73 2.0 * Utility::pow<2>(weighting) * (measurement_value - simulation_value);
MisfitReporterOffsetFunctionMaterialTempl(const InputParameters ¶meters)
This class defines a material with an associated offset function.
static InputParameters validParams()
static InputParameters validParams()
virtual void computeQpProperties() override
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
const ReporterMode REPORTER_MODE_REPLICATED
This class creates a misfit and misfit gradient material that can be used for optimizing measurements...
registerMooseObject("OptimizationApp", MisfitReporterOffsetFunctionMaterial)