Skip to content

Conversation

@jshaw35
Copy link

@jshaw35 jshaw35 commented Jun 17, 2025

Closes #1324
Closes #1328

Requires cime6.1.106 or later

I have coupled the COSP-RTTOV satellite emulator with CAM and would like to pull it into the main code repository. This update to COSP significantly extends emulation capabilities and is described here: https://egusphere.copernicus.org/preprints/2025/egusphere-2025-169/

An important note: Integrating with COSP-RTTOV with CAM requires linking an external build of RTTOV to CESM during the build step and changes to CIME. This is further complicated by the fact that the RTTOV source code is free but only available to registered users and creating a new build is slow relative to a normal CESM build, so linking an existing RTTOV build during CESM build appears to be the best solution.

CIME fork here: https://github.com/jshaw35/cime/tree/cime6.0.217_httpsbranch02_cosprttov

@jshaw35 jshaw35 marked this pull request as draft June 17, 2025 21:33
jshaw35 and others added 19 commits June 30, 2025 13:20
Merged cospsimulator_intro.F90 and bld/configure by hand. Needs testing to see if COSP-RTTOV functionality is maintained, specifically regarding the treatment of cloud water/ice and effectively water and ice droplet sizes.
…ld dependencies, clean up obsolete cloud water fields.
…te descriptions. Remove commented line from bld/configure
… cosp.F90 this array should be:

"Height of bottom interface of atm layer(km). First level contains the bottom of the top layer. Last level contains the bottom of the surface layer."
Current CAM interface includes the top of the top layer and needs to be corrected.
This reverts commit 496a7ec.
This was a mistake too, I meant to revert the commit that merged recent
CAM updates.
…wer_change"

This reverts commit 9b98aac, reversing
changes made to 9ccd342.
@jshaw35
Copy link
Author

jshaw35 commented Jul 17, 2025

@cacraigucar I have now ported the COSP-RTTOV interface code to the cam_development branch. These changes make CAM compatible with the COSP-RTTOV branch that @dustinswales and I are currently reviewing before merging into the official COSPv2.0 repository. I've updated the CAM namelist options and logic as well.

I made the following tests for performance:

  • Bit-for-bit agreement for all COSPv2.0 variables compared to the normal cam_development.
  • COSPv2.0 outputs with and without satellite-like swathing are identical (e.g. swathing just puts nans in "unobserved" gridcells, answers are unchanged even though computing time should be significantly less).
  • RTTOV builds correctly and output is nearly identical to the CESM2.1.5 version that I validated for the COSP-RTTOV documentation paper.

This pull request also corrects an answer-changing model error (cospsimulator_intr.F90) in the assignment of the "hgt_matrix_half" field that COSPv2.0 uses. Per cosp.F90 this array should be:

Height of bottom interface of atm layer(km). First level contains the bottom of the top layer. Last level contains the bottom of the surface layer.

The current CAM interface sets the first level as the top of the top layer and allocates the array as length nlay+1 instead of nlay. This changes all fields that use the lidar_simulator subroutine (CALIPSO, PARASOL, etc) and RTTOV outputs.

I think that this PR is ready for a more detailed review! I will be traveling for work until August 28th and will be slow to respond during that time.

@jshaw35 jshaw35 marked this pull request as ready for review July 17, 2025 18:02
Copy link
Collaborator

@cacraigucar cacraigucar left a comment

Choose a reason for hiding this comment

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

Review items for us to discuss (if needed) at our meeting this afternoon

  • Also, we need to add a COSP_RTTOV regression test

Comment on lines +102 to 104
url = https://github.com/dustinswales/COSPv2.0
fxrequired = AlwaysRequired
fxsparse = ../.cosp_sparse_checkout
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to brought into an official COSP repo - it can not be on a personal fork

Comment on lines +300 to +301
Directory containing RTTOV libraries. For example:
/glade/u/home/jonahshaw/w/RTTOV2/hdfseries_build/lib/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Perhaps we should install the library in a TBD location on derecho.

