Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v3
- uses: astral-sh/setup-uv@v4

- name: Build the Pyodide output
run: |
Expand Down
16 changes: 8 additions & 8 deletions content/week11/poisson_jacobi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ program poisson
end do
end do
ftot = 0. !ftot/dble(n*n)

! Main loop
ffac = h**2.
err = huge(err)
Expand All @@ -68,11 +68,11 @@ program poisson

do j = 1,n
do i = 1,n

lap = uold(i-1,j)+uold(i+1,j)+uold(i,j-1)+uold(i,j+1)-4.0*uold(i,j)
res = lap - ffac * (f(i,j) - ftot)
unew(i,j) = uold(i,j) + omega*0.25*res

err = MAX(err,abs(unew(i,j) - uold(i,j)))
end do
end do
Expand All @@ -84,13 +84,13 @@ program poisson
unew(0,i) = 0. !unew(n,i)
unew(n+1,i) = 0. !unew(1,i)
end do

do j = 1,n
do i = 1,n
uold(i,j) = unew(i,j)
end do
end do

iter = iter + 1
if ((mod(iter,OUTFREQ) .eq. 0) .or. (err .lt. eps)) then
write(*, '(A, I8, A, ES13.6)') 'Iter. ', iter, ', err = ', err
Expand All @@ -103,7 +103,7 @@ program poisson

write(*,'(A, ES13.6, A)') 'Finished in ', stop-strt, ' s'


! Final time step output
if (FOUT) then
open(7, file = 'final_phi.dat')
Expand All @@ -113,9 +113,9 @@ program poisson
end do
close(7)
end if

deallocate(uold)
deallocate(unew)
deallocate(f)

end program poisson