File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,35 @@ export class CLASS {
230230 return ( 100.0 * this . ml . qt ) / qsat_h ;
231231 }
232232
233+ /** LCL */
234+ get LCL ( ) : number {
235+ this . assertMixedLayer ( ) ;
236+ /** this is also copied from the original CLASS, in turn from Bolton (2008) */
237+
238+ // Iterative solution for LCL
239+ const g = 9.81 ;
240+ const cp = 1005.0 ;
241+ const Rd = 287.05 ;
242+ const Rv = 461.5 ;
243+ const Lv = 2.5e6 ;
244+
245+ let i = 0 ;
246+ let RHlcl = 0.9998 ;
247+ let lcl = this . ml . h ;
248+
249+ while ( ( RHlcl <= 0.9999 || RHlcl >= 1.0001 ) && i < 20 ) {
250+ // Limit max iter to 20, in case of e.g. q=0
251+ lcl = lcl + ( 1 - RHlcl ) * 1000 ;
252+ const Plcl = this . _cfg . p0 / Math . exp ( ( g * lcl ) / ( Rd * this . ml . theta ) ) ;
253+ const Tlcl = this . ml . theta / ( this . _cfg . p0 / Plcl ) ** ( Rd / cp ) ;
254+ const esatlcl = 0.611e3 * Math . exp ( ( Lv / Rv ) * ( 1 / 273.15 - 1 / Tlcl ) ) ;
255+ const elcl = ( this . ml . qt * Plcl ) / 0.622 ;
256+ RHlcl = elcl / esatlcl ;
257+ i ++ ;
258+ }
259+ return lcl ;
260+ }
261+
233262 // Lapse rates
234263
235264 /** Free atmosphere potential temperature lapse rate */
Original file line number Diff line number Diff line change @@ -110,6 +110,11 @@ export const outputVariables = {
110110 unit : "%" ,
111111 symbol : "RH_h" ,
112112 } ,
113+ LCL : {
114+ title : "Lifting condensation level" ,
115+ unit : "m" ,
116+ symbol : "LCL" ,
117+ } ,
113118} as const satisfies Record < string , VariableInfo > ;
114119
115120export type OutputVariableKey = keyof typeof outputVariables ;
You can’t perform that action at this time.
0 commit comments