Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix uninitialized variables #147

Merged
merged 2 commits into from
Dec 20, 2024
Merged

Fix uninitialized variables #147

merged 2 commits into from
Dec 20, 2024

Conversation

fjansson
Copy link
Contributor

  • Uninitialized variables in the new LSM: two actually uninitialized and some more are now zeroed before reading in netcdf, to avoid uninitialized halos.

  • in the open boundary conditions, phase velocity was used uninitialized in the first time step

cveg, land_frac were not initialized

added initialization of tile parameters to make sure they are not undefined even in the halo (where they should not be used anyway)

Also fix stats output for drizzle - no qr, Nr defined so less stats is possible
@@ -177,6 +178,7 @@ subroutine openboundary_initfields
if(.not.linithetero) return
u0 = 0.; um = 0.; v0 = 0.; vm = 0.; w0 = 0.; wm = 0.;
thl0 = 0.; thlm = 0.; qt0 = 0; qtm = 0; e120 = 0.; e12m = 0.
up = 0.; vp = 0.; wp = 0. ! do we need this?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modfields/initfields already zeroes these arrays, and is called before initopenboundary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! I'll remove that line and then merge

boundary(...)%uphase is used in openboundary_tend but
was set in subroutine openboundary_phasevelocity,
called in the time loop *after* openboundary_tend.

For now fixed by calling openboundary_phasevelocity near the end of
startup().  Note the placement is tricky, because it has to be after
rhobf has been initialized.

Also moved the allocation and initialization of rhointi from initopenboundary
to startup, so that it's done before the first openboundary_phasevelocity
but after rhobf.
@fjansson fjansson force-pushed the dev-fix-more-uninitialized branch from 39d34ef to 134eb6b Compare December 20, 2024 15:42
@fjansson fjansson merged commit 1d02719 into dev Dec 20, 2024
26 checks passed
@fjansson fjansson deleted the dev-fix-more-uninitialized branch December 20, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants