I read this post, Conservation of a physical quantity when using Neumann boundary conditions applied to the advection-diffusion equation and although it is the same type of equation it does not fit my problem.I try to solve the following equation with a no flux boundary with the solver d03pf from NAG. Should not be difficult, but i do have troubles with a no flux boundary.$ \frac{\partial(u)}{\partial(t)}+\frac{\partial(F(u))}{\partial(x)}=\frac{\partial}{\partial(x)}\left( D(u)\frac{\partial(u)}{\partial(x)}\right)$I do have a closed vessel and particles are sedimenting towards the bottom. Before they touch each other it is of hyperbolic type. Otherwise the PDE is parabolic.My flux function is something like $F=u\times\text{velocity}(1-u)^C$ So when i use the standard no flux function for the hyperbolic part, saying the flux at the boundary is zero. The solver sets the mass in the last cell to zero and i am loosing mass.I can say $\text{flux}(\text{end}-1) = -\text{flux}(\text{end})$ and the solver raises the concentration in the last cell greater one (for e.g C=5). But that does not work for even C.$F(u)$ as well as $D(u)$ are piecewise differentiable.I do have the space vector, the time at this iteration and the solution of the last three cells given.Does anybody know another way constructing a no flux boundary ? Best wishesMoritz
No flux boundaries for mixed hyperbolic parabolic PDE
pde;boundary conditions
The correct boundary condition that you need to setup is$$ F(u) - D(u) \frac{\partial u}{\partial x} = 0$$If you could have this condition, the mass would be perfectly conserved (see the answer to the question that you refer to for the reasoning). The problem is that what this condition is non-linear, so this is not a Robin condition.Here is what I would try to overcome this issue: make one part of the condition explicit in time. One option is to use a Neumann condition like$$ D(u^{(n)}) \frac{\partial u^{(n+1)}}{\partial x} = F(u^{(n)})$$where $u^{(n)}$ is the approximation of $u$ at time $t$. You can also try the following Robin condition:$$ D(u^{(n)}) \frac{\partial u^{(n+1)}}{\partial x} = u^{(n+1)} v (1-u^{(n)})^{C}$$This should give you an approximative conservation of the mass (the conservation should also improve as the time step decreases). If you want to conserve exactly the mass, then you should subiterate at each time step to solve the non-linearity (but then the convergence of the non-linear solver comes into play).Hope this helps!