Conversation
There was a problem hiding this comment.
Pull request overview
Fixes incorrect processing of the (\partial_{x_j}(S,\partial_{x_j} W)) contribution used in the (\langle w'\theta'\rangle) molecular diffusion term, addressing an error in the passive scalar (\langle w'\theta'\rangle) budget.
Changes:
- Corrects the file-key mapping used to read/write the
SdWdx,SdWdy, andSdWdzstatistic fields. - Switches these fields from
file_keys_UidSdxj[...]tofile_keys_SdUidxj[...]to align with the intended stored quantity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| file_type="fld", | ||
| file_name=full_fname_stat, | ||
| file_key=file_keys_UidSdxj[6], | ||
| file_key=file_keys_SdUidxj[6], |
There was a problem hiding this comment.
These hard-coded indices (6/7/8) are magic numbers and are easy to mis-map (which appears to be what happened previously for the SdW*d* fields). Consider replacing them with named constants (e.g., SDWDX_KEY_IDX = 6, etc.) or a small mapping (e.g., {'SdWdx': ..., 'SdWdy': ..., 'SdWdz': ...}) so it’s explicit which component each key refers to and reduces the chance of future index mistakes.
| file_type="fld", | ||
| file_name=full_fname_stat, | ||
| file_key=file_keys_UidSdxj[7], | ||
| file_key=file_keys_SdUidxj[7], |
There was a problem hiding this comment.
These hard-coded indices (6/7/8) are magic numbers and are easy to mis-map (which appears to be what happened previously for the SdW*d* fields). Consider replacing them with named constants (e.g., SDWDX_KEY_IDX = 6, etc.) or a small mapping (e.g., {'SdWdx': ..., 'SdWdy': ..., 'SdWdz': ...}) so it’s explicit which component each key refers to and reduces the chance of future index mistakes.
| file_type="fld", | ||
| file_name=full_fname_stat, | ||
| file_key=file_keys_UidSdxj[8], | ||
| file_key=file_keys_SdUidxj[8], |
There was a problem hiding this comment.
These hard-coded indices (6/7/8) are magic numbers and are easy to mis-map (which appears to be what happened previously for the SdW*d* fields). Consider replacing them with named constants (e.g., SDWDX_KEY_IDX = 6, etc.) or a small mapping (e.g., {'SdWdx': ..., 'SdWdy': ..., 'SdWdz': ...}) so it’s explicit which component each key refers to and reduces the chance of future index mistakes.
Fix$\frac{\partial}{\partial x_j} \left( S \frac{\partial W}{\partial x_j} \right)$ term in $\langle w' \theta' \rangle$ molecular diffusion, which was affecting the $\langle w' \theta' \rangle$ budget in the passive scalar statistics. Other budgets are not affected.