Skip to content

Turning off gravitational settling reads uninitialized memory #108

Description

@lrobion

Turning off gravitational settling is a valid setting in the input.yaml. It is read and if set to true, populates the falling velocity vector vFall_ in the LAGRIDPlumeModel object. Otherwise it is left uninitialized.

//Setup settling velocities
if ( simVars_.GRAVSETTLING ) {
vFall_ = AIM::SettlingVelocity( iceAerosol_.getBinCenters(), \
met_.tempRef(), simVars_.pressure_Pa );
}

However, vFall_ is used unconditionally in LAGRIDPlumeModel::RunTransport() so if settling is off, that points to uninitialized memory. Same when vFall_ is used in LAGRIDPlumeModel::remapAllVars().

Should turning off settling velocity even be an option? But right now it's leads to bugs.

As a side note, vFall_ is only computed once at initialization, but depends on temperature and pressure. The pressure is the reference pressure at which the contrail was emitted in the input.yaml, and T is the interpolated temperature at that point. This is not updated throughout the simulation: all transport steps use the falling velocity computed at $t_0$. I don't know how big of an effect this would make but this seems incorrect? I know that the "most correct" way of doing this would be to compute setting velocity at every cell of the grid, but we could get away with at least updating the numbers based on the mask centroid or something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions