Skip to content

Morrison C++ zero-initializes cumulus tendency arrays and does not overwrite from input tendencies #3055

@asalmgren

Description

@asalmgren

Location

  • Source/Microphysics/Morrison/ERF_AdvanceMorrison.cpp:633-635
  • Source/Microphysics/Morrison/ERF_AdvanceMorrison.cpp:1080-1082
  • Fortran reference: Source/Microphysics/Morrison/ERF_module_mp_morr_two_moment.F90:818-820

Problem

The C++ path explicitly zeros the local cumulus tendency arrays:

qrcuten_arr(i,j,k) = 0;
qscuten_arr(i,j,k) = 0;
qicuten_arr(i,j,k) = 0;

and then uses those values to populate qrcu1d/qscu1d/qicu1d for microphysics.

Why this is a bug

This effectively forces cumulus detrainment tendencies to zero in the C++ pathway unless they are explicitly reloaded later (they are not in this path). The Fortran pathway copies the real input fields into qrcu1d/qscu1d/qicu1d, so the two implementations diverge whenever those tendencies are nonzero.

Suggested patch

Populate qrcu1d/qscu1d/qicu1d from the incoming tendency fields (qrcuten_arr/qscuten_arr/qicuten_arr inputs), not fr
om zeroed local placeholders.

--- a/Source/Microphysics/Morrison/ERF_AdvanceMorrison.cpp
+++ b/Source/Microphysics/Morrison/ERF_AdvanceMorrison.cpp
@@
-            morr_arr(i,j,k,MORRInd::qrcu1d) = morr_arr(i,j,k,MORRInd::qrcuten_arr);
-            morr_arr(i,j,k,MORRInd::qscu1d) = morr_arr(i,j,k,MORRInd::qscuten_arr);
-            morr_arr(i,j,k,MORRInd::qicu1d) = morr_arr(i,j,k,MORRInd::qicuten_arr);
+            morr_arr(i,j,k,MORRInd::qrcu1d) = qrcuten_arr(i,j,k);
+            morr_arr(i,j,k,MORRInd::qscu1d) = qscuten_arr(i,j,k);
+            morr_arr(i,j,k,MORRInd::qicu1d) = qicuten_arr(i,j,k);

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