def run(dom, stream): constraints=VectorConstrainerOverBox() constraints.domain=Link(dom) constraints.left=[1,0,0] constraints.right=[1,0,0] constraints.top=[0,1,0] constraints.bottom=[0,1,0] constraints.front=[0,0,1] constraints.back=[0,0,1] sqe=Sequencer() sqe.dt_max=0.5 sqe.t_end=1. source=EvaluateExpression() source.domain=Link(dom) source.t=Link(sqe) source.expression=["t","t"] flow=SteadyIncompressibleFlow() flow.domain=Link(dom,"domain") flow.internal_force=Link(source,"out") flow.location_prescribed_velocity=Link(constraints,"location_of_constraint") flow.prescribed_velocity=[0.,0.] ptest=Probe() ptest.expression="(x[0]+x[1]-1.)*t" ptest.t=Link(sqe) ptest.value=Link(flow,"pressure") s=Simulation([sqe,constraints,Simulation([flow],debug=True),ptest],debug=True) s.writeXML(stream) s.run()
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()
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()