Skip to content

Commit 8b6dab2

Browse files
authored
Merge pull request #675 from FESOM/fix_heatcontent
reorder heatcontent index to fix NG5 segfault
2 parents e260ab6 + 0369b42 commit 8b6dab2

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/gen_modules_diag.F90

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ subroutine compute_destinE(mode, dynamics, tracers, partit, mesh)
943943
#include "associate_part_ass.h"
944944
#include "associate_mesh_ass.h"
945945
if (firstcall) then !allocate the stuff at the first call
946-
allocate(heatcontent(ndepths, myDim_nod2D+eDim_nod2D))
946+
allocate(heatcontent(myDim_nod2D+eDim_nod2D, ndepths))
947947
heatcontent =0.0_WP
948948
firstcall=.false.
949949
if (mode==0) return
@@ -952,21 +952,21 @@ subroutine compute_destinE(mode, dynamics, tracers, partit, mesh)
952952

953953
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(n, nz, nzmin, nzmax, zint)
954954
DO n=1, myDim_nod2D
955-
heatcontent(:, n) =0.0_WP
955+
heatcontent(n, :) =0.0_WP
956956
nzmax=nlevels_nod2D(n)
957957
nzmin=ulevels_nod2D(n)
958958
zint=0.0_WP
959959
do nz=nzmin, nzmax-1
960960
zint=zint+hnode(nz, n)
961961
where (whichdepth>zint)
962-
heatcontent(:,n)=heatcontent(:,n)+temp(nz,n)*hnode(nz,n)
962+
heatcontent(n,:)=heatcontent(n,:)+temp(nz,n)*hnode(nz,n)
963963
end where
964964
end do
965-
heatcontent(:,n)=1025.*3990.*heatcontent(:,n)
965+
heatcontent(n,:)=1025.*3990.*heatcontent(n,:)
966966
END DO
967967
!$OMP END PARALLEL DO
968968
do n=1, size(whichdepth)
969-
call exchange_nod(heatcontent(n,:), partit)
969+
call exchange_nod(heatcontent(:,n), partit)
970970
end do
971971
end subroutine compute_destinE
972972
!_______________________________________________________________________________
@@ -3577,4 +3577,4 @@ subroutine dvd_add_clim_relax(do_SDdvd, tr_num, dvd_tot, tr, partit, mesh)
35773577
end do
35783578
end subroutine dvd_add_clim_relax
35793579

3580-
end module diagnostics
3580+
end module diagnostics

src/io_meandata.F90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,15 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
366366
! output heat content (for destine)
367367
CASE ('hc300m')
368368
if (ldiag_destinE) then
369-
call def_stream(nod2D, myDim_nod2D, 'hc300m', 'Vertically integrated heat content upper 300m', 'J m**-2', heatcontent(1,1:myDim_nod2D), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
369+
call def_stream(nod2D, myDim_nod2D, 'hc300m', 'Vertically integrated heat content upper 300m', 'J m**-2', heatcontent(1:myDim_nod2D,1), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
370370
end if
371371
CASE ('hc700m')
372372
if (ldiag_destinE) then
373-
call def_stream(nod2D, myDim_nod2D, 'hc700m', 'Vertically integrated heat content upper 700m', 'J m**-2', heatcontent(2,1:myDim_nod2D), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
373+
call def_stream(nod2D, myDim_nod2D, 'hc700m', 'Vertically integrated heat content upper 700m', 'J m**-2', heatcontent(1:myDim_nod2D,2), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
374374
end if
375375
CASE ('hc')
376376
if (ldiag_destinE) then
377-
call def_stream(nod2D, myDim_nod2D, 'hc', 'Vertically integrated heat content total column', 'J m**-2', heatcontent(3,1:myDim_nod2D), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
377+
call def_stream(nod2D, myDim_nod2D, 'hc', 'Vertically integrated heat content total column', 'J m**-2', heatcontent(1:myDim_nod2D,3), io_list(i)%freq, io_list(i)%unit, io_list(i)%precision, partit, mesh)
378378
end if
379379
!_______________________________________________________________________________
380380
!---wiso-code
@@ -2523,4 +2523,4 @@ SUBROUTINE send_data_to_multio(entry)
25232523
END DO
25242524
END SUBROUTINE
25252525
#endif
2526-
end module
2526+
end module

0 commit comments

Comments
 (0)