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

Fixing ROMS-JEDI LinearModel Unit Test #30

Merged
merged 30 commits into from
Aug 9, 2024
Merged

Fixing ROMS-JEDI LinearModel Unit Test #30

merged 30 commits into from
Aug 9, 2024

Conversation

hga007
Copy link
Collaborator

@hga007 hga007 commented Mar 28, 2024

Description

This PR includes corrections and updates to several routines to fix the ROMS-JEDI LinearModel Unit Tests, guaranteeing the symmetry of the TLM/ADM operators and convergence of the 4D-Var algorithms:

  • Fixed the symmetry between the tangent linear and adjoint operators to a satisfactory level in the dot product. It now passes the LinearModel unit test case and our Sanity Symmetry test:
[dot0,dot1] = tlad_dotproduct(TLname, ADname, false);             % Native ROMS interface

TL/AD date: 01-03 00:00:00 / 01-03 06:00:00, TLrec = 01, ADrec = 13, Dot Product = 112.84303514
TL/AD date: 01-03 00:30:00 / 01-03 05:30:00, TLrec = 02, ADrec = 12, Dot Product = 187.74224524
TL/AD date: 01-03 01:00:00 / 01-03 05:00:00, TLrec = 03, ADrec = 11, Dot Product = 112.04213911
TL/AD date: 01-03 01:30:00 / 01-03 04:30:00, TLrec = 04, ADrec = 10, Dot Product = 142.80619119
TL/AD date: 01-03 02:00:00 / 01-03 04:00:00, TLrec = 05, ADrec = 09, Dot Product = 132.49011272
TL/AD date: 01-03 02:30:00 / 01-03 03:30:00, TLrec = 06, ADrec = 08, Dot Product = 158.24016596
TL/AD date: 01-03 03:00:00 / 01-03 03:00:00, TLrec = 07, ADrec = 07, Dot Product = 177.18011365
TL/AD date: 01-03 03:30:00 / 01-03 02:30:00, TLrec = 08, ADrec = 06, Dot Product = 179.46528054
TL/AD date: 01-03 04:00:00 / 01-03 02:00:00, TLrec = 09, ADrec = 05, Dot Product = 192.82609918
TL/AD date: 01-03 04:30:00 / 01-03 01:30:00, TLrec = 10, ADrec = 04, Dot Product = 161.60554627
TL/AD date: 01-03 05:00:00 / 01-03 01:00:00, TLrec = 11, ADrec = 03, Dot Product = 108.95125745
TL/AD date: 01-03 05:30:00 / 01-03 00:30:00, TLrec = 12, ADrec = 02, Dot Product = 98.12076241
TL/AD date: 01-03 06:00:00 / 01-03 00:00:00, TLrec = 13, ADrec = 01, Dot Product = 112.84303514
  
Initial, dot0 = 112.84303514
Final,   dot1 = 112.84303514
    dot1-dot0 = 2.55795385e-13

[dot0,dot1] = tlad_dotproduct(TLjedi, ADjedi, false);             % ROMS-JEDI interface
  
TL/AD date: 01-03 00:00:00 / 01-03 06:00:00, TLrec = 01, ADrec = 13, Dot Product = 119.53077750
TL/AD date: 01-03 00:30:00 / 01-03 05:30:00, TLrec = 02, ADrec = 12, Dot Product = 176.32572472
TL/AD date: 01-03 01:00:00 / 01-03 05:00:00, TLrec = 03, ADrec = 11, Dot Product = 128.80173146
TL/AD date: 01-03 01:30:00 / 01-03 04:30:00, TLrec = 04, ADrec = 10, Dot Product = 140.61649865
TL/AD date: 01-03 02:00:00 / 01-03 04:00:00, TLrec = 05, ADrec = 09, Dot Product = 136.77333523
TL/AD date: 01-03 02:30:00 / 01-03 03:30:00, TLrec = 06, ADrec = 08, Dot Product = 170.12330080
TL/AD date: 01-03 03:00:00 / 01-03 03:00:00, TLrec = 07, ADrec = 07, Dot Product = 180.70557751
TL/AD date: 01-03 03:30:00 / 01-03 02:30:00, TLrec = 08, ADrec = 06, Dot Product = 183.24860942
TL/AD date: 01-03 04:00:00 / 01-03 02:00:00, TLrec = 09, ADrec = 05, Dot Product = 184.52098633
TL/AD date: 01-03 04:30:00 / 01-03 01:30:00, TLrec = 10, ADrec = 04, Dot Product = 164.24229109
TL/AD date: 01-03 05:00:00 / 01-03 01:00:00, TLrec = 11, ADrec = 03, Dot Product = 116.54522860
TL/AD date: 01-03 05:30:00 / 01-03 00:30:00, TLrec = 12, ADrec = 02, Dot Product = 112.97778545
TL/AD date: 01-03 06:00:00 / 01-03 00:00:00, TLrec = 13, ADrec = 01, Dot Product = 119.53077750
  
Initial, dot0 = 119.53077750
Final,   dot1 = 119.53077750
    dot1-dot0 = 1.57740487e-12
  • The ROMS-JEDI driver jedi_roms.h was refactored to several initialization phases:

    • ROMS_initializeP1: It reads in standard input parameters. Then, allocate/initialize parameters and variables when switch LsetROMS is on. It sets TLM time-stepping parameters. The time-stepping indices are initialized as kstp=1, knew=2, krhs=3, nstp=1, nnew=2, and nrhs=nnew.
    • ROMS_initializeP2: It completes the initialization using the state vector provided by OOPS and computes depths, density, and horizontal mass fluxes.
    • ROMS_initializeP3: It computes the initial depths and level thicknesses from the initial free-surface field. Additionally, it initializes the nonlinear state variables for all time levels and applies lateral boundary conditions.
  • Introduce new modules post_initial.F and associated TLM, RPM, and ADM versions that compute the initial depths and level thicknesses from the initial free-surface field, initialize the nonlinear state variables for all time levels, and apply lateral boundary conditions on the first time step in main3d.F:

 # ifndef JEDI
!
!-----------------------------------------------------------------------
! On the first timestep, it computes the initial depths and level
! thicknesses from the initial free-surface field. Additionally, it
!  initializes the nonlinear state variables for all time levels and
! applies lateral boundary conditions.
!-----------------------------------------------------------------------
!
            DO ig=1,GridsInLayer(nl)
              ng=GridNumber(ig,nl)
              IF (iic(ng).eq.ntstart(ng)) THEN
                CALL post_initial (ng, iNLM)
              END IF
            END DO
# endif

Dependencies

None.

Impact

The 4D-Var dual and primal formulations run satisfactorily in ROMS-JEDI. However, further routes are required before it can be run operationally.

@hga007 hga007 added the enhancement New feature or request label Jul 5, 2024
@hga007 hga007 self-assigned this Jul 5, 2024
@hga007 hga007 merged commit caf970e into develop Aug 9, 2024
@hga007 hga007 deleted the feature/jedi branch August 9, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant