emc2.simulator.subcolumn.set_q_n¶
- emc2.simulator.subcolumn.set_q_n(model, hyd_type, is_conv=True, qc_flag=False, inv_rel_var=None, use_rad_logic=True, parallel=True, chunk=None, q_trunc_thresh=1e-18, seed=None)[source]¶
This function distributes the mixing ratio and number concentration into the subcolumns. For \(q_c\), the horizontal distribution follows Equation 8 of Morrison and Gettelman (2008).
- Parameters:
- model: :func:`emc2.core.Model`
The model to calculate the mixing ratio in each subcolumn for.
- hyd_type: str
The hydrometeor type.
- is_conv: bool
Set to True to calculate the mixing ratio assuming convective clouds.
- qc_flag: bool
Set to True to horizontally distribute the mixing ratio (allowing sub-grid variability) according to Morrison and Gettleman (2008). qc_flag is set to False in case use_rad_logic and/or is_conv are True (both cases do not follow the Morrison scheme).
- inv_rel_var: float
The inverse of the relative subgrid qc PDF variance in Morrison and Gettleman (2008) Using the default value of 1 if the relative variance field exists in the Model object dataset. In such a case where the relative variance field exists, setting: inv_rel_var = 1 / rel_var where rel_var is the data field.
- use_rad_logic: bool
When True using the cloud fraction utilized in a model radiative scheme and also implementing uniformly distributed qc (setting qc_flag to False) to maintain radiation scheme logic. Otherwise, using the microphysics scheme (note that these schemes do not necessarily use exactly the same cloud fraction logic).
- parallel: bool or str
If True or ‘dask’, use Dask bag for parallelism (supports multi-node HPC via a distributed Dask scheduler). If ‘processes’, use ProcessPoolExecutor (faster on single-node workstations). If False, run serially.
- chunk: int or None
When parallel=’processes’, the chunksize hint for ProcessPoolExecutor.map (how many time steps are batched per worker). None auto-sizes to max(1, t_dim // cpu_count()). Ignored when parallel=True or ‘dask’.
- q_trunc_thresh: float
truncation value for q. Smaller values will be treated as 0.
- seed: int or None
Random seed for reproducibility. None (default) gives non-reproducible results with fully independent draws — best for production science runs. With an integer seed and parallel=False, a single global seed is set before the timestep loop (serial-only, statistically independent timesteps). With an integer seed and parallel=True/’processes’, each worker seeds with seed+tt (parallel-safe, with a weak cross-timestep correlation). See the seeding note above _randperm for full details.
- Returns:
- model:
emc2.core.Model() The model with mixing ratio calculated in each subcolumn.
- model:
References
Morrison, H. and A. Gettelman, 2008: A New Two-Moment Bulk Stratiform Cloud Microphysics Scheme in the Community Atmosphere Model, Version 3 (CAM3). Part I: Description and Numerical Tests. J. Climate, 21, 3642–3659, https://doi.org/10.1175/2008JCLI2105.1