Chemical Diffusion Using Fast Fourier Transform

2023 eesc w3400 n.w
1 / 33
Embed
Share

Explore the computational analysis of chemical diffusion through the application of the 2D FFT method in Computational Earth Science. Learn about variables, conservation of mass principles, and the computational procedures involved in studying chemical diffusion. Discover the correlation between low and high concentrations, diffusivity, and the mathematical transformations utilized in the analysis.

  • Chemical Diffusion
  • Fast Fourier Transform
  • Computational Earth Science
  • Conservation of Mass
  • Mathematical Analysis

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. 2023 EESC W3400 Lec 17: Chemical diffusion computed with the 2D FFT Computational Earth Science Bill Menke, Instructor Emily Glazer, Teaching Assistant TR 2:40 3:55

  2. Today Additional Uses of the Fast Fourier Transform Chemical diffusion (but same as heat diffusion)

  3. Variables ? (volume fraction) Concentration of chemical Source of chemical ? (volume fraction per unit time) Flux of chemical ? (volume fraction crossing unit surface per unit time)

  4. Conservation of mass ??? + ? ??? + ? ??? ??? ??+??? ? ??? = + ? ? and ? ?? ???

  5. Conservation of mass ??? + ? ??? + ? ??? ??? ??+??? ? ??? = + ? ? and ? ?? ??? ??= ?? Chemical diffusion ?? low C ? + ? high C ? ??= ?? ?? diffusivity ???

  6. Conservation of mass ??? + ? ??? + ? ??? ??? ??+??? ? ??? = ??= ?? + ? ? and ? ?? ?? ??? ??= ?? Chemical diffusion ?? low C ? + ? high C ? ?2 ??2+ ?2 ??2? + ? ? ??? = ???

  7. when ? = 0 ?2 ??2+ ?2 ??2? ?,?,? ? ??? ?,?,? = ? ??? ??,??,? = ?? 2+ ?? 2? ??,??,? FT If ?? ??= ?? then ? ??,??,? = ?0 exp ??

  8. when ? = 0 ?2 ??2+ ?2 ??2? ?,?,? ? ??? ?,?,? = ? ??? ??,??,? = ?? 2+ ?? 2? ??,??,? 2+ ?? 2? ? ??,??,? = ?0 exp ?? with ?0??,?? = ? ??,??,? = 0

  9. procedure Start with ?0?,? FT to ?0??,?? for each ? 2+ ?? 2?to get ? ??,??,? Multiply by exp ?? IFT to ? ?,?,?

  10. procedure Start with ?0?,? FT to ?0??,?? for each ? 2+ ?? 2?to get ? ??,??,? Multiply by exp ?? IFT to ? ?,?,? Very similar to how we computed gravity anomalies

  11. when ? 0 ?2 ??2+ ?2 ??2? ?,?,? + ? ?,?,? ? ??? ?,?,? = ? ??? ??,??,? = ?? 2+ ?? 2? ??,??,? + ? ??,??,?

  12. when ? 0 ?2 ??2+ ?2 ??2? ?,?,? + ? ?,?,? ? ??? ?,?,? = ? ??? ??,??,? = ?? 2+ ?? 2? ??,??,? + ? ??,??,? ? ??? = ? ?,? We know how to solve this form numerically

  13. when ? 0 ?2 ??2+ ?2 ??2? ?,?,? + ? ?,?,? ? ??? ?,?,? = ? ??? ??,??,? = ?? 2+ ?? 2? ??,??,? + ? ??,??,? ? = ? ??,??,? ? ??? = ? ?,? 2+ ?? 2? ??,??,? + ? ??,??,? ? ?,? = ?? ?0= ? ??,??,? = 0

  14. Simple example ? ?,?,? = ? ?,? (constant in time)

  15. procedure start with ?0?,?and? ?,? FT to ?0??,??and? ??,?? for each ??,?? 2+ ?? 2? ??,??,? + ? ??,?? numerically solve ? ??,??,? = ?? with initial condition ?0??,?? to get ? ??,??,? for each ? IFT to ? ?,?,?

  16. # Fourier Transforms C0t = np.fft.fft2(C0); St = np.fft.fft2(S); FT to ?0??,??and? ??,?? # function for differential equation du/dt = f(u,t) # here u=C(kx,ky,t) and f=-k(kx**2+ky**2)+S def myfun( t, u ): f = np.zeros((1,),dtype=complex); f[0] = -b * u[0] + St[ikx,iky]; return f; for each ??,?? for ikx in range(Nx): kx0 = kx[ikx,0]; for iky in range(Ny): ky0 = ky[iky,0]; b = kappa*(kx0**2 + ky0**2); u0 = np.zeros((1,),dtype=complex); u0[0] = C0t[ikx,iky]; sol=solve_ivp(myfun, [t0, tmax], u0, method = 'RK45', t_eval=t); Et = np.sum( np.power((t-sol.t)/tmax,2) ); Ct[ikx,iky,0:Nt]=sol.y[0]; for i in range(Nt): C[0:Nx,0:Ny,i] = np.real(np.fft.ifft2( Ct[0:Nx,0:Ny,i] )); numerically solve for each ? IFT to ? ?,?,?

  17. ?0?,?

  18. ? ?,?

  19. C ?,?,? = 0

  20. C ?,?,? = 1

  21. C ?,?,? = 2

  22. C ?,?,? = 3

  23. C ?,?,? = 4

  24. C ?,?,? = 5

  25. C ?,?,? = 6

  26. C ?,?,? = 7

  27. PART 1 of code dfilename='d.txt'; Make file of random noise Purpose: allow random pattern to be reused

  28. PART 2 of code Make file of ?? Based on correlated random noise (as we did last week) dfilename='d.txt'; C0filename= C0.txt'; A = 1.0; # 0 < C0 < A Plus all the parameters from last week Purpose: allow ??to be reused

  29. PART 3 of code Make file of ? Based on correlated random noise (as we did last week) dfilename='d.txt'; Sfilename= S.txt'; A = 1.0; # 0 < S < A Plus all the parameters from last week Purpose: allow ?to be reused

  30. PART 4 of code ?2 ??2+ ?2 ??2? ?,?,? + ? ?,?,? ? ??? ?,?,? = Solve numerically C0filename= C0.txt'; Sfilename= S.txt'; kappa = 1.0; # diffusivity PLOTSTEP = 2; # plot every PLOTSTEP time slice

  31. Group 1 Case 1: Gaussian ?0 with ? = 0 and ? with ? = 0.05 Case 2: exponential and same d.txt Compare how the concentration evolves with time In particular, how does you ability to distinguish the two cases vary with time?

  32. Group 2 Case 1: Gaussian ?0 with ? = 1.0 and ? with ? = 0.0 and same d.txt Case 2: exponential Compare how the concentration evolves with time In particular, how does you ability to distinguish the two cases vary with time?

  33. Group 3 ?0 with ? = 1.0 and some d.txt exponential ? with ? = 0.05 and a different d.txt Compare how the concentration evolves with time as you vary In particular, examine the variability of the time at which the ?0 pattern is no longer discernable

Related


More Related Content