Skip to content

Commit

Permalink
workaround for gfortran 5.3 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jornbr committed Jul 10, 2024
1 parent 1911a8e commit 38c966a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions _pygotm.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cimport numpy
import numpy

cdef extern void initialize(int nlev, const char* nml_file, const char* yaml_file, double** ptke, double** peps, double** pL, double** pnum, double** pnuh) nogil
cdef extern void finalize() nogil
cdef extern void finalize2() nogil
cdef extern void calculate(int nlev, double dt, const double* h, double D, double taus, double taub, double z0s, double z0b, const double* SS, const double* NN) nogil
cdef extern void calculate_3d(int nx, int nz, int nz, int istart, int istop, int jstart, int jstop, double dt, const int* mask, const double* h3d, const double* D, const double* u_taus, const double* u_taub, const double* z0s, const double* z0b, const double* NN, const double* SS, double* tke, double* eps, double* L, double* num, double* nuh)
cdef extern void diff(int nlev, double dt, double cnpar, int posconc, const double* h, int Bcup, int Bcdw, double Yup, double Ydw, const double* nuY, const double* Lsour, const double* Qsour, const double* Taur, const double* Yobs, double* Y)
Expand All @@ -25,7 +25,7 @@ stdout = open(stdout_path)
stderr = open(stderr_path)

def cleanup():
finalize()
finalize2()
close_redirected_output()
stdout.close()
stderr.close()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pygotm"
version = "0.1.1"
version = "0.1.2"
authors = [
{name = "Jorn Bruggeman", email = "jorn@bolding-bruggeman.com"},
{name = "Karsten Bolding", email = "karsten@bolding-bruggeman.com"}
Expand Down
6 changes: 4 additions & 2 deletions src/pygotm_wrapper.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ subroutine initialize(nlev, pnml_file, pyaml_file, ptke, peps, pL, pnum, pnuh) b
call c_f_pointer(c_loc(pnml_file), nml_file)
call c_f_pointer(c_loc(pyaml_file), yaml_file)

call finalize()
call finalize2()
allocate(store)
pathlen = index(yaml_file, C_NULL_CHAR) - 1
if (pathlen > 0) then
Expand All @@ -63,7 +63,9 @@ subroutine initialize(nlev, pnml_file, pyaml_file, ptke, peps, pL, pnum, pnuh) b
flush(unit=6)
end subroutine

subroutine finalize() bind(c)
! Note: finalize was renamend to finalize2 to prevent gfortran confusing
! it with store%finalize
subroutine finalize2() bind(c)
if (associated(store)) then
call clean_turbulence()
call clean_tridiagonal()
Expand Down

0 comments on commit 38c966a

Please sign in to comment.