Commit 4bb764e5 by Jigyasa Watwani

need to fix bug

parent a9ae2bdb
# moving domain diffusion advection equation # moving domain diffusion advection equation
# boundary condition: diffusive flux at the boundaries [0,1] is zero # boundary condition: diffusive flux at the boundaries [0,1] is zero
# initial condition c(x,0) = 1 + 0.2*cos(pi x) ; satisfies the boundary condition # initial condition c(x,0) = 1 + 0.2*cos(pi x) ; satisfies the boundary condition
# exact solution at steady state: c(x) = c(0) e^(vx/D)
import numpy as np import numpy as np
import dolfin as df import dolfin as df
...@@ -35,9 +34,10 @@ def advection_diffusion(Nx, L, Nt, tmax, v, D): ...@@ -35,9 +34,10 @@ def advection_diffusion(Nx, L, Nt, tmax, v, D):
return [c.compute_vertex_values(mesh), x] return [c.compute_vertex_values(mesh), x]
Nx, L, tmax, D, k = 2000, 1, 5, 1, 1 Nx, L, tmax, D, k = 2000, 1, 1, 1, 1
v = df.Expression('k*x[0]', k=k, degree=1) v = df.Expression('k*x[0]', k=k, degree=1)
nt_array = np.array([50, 100, 200, 400, 800, 1600, 3200, 6400, 12800]) nt_array = np.array([50, 100, 200, 400, 800])
# , 1600, 3200, 6400, 12800])
dt_array = tmax/(nt_array - 1) dt_array = tmax/(nt_array - 1)
error_in_c = np.zeros(len(nt_array)) error_in_c = np.zeros(len(nt_array))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment