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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 918 - (show annotations)
Wed Jan 3 06:30:00 2007 UTC (13 years, 8 months ago) by gross
File MIME type: text/x-python
File size: 1667 byte(s)
fixes on ESySXML to get runmodel going.

    * object ids are now local for read and write of XML
    * ParameterSets are now written with class name
    * ParameterSets linked by other ParameterSets (previously only Models) are written now 
    * list are now lists of str (rather than bools), lists with bool, int or float are mapped to numarray
    * numarray are writen with generic types Bool, Int, Float (portability!)


1 # $Id$
2 #
3 # small test problem fro temperture advection:
4 #
5 # T=x0*x1*exp(-t), v=[1,-1]
6 #
7 __copyright__=""" Copyright (c) 2006 by ACcESS MNRF
8 http://www.access.edu.au
9 Primary Business: Queensland, Australia"""
10 __license__="""Licensed under the Open Software License version 3.0
11 http://www.opensource.org/licenses/osl-3.0.php"""
12
13 from esys.escript.modelframe import Link,Simulation
14 from esys.modellib.geometry import RectangularDomain,ScalarConstrainerOverBox
15 from esys.modellib.input import Sequencer
16 from esys.modellib.probe import Probe,EvaluateExpression
17 from esys.modellib.temperature import TemperatureAdvection
18 import numarray
19 import os
20
21 dom=RectangularDomain()
22 dom.order=2
23
24 sqe=Sequencer()
25 sqe.t=0
26 sqe.t_end=0.05
27
28 constraints=ScalarConstrainerOverBox()
29 constraints.domain=Link(dom)
30 constraints.top=1
31 constraints.bottom=1
32 constraints.right=1
33 constraints.left=1
34
35 source=EvaluateExpression()
36 source.domain=Link(dom)
37 source.expression="(x[1]-x[0])*exp(-t)-exp(-t)*x[0]*x[1]"
38 source.t=Link(sqe)
39 boundaryvalue=EvaluateExpression()
40 boundaryvalue.domain=Link(dom)
41 boundaryvalue.expression="x[0]*x[1]*exp(-t)"
42 boundaryvalue.t=Link(sqe)
43
44 tt=TemperatureAdvection()
45 tt.domain=Link(dom)
46 tt.temperature=Link(boundaryvalue,"out")
47 tt.velocity=numarray.array([1,-1])
48 tt.thermal_source=Link(source,"out")
49 tt.location_fixed_temperature=Link(constraints,"location_of_constraint")
50 tt.fixed_temperature=Link(boundaryvalue,"out")
51 tt.safety_factor=0.1
52
53 probe=Probe()
54 probe.expression="x[0]*x[1]*exp(-t)"
55 probe.t=Link(sqe)
56 probe.value=Link(tt,"temperature")
57
58
59 s=Simulation([sqe,constraints,tt,probe],debug=True)
60 s.writeXML()
61 s.run()

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26