Skip to content

Commit

Permalink
Merge pull request #23 from markcmiller86/bug-mcm86-14aug24-dufrank-init
Browse files Browse the repository at this point in the history
Fix initialization for DuFort-Frankel
  • Loading branch information
markcmiller86 authored Aug 15, 2024
2 parents 1a22ef7 + dd49cad commit 96b48b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dufrank.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ update_solution_dufrank(
Number r = alpha * dt / (dx * dx);
Number q = 1 / (1+r);

// FTCS update algorithm
// DuFort-Frankel update algorithm
#pragma omp parallel for
for (int i = 1; i < n-1; i++)
uk[i] = q * (1-r) * uk2[i] + q * r * (uk1[i+1] + uk1[i-1]);
Expand Down
5 changes: 4 additions & 1 deletion heat.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ initialize(void)
back2 = (Number*) malloc(Nx * sizeof(Number));

// Initial condition
set_initial_condition(Nx, back1, dx, ic);
set_initial_condition(Nx, curr, dx, ic);
copy(Nx, back1, curr);
if (back2)
copy(Nx, back2, curr);
}

int finalize(int ti, Number maxt, Number change)
Expand Down
2 changes: 1 addition & 1 deletion tools/run_matplotlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ p0=$(perl -e "print $lenx2-$lenp2")
# Compute right bound of pipe's width
p1=$(perl -e "print $lenx2+$lenp2")

python -t << EOF 2>/dev/null
python3 -t << EOF 2>/dev/null
import matplotlib.pyplot as plt
import sys, time
x = []
Expand Down

0 comments on commit 96b48b8

Please sign in to comment.