1 function [x, defect, niterations] = fixed_point_algorithm(A, f, eval_nonlin, tol, maxiter, damping, verbose)
2 %
function [x, defect, niterations] = fixed_point_algorithm(A, f, eval_nonlin, tol, maxiter, damping, verbose)
5 % rbhdd_detailed_simulation
6 % A can be an LUPQ_Handle holding the l-u-p-q-factors
if model is linear
10 has_nonlinearity = ~isempty(eval_nonlin);
12 start_iteration = tic;
13 x = zeros(length(f), 1);
20 if nargin < 6 || isempty(damping)
23 if nargin < 5 || isempty(maxiter)
26 if nargin < 4 || isempty(tol)
30 if has_nonlinearity && verbose
31 disp('start fixed point iteration');
38 while norm(defect) > tol
40 x = x + damping * (A \ defect);
43 A = A_lin + eval_nonlin(x);
48 niterations = niterations + 1;
51 if niterations >= maxiter
52 warning(['iteration maximum in fixed point iteration, norm(defect): ', ...
53 num2str(norm(defect))])
57 if norm(defect) > 1e12
58 warning('fixed point iteration diverged!')
63 disp([num2str(niterations), ': norm(defect) = ', num2str(norm(defect))]);
70 if has_nonlinearity && verbose
72 disp(['terminate fixed point iteration after ', num2str(toc(start_iteration)), ...
function sim_data = stokes_detailed_simulation(model, model_data)
Performs a detailed simulation of a (Navier-)stokes problem.