Skip to content

Commit

Permalink
add 2nd 3D experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
Class04 Course committed Jan 18, 2024
1 parent 85d87e0 commit 6831529
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 8 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,18 +516,43 @@ TODO: ADD A SENTENCE TO EXPLAIN THE RESULTS

It is also possible using the [3D_plotter_animations.jl](./docs/3D_plotter_animations.jl) to generate some animations. To generate the animation we iterate over the $n_z$-values and we take the corresponding field `[:, :, k]` entry (where `k` is the iterate index). The PML layer is represented by the black rectangle.

|![](./docs/3D/Ex_3D_pml_nx_256_ny_256_nz_100_alpha_0.0.gif)|![](./docs/3D/Ey_3D_pml_nx_256_ny_256_nz_100_alpha_0.0.gif)|![](./docs/3D/Ez_3D_pml_nx_256_ny_256_nz_100_alpha_0.0.gif)|
|![](./docs/3D/Ex_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Ey_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Ez_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|
|:--:| :--: | :--: |
| *Ex field*| *Ey field* | *Ez field* |

|![](./docs/3D/Hx_3D_pml_nx_256_ny_256_nz_100_alpha_0.0.gif)|![](./docs/3D/Hy_3D_pml_nx_256_ny_256_nz_100_alpha_0.0.gif)|![](./docs/3D/Hz_3D_pml_nx_256_ny_256_nz_100_alpha_0.0.gif)|
|![](./docs/3D/Hx_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Hy_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Hz_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|
|:--:| :--: | :--: |
| *Hx field*| *Hy field* | *Hz field*|

TODO: ADD A SENTENCE TO EXPLAIN THE RESULTS


2. $\text{pml alpha}=0.1$ (i.e. slightly PML boundary)

By running the [3D_plotter_surfaces.jl](./docs/3D_plotter_surfaces.jl) file we get the value of each field ($E_x$, $E_y$, $E_z$, $H_x$, $H_x$, $H_z$) as a slice at index $nz/2$ (or $nz/2 - 1$).

|![](./docs/3D/Ex_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.png)|![](./docs/3D/Ey_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.png)|![](./docs/3D/Ez_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.png)|
|:--:| :--: | :--: |
| *Ex field at nz/2*| *Ey field at nz/2* | *Ez field at nz/2* |

|![](./docs/3D/Hx_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.png)|![](./docs/3D/Hy_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.png)|![](./docs/3D/Hz_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.png)|
|:--:| :--: | :--: |
| *Hx field at nz/2*| *Hy field at nz/2* | *Hz field at nz/2-1* |

TODO: ADD A SENTENCE TO EXPLAIN THE RESULTS

It is also possible using the [3D_plotter_animations.jl](./docs/3D_plotter_animations.jl) to generate some animations. To generate the animation we iterate over the $n_z$-values and we take the corresponding field `[:, :, k]` entry (where `k` is the iterate index). The PML layer is represented by the black rectangle.

|![](./docs/3D/Ex_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Ey_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Ez_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|
|:--:| :--: | :--: |
| *Ex field*| *Ey field* | *Ez field* |

|![](./docs/3D/Hx_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Hy_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|![](./docs/3D/Hz_3D_pml_nx_256_ny_256_nz_100_alpha_0.1.gif)|
|:--:| :--: | :--: |
| *Hx field*| *Hy field* | *Hz field*|

TODO: ADD A SENTENCE TO EXPLAIN THE RESULTS

3. $\text{pml alpha}=5.0$ (i.e. PML boundary)

## Testing
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/2D_maxwell_pml_xPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Use the Finite Difference Time Domain (FDTD) solver to solve Maxwell's equations
ENV["GKSwstype"]="nul"
if isdir("../docs/viz_out_2D")==false mkdir("../docs/viz_out_2D") end
loadpath = "../docs/viz_out_2D/"; anim = Animation(loadpath,String[])
println("Animation directory: $(anim.dir)")
if do_test==false println("Animation directory: $(anim.dir)") end
iframe = 0
end

Expand Down
15 changes: 10 additions & 5 deletions scripts/3D_maxwell_pml_xPU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Update the PML for the Ez field in the z-direction
end

"""
maxwell(nx_, ny_, nz_, nt_, pml_alpha_; do_visu=false, do_check=true, do_test=true)
maxwell(nx_, ny_, nz_, nt_, pml_alpha_; do_visu=false, do_test=true)
Use the Finite Difference Time Domain (FDTD) solver to solve Maxwell's equations
Expand Down Expand Up @@ -244,7 +244,9 @@ Use the Finite Difference Time Domain (FDTD) solver to solve Maxwell's equations
@parallel compute_d_xa!(Ey, dx_Ey)
@parallel (1:size(Hz, 1), 1:size(Hz, 2), 1:size(Hz, 3)) update_Hz!(Hz, dt, μ0, σ, Ex, dy_Ex, Ey, dx_Ey, dx, dy)

println(it)
if do_test == false
println(it)
end
end

# Visualisation
Expand Down Expand Up @@ -273,9 +275,12 @@ end

#maxwell()

#maxwell(nx_, ny_, nz_, nt_, pml_alpha_; do_visu=false, do_check=true, do_test=true)
#maxwell(100, 100, 100, 1000, 0.1; do_visu=true, do_test=false)
#maxwell(nx_, ny_, nz_, nt_, pml_alpha_; do_visu=false, do_test=true)

# Functions used for testing
#maxwell(100, 100, 100, 1000, 0.1; do_visu=true, do_test=false)
#maxwell(100, 100, 100, 100, 0.1; do_visu=true, do_test=true)

#maxwell(256, 256, 100, 15000, 0.0, do_visu=true, do_test=false)
# Function used for the simulations in README.md
#maxwell(256, 256, 100, 15000, 0.0, do_visu=true, do_test=false)
#maxwell(256, 256, 100, 15000, 0.1, do_visu=true, do_test=false)

0 comments on commit 6831529

Please sign in to comment.