コード例 #1
0
        bh = new_bdy.dt * new_bdy.speed.min()
        # construct embedded boundary
        new_ebdy = EmbeddedBoundary(new_bdy, True, M, bh, pad_zone, MOL.step)
        new_ebdyc = EmbeddedBoundaryCollection([
            new_ebdy,
        ])
        new_ebdyc.register_grid(grid)

        # let's get the points that need to be interpolated to
        gp = new_ebdyc.grid_phys
        ap = new_ebdyc.radial_pts

        aax = np.concatenate([gp.x, ap.x])
        aay = np.concatenate([gp.y, ap.y])
        aap = PointSet(x=aax, y=aay)
        AP_key = ebdy.register_points(aap.x, aap.y)

        # now we need to interpolate onto things
        AEP = ebdy.registered_partitions[AP_key]

        # generate a holding ground for the new c
        c_new = EmbeddedFunction(new_ebdyc)
        c_new.zero()

        # get departure points
        xd_all = np.zeros(aap.N)
        yd_all = np.zeros(aap.N)

        # advect those in the annulus
        c1, c2, c3 = AEP.get_categories()
        c1n, c2n, c3n = AEP.get_category_Ns()
コード例 #2
0
ファイル: coupled_simplify.py プロジェクト: dbstein/ipde
        bh = new_bdy.dt * new_bdy.speed.min()
        # construct embedded boundary
        new_ebdy = EmbeddedBoundary(new_bdy, True, M, bh, pad_zone, MOL.step)
        new_ebdyc = EmbeddedBoundaryCollection([
            new_ebdy,
        ])
        new_ebdyc.register_grid(grid)

        # let's get the points that need to be interpolated to
        gp = new_ebdyc.grid_pna
        ap = new_ebdyc.radial_pts

        aax = np.concatenate([gp.x, ap.x])
        aay = np.concatenate([gp.y, ap.y])
        aap = PointSet(x=aax, y=aay)
        AP_key = ebdy.register_points(aap.x, aap.y)

        # now we need to interpolate onto things
        AEP = ebdy.registered_partitions[AP_key]

        # generate a holding ground for the new c
        c_new = EmbeddedFunction(new_ebdyc)
        c_new.zero()

        # get departure points
        xd_all = np.zeros(aap.N)
        yd_all = np.zeros(aap.N)

        # advect those in the annulus
        c1, c2, c3 = AEP.get_categories()
        c1n, c2n, c3n = AEP.get_category_Ns()
コード例 #3
0
xn = gx.copy()
yn = gy.copy()
resx, resy = objective_function(xn, yn)
res = np.hypot(resx, resy).max()
tol = 1e-12
i = 0
print('\nInverting departure point system')
while res > tol:
	Jxx, Jxy, Jyx, Jyy = Jacobian(xn, yn)
	det = Jxx*Jyy - Jxy*Jyx
	idet = 1.0/det
	dx = -idet*(Jyy*resx - Jyx*resy)
	dy = -idet*(-Jxy*resx + Jxx*resy)
	xn = xn + dx
	yn = yn + dy
	ebdy.register_points(xn, yn, nearly_radial=True)
	# xn += dx
	# yn += dy
	resx, resy = objective_function(xn, yn)
	res = np.hypot(resx, resy).max()
	i += 1
	print(i, '{:0.1e}'.format(res))
cu2 = ebdy.interpolate_radial_to_points(c, xn, yn)
time_departure = time.time()-st

### linearized departure based semi-lagrangian advector
st = time.time()
# get departure points
nt = np.prod(xr.shape)
SLM = np.zeros([nt,] + [2,2], dtype=float)
SLR = np.zeros([nt,] + [2,], dtype=float)
コード例 #4
0
])
new_ebdyc.register_grid(grid)
print('Time to generate new ebdy and register grid:  {:0.1f}'.format(
    (time.time() - st) * 1000))
st = time.time()

# let's get the points that need to be interpolated to
gp = new_ebdyc.grid_pna
ap = new_ebdyc.radial_pts

from pybie2d.point_set import PointSet
aax = np.concatenate([gp.x, ap.x])
aay = np.concatenate([gp.y, ap.y])
aap = PointSet(x=aax, y=aay)

AP_key = ebdy.register_points(aap.x, aap.y)
print('Time to register new points with old ebdy |A: {:0.1f}'.format(
    (time.time() - st) * 1000))
st = time.time()

# register these with ebdy
gp_key = ebdy.register_points(gp.x, gp.y)
print('Time to register new points with old ebdy |g: {:0.1f}'.format(
    (time.time() - st) * 1000))
st = time.time()
ap_key = ebdy.register_points(ap.x, ap.y, nearly_radial=True)
print('Time to register new points with old ebdy |a: {:0.1f}'.format(
    (time.time() - st) * 1000))
st = time.time()

# now we need to interpolate onto things
コード例 #5
0
                                coordinate_tolerance=1e-12)
    new_ebdyc = EmbeddedBoundaryCollection([
        new_ebdy,
    ])
    umax = np.sqrt((u * u + v * v).data, where=np.logical_not(u.mask)).max()
    new_ebdyc.register_grid(grid, danger_zone_distance=2 * umax * dt)

    # let's get the points that need to be interpolated to
    gp = new_ebdyc.grid_pna
    ap = new_ebdyc.radial_pts

    aax = np.concatenate([gp.x, ap.x])
    aay = np.concatenate([gp.y, ap.y])
    aap = PointSet(x=aax, y=aay)
    AP_key = ebdy.register_points(aap.x,
                                  aap.y,
                                  danger_zone=new_ebdy.in_danger_zone,
                                  gi=new_ebdy.guess_inds)

    # now we need to interpolate onto things
    AEP = ebdy.registered_partitions[AP_key]

    # generate a holding ground for the new c
    c_new = EmbeddedFunction(new_ebdyc)
    c_new.zero()

    # get departure points
    xd_all = np.zeros(aap.N)
    yd_all = np.zeros(aap.N)

    # advect those in the annulus
    c1, c2, c3 = AEP.get_categories()
コード例 #6
0
                                    qfs_fsuf=qfs_fsuf,
                                    coordinate_scheme=coordinate_scheme,
                                    coordinate_tolerance=1e-8)
        new_ebdyc = EmbeddedBoundaryCollection([
            new_ebdy,
        ])
        new_ebdyc.register_grid(grid)

        # let's get the points that need to be interpolated to
        gp = new_ebdyc.grid_pna
        ap = new_ebdyc.radial_pts

        aax = np.concatenate([gp.x, ap.x])
        aay = np.concatenate([gp.y, ap.y])
        aap = PointSet(x=aax, y=aay)
        AP_key = ebdy.register_points(aap.x, aap.y)

        # now we need to interpolate onto things
        AEP = ebdy.registered_partitions[AP_key]

        # generate a holding ground for the new c
        c_new = EmbeddedFunction(new_ebdyc)
        c_new.zero()

        # advect those in the annulus
        c1, c2, c3 = AEP.get_categories()
        c1n, c2n, c3n = AEP.get_category_Ns()
        c12 = np.logical_or(c1, c2)
        # category 1 and 2 (use Eulerian scheme)
        cx, cy = ebdyc.gradient2(c)
        ecnew = c - dt * (u * cx + v * cy) - dt * scaled_nonlinearity(c)