Skip to content

Unified wrf/wrf-chem model_mod - #741

Open
hkershaw-brown wants to merge 66 commits into
mainfrom
wrf-unified
Open

hkershaw-brown wants to merge 66 commits into
mainfrom
wrf-unified

Conversation

@hkershaw-brown

@hkershaw-brown hkershaw-brown commented Sep 26, 2024 •

Copy link
Copy Markdown
Collaborator

Description:

Refactored WRF model mod for WRF & WRF CHEM.
Namelist selectable QTYS, see #404 for details.

Created a wrf_unified model directory. This is to allow concurrent development on wrf and wrf_unified.
wrf_unified/model_mod is ~4500 less than the wrf/model_mod and this is a bit of a headache for keeping up-to-date with main (easy to miss changes in such differing code).

See pull #683 for original pull request
wrf-wrf-chem branch available at https://github.com/hkershaw-brown/DART/tree/wrf-wrf-chem

Fixes issue

Fixes #404
Partial #359 (WRF)
Partial #624 (WRF)

To do:
Follow fixes for

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

Please describe any tests you ran to verify your changes.
Bitwise tests during refactoring: https://github.com/hkershaw-brown/wrf-tests.git

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

kershaw-ucar and others added 4 commits September 26, 2024 13:35
New model_mod directory so development can happen concurrently on
wrf and wrf_unified.
Original pull request #683
@hkershaw-brown

Copy link
Copy Markdown
Collaborator Author

For un reviewed atmos-chem forward operators see #743

@hkershaw-brown hkershaw-brown added the wrf Weather Research & Forecasting Model label Dec 11, 2024
@hkershaw-brown
hkershaw-brown requested a review from Copilot June 9, 2025 16:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors the WRF model_mod for both WRF and WRF CHEM by introducing a unified model_mod and updating corresponding documentation and configuration files. Key changes include:

  • Addition of a build script (quickbuild.sh) in the wrf_unified directory.
  • Extensive documentation updates in readme.rst describing the unified model and its configuration.
  • A new model_mod.nml file with updated configuration and minor comment updates to observation modules.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
models/wrf_unified/work/quickbuild.sh Introduces a build script for the new unified model
models/wrf_unified/readme.rst Provides documentation updates for the unified WRF model interface
models/wrf_unified/model_mod.nml Defines new namelist settings for the unified model_mod
assimilation_code/modules/observations/default_quantities_mod.f90 Updates observation quantities comments with a new potential temperature entry
assimilation_code/modules/observations/atmosphere_quantities_mod.f90 Updates observation quantities comments with a new potential temperature entry
Comments suppressed due to low confidence (2)

assimilation_code/modules/observations/default_quantities_mod.f90:14

  • [nitpick] Consider adding a brief comment that explains the rationale behind adding QTY_2M_POTENTIAL_TEMPERATURE to the observation quantities documentation.
!   QTY_2M_POTENTIAL_TEMPERATURE

assimilation_code/modules/observations/atmosphere_quantities_mod.f90:107

  • [nitpick] Consider adding documentation for the inclusion of QTY_2M_POTENTIAL_TEMPERATURE to clarify its intended use and context in the module.
!   QTY_2M_POTENTIAL_TEMPERATURE

Comment thread models/wrf_unified/readme.rst Resolved
wrf on main does vert, then horiz for vert_convert and horiz, then
vert for model_interpolate

#404 (comment)

I am not sure why wrf model_mod.f90 has vert/horiz order swapped for
vertical conversion vs model_interpolate.

The order for convert vertical obs gives differences in the last
three decimal places:

In pressure, out height
OLD: 5223.5371313647593
NEW: 5223.5371313647584

Also fix missing implicit none!
The set and get location changes the lat lon #621
The if statements capture the in/out but since there is an initialization
set to false.
see #744 static data
@hkershaw-brown

hkershaw-brown commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

hybrid coordinate:

"It is mandatory to use the terrain following coordinate
system (hybrid_opt=0)"?
#404 (comment)

.. Important ::
This tutorial was designed to be compatible with WRF Version 4 and later, and was
tested with WRFv4.5.2. It is mandatory to use the terrain following coordinate
system (hybrid_opt=0) and not the default sigma hybrid coordinates (hybrid_opt=1)
when using WRF-DART. Using the sigma hybrid coordinate can lead to adverse effects
when generating ensemble spread leading to poor forecast performance. For more
details see `DART Issue #650 <https://github.com/NCAR/DART/pull/650>`__.

! hybrid_opt 2 is a hybrid coordinate - terrain following at the
! surface, and straight pressure levels at the top.
integer, parameter :: VERT_HYBRID = 2

Apparently the "It is mandatory to use the terrain following coordinate
system" is only when using WRF CV3 perturbation to generate the boundary condition perturbed ensemble.

echo "ERROR: WRF-DART must use terrain following coordinates, hybrid_opt must be 0"

Needs to be explained in the docs.
Came in in d85b7a0
part of #1030

@hkershaw-brown

Copy link
Copy Markdown
Collaborator Author

This is in use by CU/DOE collaborators with the addition of #1148

@hkershaw-brown

Copy link
Copy Markdown
Collaborator Author

note @hkershaw-brown changes for bitwise testing with wrf on
main...hkershaw-brown:DART:model_mod_gc

CU/DOE colloborators are using hybrid cordinate
Add log_vert_interp, polar, periodic_x and periodic_y to the
model_nml namelist statement, since these are namelist options in
The regular wrf model_mod.f90. Note I do not have tests for these.

model_mod.nml  to match model_mod.f90

Namelist documentation

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

atmos-chem wrf Weather Research & Forecasting Model wrf-chem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat req: Refactor wrf model_mod and models/wrf directory, unify WRF/WRF-CHEM

3 participants