Hi all! I am recently trying to solve the 1D advection equations with discontinuous galerkin method. The 1D boudary conditions is not working properly. The attached is the code that explains the problem:
m_size = 32
mesh = UnitIntervalMesh(m_size)
beta = Constant((0.5,))
parameters[“ghost_mode”] = “shared_facet”
V_dg = FunctionSpace(mesh, ‘DG’, 2)
phi, v = TrialFunction(V_dg), TestFunction(V_dg)
u_new, u_old = Function(V_dg), Function(V_dg)
u0 = Expression(“sin(2pix[0])”, degree=1, t=0, name=‘u0’) #
u_old = project(u0, V_dg)
u_exact = Expression("sin(2pi(x[0] - c*t)) ", degree=2, t=0, c=float(beta[0])) #
bcs = DirichletBC(V_dg, u_exact, “on_boundary”)
u_exact.t = 0.1
bcs.apply(u_old.vector())
print(u_old(0))
Is there a problem with the boundary conditions definition or application? Thanks a lot in advance!