https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ParsedConvergence.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 "Convergence.h"
13#include "FunctionParserUtils.h"
14
15class Function;
16
21{
22public:
24
26
27 virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter) override;
28
29 virtual void initialSetup() override;
30
31protected:
33
37 void initializeSymbols();
38 void initializePostprocessorSymbol(unsigned int i);
39 void initializeFunctionSymbol(unsigned int i);
40 void initializeConvergenceSymbol(unsigned int i);
41 void initializeConstantSymbol(unsigned int i);
42
48 SymFunctionPtr makeParsedFunction(const std::string & expression);
49
55 void updateSymbolValues(unsigned int n_iter);
58 void updateConvergenceSymbolValues(unsigned int n_iter);
59
66 bool convertRealToBool(Real value, const std::string & param) const;
67
69
71 std::vector<std::string> _symbol_names;
73 std::vector<std::string> _symbol_values;
74
76 const std::string _convergence_expression;
78 const std::string _divergence_expression;
79
84
88 std::vector<Real> _divergence_function_params;
89
91 std::vector<const PostprocessorValue *> _pp_values;
92 std::vector<unsigned int> _pp_indices;
93
95 std::vector<Function *> _functions;
96 std::vector<unsigned int> _function_indices;
97
99 std::vector<Convergence *> _convergences;
100 std::vector<std::string> _convergence_symbol_names;
101 std::vector<unsigned int> _convergence_indices;
102};
Base class for convergence criteria.
Definition Convergence.h:26
MooseConvergenceStatus
Status returned by calls to checkConvergence.
Definition Convergence.h:34
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
std::shared_ptr< SymFunction > SymFunctionPtr
Shorthand for an smart pointer to an autodiff function parser object.
Base class for function objects.
Definition Function.h:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Evaluates convergence from a parsed expression.
bool convertRealToBool(Real value, const std::string &param) const
Converts a Real value to a bool.
std::vector< unsigned int > _pp_indices
void updatePostprocessorSymbolValues()
std::vector< const PostprocessorValue * > _pp_values
Post-processor values in the provided symbols.
const std::string _divergence_expression
Expression to parse for divergence.
void initializeFunctionSymbol(unsigned int i)
std::vector< std::string > _symbol_names
User-defined symbols to use in parsed expression.
std::vector< Convergence * > _convergences
Convergences in the provided symbols.
std::vector< unsigned int > _function_indices
std::vector< Real > _convergence_function_params
Convergence function parameters.
SymFunctionPtr _divergence_function
Parsed function for divergence.
virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter) override
Returns convergence status.
void initializePostprocessorSymbol(unsigned int i)
std::vector< std::string > _convergence_symbol_names
void updateConvergenceSymbolValues(unsigned int n_iter)
std::vector< unsigned int > _convergence_indices
void updateSymbolValues(unsigned int n_iter)
Updates non-constant symbol values.
const std::string _convergence_expression
Expression to parse for convergence.
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job.
usingFunctionParserUtilsMembers(false)
std::vector< Function * > _functions
Functions in the provided symbols.
void initializeConstantSymbol(unsigned int i)
SymFunctionPtr _convergence_function
Parsed function for convergence.
void initializeSymbols()
Initializes symbols used in the parsed expression.
void initializeConvergenceSymbol(unsigned int i)
std::vector< Real > _divergence_function_params
Divergence function parameters.
SymFunctionPtr makeParsedFunction(const std::string &expression)
Makes a parsed function.
FEProblemBase & _fe_problem
static InputParameters validParams()
std::vector< std::string > _symbol_values
Corresponding symbol values (Convergence, Function, Postprocessor, or constant)