/[escript]/trunk/modellib/py_src/temperature.py
ViewVC logotype

Annotation of /trunk/modellib/py_src/temperature.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 150 - (hide annotations)
Thu Sep 15 03:44:45 2005 UTC (15 years, 1 month ago) by jgs
Original Path: trunk/esys2/modellib/py_src/temperature.py
File MIME type: text/x-python
File size: 2715 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-15

1 jgs 127 # $Id$
2    
3 jgs 150 from esys.escript import *
4 jgs 149 from esys.escript.modelframe import Model,IterationDivergenceError
5     from esys.escript.linearPDEs import AdvectivePDE,LinearPDE
6 jgs 147 import numarray
7 jgs 127
8    
9 jgs 147 class TemperatureAdvection(Model):
10     """
11 jgs 127
12 jgs 149 The conservation of internal heat energy is given by
13 jgs 147
14 jgs 149 M{S{rho} c_p ( dT/dt+v[j]*grad(T)[j])-grad(\kappa grad(T)_{,i}=Q}
15 jgs 147
16 jgs 149 M{n_i\kappa T_{,i}=0}
17 jgs 147
18 jgs 149 it is assummed that M{\rho c_p} is constant in time.
19 jgs 147
20 jgs 149 solved by Taylor Galerkin method
21    
22 jgs 147 """
23 jgs 127 def __init__(self,debug=False):
24     Model.__init__(self,debug=debug)
25     self.declareParameter(domain=None, \
26     temperature=1., \
27 jgs 147 velocity=numarray.zeros([3]),
28 jgs 127 density=1., \
29 jgs 147 heat_capacity=1., \
30 jgs 127 thermal_permabilty=1., \
31 jgs 147 # reference_temperature=0., \
32     # radiation_coefficient=0., \
33 jgs 127 thermal_source=0., \
34 jgs 147 fixed_temperature=0.,
35     location_fixed_temperature=Data(),
36     safety_factor=0.1)
37 jgs 127
38 jgs 147 def doInitialization(self):
39     self.__pde=LinearPDE(self.domain)
40     self.__pde.setSymmetryOn()
41     # self.__pde.setReducedOrderOn()
42 jgs 150 self.__pde.setSolverMethod(self.__pde.LUMPING)
43 jgs 147 self.__pde.setValue(D=self.heat_capacity*self.density)
44 jgs 127
45     def getSafeTimeStepSize(self,dt):
46 jgs 149 """
47     returns new step size
48     """
49 jgs 147 h=self.domain.getSize()
50     return self.safety_factor*inf(h**2/(h*abs(self.heat_capacity*self.density)*length(self.velocity)+self.thermal_permabilty))
51 jgs 127
52 jgs 147 def G(self,T,alpha):
53 jgs 149 """
54     tangential operator for taylor galerikin
55     """
56 jgs 147 g=grad(T)
57     self.__pde.setValue(X=-self.thermal_permabilty*g, \
58     Y=self.thermal_source-self.__rhocp*inner(self.velocity,g), \
59     r=(self.__fixed_T-self.temperature)*alpha,\
60     q=self.location_fixed_temperature)
61     return self.__pde.getSolution()
62    
63 jgs 127
64 jgs 147 def doStepPostprocessing(self,dt):
65 jgs 149 """
66     perform taylor galerkin step
67     """
68 jgs 147 T=self.temperature
69     self.__rhocp=self.heat_capacity*self.density
70     self.__fixed_T=self.fixed_temperature
71     self.temperature=dt*self.G(dt/2*self.G(T,1./dt)+T,1./dt)+T
72     self.trace("Temperature range is %e %e"%(inf(self.temperature),sup(self.temperature)))

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26