~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/kernel/ode/FixedPointIteration.cpp

  • Committer: logg
  • Date: 2004-02-17 20:06:10 UTC
  • Revision ID: devnull@localhost-20040217200610-sbq402hgv8iasnkk
Tailorized "2004-02-17 14:06:09 by logg"
Improve adaptive damping, make stiff test problems work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
  // FIXME: Convergence should be determined by the error control
34
34
  tol = dolfin_get("tolerance");
35
 
  tol *= 0.1;
 
35
  tol *= 0.01;
 
36
 
 
37
  cout << "Fixed point tolerance: " << tol << endl;
36
38
 
37
39
  // Choose initial stiffness
38
40
  std::string stiffness = dolfin_get("stiffness");
101
103
      
102
104
      // Write debug info
103
105
      if ( debug_iter )
104
 
        debug(list, d);
 
106
        debug(list, d, n);
105
107
 
106
108
      // Update group list
107
109
      update(list, d);
133
135
      // Check convergence
134
136
      if ( converged(group, d, n) )
135
137
      {
136
 
        cout << "Converged after " << n << " iterations" << endl;
137
138
        end(group);
138
139
        return d.dtot;
139
140
      }
152
153
 
153
154
      // Write debug info
154
155
      if ( debug_iter )
155
 
        debug(group, d);
 
156
        debug(group, d, n);
156
157
 
157
158
      // Update element group
158
159
      update(group, d);
199
200
 
200
201
      // Write debug info
201
202
      if ( debug_iter )
202
 
        debug(element, d);
 
203
        debug(element, d, n);
203
204
      
204
205
      // Update element
205
206
      update(element, d);
432
433
}
433
434
//-----------------------------------------------------------------------------
434
435
void FixedPointIteration::debug(ElementGroupList& list,
435
 
                                const Iteration::Increments& d)
 
436
                                const Iteration::Increments& d,
 
437
                                unsigned int n)
436
438
{
437
439
  // Don't write debug info if iteration wasn't accepted
438
440
  if ( !state->accept() )
439
441
    return;
440
442
 
 
443
  // Don't write debug info before the first iteration
 
444
  if ( n == 0 )
 
445
    return;
 
446
 
441
447
  real r = 0.0;
442
448
  real alpha = 0.0;
443
449
  unsigned int m = 0;
454
460
}
455
461
//-----------------------------------------------------------------------------
456
462
void FixedPointIteration::debug(ElementGroup& group,
457
 
                                const Iteration::Increments& d)
 
463
                                const Iteration::Increments& d,
 
464
                                unsigned int n)
458
465
{
459
466
  // Don't write debug info if iteration wasn't accepted
460
467
  if ( !state->accept() )
461
468
    return;
462
469
 
 
470
  // Don't write debug info before the first iteration
 
471
  if ( n == 0 )
 
472
    return;
463
473
 
464
474
  real r = 0.0;
465
475
  real alpha = 0.0;
477
487
}
478
488
//-----------------------------------------------------------------------------
479
489
void FixedPointIteration::debug(Element& element,
480
 
                                const Iteration::Increments& d)
 
490
                                const Iteration::Increments& d,
 
491
                                unsigned int n)
481
492
{
482
493
  // Don't write debug info if iteration wasn't accepted
483
494
  if ( !state->accept() )
484
495
    return;
485
496
 
 
497
  // Don't write debug info before the first iteration
 
498
  if ( n == 0 )
 
499
    return;
 
500
 
486
501
  real r = 0.0;
487
502
  real alpha = 0.0;
488
503
  unsigned int m = 0;