Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Lower boundary conditions (differences between CLM4.5 and CLM5)

oleson

Keith Oleson
CSEG and Liaisons
Staff member
Your last plot (ALT23SL_3.5_unmodified.png) looks pretty much like I would expect. Here is a plot of ALTMAX for northern polar regions for the default soil layer model forced with GSWP3 atm.
ctsm51_cesm23a16bctsm51d130_ne30pg3ne30pg3mg17_GSWP3V1_hist.ANN.ALTMAX.polar.png
 

wvsi3w

wvsi3w
Member
Your last plot (ALT23SL_3.5_unmodified.png) looks pretty much like I would expect. Here is a plot of ALTMAX for northern polar regions for the default soil layer model forced with GSWP3 atm.
View attachment 5398
Thank you @oleson for your response,
So based on this plot which shows values below 4m, I think I should change my color bar to see changes in values below a certain meter (like 4m in this plot) because variation in ALT is only important above a certain latitude.

For my first question (regarding the 20SL_8.5_DG soil layer structure which resulted in 193m for ALT in lower latitudes), do you think there is a missing parameter here in the process of simulation, some option that I might have forgotten to include in the simulation (some XML thing, like turning on bedrock?). I don't know why that happened because in the code it clearly adds 10 bedrock layers and doesn't add to the active part of the soil.

This part is the most important question I encountered because if I don't get why that happened after I modified the 23SL_3.5 soil layer structure I would probably end up with the same results for it as I got from 20SL_8.5_DG.
 

wvsi3w

wvsi3w
Member
Thank you @oleson for your response,
So based on this plot which shows values below 4m, I think I should change my color bar to see changes in values below a certain meter (like 4m in this plot) because variation in ALT is only important above a certain latitude.

For my first question (regarding the 20SL_8.5_DG soil layer structure which resulted in 193m for ALT in lower latitudes), do you think there is a missing parameter here in the process of simulation, some option that I might have forgotten to include in the simulation (some XML thing, like turning on bedrock?). I don't know why that happened because in the code it clearly adds 10 bedrock layers and doesn't add to the active part of the soil.

This part is the most important question I encountered because if I don't get why that happened after I modified the 23SL_3.5 soil layer structure I would probably end up with the same results for it as I got from 20SL_8.5_DG.
OK, I realized now that ALT itself doesn't mean active soil or just soil layer only. It can be either soil or bedrock. "Active" means that it is not permafrost, i.e. that at some point during the year, it is not frozen.

Sorry for the misunderstanding.
I would modify the 23SL_3.5 to reach 500m depth (100m increments) and let you know if I have any questions.

Thanks.
 

wvsi3w

wvsi3w
Member
Hello,

To increase the lower boundary in CLM5 I did all of the modifications to the codes based on the instruction of this paper (Lower boundary conditions improvement in CLM4.5) which is for CLM4.5. However, some of the files uploaded in the article link are probably missing some lines (?).

For example, in the README file in that link, they mention "Added flxdat to the list of variables used from clm_varctl", but I dont see flxdat in the iniTimeConst file uploaded there. I already added this to my CLM5 code but I don't know if it is correct.

Moreover, eflx_bot is not there in the iniTimeConst file of clm4.5 but it is stated that eflx_bot is defined as a local pointer, which is then assigned to a subtype component.

I think that file is not the actual file. I already added this part to my CLM5 code with the help of GPT4 but I dont know if it is correct (attached here).

