/[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 707 - (show annotations)
Wed Apr 12 23:58:02 2006 UTC (16 years, 11 months ago) by gross
File MIME type: text/x-python
File size: 3123 byte(s)
latex build documentation is working now
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,ScalarConstrainer,VectorConstrainer
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 dom=RectangularDomain()
24 dom.order=2
25
26 temp_constraints=ScalarConstrainer()
27 temp_constraints.domain=Link(dom)
28 temp_constraints.top=1
29 temp_constraints.bottom=1
30
31 vel_constraints=VectorConstrainer()
32 vel_constraints.domain=Link(dom)
33 vel_constraints.left=[1,0,0]
34 vel_constraints.right=[1,0,0]
35 vel_constraints.top=[0,1,0]
36 vel_constraints.bottom=[0,1,0]
37 vel_constraints.front=[0,0,1]
38 vel_constraints.back=[0,0,1]
39
40
41 temp_val=InterpolateOverBox()
42 temp_val.domain=Link(dom,"domain")
43 temp_val.right_top_back=Link(dom,"l")
44 temp_val.value_left_bottom_front=1.
45 temp_val.value_right_bottom_front=1.
46 temp_val.value_left_top_front=0.
47 temp_val.value_right_top_front=0.
48 temp_val.value_left_bottom_back=1.
49 temp_val.value_right_bottom_back=1.
50 temp_val.value_left_top_back=0.
51 temp_val.value_right_top_back=0.
52
53 mat=SimpleEarthModel()
54 mat.density0=1.
55 mat.viscocity0=1.
56 mat.rayleigh_number=10000.
57 mat.alpha=0.001
58
59 temp=TemperatureAdvection(debug=True)
60 temp.domain=Link(dom)
61 temp.density=Link(mat,"density0")
62 temp.heat_capacity=Link(mat,"heat_capacity")
63 temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
64 temp.fixed_temperature=Link(temp_val,"out")
65 temp.safety_factor=0.01
66 mat.temperature=Link(temp,"temperature")
67
68
69 grav=GravityForce()
70 grav.domain=Link(dom,"domain")
71 grav.direction=[0.,-1.,0.]
72 grav.density=Link(mat,"density")
73 grav.gravity=Link(mat,"gravity")
74
75
76 vel=SteadyIncompressibleFlow(debug=True)
77 vel.domain=Link(dom)
78 vel.internal_force=Link(grav,"gravity_force")
79 vel.viscosity=Link(mat,"viscosity")
80 vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
81 vel.rel_tol=1.e-6
82 temp.velocity=Link(vel,"velocity")
83
84 sq=Sequencer()
85 sq.t_end=0.005
86
87 vis=WriteVTK()
88 vis.t=Link(sq)
89 vis.scalar=Link(temp,"temperature")
90 vis.vector=Link(vel,"velocity")
91 vis.stride=5
92 vis.filename=os.environ['MODELLIB_WORKDIR']+"/temp.xml"
93
94 per=GaussianProfile()
95 per.domain=Link(dom)
96 per.x_c=[0.5,0.5,0.5]
97 per.A=0.0001
98 per.width=0.01
99 per.r=0
100
101 lc=LinearCombination()
102 lc.f0=1.
103 lc.v0=Link(per,"out")
104 lc.f1=1.
105 lc.v1=Link(temp_val,"out")
106 temp.temperature=Link(lc,"out")
107
108 # s=Simulation([dom,sq,temp_constraints,vel_constraints,temp_val,per,lc,mat,grav,Simulation([vel],debug=True),temp,vis],debug=True)
109 s=Simulation([dom,sq,Simulation([vel],debug=True),temp,vis],debug=True)
110 s.writeXML()
111 s.run()

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26