/[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 912 - (show annotations)
Wed Dec 6 03:29:49 2006 UTC (16 years, 3 months ago) by gross
File MIME type: text/x-python
File size: 3052 byte(s)
modellib.WriteVTK has been rewritten. Instead of only three data objects scalar,
vector, tensor it takes now up to 20 data objects data0 ... data19 and writes it into a 
single VTK file. There is also the possibilty to define individiual name tags name0,..., name19.
If no name is given the corresponding attribute name of the Link target is used. 
This simplifies the usage and increases efficiency.



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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26