# Diff of /trunk/modellib/py_src/materials.py

trunk/esys2/modellib/py_src/materials.py revision 148 by jgs, Tue Aug 23 01:24:31 2005 UTC trunk/modellib/py_src/materials.py revision 628 by elspeth, Thu Mar 23 02:27:57 2006 UTC
# Line 1  Line 1
1  # \$Id\$  # \$Id\$
2
3  from escript.modelframe import Model,ParameterSet  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
4  from escript.util import exp                      http://www.access.edu.au
8
9    from esys.escript.modelframe import Model,ParameterSet
10    from esys.escript.util import exp
11  import numarray  import numarray
12
13  class GravityForce(ParameterSet):  class GravityForce(ParameterSet):
14         """@brief sets a gravity force of given direction in given domain:         """
15           Sets a gravity force of given direction in given domain:
@param domain (in) - domain of interest
@param density (in) - density
@param direction (in) - density
@param gravity_force(out)  - gravity force
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):         def __init__(self,debug=False):
23             ParameterSet.__init__(self,debug=debug)             ParameterSet.__init__(self,debug=debug)
# Line 30  class GravityForce(ParameterSet): Line 36  class GravityForce(ParameterSet):
36
37
38  class MaterialTable(ParameterSet):  class MaterialTable(ParameterSet):
39         """@brief a simple matrial table which allows setting physical parameters of a model         """
40           A simple matrial table which allows setting physical ivar of a model
@param density (in/out) - density
@param heat_capacity (in/out)  - heat_capacity
@param thermal_permabilty (in/out) - permabilty
@param viscosity (in/out)  - viscosity
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
47         """         """
48         def __init__(self,debug=False):         def __init__(self,debug=False):
49             ParameterSet.__init__(self,debug=debug)             ParameterSet.__init__(self,debug=debug)
# Line 48  class MaterialTable(ParameterSet): Line 54  class MaterialTable(ParameterSet):
55
56  class SimpleEarthModel(ParameterSet):  class SimpleEarthModel(ParameterSet):
57         """@brief a simple matrial table run convection models:         """
58           B simple matrial table run convection models::
density=density0*(1-rayleigh_number*(temperature-reference_temperature))
viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
59
60                @param gravity  (in) - gravity constants (9.81)             density=density0*(1-rayleigh_number*(temperature-reference_temperature))
61                @param reference_temperature  (in) - reference temperature             viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
@param density0  (in) - density at reference temperature
@param viscosity0  (in) - viscosity0 at reference temperature
@param alpha  (in) - viscosity contrast
@param rayleigh_number (in)  - Raleigh number
@param heat_capacity (in)  - heat capacity
@param thermal_permabilty (in) - permabilty
@param temperature (in) - temperature
@param viscosity (out)  - viscosity
@param density (out)  - density
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):         def __init__(self,debug=False):
76             ParameterSet.__init__(self,debug=debug)             ParameterSet.__init__(self,debug=debug)
# Line 84  class SimpleEarthModel(ParameterSet): Line 90  class SimpleEarthModel(ParameterSet):
90             return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))             return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))
91
92  class SimpleSolidMaterial(MaterialTable):  class SimpleSolidMaterial(MaterialTable):
93         """@brief a simple matrial table which allows setting physical parameters of a model         """
94           A simple matrial table which allows setting physical parameters of
95                @param density (in/out) - density         a model.
@param heat_capacity (in/out)  - heat_capacity
@param thermal_permabilty (in/out) - permabilty
@param viscosity (in/out)  - viscosity
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
102         """         """
103         def __init__(self,debug=False):         def __init__(self,debug=False):
104             MaterialTable.__init__(self,debug=debug)             MaterialTable.__init__(self,debug=debug)
# Line 99  class SimpleSolidMaterial(MaterialTable) Line 106  class SimpleSolidMaterial(MaterialTable)
106                                   lame_my=1.)                                   lame_my=1.)
107
108  class SimpleFluidMaterial(MaterialTable):  class SimpleFluidMaterial(MaterialTable):
109         """@brief a simple matrial table which allows setting physical parameters of a model         """
110           A simple matrial table which allows setting physical ivar of a model.
@param density (in/out) - density
@param heat_capacity (in/out)  - heat_capacity
@param thermal_permabilty (in/out) - permabilty
@param viscosity (in/out)  - viscosity
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