Esempio n. 1
0
 def diff_axis(iaxis, operand):
     v = np.array(2, dtype=np.float64)
     v[iaxis] = 1
     d = sym.Derivative()
     return d.resolve(
         (sym.MultiVector(v).scalar_product(d.dnabla(2))) *
         d(operand))
    NArmedStarfish, make_curve_mesh)
# from sumpy.visualization import FieldPlotter
from pytential import bind, sym, norm
from sumpy.kernel import LaplaceKernel, HelmholtzKernel

import logging
logger = logging.getLogger(__name__)

circle = partial(ellipse, 1)

try:
    import matplotlib.pyplot as pt
except ImportError:
    pass

d1 = sym.Derivative()
d2 = sym.Derivative()


def get_sphere_mesh(refinement_increment, target_order):
    from meshmode.mesh.generation import generate_icosphere
    mesh = generate_icosphere(1, target_order)
    from meshmode.mesh.refinement import Refiner

    refiner = Refiner(mesh)
    for i in range(refinement_increment):
        flags = np.ones(mesh.nelements, dtype=bool)
        refiner.refine(flags)
        mesh = refiner.get_current_mesh()

    return mesh
Esempio n. 3
0
mode_nr = 0
k = 0

mesh = make_curve_mesh(starfish, np.linspace(0, 1, nelements + 1),
                       target_order)

from pytential.discretization.qbx import make_upsampling_qbx_discr

discr = make_upsampling_qbx_discr(cl_ctx, mesh, target_order, qbx_order)

nodes = discr.nodes().with_queue(queue)

angle = cl.clmath.atan2(nodes[1], nodes[0])

from pytential import bind, sym
d = sym.Derivative()
op = sym.S("k" if k else 0, sym.var("sigma"))

sigma = cl.clmath.cos(mode_nr * angle)
if k:
    sigma = sigma.astype(np.complex128)

fplot = FieldPlotter(np.zeros(2), extent=5, npoints=500)
from pytential.discretization.target import PointsTarget
fld_in_vol = bind((discr, PointsTarget(fplot.points)), op)(queue,
                                                           sigma=sigma,
                                                           k=k).get()

fld_on_bdry = bind(discr, op)(queue, sigma=sigma, k=k).get()

nodes = discr.nodes().get(queue=queue)