That seems odd to me because that would be inconsistent with a non constant concentration field, but doesn’t cause any error. Am I missing something? Would it be possible to initialize the chemical potential as
Similarly, is it possible to set the chemical potential with Dirichlet boundary conditions explicitly as a function of the concentration field such as (c-0.9)*(c-0.1)*(c-0.5)-lmbda*div(grad(c)?
Thanks for the quick reply! How come it doesn’t seem to matter what initial condition we set the chemical potential to be though? ( Even in the latest demo the chemical potential initial condition is still set to 0)
I am actually not sure. It is quite common in mixed problems that one only has a valid initial state for one variable (for instance navier stokes where the initial condition might just be an inlet condition).
For a problem with an analytical solution this usually throws of the convergence rates a bit.
You could add a projection that brings the initial conditions into a feasible space, and it should make the solution slightly more accurate.
where the initial value for c at the boundary is 0.9, the dolfin solver has difficulty converging for
bc_c = DirichletBC(ME.sub(0), Constant(0.9), boundary) # For 'c'
bc_mu = DirichletBC(ME.sub(1), Constant(0), boundary) # For 'mu'
However, the dolfin solver accepts
bc_c = DirichletBC(ME.sub(0), Constant(0), boundary) # For 'c'
bc_mu = DirichletBC(ME.sub(1), Constant(0), boundary) # For 'mu'
and behaves as if the boundary value of c is actually fixed at 0.9 instead of 0. I checked this for various initial conditions by printing out the boundary values at different times of the simulation and the behavior is always the same. Is this some weird implementation issue for legacy fenics?