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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1312 - (hide annotations)
Mon Sep 24 06:18:44 2007 UTC (13 years, 7 months ago) by ksteube
File MIME type: text/x-python
File size: 5572 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

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