/[escript]/trunk/modellib/test/python/run_convection.py
ViewVC logotype

Contents of /trunk/modellib/test/python/run_convection.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1809 - (show annotations)
Thu Sep 25 06:43:44 2008 UTC (10 years, 9 months ago) by ksteube
File MIME type: text/x-python
File size: 3826 byte(s)
Copyright updated in all python files

1
2 ########################################################
3 #
4 # Copyright (c) 2003-2008 by University of Queensland
5 # Earth Systems Science Computational Center (ESSCC)
6 # http://www.uq.edu.au/esscc
7 #
8 # Primary Business: Queensland, Australia
9 # Licensed under the Open Software License version 3.0
10 # http://www.opensource.org/licenses/osl-3.0.php
11 #
12 ########################################################
13
14 __copyright__="""Copyright (c) 2003-2008 by University of Queensland
15 Earth Systems Science Computational Center (ESSCC)
16 http://www.uq.edu.au/esscc
17 Primary Business: Queensland, Australia"""
18 __license__="""Licensed under the Open Software License version 3.0
19 http://www.opensource.org/licenses/osl-3.0.php"""
20 __url__="http://www.uq.edu.au/esscc/escript-finley"
21
22 #
23 #
24 # a very simple convection model in model frame:
25 #
26
27 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
28 http://www.access.edu.au
29 Primary Business: Queensland, Australia"""
30 __license__="""Licensed under the Open Software License version 3.0
31 http://www.opensource.org/licenses/osl-3.0.php"""
32
33 import os
34 from esys.escript.modelframe import Link,Simulation
35 from esys.modellib.geometry import RectangularDomain,ScalarConstrainerOverBox,VectorConstrainerOverBox
36 from esys.modellib.input import Sequencer,InterpolateOverBox,GaussianProfile,LinearCombination
37 from esys.modellib.flow import SteadyIncompressibleFlow
38 from esys.modellib.temperature import TemperatureAdvection
39 from esys.modellib.materials import SimpleEarthModel,GravityForce
40 from esys.modellib.visualization import WriteVTK
41
42 try:
43 WORKDIR=os.environ['MODELLIB_WORKDIR']
44 except KeyError:
45 WORKDIR='.'
46
47
48 dom=RectangularDomain()
49 dom.order=2
50
51 temp_val=InterpolateOverBox()
52 temp_val.domain=Link(dom,"domain")
53 temp_val.value_left_bottom_front=1.
54 temp_val.value_right_bottom_front=1.
55 temp_val.value_left_top_front=0.
56 temp_val.value_right_top_front=0.
57 temp_val.value_left_bottom_back=1.
58 temp_val.value_right_bottom_back=1.
59 temp_val.value_left_top_back=0.
60 temp_val.value_right_top_back=0.
61
62 temp_constraints=ScalarConstrainerOverBox()
63 temp_constraints.domain=Link(dom)
64 temp_constraints.top=1
65 temp_constraints.bottom=1
66
67 vel_constraints=VectorConstrainerOverBox()
68 vel_constraints.domain=Link(dom)
69 vel_constraints.left=[1,0,0]
70 vel_constraints.right=[1,0,0]
71 vel_constraints.top=[0,1,0]
72 vel_constraints.bottom=[0,1,0]
73 vel_constraints.front=[0,0,1]
74 vel_constraints.back=[0,0,1]
75
76 mat=SimpleEarthModel()
77 mat.density0=1.
78 mat.viscocity0=1.
79 mat.rayleigh_number=10000.
80 mat.alpha=0.001
81
82 temp=TemperatureAdvection(debug=True)
83 temp.domain=Link(dom)
84 temp.density=Link(mat,"density0")
85 temp.heat_capacity=Link(mat,"heat_capacity")
86 temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
87 temp.fixed_temperature=Link(temp_val,"out")
88 temp.safety_factor=0.01
89 mat.temperature=Link(temp,"temperature")
90
91
92 grav=GravityForce()
93 grav.domain=Link(dom,"domain")
94 grav.direction=[0.,-1.,0.]
95 grav.density=Link(mat,"density")
96 grav.gravity=Link(mat,"gravity")
97
98
99 vel=SteadyIncompressibleFlow(debug=True)
100 vel.domain=Link(dom)
101 vel.internal_force=Link(grav,"gravity_force")
102 vel.viscosity=Link(mat,"viscosity")
103 vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
104 vel.rel_tol=1.e-6
105 temp.velocity=Link(vel,"velocity")
106
107 sq=Sequencer()
108 sq.t_end=0.001
109
110 vis=WriteVTK()
111 vis.t=Link(sq)
112 vis.data0=Link(temp,"temperature")
113 vis.data1=Link(vel,"velocity")
114 vis.dt=0.0001
115 vis.filename=WORKDIR+"/temp.xml"
116
117 per=GaussianProfile()
118 per.domain=Link(dom)
119 per.x_c=[0.5,0.5,0.5]
120 per.A=0.0001
121 per.width=0.01
122 per.r=0
123
124 lc=LinearCombination()
125 lc.f0=1.
126 lc.v0=Link(per,"out")
127 lc.f1=1.
128 lc.v1=Link(temp_val,"out")
129 temp.temperature=Link(lc,"out")
130
131 s=Simulation([sq,vel_constraints, temp_constraints,Simulation([vel],debug=True),temp,vis],debug=True)
132 s.writeXML()
133 s.run()

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26