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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 628 - (show annotations)
Thu Mar 23 02:27:57 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/x-python
File size: 3002 byte(s)
Copyright information added.

1 # $Id$
2
3 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
4 http://www.access.edu.au
5 Primary Business: Queensland, Australia"""
6 __license__="""Licensed under the Open Software License version 3.0
7 http://www.opensource.org/licenses/osl-3.0.php"""
8
9 from esys.escript import *
10 from esys.escript.modelframe import Model,IterationDivergenceError
11 from esys.escript.linearPDEs import AdvectivePDE,LinearPDE
12 import numarray
13
14
15 class TemperatureAdvection(Model):
16 """
17
18 The conservation of internal heat energy is given by
19
20 M{S{rho} c_p ( dT/dt+v[j]*grad(T)[j])-grad(\kappa grad(T)_{,i}=Q}
21
22 M{n_i\kappa T_{,i}=0}
23
24 it is assummed that M{\rho c_p} is constant in time.
25
26 solved by Taylor Galerkin method
27
28 """
29 def __init__(self,debug=False):
30 Model.__init__(self,debug=debug)
31 self.declareParameter(domain=None, \
32 temperature=1., \
33 velocity=numarray.zeros([3]),
34 density=1., \
35 heat_capacity=1., \
36 thermal_permabilty=1., \
37 # reference_temperature=0., \
38 # radiation_coefficient=0., \
39 thermal_source=0., \
40 fixed_temperature=0.,
41 location_fixed_temperature=Data(),
42 safety_factor=0.1)
43
44 def doInitialization(self):
45 self.__pde=LinearPDE(self.domain)
46 self.__pde.setSymmetryOn()
47 self.__pde.setReducedOrderOn()
48 self.__pde.setSolverMethod(self.__pde.LUMPING)
49 self.__pde.setValue(D=self.heat_capacity*self.density)
50
51 def getSafeTimeStepSize(self,dt):
52 """
53 returns new step size
54 """
55 h=self.domain.getSize()
56 return self.safety_factor*inf(h**2/(h*abs(self.heat_capacity*self.density)*length(self.velocity)+self.thermal_permabilty))
57
58 def G(self,T,alpha):
59 """
60 tangential operator for taylor galerikin
61 """
62 g=grad(T)
63 self.__pde.setValue(X=-self.thermal_permabilty*g, \
64 Y=self.thermal_source-self.__rhocp*inner(self.velocity,g), \
65 r=(self.__fixed_T-self.temperature)*alpha,\
66 q=self.location_fixed_temperature)
67 return self.__pde.getSolution()
68
69
70 def doStepPostprocessing(self,dt):
71 """
72 perform taylor galerkin step
73 """
74 T=self.temperature
75 self.__rhocp=self.heat_capacity*self.density
76 self.__fixed_T=self.fixed_temperature
77 self.temperature=dt*self.G(dt/2*self.G(T,1./dt)+T,1./dt)+T
78 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