/[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 3258 by jfenwick, Thu Jan 28 02:03:15 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 33  from esys.modellib.temperature import Te Line 33  from esys.modellib.temperature import Te
33  from esys.modellib.materials import SimpleEarthModel,GravityForce  from esys.modellib.materials import SimpleEarthModel,GravityForce
34  from esys.modellib.visualization import WriteVTK  from esys.modellib.visualization import WriteVTK
35    
36    import esys.dudley
37    
38  try:  try:
39     WORKDIR=os.environ['MODELLIB_WORKDIR']     WORKDIR=os.environ['MODELLIB_WORKDIR']
40  except KeyError:  except KeyError:
# Line 41  except KeyError: Line 43  except KeyError:
43    
44  dom=RectangularDomain()  dom=RectangularDomain()
45  dom.order=2  dom.order=2
46    def Test(dom):
47  temp_val=InterpolateOverBox()      temp_val=InterpolateOverBox()
48  temp_val.domain=Link(dom,"domain")      temp_val.domain=Link(dom,"domain")
49  temp_val.value_left_bottom_front=1.      temp_val.value_left_bottom_front=1.
50  temp_val.value_right_bottom_front=1.      temp_val.value_right_bottom_front=1.
51  temp_val.value_left_top_front=0.      temp_val.value_left_top_front=0.
52  temp_val.value_right_top_front=0.      temp_val.value_right_top_front=0.
53  temp_val.value_left_bottom_back=1.      temp_val.value_left_bottom_back=1.
54  temp_val.value_right_bottom_back=1.      temp_val.value_right_bottom_back=1.
55  temp_val.value_left_top_back=0.      temp_val.value_left_top_back=0.
56  temp_val.value_right_top_back=0.      temp_val.value_right_top_back=0.
57        
58  temp_constraints=ScalarConstrainerOverBox()      temp_constraints=ScalarConstrainerOverBox()
59  temp_constraints.domain=Link(dom)      temp_constraints.domain=Link(dom)
60  temp_constraints.top=1      temp_constraints.top=1
61  temp_constraints.bottom=1      temp_constraints.bottom=1
62        
63  vel_constraints=VectorConstrainerOverBox()      vel_constraints=VectorConstrainerOverBox()
64  vel_constraints.domain=Link(dom)      vel_constraints.domain=Link(dom)
65  vel_constraints.left=[1,0,0]      vel_constraints.left=[1,0,0]
66  vel_constraints.right=[1,0,0]      vel_constraints.right=[1,0,0]
67  vel_constraints.top=[0,1,0]      vel_constraints.top=[0,1,0]
68  vel_constraints.bottom=[0,1,0]      vel_constraints.bottom=[0,1,0]
69  vel_constraints.front=[0,0,1]      vel_constraints.front=[0,0,1]
70  vel_constraints.back=[0,0,1]      vel_constraints.back=[0,0,1]
71        
72  mat=SimpleEarthModel()      mat=SimpleEarthModel()
73  mat.density0=1.      mat.density0=1.
74  mat.viscocity0=1.      mat.viscocity0=1.
75  mat.rayleigh_number=10000.      mat.rayleigh_number=10000.
76  mat.alpha=0.001      mat.alpha=0.001
77        
78  temp=TemperatureAdvection(debug=True)      temp=TemperatureAdvection(debug=True)
79  temp.domain=Link(dom)      temp.domain=Link(dom)
80  temp.density=Link(mat,"density0")      temp.density=Link(mat,"density0")
81  temp.heat_capacity=Link(mat,"heat_capacity")      temp.heat_capacity=Link(mat,"heat_capacity")
82  temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")      temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
83  temp.fixed_temperature=Link(temp_val,"out")      temp.fixed_temperature=Link(temp_val,"out")
84  temp.safety_factor=0.01      temp.safety_factor=0.01
85  mat.temperature=Link(temp,"temperature")      mat.temperature=Link(temp,"temperature")
86        
87        
88  grav=GravityForce()      grav=GravityForce()
89  grav.domain=Link(dom,"domain")      grav.domain=Link(dom,"domain")
90  grav.direction=[0.,-1.,0.]      grav.direction=[0.,-1.,0.]
91  grav.density=Link(mat,"density")      grav.density=Link(mat,"density")
92  grav.gravity=Link(mat,"gravity")      grav.gravity=Link(mat,"gravity")
93        
94        
95  vel=SteadyIncompressibleFlow(debug=True)      vel=SteadyIncompressibleFlow(debug=True)
96  vel.domain=Link(dom)      vel.domain=Link(dom)
97  vel.internal_force=Link(grav,"gravity_force")      vel.internal_force=Link(grav,"gravity_force")
98  vel.viscosity=Link(mat,"viscosity")      vel.viscosity=Link(mat,"viscosity")
99  vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")      vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
100  vel.rel_tol=1.e-6      vel.rel_tol=1.e-6
101  temp.velocity=Link(vel,"velocity")      temp.velocity=Link(vel,"velocity")
102        
103  sq=Sequencer()      sq=Sequencer()
104  sq.t_end=0.001      sq.t_end=0.001
105        
106  vis=WriteVTK()      vis=WriteVTK()
107  vis.t=Link(sq)      vis.t=Link(sq)
108  vis.data0=Link(temp,"temperature")      vis.data0=Link(temp,"temperature")
109  vis.data1=Link(vel,"velocity")      vis.data1=Link(vel,"velocity")
110  vis.dt=0.0001      vis.dt=0.0001
111  vis.filename=os.path.join(WORKDIR,"temp.xml")      vis.filename=os.path.join(WORKDIR,"temp.xml")
112        
113  per=GaussianProfile()      per=GaussianProfile()
114  per.domain=Link(dom)      per.domain=Link(dom)
115  per.x_c=[0.5,0.5,0.5]      per.x_c=[0.5,0.5,0.5]
116  per.A=0.0001      per.A=0.0001
117  per.width=0.01      per.width=0.01
118  per.r=0      per.r=0
119        
120  lc=LinearCombination()      lc=LinearCombination()
121  lc.f0=1.      lc.f0=1.
122  lc.v0=Link(per,"out")      lc.v0=Link(per,"out")
123  lc.f1=1.      lc.f1=1.
124  lc.v1=Link(temp_val,"out")      lc.v1=Link(temp_val,"out")
125  temp.temperature=Link(lc,"out")      temp.temperature=Link(lc,"out")
126        
127  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)
128  s.writeXML()      s.writeXML()
129  s.run()      s.run()
130    
131    Test(dom)
132    dom=RectangularDomain(esys.dudley)
133    dom.order=1
134    Test(dom)

Legend:
Removed from v.3258  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26