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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2061 - (show annotations)
Wed Nov 19 03:40:21 2008 UTC (11 years, 11 months ago) by jfenwick
File MIME type: text/x-python
File size: 5627 byte(s)
Fixing some warnings from epydoc.
Disabled c++ signatures in python docstrings.
Removed references to Bruce in epydoc and the users guide.
1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 from esys.escript.modelframe import Model,ParameterSet
23 from esys.escript.util import exp
24 import numarray
25
26 class GravityForce(ParameterSet):
27 """
28 Sets a gravity force of given direction in given domain:
29
30 @ivar domain: domain of interest (in).
31 @type domain: L{esys.escript.Domain}
32 @ivar density: density, default 1 (in).
33 @ivar gravity: the gravity constant, default 9.81 (in).
34 @ivar direction: the direction of gravity, default [1.,0.,0.] (in).
35 """
36 def __init__(self,**kwargs):
37 """
38 initializes the set
39 """
40 super(GravityForce, self).__init__(**kwargs)
41 self.declareParameter(domain=None,
42 gravity=9.81, \
43 density=1., \
44 direction=[1.,0.,0.])
45
46 def gravity_force(self):
47 """
48 return the gravity force as L{density}*L{gravity}*L{direction}
49 """
50 if isinstance(self.direction,list):
51 dir=numarray.array(self.direction[:self.domain.getDim()])
52 else:
53 dir=self.direction[:self.domain.getDim()]
54 return self.gravity*self.density*dir
55
56
57
58 class MaterialTable(ParameterSet):
59 """
60 A simple matrial table which allows setting physical ivar of a model
61
62 @ivar density: density(in/out)
63 @ivar heat_capacity: heat_capacity(in/out)
64 @ivar thermal_permabilty: permabilty(in/out)
65 @ivar viscosity: viscosity(in/out)
66 @ivar radiation_coefficient: (in/out)
67 """
68 def __init__(self,**kwargs):
69 super(MaterialTable, self).__init__(**kwargs)
70 self.declareParameter(gravity=9.81, \
71 density=1., \
72 heat_capacity=1., \
73 thermal_permabilty=1., \
74 radiation_coefficient=0.)
75
76 class SimpleEarthModel(ParameterSet):
77 """
78 A simple matrial table run convection models::
79
80 density=density0*(1-expansion_coefficient*(temperature-reference_temperature))
81 viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
82
83 @ivar gravity: gravity constants (9.81) (in)
84 @ivar reference_temperature: reference temperature (in)
85 @ivar density0: density at reference temperature (in)
86 @ivar viscosity0: viscosity0 at reference temperature (in)
87 @ivar alpha: viscosity contrast (in)
88 @ivar expansion_coefficient: Raleigh number (in)
89 @ivar heat_capacity: heat capacity (in)
90 @ivar thermal_permabilty: permabilty (in)
91 @ivar temperature: temperature (in)
92 @ivar viscosity: viscosity (out)
93 @ivar density: density (out)
94 """
95 def __init__(self,**kwargs):
96 super(SimpleEarthModel, self).__init__(**kwargs)
97 self.declareParameter(reference_temperature=1.,
98 gravity=9.81, \
99 density0=1., \
100 expansion_coefficient=0., \
101 viscosity0=1., \
102 alpha=0., \
103 temperature=0.,\
104 heat_capacity=1., \
105 thermal_permabilty=1.)
106
107 def density(self):
108 return self.density0*(1-self.expansion_coefficient*(self.temperature-self.reference_temperature))
109
110 def viscosity(self):
111 return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))
112
113 class SimpleSolidMaterial(MaterialTable):
114 """
115 A simple matrial table which allows setting physical parameters of
116 a model.
117
118 @ivar density: density (in/out)
119 @ivar heat_capacity: heat_capacity (in/out)
120 @ivar thermal_permabilty: permabilty (in/out)
121 @ivar viscosity: viscosity (in/out)
122 @ivar radiation_coefficient: (in/out)
123 """
124 def __init__(self,**kwargs):
125 super(MaterialTable, self).__init__(**kwargs)
126 self.declareParameter(lame_lambda=1.,\
127 lame_my=1.)
128
129 class SimpleFluidMaterial(MaterialTable):
130 """
131 A simple matrial table which allows setting physical ivar of a model.
132
133 @ivar density: density(in/out)
134 @ivar heat_capacity: heat_capacity(in/out)
135 @ivar thermal_permabilty: permabilty (in/out)
136 @ivar viscosity: viscosity (in/out)
137 @ivar radiation_coefficient:(in/out)
138 """
139 def __init__(self,**kwargs):
140 super(MaterialTable, self).__init__(**kwargs)
141 self.declareParameter(viscosity=1., \
142 hydraulic_conductivity=1.e-4)
143
144 # 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