newton(3rheolef)
π newton β the nonlinear solver glow-up (rheolef-7.2) π
okay bestie, we're in section 3rheolef of the rheolef manual and this one is literally the main character of nonlinear solving. sit down, grab a boba, let's go π§β¨
πΈ SYNOPSIS πΈ
template <class Problem, class Field>
int newton (const Problem& P, Field& uh, Float& tol, size_t& max_iter, odiststream *p_derr = 0)
that's the whole vibe right there. five things in, an int out, and yes there's a default arg at the end being all sneaky = 0 π«Ά
β¨ DESCRIPTION β¨
this function implements a generic Newton method for solving the problem:
F(u) = 0
like. that's it. that's the problem. we're finding the u that makes F vanish, no cap π
a simple call to the algorithm writes:
my_problem P;
field uh (Xh);
newton (P, uh, tol, max_iter);
look how clean that is. obsessed. π
your my_problem class should contain some methods for the evaluation of F, i.e. the residue of the problem, and its derivative. the minimal requirements are:
class my_problem {
public:
typedef value_type;
value_type residue (const value_type& uh) const;
void update_derivative (const value_type& uh) const;
value_type derivative_solve (const value_type& mrh) const;
Float dual_space_norm (const value_type& mrh) const;
};
that's the whole checklist bestie, don't skip a single one π
the value_type could be a field(2). and plot twist: the Newton method could also be applied when value_type is a simple Float scalar. conversely β yes, conversely, we love a transition word β it supports multi-field extensions. versatile icon behavior fr fr π
the update_derivative and derivative_solver members are called at each step of the Newton algorithm. every. single. step. π
the dual_space_norm member function returns a scalar from the weighted residual field term mrh returned by the residue function: this scalar is used as the stopping criterion of the algorithm. so like, that's the vibe check that tells us when to stop π
π EXAMPLE π
see the p_laplacian_newton.cc example and the usersguide for more. go look, it's giving tutorial energy πβ¨
π§ IMPLEMENTATION π§
this documentation has been generated from file main/lib/newton.h
like, it was born there. that's its origin story π±
π AUTHOR π
Pierre Saramito <Pierre.Saramito@imag.fr>
π COPYRIGHT π
Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr>
GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. (yes that's dramatic and yes it means it. no take-backsies π)
and that's the whole page bestie!! this was rheolef Version 7.2, newton(3rheolef), and honestly? iconic. go solve something nonlinear, you absolute legend π¦π
π¦ where this page comes from
- debian trixie: librheolef-dev 7.2-4 Β· GPL-3.0-or-later
- ubuntu noble: librheolef-dev 7.2-3build5 Β· GPL-3.0-or-later
- ubuntu questing: librheolef-dev 7.2-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms