Skip to content
Extraits de code Groupes Projets
Valider cd9c16ba rédigé par Simon Collignon's avatar Simon Collignon
Parcourir les fichiers

imshow instead of contourf

parent 3250edd0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -39,7 +39,7 @@ def cahn_hilliard_spectral(it, c): ...@@ -39,7 +39,7 @@ def cahn_hilliard_spectral(it, c):
# wavenumbers # wavenumbers
kr = power(2 * pi * fft.rfftfreq(nn, d=dx), 2) kr = power(2 * pi * fft.rfftfreq(nn, d=dx), 2)
kc = power(2 * pi * fft.fftfreq(nn, d=dx), 2) kc = power(2 * pi * fft.fftfreq(nn, d=dx), 2)
kk = array([kr,]*nn) + array([kc,]*int((nn/2)+1)) .transpose() kk = array([kr,]*nn) + array([kc,]*int((nn/2)+1)).transpose()
for _ in range(it): for _ in range(it):
...@@ -61,8 +61,8 @@ if __name__ == "__main__": ...@@ -61,8 +61,8 @@ if __name__ == "__main__":
fig, (ax1, ax2) = plt.subplots(1, 2) fig, (ax1, ax2) = plt.subplots(1, 2)
fig.suptitle(f"Cahn-Hilliard integration for {it} iterations ") fig.suptitle(f"Cahn-Hilliard integration for {it} iterations ")
ax1.contourf(xy, xy, c1, cmap="jet") ax1.imshow(c1, cmap="jet", vmin=-1, vmax=1)
ax1.set_title("Finite differences method") ax1.set_title("Finite differences method")
ax2.contourf(xy, xy, c2 , cmap="jet") ax2.imshow(c2, cmap="jet", vmin=-1, vmax=1)
ax2.set_title("Spectral method") ax2.set_title("Spectral method")
plt.show() plt.show()
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter