def transport(Q, dt, u, phi_): # Define test and trial functions phi = TrialFunction(Q) v = TestFunction(Q) # Constants associated with DG scheme alpha = StaticConstant(10.0) mesh = Q.mesh() h = CellSize(mesh) n = FacetNormal(mesh) # Diffusivity constant kappa = StaticConstant(0.0001) # Define discrete time derivative operator Dt = lambda phi: backward_euler(phi, phi_, dt) a_A = lambda phi, v: advection(phi, v, u, n) a_D = lambda phi, v: diffusion(phi, v, kappa, alpha, n, h) # Define form F = Dt(phi) * v * dx + a_A(phi, v) + a_D(phi, v) return (lhs(F), rhs(F))
def energy(Q, dt, u, T_): # Define basis functions T = TrialFunction(Q) psi = TestFunction(Q) # Diffusivity constant kappa = Constant(1.0) # Variables associated with DG scheme alpha = Constant(50.0) mesh = Q.mesh() h = CellSize(mesh) n = FacetNormal(mesh) # Define discrete time derivative operator Dt = lambda T: backward_euler(T, T_, dt) a_A = lambda u, T, psi: advection(T, psi, u, n) a_D = lambda T, psi: diffusion(T, psi, kappa, alpha, n, h) # Define form F = Dt(T)*psi*dx + a_A(u, T, psi) + a_D(T, psi) return (lhs(F), rhs(F))
def energy(Q, dt, u, T_): # Define basis functions T = TrialFunction(Q) psi = TestFunction(Q) # Diffusivity constant kappa = StaticConstant(1.0) # Variables associated with DG scheme alpha = StaticConstant(50.0) mesh = Q.mesh() h = CellSize(mesh) n = FacetNormal(mesh) # Define discrete time derivative operator Dt = lambda T: backward_euler(T, T_, dt) a_A = lambda u, T, psi: advection(T, psi, u, n) a_D = lambda T, psi: diffusion(T, psi, kappa, alpha, n, h) # Define form F = Dt(T) * psi * dx + a_A(u, T, psi) + a_D(T, psi) return (lhs(F), rhs(F))
def transport(Q, dt, u, phi_): # Define test and trial functions phi = TrialFunction(Q) v = TestFunction(Q) # Constants associated with DG scheme alpha = StaticConstant(10.0) mesh = Q.mesh() h = CellSize(mesh) n = FacetNormal(mesh) # Diffusivity constant kappa = StaticConstant(0.0001) # Define discrete time derivative operator Dt = lambda phi: backward_euler(phi, phi_, dt) a_A = lambda phi, v: advection(phi, v, u, n) a_D = lambda phi, v: diffusion(phi, v, kappa, alpha, n, h) # Define form F = Dt(phi)*v*dx + a_A(phi, v) + a_D(phi, v) return (lhs(F), rhs(F))
def Dt(T): return backward_euler(T, T_, dt)