/[escript]/trunk/escript/py_src/heat.py
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2169 - (hide annotations)
Wed Dec 17 03:08:58 2008 UTC (10 years, 10 months ago) by caltinay
File MIME type: text/x-python
File size: 3436 byte(s)
Assorted spelling, grammar, whitespace and copy/paste error fixes (Part 2).
All epydoc warnings for these files have been fixed.
This commit should be a no-op.

1 ksteube 1809
2     ########################################################
3 gross 1417 #
4 ksteube 1809 # Copyright (c) 2003-2008 by University of Queensland
5     # Earth Systems Science Computational Center (ESSCC)
6     # http://www.uq.edu.au/esscc
7 gross 1417 #
8 ksteube 1809 # Primary Business: Queensland, Australia
9     # Licensed under the Open Software License version 3.0
10     # http://www.opensource.org/licenses/osl-3.0.php
11 gross 1417 #
12 ksteube 1809 ########################################################
13 gross 1417
14 ksteube 1809 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15     Earth Systems Science Computational Center (ESSCC)
16     http://www.uq.edu.au/esscc
17     Primary Business: Queensland, Australia"""
18     __license__="""Licensed under the Open Software License version 3.0
19     http://www.opensource.org/licenses/osl-3.0.php"""
20     __url__="http://www.uq.edu.au/esscc/escript-finley"
21    
22 gross 1417 """
23     Some models for heat advection-diffusion
24    
25     @var __author__: name of author
26     @var __copyright__: copyrights
27     @var __license__: licence agreement
28     @var __url__: url entry point on documentation
29     @var __version__: version
30     @var __date__: date of the version
31     """
32    
33     __author__="Lutz Gross, l.gross@uq.edu.au"
34    
35     # from escript import *
36     import util
37     from linearPDEs import TransportPDE
38    
39     class TemperatureCartesian(TransportPDE):
40 caltinay 2169 """
41     Represents and solves the temperature advection-diffusion problem
42 gross 1417
43 caltinay 2169 M{rhocp(T_{,t} + v_i T_{,i} - ( k T_{,i})_i = Q}
44 caltinay 2158
45 caltinay 2169 M{k T_{,i}*n_i=surface_flux} and M{T_{,t} = 0} where C{given_T_mask}>0.
46 caltinay 2158
47 caltinay 2169 If surface_flux is not given 0 is assumed.
48 gross 1417
49 caltinay 2169 Typical usage::
50 gross 1417
51 caltinay 2169 sp = TemperatureCartesian(domain)
52     sp.setTolerance(1.e-4)
53     t = 0
54     T = ...
55     sp.setValues(rhocp=..., v=..., k=..., given_T_mask=...)
56     sp.setInitialTemperature(T)
57     while t < t_end:
58     sp.setValue(Q=...)
59     T = sp.getTemperature(dt)
60     t += dt
61     """
62     def __init__(self,domain,theta=0.5,**kwargs):
63 gross 1417 """
64 caltinay 2169 Initializes the temperature advection-diffusion problem.
65 gross 1417
66     @param domain: domain of the problem
67 caltinay 2169 @param theta: method control:
68     - theta=1.0: backward Euler
69     - theta=0.5: Crank-Nicholson scheme
70     - theta=0.0: forward Euler (not recommended)
71 gross 1417 """
72 ksteube 1874 TransportPDE.__init__(self,domain,numEquations=1,theta=theta,**kwargs)
73 gross 1841 self.setReducedOrderOn()
74 gross 1417 self.__rhocp=None
75     self.__v=None
76 caltinay 2158
77 caltinay 2169 def setInitialTemperature(self,T):
78     """
79     Same as L{setInitialSolution}.
80     """
81 gross 1417 self.setInitialSolution(T)
82 caltinay 2158
83 caltinay 2169 def setValue(self,rhocp=None,v=None,k=None,Q=None,surface_flux=None,given_T_mask=None):
84     if rhocp!=None:
85     self.__rhocp=rhocp
86     if v!=None:
87     self.__v=v
88     if rhocp!=None:
89     super(TemperatureCartesian,self).setValue(M=self.__rhocp)
90     if (rhocp!=None or v!=None) and self.__rhocp!=None and self.__v!=None:
91     super(TemperatureCartesian,self).setValue(C=-self.__rhocp*self.__v)
92     if k!=None:
93     super(TemperatureCartesian,self).setValue(A=-k*util.kronecker(self.getDomain()))
94     if Q!=None:
95     super(TemperatureCartesian,self).setValue(Y=Q)
96     if surface_flux!=None:
97     super(TemperatureCartesian,self).setValue(y=surface_flux)
98     if given_T_mask!=None:
99     super(TemperatureCartesian,self).setValue(q=given_T_mask)
100 caltinay 2158
101 caltinay 2169 def getTemperature(self,dt,**kwargs):
102     """
103     Same as L{getSolution}.
104     """
105     return self.getSolution(dt,**kwargs)
106 caltinay 2158

  ViewVC Help
Powered by ViewVC 1.1.26