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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4575 by jfenwick, Tue Jan 22 09:30:23 2013 UTC revision 4576 by sshaw, Mon Dec 9 23:35:30 2013 UTC
# Line 45  except KeyError: Line 45  except KeyError:
45  dom=RectangularDomain()  dom=RectangularDomain()
46  dom.order=2  dom.order=2
47  def Test(dom):  def Test(dom):
48      temp_val=InterpolateOverBox()      temp_val=InterpolateOverBox()
49      temp_val.domain=Link(dom,"domain")      temp_val.domain=Link(dom,"domain")
50      temp_val.value_left_bottom_front=1.      temp_val.value_left_bottom_front=1.
51      temp_val.value_right_bottom_front=1.      temp_val.value_right_bottom_front=1.
52      temp_val.value_left_top_front=0.      temp_val.value_left_top_front=0.
53      temp_val.value_right_top_front=0.      temp_val.value_right_top_front=0.
54      temp_val.value_left_bottom_back=1.      temp_val.value_left_bottom_back=1.
55      temp_val.value_right_bottom_back=1.      temp_val.value_right_bottom_back=1.
56      temp_val.value_left_top_back=0.      temp_val.value_left_top_back=0.
57      temp_val.value_right_top_back=0.      temp_val.value_right_top_back=0.
58            
59      temp_constraints=ScalarConstrainerOverBox()      temp_constraints=ScalarConstrainerOverBox()
60      temp_constraints.domain=Link(dom)      temp_constraints.domain=Link(dom)
61      temp_constraints.top=1      temp_constraints.top=1
62      temp_constraints.bottom=1      temp_constraints.bottom=1
63            
64      vel_constraints=VectorConstrainerOverBox()      vel_constraints=VectorConstrainerOverBox()
65      vel_constraints.domain=Link(dom)      vel_constraints.domain=Link(dom)
66      vel_constraints.left=[1,0,0]      vel_constraints.left=[1,0,0]
67      vel_constraints.right=[1,0,0]      vel_constraints.right=[1,0,0]
68      vel_constraints.top=[0,1,0]      vel_constraints.top=[0,1,0]
69      vel_constraints.bottom=[0,1,0]      vel_constraints.bottom=[0,1,0]
70      vel_constraints.front=[0,0,1]      vel_constraints.front=[0,0,1]
71      vel_constraints.back=[0,0,1]      vel_constraints.back=[0,0,1]
72            
73      mat=SimpleEarthModel()      mat=SimpleEarthModel()
74      mat.density0=1.      mat.density0=1.
75      mat.viscocity0=1.      mat.viscocity0=1.
76      mat.rayleigh_number=10000.      mat.rayleigh_number=10000.
77      mat.alpha=0.001      mat.alpha=0.001
78            
79      temp=TemperatureAdvection(debug=True)      temp=TemperatureAdvection(debug=True)
80      temp.domain=Link(dom)      temp.domain=Link(dom)
81      temp.density=Link(mat,"density0")      temp.density=Link(mat,"density0")
82      temp.heat_capacity=Link(mat,"heat_capacity")      temp.heat_capacity=Link(mat,"heat_capacity")
83      temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")      temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
84      temp.fixed_temperature=Link(temp_val,"out")      temp.fixed_temperature=Link(temp_val,"out")
85      temp.safety_factor=0.01      temp.safety_factor=0.01
86      mat.temperature=Link(temp,"temperature")      mat.temperature=Link(temp,"temperature")
87            
88            
89      grav=GravityForce()      grav=GravityForce()
90      grav.domain=Link(dom,"domain")      grav.domain=Link(dom,"domain")
91      grav.direction=[0.,-1.,0.]      grav.direction=[0.,-1.,0.]
92      grav.density=Link(mat,"density")      grav.density=Link(mat,"density")
93      grav.gravity=Link(mat,"gravity")      grav.gravity=Link(mat,"gravity")
94            
95            
96      vel=SteadyIncompressibleFlow(debug=True)      vel=SteadyIncompressibleFlow(debug=True)
97      vel.domain=Link(dom)      vel.domain=Link(dom)
98      vel.internal_force=Link(grav,"gravity_force")      vel.internal_force=Link(grav,"gravity_force")
99      vel.viscosity=Link(mat,"viscosity")      vel.viscosity=Link(mat,"viscosity")
100      vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")      vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
101      vel.rel_tol=1.e-6      vel.rel_tol=1.e-6
102      temp.velocity=Link(vel,"velocity")      temp.velocity=Link(vel,"velocity")
103            
104      sq=Sequencer()      sq=Sequencer()
105      sq.t_end=0.001      sq.t_end=0.001
106            
107      vis=WriteVTK()      vis=WriteVTK()
108      vis.t=Link(sq)      vis.t=Link(sq)
109      vis.data0=Link(temp,"temperature")      vis.data0=Link(temp,"temperature")
110      vis.data1=Link(vel,"velocity")      vis.data1=Link(vel,"velocity")
111      vis.dt=0.0001      vis.dt=0.0001
112      vis.filename=os.path.join(WORKDIR,"temp.vtu")      vis.filename=os.path.join(WORKDIR,"temp.vtu")
113            
114      per=GaussianProfile()      per=GaussianProfile()
115      per.domain=Link(dom)      per.domain=Link(dom)
116      per.x_c=[0.5,0.5,0.5]      per.x_c=[0.5,0.5,0.5]
117      per.A=0.0001      per.A=0.0001
118      per.width=0.01      per.width=0.01
119      per.r=0      per.r=0
120            
121      lc=LinearCombination()      lc=LinearCombination()
122      lc.f0=1.      lc.f0=1.
123      lc.v0=Link(per,"out")      lc.v0=Link(per,"out")
124      lc.f1=1.      lc.f1=1.
125      lc.v1=Link(temp_val,"out")      lc.v1=Link(temp_val,"out")
126      temp.temperature=Link(lc,"out")      temp.temperature=Link(lc,"out")
127            
128      s=Simulation([sq,vel_constraints, temp_constraints,Simulation([vel],debug=True),temp,vis],debug=True)      s=Simulation([sq,vel_constraints, temp_constraints,Simulation([vel],debug=True),temp,vis],debug=True)
129      s.writeXML()      s.writeXML()
130      s.run()      s.run()
131    
132  Test(dom)  Test(dom)
133  dom=RectangularDomain(esys.dudley)  dom=RectangularDomain(esys.dudley)

Legend:
Removed from v.4575  
changed lines
  Added in v.4576

  ViewVC Help
Powered by ViewVC 1.1.26