Also, the "allocate(bhf" and "eflx_bot => col%eflx_bot" are not in the clm4.5 iniTimeConst file, but they are mentioned in the README file of that paper and I added them to my file my way (which again I don't know if I did it right or not).

I am seeking guidance from the experts here to modify these CLM5 codes.

Thanks for your support (@oleson).
 

Attachments

  • iniTimeConst F90 CLM5.txt
    35.7 KB · Views: 0
  • iniTimeConst. F90 CLM4.5.txt
    58.8 KB · Views: 0
  • README.txt
    3.8 KB · Views: 0

slevis

Moderator
We expect you, as a research scientist, to figure out things like this through trial and error. Unfortunately we do not provide support for what you're asking.
 

wvsi3w

wvsi3w
Member
We expect you, as a research scientist, to figure out things like this through trial and error. Unfortunately we do not provide support for what you're asking.
Thank you @slevis for your response.
I will let you know if my try and error process resulted in any presentable outputs. For now I will stick to the bottom boundary modification runs and skip the bottom heat flux option.
Best wishes
 

wvsi3w

wvsi3w
Member
Greetings,
I have tested the CLM5 with this new depth modification and it did run as I wanted.
Because I want to work with permafrost, and the "23SL_3.5m" is a good choice for this matter (Soil layer structure that starts with standard exponential and then has several evenly spaced layers, then finishes off exponential. This allows the upper soil to behave as standard, but then continues with higher resolution to a deeper depth, so that, for example, permafrost dynamics are not lost due to an inability to resolve temperature, moisture, and biogeochemical dynamics at the base of the active layer).

So I modified it, and the followings are the details:

inside initVerticalMod file:

scalez = 0.029_r8 ! Soil layer thickness discretization (m) (changed it from 0.025 to 0.029)

And,

Code:
else if ( soil_layerstruct == '23SL_3.5m_D500' )then
       do j = 1, toplev_equalspace
          zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8)    !node depths
       enddo

       do j = toplev_equalspace+1,toplev_equalspace + nlev_equalspace
          zsoi(j) = zsoi(j-1) + thick_equal
       enddo

       do j = toplev_equalspace + nlev_equalspace +1, nlevgrnd
          zsoi(j) = scalez*(exp(0.5_r8*((j - nlev_equalspace)-0.5_r8))-1._r8) + nlev_equalspace * thick_equal
       enddo

       dzsoi(1) = 0.5_r8*(zsoi(1)+zsoi(2))             !thickness b/n two interfaces
       do j = 2,nlevgrnd-1
          dzsoi(j)= 0.5_r8*(zsoi(j+1)-zsoi(j-1))
       enddo
       dzsoi(nlevgrnd) = zsoi(nlevgrnd)-zsoi(nlevgrnd-1)

       zisoi(0) = 0._r8
       do j = 1, nlevgrnd-1
       zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1))         !interface depths
       enddo
       zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd)

in clm_varpar file (added 5 more layers to the bottom exponential layers):

Code:
    else if ( soil_layerstruct == '23SL_3.5m_D500' ) then
       nlevsoi     =  8  + nlev_equalspace
       nlevgrnd    =  20 + nlev_equalspace

And, added the "23SL_3.5m_D500" to the namelist definition file:

Code:
<entry id="soil_layerstruct" type="char*16" category="clm_physics"
       group="clm_inparm" valid_values="10SL_3.5m,23SL_3.5m,49SL_10m,20SL_8.5m,23SL_3.5m_D500" >
10SL_3.5m    = standard CLM4 and CLM4.5 version
23SL_3.5m    = more vertical layers for permafrost simulations
49SL_10m     = 49 layer soil column, 10m of soil, 5 bedrock layers
20SL_8.5m    = 20 layer soil column, 8m of soil, 5 bedrock layers
23SL_3.5m_D500 = 23 layer soil column, 3.7m of soil, extended to 500m depth
</entry>

I was wondering if you think there are any issues to this modification. Beacuse as I was reading other papers that did this kind of bottom boundary modification they went through a lot of change in several files and lines and variables which for example one of them increased the thick_equal value and the other added another set of formula for 20SL_8.5 soil layer so that it creates a bunch of equal deep layers at the bottom. The thing I did is that I added 5 more exponential layers to the bottom of 23SL_3.5 soil layer and I increased the scalez value by 4mm (0.029 modified - 0.025 default) because this way I would have about the same depth of soil at the 23rd layer (before modification it was 3.6m now it is ~3.7m), so I kinda saved the structure of the upper soil layer as it was and just increased the lower levels exponentially.

What do you think?

P.S. The ALT and ALTMAX values are truly 500m for a test run, which means it worked. But still knowing your POV is beneficial.
 

wvsi3w

wvsi3w
Member
Greetings,
I have tested the CLM5 with this new depth modification and it did run as I wanted.
Because I want to work with permafrost, and the "23SL_3.5m" is a good choice for this matter (Soil layer structure that starts with standard exponential and then has several evenly spaced layers, then finishes off exponential. This allows the upper soil to behave as standard, but then continues with higher resolution to a deeper depth, so that, for example, permafrost dynamics are not lost due to an inability to resolve temperature, moisture, and biogeochemical dynamics at the base of the active layer).

So I modified it, and the followings are the details:

inside initVerticalMod file:

scalez = 0.029_r8 ! Soil layer thickness discretization (m) (changed it from 0.025 to 0.029)

And,

Code:
else if ( soil_layerstruct == '23SL_3.5m_D500' )then
       do j = 1, toplev_equalspace
          zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8)    !node depths
       enddo

       do j = toplev_equalspace+1,toplev_equalspace + nlev_equalspace
          zsoi(j) = zsoi(j-1) + thick_equal
       enddo

       do j = toplev_equalspace + nlev_equalspace +1, nlevgrnd
          zsoi(j) = scalez*(exp(0.5_r8*((j - nlev_equalspace)-0.5_r8))-1._r8) + nlev_equalspace * thick_equal
       enddo

       dzsoi(1) = 0.5_r8*(zsoi(1)+zsoi(2))             !thickness b/n two interfaces
       do j = 2,nlevgrnd-1
          dzsoi(j)= 0.5_r8*(zsoi(j+1)-zsoi(j-1))
       enddo
       dzsoi(nlevgrnd) = zsoi(nlevgrnd)-zsoi(nlevgrnd-1)

       zisoi(0) = 0._r8
       do j = 1, nlevgrnd-1
       zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1))         !interface depths
       enddo
       zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd)

