Constrained problem with PETScKrylov


I am solving a 3D elasticity problem with PETScKrylov solver and trying to introduce constraints.

This 3D elasticity is coupled with a deformation gradient dependent phase field parameter, c. This parameter is a ''vector" of n elements (each denoting a separate variant of the phase)

I need help to introduce the following constraints in my code, but I am not sure whether it would be possible:

  1. Each component c_i needs to be within 0 and 1 (inclusive).
  2. Sum of all c_i is also between 0 and 1.

Thank you!

P.S. I am aware that PETScSNES solver allows for lower and upper bounds. But this solver didn’t converge at all so switched over to PETScKrylov.