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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 814 - (hide annotations)
Wed Aug 23 09:31:10 2006 UTC (13 years, 2 months ago) by gross
File MIME type: text/x-python
File size: 5087 byte(s)
small bug in general tensor propduct fixed
1 jgs 127 # $Id$
2    
3 elspeth 628 __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 jgs 149 from esys.escript.modelframe import Model,ParameterSet
10     from esys.escript.util import exp
11 jgs 147 import numarray
12 jgs 127
13 jgs 148 class GravityForce(ParameterSet):
14 jgs 149 """
15     Sets a gravity force of given direction in given domain:
16 jgs 127
17 gross 814 @ivar domain: domain of interest (in).
18     @type domain: L{esys.escript.Domain}
19     @ivar density: density, default 1 (in).
20     @ivar gravity: the gravity constant, default 9.81 (in).
21     @ivar direction: the direction of gravity, default [1.,0.,0.] (in).
22 jgs 147 """
23     def __init__(self,debug=False):
24 gross 814 """
25     initializes the set
26     """
27 jgs 148 ParameterSet.__init__(self,debug=debug)
28 jgs 147 self.declareParameter(domain=None,
29     gravity=9.81, \
30     density=1., \
31     direction=[1.,0.,0.])
32    
33     def gravity_force(self):
34 gross 814 """
35     return the gravity force as L{density}*L{gravity}*L{direction}
36     """
37     if isinstance(self.direction,list):
38 jgs 147 dir=numarray.array(self.direction[:self.domain.getDim()])
39 gross 814 else:
40 jgs 147 dir=self.direction[:self.domain.getDim()]
41 gross 814 return self.gravity*self.density*dir
42 jgs 147
43    
44    
45 jgs 148 class MaterialTable(ParameterSet):
46 jgs 149 """
47     A simple matrial table which allows setting physical ivar of a model
48 jgs 127
49 jgs 149 @ivar density (in/out): density
50     @ivar heat_capacity (in/out): heat_capacity
51     @ivar thermal_permabilty (in/out): permabilty
52     @ivar viscosity (in/out): viscosity
53     @ivar radiation_coefficient (in/out):
54 jgs 127 """
55     def __init__(self,debug=False):
56 jgs 148 ParameterSet.__init__(self,debug=debug)
57 jgs 147 self.declareParameter(gravity=9.81, \
58 jgs 127 density=1., \
59 jgs 147 heat_capacity=1., \
60 jgs 127 thermal_permabilty=1., \
61     radiation_coefficient=0.)
62    
63 jgs 148 class SimpleEarthModel(ParameterSet):
64 jgs 149 """
65     B simple matrial table run convection models::
66 jgs 147
67 gross 814 density=density0*(1-expansion_coefficient*(temperature-reference_temperature))
68 jgs 149 viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
69 jgs 147
70 jgs 149 @ivar gravity (in): gravity constants (9.81)
71     @ivar reference_temperature (in): reference temperature
72     @ivar density0 (in): density at reference temperature
73     @ivar viscosity0 (in): viscosity0 at reference temperature
74     @ivar alpha (in): viscosity contrast
75 gross 814 @ivar expansion_coefficient (in): Raleigh number
76 jgs 149 @ivar heat_capacity (in): heat capacity
77     @ivar thermal_permabilty (in): permabilty
78     @ivar temperature (in): temperature
79     @ivar viscosity (out): viscosity
80     @ivar density (out): density
81 jgs 147 """
82     def __init__(self,debug=False):
83 jgs 148 ParameterSet.__init__(self,debug=debug)
84 jgs 147 self.declareParameter(reference_temperature=1.,
85     gravity=9.81, \
86     density0=1., \
87 gross 814 expansion_coefficient=0., \
88 jgs 147 viscosity0=1., \
89     alpha=0., \
90     heat_capacity=1., \
91     thermal_permabilty=1.)
92    
93     def density(self):
94 gross 814 return self.density0*(1-self.expansion_coefficient*(self.temperature-self.reference_temperature))
95 jgs 147
96     def viscosity(self):
97     return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))
98    
99 jgs 127 class SimpleSolidMaterial(MaterialTable):
100 jgs 149 """
101     A simple matrial table which allows setting physical parameters of
102     a model.
103 jgs 127
104 jgs 149 @ivar density (in/out): density
105     @ivar heat_capacity (in/out): heat_capacity
106     @ivar thermal_permabilty (in/out): permabilty
107     @ivar viscosity (in/out): viscosity
108     @ivar radiation_coefficient (in/out):
109 jgs 127 """
110     def __init__(self,debug=False):
111     MaterialTable.__init__(self,debug=debug)
112     self.declareParameter(lame_lambda=1.,\
113     lame_my=1.)
114    
115     class SimpleFluidMaterial(MaterialTable):
116 jgs 149 """
117     A simple matrial table which allows setting physical ivar of a model.
118 jgs 127
119 jgs 149 @ivar density (in/out): density
120     @ivar heat_capacity (in/out): heat_capacity
121     @ivar thermal_permabilty (in/out): permabilty
122     @ivar viscosity (in/out): viscosity
123     @ivar radiation_coefficient (in/out):
124 jgs 127 """
125     def __init__(self,debug=False):
126     MaterialTable.__init__(self,debug=debug)
127     self.declareParameter(viscosity=1., \
128     hydraulic_conductivity=1.e-4)
129    
130 jgs 149 # vim: expandtab shiftwidth=4:

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26