CenterForTheBuiltEnvironment / pythermalcomfort

Package to calculate several thermal comfort indices (e.g. PMV, PPD, SET, adaptive) and convert physical variables.
https://pythermalcomfort.readthedocs.io/en/latest/
MIT License
144 stars 52 forks source link

pet_steady function numpy array input and input limits. #111

Open shakir-azad opened 3 months ago

shakir-azad commented 3 months ago

Hi, I have encountered a few feature issues while using the pet_steady function and would like some clarification.

This is a brief description of the task at hand: I have previously used the utci function in the pythermalcomfort library to calculate UTCI for 2D topographies and have recently moved to the pet_steady function to find the PET for the 2D topographies.

As the pet_steady function does not take 2D-array inputs like the utci function, I iterated over each value of the 2D topography to calculate the PET of each point using the pet_steady function and get a 2D output.

Issues: While calculating the PET value I have encountered several instances of Runtime warnings with the message 'The iteration is not making good progress, as measured by the improvement from the last ten iterations' which is most likely a warning from the fsolve function in the pet_steady function. An example of an input causing this would be: _petsteady(tdb=31.7, tr=43.718616, rh=65.9, v=0.17980224, met=1.3, clo=0.9).

Questions: This leaves me pondering with 4 questions:

  1. Is there a bound to the acceptable input values for the pet_steady function?
  2. Can the runtime warnings be safely ignored as an output is produced?
  3. Is there a particular reason why the pet_steady function is not made to take 2D arrays as inputs to calculate the PET values of 2D maps directly? If not, can it be added?
  4. Is the method of iteration I am using to calculate the PET for 2D topographies valid?

Thanks.

eddes commented 2 months ago

Hello,

I will try and answer some of your questions:

  1. To the best I can remember, I have not seen bounds provided for the PET calculation routine. The model is little documented though, as you can see for yourself in the introduction of this paper or this one for the transient version.

  2. The determination of the PET implies solving a non linear system of equations. Sometimes the convergence is hard or numerical oscillations appear. Most of the time, runtime warnings can be ignored, given you compare the value of the PET obtained with the PET for close values of the ambient parameters (slightly change tdb, tr, v and check the result).

  3. Solving with 2D arrays would require quite some formatting of the code, as for each line of your array (tdb, tr, v, rh, met, clo) a system of three equations is to be solved, after which another simpler equation yields the PET. What is more, doing so you will discover that the procedure is more time consuming than what you would comfortably accept. I would hence suggest you to build directly a surrogate model of the PET (see e.g. SMT ) and use it for your 2D arrays. In similar use cases as the one you describe, it proved more efficient.

Hope this will help! Regards