https://mooseframework.inl.gov
Loading...
Searching...
No Matches
InversionControlBase.h
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
10#pragma once
11
12#include "Control.h"
13
14#include <optional>
15
16class Function;
17
27{
28public:
30
32
38 virtual void execute() override final;
39
40protected:
43 {
49 bool publish;
50 };
51
57 virtual IterationUpdate computeUpdate(unsigned int it, Real p_used, Real y, Real y_target) = 0;
58
60 unsigned int fixedPointIteration() const;
61
63 Real targetValue() const;
64
67
69 void setParameter(Real p);
70
77 Real linearRootUpdate(Real p_a, Real y_a, Real p_b, Real y_b, Real y_target);
78
88 Real normalizedResidual(Real y) const;
89
91 void setResidual(Real value);
92
98 const PostprocessorName _param_name;
100 const std::optional<PostprocessorName> _converged_param_name;
104 const PostprocessorName _residual_name;
106 const Real _abs_tol;
108 const Real _rel_tol;
109};
const std::vector< double > y
const Real p
Real PostprocessorValue
Base class for controls that adjust a single scalar parameter (held in a postprocessor) once per fixe...
virtual IterationUpdate computeUpdate(unsigned int it, Real p_used, Real y, Real y_target)=0
Compute this iteration's update from the current sample: the 1-based fixed-point iteration it and the...
Real normalizedResidual(Real y) const
Normalized convergence residual for output value y: |y - targetValue()| / max(absolute_tolerance,...
const Real _rel_tol
Relative tolerance on |output - target|, relative to |target|.
const Real _abs_tol
Absolute tolerance on |output - target|.
const PostprocessorName _residual_name
Name of the postprocessor the control writes with the normalized convergence residual.
void setResidual(Real value)
Write a value to the residual postprocessor that the Convergence object compares against 1.
Real linearRootUpdate(Real p_a, Real y_a, Real p_b, Real y_b, Real y_target)
One guarded linear-model root update from two (parameter, output) samples – a secant step shared by t...
unsigned int fixedPointIteration() const
1-based fixed-point iteration (1 on the first iteration of each fixed-point solve,...
const PostprocessorValue & _param
Parameter value consumed by the most recent sub-app solve (read in place)
void publishConvergedParameter(Real p)
Publish a parameter value to the optional converged-parameter postprocessor (no-op if unset)
const std::optional< PostprocessorName > _converged_param_name
Optional postprocessor to publish the parameter value that produced the current output.
void setParameter(Real p)
Write the next parameter guess to the parameter postprocessor.
const PostprocessorName _param_name
Name of the parameter postprocessor to update with the next guess.
virtual void execute() override final
Template method: reads the current (parameter, output) sample, delegates the scheme-specific decision...
const PostprocessorValue & _output
Sub-app output value transferred back to the main app (compared against the target)
Real targetValue() const
Target output value at the current time.
const Function & _target_function
Target output as a function of time.
static InputParameters validParams()
const InputParameters & parameters() const
One iteration's update, produced by the derived scheme and applied by execute().
bool publish
Whether the current (already-evaluated) parameter is the solution of record to publish.
Real residual
Residual to report for the current sample (compared against 1 by the Convergence object)
Real next_parameter
Parameter guess to write for the next solve.