#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 15 15:22:43 2021 @author: Arwin """ from helpers.visualize import show_plane from helpers.create_testobject import plane_with_circle, plane_with_guide plane_size = (100, 200) step_size = 0.01 # Create a plane with a circle in the middle which has a diameter # of 25cm while using a grid with steps of 1cm. The circle has a relative # permittivity of 4.7. epsilon_circle = plane_with_circle(plane_size, step_size, 0.25, 4.7) show_plane(epsilon_circle, step_size) # Create a plane with a guide in the middle which has a width of 50cm # while using a grid with steps of 1cm. The sides of the guide have a relative # permittivity of 4.7. epsilon_guide = plane_with_guide(plane_size, step_size, 0.25, 4.7) show_plane(epsilon_guide, step_size)
step_size = 5 #meters # Define input wave properties frequency = 1e6 #Hz input_angle = 90*np.pi/180 #radians #Define number of farfield samples desired, default 0 farfield_samples = 120 # Define circle in middle of grid as test object circle_diameter = simulation_size[0]*step_size/10 #meters circle_permittivity = 4.7 #relative, can be real or complex epsilon = plane_with_circle(simulation_size, step_size, circle_diameter, circle_permittivity) # Show plane show_plane(np.real(epsilon), step_size,'Simulation grid setup','epsilon') #Calculation of wavelength from user defined frequency wavelength = speed_of_light/frequency #meters wvl = 3e8/frequency #meters, rounded wavelength #Store necessary variables into dictionary for E-field computation simparams = { 'simulation_size': simulation_size, 'step_size': step_size, 'wavelength': wavelength, 'input_angle': input_angle, 'relative_permittivity': epsilon, 'dynamic_sample_distance': True, 'size_limits': [0, 2*circle_diameter, 4*circle_diameter], 'farfield_samples': farfield_samples
# Create epsilon plane simulation_size = (100, 100 ) #number of samples in x- and y-direction, respectively total_size = 500 #size of grid, meters step_size = total_size / simulation_size[0] #meters # Circle in middle circle_diameter = total_size / 10 #meters circle_permittivity = 4.7 #relative (glass) epsilon_circle = plane_with_circle(simulation_size, step_size, circle_diameter, circle_permittivity) # Show plane show_plane(np.real(epsilon_circle), step_size, title="Plane on which the field is incident", plottype='epsilon') # Define input wave properties frequency = 1e6 #Hz wavelength = speed_of_light / frequency #meters theta_i = 0 #degree input_angle = theta_i * np.pi / 180 #radians farfield_samples = 120 #STATIC GRID # Store necessary variables into dictionary for E-field computation simparams = { 'simulation_size': simulation_size, 'step_size': step_size,
frequency = 20e6 wavelength = speed_of_light/frequency input_angle = 120*np.pi/180 # Create a plane with a circle in the middle epsilon_circle = plane_with_circle(plane_size, step_size, 10, 4.7) # Convert grid to dynamic max_size = 4 size_limits = [0, 6, 12] locations, location_sizes, epsilon = grid_to_dynamic(epsilon_circle, step_size, size_limits) # Convert back to test farfield_samples = 0 epsilon_grid = dynamic_to_grid(locations, epsilon, location_sizes, plane_size, step_size) show_plane(np.real(epsilon_grid), step_size) # Plot location points on plane fig = plt.figure() for loc in locations: plt.scatter(loc[0], loc[1], s=5, color='black') plt.gca().set_aspect('equal') plt.ylim(0, plane_size[1]) plt.xlim(0, plane_size[0]) plt.xlabel("X [m]") plt.ylabel("Y [m]") # Calculate incident wave on locations E_0 = np.sqrt(mu_0/epsilon_0) # Amplitude of incident wave E_incident = create_planewave(locations, E_0, wavelength, input_angle, plane_size, step_size)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 15 15:24:02 2021 @author: Arwin """ import numpy as np from scipy.constants import speed_of_light from helpers.visualize import show_plane from helpers.create_incident_wave import create_planewave plane_size = (200, 100) step_size = 0.01 # Create a 0.75x0.5meter plane with the amplitude of the electric field of a # plane wave with a frequency of 1Ghz with an incident angle of 45 degrees. frequency = 1e9 wavelength = speed_of_light / frequency E_plane = create_planewave(plane_size, step_size, 1, wavelength, 45 * np.pi / 180) show_plane(np.real(E_plane), step_size)
input_angle = 120 * np.pi / 180 diameter_cylinder = 50 cylinder_permittivity = 4.7 # Create a plane with a circle in the middle epsilon_circle = plane_with_circle(plane_size, step_size, diameter_cylinder, cylinder_permittivity) # Convert grid to dynamic max_size = 4 size_limits = [0, 200, 400] locations, location_sizes, permittivity = grid_to_dynamic( epsilon_circle, step_size, size_limits) # Calculate incident wave on locations E_0 = np.sqrt(mu_0 / epsilon_0) #Amplitude of incident wave in background medium E_incident = create_planewave(locations, E_0, wavelength, input_angle, plane_size, step_size) # Calculate the scattered field E = martin98(locations, E_incident, permittivity, location_sizes, wavelength, step_size) # Convert dynamic locations to grid E_grid = dynamic_to_grid(locations, E, location_sizes, plane_size, step_size) # Show the scattering show_plane(np.absolute(E_grid.T), step_size, title="E field of algorithm solution")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 15 15:24:02 2021 @author: Arwin """ import numpy as np from scipy.constants import speed_of_light from helpers.visualize import show_plane from helpers.create_incident_wave_bessel import create_planewave from scipy.special import jv plane_size = (50, 50) step_size = 0.05 # Create a 0.75x0.5meter plane with the amplitude of the electric field of a # plane wave with a frequency of 1Ghz with an incident angle of 45 degrees. frequency = 1e9 wavelength = speed_of_light / frequency theta_i = 45 incident_angle = theta_i * np.pi / 180 method = "bessel" E_0 = 1 epsilon_B = 1 E_plane = create_planewave(plane_size, step_size, E_0, wavelength, incident_angle, 1, method) show_plane(np.real(E_plane), step_size, title='Incident field (Bessel) for ' r'$\theta_i$ = %i' % theta_i)
from domain_integral_equation import domain_integral_equation from helpers.create_incident_wave_bessel import create_planewave from validation.TEcil import Analytical_2D_TE # Create epsilon plane simulation_size = (50, 50) # Circle in middle step_size = 0.05 #meters circle_diameter = 0.7 #meters circle_permittivity = 20 #relative epsilon = plane_with_circle(simulation_size, step_size, circle_diameter, circle_permittivity) # Show plane show_plane(epsilon, step_size, title="Plane on which the field is incident") # Define input wave properties frequency = 1e9 wavelength = speed_of_light / frequency theta_i = 270 input_angle = theta_i * np.pi / 180 # Store necessary variables into dictionary for E-field computation simparams = { 'simulation_size': simulation_size, 'step_size': step_size, 'wavelength': wavelength, 'input_angle': input_angle, 'relative_permittivity': epsilon, 'method': 'bessel'
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 15 15:33:02 2021 @author: Arwin """ import numpy as np from helpers.visualize import show_plane step_size = 0.01 size = 25 test_values = range(np.square(size)) show_plane(np.reshape(test_values, (size, size)), step_size)