/[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 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 9 months ago) by ksteube
File MIME type: text/x-python
File size: 3426 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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