# Wrong runoffs temperature/salinity fluxes ?

Reported by:reporter: Owned by:owner: The author of the ticket. Person in charge for handling jchanut systeam high TRA 4.0-HEAD major runoffs, smasson failed no Unspecified

#### Context

Temperature fluxes due to runoffs (ln_rnf)

#### Analysis

Temperature and salt fluxes are prescribed at runoffs points in trasbc such that

```155	      IF( ln_rnf ) THEN         ! input of heat and salt due to river runoff
156	         zfact = 0.5_wp
157	         DO_2D_01_00
158	            IF( rnf(ji,jj) /= 0._wp ) THEN
159	               zdep = zfact / h_rnf(ji,jj)
160	               DO jk = 1, nk_rnf(ji,jj)
161	                                     pts(ji,jj,jk,jp_tem,Krhs) = pts(ji,jj,jk,jp_tem,Krhs)                                  &
162	                                        &                      +  ( rnf_tsc_b(ji,jj,jp_tem) + rnf_tsc(ji,jj,jp_tem) ) * zdep
163	                  IF( ln_rnf_sal )   pts(ji,jj,jk,jp_sal,Krhs) = pts(ji,jj,jk,jp_sal,Krhs)                                  &
164	                                        &                      +  ( rnf_tsc_b(ji,jj,jp_sal) + rnf_tsc(ji,jj,jp_sal) ) * zdep
165	               END DO
166	            ENDIF
167	         END_2D
168	      ENDIF
```

If no external temperature data is read (we expect only a dilution effect from rivers), temperature fluxes defined in sbcrnf as:

``` rnf_tsc(:,:,jp_tem) = MAX( sst_m(:,:), 0.0_wp ) * rnf(:,:) * r1_rho0
```

Let's now consider the boundary condition on vertical fluxes applied in the advection step, that I did forget in my first analysis of the problem:

```156	         IF( ln_linssh ) THEN    ! top ocean value (only in linear free surface as zwz has been w-masked)
162	               zwz(:,:,1) = pW(:,:,1) * pt(:,:,1,jn,Kbb)
164	         ENDIF
```

Combining all of this and assuming that runoffs are applied only at the surface (i.e. the default), one get for the temperature change due to rivers in the top layer:

```	         IF( ln_linssh ) THEN    ! top ocean value (only in linear free surface as zwz has been w-masked)
pts(,:,1,jn,Krhs) = rnf(:,:) * r1_rho0 * ( sst_m(:,:) - pts(:,:,1,jn,Kbb) ) / e3t(:,:,1,Kmm)
ELSE
pts(,:,1,jn,Krhs) = rnf(:,:) * r1_rho0 *  sst_m(:,:) / e3t(:,:,1,Kmm)
ENDIF

! and since sst_m is close to pts(:,:,1,jn,Kbb)

IF( ln_linssh ) THEN    ! top ocean value (only in linear free surface as zwz has been w-masked)
pts(,:,1,jn,Krhs) = 0.
ELSE
pts(,:,1,jn,Krhs) = rnf(:,:) * r1_rho0 * pts(:,:,1,jn,Kbb) / e3t(:,:,1,Kmm)
ENDIF
```

Unless I did a mistake in my analysis again, we get a virtual temperature flux with variable volume, although this is not necessary (we expect the dilution is properly handled by the volume variation). In the linear free-surface, however, we expect a virtual flux to represent this effect, but it is null.
The next problem to solve is to properly handle an input of heat or salt.

(No commits)

### comment:2 Changed 12 months ago by jchanut

• Description modified (diff)
• Summary changed from Wrong sign for runoffs temperature/salinity fluxes ? to Wrong runoffs temperature/salinity fluxes ?

### comment:3 Changed 12 months ago by jchanut

• Description modified (diff)
• Resolution set to invalid
• Status changed from new to closed

After discussions (thanks Gurvan !), I understood the philosophy behind the local heat compensation due to runoff. A corrective flux is applied, no matter local convergence of heat could compensate the temperature decrease due to dilution, hence "a null temperature flux" approach. Code is therefore consistent with what was intended (and not reading temperature data doesn't mean there's no runoff temperature flux).

Note: See TracTickets for help on using tickets.