Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Might have found small bug in the vertical tracer gradient used in the horizontal redi diffusivity #544

Open
patrickscholz opened this issue Dec 6, 2023 · 5 comments
Assignees
Milestone

Comments

@patrickscholz
Copy link
Contributor

I think to compute the vertical tracer gradient we need here hnode and not hnode_new. hnode_new at this point already contains the new vertical grid (in case of zstar) but i think the horizontal redi diffusivity is still done on the old vertical grid. Since we also use helem (old vertical grid ) to compute the horizontal diffusive fluxes.

Am i right? In this case it would change our default testcase!

This problem only account for the zstar and zlevel case

DO n=1, myDim_nod2D+eDim_nod2D
!!PS nlev=nlevels_nod2D(n)
nzmax=nlevels_nod2D(n)
nzmin=ulevels_nod2D(n)
!!PS DO nz=2, nlev-1
DO nz=nzmin+1, nzmax-1
dz=0.5_WP*(hnode_new(nz-1,n)+hnode_new(nz,n))
tr_z(nz, n)=(ttf(nz-1,n)-ttf(nz,n))/dz
END DO
!!PS tr_z(1, n)=0.0_WP
!!PS tr_z(nlev, n)=0.0_WP
tr_z(nzmin, n)=0.0_WP
tr_z(nzmax, n)=0.0_WP

@patrickscholz
Copy link
Contributor Author

just spoke with Sergey about, so its definitely a bug and needs to be changed. Not sure how large is its implication, most likely not to big.

@patrickscholz
Copy link
Contributor Author

patrickscholz commented Dec 22, 2023

I think i just might have found another issue regarding Redi diffusivity ...

fesom2/src/oce_ale_tracer.F90

Lines 960 to 1000 in 2695a5d

!$OMP END DO
! no halo exchange of tr_xynodes is needed !
!$OMP DO
do n=1, myDim_nod2D
nl1=nlevels_nod2D(n)-1
ul1=ulevels_nod2D(n)
vd_flux=0._WP
!_______________________________________________________________________
zbar_n(1:mesh%nl )=0.0_WP
z_n (1:mesh%nl-1)=0.0_WP
zbar_n(nl1+1)=zbar_n_bot(n)
z_n(nl1)=zbar_n(nl1+1) + hnode_new(nl1,n)/2.0_WP
do nz=nl1, ul1+1, -1
zbar_n(nz) = zbar_n(nz+1) + hnode_new(nz,n)
z_n(nz-1) = zbar_n(nz) + hnode_new(nz-1,n)/2.0_WP
end do
zbar_n(ul1) = zbar_n(ul1+1) + hnode_new(ul1,n)
!_______________________________________________________________________
do nz=ul1+1,nl1
vd_flux(nz)=(z_n(nz-1)-zbar_n(nz))*(slope_tapered(1,nz-1,n)*tr_xynodes(1,nz-1,n)+slope_tapered(2,nz-1,n)*tr_xynodes(2,nz-1,n))*Ki(nz-1,n)
vd_flux(nz)=vd_flux(nz)+&
(zbar_n(nz)-z_n(nz)) *(slope_tapered(1,nz,n) *tr_xynodes(1,nz,n) +slope_tapered(2,nz,n) *tr_xynodes(2,nz,n)) *Ki(nz,n)
vd_flux(nz)=vd_flux(nz)/(z_n(nz-1)-z_n(nz))*area(nz,n)
enddo
do nz=ul1,nl1
del_ttf(nz,n) = del_ttf(nz,n)+(vd_flux(nz) - vd_flux(nz+1))*dt/areasvol(nz,n)
enddo
end do
!$OMP END DO
!$OMP END PARALLEL
end subroutine diff_ver_part_redi_expl
!
!
!===============================================================================
subroutine diff_part_hor_redi(tracers, partit, mesh)
use o_ARRAYS
use MOD_MESH
USE MOD_PARTIT

... also here when computing zbar_n and z_n we must use the old hnode not the new one, since its the explicte part of Redi ?!

@christian-stepanek
Copy link

Hi @patrickscholz, is it known whether or not the bug leads to problems so severe that one should upgrade the FESOM2 source code asap? If it is severe, is there already an accepted fix? Thanks a lot for reporting this!!!

@patrickscholz
Copy link
Contributor Author

@christian-stepanek, I havent tested yet the full severity of that issue since i had other things to do before the holidays. I just stumbelt over these things while working on another problem. Maybe i manage to make some test runs in the next weeks! The problem here is also that this will change our fesom testcases for binary identiy. When we merge this these need to be done new

@christian-stepanek
Copy link

Thanks a lot @patrickscholz, I will keep my eyes open re any updates on this issue.

@JanStreffing JanStreffing added this to the FESOM 2.7 milestone Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants