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

revision 1417 by gross, Mon Feb 25 04:45:48 2008 UTC revision 2158 by caltinay, Mon Dec 15 07:17:47 2008 UTC
# Line 1  Line 1
1  # \$Id:\$
2  #  ########################################################
#######################################################
#
#       Copyright 2008 by University of Queensland
3  #  #
4  #                http://esscc.uq.edu.au  # Copyright (c) 2003-2008 by University of Queensland
5  #        Primary Business: Queensland, Australia  # Earth Systems Science Computational Center (ESSCC)
6  #  Licensed under the Open Software License version 3.0  # http://www.uq.edu.au/esscc
7  #  #
8  #######################################################  # Primary Business: Queensland, Australia
11  #  #
12    ########################################################
13
15    Earth Systems Science Computational Center (ESSCC)
16    http://www.uq.edu.au/esscc
20    __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22  """  """
# Line 24  Some models for heat advection-diffusion Line 31  Some models for heat advection-diffusion
31  """  """
32
33  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
http://www.access.edu.au
__url__="http://www.iservo.edu.au/esys"
__version__="\$Revision:\$"
__date__="\$Date:\$"
34
35  # from escript import *  # from escript import *
36  import util  import util
# Line 39  from linearPDEs import TransportPDE Line 38  from linearPDEs import TransportPDE
38
39  class TemperatureCartesian(TransportPDE):  class TemperatureCartesian(TransportPDE):
40        """        """
41        solves        solves
42
43            rhocp(T_{,t} + v_i T_{,i} - ( k T_{,i})_i = Q            rhocp(T_{,t} + v_i T_{,i} - ( k T_{,i})_i = Q
44
45                   k T_{,i}*n_i=surface_flux                   k T_{,i}*n_i=surface_flux
46
48
49        if surface_flux is not give 0 is assumed.        if surface_flux is not given 0 is assumed.
50
51        typical usage:        typical usage:
52
# Line 64  class TemperatureCartesian(TransportPDE) Line 63  class TemperatureCartesian(TransportPDE)
63        """        """
64        def __init__(self,domain,theta=0.5,**kwargs):        def __init__(self,domain,theta=0.5,**kwargs):
65          """          """
67
68          @param domain: domain of the problem          @param domain: domain of the problem
69          @param theta: method control: theta=1. backward Euler          @param theta: method control: theta=1. backward Euler
70                                        theta=0.5: Crank-Nicholson scheme                                        theta=0.5: Crank-Nicholson scheme
71                                        thete=0.: forward Euler (not recommendable)                                        theta=0.: forward Euler (not recommendable)
72          """          """
73          TransportPDE.__init__(self,domain,num_equations=1,theta=theta,**kwargs)          TransportPDE.__init__(self,domain,numEquations=1,theta=theta,**kwargs)
74          self.setReducedOn()          self.setReducedOrderOn()
75          self.__rhocp=None          self.__rhocp=None
76          self.__v=None          self.__v=None
77
78        def setInitialTemperature(self,T):        def setInitialTemperature(self,T):
79          self.setInitialSolution(T)          self.setInitialSolution(T)
80
82             if rhocp!=None:             if rhocp!=None:
83                 self.__rhocp=rhocp                 self.__rhocp=rhocp
# Line 94  class TemperatureCartesian(TransportPDE) Line 95  class TemperatureCartesian(TransportPDE)
95                 super(TemperatureCartesian,self).setValue(y=surface_flux)                 super(TemperatureCartesian,self).setValue(y=surface_flux)