From 6dc42c2fbb44bd220cf7e10a157a7082b7ace0b8 Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" Date: Thu, 15 Aug 2024 00:29:00 -0700 Subject: [PATCH] init dufrank with ftcs --- heat.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/heat.c b/heat.c index ca4c35c..2522812 100644 --- a/heat.c +++ b/heat.c @@ -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)