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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 728 - (hide annotations)
Mon May 15 02:01:18 2006 UTC (16 years, 10 months ago) by gross
File MIME type: text/x-python
File size: 3048 byte(s)
modelframe test examples work now
1 jgs 147 # $Id$
2    
3     #
4     #
5     # a very simple convection model in model frame:
6     #
7    
8 elspeth 628 __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 gross 706 import os
15 jgs 149 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 jgs 147
23 gross 728 try:
24     WORKDIR=os.environ['MODELLIB_WORKDIR']
25     except KeyError:
26     WORKDIR='.'
27    
28    
29 jgs 147 dom=RectangularDomain()
30     dom.order=2
31    
32     temp_constraints=ScalarConstrainer()
33     temp_constraints.domain=Link(dom)
34     temp_constraints.top=1
35     temp_constraints.bottom=1
36    
37     vel_constraints=VectorConstrainer()
38     vel_constraints.domain=Link(dom)
39     vel_constraints.left=[1,0,0]
40     vel_constraints.right=[1,0,0]
41     vel_constraints.top=[0,1,0]
42     vel_constraints.bottom=[0,1,0]
43     vel_constraints.front=[0,0,1]
44     vel_constraints.back=[0,0,1]
45    
46    
47     temp_val=InterpolateOverBox()
48     temp_val.domain=Link(dom,"domain")
49     temp_val.right_top_back=Link(dom,"l")
50     temp_val.value_left_bottom_front=1.
51     temp_val.value_right_bottom_front=1.
52     temp_val.value_left_top_front=0.
53     temp_val.value_right_top_front=0.
54     temp_val.value_left_bottom_back=1.
55     temp_val.value_right_bottom_back=1.
56     temp_val.value_left_top_back=0.
57     temp_val.value_right_top_back=0.
58    
59     mat=SimpleEarthModel()
60     mat.density0=1.
61     mat.viscocity0=1.
62     mat.rayleigh_number=10000.
63     mat.alpha=0.001
64    
65     temp=TemperatureAdvection(debug=True)
66     temp.domain=Link(dom)
67     temp.density=Link(mat,"density0")
68     temp.heat_capacity=Link(mat,"heat_capacity")
69     temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
70     temp.fixed_temperature=Link(temp_val,"out")
71     temp.safety_factor=0.01
72     mat.temperature=Link(temp,"temperature")
73    
74    
75     grav=GravityForce()
76     grav.domain=Link(dom,"domain")
77     grav.direction=[0.,-1.,0.]
78     grav.density=Link(mat,"density")
79     grav.gravity=Link(mat,"gravity")
80    
81    
82     vel=SteadyIncompressibleFlow(debug=True)
83     vel.domain=Link(dom)
84     vel.internal_force=Link(grav,"gravity_force")
85     vel.viscosity=Link(mat,"viscosity")
86     vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
87     vel.rel_tol=1.e-6
88     temp.velocity=Link(vel,"velocity")
89    
90     sq=Sequencer()
91     sq.t_end=0.005
92    
93     vis=WriteVTK()
94     vis.t=Link(sq)
95     vis.scalar=Link(temp,"temperature")
96     vis.vector=Link(vel,"velocity")
97 gross 728 vis.dt=0.0005
98     vis.filename=WORKDIR+"/temp.xml"
99 jgs 147
100 jgs 148 per=GaussianProfile()
101 jgs 147 per.domain=Link(dom)
102     per.x_c=[0.5,0.5,0.5]
103     per.A=0.0001
104     per.width=0.01
105     per.r=0
106    
107     lc=LinearCombination()
108     lc.f0=1.
109     lc.v0=Link(per,"out")
110     lc.f1=1.
111     lc.v1=Link(temp_val,"out")
112     temp.temperature=Link(lc,"out")
113    
114 gross 728 s=Simulation([sq,Simulation([vel],debug=True),temp,vis],debug=True)
115 jgs 147 s.writeXML()
116     s.run()

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26