1 |
jgs |
127 |
# $Id$ |
2 |
|
|
|
3 |
jgs |
149 |
from esys.escript.modelframe import Model,ParameterSet |
4 |
|
|
from esys.escript.util import exp |
5 |
jgs |
147 |
import numarray |
6 |
jgs |
127 |
|
7 |
jgs |
148 |
class GravityForce(ParameterSet): |
8 |
jgs |
149 |
""" |
9 |
|
|
Sets a gravity force of given direction in given domain: |
10 |
jgs |
127 |
|
11 |
jgs |
149 |
@ivar domain (in): domain of interest |
12 |
|
|
@ivar density (in): density |
13 |
|
|
@ivar direction (in): density |
14 |
|
|
@ivar gravity_force(out): gravity force |
15 |
jgs |
147 |
""" |
16 |
|
|
def __init__(self,debug=False): |
17 |
jgs |
148 |
ParameterSet.__init__(self,debug=debug) |
18 |
jgs |
147 |
self.declareParameter(domain=None, |
19 |
|
|
gravity=9.81, \ |
20 |
|
|
density=1., \ |
21 |
|
|
direction=[1.,0.,0.]) |
22 |
|
|
|
23 |
|
|
def gravity_force(self): |
24 |
|
|
if isinstance(self.direction,list): |
25 |
|
|
dir=numarray.array(self.direction[:self.domain.getDim()]) |
26 |
|
|
else: |
27 |
|
|
dir=self.direction[:self.domain.getDim()] |
28 |
|
|
return self.gravity*self.density*dir |
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
jgs |
148 |
class MaterialTable(ParameterSet): |
33 |
jgs |
149 |
""" |
34 |
|
|
A simple matrial table which allows setting physical ivar of a model |
35 |
jgs |
127 |
|
36 |
jgs |
149 |
@ivar density (in/out): density |
37 |
|
|
@ivar heat_capacity (in/out): heat_capacity |
38 |
|
|
@ivar thermal_permabilty (in/out): permabilty |
39 |
|
|
@ivar viscosity (in/out): viscosity |
40 |
|
|
@ivar radiation_coefficient (in/out): |
41 |
jgs |
127 |
""" |
42 |
|
|
def __init__(self,debug=False): |
43 |
jgs |
148 |
ParameterSet.__init__(self,debug=debug) |
44 |
jgs |
147 |
self.declareParameter(gravity=9.81, \ |
45 |
jgs |
127 |
density=1., \ |
46 |
jgs |
147 |
heat_capacity=1., \ |
47 |
jgs |
127 |
thermal_permabilty=1., \ |
48 |
|
|
radiation_coefficient=0.) |
49 |
|
|
|
50 |
jgs |
148 |
class SimpleEarthModel(ParameterSet): |
51 |
jgs |
149 |
""" |
52 |
|
|
B simple matrial table run convection models:: |
53 |
jgs |
147 |
|
54 |
jgs |
149 |
density=density0*(1-rayleigh_number*(temperature-reference_temperature)) |
55 |
|
|
viscocity=viscocity0*(exp(alpha*(1/reference_temperature - 1/temperature)) |
56 |
jgs |
147 |
|
57 |
jgs |
149 |
@ivar gravity (in): gravity constants (9.81) |
58 |
|
|
@ivar reference_temperature (in): reference temperature |
59 |
|
|
@ivar density0 (in): density at reference temperature |
60 |
|
|
@ivar viscosity0 (in): viscosity0 at reference temperature |
61 |
|
|
@ivar alpha (in): viscosity contrast |
62 |
|
|
@ivar rayleigh_number (in): Raleigh number |
63 |
|
|
@ivar heat_capacity (in): heat capacity |
64 |
|
|
@ivar thermal_permabilty (in): permabilty |
65 |
|
|
@ivar temperature (in): temperature |
66 |
|
|
@ivar viscosity (out): viscosity |
67 |
|
|
@ivar density (out): density |
68 |
jgs |
147 |
""" |
69 |
|
|
def __init__(self,debug=False): |
70 |
jgs |
148 |
ParameterSet.__init__(self,debug=debug) |
71 |
jgs |
147 |
self.declareParameter(reference_temperature=1., |
72 |
|
|
gravity=9.81, \ |
73 |
|
|
density0=1., \ |
74 |
|
|
rayleigh_number=0., \ |
75 |
|
|
viscosity0=1., \ |
76 |
|
|
alpha=0., \ |
77 |
|
|
heat_capacity=1., \ |
78 |
|
|
thermal_permabilty=1.) |
79 |
|
|
|
80 |
|
|
def density(self): |
81 |
|
|
return self.density0*(1-self.rayleigh_number*(self.temperature-self.reference_temperature)) |
82 |
|
|
|
83 |
|
|
def viscosity(self): |
84 |
|
|
return self.viscosity0*exp(self.alpha*(1/self.reference_temperature - 1/(self.temperature+1.e-15))) |
85 |
|
|
|
86 |
jgs |
127 |
class SimpleSolidMaterial(MaterialTable): |
87 |
jgs |
149 |
""" |
88 |
|
|
A simple matrial table which allows setting physical parameters of |
89 |
|
|
a model. |
90 |
jgs |
127 |
|
91 |
jgs |
149 |
@ivar density (in/out): density |
92 |
|
|
@ivar heat_capacity (in/out): heat_capacity |
93 |
|
|
@ivar thermal_permabilty (in/out): permabilty |
94 |
|
|
@ivar viscosity (in/out): viscosity |
95 |
|
|
@ivar radiation_coefficient (in/out): |
96 |
jgs |
127 |
""" |
97 |
|
|
def __init__(self,debug=False): |
98 |
|
|
MaterialTable.__init__(self,debug=debug) |
99 |
|
|
self.declareParameter(lame_lambda=1.,\ |
100 |
|
|
lame_my=1.) |
101 |
|
|
|
102 |
|
|
class SimpleFluidMaterial(MaterialTable): |
103 |
jgs |
149 |
""" |
104 |
|
|
A simple matrial table which allows setting physical ivar of a model. |
105 |
jgs |
127 |
|
106 |
jgs |
149 |
@ivar density (in/out): density |
107 |
|
|
@ivar heat_capacity (in/out): heat_capacity |
108 |
|
|
@ivar thermal_permabilty (in/out): permabilty |
109 |
|
|
@ivar viscosity (in/out): viscosity |
110 |
|
|
@ivar radiation_coefficient (in/out): |
111 |
jgs |
127 |
""" |
112 |
|
|
def __init__(self,debug=False): |
113 |
|
|
MaterialTable.__init__(self,debug=debug) |
114 |
|
|
self.declareParameter(viscosity=1., \ |
115 |
|
|
hydraulic_conductivity=1.e-4) |
116 |
|
|
|
117 |
jgs |
149 |
# vim: expandtab shiftwidth=4: |