/[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 814 - (show annotations)
Wed Aug 23 09:31:10 2006 UTC (13 years, 1 month ago) by gross
File MIME type: text/x-python
File size: 5087 byte(s)
small bug in general tensor propduct fixed
1 # $Id$
2
3 __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 from esys.escript.modelframe import Model,ParameterSet
10 from esys.escript.util import exp
11 import numarray
12
13 class GravityForce(ParameterSet):
14 """
15 Sets a gravity force of given direction in given domain:
16
17 @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 """
23 def __init__(self,debug=False):
24 """
25 initializes the set
26 """
27 ParameterSet.__init__(self,debug=debug)
28 self.declareParameter(domain=None,
29 gravity=9.81, \
30 density=1., \
31 direction=[1.,0.,0.])
32
33 def gravity_force(self):
34 """
35 return the gravity force as L{density}*L{gravity}*L{direction}
36 """
37 if isinstance(self.direction,list):
38 dir=numarray.array(self.direction[:self.domain.getDim()])
39 else:
40 dir=self.direction[:self.domain.getDim()]
41 return self.gravity*self.density*dir
42
43
44
45 class MaterialTable(ParameterSet):
46 """
47 A simple matrial table which allows setting physical ivar of a model
48
49 @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 """
55 def __init__(self,debug=False):
56 ParameterSet.__init__(self,debug=debug)
57 self.declareParameter(gravity=9.81, \
58 density=1., \
59 heat_capacity=1., \
60 thermal_permabilty=1., \
61 radiation_coefficient=0.)
62
63 class SimpleEarthModel(ParameterSet):
64 """
65 B simple matrial table run convection models::
66
67 density=density0*(1-expansion_coefficient*(temperature-reference_temperature))
68 viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
69
70 @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 @ivar expansion_coefficient (in): Raleigh number
76 @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 """
82 def __init__(self,debug=False):
83 ParameterSet.__init__(self,debug=debug)
84 self.declareParameter(reference_temperature=1.,
85 gravity=9.81, \
86 density0=1., \
87 expansion_coefficient=0., \
88 viscosity0=1., \
89 alpha=0., \
90 heat_capacity=1., \
91 thermal_permabilty=1.)
92
93 def density(self):
94 return self.density0*(1-self.expansion_coefficient*(self.temperature-self.reference_temperature))
95
96 def viscosity(self):
97 return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))
98
99 class SimpleSolidMaterial(MaterialTable):
100 """
101 A simple matrial table which allows setting physical parameters of
102 a model.
103
104 @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 """
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 """
117 A simple matrial table which allows setting physical ivar of a model.
118
119 @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 """
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 # 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