Comment on lines +2500 to +2501
<!-- Swathing input control parameters. -->
<entry id="cosp_N_SWATHS_ISCCP" type="integer*10" category="cosp"
Copy link
Collaborator

Choose a reason for hiding this comment

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

During documentation of this feature, could we add a section on how to set up your own satellite (if it is easily done)

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 634 to 641
tauresx(i) = taux(i) + tauresx(i) - tauimpx(i) + tautmsx(i) + taubljx(i)
tauresy(i) = tauy(i) + tauresy(i) - tauimpy(i) + tautmsy(i) + taubljy(i)
tauresx(i) = taux(i) + tautmsx(i) + taubljx(i) + tauresx(i)- tauimpx(i)
tauresy(i) = tauy(i) + tautmsy(i) + taubljy(i) + tauresy(i)- tauimpy(i)
endif

else

tautotx(i) = taux(i) + tautmsx(i)
tautoty(i) = tauy(i) + tautmsy(i)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe this is indicative of a bad merge (this and the ChangeLog). Perhaps we can try merging to the current head of cam_development and see if they go away. We can do that when we meet this afternoon

Copy link
Author

Choose a reason for hiding this comment

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

done

@@ -123,6 +125,7 @@ module cospsimulator_intr
! ######################################################################################
! Default CAM namelist settings
! ######################################################################################
! CAM
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment not needed

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 2083 to 2092
rttov_sfcmask(1:ncol) = 0
do i=1,ncol
if ((cam_in%landfrac(i) > cam_in%ocnfrac(i)) .and. (cam_in%landfrac(i) > cam_in%icefrac(i))) then
rttov_sfcmask(i) = 1
else if (cam_in%ocnfrac(i) > cam_in%icefrac(i)) then
rttov_sfcmask(i) = 0
else
rttov_sfcmask(i) = 2
end if
end do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should probably double check this entire routine, and put sections like this within an if lrttov_sim construct

Copy link
Author

Choose a reason for hiding this comment

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

done

cospstateIN%rttov_time(:,2) = (ncsec - 3600 * (ncsec / 3600)) / 60 ! Remainder divided by 60 seconds per minute
cospstateIN%rttov_time(:,3) = ncsec - (3600*cospstateIN%rttov_time(:,1)) - (60*cospstateIN%rttov_time(:,2)) ! Final remainder

cospstateIN%sza(1:ncol) = acosd(coszrs(1:ncol)) ! Hokey because we get the SZA by taking the arcosine of cos(sza), but this seems to be the variable the radiation scheme can pass.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line > 133 characters - split into two or more

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 2265 to 2266
where ((mr_lsliq(1:ncol,1:pver) > 0._r8) .and. (mr_ccliq(1:ncol,1:pver) > 0._r8))
cospstateIN%DeffLiq(:,:) = 2._r8 * 1.0e6 * (mr_lsliq(1:ncol,1:pver) + mr_ccliq(1:ncol,1:pver)) / (mr_lsliq(1:ncol,1:pver) / reff_cosp(1:ncol,1:pver,I_LSCLIQ) + mr_ccliq(1:ncol,1:pver) / reff_cosp(1:ncol,1:pver,I_CVCLIQ))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line > 133 characters - break into two or more

Copy link
Author

Choose a reason for hiding this comment

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

done

call t_stopf("construct_cospstateIN")

! Optical inputs
call t_startf("construct_cospIN")
call construct_cospIN(ncol, nscol_cosp, nlay, cospIN)
call construct_cospIN(ncol, nscol_cosp, nlay, rttov_Ninstruments, cospIN, emis_grey=1.0_r8) ! Apply unitary blackbody surface emissivity to be consistent with CESM physics
Copy link
Collaborator

Choose a reason for hiding this comment

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

Line > 133 characters - break into two or more

Copy link
Author

Choose a reason for hiding this comment

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

done


! RTTOV
if (lrttov_sim) then
do i=1,rttov_Ninstruments ! Not sure if this logical stuff is needed or not?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Address this comment

Copy link
Author

Choose a reason for hiding this comment

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

done

@jshaw35 jshaw35 requested a review from cacraigucar August 5, 2025 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants