This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

how to write the code for the PDE?

0 votes

there is a PDE:

ac1du/dt - div(knabla_u) + bc2*(u-u_a) = m in D

-knabla_un = h(u-u_b) on boundary Dx[0,tf]

a,c1,b,c2 are constant and let be 1.0, m is a control-variable, u_a and u_b should be zero, n means normal-vector, k can be the same or two values, h(u-u_b) is a flow.

i want to write the code for F = a - L = 0

F = ((u-u_old)v/timestep + inner(kgrad(u), grad(v)) + (u-0)v - mv)*dx

is not right, because "-knabla_un = h(u-u_b)" is missing in it. What is the right code for it?
please help me!

best regards

christian

asked Dec 9, 2015 by Christian FEniCS Novice (150 points)

The boundary condition you have is of Neumann type. If you properly derive the variational formulation of your PDE, you will get an integral over the boundary along with the volume integrals. This is why those are called natural boundary conditions. See also: http://fenicsproject.org/documentation/dolfin/dev/python/demo/documented/neumann-poisson/python/documentation.html.

...