1 |
jgs |
147 |
# $Id$ |
2 |
|
|
# |
3 |
|
|
# small test problem fro temperture advection: |
4 |
|
|
# |
5 |
|
|
# T=x0*x1*exp(-t), v=[1,-1] |
6 |
|
|
# |
7 |
|
|
from escript.modelframe import Link,Simulation |
8 |
|
|
from modellib.geometry import RectangularDomain,ScalarConstrainer |
9 |
|
|
from modellib.input import Sequencer |
10 |
|
|
from modellib.probe import Probe,EvaluateExpression |
11 |
|
|
from modellib.temperature import TemperatureAdvection |
12 |
|
|
import numarray |
13 |
|
|
|
14 |
|
|
dom=RectangularDomain() |
15 |
|
|
dom.order=2 |
16 |
|
|
|
17 |
|
|
sqe=Sequencer() |
18 |
|
|
sqe.t=0 |
19 |
|
|
sqe.t_end=0.1 |
20 |
|
|
|
21 |
|
|
constraints=ScalarConstrainer() |
22 |
|
|
constraints.domain=Link(dom) |
23 |
|
|
constraints.top=1 |
24 |
|
|
constraints.bottom=1 |
25 |
|
|
constraints.right=1 |
26 |
|
|
constraints.left=1 |
27 |
|
|
|
28 |
|
|
source=EvaluateExpression() |
29 |
|
|
source.domain=Link(dom) |
30 |
|
|
source.expression="(x[1]-x[0])*exp(-t)-exp(-t)*x[0]*x[1]" |
31 |
|
|
source.t=Link(sqe) |
32 |
|
|
boundaryvalue=EvaluateExpression() |
33 |
|
|
boundaryvalue.domain=Link(dom) |
34 |
|
|
boundaryvalue.expression="x[0]*x[1]*exp(-t)" |
35 |
|
|
boundaryvalue.t=Link(sqe) |
36 |
|
|
|
37 |
|
|
tt=TemperatureAdvection() |
38 |
|
|
tt.domain=Link(dom) |
39 |
|
|
tt.temperature=Link(boundaryvalue,"out") |
40 |
|
|
tt.velocity=numarray.array([1,-1,0]) |
41 |
|
|
tt.thermal_source=Link(source,"out") |
42 |
|
|
tt.location_fixed_temperature=Link(constraints,"location_of_constraint") |
43 |
|
|
tt.fixed_temperature=Link(boundaryvalue,"out") |
44 |
|
|
tt.safety_factor=0.01 |
45 |
|
|
|
46 |
|
|
probe=Probe() |
47 |
|
|
probe.expression="x[0]*x[1]*exp(-t)" |
48 |
|
|
probe.t=Link(sqe) |
49 |
|
|
probe.value=Link(tt,"temperature") |
50 |
|
|
|
51 |
|
|
|
52 |
jgs |
148 |
s=Simulation([sqe,dom,tt,probe],debug=True) |
53 |
jgs |
147 |
s.writeXML() |
54 |
|
|
s.run() |