Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check class #29

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 4 additions & 25 deletions packages/class/src/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import type { ClassConfig } from "./config";
const rho = 1.2; /** Density of air [kg m-3] */
const cp = 1005.0; /** Specific heat of dry air [J kg-1 K-1] */

// More constants that were stored as model props
// TODO: should these be settable via config? Or dynamically calculated? ???
// const ac = 0.0; /** Cloud core fraction [-] */ // unused
const M = 0.0; /** Cloud core mass flux [m s-1] */
const wqM = 0.0; /** Cloud core moisture flux [kg kg-1 m s-1] */
// const wCO2M = 0; /** CO2 mass flux [ppm m s-1] */ // unused

/**
* CLASS model definition
* @property _cfg: object containing the model settings
Expand Down Expand Up @@ -58,7 +51,7 @@ export class CLASS {

/** Tendency of CLB [m s-1]*/
get htend(): number {
return this.we + this.ws + this.wf - M;
return this.we + this.ws;
}

/** Tendency of mixed-layer potential temperature [K s-1] */
Expand All @@ -72,29 +65,20 @@ export class CLASS {
/** Tendency of potential temperature jump at h [K s-1] */
get dthetatend(): number {
const w_th_ft = 0.0; // TODO: add free troposphere switch
return (
this._cfg.mixedLayer.gammatheta * (this.we + this.wf - M) -
this.thetatend +
w_th_ft
);
return this._cfg.mixedLayer.gammatheta - this.thetatend + w_th_ft;
}

/** Tendency of mixed-layer specific humidity [kg kg-1 s-1] */
get qtend(): number {
return (
(this._cfg.mixedLayer.wq - this.wqe - wqM) / this.h +
this._cfg.mixedLayer.advq
(this._cfg.mixedLayer.wq - this.wqe) / this.h + this._cfg.mixedLayer.advq
);
}

/** Tendency of specific humidity jump at h[kg kg-1 s-1] */
get dqtend(): number {
const w_q_ft = 0; // TODO: add free troposphere switch
return (
this._cfg.mixedLayer.gammaq * (this.we + this.wf - M) -
this.qtend +
w_q_ft
);
return this._cfg.mixedLayer.gammaq - this.qtend + w_q_ft;
}

/** Entrainment velocity [m s-1]. */
Expand All @@ -114,11 +98,6 @@ export class CLASS {
return -this._cfg.mixedLayer.divU * this.h;
}

/** Mixed-layer growth due to radiative divergence [m s-1]. */
get wf(): number {
return this._cfg.radiation.dFz / (rho * cp * this.dtheta);
}

/** Entrainment kinematic heat flux [K m s-1]. */
get wthetae(): number {
return -this.we * this.dtheta;
Expand Down
10 changes: 0 additions & 10 deletions packages/class/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,10 @@ const mixedLayer = z
})
.describe("Mixed layer");

const radiation = z
.object({
dFz: z.coerce
.number()
.default(0)
.describe("Cloud top radiative divergence [W m-2]"),
})
.describe("Radiation");

export const classConfig = z.object({
initialState: initialState.default({}),
timeControl: timeControl.default({}),
mixedLayer: mixedLayer.default({}),
radiation: radiation.default({}),
});

export type ClassConfig = z.infer<typeof classConfig>;
Expand Down