Undefined/uninitialized local variable eps for WET_DRY

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
stef
Posts: 175
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

Undefined/uninitialized local variable eps for WET_DRY

#1 Unread post by stef »

Sorry Hernan I think it's a WET_DRY bug (you mentioned in a previous post that maintaining the option is a burden). No urgency, I can do it myself, but still wanted to report it. Using WET_DRY in a 4dvar results in:

Code: Select all

cd xxx; /usr/bin/mpif90 -c -frepack-arrays -O3 -ffast-math -fallow-argument-mismatch tl_zetabc.f90
tl_zetabc.f90:854:23:

  854 |       cff=Dcrit(ng)-eps
      |                       1
Error: Symbol 'eps' at (1) has no IMPLICIT type
I guess there is a

Code: Select all

#  ifdef WET_DRY
      real(r8), parameter :: eps = 1.0E-14_r8
#  endif
missing in the {tl,ad,rp}_zetabc.F files.

User avatar
arango
Site Admin
Posts: 1347
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: Undefined/uninitialized local variable eps for WET_DRY

#2 Unread post by arango »

Hmm, the option WET_DRY is not supported in any of the adjoint-based algorithms! The reason is that their associated mask variables would become time-dependent, and we need the entire trajectory for stepping backward in time. However, we will need to change the TLM and ADM kernels to add the variational calculus extra term to the discrete code because the wetting and drying masks are adjointable. For example,

Code: Select all

If the nonlinear model code is:

        x(i,j) = x(i,j) * rmask_wet(i,j)

The tangent linear code is now quadratic:

        tl_x(i,j) = x(i,j) * tl_rmask_wet(i,j) + tl_x(i,j) * rmask_wet(i,j)

and the associated adjoint is:

        ad_x(i,j) = ad_x(i,j) * rmask_wet(i,j)
        ad_rmask_wet(i,j) = ad_rmask_wet(i,j) + x(i,j) * ad_x(i,j)
Notice that the order of the above two statements matter, and we need the forward solution for x(i,j). Therefore, it is extremely complicated. Here, tl_rmask_wet and ad_rmask_wet depend on tl_zeta, ad_zeta, and zeta. It is very complicated :evil:

I think that if we use the split 4D-Var scheme (TWO executables), we can run the FORWARD nonlinear solution with WET_DRY activated and the TLM and ADM kernels in the inner loops with WET_DRY off. Recall that the forward nonlinear solution is used to linearize the TLM and ADM kernels. However, we never test it. In my opinion, wetting and drying don't belong in variational data assimilation. I don't see the point of it. It is highly nonlinear because it depends on the instantaneous free surface. In addition, the wetting and drying code is NOT differentiable since it is not derived from continuous equations. An engineering approach is used in its implementation.

Therefore, a sound linearization assumption is to turn off WET_DRY in adjoint-based applications. That is, x(i,j) * tl_rmask_wet(i,j) is a neglible high-order term.

stef
Posts: 175
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

Re: Undefined/uninitialized local variable eps for WET_DRY

#3 Unread post by stef »

Thanks for taking the time to provide so much background!

I will switch it off, work through more of the tutorials/lectures you provide and at some point revisit your post when I understand more about assimilation (I'll admit I don't yet understand much of what you are saying about the math). I get the impression that for storm-surge modelling, one would use assimilation to get a good wind field, e.g. through coupling with WRF, and good initial/boundary conditions, and the run a forward-only model to do the wetting/drying separately (possibly coupled with WRF if forecasting, but perhaps not coupled at all, instead using analyzed/assimilated wind fields as soon as they become available for the entire history of the storm).

The error arose because I started to intermingle my cpp-options with those of the tutorials, and I had the WET_DRY option lingering around without actually needing it. I'll shut it off and go through the tutorials as they are.

Thanks again for the tutorials/lectures, they are great!

Post Reply