global bx_scale, by_scale bx_scale = 1.04 by_scale = 1.04 # origin o = Node(0.0, 0.0) # sphere surface nodes a = Node(-Rn, 0.0) b = Node(0.0, Rn) # inflow boundary nodes inflow_nodes = [] np = 16 y_top = by_scale * y_from_x(b.x / bx_scale, M_inf, theta=0.0, axi=1, R_nose=Rn) dy = y_top / (np - 1) for iy in range(np): y = dy * iy x = -bx_scale * x_from_y(y / by_scale, M_inf, theta=0.0, axi=1, R_nose=Rn) inflow_nodes.append(Node(x, y)) print inflow_nodes[-1].str() # curves west = Spline(inflow_nodes) south = Line(inflow_nodes[0], a) north = Line(inflow_nodes[-1], b) east = Arc(a, b, o) # Define the blocks, boundary conditions and set the discretisation. nnx = 60 nny = 60 nbx = 4 nby = 4 betaNS = 1.0 # clustering
# We have made sure that our query surface is within the bounds of the original. q0 = Vector3(0.0, -L2, L2) q1 = Vector3(0.0, -L2, 0.0) q2 = Vector3(0.0, L2, 0.0) q3 = Vector3(0.0, L2, L2) qsurf2 = CoonsPatch(q0, q1, q2, q3, "query_surface") east = MappedSurface(qsurf2, surf1) # The outer mesh surface is derived from Billig's shock-shape correlation. # In preparation for defining nodes, generate a few sample points # along the expected shock position. e = [] # will use a list to keep the nodes for the shock boundary for y in [0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2]: y *= Dmax/2.0 # scale up to cover the base of the vehicle # Note that we lie about the cone angle. Detached shock. x = x_from_y(y, M_inf, theta=20.0/180.0*pi, axi=1, R_nose=Rnose) # print "x=", x, "y=", y # the outer boundary should be a little further than the shock itself e.append( Vector(-1.2*x, 1.2*y, 0.0) ) shock = Spline(e) # print "shock=", shock surf2 = RevolvedSurface(shock, "shock_surface") L3 = e[-1].y / sqrt(2.0) qs0 = Vector3(0.0, -L3, L3) qs1 = Vector3(0.0, -L3, 0.0) qs2 = Vector3(0.0, L3, 0.0) qs3 = Vector3(0.0, L3, L3) qsurf2 = CoonsPatch(qs0, qs1, qs2, qs3, "query_surface_shock") west = MappedSurface(qsurf2, surf2) p0 = west.eval(0.0, 0.0)
def zero_func(y): # from cfpylib.gasdyn.billig import x_from_y return -bx_scale * x_from_y( y / by_scale, M_inf, theta=0.0, axi=1, R_nose=Rn) - y / tan(pi - theta)
u=0.0, v=0.0, T=[T_inf, T_inf], massf=[ 1.0, ]) # Build the geometry from the bottom-up, starting with nodes... # Scale it with the cylinder radius. # In preparation for defining nodes, generate a few sample points # along the expected shock position # (which is estimated via Billig's correlation). xys = [] for y in [0.0, 0.5, 1.0, 1.5, 2.0, 2.5]: x = x_from_y(y, M_inf, theta=0.0, axi=0, R_nose=Rc) xys.append((x, y)) # a new coordinate pair print "x=", x, "y=", y a = Node(-Rc, 0.0, label="a") b = Node(0.0, Rc, label="b") c = Node(0.0, 0.0, label="c") d = [] # will use a list to keep the nodes for the shock boundary for x, y in xys: # the outer boundary should be a little further than the shock itself d.append(Node(-1.1 * x, 1.1 * y, label="d")) # ...then lines, arcs, etc, that will make up the block boundaries. axis = Line(d[0], a) # first-point of shock to nose of cylinder cylinder = Arc(a, b, c) shock = Spline(d)