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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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 814 by gross, Wed Aug 23 09:31:10 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
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  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: 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):         def __init__(self,debug=False):
24               """
25               initializes the set
26               """
27             ParameterSet.__init__(self,debug=debug)             ParameterSet.__init__(self,debug=debug)
28             self.declareParameter(domain=None,             self.declareParameter(domain=None,
29                                   gravity=9.81, \                                   gravity=9.81, \
# Line 21  class GravityForce(ParameterSet): Line 31  class GravityForce(ParameterSet):
31                                   direction=[1.,0.,0.])                                   direction=[1.,0.,0.])
32    
33         def gravity_force(self):         def gravity_force(self):
34              if isinstance(self.direction,list):             """
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()])                 dir=numarray.array(self.direction[:self.domain.getDim()])
39              else:             else:
40                 dir=self.direction[:self.domain.getDim()]                 dir=self.direction[:self.domain.getDim()]
41              return self.gravity*self.density*dir             return self.gravity*self.density*dir
42            
43    
44            
45  class MaterialTable(ParameterSet):  class MaterialTable(ParameterSet):
46         """@brief a simple matrial table which allows setting physical parameters of a model         """
47           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  
               @param radiation_coefficient (in/out) -  
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):         def __init__(self,debug=False):
56             ParameterSet.__init__(self,debug=debug)             ParameterSet.__init__(self,debug=debug)
# Line 48  class MaterialTable(ParameterSet): Line 61  class MaterialTable(ParameterSet):
61                                   radiation_coefficient=0.)                                   radiation_coefficient=0.)
62    
63  class SimpleEarthModel(ParameterSet):  class SimpleEarthModel(ParameterSet):
64         """@brief a simple matrial table run convection models:         """
65           B simple matrial table run convection models::
               density=density0*(1-rayleigh_number*(temperature-reference_temperature))  
               viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))  
66    
67                @param gravity  (in) - gravity constants (9.81)             density=density0*(1-expansion_coefficient*(temperature-reference_temperature))
68                @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  
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):         def __init__(self,debug=False):
83             ParameterSet.__init__(self,debug=debug)             ParameterSet.__init__(self,debug=debug)
84             self.declareParameter(reference_temperature=1.,             self.declareParameter(reference_temperature=1.,
85                                   gravity=9.81, \                                   gravity=9.81, \
86                                   density0=1., \                                   density0=1., \
87                                   rayleigh_number=0., \                                   expansion_coefficient=0., \
88                                   viscosity0=1., \                                   viscosity0=1., \
89                                   alpha=0., \                                   alpha=0., \
90                                   heat_capacity=1., \                                   heat_capacity=1., \
91                                   thermal_permabilty=1.)                                   thermal_permabilty=1.)
92                
93         def density(self):         def density(self):
94             return self.density0*(1-self.rayleigh_number*(self.temperature-self.reference_temperature))             return self.density0*(1-self.expansion_coefficient*(self.temperature-self.reference_temperature))
95    
96         def viscosity(self):         def viscosity(self):
97             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)))
98    
99  class SimpleSolidMaterial(MaterialTable):  class SimpleSolidMaterial(MaterialTable):
100         """@brief a simple matrial table which allows setting physical parameters of a model         """
101           A simple matrial table which allows setting physical parameters of
102                @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  
               @param radiation_coefficient (in/out) -  
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):         def __init__(self,debug=False):
111             MaterialTable.__init__(self,debug=debug)             MaterialTable.__init__(self,debug=debug)
# Line 99  class SimpleSolidMaterial(MaterialTable) Line 113  class SimpleSolidMaterial(MaterialTable)
113                                   lame_my=1.)                                   lame_my=1.)
114    
115  class SimpleFluidMaterial(MaterialTable):  class SimpleFluidMaterial(MaterialTable):
116         """@brief a simple matrial table which allows setting physical parameters of a model         """
117           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  
               @param radiation_coefficient (in/out) -  
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):         def __init__(self,debug=False):
126             MaterialTable.__init__(self,debug=debug)             MaterialTable.__init__(self,debug=debug)
127             self.declareParameter(viscosity=1., \             self.declareParameter(viscosity=1., \
128                                   hydraulic_conductivity=1.e-4)                                   hydraulic_conductivity=1.e-4)
129    
130    # vim: expandtab shiftwidth=4:

Legend:
Removed from v.148  
changed lines
  Added in v.814

  ViewVC Help
Powered by ViewVC 1.1.26