Skip to content

Base State WRFInput#3177

Open
AMLattanzi wants to merge 9 commits into
erf-model:developmentfrom
AMLattanzi:BaseStateWRF
Open

Base State WRFInput#3177
AMLattanzi wants to merge 9 commits into
erf-model:developmentfrom
AMLattanzi:BaseStateWRF

Conversation

@AMLattanzi
Copy link
Copy Markdown
Collaborator

@AMLattanzi AMLattanzi commented May 13, 2026

Summary

The base state needs to be set such that \partial_{x_h} P_0 \approx 0. This PR now follows WRF in using a laterally homogeneous and dry state for HSE.

Regtest Implications

This PR will break the following regtests

  1. WPS_Terrain
  2. MetGrid

WRF Equations

image

Algorithm

  1. Compute z and set Pd, Td, Rd on the low side from WRF equations
  2. Compute z on high side and initialize data to the low side
  3. Newton-Raphson iterations through a pressure derivative. Note that we have Td(Pd) & Rd(Td,Pd). Use WRF equations for Td and EOS for Rd. This ensures a hydrostatic balance is achieved.
  4. Loop over all k in the domain and FOEXTRAP above and below the domain boundaries.

Result

Qv in the large tornado domain at 30 m AGL after 8 hrs of simulation (6 ITC --> 14 UTC):
image

@AMLattanzi AMLattanzi requested a review from asalmgren May 13, 2026 23:12
@asalmgren asalmgren requested review from cmkaul and pressel May 15, 2026 13:30
Copy link
Copy Markdown
Collaborator

@pressel pressel left a comment

Choose a reason for hiding this comment

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

See inline comments.

int khi = ubound(valid_bx).z;
int klo = lbound(valid_bx).z;

// ARW V4 Constants (5.2.2 Reference State)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is the right ARW reference-state form, but should these constants come from the WRFInput file or ERF inputs rather than being hard-coded?

WRF treats the reference-state parameters (p00, t00, tlp/base_lapse, tiso, tlp_strat, p_strat, p_top) as configurable/input values. If the wrfinput/wrfbdy pair was generated with non-default reference-state constants, ERF would now construct a different dry base state than the one WRF used.

At minimum, I think we should print the values used here. Ideally, we should read the WRF values when present and fall back to these defaults only when absent.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I do not see these values in any of the wrfinput or wrbdy files I have. We can easily print the current values. However, a discussion is in order if we wish to parse them from somewhere.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

My opinion is that we go ahead and merge this PR then open an issue pointing out that we could read these in from wrfinput / wrfbdy files. Given that we know this is better than what is there, we should not delay in merging, but we should remember we can generalize later. @pressel -- would you be good with that? @cmkaul -- could you give this PR a try on your case that has boundary issues and confirm the solution is hopefully better but at least no worse?

Comment thread Source/Initialization/ERF_InitFromWRFInput.cpp
pi_hse_arr(i,j,k) = getExnergivenP(p_hse_arr(i,j,k), l_rdOcp);
th_hse_arr(i,j,k) = getRhoThetagivenP(p_hse_arr(i,j,k), Qv) / cons_arr(ii,jj,kk,Rho_comp);
qv_hse_arr(i,j,k) = Qv;
// Fill top and bottom ghost cells
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does base_state ever require more than one vertical ghost cell in the pressure-gradient/HSE paths? This fills only klo-1 and khi+1, while the previous grown-box/clamping approach populated the whole grown region. If one layer is sufficient, a short assertion or comment would make that clear.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, only one ghost cell is needed at the top and bottom.

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.

3 participants