SUBROUTINE CTCAB (KDUM,YD_PU,YD_PV)

!***  *CTCAB* change back to initial basis

!**   Purpose.
!     --------
!            go from the orthonormal basis (with respect to the inner product)
!            to the initial basis.

!**   Interface.
!     *CALL* *CTCAB(KDUM,PU,PV)* (from Q3DD2)

!        Explicit arguments :
!        --------------------
!        KDUM   : dimension of the problem (not used)
!        PU     : in initial basis
!        PV     : in final basis

!        Implicit arguments :
!        --------------------
!        SCALP  : from YOMCVA

!     Method.
!     -------
!        See documentation : The modules M1QN2,N1QN2,M1QN3,N1QN3
!                            version 1.1.b (February 1989)
!                            J.C Gilbert and C. Lemarechal

!     Externals.
!     ----------
!      none

!     Reference.
!     ----------
!        ECMWF research department documentation of the IFS

!     Author.
!     -------
!        Jean-Noel Thepaut *ECMWF*

!     Modifications.
!     --------------
!        Original : 91-09-19
!        E.ANdersson : 96-08-01 - Pre-calculated SQRT(SCALP)
!        M.Hamrud    : 98-01-10 - Minimisation parallelized
!        M.Fisher    : 02-07-15 - Don't call PRECOND if LAVCGL.OR.LCONGRAD
!        Y.Tremolet  : 02-08-05 - Use control_vectors.
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMCVA   , ONLY : YRSCALPSQRT
USE YOMVAR   , ONLY : LMPCGL, LAVCGL, LCONGRAD
USE CONTROL_VECTORS

IMPLICIT NONE

INTEGER(KIND=JPIM)               :: KDUM ! Argument NOT used
TYPE(CONTROL_VECTOR),INTENT(IN)    :: YD_PU 
TYPE(CONTROL_VECTOR),INTENT(INOUT) :: YD_PV 
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "precond.intfb.h"

!     --------------------------------------------------

!*    1.  CHANGE BASIS (WITH SPECIAL TREATMENT FOR SCALP=0.)
!     ------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('CTCAB',0,ZHOOK_HANDLE)
YD_PV=YD_PU

IF (LMPCGL .AND. .NOT.(LAVCGL .OR. LCONGRAD)) CALL PRECOND(YD_PV,-2)

YD_PV%data=YD_PV%data*YRSCALPSQRT%data

!     --------------------------------------------------

IF (LHOOK) CALL DR_HOOK('CTCAB',1,ZHOOK_HANDLE)
END SUBROUTINE CTCAB
