import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tkinter as tk
# Vortex simulation function using Ginzburg-Landau parameters
def generate_vortex_pattern(B, xi, lambda_, grid_size=100):
x = np.linspace(-grid_size / 2, grid_size / 2, grid_size)
y = np.linspace(-grid_size / 2, grid_size / 2, grid_size)
X, Y = np.meshgrid(x, y)
# Distance from the origin
R = np.sqrt(X**2 + Y**2)
# Simplified vortex model
psi = np.exp(-R / lambda_) * np.sin(2 * np.pi * R / xi)
# Magnetic field intensity
B_field = B * np.exp(-R / lambda_)
return psi, B_field
# Function to update the plot based on user inputs
def update_plot():
B = float(entry_B.get())
xi = float(entry_xi.get())
lambda_ = float(entry_lambda.get())
# Generate vortex patterns
psi, B_field = generate_vortex_pattern(B, xi, lambda_)
# Clear and update plot
ax.clear()
ax.set_title("Vortex Pattern in Type-II Superconductor")
vortex = ax.imshow(psi, cmap='viridis', extent=(-50, 50, -50, 50))
fig.colorbar(vortex, ax=ax, label="Order Parameter |ψ|")
canvas.draw()
# Setup GUI window using Tkinter
root = tk.Tk()
root.title("Ginzburg-Landau Vortex Simulation")
# Create input fields for parameters
tk.Label(root, text="Magnetic Field (B)").grid(row=0, column=0)
entry_B = tk.Entry(root)
entry_B.grid(row=0, column=1)
entry_B.insert(0, "1.0")
tk.Label(root, text="Coherence Length (ξ)").grid(row=1, column=0)
entry_xi = tk.Entry(root)
entry_xi.grid(row=1, column=1)
entry_xi.insert(0, "5.0")
tk.Label(root, text="Penetration Depth (λ)").grid(row=2, column=0)
entry_lambda = tk.Entry(root)
entry_lambda.grid(row=2, column=1)
entry_lambda.insert(0, "10.0")
# Create plot area for vortex pattern
fig, ax = plt.subplots(figsize=(5, 5))
canvas = FigureCanvasTkAgg(fig, master=root)
canvas.get_tk_widget().grid(row=3, column=0, columnspan=2)
# Add button to update plot based on parameters
tk.Button(root, text="Generate Vortex Pattern", command=update_plot).grid(row=4, column=0, columnspan=2)
# Run the GUI application
root.mainloop()
'정보통신기술(ICT)' 카테고리의 다른 글
파이썬 코드로 한국이 가진 오방색을 나타내는 방식 (0) | 2024.11.13 |
---|---|
파이썬 GUI 모듈 인핸스(Enhanced) 타입 (0) | 2024.11.12 |
초연공학(Conscious Engineering) (0) | 2024.11.10 |
초전도체 연구에 필요한 양자물리학 기반 뉴트론시스 방정식(Neutronsys Equation) (3) | 2024.11.07 |
반데르발스 헤테르구조(Vanderwaals Heterostructures) (3) | 2024.11.06 |