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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 149 - (show annotations)
Thu Sep 1 03:31:39 2005 UTC (17 years, 6 months ago) by jgs
Original Path: trunk/esys2/modellib/test/python/convection.py
File MIME type: text/x-python
File size: 3120 byte(s)
Merge of development branch dev-02 back to main trunk on 2005-09-01

1 # $Id$
2
3 #
4 #
5 # a very simple convection model in model frame:
6 #
7
8 from esys.escript.modelframe import Link,Simulation
9 from esys.modellib.geometry import RectangularDomain,ScalarConstrainer,VectorConstrainer
10 from esys.modellib.input import Sequencer,InterpolateOverBox,GaussianProfile,LinearCombination
11 from esys.modellib.flow import SteadyIncompressibleFlow
12 from esys.modellib.temperature import TemperatureAdvection
13 from esys.modellib.materials import SimpleEarthModel,GravityForce
14 from esys.modellib.visualization import WriteVTK
15
16 # from esys.modelframe.geometry import RectangularDomain,ScalarConstrainer,VectorConstrainer
17 # from esys.modelframe.input import Sequencer,InterpolateOverBox
18 # from esys.modelframe.flow import SteadyIncompressibleFlow
19 # from esys.modelframe.temperature import TemperatureAdvection
20 # from esys.modelframe.materials import SimpleEarthModel,GravityForce
21
22 dom=RectangularDomain()
23 dom.order=2
24
25 temp_constraints=ScalarConstrainer()
26 temp_constraints.domain=Link(dom)
27 temp_constraints.top=1
28 temp_constraints.bottom=1
29
30 vel_constraints=VectorConstrainer()
31 vel_constraints.domain=Link(dom)
32 vel_constraints.left=[1,0,0]
33 vel_constraints.right=[1,0,0]
34 vel_constraints.top=[0,1,0]
35 vel_constraints.bottom=[0,1,0]
36 vel_constraints.front=[0,0,1]
37 vel_constraints.back=[0,0,1]
38
39
40 temp_val=InterpolateOverBox()
41 temp_val.domain=Link(dom,"domain")
42 temp_val.right_top_back=Link(dom,"l")
43 temp_val.value_left_bottom_front=1.
44 temp_val.value_right_bottom_front=1.
45 temp_val.value_left_top_front=0.
46 temp_val.value_right_top_front=0.
47 temp_val.value_left_bottom_back=1.
48 temp_val.value_right_bottom_back=1.
49 temp_val.value_left_top_back=0.
50 temp_val.value_right_top_back=0.
51
52 mat=SimpleEarthModel()
53 mat.density0=1.
54 mat.viscocity0=1.
55 mat.rayleigh_number=10000.
56 mat.alpha=0.001
57
58 temp=TemperatureAdvection(debug=True)
59 temp.domain=Link(dom)
60 temp.density=Link(mat,"density0")
61 temp.heat_capacity=Link(mat,"heat_capacity")
62 temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
63 temp.fixed_temperature=Link(temp_val,"out")
64 temp.safety_factor=0.01
65 mat.temperature=Link(temp,"temperature")
66
67
68 grav=GravityForce()
69 grav.domain=Link(dom,"domain")
70 grav.direction=[0.,-1.,0.]
71 grav.density=Link(mat,"density")
72 grav.gravity=Link(mat,"gravity")
73
74
75 vel=SteadyIncompressibleFlow(debug=True)
76 vel.domain=Link(dom)
77 vel.internal_force=Link(grav,"gravity_force")
78 vel.viscosity=Link(mat,"viscosity")
79 vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
80 vel.rel_tol=1.e-6
81 temp.velocity=Link(vel,"velocity")
82
83 sq=Sequencer()
84 sq.t_end=0.005
85
86 vis=WriteVTK()
87 vis.t=Link(sq)
88 vis.scalar=Link(temp,"temperature")
89 vis.vector=Link(vel,"velocity")
90 vis.stride=5
91
92 per=GaussianProfile()
93 per.domain=Link(dom)
94 per.x_c=[0.5,0.5,0.5]
95 per.A=0.0001
96 per.width=0.01
97 per.r=0
98
99 lc=LinearCombination()
100 lc.f0=1.
101 lc.v0=Link(per,"out")
102 lc.f1=1.
103 lc.v1=Link(temp_val,"out")
104 temp.temperature=Link(lc,"out")
105
106 # s=Simulation([dom,sq,temp_constraints,vel_constraints,temp_val,per,lc,mat,grav,Simulation([vel],debug=True),temp,vis],debug=True)
107 s=Simulation([dom,sq,Simulation([vel],debug=True),temp,vis],debug=True)
108 s.writeXML()
109 s.run()

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26