/[escript]/trunk/esys2/modellib/py_src/materials.py
ViewVC logotype

Annotation of /trunk/esys2/modellib/py_src/materials.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 147 - (hide annotations)
Fri Aug 12 01:45:47 2005 UTC (15 years, 2 months ago) by jgs
File MIME type: text/x-python
File size: 4697 byte(s)
erge of development branch dev-02 back to main trunk on 2005-08-12

1 jgs 127 # $Id$
2    
3 jgs 147 from escript.modelframe import Model
4     from escript.util import exp
5     import numarray
6 jgs 127
7 jgs 147 class GravityForce(Model):
8     """@brief sets a gravity force of given direction in given domain:
9 jgs 127
10 jgs 147 @param domain (in) - domain of interest
11     @param density (in) - density
12     @param direction (in) - density
13     @param gravity_force(out) - gravity force
14    
15     """
16     def __init__(self,debug=False):
17     Model.__init__(self,debug=debug)
18     self.declareParameter(domain=None,
19     gravity=9.81, \
20     density=1., \
21     direction=[1.,0.,0.])
22    
23     def gravity_force(self):
24     if isinstance(self.direction,list):
25     dir=numarray.array(self.direction[:self.domain.getDim()])
26     else:
27     dir=self.direction[:self.domain.getDim()]
28     return self.gravity*self.density*dir
29    
30    
31    
32 jgs 127 class MaterialTable(Model):
33     """@brief a simple matrial table which allows setting physical parameters of a model
34    
35     @param density (in/out) - density
36 jgs 147 @param heat_capacity (in/out) - heat_capacity
37 jgs 127 @param thermal_permabilty (in/out) - permabilty
38     @param viscosity (in/out) - viscosity
39     @param radiation_coefficient (in/out) -
40    
41     """
42     def __init__(self,debug=False):
43     Model.__init__(self,debug=debug)
44 jgs 147 self.declareParameter(gravity=9.81, \
45 jgs 127 density=1., \
46 jgs 147 heat_capacity=1., \
47 jgs 127 thermal_permabilty=1., \
48     radiation_coefficient=0.)
49    
50 jgs 147 class SimpleEarthModel(Model):
51     """@brief a simple matrial table run convection models:
52    
53     density=density0*(1-rayleigh_number*(temperature-reference_temperature))
54     viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
55    
56     @param gravity (in) - gravity constants (9.81)
57     @param reference_temperature (in) - reference temperature
58     @param density0 (in) - density at reference temperature
59     @param viscosity0 (in) - viscosity0 at reference temperature
60     @param alpha (in) - viscosity contrast
61     @param rayleigh_number (in) - Raleigh number
62     @param heat_capacity (in) - heat capacity
63     @param thermal_permabilty (in) - permabilty
64     @param temperature (in) - temperature
65     @param viscosity (out) - viscosity
66     @param density (out) - density
67    
68     """
69     def __init__(self,debug=False):
70     Model.__init__(self,debug=debug)
71     self.declareParameter(reference_temperature=1.,
72     gravity=9.81, \
73     density0=1., \
74     rayleigh_number=0., \
75     viscosity0=1., \
76     alpha=0., \
77     heat_capacity=1., \
78     thermal_permabilty=1.)
79    
80     def density(self):
81     return self.density0*(1-self.rayleigh_number*(self.temperature-self.reference_temperature))
82    
83     def viscosity(self):
84     return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))
85    
86 jgs 127 class SimpleSolidMaterial(MaterialTable):
87     """@brief a simple matrial table which allows setting physical parameters of a model
88    
89     @param density (in/out) - density
90 jgs 147 @param heat_capacity (in/out) - heat_capacity
91 jgs 127 @param thermal_permabilty (in/out) - permabilty
92     @param viscosity (in/out) - viscosity
93     @param radiation_coefficient (in/out) -
94    
95     """
96     def __init__(self,debug=False):
97     MaterialTable.__init__(self,debug=debug)
98     self.declareParameter(lame_lambda=1.,\
99     lame_my=1.)
100    
101     class SimpleFluidMaterial(MaterialTable):
102     """@brief a simple matrial table which allows setting physical parameters of a model
103    
104     @param density (in/out) - density
105 jgs 147 @param heat_capacity (in/out) - heat_capacity
106 jgs 127 @param thermal_permabilty (in/out) - permabilty
107     @param viscosity (in/out) - viscosity
108     @param radiation_coefficient (in/out) -
109    
110     """
111     def __init__(self,debug=False):
112     MaterialTable.__init__(self,debug=debug)
113     self.declareParameter(viscosity=1., \
114     hydraulic_conductivity=1.e-4)
115    

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26