From 9a625d4ed226a7351659bede199b1108f8c3c8c8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:55:20 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- content/week10/rust_example/rust.md | 9 +++++---- content/week11/poisson_jacobi.f90 | 16 ++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/content/week10/rust_example/rust.md b/content/week10/rust_example/rust.md index 208c7ab..b17ed87 100644 --- a/content/week10/rust_example/rust.md +++ b/content/week10/rust_example/rust.md @@ -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 diff --git a/content/week11/poisson_jacobi.f90 b/content/week11/poisson_jacobi.f90 index 6ace82e..30ae62c 100644 --- a/content/week11/poisson_jacobi.f90 +++ b/content/week11/poisson_jacobi.f90 @@ -55,7 +55,7 @@ program poisson end do end do ftot = 0. !ftot/dble(n*n) - + ! Main loop ffac = h**2. err = huge(err) @@ -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 @@ -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 @@ -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') @@ -113,9 +113,9 @@ program poisson end do close(7) end if - + deallocate(uold) deallocate(unew) deallocate(f) - + end program poisson