Skip to content

Commit

Permalink
deploy: eb812aa
Browse files Browse the repository at this point in the history
  • Loading branch information
mdenolle committed Nov 22, 2024
1 parent bcbfa1c commit 7165b3e
Show file tree
Hide file tree
Showing 13 changed files with 441 additions and 170 deletions.
333 changes: 271 additions & 62 deletions Chapter4-DeepLearning/mlgeo_4.7_PINN.html

Large diffs are not rendered by default.

Binary file modified _images/mlgeo_4.7_PINN_10_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed _images/mlgeo_4.7_PINN_11_1.png
Binary file not shown.
Binary file added _images/mlgeo_4.7_PINN_13_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/mlgeo_4.7_PINN_14_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed _images/mlgeo_4.7_PINN_15_1.png
Binary file not shown.
Binary file removed _images/mlgeo_4.7_PINN_1_0.png
Binary file not shown.
File renamed without changes
File renamed without changes
Binary file added _images/mlgeo_4.7_PINN_9_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
222 changes: 155 additions & 67 deletions _sources/Chapter4-DeepLearning/mlgeo_4.7_PINN.ipynb

Large diffs are not rendered by default.

54 changes: 14 additions & 40 deletions reports/mlgeo_4.7_PINN.log
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,25 @@ Traceback (most recent call last):
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
import numpy as np
import functools
import matplotlib.pyplot as plt
import numpy as np
import torch

# Parameters
nx, ny = 50, 50 # Number of grid points in x and y directions
dx, dy = 1.0, 1.0 # Grid spacing in x and y directions
alpha = 0.01 # Thermal diffusivity
dt = 0.1 # Time step
nt = 100 # Number of time steps

# Initial temperature field
T = np.zeros((nx, ny))
T[nx//4:3*nx//4, ny//4:3*ny//4] = 100 # Initial heat source in the center

# Function to update the temperature field
def update_temperature(T, alpha, dx, dy, dt):
T_new = T.copy()
T_new[1:-1, 1:-1] = T[1:-1, 1:-1] + alpha * dt * (
(T[2:, 1:-1] - 2 * T[1:-1, 1:-1] + T[:-2, 1:-1]) / dx**2 +
(T[1:-1, 2:] - 2 * T[1:-1, 1:-1] + T[1:-1, :-2]) / dy**2
)
return T_new

# Time-stepping loop
for n in range(nt):
T = update_temperature(T, alpha, dx, dy, dt)
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Plot the final temperature field
plt.figure(figsize=(8, 6))
plt.imshow(T, extent=[0, nx*dx, 0, ny*dy], origin='lower', cmap='hot')
plt.colorbar(label='Temperature')
plt.title('Temperature Field after Diffusion')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
sleep(1)
torch.manual_seed(42)
np.random.seed(10)
------------------

---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import numpy as np
 2 import matplotlib.pyplot as plt
 4 # Parameters

ModuleNotFoundError: No module named 'numpy'
ModuleNotFoundError: No module named 'numpy'
Input In [1], in <cell line: 2>()
 1 import functools
----> 2 import matplotlib.pyplot as plt
 3 import numpy as np
 4 import torch

ModuleNotFoundError: No module named 'matplotlib'
ModuleNotFoundError: No module named 'matplotlib'

2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 7165b3e

Please sign in to comment.