Exemplo n.º 1
0
 def by(x, y):
     from pyphare.pharein.global_vars import sim
     Lx = sim.simulation_domain()[0]
     Ly = sim.simulation_domain()[1]
     w1 = 0.2
     w2 = 1.0
     x0 = (x - 0.5 * Lx)
     y1 = (y - 0.3 * Ly)
     y2 = (y - 0.7 * Ly)
     w3 = np.exp(-(x0 * x0 + y1 * y1) / (w2 * w2))
     w4 = np.exp(-(x0 * x0 + y2 * y2) / (w2 * w2))
     w5 = 2.0 * w1 / w2
     return (w5 * x0 * w3) + (-w5 * x0 * w4)
Exemplo n.º 2
0
 def bx(x, y):
     from pyphare.pharein.global_vars import sim
     Lx = sim.simulation_domain()[0]
     Ly = sim.simulation_domain()[1]
     w1 = 0.2
     w2 = 1.0
     x0 = (x - 0.5 * Lx)
     y1 = (y - 0.3 * Ly)
     y2 = (y - 0.7 * Ly)
     w3 = np.exp(-(x0 * x0 + y1 * y1) / (w2 * w2))
     w4 = np.exp(-(x0 * x0 + y2 * y2) / (w2 * w2))
     w5 = 2.0 * w1 / w2
     v1 = -1
     v2 = 1.
     return v1 + (v2 - v1) * (S(y, Ly * 0.3, 0.5) - S(y, Ly * 0.7, 0.5)) + (
         -w5 * y1 * w3) + (+w5 * y2 * w4)
Exemplo n.º 3
0
 def vz(x):
     from pyphare.pharein.global_vars import sim
     L = sim.simulation_domain()
     return 0.1 * np.sin(2 * np.pi * x / L[0])
Exemplo n.º 4
0
 def vx(x):
     from pyphare.pharein.global_vars import sim
     L = sim.simulation_domain()[0]
     v1 = 0.
     v2 = 0.
     return v1 + (v2 - v1) * (S(x, L * 0.25, 1) - S(x, L * 0.75, 1))
Exemplo n.º 5
0
 def by(x):
     from pyphare.pharein.global_vars import sim
     L = sim.simulation_domain()[0]
     v1 = 0.125
     v2 = 4.0
     return v1 + (v2 - v1) * (S(x, L * 0.2, 1) - S(x, L * 0.8, 1))
Exemplo n.º 6
0
 def density(x):
     from pyphare.pharein.global_vars import sim
     L = sim.simulation_domain()[0]
     v1 = 1
     v2 = 1.
     return v1 + (v2 - v1) * (S(x, L * 0.2, 1) - S(x, L * 0.8, 1))
Exemplo n.º 7
0
 def by(x, y):
     from pyphare.pharein.global_vars import sim
     Lx = sim.simulation_domain()[0]
     Ly = sim.simulation_domain()[1]
     return 0.2
Exemplo n.º 8
0
 def density(x, y):
     from pyphare.pharein.global_vars import sim
     L = sim.simulation_domain()[1]
     return 0.2 + 1. / np.cosh((y - L * 0.3) / 0.5)**2 + 1. / np.cosh(
         (y - L * 0.7) / 0.5)**2
Exemplo n.º 9
0
 def density(x, y):
     from pyphare.pharein.global_vars import sim
     Lx = sim.simulation_domain()[0]
     return 1.
Exemplo n.º 10
0
 def vy(*xyz):
     from pyphare.pharein.global_vars import sim
     L = sim.simulation_domain()
     _ = lambda i: 0.1 * np.cos(2 * np.pi * xyz[i] / L[i])
     return np.asarray([_(i) for i, v in enumerate(xyz)]).prod(axis=0)
Exemplo n.º 11
0
 def _density(*xyz):
     from pyphare.pharein.global_vars import sim
     hL = np.array(sim.simulation_domain()) / 2
     _ = lambda i: -(xyz[i] - hL[i])**2
     return .3 + np.exp(sum([_(i) for i, v in enumerate(xyz)]))
Exemplo n.º 12
0
def density_2d_periodic(sim, x, y):
    xmax, ymax = sim.simulation_domain()
    background_particles = 0.3  # avoids 0 density
    xx, yy = meshify(x, y)
    return np.exp(-(xx - 0.5 * xmax)**2) * np.exp(
        -(yy - ymax / 2.)**2) + background_particles
Exemplo n.º 13
0
def density_1d_periodic(sim, x):
    xmax = sim.simulation_domain()[0]
    background_particles = 0.3  # avoids 0 density
    return 1.0 / np.cosh((x - xmax * 0.5)**2 + background_particles)