Poster of Linux kernelThe best gift for a Linux geek
Nonlinear

Nonlinear

Section: C Library Functions (3) Updated: Thu Apr 7 2011
Local index Up
 

NAME

Nonlinear -  

SYNOPSIS


#include <nonlinear.h>  

Public Member Functions


Nonlinear (EquationSystems &es)

Nonlinear (EquationSystems &es, const std::string &name, const unsigned int number)

~Nonlinear ()

virtual void solve ()

unsigned int max_nonlinear_steps () const

unsigned int & max_nonlinear_steps ()

Real nonlinear_tolerance () const

Real & nonlinear_tolerance ()
 

Private Attributes


unsigned int _max_nl_steps

Real _nl_tol
 

Detailed Description

 

template<class T = Linear<>> class Nonlinear< T >

This is a generic class that defines a nonlinear to be used in a simulation. A user can define a nonlinear by deriving from this class and implementing certain functions.

Author:

Benjamin S. Kirk, 2003-2004.

Definition at line 44 of file nonlinear.h.  

Constructor & Destructor Documentation

 

template<class T > Nonlinear< T >::Nonlinear (EquationSystems &es) [inline]Constructor. Requires a reference to a system to be solved.

Definition at line 111 of file nonlinear.h.

                                            :
  T             (es),  // Call the base class constructor
  _max_nl_steps (5),   // Default solver attributes
  _nl_tol       (1.e-6)
{
}
 

template<class T > Nonlinear< T >::Nonlinear (EquationSystems &es, const std::string &name, const unsigned intnumber) [inline]Constructor. Requires a referece to the EquationSystems object.

Definition at line 122 of file nonlinear.h.

                                                    :
  Nonlinear (es),
  T         (es, name, number)  // Call the base class constructor
{
}
 

template<class T > Nonlinear< T >::~Nonlinear () [inline]Destructor.

Definition at line 134 of file nonlinear.h.

{
}
 

Member Function Documentation

 

template<class T = Linear<>> unsigned int Nonlinear< T >::max_nonlinear_steps () const [inline]Returns:

the maximum number of nonlinear steps to take.

Definition at line 74 of file nonlinear.h.

References Nonlinear< T >::_max_nl_steps.

{ return _max_nl_steps; }
 

template<class T = Linear<>> unsigned int& Nonlinear< T >::max_nonlinear_steps () [inline]Sets the maximum number of nonlinear steps to take.

Definition at line 79 of file nonlinear.h.

References Nonlinear< T >::_max_nl_steps.

{ return _max_nl_steps; }
 

template<class T = Linear<>> Real Nonlinear< T >::nonlinear_tolerance () const [inline]Returns:

the nonlinear solver tolerance.

Definition at line 84 of file nonlinear.h.

References Nonlinear< T >::_nl_tol.

{ return _nl_tol; }
 

template<class T = Linear<>> Real& Nonlinear< T >::nonlinear_tolerance () [inline]Sets the nonlinear solver tolerance.

Definition at line 89 of file nonlinear.h.

References Nonlinear< T >::_nl_tol.

{ return _nl_tol; }
 

template<class T > void Nonlinear< T >::solve () [inline, virtual]Re-implement the solve member to do a fixed number of linear solves

Definition at line 142 of file nonlinear.h.

{
  for (unsigned int l=0; l<this->max_nonlinear_steps(); l++)
    {
      // Get a copy of the solution at the current nonlinear
      // iteration
      AutoPtr<NumericVector<Number> >
        last_nonlinear_soln (this->system().solution->clone());
      
      // Call the base class solver
      T::solve ();

      // Compute the difference between this solution
      // and the last iterate
      last_nonlinear_soln->add (-1., *(this->system().solution));

      // We must close the vector before we ask it for its norm
      last_nonlinear_soln->close();
      
      // Compute the l2 norm of the difference
      const Real norm_delta = last_nonlinear_soln->l2_norm();

      // Print out convergence information
      std::cout << 'Nonlinear convergence: ||u - u_old|| = '
                << norm_delta
                << std::endl;

      // Terminate the solution iteration if the difference between
      // this iteration and the last is sufficiently small.
      if (norm_delta < this->nonlinear_tolerance())
        {
          std::cout << ' Nonlinear solver converged at step '
                    << l
                    << std::endl;
          break;
        }
    }
}
 

Member Data Documentation

 

template<class T = Linear<>> unsigned int Nonlinear< T >::_max_nl_steps [private]The maximum number of nonlinear steps to take.

Definition at line 97 of file nonlinear.h.

Referenced by Nonlinear< T >::max_nonlinear_steps().  

template<class T = Linear<>> Real Nonlinear< T >::_nl_tol [private]The nonlinear solver tolerance.

Definition at line 102 of file nonlinear.h.

Referenced by Nonlinear< T >::nonlinear_tolerance().

 

Author

Generated automatically by Doxygen for libMesh from the source code.


 

Index

NAME
SYNOPSIS
Public Member Functions
Private Attributes
Detailed Description
template<class T = Linear<>> class Nonlinear< T >
Constructor & Destructor Documentation
template<class T > Nonlinear< T >::Nonlinear (EquationSystems &es) [inline]Constructor. Requires a reference to a system to be solved.
template<class T > Nonlinear< T >::Nonlinear (EquationSystems &es, const std::string &name, const unsigned intnumber) [inline]Constructor. Requires a referece to the EquationSystems object.
template<class T > Nonlinear< T >::~Nonlinear () [inline]Destructor.
Member Function Documentation
template<class T = Linear<>> unsigned int Nonlinear< T >::max_nonlinear_steps () const [inline]Returns:
template<class T = Linear<>> unsigned int& Nonlinear< T >::max_nonlinear_steps () [inline]Sets the maximum number of nonlinear steps to take.
template<class T = Linear<>> Real Nonlinear< T >::nonlinear_tolerance () const [inline]Returns:
template<class T = Linear<>> Real& Nonlinear< T >::nonlinear_tolerance () [inline]Sets the nonlinear solver tolerance.
template<class T > void Nonlinear< T >::solve () [inline, virtual]Re-implement the solve member to do a fixed number of linear solves
Member Data Documentation
template<class T = Linear<>> unsigned int Nonlinear< T >::_max_nl_steps [private]The maximum number of nonlinear steps to take.
template<class T = Linear<>> Real Nonlinear< T >::_nl_tol [private]The nonlinear solver tolerance.
Author

This document was created by man2html, using the manual pages.
Time: 21:51:27 GMT, April 16, 2011