https://mooseframework.inl.gov
TransientSyntheticDataCreator.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 
13 
16 {
18 
19  params.addClassDescription(
20  "Fills optimization data from a forward transient simulation using "
21  "a single set of measurement times and points and replicates the data as needed.");
22  params.addParam<std::vector<Real>>("measurement_times_for_all_points",
23  "Measurement time that all points read in a value.");
24  params.addParam<std::vector<Point>>("single_set_of_measurement_points",
25  "One set of measurement points that will be sampled at every "
26  "time in measurement_times_for_all_points.");
27  params.set<std::vector<Real>>("measurement_values") = {0};
28  return params;
29 }
30 
33 {
34  std::vector<Real> measurement_times_for_all_points;
35  if (isParamValid("measurement_times_for_all_points"))
36  measurement_times_for_all_points =
37  getParam<std::vector<Real>>("measurement_times_for_all_points");
38  else
39  paramError("measurement_times_for_all_points",
40  "Input file must contain measurement_times_for_all_points");
41 
42  std::vector<Point> single_set_of_measurement_points;
43  if (isParamValid("single_set_of_measurement_points"))
44  single_set_of_measurement_points =
45  getParam<std::vector<Point>>("single_set_of_measurement_points");
46  else
47  paramError("single_set_of_measurement_points",
48  "Input file must contain single_set_of_measurement_points");
49 
50  for (auto & p : single_set_of_measurement_points)
51  {
52  for (auto & t : measurement_times_for_all_points)
53  {
54  _measurement_xcoord.push_back(p(0));
55  _measurement_ycoord.push_back(p(1));
56  _measurement_zcoord.push_back(p(2));
57  _measurement_time.push_back(t);
58  _measurement_values.push_back(0.0);
59  }
60  }
61 }
TransientSyntheticDataCreator(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
bool isParamValid(const std::string &name) const
registerMooseObject("OptimizationTestApp", TransientSyntheticDataCreator)
void paramError(const std::string &param, Args... args) const
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()