From dec3f1f1d6fa1a2a4f0af04e782efe169bf7e974 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Sun, 9 Jun 2024 07:59:06 +0100 Subject: [PATCH 1/7] SUEWS-SS with same building fractions won't run Fixes #266 --- src/suews/src/suews_ctrl_driver.f95 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/suews/src/suews_ctrl_driver.f95 b/src/suews/src/suews_ctrl_driver.f95 index 0b1d0ab1..92dfbfcb 100644 --- a/src/suews/src/suews_ctrl_driver.f95 +++ b/src/suews/src/suews_ctrl_driver.f95 @@ -9850,7 +9850,10 @@ SUBROUTINE SUEWS_cal_surf_DTS( & ! get individual building fractions of each layer ! NB.: sum(sfr_roof) = building_frac(1) sfr_roof = 0. - IF (nlayer > 1) sfr_roof(1:nlayer - 1) = building_frac(1:nlayer - 1) - building_frac(2:nlayer) + IF (nlayer > 1) sfr_roof(1:nlayer - 1) = & + MAX( & + building_frac(1:nlayer - 1) - building_frac(2:nlayer), & + 0.01) ! minimum value for sfr_roof to avoid zero fractions when adjacent layers have the same building fraction sfr_roof(nlayer) = building_frac(nlayer) ! get individual net building height of each layer From f2864e37f9828e0738b4dae62586acfa12f220c9 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Thu, 13 Jun 2024 23:15:21 +0100 Subject: [PATCH 2/7] SUEWS-SS issue with more 7+ layers Fixes #268 --- src/suews/src/suews_ctrl_driver.f95 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/suews/src/suews_ctrl_driver.f95 b/src/suews/src/suews_ctrl_driver.f95 index 92dfbfcb..d9417d4f 100644 --- a/src/suews/src/suews_ctrl_driver.f95 +++ b/src/suews/src/suews_ctrl_driver.f95 @@ -2837,8 +2837,8 @@ SUBROUTINE SUEWS_cal_Main_DTS( & TYPE(HEAT_STATE) :: heatState_in, heatState_out REAL(KIND(1D0)), DIMENSION(nlayer) :: sfr_roof !roof surface fraction [-] REAL(KIND(1D0)), DIMENSION(nlayer) :: sfr_wall !wall surface fraction [-] - REAL(KIND(1D0)), DIMENSION(nsurf) :: tsfc0_out_roof !surface temperature of roof[degC] - REAL(KIND(1D0)), DIMENSION(nsurf) :: tsfc0_out_wall !surface temperature of wall[degC] + REAL(KIND(1D0)), DIMENSION(nlayer) :: tsfc0_out_roof !surface temperature of roof[degC] + REAL(KIND(1D0)), DIMENSION(nlayer) :: tsfc0_out_wall !surface temperature of wall[degC] REAL(KIND(1D0)), DIMENSION(nsurf) :: tsfc0_out_surf !surface temperature [degC] ! output arrays: From e2ec0b41b6ee46555a6e19f4ac8bece8d6883213 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Thu, 13 Jun 2024 23:15:32 +0100 Subject: [PATCH 3/7] chore: Clean up build artifacts --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 120c6a79..0ce31e64 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,7 @@ clean: $(MAKE) -C $(suews_dir) clean $(MAKE) -C $(supy_dir) clean $(MAKE) -C $(docs_dir) clean + rm -rf build dist *.egg-info # this is to test cibuildwheel locally cibw: From ee4f96c1b4268c424621ffe56c5cf4a079f3af17 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Thu, 13 Jun 2024 23:26:43 +0100 Subject: [PATCH 4/7] chore: Update compiler flags in supy_driver/meson.build --- src/supy_driver/meson.build | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/supy_driver/meson.build b/src/supy_driver/meson.build index 6901f042..62576de3 100644 --- a/src/supy_driver/meson.build +++ b/src/supy_driver/meson.build @@ -12,7 +12,14 @@ # set the compiler flags fortran_compiler = meson.get_compiler('fortran') if fortran_compiler.get_id() == 'gcc' - f90flags = ['-fPIC', '-fconvert=big-endian'] + f90flags = [ + '-fPIC', + '-fconvert=big-endian', + '-g', + '-O0', + '-fcheck=all', + # '-fsanitize=address', + ] fortran_program = find_program('gfortran') elif fortran_compiler.get_id() == 'intel' f90flags = ['-fpscomp logicals', '-fPIC'] @@ -21,7 +28,14 @@ endif add_global_arguments(f90flags, language: 'fortran') c_compiler = meson.get_compiler('c') -cflags = ['-fPIC', '-D_POSIX_C_SOURCE=200809L'] +cflags = [ + '-fPIC', + '-D_POSIX_C_SOURCE=200809L', + '-g', + '-O0', + '-fcheck=all', + # '-fsanitize=address', +] if c_compiler.get_id() == 'clang' cflags += ['-fbracket-depth=1024'] endif @@ -72,8 +86,8 @@ endforeach src_f95_files = files(src_f95_files) src_f95_sub = [ - 'suews_ctrl_driver.f95', # 'suews_ctrl_const.f95', + 'suews_ctrl_driver.f95', 'suews_phys_anemsn.f95', 'suews_phys_atmmoiststab.f95', 'suews_phys_dailystate.f95', @@ -196,7 +210,7 @@ fortranobject_c = incdir_f2py / 'fortranobject.c' inc_np = include_directories(incdir_numpy, incdir_f2py) # gh-25000 -dep_quadmath = fortran_compiler.find_library('quadmath', required: true) +# dep_quadmath = fortran_compiler.find_library('quadmath', required: true) # Share this object across multiple modules. lib_fortranobject = static_library( @@ -241,7 +255,7 @@ ext_supy_driver = py.extension_module( dependencies: [ dep_py, dep_fortranobject, - dep_quadmath, + # dep_quadmath, dep_suews, ], install: true, @@ -250,7 +264,7 @@ ext_supy_driver = py.extension_module( # move the generated `supy_driver.py` to the correct directory # this is kind of dummy, but it is necessary to make the installation work -gen_supy_driver_py=custom_target( +gen_supy_driver_py = custom_target( command: [ py, '@CURRENT_SOURCE_DIR@/patch_supy_driver.py', # Path to your Python wrapper script @@ -265,6 +279,4 @@ gen_supy_driver_py=custom_target( install_dir: [py.get_install_dir() / 'supy'], # this is the directory where the python module will be installed ) ################################################################## -# 5. add the test for the python module - -# TODO: add test for the python module \ No newline at end of file +# 5. add the test for the python module \ No newline at end of file From 17e78edea952bd285e18b9adcf7d2b0a79642f10 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Thu, 13 Jun 2024 23:26:52 +0100 Subject: [PATCH 5/7] chore: Update .gitignore to exclude save-AVL_6_vars273/ and AVL_*_vars* --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 99caee4d..1a56693a 100644 --- a/.gitignore +++ b/.gitignore @@ -403,3 +403,5 @@ supy_info.json src/supy_driver/build_dir src/supy_driver/log.build log.build +save-AVL_6_vars273/ +AVL_*_vars* From 42f52a004035661b7fd4e0378dc933503bf6ff4a Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Thu, 13 Jun 2024 23:56:37 +0100 Subject: [PATCH 6/7] chore: Update compiler flags in supy_driver/meson.build --- src/supy_driver/meson.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/supy_driver/meson.build b/src/supy_driver/meson.build index 62576de3..76f6e3e3 100644 --- a/src/supy_driver/meson.build +++ b/src/supy_driver/meson.build @@ -18,7 +18,6 @@ if fortran_compiler.get_id() == 'gcc' '-g', '-O0', '-fcheck=all', - # '-fsanitize=address', ] fortran_program = find_program('gfortran') elif fortran_compiler.get_id() == 'intel' @@ -33,8 +32,6 @@ cflags = [ '-D_POSIX_C_SOURCE=200809L', '-g', '-O0', - '-fcheck=all', - # '-fsanitize=address', ] if c_compiler.get_id() == 'clang' cflags += ['-fbracket-depth=1024'] From 429062528e015a0988b9f9aff4cdd715e9e73405 Mon Sep 17 00:00:00 2001 From: Ting Sun Date: Thu, 13 Jun 2024 23:58:23 +0100 Subject: [PATCH 7/7] chore: Update supy_driver/meson.build to find quadmath library --- src/supy_driver/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/supy_driver/meson.build b/src/supy_driver/meson.build index 76f6e3e3..d8cbddbd 100644 --- a/src/supy_driver/meson.build +++ b/src/supy_driver/meson.build @@ -207,7 +207,7 @@ fortranobject_c = incdir_f2py / 'fortranobject.c' inc_np = include_directories(incdir_numpy, incdir_f2py) # gh-25000 -# dep_quadmath = fortran_compiler.find_library('quadmath', required: true) +dep_quadmath = fortran_compiler.find_library('quadmath', required: true) # Share this object across multiple modules. lib_fortranobject = static_library( @@ -252,7 +252,7 @@ ext_supy_driver = py.extension_module( dependencies: [ dep_py, dep_fortranobject, - # dep_quadmath, + dep_quadmath, dep_suews, ], install: true,