Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 13, 2025
1 parent a0af227 commit 9a625d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions content/week10/rust_example/rust.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Intro to Rust

This is an introduction to some of the unique design of Rust. This is not
comprehensive - the fantastic [Rust Book][] is much better if you want to fully learn
Rust. Instead, we'll look at how it's different from what we've seen so far in Python,
and discuss some of the aspects that make special, like how it is memory safe without
resorting to a garbage collector, the trait system, and syntactic macros.
comprehensive - the fantastic [Rust Book][] is much better if you want to fully
learn Rust. Instead, we'll look at how it's different from what we've seen so
far in Python, and discuss some of the aspects that make special, like how it is
memory safe without resorting to a garbage collector, the trait system, and
syntactic macros.

## Basic syntax

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

0 comments on commit 9a625d4

Please sign in to comment.