Nonlinear 1-d convection diffusion
Hello
This is my first attempt at dolfin. I am solving a 1-d convection-
(u^2/2)_x - u_xx = f
u(0) = u(1) = 0
So I do the following
# Create mesh and function space
mesh = UnitInterval(50)
V = FunctionSpace(mesh, "CG", 1)
# Sub domain for Dirichlet boundary condition
def DirichletBounda
return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
# Define variational problem
u = Function(V)
f = Expression(
du = TrialFunction(V)
v = TestFunction(V)
F = (-0.5*u**2*grad(v) + dot(grad(u), grad(v)))*dx - f*v*dx
dF= derivative(F, u, du)
# Define boundary condition
u0 = Constant(0.0)
bc = DirichletBC(V, u0, DirichletBoundary)
problem = VariationalProb
u = problem.solve()
But this gives me following error
RuntimeError: *** Error: Unable to extract trial space for solution of variational problem, is 'a' bilinear?
Can you help me with this please ?
Thanks
praveen
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Praveen C
- Solved:
- Last query:
- Last reply: