Skip to content

Commit

Permalink
init dufrank with ftcs
Browse files Browse the repository at this point in the history
  • Loading branch information
markcmiller86 committed Aug 15, 2024
1 parent dd49cad commit 6dc42c2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions heat.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,17 @@ initialize(void)
initialize_crankn(Nx, alpha, dx, dt, &cn_Amat);

if (!strncmp(alg, "dufrank", 7))
{
back2 = (Number*) malloc(Nx * sizeof(Number));

// Initial condition
set_initial_condition(Nx, curr, dx, ic);
copy(Nx, back1, curr);
if (back2)
copy(Nx, back2, curr);
/* Set initial condition 2 timesteps back (back2) and use
FTCS once to set the initial condition for 1 timestep back (back1) */
set_initial_condition(Nx, back2, dx, ic);
update_solution_ftcs(Nx, back1, back2, alpha, dx, dt, bc0, bc1);
}
else
{
set_initial_condition(Nx, back1, dx, ic);
}
}

int finalize(int ti, Number maxt, Number change)
Expand Down

0 comments on commit 6dc42c2

Please sign in to comment.