Git Product home page Git Product logo

suews's Introduction

SUEWS

THIS PROJECT IS ARCHIVED AND NOW MAINTAINED BY @UMEP-dev.


This is a public repo for SUEWS source code and documentation.

Documentation

Developer Note

Branch

Central curated branches

These branches are regularly curated by admin members with specific purposes and set with triggers for automatic deployment (via MS Azure Pipeline) in the releases page named Latest Release Test:

  • master:
    • the main branch that keeps milestone and stable features.
    • push is restricted to admin members.
  • develop:
    • used for core developments.
    • push is restricted to admin members.

Manual

  • Please keep the development changes documented in the Documentation repo.
  • The SUEWS docs are mainly written in RST but Markdown is also acceptable.
  • Your changes to docs will be reviewed and merged into public release if appropriate.

Test

Whenever changes are made, please run make test in the repo root to check if your changes are working or not. If any error, please resolve it or justify that the test is giving false alarm.

Tests and purposes

make test will perform the following checks:

  • if single-grid-multi-year run could be successful: to check if multi-year run is functional;
  • if multi-grid-multi-year run could be successful: to check if multi-grid run is functional;
  • if test run results could match those from the standard run (runs under BaseRun): to check if any non-functional changes would break the current code;
  • if all physics schemes are working: to check possible invalid physics schemes.

Workflow

The test workflow is as follows (details refer to the Makefile test recipe and related python code):

  1. clean existing build and rebuild the code;
  2. create a temporary directory as working directory to perform checks;
  3. copy the rebuilt SUEWS_{version} binary to the temporary folder;
  4. copy the version specific input files under Release/InputTables/{version} to the temporary folder (see below for its preparation);
  5. run python code to perform the above checks and write out test results to the console:
    1. if all tests are successful, the code is generally good to go;
    2. if any test failed, we NEED to look into the reasons for the failure and resolve them before any further feature-added operations.

Preparation of tests

  1. Prepare a base run:

    • under Test/BaseRun, create a folder named with version/feature info (e.g., 2019a);
    • perform a simulation to produce example output files, which will later be used as standard run to verify the correct code functionalities.

    Note: all the above input files will be automatically copied under Release/InputTables with explicit version/feature (e.g., Release/InputTables/2019a) and later archived in public releases for users; so carefully construct test data to include in the input files.

  2. Configure test namelist file Test/code/BTS_config.nml:

    • name_exe: the SUEWS binary name that will be used for testing.
    • dir_exe: the directory to copy name_exe.
    • dir_input: the directory to copy input files; suggested to be Release/InputTables/{version}.
    • dir_baserun: the base run against which to test identity in results.

Debugging with GDB

GDB is a generic debugging tool used along with gfortran. Here are some tips to debug SUEWS code:

GDB on macOS

Recent macOS (since High Sierra) introduces extra security procedures for system level operations that makes installation GDB more tedious than before. The best practice, in TS's option, to avoid hacking your macOS, is to use Linux docker images with gfortran&gdb installations: e.g., alpine-gfortran.

Once the docker image is installed, simply run this from the SUEWS root folder for debugging:

 docker run --rm -it -v $(pwd):/source cmplopes/alpine-gfortran /bin/bash

which will mount the current SUEWS directory to docker's path /source and enter the interactive mode for debugging.

debugging with GDB

  1. enable the debugging related flags in Makefile under SUEWS-SourceCode by removing the # after the equal sign =:
FCNOOPT = -O0
FFLAGS = -O3 $(STATIC) $(FCDEBUG) -Wall -Wtabs -fbounds-check -cpp \
					-Wno-unused-dummy-argument -Wno-unused-variable
  1. fully clean and recompile SUEWS:
make clean; make
  1. copy the recompiled SUEWS binary into your SUEWS testing folder (e.g., Test/BaseRun/2019a) and load it into GDB:
gdb SUEWS

run

then you should have stack info printed out by GDB if any runtime error occurs.

More detailed GDB tutorial can be found here.

Questions

  • Please raise issues for questions in the development so our progress can be well managed.

suews's People

Contributors

azure-pipelines[bot] avatar biglimp avatar hamidrezaomidvar avatar ljarvi avatar pjaysuews avatar suegrimmond avatar sunt05 avatar zhenkunl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

suews's Issues

incorporation of RSL wind profile

Hi @natalieth, I just read through your code and would suggest replace the avU10_ms, 10 m agl wind speed, produced as a diagnostic by SUEWS_cal_Diagnostics with your u(z) at z=10+z0m:

CALL SUEWS_cal_Diagnostics( &
dectime, &!input
avU1, Temp_C, avRH, Press_hPa, &
qh, qe, &
VegFraction, z, z0m, zdm, RA, avdens, avcp, lv_J_kg, tstep_real, &
RoughLenHeatMethod, StabilityMethod, &
avU10_ms, t2_C, q2_gkg, tskin_C)!output

How do you think?

to improve input table consistency

input tables are placed in two places:

  1. ReleaseRepo: for storing release related files;
  2. Test: for testing code and build.

These should be consolidated for better consistency.

Bug in Day of Week cycle

Describe the bug
Error in subroutine Day_Of_Week. The days of the week do not change correctly. I added a figure here to show the difference of weekday (1) /weekend (2) cycle over one year between the different versions of the code. I think that the change can be explained by the added line “DATE = 1” in the v2019 code. Is it needed there or can it be commented away?

DayofWeek_iu

Version and platform (please complete the following information):

  • SUEWS version: 2019a
  • linux

cbl suews v2017b

SUEWS_FILES.zip

Describe the Issue
Hello;
I made txt and nml files for the boundary layer. But when I run the model, I get an error. Can you help me find out where is the problem? I saved all these files to the desktop directory. I'm using version 2017b.

Location

Screenshots
cblinputnml
initialdata
error

Additional context
Add any other context about the problem here.

remove SOLWEIG option

this option has been deprecated for a while; so clean it from RunControl and alert users in the manual.

Snow related heat storage issue

@ljarvi reported this:

The issue with the storage heat flux is now mainly in summer time. When there is snow on ground, the model output looks almost identical to V2016a runs. I also found a few bugs in printing out the snow files and now they should be OK and one bug in snow fraction. I/we will push these soon so you can implement these to the main code.
As now storage heat flux gets too high values, is there something else in OHM_dqndt_cal_X that can increase the storage flux. Or can this simply be the different treating on how dQ is calculated. Did you see increasing values at sites you were testing? a1, a2 and a3 should be the same so the issue can only be in dQ/dt?

RSL profiles if zh is small

RSL profiles are not dependent on zh (combined tree and building canopy height):

dz = Zh/10.
zarray = (/(I, I=1, nz)/)*dz

But if the canopy height is small the heights are all very close to the surface and the entire U-profile will be 0's/NaN's. Alternatively, we can used fixed heights over which to calculate a profile.

remove netcdf support

reasons for doing so:

  • very rarely used
  • often causes troubles and glitches when coding the main SUEWS
  • be better handled by python tools, e.g., SuPy

SUEWS MODEL OUTPUT

Hello;
Excuse me I have a question. I ran suews and wrfchem for two dusty days. The incoming and outgoing wavelengths and sensible and latent heat flux of the wrfchem output for dusty days show high values compared to non-dusty days, but the suews model shows low values for dusty days compared to non-dusty days. My question is, which model output is right? I'm really confused.
can you help me?
Thanks and best wishes

tagging WRF-compliant SUEWS version/commit

@hamidrezaomidvar as we are approaching a satisfactory coupled version, it would be good to tag a SUEWS 2018c version that we have used for this project.
We may use a tag like WRF4.0-SUEWS2018c to denote the working versions used for this project.
Then we can move with 2019a, which I have already started.

Albedo_di versus albmax and albmin

Describe the bug
A clear and concise description of what the bug is.
I think we need to implement a checker in SUEWS side (in addition to to the checker we had before) which checks if albedo_id falls into the range of albmax and albmin. If initial alb_id is greater than albmax or smaller than albmin, it would lead to an incorrect calculation of alb.
To Reproduce
Attach your input files that can reproduce the bug.
put alb_id greater than alb_max or smaller than alb_min
Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Version and platform (please complete the following information):

  • SUEWS version: [e.g., 2018b]
  • OS: [e.g. macOS]

Additional context
Add any other context about the problem here.

Bug in QF_build calculations

Describe the bug
Error in the anthropogenic heat equation calculated using the inventory method. QF_build did not include building energy use factor and it followed anthropogenic heat profile.

Version and platform (please complete the following information):

  • SUEWS version: 2019a
  • linux

Other remarks
Possible correction added to test-dev-QF branch. I added the needed building energy use and changed the profile from the old anthropogenic heat profile to follow population profile. The anthropogenic heat profile is used preferably only when the inventory method is not used as it should contain components from traffic, human metabolism and buildings. The correction affects QF and also QH values if the inventory method is used.

ESTM initialisation issue

The numbers of mass layers are improperly initialised:

DO i = 1, 5
IF (zground(i) <= 0) THEN
Nground = i - 1
EXIT
ENDIF
ENDDO
DO i = 1, 5
IF (zroof(i) <= 0) THEN
Nroof = i - 1
EXIT
ENDIF
ENDDO
DO i = 1, 5
IF (zwall(i) <= 0) THEN
Nwall = i - 1
EXIT
ENDIF
ENDDO
DO i = 1, 5
IF (zibld(i) <= 0) THEN
Nibld = i - 1
EXIT
ENDIF
ENDDO
ENDIF ! ESTM related translation finished here.

What would happen if zground(5)>0? Nground is initialised NOWHERE!
Other variables have the same issue.

organisation of the `const` file

As we are enhancing the modularity of code, @zhenkunl and I feel many of the definitions in suews_ctrl_const.f95 can be reorganised into the respective modules.
It would be good to gather thoughts here on how to improve this.

CO2 dev: missing new gsModel implementation?

in the test example file for CO2 and driver.f95, I noticed gsModel=3 and gsModel=4 are used for surface resistance calculation.

IF(gsmodel == 3 .OR. gsmodel == 4) THEN ! With modelled 2 meter temperature
! Call LUMPS_cal_AtmMoist for dq and SurfaceResistance for gfunc with 2 meter temperature
! If modelled 2 meter temperature is too different from measured air temperature then
! use temp_c
IF(ABS(Temp_C - t2_C)>5)THEN
t2 = Temp_C
ELSE
t2 = t2_C
ENDIF
CALL LUMPS_cal_AtmMoist( &
t2, Press_hPa, avRh, dectime, &! input:
dummy1, dummy2, &! output:
dummy3, dummy4, dummy5, dummy6, dq, dummy7, dummy8, dummy9)
CALL SurfaceResistance( &
id, it, &! input:
SMDMethod, snowFrac, sfr, avkdn, t2, dq, xsmd, vsmd, MaxConductance, &
LAIMax, LAI_id, gsModel, Kmax, &
G1, G2, G3, G4, G5, G6, TH, TL, S1, S2, &
gfunc2, dummy10, dummy11)! output:
ENDIF

However, related implementations are missing from phys_resist.f95.
Have they actually been implemented?

For now, I temporally changed the conductance code to get the new CO2 version running; but this might needs further infestation.

add Doxygen and sphinx support

  • add Doxygen support
  • add exhale support for sphinx
  • generate call-graphs

- [ ] enrich the documentation of major components in the driver subroutine

Documentation for RSL wind profiles

At the moment this is default in 'test_dev_RSL'-branch but should be added as an option. Will update when model is further developed

Wind profiles in the roughness sublayer
Wind profiles are derived at 30 levels in the surface layer. In order to account for the roughness sublayer and canopy layer, we follow Harman and Finnigan (2007) and Theeuwes et al. (2019).
The 30 levels have a step of 0.1 times the canopy height (should still output zh somewhere) dz = 0.1 * zh. However. if 3 x canopy height is less the 10 m steps of 0.3333 m are used:
IF ((3.*Zh) < 10.) THEN
dz = 1./3.
zarray = (/(I, I=1, nz)/)*dz...
Here nz is 30.

The results are written to ..._RSL_60.txt, where U_1 ... U_30 are the the wind speed calculated at 0.1Zh ... 3.0Zh.

References:
Harman IN, Finnigan JJ (2007) A simple uni ed theory for flow in the canopy and roughness sublayer. Boundary-Layer Meteorol 123(2):339--363
Theeuwes NE, Ronda RJ, Harman IN, Christen A, Grimmond CSB (2019) Parametrizing Horizontally Averaged Wind and Temperature Profiles in the Urban Roughness Sublayer. Boundary-Layer Meteorol accepted

LAI issue

@havum please attach the SUEWS files for reproducing your issues here.

update development guideline

Describe the bug

the guideline needs to be updated for new developers.

Location
https://suews-docs.readthedocs.io/en/latest/development/coding_guideline.html

Expected statement

`GDD` not updated correctly according to `BaseT` and `BaseTe`

Describe the bug
different BaseT and BaseTe values set for different vegetation land covers interfere each other and lead to unexpected GDD values.

To Reproduce
Set different BaseT and BaseTe values for the three vegetation types.

Expected behavior
BaseT and BaseTe set for a given vegetation LC should only alter GDD for that specific LC rather than affect others.

Version and platform (please complete the following information):

  • SUEWS version: all version since 2018a; even previous ones.
  • OS: all platforms.

Additional context
@hamidrezaomidvar found this issue.

WUProfM_24Hr and WUProfA_24Hr have been defined twice

I found WUProfM_24Hr and WUProfA_24Hr have been defined twice in suews_ctrl_const.f95 under master branch by accident. Since they are in different modules (allocateArray and sues_data), I assume only one pair of them are actually used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.