PHYEX 0.9.5
PHYsique EXternalisée
Loading...
Searching...
No Matches
pyphyex.phyex1d.simple_physics.SimplePhysics Class Reference
Inheritance diagram for pyphyex.phyex1d.simple_physics.SimplePhysics:
Collaboration diagram for pyphyex.phyex1d.simple_physics.SimplePhysics:

Public Member Functions

 __init__ (self, dt, method, name, tag, case, grid, prognostic_variables, attrs=None, mf_max=0.05, mf_dtheta=.5, mf_rt_factor=1.2, do_adjustment=True, do_shallow=True, do_turb=True)
 setup (self, init_state, duration)
 step (self, state, timestep, timestep_number)
Public Member Functions inherited from pyphyex.phyex1d.physics_base.PhysicsBase
 __init__ (self, dt, method, name, tag, case, grid, prognostic_variables)
 budget_add (self, state, key, value)
 budget_fields (self, state)
 budget_record (self, state, before, scheme, process, variables, timestep)
 finalize (self)
 execute (self, previous_state, timestep, timestep_number)
 add_vertical_coordinate (self, state)
 add_conversions (self, state)
 build_init_state (self, init_state)
 forcing (self, state, timestep, timestep_number)

Public Attributes

 mf_max = mf_max
 mf_dtheta = mf_dtheta
 mf_rt_factor = mf_rt_factor
 do_adjustment = do_adjustment
 do_shallow = do_shallow
 do_turb = do_turb
Public Attributes inherited from pyphyex.phyex1d.physics_base.PhysicsBase
 case = case
 grid = grid
 prognostic_variables = prognostic_variables
 cst = Cst()
int tkemin = 1e-6
list scalar_variables = []
bool budgets = False

Protected Member Functions

 _k_diff (self, theta, rv, u, v, ctx, sfth, sfrv, sfu, sfv, timestep)
 _preparation (self, state)
 _adjust (self, theta, rv, rc, ctx)
 _surface (self, state, ctx)
 _massflux (self, state, ctx, timestep)

Additional Inherited Members

Static Public Attributes inherited from pyphyex.phyex1d.physics_base.PhysicsBase
dict OPTIONS_HELP = {}
tuple BUDGET_VARIABLES = ('U', 'V', 'W', 'TH', 'TKE', 'RV', 'RC', 'RR', 'RI', 'RS', 'RG', 'RH')
dict BUDGET_STATE_NAMES
Protected Attributes inherited from pyphyex.phyex1d.physics_base.PhysicsBase
 _budget_keys = None
 _budget_active = list(self.BUDGET_VARIABLES)

Detailed Description

Simplified physics scheme.

Features:
  - all-or-nothing saturation adjustment (liquid only)
  - K-gradient turbulence with constant K
  - mass-flux shallow convection (prescribed half-sine profile)
  - WASP or prescribed surface fluxes
  - only vapour (v) and cloud liquid water (c)

Definition at line 12 of file simple_physics.py.

Constructor & Destructor Documentation

◆ __init__()

pyphyex.phyex1d.simple_physics.SimplePhysics.__init__ ( self,
dt,
method,
name,
tag,
case,
grid,
prognostic_variables,
attrs = None,
mf_max = 0.05,
mf_dtheta = .5,
mf_rt_factor = 1.2,
do_adjustment = True,
do_shallow = True,
do_turb = True )

Definition at line 35 of file simple_physics.py.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ _adjust()

pyphyex.phyex1d.simple_physics.SimplePhysics._adjust ( self,
theta,
rv,
rc,
ctx )
protected
Adjustment

Definition at line 261 of file simple_physics.py.

Here is the caller graph for this function:

◆ _k_diff()

pyphyex.phyex1d.simple_physics.SimplePhysics._k_diff ( self,
theta,
rv,
u,
v,
ctx,
sfth,
sfrv,
sfu,
sfv,
timestep )
protected
K-gradient diffusion tendencies for all variables in one pass.
Uses an implicit tridiagonal solver following PHYEX's TRIDIAG_THERMO.

