Hello Zeinab,
To code your own decay rate for a tracer, you can implement SOURCE_TRAC subroutine in TELEMAC-3D.
The arrays you can play with are S1TA and S0TA.
- S0TA acts explicitely on the tracer value at the begining of the time step as follows:
TA = TA + S0TA ... + ADVECTION+DIFFUSION +...
- S1TA acts implicitely on the tracer value at the end of the time step as follows:
TA *( 1.-S1TA ) = TA + ... + ADVECTION+DIFFUSION
Please note the sign in front of S0TA and S1TA, and that S1TA is a multiplier of TA, the tracer concentration.
So, say you have
INTEGER IPOIN3, IPOIN2, IPLAN
DOUBLE PRECISION DECAYDAY,DECAYRATE
Here, for instance, the formulation use a T90 ( Loss of 'DECAYRATE' % IN 'DECAYDAY' time ), or how many days it takes for a tracer to lose so much % of it smass
DECAYDAY = 0.125D0
= 1/8 of a day, just to make the simulation quick
DECAYRATE = 0.9D0
=> T90, a T50 would be with DECAYRATE = 0.5D0
And we assume NUMBER OF TRACERS = 3 ...
You can write for instance for TRACER #2:
- For TRACER #2, here I used a balanced formulation with both S0TA/2 + TA*S1TA/2 ...
! UNIFORM DECAY RATE FOR TRACER NUMBER 2 (%ADR(2)) -
IF(NTRAC.GE.2) THEN
!
S0TA%ADR(2)%P%TYPR='Q'
S1TA%ADR(2)%P%TYPR='Q'
DO IPOIN3 = 1,NPOIN3
S0TA%ADR(2)%P%R(IPOIN3) = TA%ADR(2)%P%R(IPOIN3) *
& DLOG( 1.D0-DECAYRATE ) / ( DECAYDAY*24*3600.D0 ) / 2.D0
S1TA%ADR(2)%P%R(IPOIN3) =
& - DLOG( 1.D0-DECAYRATE ) / ( DECAYDAY*24*3600.D0 ) / 2.D0
ENDDO
!
ENDIF
You can write for instance for TRACER #3:
- For TRACER #3, here I used an implicit formulation with only TA*S1TA/2 ...
but ( DECAYDAY / IPLAN ) for each plan to see vertical variation
! VERTICALLY VARIABLE DECAY RATE FOR TRACER NUMBER 3 (%ADR(3))
! ... A FUNCTION OF PLAN NUMBER TO DO IT SIMPLY ... (IPLAN=1 IS THE BOTTOM)
IF(NTRAC.GE.3) THEN
!
S1TA%ADR(3)%P%TYPR='Q'
DO IPOIN2 = 1,NPOIN2
DO IPLAN = 1,NPLAN
IPOIN3 = IPOIN2 + (IPLAN-1)*NPOIN2
S1TA%ADR(3)%P%R(IPOIN3) =
& - DLOG( 1.D0-DECAYRATE ) / ( DECAYDAY*24*3600.D0 ) * IPLAN
ENDDO
ENDDO
!
ENDIF
Finally, for TEMPERATURE dependence, if you name your TARCERS, with one at least being TEMPERATURE for instance (or SALINITY)
NAMES OF TRACERS ='TEMPERATURE';'UNIFORM DECAY';'DEPTH DECAY'
Then in your PRINCI, you can directly access the value of TRACER #1 at any IPOIN with TA%ADR(1)%P%R(IPOIN) and use it the DECAY formulation ...
or in a mor generic way, you can used IND_T (or IND_S for SALINITY), which is the indice for which TEMPERATURE (SALINITY) has been recognised automatically by TELEMAC: TA%ADR(IND_T)%P%R(IPOIN)
Hope this helps.
Sébastien.