/[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 1312 - (show annotations)
Mon Sep 24 06:18:44 2007 UTC (12 years, 10 months ago) by ksteube
File MIME type: text/x-python
File size: 3489 byte(s)
The MPI branch is hereby closed. All future work should be in trunk.

Previously in revision 1295 I merged the latest changes to trunk into trunk-mpi-branch.
In this revision I copied all files from trunk-mpi-branch over the corresponding
trunk files. I did not use 'svn merge', it was a copy.

1 #
2 # $Id$
3 #
4 #######################################################
5 #
6 # Copyright 2003-2007 by ACceSS MNRF
7 # Copyright 2007 by University of Queensland
8 #
9 # http://esscc.uq.edu.au
10 # Primary Business: Queensland, Australia
11 # Licensed under the Open Software License version 3.0
12 # http://www.opensource.org/licenses/osl-3.0.php
13 #
14 #######################################################
15 #
16
17 #
18 #
19 # a very simple convection model in model frame:
20 #
21
22 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
23 http://www.access.edu.au
24 Primary Business: Queensland, Australia"""
25 __license__="""Licensed under the Open Software License version 3.0
26 http://www.opensource.org/licenses/osl-3.0.php"""
27
28 import os
29 from esys.escript.modelframe import Link,Simulation
30 from esys.modellib.geometry import RectangularDomain,ScalarConstrainerOverBox,VectorConstrainerOverBox
31 from esys.modellib.input import Sequencer,InterpolateOverBox,GaussianProfile,LinearCombination
32 from esys.modellib.flow import SteadyIncompressibleFlow
33 from esys.modellib.temperature import TemperatureAdvection
34 from esys.modellib.materials import SimpleEarthModel,GravityForce
35 from esys.modellib.visualization import WriteVTK
36
37 try:
38 WORKDIR=os.environ['MODELLIB_WORKDIR']
39 except KeyError:
40 WORKDIR='.'
41
42
43 dom=RectangularDomain()
44 dom.order=2
45
46 temp_val=InterpolateOverBox()
47 temp_val.domain=Link(dom,"domain")
48 temp_val.value_left_bottom_front=1.
49 temp_val.value_right_bottom_front=1.
50 temp_val.value_left_top_front=0.
51 temp_val.value_right_top_front=0.
52 temp_val.value_left_bottom_back=1.
53 temp_val.value_right_bottom_back=1.
54 temp_val.value_left_top_back=0.
55 temp_val.value_right_top_back=0.
56
57 temp_constraints=ScalarConstrainerOverBox()
58 temp_constraints.domain=Link(dom)
59 temp_constraints.top=1
60 temp_constraints.bottom=1
61
62 vel_constraints=VectorConstrainerOverBox()
63 vel_constraints.domain=Link(dom)
64 vel_constraints.left=[1,0,0]
65 vel_constraints.right=[1,0,0]
66 vel_constraints.top=[0,1,0]
67 vel_constraints.bottom=[0,1,0]
68 vel_constraints.front=[0,0,1]
69 vel_constraints.back=[0,0,1]
70
71 mat=SimpleEarthModel()
72 mat.density0=1.
73 mat.viscocity0=1.
74 mat.rayleigh_number=10000.
75 mat.alpha=0.001
76
77 temp=TemperatureAdvection(debug=True)
78 temp.domain=Link(dom)
79 temp.density=Link(mat,"density0")
80 temp.heat_capacity=Link(mat,"heat_capacity")
81 temp.location_fixed_temperature=Link(temp_constraints,"location_of_constraint")
82 temp.fixed_temperature=Link(temp_val,"out")
83 temp.safety_factor=0.01
84 mat.temperature=Link(temp,"temperature")
85
86
87 grav=GravityForce()
88 grav.domain=Link(dom,"domain")
89 grav.direction=[0.,-1.,0.]
90 grav.density=Link(mat,"density")
91 grav.gravity=Link(mat,"gravity")
92
93
94 vel=SteadyIncompressibleFlow(debug=True)
95 vel.domain=Link(dom)
96 vel.internal_force=Link(grav,"gravity_force")
97 vel.viscosity=Link(mat,"viscosity")
98 vel.location_prescribed_velocity=Link(vel_constraints,"location_of_constraint")
99 vel.rel_tol=1.e-6
100 temp.velocity=Link(vel,"velocity")
101
102 sq=Sequencer()
103 sq.t_end=0.001
104
105 vis=WriteVTK()
106 vis.t=Link(sq)
107 vis.data0=Link(temp,"temperature")
108 vis.data1=Link(vel,"velocity")
109 vis.dt=0.0001
110 vis.filename=WORKDIR+"/temp.xml"
111
112 per=GaussianProfile()
113 per.domain=Link(dom)
114 per.x_c=[0.5,0.5,0.5]
115 per.A=0.0001
116 per.width=0.01
117 per.r=0
118
119 lc=LinearCombination()
120 lc.f0=1.
121 lc.v0=Link(per,"out")
122 lc.f1=1.
123 lc.v1=Link(temp_val,"out")
124 temp.temperature=Link(lc,"out")
125
126 s=Simulation([sq,vel_constraints, temp_constraints,Simulation([vel],debug=True),temp,vis],debug=True)
127 s.writeXML()
128 s.run()

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26