/[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 628 - (hide annotations)
Thu Mar 23 02:27:57 2006 UTC (14 years, 7 months ago) by elspeth
File MIME type: text/x-python
File size: 4790 byte(s)
Copyright information added.

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