/[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 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 10 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 #
2 # $Id$
3 #
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
17 __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 from esys.escript.modelframe import Model,ParameterSet
24 from esys.escript.util import exp
25 import numarray
26
27 class GravityForce(ParameterSet):
28 """
29 Sets a gravity force of given direction in given domain:
30
31 @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 """
37 def __init__(self,**kwargs):
38 """
39 initializes the set
40 """
41 super(GravityForce, self).__init__(**kwargs)
42 self.declareParameter(domain=None,
43 gravity=9.81, \
44 density=1., \
45 direction=[1.,0.,0.])
46
47 def gravity_force(self):
48 """
49 return the gravity force as L{density}*L{gravity}*L{direction}
50 """
51 if isinstance(self.direction,list):
52 dir=numarray.array(self.direction[:self.domain.getDim()])
53 else:
54 dir=self.direction[:self.domain.getDim()]
55 return self.gravity*self.density*dir
56
57
58
59 class MaterialTable(ParameterSet):
60 """
61 A simple matrial table which allows setting physical ivar of a model
62
63 @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 """
69 def __init__(self,**kwargs):
70 super(MaterialTable, self).__init__(**kwargs)
71 self.declareParameter(gravity=9.81, \
72 density=1., \
73 heat_capacity=1., \
74 thermal_permabilty=1., \
75 radiation_coefficient=0.)
76
77 class SimpleEarthModel(ParameterSet):
78 """
79 B simple matrial table run convection models::
80
81 density=density0*(1-expansion_coefficient*(temperature-reference_temperature))
82 viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature))
83
84 @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 @ivar expansion_coefficient (in): Raleigh number
90 @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 """
96 def __init__(self,**kwargs):
97 super(SimpleEarthModel, self).__init__(**kwargs)
98 self.declareParameter(reference_temperature=1.,
99 gravity=9.81, \
100 density0=1., \
101 expansion_coefficient=0., \
102 viscosity0=1., \
103 alpha=0., \
104 temperature=0.,\
105 heat_capacity=1., \
106 thermal_permabilty=1.)
107
108 def density(self):
109 return self.density0*(1-self.expansion_coefficient*(self.temperature-self.reference_temperature))
110
111 def viscosity(self):
112 return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15)))
113
114 class SimpleSolidMaterial(MaterialTable):
115 """
116 A simple matrial table which allows setting physical parameters of
117 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,**kwargs):
126 super(MaterialTable, self).__init__(**kwargs)
127 self.declareParameter(lame_lambda=1.,\
128 lame_my=1.)
129
130 class SimpleFluidMaterial(MaterialTable):
131 """
132 A simple matrial table which allows setting physical ivar of a model.
133
134 @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 """
140 def __init__(self,**kwargs):
141 super(MaterialTable, self).__init__(**kwargs)
142 self.declareParameter(viscosity=1., \
143 hydraulic_conductivity=1.e-4)
144
145 # 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