atmtools / konrad

Implementation of a radiative-convective equilibrium model.
MIT License
19 stars 18 forks source link

Improve lapse rate interpolation #76

Closed SallyDa closed 5 years ago

SallyDa commented 5 years ago

Use the log of the pressure, so that the interpolation is approx linear with height.

lkluft commented 5 years ago

I like the approach, but I have two comments/questions.

  1. Is it possible to implement a separate function that we could reuse, e.g. konrad.utils.derive_pressure()?
  2. I have the feeling that it would be cleaner to return values at all levels (either full or half). Could you remind me why we need to return the number of full-levels of the half-level values?
SallyDa commented 5 years ago
  1. Yes it would be possible to do that, of course. I had a quick look through and I'm not sure where else we would use it, which is why I didn't do it as a general use function originally.

  2. If we do 1., then for sure it would be better to return values for all the levels / half levels. For the lapse rate, we use it to calculate the new temperature profile on full levels, as the surface temperature plus the sum (integral) of the half level lapse rate values multiplied by distance between the full levels. Can you picture that? Then, we don't need the uppermost half level lapse rate value, because there is no full level above that.

lkluft commented 5 years ago
  1. Okay, I am fine with either approach 😉
  2. Agreed. I had the stand-alone function in mind, but in this use case it obviously makes sense as is.
SallyDa commented 5 years ago

Okay, then I will merge as is. If we find that we need a similar function somewhere else, we can always move it then :)