Skip to content

Commit

Permalink
Added groups for control parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
lars2015 committed Aug 8, 2024
1 parent a7ea901 commit 4a4cbf4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GPU ?= 0
GPU_PIN ?= 0

# Static compilation...
STATIC ?= 0
STATIC ?= 1

# Optimization flags...
OPTI ?= -O3
Expand Down
28 changes: 17 additions & 11 deletions src/mptrac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2136,10 +2136,14 @@ void locate_vert(
double height_ap,
int *ind) {

ind[0] = locate_irr_float(profiles[lon_ap_ind][lat_ap_ind], np, height_ap, 0);
ind[1] = locate_irr_float(profiles[lon_ap_ind + 1][lat_ap_ind], np, height_ap, ind[0]);
ind[2] = locate_irr_float(profiles[lon_ap_ind][lat_ap_ind + 1], np, height_ap, ind[1]);
ind[3] = locate_irr_float(profiles[lon_ap_ind + 1][lat_ap_ind + 1], np, height_ap, ind[2]);
ind[0] = locate_irr_float(profiles[lon_ap_ind][lat_ap_ind],
np, height_ap, 0);
ind[1] = locate_irr_float(profiles[lon_ap_ind + 1][lat_ap_ind],
np, height_ap, ind[0]);
ind[2] = locate_irr_float(profiles[lon_ap_ind][lat_ap_ind + 1],
np, height_ap, ind[1]);
ind[3] = locate_irr_float(profiles[lon_ap_ind + 1][lat_ap_ind + 1],
np, height_ap, ind[2]);
}

/*****************************************************************************/
Expand Down Expand Up @@ -2950,20 +2954,20 @@ void module_h2o2_chem(
/* Henry constant of H2O2... */
double H_h2o2 = 8.3e2 * exp(7600 * (1 / t - 1 / 298.15)) * RI * t;

/* Correction factor for high SO2 concentration (When qnt_Cx is difined, the correction switch on)... */
/* Correction factor for high SO2 concentration
(if qnt_Cx is defined, the correction is switched on)... */
double cor = 1;
if (ctl->qnt_Cx >= 0)
cor =
atm->q[ctl->qnt_Cx][ip] >
cor = atm->q[ctl->qnt_Cx][ip] >
low ? a * pow(atm->q[ctl->qnt_Cx][ip], b) : 1;

double h2o2 = H_h2o2
* clim_zm(&clim->h2o2, atm->time[ip], atm->lat[ip], atm->p[ip])
* M * cor * 1000 / AVO; /* unit: mol/L */

/* Volume water content in cloud [m^3 m^(-3)]... */
double rho_air = 100 * atm->p[ip] / (RI * t) * MA / 1000;
double CWC = (lwc + rwc) * rho_air / 1000; // TODO: check this? wrong units?
double CWC = (lwc + rwc) * rho_air / 1000; // TODO: check this? wrong units?

/* Calculate exponential decay (Rolph et al., 1992)... */
double rate_coef = k * K_1S * h2o2 * H_SO2 * CWC;
Expand Down Expand Up @@ -4973,7 +4977,8 @@ void read_ctl(
ctl->met_vert_coord =
(int) scan_ctl(filename, argc, argv, "MET_VERT_COORD", -1, "0", NULL);
if (ctl->advect_vert_coord == 2 && ctl->met_vert_coord != 1)
ERRMSG("Using advect_vert_coord = 2 requires meteo data on model levels!");
ERRMSG
("Using ADVECT_VERT_COORD = 2 requires meteo data on model levels!");
ctl->met_clams =
(int) scan_ctl(filename, argc, argv, "MET_CLAMS", -1, "0", NULL);
ctl->advect_cpl_zeta_and_press_modules =
Expand Down Expand Up @@ -5050,7 +5055,8 @@ void read_ctl(
if (ctl->met_np > EP)
ERRMSG("Too many levels!");
ctl->met_press_level_def =
(int) scan_ctl(filename, argc, argv, "MET_PRESS_LEVEL_DEF", -1, "-1", NULL);
(int) scan_ctl(filename, argc, argv, "MET_PRESS_LEVEL_DEF", -1, "-1",
NULL);
if (ctl->met_press_level_def >= 0) {
level_definitions(ctl);
} else {
Expand Down
20 changes: 19 additions & 1 deletion src/mptrac.h
Original file line number Diff line number Diff line change
Expand Up @@ -2129,11 +2129,13 @@ void thrustSortWrapper(
* @brief Control parameters.
*
* This structure contains all control parameters used by the MPTRAC
* model. The struct is used to collect to easily pass the control
* model. The struct is used to collect and to easily pass the control
* parameters on to the various functions.
*/
typedef struct {

/* TODO: finally sort ctl parameters once Fortran wrapper is working! */

/*! Coupled use of pressure based modules and diabatic advection.
(0= no coupling, 1= coupling) */
int advect_cpl_zeta_and_press_modules;
Expand All @@ -2150,6 +2152,10 @@ typedef struct {
/*! Read MPTRAC or CLaMS meteo data (0=MPTRAC, 1=CLaMS). */
int met_clams;

/* ------------------------------------------------------------
Quantity parameters...
------------------------------------------------------------ */

/*! Number of quantities. */
int nq;

Expand Down Expand Up @@ -2441,6 +2447,10 @@ typedef struct {
/*! Time step of simulation [s]. */
double dt_mod;

/* ------------------------------------------------------------
Meteo data parameters...
------------------------------------------------------------ */

/*! Basename for meteo data. */
char metbase[LEN];

Expand Down Expand Up @@ -2566,6 +2576,10 @@ typedef struct {
/*! Use MPI to share meteo (0=no, 1=yes). */
int met_mpi_share;

/* ------------------------------------------------------------
Geophysical module parameters...
------------------------------------------------------------ */

/*! Time step for sorting of particle data [s]. */
double sort_dt;

Expand Down Expand Up @@ -2825,6 +2839,10 @@ typedef struct {
/*! HNO3 volume mixing ratio for PSC analysis. */
double psc_hno3;

/* ------------------------------------------------------------
Output parameters...
------------------------------------------------------------ */

/*! Basename of atmospheric data files. */
char atm_basename[LEN];

Expand Down

0 comments on commit 4a4cbf4

Please sign in to comment.