Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Partially change the SST value

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.


New member
I am looking for a way to change the SST value by specifying a range and time.
(For example, decrease the SST value by 3 Kelvin in the range of t = 2-5, x = 1-30, y = 20-40)
I don't think there is such an option in WRF.
So, what is the name of the program (subroutine, etc.) to be rewritten to achieve this?
If sst_update = 1 is set, is this impossible because the SST value is input data?
Is it better to set sst_skin = 1? (Because SST is output by calculation instead of input data)
Yes, you will need to make modifications to the code to do this. The place to modify SST (it is actually TSK in the model) would be in phys/module_surface_driver.F, after the 'tmn_update' code (this is near the top). The model time is available in the 'xtime' module, where there are examples on how to modify the TSK field (again, you will need to modify TSK, and not SST here). The code for the sst_skin option that would be a good example to follow. Modifying TSK in this part of the code should accommodate options like sst_update, and sst_skin.
Thank you for your reply.

I can't find the location of xtime module and examples on how to modify the TSK field. What is the xtime module in the first place? Excuse me, can you tell me more?

Sorry for lack of knowledge.
I apologize for the confusion. So within phys/module_surface_driver.F, you'll need to write a new subroutine that does what you want it to do. You'll need to use the dimensions ips (i-patch-start) and ipe (i-patch-end), ips (j-patch-start) and jpe (j-patch-end) for the spatial specifications, and then you'll need to use the variable xtime for the time specification. xtime is the minutes since the simulation start. And then based on the tests that you put in your subroutine, you can set TSK to be whatever you need (e.g., tsk(i,j) = tsk(i,j) + 3). You can then call that subroutine somewhere within the "IF (sst_skin .EQ. 1)" block of code. You can play around with it to make sure you're doing things right. Just run some short, small tests to be sure, before running a big/long case.
Thank you for your reply.

When I want to decrease the SST value by 3 Kelvin in the range of t = 2-5, x = 1-30, y = 20-40,
In phys / module_surface_driver.F
Should I make the following changes? (Additional parts are in bold)

IF (sst_skin .EQ. 1) THEN
! Calculate skin sst based on Zeng and Beljaars (2005)
CALL wrf_debug( 100, 'in SST_SKIN_UPDATE' )
!$OMP PRIVATE ( ij, i, j, k )
DO ij = 1 , num_tiles
DO j=j_start(ij),j_end(ij)
DO i=i_start(ij),i_end(ij)
IF(XLAND(i,j) .GT. 1.5 .and. sst_update .NE. 1) THEN

DO j = jps , jpe
DO i = ips, ipe
IF(XTIME .GE. 2 .and. XTIME .LE. 5 .and. i .GE. 1 .and. i .LE. 30 .and. j .GE. 20 .and. j .LE. 40 )
TSK(i,j) =SST(i,j)
TSK(i,j) =TSK(i,j)-3

TSK(i,j) =SST(i,j)

CALL sst_skin_update(xland,glw,gsw,hfx,qfx,tsk,ust, &
emiss,dtw,sstsk,dt,stbolt, &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
i_start(ij),i_end(ij), j_start(ij),j_end(ij), kts,kte )
DO j=j_start(ij),j_end(ij)
DO i=i_start(ij),i_end(ij)
IF(XLAND(i,j) .GT. 1.5)TSK(i,j)=SSTSK(i,j)
Yes, that could potentially work, though without running this myself, I'm not certain. I would recommend testing out the changes to see if it works and gives the results you're interested in.
Hello, rewriting of the program does not go well. Help me.

The range and time are not specified. For the time being, I tried to check if the TSK value was calculated correctly.

In ! Calculate skin sst based on Zeng and Beljaars (2005),
Change before:
IF (XLAND (i, j) .GT. 1.5) TSK (i, j) = SSTSK (i, j)
After change:
IF (XLAND (i, j) .GT. 1.5) TSK (i, j) = SSTSK (i, j) -10

* The last reply is the one searched on the Internet. Since the contents of the version and the module are different, the change method is also changed. The version I used is WRF3.3.1.

The compilation succeeds, but after running wrf.exe, the process drops a few minutes later.
The time until processing drops varies slightly depending on the setting value. For example, when +10, the calculation continues longer than -10.

My expectation is
・ By repeating calculation, TSK jumped out of the definition range.
・ Compatibility with other TSK values ​​is lost by changing only one location.

However, I do not know where and how to change.
The module file is attached below.


  • module_surface_driver.F.txt
    170.1 KB · Views: 54
I believe in your "if" tests, instead of just i and j, you need to use ips, ipe, jps, jpe. These specify i-patch-start, i-patch-end, and the same for j.
The WRF modeling system uses distributed memory across the patches. However, the indexing is global. As a simple example, if you were only interested in the point i=60, j=70, you could write a simple if-test to determine that you are in the correct patch.

IF ( ( ips <= 60 ) .and. ( ipe >= 60 ) .and. &
( jps <= 70 ) .and. ( jpe >= 70 ) ) THEN
--> your mods

As you are interested in points between certain i and j locations, you will need to do this a bit differently.

Unfortunately we have resources to support the officially-released versions of the WRF code, but not for modified code. We can attempt to provide hints for code modification, but we cannot simply write the code for user specific projects. We just do not have the time to do this, as we are already stretched to the limit with all of the projects we are responsible for. Modifications are ultimately the user's responsibility.
Thank you very much. I'll give it a try.
By the way,
Isn't it possible to use the EditData option of the read_wrf_nc tool?
In that case, I think that it is possible to specify the range.
Is the time specified only by the time interval of the input data? (3 hours, 6 hours, etc.)
I believe that NCL function is for the purpose of viewing output for a particular area of the domain, but you are wanting to run the model with that particular area modified, so I'm not certain that will work for your needs. You could try posting that question to the NCL portion of this forum. A different person specializes in that area, and can at least confirm/deny whether that is an option for your test.