Пример #1
0
def value_Bx(x, y, z):
    Bx = 0
    return Bx

def value_By(x, y, z):
    By = 0
    return By

def value_Bz(x, y, z):
    if (x < pml_left_end or x >= pml_right_end):
        Bz=0
    else: 
        Bz = np.sin(2*np.pi/internal_width*(x - pml_left_end))
    return Bz

field = hichi.PSTDField(field_size, min_coords, field_step, time_step)
# field = hichi.PSATDField(field_size, min_coords, field_step, time_step)
# field = hichi.PSATDTimeStraggeredField(field_size, min_coords, field_step, time_step)
# field = hichi.YeeField(field_size, min_coords, field_step, time_step) 
field.set_E(value_Ex, value_Ey, value_Ez)
field.set_B(value_Bx, value_By, value_Bz)
field.set_PML(int(pml_size.x), int(pml_size.y), int(pml_size.z))


# ------------------- show -------------------

import matplotlib.pyplot as plt
import matplotlib.animation as animation

Nx = int(field_size.x)
Ny = int(field_size.y)
Пример #2
0

def value_By(x, y, z):
    By = np.sin(2 * np.pi / (max_coords.z - min_coords.z) * z)
    return By


def value_Bz(x, y, z):
    Bz = 0
    return Bz


grid_step = (max_coords - min_coords) / grid_size
time_step = 1e-12

field = hichi.PSTDField(grid_size, min_coords, grid_step, time_step)
# field = hichi.PSATDField(grid_size, min_coords, grid_step, time_step)
# field = hichi.PSATDSField(grid_size, min_coords, grid_step, time_step)
# field = hichi.YeeField(grid_size, min_coords, grid_step, time_step)
field.set_E(value_Ex, value_Ey, value_Ez)
field.set_B(value_Bx, value_By, value_Bz)

#show
import matplotlib.pyplot as plt
import matplotlib.animation as animation

N = 37
x = np.arange(0, 3.5, 3.5 / N)
z = np.arange(0, 2 * np.pi, 2 * np.pi / N)

Пример #3
0
field_1.set_B(null_value, null_value, field_value_1)
field_1.convert_fields_poisson_equation()

# ------- create the second pulse --------------


def field_value_2(x, y, z):
    return np.exp(-x**2 - y**2) * np.sin(6 * x)  # omega=6


grid_size_2 = hichi.Vector3d(256, 256, 1)
d2 = (max_coords.x - min_coords.x) / grid_size_2.x
grid_step_2 = hichi.Vector3d(d2, d2, d2)
time_step_2 = 0.025 / hichi.c  # PSTD Courant condition is taken into account

field_2 = hichi.PSTDField(grid_size_2, min_coords, grid_step_2, time_step_2)
field_2.set_E(null_value, field_value_2, null_value)
field_2.set_B(null_value, null_value, field_value_2)

# ------ transform fields ---------------------

rotation_mapping_z_axis = hichi.RotationMapping(hichi.Axis.Z, hichi.pi / 3)
shift_mapping_1 = hichi.ShiftMapping(hichi.Vector3d(-6.5, -4.0, 0.0))
shift_mapping_2 = hichi.ShiftMapping(hichi.Vector3d(5.0, -4.0, 0.0))
shift_mapping_3 = hichi.ShiftMapping(hichi.Vector3d(-7.0, 7.0, 0.0))

res_field = (0.5*field_2.apply_mapping(shift_mapping_1) + field_1 + (field_2*0.8).apply_mapping(shift_mapping_2))\
                .apply_mapping(rotation_mapping_z_axis) + field_1.apply_mapping(shift_mapping_3)

# ------ update fields ------------------------