Esempio n. 1
0
def run(dom, stream):
    sqe=Sequencer()
    sqe.t=0
    sqe.t_end=0.05

    constraints=ScalarConstrainerOverBox()
    constraints.domain=Link(dom)
    constraints.top=1
    constraints.bottom=1
    constraints.right=1
    constraints.left=1

    source=EvaluateExpression()
    source.domain=Link(dom)
    source.expression="(x[1]-x[0])*exp(-t)-exp(-t)*x[0]*x[1]"
    source.t=Link(sqe)
    boundaryvalue=EvaluateExpression()
    boundaryvalue.domain=Link(dom)
    boundaryvalue.expression="x[0]*x[1]*exp(-t)"
    boundaryvalue.t=Link(sqe)

    tt=TemperatureAdvection()
    tt.domain=Link(dom)
    tt.temperature=Link(boundaryvalue,"out")
    tt.velocity=numpy.array([1,-1])
    tt.thermal_source=Link(source,"out")
    tt.location_fixed_temperature=Link(constraints,"location_of_constraint")
    tt.fixed_temperature=Link(boundaryvalue,"out")
    tt.safety_factor=0.1

    probe=Probe()
    probe.expression="x[0]*x[1]*exp(-t)"
    probe.t=Link(sqe)
    probe.value=Link(tt,"temperature")


    s=Simulation([sqe,constraints,tt,probe],debug=True)
    s.writeXML(stream)
    s.run()
Esempio n. 2
0
def run(dom, stream):
    sqe = Sequencer()
    sqe.t = 0
    sqe.t_end = 0.05

    constraints = ScalarConstrainerOverBox()
    constraints.domain = Link(dom)
    constraints.top = 1
    constraints.bottom = 1
    constraints.right = 1
    constraints.left = 1

    source = EvaluateExpression()
    source.domain = Link(dom)
    source.expression = "(x[1]-x[0])*exp(-t)-exp(-t)*x[0]*x[1]"
    source.t = Link(sqe)
    boundaryvalue = EvaluateExpression()
    boundaryvalue.domain = Link(dom)
    boundaryvalue.expression = "x[0]*x[1]*exp(-t)"
    boundaryvalue.t = Link(sqe)

    tt = TemperatureAdvection()
    tt.domain = Link(dom)
    tt.temperature = Link(boundaryvalue, "out")
    tt.velocity = numpy.array([1, -1])
    tt.thermal_source = Link(source, "out")
    tt.location_fixed_temperature = Link(constraints, "location_of_constraint")
    tt.fixed_temperature = Link(boundaryvalue, "out")
    tt.safety_factor = 0.1

    probe = Probe()
    probe.expression = "x[0]*x[1]*exp(-t)"
    probe.t = Link(sqe)
    probe.value = Link(tt, "temperature")

    s = Simulation([sqe, constraints, tt, probe], debug=True)
    s.writeXML(stream)
    s.run()
try:
    WORKDIR = os.environ['MODELLIB_WORKDIR']
except KeyError:
    WORKDIR = '.'

dbg = True

dom = RectangularDomain(debug=dbg)
dom.dim = 3
dom.l = [0.5, 1., 1.]
dom.n = [30, 6, 6]
dom.order = 1
dom.integrationOrder = -1

sq = Sequencer(debug=dbg)
sq.t = 0
sq.t_end = 0.8
sq.dt_max = 100.

iob = InterpolateOverBox(debug=dbg)
iob.domain = Link(dom, "domain")
iob.value_left_bottom_front = [-1., 0., 0.]
iob.value_right_bottom_front = [0., 0., 0.]
iob.value_left_bottom_back = [-1., 0., 0.]
iob.value_right_bottom_back = [0., 0., 0.]
iob.value_left_top_front = [-1., 0., 0.]
iob.value_right_top_front = [0., 0., 0.]
iob.value_left_top_back = [-1., 0., 0.]
iob.value_right_top_back = [0., 0., 0.]

# iob.value_left_bottom_front=[-1.,0.]
Esempio n. 4
0
except KeyError:
   WORKDIR='.'


dbg=True

dom=RectangularDomain(debug=dbg)
dom.dim=3
dom.l=[0.5,1.,1.]
dom.n=[30,6,6]
dom.order=1
dom.integrationOrder=-1


sq=Sequencer(debug=dbg)
sq.t=0
sq.t_end=0.8
sq.dt_max=100.

iob=InterpolateOverBox(debug=dbg)
iob.domain=Link(dom,"domain")
iob.value_left_bottom_front=[-1.,0.,0.]
iob.value_right_bottom_front=[0.,0.,0.]
iob.value_left_bottom_back=[-1.,0.,0.]
iob.value_right_bottom_back=[0.,0.,0.]
iob.value_left_top_front=[-1.,0.,0.]
iob.value_right_top_front=[0.,0.,0.]
iob.value_left_top_back=[-1.,0.,0.]
iob.value_right_top_back=[0.,0.,0.]

# iob.value_left_bottom_front=[-1.,0.]