Bugs found in tracer mixing when CLIMA_TS_MIX is used

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
yang
Posts: 56
Joined: Mon Sep 25, 2006 2:37 pm
Location: Institue of oceanology ,Chinese acedemy of scinece

Bugs found in tracer mixing when CLIMA_TS_MIX is used

#1 Unread post by yang »

In my application in Eash China Sea using ROMS src 766, there are weird results for tracer mixing (see the attached picture), where CLIMA_TS_MIX is turned on for salinity and temperature, but turned off for tracer. The bug resulted in this wrong result is that the tracer mixing are wrongly calculated by t(i,j-1,k+1,nrhs,itrc)-tclm(i,j-1,k+1,itrc) when itrc is larger than 2.
I checked the code and found bugs in t3dmix2_geo.h, t3dmix2_iso.h, t3dmix2_s.h, t3dmix4_geo.h,t3dmix4_iso.h t3dmix4_s.h,ad_t3dmix2_geo.h and so on. In my configuration, i have set LtracerCLM == T T F and LnudgeTCLM == T T F ( temperature, salinity, inert) in my *.in file, which means the tracer mixing should not be dealed with t-tclm, however in mixing subroutine such as t3dmix2_geo.h, the tracer mixing is still calculated by t-tclm when itrc is equual to 3.
I have fixed these bugs in these subroutines. And the tracer is properly mixed.
For example,the orginal code in lines 229-237 of t3dmix2_geo.h has been fixed as following.
The orginal code in src 766.

Code: Select all

#ifdef MIX_STABILITY
                dTdx(i,j,k2)=cff*(0.75_r8*(t(i  ,j,k+1,nrhs,itrc)-      &
     &                                     t(i-1,j,k+1,nrhs,itrc))+     &
     &                            0.25_r8*(t(i  ,j,k+1,nstp,itrc)-      &
     &                                     t(i-1,j,k+1,nstp,itrc)))
#elif defined CLIMA_TS_MIX
                dTdx(i,j,k2)=cff*((t(i  ,j,k+1,nrhs,itrc)-              &
     &                             tclm(i  ,j,k+1,itrc))-               &
     &                            (t(i-1,j,k+1,nrhs,itrc)-              &
     &                             tclm(i-1,j,k+1,itrc)))
#else
                dTdx(i,j,k2)=cff*(t(i  ,j,k+1,nrhs,itrc)-               &
     &                            t(i-1,j,k+1,nrhs,itrc))
#endif
The corrected code.

Code: Select all

#ifdef MIX_STABILITY
                dTde(i,j,k2)=cff*(0.75_r8*(t(i,j  ,k+1,nrhs,itrc)-      &
     &                                     t(i,j-1,k+1,nrhs,itrc))+     &
     &                            0.25_r8*(t(i,j  ,k+1,nstp,itrc)-      &
     &                                     t(i,j-1,k+1,nstp,itrc)))
!
! The following code has been Changed by YDZ 2015.06.29
!
#elif defined CLIMA_TS_MIX
	       if (LtracerCLM(itrc,ng)) then
                dTdx(i,j,k2)=cff*((t(i  ,j,k+1,nrhs,itrc)-              &
     &                             tclm(i  ,j,k+1,itrc))-               &
     &                            (t(i-1,j,k+1,nrhs,itrc)-              &
     &                             tclm(i-1,j,k+1,itrc)))
	       else 
   #ifdef MIX_STABILITY
                dTdx(i,j,k2)=cff*(0.75_r8*(t(i  ,j,k+1,nrhs,itrc)-      &
     &                                     t(i-1,j,k+1,nrhs,itrc))+     &
     &                            0.25_r8*(t(i  ,j,k+1,nstp,itrc)-      &
     &                                     t(i-1,j,k+1,nstp,itrc)))
   #else
                dTdx(i,j,k2)=cff*(t(i  ,j,k+1,nrhs,itrc)-               &
     &                            t(i-1,j,k+1,nrhs,itrc))
   #endif
	       end if      							
#else
                dTdx(i,j,k2)=cff*(t(i  ,j,k+1,nrhs,itrc)-               &
     &                            t(i-1,j,k+1,nrhs,itrc))
#endif
In addtion, I have also fixed other potential bugs relevant to CLIMA_TS_MIX in t3dmix2_geo.h, t3dmix2_iso.h, t3dmix2_s.h, t3dmix4_geo.h,t3dmix4_iso.h t3dmix4_s.h,ad_t3dmix2_geo.h and so on. When these bugs are fixed, the model show reasonable results for tracer mixing.
Attachments
Bug_in_ROMS_766.JPG
Bug_in_ROMS_766.JPG (54.19 KiB) Viewed 3292 times
Last edited by yang on Tue Jun 30, 2015 9:02 am, edited 4 times in total.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Bugs found in tracer mixing when CLIMA_TS_MIX is used

#2 Unread post by kate »

Thanks for the patch! It's scary when you see the tile boundaries like that.

Post Reply