Greetings JEDIs! Happy Thanksgiving from the Dark Side!

Is there currently a way in JEDI to constrain the minimization of the cost function. In particular, I want to minimize the cost function subject to the constraint that the state x satisfies particular boundary conditions. I suspect this issue might also arise for local area models.

Also - another, separate question. I have an obs field that is binary. So, it’s a 2D (N x N) lat/lon grid of obs where the obs value is 1 in some local areas/patches and 0 elsewhere. So, it’s like a mask but the zeros contain as much useful information as the ones. I’m a bit worried that this may lead to sharp gradients in the cost function - i.e. that small changes in x will lead to relatively abrupt “jumps” in J. I don’t expect these jumps to be large enough to cause serious problems but even so, is there a particular minimization algorithm that might be more robust to a situation like this? I suspect a rough analogue in meteorology might be something to do with cloud cover, though that isn’t really binary.

Do you want to impose your boundary condition as a strong or weak constraint?

If you want it as a strong constraint, you have to implement your increment class so that it doesn’t change the boundary condition.

If you want it as a weak constraint, you have to add a term to the cost function. There is a base class for that (CostTermBase) and you can see an example in CostJcDFI.

About your second question, I don’t think that should be an issue. The obs errors affects convergence, but the obs values do not. That’s because the convergence is determined by the Hessian of the cost function, where R (R^{-1}) appears but not the obs values.

Then your B matrix will smooth out the steps in the observations so the resulting analysis is smoother, if that’s what you want.

Thanks @tremolet! Good to hear from you! I’m not quite using JEDI yet but I’m trying to convince others that it’s a good idea - your answer will help ! One of the BCs is a Neumann type (derivative zero) but I think I could still implement that in the increment class.

And, with regard to the other question - I don’t really want to smooth the obs. The “observation” in question (derived but still can be implemented as an obs) is whether or not magnetic field lines rooted in the surface of the Sun are open (1) or closed (0). So, each point in the analysis (on that surface; x itself extends beyond the surface) needs to be one or the other, though the actual x value is the magnetic field itself: H(x) will translate that into a binary 1 or 0. A bit hard to explain, but I think it will work. Thanks again!