Error compiling IS4DVAR with TS_U3ADV_SPLIT (TS_DIF4)

Discussion about tangent linear and adjoint models, variational data assimilation, and other related issues.

Moderators: arango, robertson

Post Reply
Message
Author
thiago.pdpaula
Posts: 12
Joined: Thu Oct 03, 2013 6:44 pm
Location: Personal

Error compiling IS4DVAR with TS_U3ADV_SPLIT (TS_DIF4)

#1 Post by thiago.pdpaula » Mon Jun 12, 2017 5:07 pm

I'm trying to compile an IS4DVAR application using TS_U3ADV_SPLIT as tracer advection scheme in NLM but it throws me the following error:

ad_t3dmix.f90(268): error #6404: This name does not have a type, and must have an explicit type. [ISTVAR]
IF (ad_LBC(iwest,isTvar(itrc),ng)%closed) THEN

It seems that "isTvar" variable, which holds the state variable indices for tracers, according to mod_ncparam.F, is not being imported or declared in ad_t3dmix_geo.h, as I'm turning on mixing along geopotentials (MIX_GEO_TS).

Attempting to track the source of the error, I checked globaldefs.h to see which flags were being implicitly activated when using TS_U3ADV_SPLIT. Then, I tested compiling these flags one by one.

I figured that the error occurs when TS_DIF4 is activated. If I use TS_DIF2 it compiles fine. I'm using ROMS svn783 but I also tried upgrading to svn836 with no success.

Is this a bug or the split scheme is not compatible with IS4DVAR? Is it to possible to have TS_U3ADV_SPLIT just for the NLM and keep the default advection schemes (TS_U3HADVECTION_TL, TS_C4VADVECTION_TL) for the TLM?

Attached is my header file which triggers the problem.

Cheers, Thiago.
Attachments
sse.h
(2.5 KiB) Downloaded 111 times

thiago.pdpaula
Posts: 12
Joined: Thu Oct 03, 2013 6:44 pm
Location: Personal

Re: Error compiling IS4DVAR with TS_U3ADV_SPLIT (TS_DIF4)

#2 Post by thiago.pdpaula » Tue Jun 13, 2017 4:52 pm

Update:
I managed to compile by making a minor modification in "ad_t3dmix4_geo.h" from ./ROMS/Adjoint/.
I included "USE mod_ncparam" statement in subroutines "ad_t3dmix4" and "ad_t3dmix4_tile" definition so "isTvar" becomes accessible.

Cheers.
Thiago.

thiago.pdpaula
Posts: 12
Joined: Thu Oct 03, 2013 6:44 pm
Location: Personal

Re: Error compiling IS4DVAR with TS_U3ADV_SPLIT (TS_DIF4)

#3 Post by thiago.pdpaula » Tue Jun 13, 2017 5:51 pm

Update 2:
After compiling and trying to run, I found that TS_U3ADV_SPLIT is indeed not supported in adjoint as it is not coded yet.

thiago.pdpaula
Posts: 12
Joined: Thu Oct 03, 2013 6:44 pm
Location: Personal

Re: Error compiling IS4DVAR with TS_U3ADV_SPLIT (TS_DIF4)

#4 Post by thiago.pdpaula » Fri Jun 16, 2017 10:56 am

Update 3:
I feel crazy answer my own post several times but this might be useful for others. It is possible to use the 3rd-order upstream split tracer advection scheme (TS_U3ADV_SPLIT) for the nonlinear model with IS4DVAR, or any other option, as explained in here viewtopic.php?f=31&t=3662#p13961.
To do that it is necessary to explicitly activate one of the tangent linear model tracer advection schemes. From cppdefs.h:

Code: Select all

** Tracer advection OPTIONS for adjoint-based algorithms:                    **
**                                                                           **
**   Some of the tracer advection algorithms are highly nonlinear and        **
**   may become unstable when running the tangent linear, representer,       **
**   and adjoint models. This may affect the convergence of the 4DVar        **
**   data assimilation algorithms. Therefore, it is possible to choose       **
**   a simpler (less nonlinear) horizontal and vertical tracer advection     **
**   scheme, if so desired, for the tangent linear, representer and          **
**   adjoint models. Notice that this strategy still allows us to use        **
**   highly nonlinear tracer advection schemes in the basic state upon       **
**   which the tangent linear and adjoint models are linearized. Also,       **
**   it allows us to use those schemes that have not been adjointed yet,     **
**   for example, TS_MPDATA.  Recall that basic state trajectory is          **
**   computed by running the nonlinear model.                                **
**                                                                           **
**   The flags below are optional. By default, the same options chosen       **
**   for the nonlinear model are selected for the tangent linear,            **
**   representer, and adjoint models.                                        **
**                                                                           **
** TS_A4HADVECTION_TL  use if 4th-order Akima horizontal advection           **
** TS_C2HADVECTION_TL  use if 2nd-order centered horizontal advection        **
** TS_C4HADVECTION_TL  use if 4th-order centered horizontal advection        **
** TS_U3HADVECTION_TL  use if 3rd-order upstream horiz. advection            **
**                                                                           **
** TS_A4VADVECTION_TL  use if 4th-order Akima vertical advection             **
** TS_C2VADVECTION_TL  use if 2nd-order centered vertical advection          **
** TS_C4VADVECTION_TL  use if 4th-order centered vertical advection          **
** TS_SVADVECTION_TL   use if splines vertical advection                     **
If TS_U3ADV_SPLIT is activated without specifying an advection scheme for TLM it will trigger an error in checkadj.F:

Code: Select all

# if !defined TS_HADVECTION_TL
      string=uppercase('ts_u3adv_split')
      ifound=INDEX(TRIM(Coptions), TRIM(string))
      IF (ifound.ne.0) THEN
        ic=ic+1
        IF (Master) WRITE(stdout,20) TRIM(string),                      &
     &                               'not coded, FATAL ERROR'
      END IF
# endif
My fault not seeing this before.

Post Reply