Sobolev gradient and conjugate-gradient methods for solving optimization problems for fluid or superfluid systems