 # Diff of /trunk/escript/py_src/heat.py

revision 3792 by jfenwick, Wed Jan 18 02:30:48 2012 UTC revision 3793 by gross, Wed Feb 1 07:39:43 2012 UTC
# Line 60  class TemperatureCartesian(TransportPDE) Line 60  class TemperatureCartesian(TransportPDE)
60              T = sp.getTemperature(dt)              T = sp.getTemperature(dt)
61              t += dt              t += dt
62      """      """
63      def __init__(self,domain,useBackwardEuler=False,**kwargs):      def __init__(self,domain,**kwargs):
64          """          """
65          Initializes the temperature advection-diffusion problem.          Initializes the temperature advection-diffusion problem.
66
67          :param domain: domain of the problem          :param domain: domain of the problem
:param useBackwardEuler: if set the backward Euler scheme is used. Otherwise the Crank-Nicholson scheme is applied. Not that backward Euler scheme will return a safe time step size which is practically infinity as the scheme is unconditional unstable. So other measures need to be applied to control the time step size. The Crank-Nicholson scheme provides a higher accuracy but requires to limit the time step size to be stable.
:type useBackwardEuler: ``bool``
68          :note: the approximation order is switched to reduced if the approximation order is nnot linear (equal to 1).          :note: the approximation order is switched to reduced if the approximation order is nnot linear (equal to 1).
69          """          """
70          TransportPDE.__init__(self,domain,numEquations=1,useBackwardEuler=useBackwardEuler,**kwargs)          TransportPDE.__init__(self,domain,numEquations=1, **kwargs)
71          order=escript.Solution(domain).getApproximationOrder()          order=escript.Solution(domain).getApproximationOrder()
72          if order>1:          if order>1:
73              if escript.ReducedSolution(domain).getApproximationOrder()>1: raise ValueError("Reduced order needs to be equal to 1.")              if escript.ReducedSolution(domain).getApproximationOrder()>1: raise ValueError("Reduced order needs to be equal to 1.")

Legend:
 Removed from v.3792 changed lines Added in v.3793

 ViewVC Help Powered by ViewVC 1.1.26