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

chunked structure

Hi,

I was hoping somebody could help me understand better what happens when the field gets scattered into chunks. For example, there is a field A which was chunked, now there is a loop in the code that goes from begchunk to endchunk, does this cover all the globe (all the lats, longs)? If one would like to change the field A globally would it be correct to use it chunked and to apply the wanted change while looping through the A(chunk)?
Thank you in advance.
 

hannay

Cecile Hannay
AMWG Liaison
Staff member
The "chunking" in CAM is used to optimize the performance of the model.

In CAM, the physics is performed on columns with no communication between the columns.

So you can compute the physics independently in each column. Basically:

do j=1,nlat
do = i=1,nlon
[do physics parameterizations]
end do
end do

Because the computation in the physics is independent between columns, you can group the columns into chunks to maximize the model performance.

do j=1,nchunks
do = i = 1,ncols(j)
[do physics parameterizations]
end do
end do

where ncols(j) is the number of columns allocated to the chunk j and nchunks is the total number of chunks. Notice that the columns of a chunk don't need to be contiguous.

If you work at the physics level [do physics parameterizations], you shouldn't worry about the chunks
 
Hi, HannyYou said the 'chunking' is used to optimize the performance of the model. The columns in each chunk have specific longitude and latitude.  So I think we do not know how many chunks the global data are seperated to. And we still do not know how many coloumns each chunk has. But the total of "chunks" x "columns" should equal to "nlat" x "nlon". Now, I want to see the sst values  which are tranported from coupler driver to atm. In the atm_comp_mct.F90, the sst variable are  represneted by x2a_a%rAttr(index_x2a_So_t). Can you tell me how should I write this out in txt file? Some of the codes are shown as followed.-----------------------------------------------------------------------------------ig=1    do c=begchunk,endchunk       ncols = get_ncols_p(c)        ! initialize constituent surface fluxes to zero       cam_in(c)%cflx(:,:) = 0._r8        do i =1,ncols                                                                         cam_in(c)%wsx(i)       = -x2a_a%rAttr(index_x2a_Faxx_taux,ig)               cam_in(c)%wsy(i)       = -x2a_a%rAttr(index_x2a_Faxx_tauy,ig)               cam_in(c)%lhf(i)       = -x2a_a%rAttr(index_x2a_Faxx_lat, ig)               cam_in(c)%shf(i)       = -x2a_a%rAttr(index_x2a_Faxx_sen, ig)               cam_in(c)%lwup(i)      = -x2a_a%rAttr(index_x2a_Faxx_lwup,ig)              cam_in(c)%cflx(i,1)    = -x2a_a%rAttr(index_x2a_Faxx_evap,ig)                          cam_in(c)%asdir(i)     =  x2a_a%rAttr(index_x2a_Sx_avsdr, ig)            cam_in(c)%aldir(i)     =  x2a_a%rAttr(index_x2a_Sx_anidr, ig)            cam_in(c)%asdif(i)     =  x2a_a%rAttr(index_x2a_Sx_avsdf, ig)            cam_in(c)%aldif(i)     =  x2a_a%rAttr(index_x2a_Sx_anidf, ig)          cam_in(c)%ts(i)        =  x2a_a%rAttr(index_x2a_Sx_t,     ig)            cam_in(c)%sst(i)       =  x2a_a%rAttr(index_x2a_So_t,     ig)                       cam_in(c)%snowhland(i) =  x2a_a%rAttr(index_x2a_Sl_snowh, ig)            cam_in(c)%snowhice(i)  =  x2a_a%rAttr(index_x2a_Si_snowh, ig)            cam_in(c)%tref(i)      =  x2a_a%rAttr(index_x2a_Sx_tref,  ig) ------------------------------------------------------------------------------------
Best regards,Yao
 

eaton

CSEG and Liaisons
The SST is available to be written to CAM's output files.  It's not output by default, so you need to customize the namelist by adding fincl1='SST' (that puts the output in the h0 files).  You can see how the code outputs cam_in%sst by looking at src/physics/cam/cam_diagnostics.F90. Also note that there is nothing random about how columns are assigned to chunks.  The assignment is based on algorithms to optimize the load balance of the physics calculation by balancing the number of day and night columns assigned to a chunk with certain constrains designed to minimize the communication cost.  The code that does this is in src/physics/cam/phys_grid.F90. 
 
Top