/[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 628 - (show 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 # $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 (in): domain of interest
18 @ivar density (in): density
19 @ivar direction (in): density
20 @ivar gravity_force(out): gravity force
21 """
22 def __init__(self,debug=False):
23 ParameterSet.__init__(self,debug=debug)
24 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 class MaterialTable(ParameterSet):
39 """
40 A simple matrial table which allows setting physical ivar of a model
41
42 @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 """
48 def __init__(self,debug=False):
49 ParameterSet.__init__(self,debug=debug)
50 self.declareParameter(gravity=9.81, \
51 density=1., \
52 heat_capacity=1., \
53 thermal_permabilty=1., \
54 radiation_coefficient=0.)
55
56 class SimpleEarthModel(ParameterSet):
57 """
58 B simple matrial table run convection models::
59
60 density=density0*(1-rayleigh_number*(temperature-reference_temperature))
61 viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
62
63 @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 """
75 def __init__(self,debug=False):
76 ParameterSet.__init__(self,debug=debug)
77 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 class SimpleSolidMaterial(MaterialTable):
93 """
94 A simple matrial table which allows setting physical parameters of
95 a model.
96
97 @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 """
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 """
110 A simple matrial table which allows setting physical ivar of a model.
111
112 @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 """
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 # 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