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

CAM5 modification

Hello,I am running cam5 using cesm1_0_4 script. I am trying to modify the [cam_comp. F90] and [radsw. F90] codes to add additional heating ‘qrs’ vertically to the atmosphere by using aerosol-forcing data set that are 3 dimensional,absp(lon,month,lat).the temporal interpolation for absp is done as, do i=1,Nday  ! number of daylight columnsn=IdxDay(i) ! indices of daylight columns nlat=get_lat_p(lchnk,n) ! lat index nlon=get_lon_p(lchnk,n)!lon indexFa(i)=dble(Absp(nlon,mo_prv,nlat))*fact1 Fa(i)=Fa(i)+dble(Absp(nlon,mo_nxt,nlat))*fact2For this, call get_timeinterp_factors (.true., mo_nxt, cdaym, cdayp, caldayloc, &fact1, fact2, 'GET_data:') was used.I have 4-dimensional CALIPSO data for aerosol extinction profiles variable called ascaldata[lon,month,lat,lev] and I want to put weight on vertical heating based on caldata. So caldata are also temporally interpolated as,Do k=1,pvercalextt(i,k)= dble(caldata(nlon,mo_prv,nlat,k))*fact1calextt(i,k)=calextt(i,k)+dble(caldata(nlon,mo_nxt,nlat,k))*fact2end doMay be should I use some vertical indices (chunk index like nlat and nlon) instead of k index in the expression above? If yes, ould you please advise me what it would be in this case.When I multiply Fa(i) by calextt(i,k) it does not seem working properly. So I am guessing that I also need to interpolate calextt(i,k) vertically. I am not quite sure how to do this. I see subroutine called, ‘vertinterp (ncol,ncold,nlev,pmid,pout,arrin,arrout)’ in module called [interpolate_data.F90] and trying to use this but I am having trouble in calculating dpl (lower level pressure difference), dpu(upper level pressure difference) I am not sure how to calculate these variables (dpl,dpu), also having trouble in defining ncold, and index called 'kupper (i)' in the code. I am also not sure what value to use for 'Pout (out put pressure level)', is this 1000.0? My guess is that variable ‘arrin’ should be replaced by my temporally interpolated data (i.e., variable ‘calextt(i,k)’) as given above.I would highly appreciate your help on this. Thank you. Best regards,DK
 

santos

Member
I'm a bit confused about all this. Here are my thoughts:- You should be interpolating only if caldata is defined on a different set of pressure levels from CAM5. You must know what pressure levels caldata is defined on before you can interpolate.- I would not use vertinterp; it is only for computing a single level. I would use lininterp, specifically "lininterp_full1d" interface, for each column. Your inputs would be a single column of data from caldata ("arrin"), the caldata pressure grid ("yin"), the CAM pressure grid ("yout"), and the number of levels in input and output ("nin" and "nout"). The output will be "arrout", the interpolated data.- Most pressures in the CAM physics are in Pa.
 
Hi Santos,Thank you for your response and suggestions. Yes, actually I interpolated the caldata to match the CAM5 pressure levels (30 levels) for corresponding lon/lat grids. Also, the interpolation was done for caldata lon/lat (72/85) to match with CAM5 lon/lat(144/96) grids. After doing all this only I read caldata using cesm1_0_4 scripts (CAM_COMP.F90) to incorporate caldata in the model. As noted in the previous post, then the interpolation was done on the monthly values to daily values based on previous and next month for caldata.I have attached a plot that I got from this calculation. As seen in the plot, I am getting the gaps every 12-15 degrees lats. I don't understand why those gaps are there? the original caldat don't seem to have those systematic gaps as seen in this plot. Also the result without using caldata does not have any gaps. Could you please suggest me what could be the reason for this?I would highly appreciate your help on this. Thank you again.DK
 

eaton

CSEG and Liaisons
I would recommend using the tracer_data module to interpolate a dataset.  The prescribed_aero, prescribed_ghg, prescribed_ozone, and prescribed_volcaero modules are all built on top of tracer_data (in cam/src/chemistry/utils/).  The tracer_data module is not well documented, but the prescribed_* modules provide examples of its use.  Also have a look athttps://bb.cgd.ucar.edu/node/1001688which addresses a similar problem. 
 
Thank you Eaton and Santos for the responses.As you suggested, First, I am trying to interpolate my caldata using "lininterp_full1d" interface. For this I am using the module "interpolate_data" and did the folowing,use interpolate_data, only: lininterp_full1dcall lininterp_full1d(arrin,yin,nin,arrout,yout,nout)the problem is ,Every time I keep getting the following error when I try building the case,error #6580: Name in only-list does not exist.   [LININTERP_FULL1D]use interpolate_data, only: lininterp_full1dCould you please suggest me what I do to solve this issue?I appreciate your help.ThanksDK
 

eaton

CSEG and Liaisons
lininterp_full1d is not a public member of the interpolate_data module.  Use the generic interface name, lininterp.
 
Top