in clm_varpar file (added 5 more layers to the bottom exponential layers):

Code:
    else if ( soil_layerstruct == '23SL_3.5m_D500' ) then
       nlevsoi     =  8  + nlev_equalspace
       nlevgrnd    =  20 + nlev_equalspace

And, added the "23SL_3.5m_D500" to the namelist definition file:

Code:
<entry id="soil_layerstruct" type="char*16" category="clm_physics"
       group="clm_inparm" valid_values="10SL_3.5m,23SL_3.5m,49SL_10m,20SL_8.5m,23SL_3.5m_D500" >
10SL_3.5m    = standard CLM4 and CLM4.5 version
23SL_3.5m    = more vertical layers for permafrost simulations
49SL_10m     = 49 layer soil column, 10m of soil, 5 bedrock layers
20SL_8.5m    = 20 layer soil column, 8m of soil, 5 bedrock layers
23SL_3.5m_D500 = 23 layer soil column, 3.7m of soil, extended to 500m depth
</entry>

I was wondering if you think there are any issues to this modification. Beacuse as I was reading other papers that did this kind of bottom boundary modification they went through a lot of change in several files and lines and variables which for example one of them increased the thick_equal value and the other added another set of formula for 20SL_8.5 soil layer so that it creates a bunch of equal deep layers at the bottom. The thing I did is that I added 5 more exponential layers to the bottom of 23SL_3.5 soil layer and I increased the scalez value by 4mm (0.029 modified - 0.025 default) because this way I would have about the same depth of soil at the 23rd layer (before modification it was 3.6m now it is ~3.7m), so I kinda saved the structure of the upper soil layer as it was and just increased the lower levels exponentially.

What do you think?

P.S. The ALT and ALTMAX values are truly 500m for a test run, which means it worked. But still knowing your POV is beneficial.
I have attached the related files here.
Also the plots and tables of this modification are like this:
1720628262517.png
vs
1720628275835.png
which shows a slight change in the last soil layer depth. So, I added 5 exponential layers to the bottom of this structure + 4mm increase of the "scalez" variable (which is the layer thickness discretization value), and kept the top layers almost intact so that they don't change alot and remain close to initial form that was defined for permafrost region = 500m of depth.

23SL_3.5mlayers123456789101112131415161718192021222324252627282930
depth0.010.030.060.120.210.370.570.770.971.171.371.571.771.972.172.372.572.772.973.173.373.624.044.735.867.7410.8315.9324.3338.18

scalez=0.025


23SL_3.5m_D500layers1234567891011121314151617181920212223242526272829303132333435
depth0.010.030.070.140.250.420.620.821.021.221.421.621.822.022.222.422.622.823.023.223.423.724.205.006.328.5012.0817.9927.7443.8170.30113.97185.98304.70500.44

scalez=0.029
 

Attachments

  • user_nl_clm D500 + crop.txt
    1.5 KB · Views: 1
  • namelist definition D500.txt
    109.6 KB · Views: 0
  • initVerticalMod D500.txt
    34.6 KB · Views: 1
  • clm Varpar D500.txt
    10 KB · Views: 1

wvsi3w

wvsi3w
Member
Hello,

To increase the lower boundary in CLM5 I did all of the modifications to the codes based on the instruction of this paper (Lower boundary conditions improvement in CLM4.5) which is for CLM4.5. However, some of the files uploaded in the article link are probably missing some lines (?).

For example, in the README file in that link, they mention "Added flxdat to the list of variables used from clm_varctl", but I dont see flxdat in the iniTimeConst file uploaded there. I already added this to my CLM5 code but I don't know if it is correct.

Moreover, eflx_bot is not there in the iniTimeConst file of clm4.5 but it is stated that eflx_bot is defined as a local pointer, which is then assigned to a subtype component.

I think that file is not the actual file. I already added this part to my CLM5 code with the help of GPT4 but I dont know if it is correct (attached here).

Also, the "allocate(bhf" and "eflx_bot => col%eflx_bot" are not in the clm4.5 iniTimeConst file, but they are mentioned in the README file of that paper and I added them to my file my way (which again I don't know if I did it right or not).

I am seeking guidance from the experts here to modify these CLM5 codes.

Thanks for your support (@oleson).
For this approach I modified the 9 Fortran Codes this way.
I haven't tested it yet and when it is done I will let you know.
For our reference I attached the 9 files.
These modifications are based on this paper: Lower boundary conditions improvement in CLM4.5
 

Attachments

  • CLM5 modified based on CLM4 + HeatFlux.zip
    99.9 KB · Views: 0
Top