%last update May 24, 2017 
Solar-J v7.5: exending the spectral range of cloud-J/Fast-J from visible to the infrared range by adopting and modifying RRTMG-SW's gas absorption bins. (Release_3_9)
The codes have been compiled with intel ifort (make sure you moudule load the most recent intel compiler)
(1) Fortran source codes are under these directories:
fjx_src/
rrtmg_src/
rrtmg_modules/

(2)tabulated data needed to be read-in are undear
Data/

(3) To compile the source codes, run makefile by typing make.

Note that it takes a few minutes to compile rrtmg_sw_k_g.f90.
ifort -O2 -fpp -W0  -assume byterecl -Ifjx_rrtmg_obj -c rrtmg_src/rrtmg_sw_k_g.f90

(4) the compiled *.o files are all under 
fjx_rrtmg_obj/

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
To reproduce results of all cases in the manuscript "A radiative Transfer Module for Calculating Photolysis Rates and Solar Heating in Climate Model: Solar-J .5", GMD-2017-27

execute   ./runscript_solarj.sh

The results are stored under directory stratus/ for the stratus case and under /cirrus for cirrus case

This script produces clear sky, cirrus cloud and stratus cloud cases for all four sun zenith angles (SZAs) discussed in the paper.

The clear-sky case for a given sun zenith angle always precedes the cloudy case.

The output under /stratus or /cirrus consist of  
Sj_1.dat (heating rates from bin 1 to bin 18)
Sj_2.dat (heating rates from bin 19- bin27 + total heating of bins 1-18  + total heating of bins 19 to 27 + total heating for all bands)
OD_1.dat (same format as Sj_1.dat but for optical depth contributed from Rayleigh, gases and clouds (if invoked) or aerosols (if invoked))
OD_2.dat
SWbgt.dat (SW radiative budget: total, absorbed in the atmosphere, absorbed at the surface)
fj.dat (photolysis rates)
output* (output from write(6) or print* statement in the model)

Note this script (runscript_solarj.sh) cleans up all the *.dat and output files first and recompile the codes from scratch.
Comment those lines out in the script if you don't want to clean out all previous output.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To test CPU time, you can increase the numbers of loopng in fjx72.f DO KKK=1, 1 (for example) to compute K=1, 10000 (10000 columns for example)
(This loop is redundant if not using it for the purpose of computing the same cloud profile kkk times with only one-time read-in) 

In testing CPU time case, LPRTJ should be changed to .false. to turn off H and J's output
Change LPRTJ=.true. in fjx_src/fjx72.f90


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To turn off gas absorptions adopted from RRTMG,

set W_RRTMG=0 in rrtmg_modules/rrsw_fastj_cmn.f90 and recompile the codes       
! integer(kind=im), parameter:: W_rrtmg= 82 ! = ngs29=82 for using RRTMG  
 integer(kind=im), parameter:: W_rrtmg= 0  ! RRTMG's subroutines won't be called;

W_r= W_rrtmg =82 plus the 18 W_ bins make a total of 100 wavelength bins in opmie subrotuine.

However, even if when W_RRTMG=0, with S_=27 and W_=18, the codes will still run clouds for S_= 27  wavelength bins and photolysis rates for W_=18 bins  

To turn off clouds or aerosols from S19-S27 bins, 
set S_=18 SX_=18 (It will run as if there are only 18 Fast-J bins but up to 778 nm)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Manipulate input in this zipped files,

(1)Solar Zenith Angle (SZA) given in this zipped files is a readin input from CTM_GrdCld.dat.
(However, the real input is photau, which is assigned to GMT and then to LOCT); in this script,  PHOTAU is replaced with  SZA as below in the shell script
R1="11.0  12.0 GMT, PHOTAU"                              
N1="11.0  21.2 GMT, SZA   

And the source lines have been modified to set sza = gmtime =photau

To change it back to PHOTAU input, go to subroutine Solar_JX in fjx_sub_mod.f90 and 
uncomment these two lines
!      COSSZA = COSDEC*COSLAT*cos(LOCT) + SINDEC*SINLAT
!      SZA    = acos(COSSZA)/CPI180

and delete these two added lines 
        SZA    = GMTIME
        COSSZA = COS(SZA*CPI180)
!
! note H2O water vapor in kg/kg is read from CTM_GrdCld.dat, not from atmos_h2och4.dat, in which h2o only has a resolution of 2km and it is too blocky for the derived optical depth.
--------------------------------------------------------------------------------------------------------------------------------------------------------------




