コード例 #1
0
rrange = np.sqrt(xrange**2.0 + zrange**2.0)

trange = np.arange(10e-3, 10.0, 1.0, dtype='f')  # step was 10e-3
trange = trange.reshape(1, 1, trange.shape[0])

greensconvolution_params = read_greensconvolution()
greensconvolution_params.get_opencl_context("GPU")

cpu_starttime = time.time()

cpu_result = greensconvolution_integrate(greensconvolution_params,
                                         zrange,
                                         rrange,
                                         trange,
                                         0.0,
                                         composite_k,
                                         composite_rho,
                                         composite_c,
                                         1.0, (),
                                         kernel="openmp_interpolator")

cpu_elapsed = time.time() - cpu_starttime

starttime = time.time()

result = greensconvolution_integrate(greensconvolution_params,
                                     zrange,
                                     rrange,
                                     trange,
                                     0.0,
                                     composite_k,
コード例 #2
0
            rmat = np.sqrt(dxmat**2.0 + dymat**2.0 + zmat**2.0)
            rvec = np.reshape(rmat, np.prod(rmat.shape))

            rmat_extraterm = np.sqrt(
                dxmat**2.0 + dymat**2.0 +
                (zmat * 3)**2.0)  # for extra image sources of barrier
            rvec_extraterm = np.reshape(rmat_extraterm,
                                        np.prod(rmat_extraterm.shape))

            # WARNING: 2.0 in leading coefficient here is a fudge factor!... where did we drop it???
            # Answer: We didn't. There's an image source reflected in the flash
            # plane required to satisfy the no-flow boundary condition on the
            # flash plane.
            Tg[1:, jidx, iidx] += dx * dy * flash_energy * 2.0 * (
                greensconvolution_integrate(
                    greensconvolution_params, zvec, rvec,
                    t_heatsim2 + dt_heatsim2 / 2.0, composite_k, composite_rho,
                    composite_c) + greensconvolution_integrate(
                        greensconvolution_params, zvec, rvec_extraterm,
                        t_heatsim2 + dt_heatsim2 / 2.0, composite_k,
                        composite_rho, composite_c))
            pass
        pass
    pass

if calc_greensfcn_accel:
    # accelerate green's function by using theory for back face
    (ymat, xmat) = np.meshgrid(y, x, indexing='ij')
    zmat_accel = np.ones((ny, nx), dtype='d') * z_thick
    barrier_location = ((xmat > barrier_min_x) & (xmat < barrier_max_x) &
                        (ymat > barrier_min_y) & (ymat < barrier_max_y))
    zmat_accel[barrier_location] = barrier_min_z
コード例 #3
0
            rmat_extraterm = np.sqrt(
                dxmat**2.0 + dymat**2.0 +
                (zmat * 3)**2.0)  # for extra image sources of barrier
            rvec_extraterm = rmat_extraterm.reshape(
                np.prod(rmat_extraterm.shape), 1)

            # WARNING: 2.0 in leading coefficient here is a fudge factor!... where did we drop it???
            # Answer: We didn't. There's an image source reflected in the flash
            # plane required to satisfy the no-flow boundary condition on the
            # flash plane.
            Tg[1:, jidx, iidx] += (greensconvolution_integrate(
                greensconvolution_params,
                zvec.astype(np.float32),
                rvec.astype(np.float32),
                t_heatsim2.astype(np.float32).reshape(1, nt_heatsim2) +
                dt_heatsim2 / 2.0,
                composite_k,
                composite_rho,
                composite_c,
                dx * dy * flash_energy * 2.0, (0, ),
                kernel=gc_kernel) + greensconvolution_integrate(
                    greensconvolution_params,
                    zvec.astype(np.float32),
                    rvec_extraterm.astype(np.float32),
                    t_heatsim2.astype(np.float32).reshape(1, nt_heatsim2) +
                    dt_heatsim2 / 2.0,
                    composite_k,
                    composite_rho,
                    composite_c,
                    dx * dy * flash_energy * 2.0, (0, ),
                    kernel=gc_kernel))
コード例 #4
0
        print("i=%d/%d" % (iidx, nx))
        if iidx != measi or jidx != measj:
            continue

        dxmat = x[iidx] - xmat
        dymat = y[jidx] - ymat
        rmat = np.sqrt(dxmat**2.0 + dymat**2.0 + zmat**2.0)
        rvec = np.reshape(rmat, np.prod(rmat.shape))

        # WARNING: 2.0 in leading coefficient here is a fudge factor!... where did we drop it???
        # Answer: We didn't. There's an image source reflected in the flash
        # plane required to satisfy the no-flow boundary condition on the
        # flash plane.
        Tg[1:, jidx,
           iidx] += dx * dy * flash_energy * 2.0 * greensconvolution_integrate(
               greensconvolution_params, zvec, rvec, t_heatsim2 +
               dt_heatsim2 / 2.0, composite_k, composite_rho, composite_c)
        pass
    pass

if calc_heatsim2:
    hs2_start = datetime.datetime.now()
    (ADI_params,
     ADI_steps) = heatsim2.setup(z[0], y[0], x[0], dz, dy, dx, nz, ny, nx,
                                 dt_heatsim2, materials, boundaries,
                                 volumetric, material_elements,
                                 boundary_z_elements, boundary_y_elements,
                                 boundary_x_elements, volumetric_elements)

    T = np.zeros((nt_heatsim2 + 1, nz, ny, nx), dtype='d')