Parameters
----------
theta : ndarray (nz,) — potential temperature
rv : ndarray (nz,) — water vapour mixing ratio
u, v : ndarray (nz,) — wind components
ctx : dict — context from _preparation
sfth, sfrv, sfu, sfv : float — surface fluxes
timestep : float — time step (s)

Returns
-------
tuple of ndarray — (tend_theta, tend_rv, tend_u, tend_v)

Definition at line 53 of file simple_physics.py.

Here is the caller graph for this function:

◆ _massflux()

pyphyex.phyex1d.simple_physics.SimplePhysics._massflux ( self,
state,
ctx,
timestep )
protected
Mass-flux shallow convection scheme with implicit tridiagonal solver
following PHYEX's TRIDIAG_MASSFLUX.

Updraft properties equal near-surface values (no perturbation).
Cloud top is the first flux level above ground where environmental
theta_l equals the updraft theta_l.  The mass-flux profile is a
half-sine (0 at surface, 0 at cloud top, max in the middle).

Parameters
----------
timestep : float — time step (s)

Returns
-------
tend_theta_l : ndarray (nkt,) — theta_l tendency (K/s)
tend_rt      : ndarray (nkt,) — total-water tendency (kg/kg/s)
tend_u       : ndarray (nkt,) — u-wind tendency (m/s²)
tend_v       : ndarray (nkt,) — v-wind tendency (m/s²)

Definition at line 410 of file simple_physics.py.

Here is the caller graph for this function:

◆ _preparation()

pyphyex.phyex1d.simple_physics.SimplePhysics._preparation ( self,
state )
protected
Compute grid, density and reference fields, return a context dict.

Definition at line 207 of file simple_physics.py.

Here is the caller graph for this function:

◆ _surface()

pyphyex.phyex1d.simple_physics.SimplePhysics._surface ( self,
state,
ctx )
protected
Compute surface fluxes, return (sfu, sfv, sfth, sfrv).

Definition at line 278 of file simple_physics.py.

Here is the caller graph for this function:

◆ setup()

pyphyex.phyex1d.simple_physics.SimplePhysics.setup ( self,
init_state,
duration )
Set up the scheme. Override in subclasses.

Reimplemented from pyphyex.phyex1d.physics_base.PhysicsBase.

Definition at line 47 of file simple_physics.py.

◆ step()

pyphyex.phyex1d.simple_physics.SimplePhysics.step ( self,
state,
timestep,
timestep_number )
Physics step. Override in subclasses.

Returns the state unchanged by default.

Reimplemented from pyphyex.phyex1d.physics_base.PhysicsBase.

Definition at line 588 of file simple_physics.py.

Here is the call graph for this function:

Member Data Documentation

◆ do_adjustment

pyphyex.phyex1d.simple_physics.SimplePhysics.do_adjustment = do_adjustment
  1. SATURATION ADJUSTMENT (all-or-nothing, liquid only)

Definition at line 43 of file simple_physics.py.

◆ do_shallow

pyphyex.phyex1d.simple_physics.SimplePhysics.do_shallow = do_shallow
  1. SHALLOW CONVECTION (mass flux)

Definition at line 44 of file simple_physics.py.

◆ do_turb

pyphyex.phyex1d.simple_physics.SimplePhysics.do_turb = do_turb
  1. K-GRADIENT TURBULENCE (K = (du/dz)^2)

Definition at line 45 of file simple_physics.py.

◆ mf_dtheta

pyphyex.phyex1d.simple_physics.SimplePhysics.mf_dtheta = mf_dtheta

Definition at line 41 of file simple_physics.py.

◆ mf_max

pyphyex.phyex1d.simple_physics.SimplePhysics.mf_max = mf_max

Definition at line 40 of file simple_physics.py.

◆ mf_rt_factor

pyphyex.phyex1d.simple_physics.SimplePhysics.mf_rt_factor = mf_rt_factor

Definition at line 42 of file simple_physics.py.


The documentation for this class was generated from the following file: