101 "allocateStorage has not been called with primary = " +
Moose::stringify(primary));
103 "allocateStorage has not been called with primary = " +
Moose::stringify(primary));
105 "allocateStorage has not been called with primary = " +
Moose::stringify(primary));
107 "allocateStorage has not been called with primary = " +
Moose::stringify(primary));
134 const std::vector<PostprocessorName> * transformed_pps;
135 std::vector<std::vector<PostprocessorValue>> * transformed_pps_values;
149 for (
size_t i = 0; i < (*transformed_pps).size(); i++)
152 (*transformed_pps_values)[i][3] = (*transformed_pps_values)[i][1];
164 (*transformed_pps_values)[i][2] = (*transformed_pps_values)[i][1];
167 (*transformed_pps_values)[i][2] = (*transformed_pps_values)[i][0];
187 Real relaxation_factor;
188 const std::vector<PostprocessorName> * transformed_pps;
189 std::vector<std::vector<PostprocessorValue>> * transformed_pps_values;
204 for (
size_t i = 0; i < (*transformed_pps).size(); i++)
208 const Real xn_m1 = (*transformed_pps_values)[i][1];
209 const Real fxn_m2 = (*transformed_pps_values)[i][2];
210 const Real xn_m2 = (*transformed_pps_values)[i][3];
213 (*transformed_pps_values)[i][0] = fxn_m1;
216 Real new_value = fxn_m1;
218 new_value = xn_m1 - (fxn_m1 - xn_m1) * (xn_m1 - xn_m2) / (fxn_m1 - xn_m1 - fxn_m2 + xn_m2);
221 new_value = relaxation_factor * new_value + (1 - relaxation_factor) * xn_m1;
230 Real relaxation_factor;
261 for (
const auto & dof : target_dofs)
264 Real new_value = fxn_m1(dof);
266 new_value = xn_m1(dof) - (solution(dof) - xn_m1(dof)) * (xn_m1(dof) - xn_m2(dof)) /
267 (solution(dof) - xn_m1(dof) - fxn_m2(dof) + xn_m2(dof));
270 new_value = relaxation_factor * new_value + (1 - relaxation_factor) * xn_m1(dof);
272 solution.
set(dof, new_value);
280 const std::vector<Real> & timestep_begin_norms,
281 const std::vector<Real> & timestep_end_norms)
const 283 _console <<
"\n 0 Secant initialization |R| = " 286 Real max_norm_old = initial_norm;
289 Real max_norm =
std::max(timestep_begin_norms[i], timestep_end_norms[i]);
290 std::stringstream secant_prefix;
292 secant_prefix <<
" Secant initialization |R| = ";
294 secant_prefix <<
" Secant step |R| = ";
296 _console << std::setw(2) << i + 1 << secant_prefix.str()
298 max_norm_old = max_norm;
std::vector< std::vector< PostprocessorValue > > _transformed_pps_values
Previous values of the relaxed postprocessors.
std::vector< std::vector< PostprocessorValue > > _secondary_transformed_pps_values
Previous values of the postprocessors relaxed outside of the fixed point iteration (used as a subapp)...
FEProblemBase & _problem
Reference to FEProblem.
TagID _secondary_xn_m1_tagid
Vector tag id for the solution variable before the latest solve, as a sub app.
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
NumericVector< Number > & solution()
TagID _secondary_fxn_m2_tagid
Vector tag id for the result of the last but one secondary solve, as a sub app.
static InputParameters validParams()
void setPostprocessorValueByName(const PostprocessorName &name, const PostprocessorValue &value, std::size_t t_index=0)
Set the value of a PostprocessorValue.
TagID _secondary_xn_m2_tagid
Vector tag id for the solution variable two primary solves ago, as a sub app.
virtual void saveVariableValues(const bool primary) override final
Saves the current values of the variables, and update the old(er) vectors.
virtual TagID addVectorTag(const TagName &tag_name, const Moose::VectorTagType type=Moose::VECTOR_TAG_RESIDUAL)
Create a Tag.
TagID _xn_m2_tagid
Vector tag id for the solution variable two solves ago, as a main app.
TagID _fxn_m1_tagid
Vector tag id for the most recent solution variable, pre-Secant transform, as a main app...
std::vector< PostprocessorName > _secondary_transformed_pps
Postprocessors to be relaxed outside of fixed point iteration (used as a subapp)
virtual void transformPostprocessors(const bool primary) override final
Use the fixed point algorithm to transform the postprocessors.
auto max(const L &left, const R &right)
const std::vector< PostprocessorName > _transformed_pps
The postprocessors (transferred or not) that are going to be relaxed.
virtual void printFixedPointConvergenceHistory(Real initial_norm, const std::vector< Real > ×tep_begin_norms, const std::vector< Real > ×tep_end_norms) const override final
Print the convergence history of the coupling, at every fixed point iteration.
NumericVector< Number > & addVector(const std::string &vector_name, const bool project, const libMesh::ParallelType type)
Adds a solution length vector to the system.
void update()
Update the system (doing libMesh magic)
TagID _secondary_fxn_m1_tagid
Vector tag id for the most recent solution variable, pre-Secant transform, as a sub app...
const Real _relax_factor
Relaxation factor for fixed point Iteration.
virtual void transformVariables(const std::set< dof_id_type > &transformed_dofs, const bool primary) override final
Use the fixed point algorithm to transform the variables.
Executioners are objects that do the actual work of solving your problem.
Real _secondary_relaxation_factor
Relaxation factor outside of fixed point iteration (used as a subapp)
virtual void savePostprocessorValues(const bool primary) override final
Saves the current values of the postprocessors, and update the old(er) vectors.
std::string stringify(const T &t)
conversion to string
TagID _fxn_m2_tagid
Vector tag id for the result of the last but one solve, as a main app.
virtual const PostprocessorValue & getPostprocessorValueByName(const PostprocessorName &name) const
Retrieve the value of the Postprocessor.
unsigned int _fixed_point_it
TagID _xn_m1_tagid
Vector tag id for the solution variable before the latest solve, as a main app.
SystemBase & _solver_sys
Reference to a system for creating vectors as needed for the solve, etc.
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static std::string outputNorm(const Real &old_norm, const Real &norm, const unsigned int precision=6)
A helper function for outputting norms in color.
const TagID INVALID_TAG_ID
virtual void allocateStorage(const bool primary) override final
Allocate storage for the fixed point algorithm.
virtual bool useFixedPointAlgorithmUpdateInsteadOfPicard(const bool primary) override final
Use the fixed point algorithm transform instead of simply using the Picard update.
virtual void set(const numeric_index_type i, const Number value)=0
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
virtual NumericVector< Number > & getVector(const std::string &name)
Get a raw NumericVector by name.
SecantSolve(Executioner &ex)
unsigned int _main_fixed_point_it
fixed point iteration counter for the main app