UWG model simulation failed

  1. Solution exception:The UWG failed to run:
    UWG model simulation failed.
    math domain error
    Traceback (most recent call last):
    File “C:\Users\Mohammad El-Ghandour\ladybug_tools\python\lib\site-packages\uwg\cli\simulate.py”, line 50, in simulate_json_model
    uwg_model.simulate()
    File “C:\Users\Mohammad El-Ghandour\ladybug_tools\python\lib\site-packages\uwg\uwg.py”, line 1352, in simulate
    self.RSM)
    File “C:\Users\Mohammad El-Ghandour\ladybug_tools\python\lib\site-packages\uwg\urbflux.py”, line 38, in urbflux
    BEM[j].building.BEMCalc(UCM, BEM[j], forc, parameter, simTime)
    File “C:\Users\Mohammad El-Ghandour\ladybug_tools\python\lib\site-packages\uwg\building.py”, line 539, in BEMCalc
    psychrometrics(self.indoor_temp, self.indoor_hum, forc.pres)
    File “C:\Users\Mohammad El-Ghandour\ladybug_tools\python\lib\site-packages\uwg\psychrometrics.py”, line 52, in psychrometrics
    alpha = log(_pw)
    ValueError: math domain error

I am trying to create a simulation but I receive this error
Kindly does anyone know the reason for it? I need some help

Hey @Mohammad.ElGhandour ,

Thanks for reporting and it looks like you might have found a bug (or at least a limitation) in the psychrometric calculations performed by the Urban Weather Generator (UWG). You can see that this is the specific line of code where things are failing:

And I imagine that we’re somehow trying to take the log of a negative number. It’s possible that this results from something odd about the EPW file that you are trying to morph for urban heat island. Would you be able to share this EPW file so that we can see whether there’s something erroneous about it? If the EPW all looks good, then I imagine that we could implement a patch for this case in the UWG.

CC: @SaeranVasanthakumar , @josephyang

These kinds of errors could just be part of the general limitations of the finite difference approach, which can be derailed by big swings in input data, coarse discretizations, or rounding errors caused by our floating point tolerances.

The domain of log excludes 0, so I think a very small increment that gets rounded to 0 is definitely likely. Trying to figure out what caused that error is tricky though, since it could be caused by something several timesteps prior, by any of the values contributing to the heat balance.

There are solutions, or improvements that can be made to the code to fix this (a simple one may be to include a warm-up period so the starting conditions), however, in the past I’ve usually found the error occurs when users use extreme input values, that aren’t intended to be modeled by the UWG.

This could be the case here. In the error screenshot, I noticed there seems to be some extreme values for inputs that don’t align with the kind of urban conditions needed for the UWG:

image

@Mohammad.ElGhandour are these the values you’re actually using as inputs to the simulation? If not, can you share your inputs?

Thanks Chris for your consideration.

These are the two epw files that I used.
https://energyplus-weather.s3.amazonaws.com/africa_wmo_region_1/EGY/EGY_Cairo.623660_IWEC/EGY_Cairo.623660_IWEC.zip

https://energyplus-weather.s3.amazonaws.com/africa_wmo_region_1/EGY/EGY_Helwan.623780_ETMY/EGY_Helwan.623780_ETMY.zip

Many thanks for your consideration.
Kindly find my rhino and gh files in this link

Just a side note, if you’re using this for work, do try to use the updated ones from https://climate.onebuilding.org/. Especially for the Helwan file, the data is all from 1960’s.

1 Like

Good catch, @SaeranVasanthakumar . Having a building footprint area near zero seems to be the reason why everything was failing and it’s definitely not realistic.

@Mohammad.ElGhandour ,
You really need to check the outputs of the components since you were joining the entire urban area into a single building, thereby resulting in a building footprint from only one of your solid geometries. For your UWG simulation, I wouldn’t bother with separating the ground stories to make them Retail until you have gotten a better sense of data list/tree management in Grasshopper and a better understanding of the Dragonfly Room/Story/Building object hierarchy described in this tutorial:

You’re just going to be making your simulation less accurate unless you understand what you are doing with each component.

I also just wouldn’t put in a detailed terrain surface that includes all of this area outside of the actual buildings and you should probably watch this tutorial on simulation with the UWG in particular:

Here’s a version of your file that runs successfully:
UWGmodel.gh (1.0 MB)

Many many thanks for your feedback, I really appreciate it so much. I wish you the best really, Thanks again!!