├── .buildkite └── pipeline.yml ├── .gitignore ├── AlteredRestart ├── AlterMany.py └── AlteredRestart.py ├── AuxiliaryStatistics.pxd ├── AuxiliaryStatistics.pyx ├── Bomex.in ├── CGILSdata ├── ctl_s11.nc ├── ctl_s12.nc ├── ctl_s6.nc ├── p2k_s11.nc ├── p2k_s12.nc └── p2k_s6.nc ├── ConditionalStatistics.pxd ├── ConditionalStatistics.pyx ├── Csrc ├── advection_interpolation.h ├── entropies.h ├── flux_divergence.h ├── grid.h ├── kinematics.h ├── lookup.h ├── microphysics.h ├── microphysics_CLIMA.h ├── microphysics_arctic_1m.h ├── microphysics_arctic_1m.h_no_melt ├── microphysics_sb.h ├── momentum_advection.h ├── momentum_advection_central.h ├── momentum_advection_central_pt.h ├── momentum_advection_central_ws.h ├── momentum_advection_weno.h ├── momentum_advection_weno_pt.h ├── momentum_diffusion.h ├── prognostic_variables.h ├── scalar_advection.h ├── scalar_diffusion.h ├── sgs.h ├── surface.h ├── thermodynamic_functions.h ├── thermodynamics_dry.h └── thermodynamics_sa.h ├── Damping.pxd ├── Damping.pyx ├── DiagnosticVariables.pxd ├── DiagnosticVariables.pyx ├── FluxDivergence.pxd ├── FluxDivergence.pyx ├── Forcing.pxd ├── Forcing.pyx ├── ForcingGCMFixed.pxd ├── ForcingGCMFixed.pyx ├── ForcingGCMVarying.pxd ├── ForcingGCMVarying.pyx ├── ForcingReference.pxd ├── ForcingReference.pyx ├── Grid.pxd ├── Grid.pyx ├── Initialization.pxd ├── Initialization.pyx ├── Kinematics.pxd ├── Kinematics.pyx ├── LICENSE ├── Lookup.pxd ├── Lookup.pyx ├── Microphysics.pxd ├── Microphysics.pyx ├── Microphysics_Arctic_1M.pxd ├── Microphysics_Arctic_1M.pxd_no_melt ├── Microphysics_Arctic_1M.pyx ├── Microphysics_Arctic_1M.pyx_no_melt ├── MomentumAdvection.pxd ├── MomentumAdvection.pyx ├── MomentumDiffusion.pxd ├── MomentumDiffusion.pyx ├── NetCDFIO.pxd ├── NetCDFIO.pyx ├── ParallelMPI.pxd ├── ParallelMPI.pyx ├── PostProcessing ├── combine3d.py ├── combine3d.pyx ├── combine3dFields.py ├── combine3dMany.py └── setup.py ├── PressureFFTParallel.pxd ├── PressureFFTParallel.pyx ├── PressureFFTSerial.pxd ├── PressureFFTSerial.pyx ├── PressureSolver.pxd ├── PressureSolver.pyx ├── PrognosticVariables.pxd ├── PrognosticVariables.pyx ├── README.md ├── RRTMG ├── compile_RRTMG_combined.csh ├── lw │ ├── data │ │ └── rrtmg_lw.nc │ ├── modules │ │ ├── parkind.f90 │ │ ├── parrrtm.f90 │ │ ├── rrlw_cld.f90 │ │ ├── rrlw_con.f90 │ │ ├── rrlw_kg01.f90 │ │ ├── rrlw_kg02.f90 │ │ ├── rrlw_kg03.f90 │ │ ├── rrlw_kg04.f90 │ │ ├── rrlw_kg05.f90 │ │ ├── rrlw_kg06.f90 │ │ ├── rrlw_kg07.f90 │ │ ├── rrlw_kg08.f90 │ │ ├── rrlw_kg09.f90 │ │ ├── rrlw_kg10.f90 │ │ ├── rrlw_kg11.f90 │ │ ├── rrlw_kg12.f90 │ │ ├── rrlw_kg13.f90 │ │ ├── rrlw_kg14.f90 │ │ ├── rrlw_kg15.f90 │ │ ├── rrlw_kg16.f90 │ │ ├── rrlw_ncpar.f90 │ │ ├── rrlw_ref.f90 │ │ ├── rrlw_tbl.f90 │ │ ├── rrlw_vsn.f90 │ │ └── rrlw_wvn.f90 │ └── src │ │ ├── mcica_random_numbers.f90 │ │ ├── mcica_subcol_gen_lw.f90 │ │ ├── rrtmg_lw_cldprmc.f90 │ │ ├── rrtmg_lw_cldprop.f90 │ │ ├── rrtmg_lw_init.f90 │ │ ├── rrtmg_lw_k_g.f90 │ │ ├── rrtmg_lw_rad.f90 │ │ ├── rrtmg_lw_rad.nomcica.f90 │ │ ├── rrtmg_lw_read_nc.f90 │ │ ├── rrtmg_lw_rtrn.f90 │ │ ├── rrtmg_lw_rtrnmc.f90 │ │ ├── rrtmg_lw_rtrnmr.f90 │ │ ├── rrtmg_lw_setcoef.f90 │ │ └── rrtmg_lw_taumol.f90 ├── rrtmg_build │ ├── rrtmg_lw_wrapper.f90 │ └── rrtmg_sw_wrapper.f90 └── sw │ ├── data │ └── rrtmg_sw.nc │ ├── modules │ ├── parkind.f90 │ ├── parrrsw.f90 │ ├── rrsw_aer.f90 │ ├── rrsw_cld.f90 │ ├── rrsw_con.f90 │ ├── rrsw_kg16.f90 │ ├── rrsw_kg17.f90 │ ├── rrsw_kg18.f90 │ ├── rrsw_kg19.f90 │ ├── rrsw_kg20.f90 │ ├── rrsw_kg21.f90 │ ├── rrsw_kg22.f90 │ ├── rrsw_kg23.f90 │ ├── rrsw_kg24.f90 │ ├── rrsw_kg25.f90 │ ├── rrsw_kg26.f90 │ ├── rrsw_kg27.f90 │ ├── rrsw_kg28.f90 │ ├── rrsw_kg29.f90 │ ├── rrsw_ncpar.f90 │ ├── rrsw_ref.f90 │ ├── rrsw_tbl.f90 │ ├── rrsw_vsn.f90 │ └── rrsw_wvn.f90 │ └── src │ ├── mcica_random_numbers.f90 │ ├── mcica_subcol_gen_sw.f90 │ ├── rrtmg_sw_cldprmc.f90 │ ├── rrtmg_sw_cldprop.f90 │ ├── rrtmg_sw_init.f90 │ ├── rrtmg_sw_k_g.f90 │ ├── rrtmg_sw_rad.f90 │ ├── rrtmg_sw_rad.nomcica.f90 │ ├── rrtmg_sw_read_nc.f90 │ ├── rrtmg_sw_reftra.f90 │ ├── rrtmg_sw_setcoef.f90 │ ├── rrtmg_sw_spcvmc.f90 │ ├── rrtmg_sw_spcvrt.f90 │ ├── rrtmg_sw_taumol.f90 │ └── rrtmg_sw_vrtqdr.f90 ├── Radiation.pxd ├── Radiation.pyx ├── ReferenceState.pxd ├── ReferenceState.pyx ├── Restart.pxd ├── Restart.pyx ├── SGS.pxd ├── SGS.pyx ├── ScalarAdvection.pxd ├── ScalarAdvection.pyx ├── ScalarDiffusion.pxd ├── ScalarDiffusion.pyx ├── Simulation3d.pxd ├── Simulation3d.pyx ├── SparseSolvers.pxd ├── SparseSolvers.pyx ├── Surface.pxd ├── Surface.pyx ├── SurfaceBudget.pxd ├── SurfaceBudget.pyx ├── Thermodynamics.pxd ├── Thermodynamics.pyx ├── ThermodynamicsArctic.pxd ├── ThermodynamicsArctic.pyx ├── ThermodynamicsDry.pxd ├── ThermodynamicsDry.pyx ├── ThermodynamicsSA.pxd ├── ThermodynamicsSA.pyx ├── TimeStepping.pxd ├── TimeStepping.pyx ├── Tracers.pxd ├── Tracers.pyx ├── VisualizationOutput.pxd ├── VisualizationOutput.pyx ├── bors.toml ├── cfgrid_forcing_reader.py ├── cfsites_forcing_reader.py ├── compile_RRTMG_combined.csh ├── docs ├── Makefile └── source │ ├── Grid.rst │ ├── conf.py │ ├── index.rst │ ├── install.rst │ ├── introduction.rst │ ├── running.rst │ └── standards.rst ├── entropies.pxd ├── entropies.pyx ├── generate_namelist.py ├── generate_parameters.py ├── generate_parameters_a1m.py ├── lw ├── data │ └── rrtmg_lw.nc ├── modules │ ├── parkind.f90 │ ├── parrrtm.f90 │ ├── rrlw_cld.f90 │ ├── rrlw_con.f90 │ ├── rrlw_kg01.f90 │ ├── rrlw_kg02.f90 │ ├── rrlw_kg03.f90 │ ├── rrlw_kg04.f90 │ ├── rrlw_kg05.f90 │ ├── rrlw_kg06.f90 │ ├── rrlw_kg07.f90 │ ├── rrlw_kg08.f90 │ ├── rrlw_kg09.f90 │ ├── rrlw_kg10.f90 │ ├── rrlw_kg11.f90 │ ├── rrlw_kg12.f90 │ ├── rrlw_kg13.f90 │ ├── rrlw_kg14.f90 │ ├── rrlw_kg15.f90 │ ├── rrlw_kg16.f90 │ ├── rrlw_ncpar.f90 │ ├── rrlw_ref.f90 │ ├── rrlw_tbl.f90 │ ├── rrlw_vsn.f90 │ └── rrlw_wvn.f90 └── src │ ├── mcica_random_numbers.f90 │ ├── mcica_subcol_gen_lw.f90 │ ├── rrtmg_lw_cldprmc.f90 │ ├── rrtmg_lw_cldprop.f90 │ ├── rrtmg_lw_init.f90 │ ├── rrtmg_lw_k_g.f90 │ ├── rrtmg_lw_rad.f90 │ ├── rrtmg_lw_rad.nomcica.f90 │ ├── rrtmg_lw_read_nc.f90 │ ├── rrtmg_lw_rtrn.f90 │ ├── rrtmg_lw_rtrnmc.f90 │ ├── rrtmg_lw_rtrnmr.f90 │ ├── rrtmg_lw_setcoef.f90 │ └── rrtmg_lw_taumol.f90 ├── main.py ├── microphysics_functions.pyx ├── profiles.py ├── rrtmg_build ├── rrtmg_lw_wrapper.f90 └── rrtmg_sw_wrapper.f90 ├── setup.py ├── sw ├── data │ └── rrtmg_sw.nc ├── modules │ ├── parkind.f90 │ ├── parrrsw.f90 │ ├── rrsw_aer.f90 │ ├── rrsw_cld.f90 │ ├── rrsw_con.f90 │ ├── rrsw_kg16.f90 │ ├── rrsw_kg17.f90 │ ├── rrsw_kg18.f90 │ ├── rrsw_kg19.f90 │ ├── rrsw_kg20.f90 │ ├── rrsw_kg21.f90 │ ├── rrsw_kg22.f90 │ ├── rrsw_kg23.f90 │ ├── rrsw_kg24.f90 │ ├── rrsw_kg25.f90 │ ├── rrsw_kg26.f90 │ ├── rrsw_kg27.f90 │ ├── rrsw_kg28.f90 │ ├── rrsw_kg29.f90 │ ├── rrsw_ncpar.f90 │ ├── rrsw_ref.f90 │ ├── rrsw_tbl.f90 │ ├── rrsw_vsn.f90 │ └── rrsw_wvn.f90 └── src │ ├── mcica_random_numbers.f90 │ ├── mcica_subcol_gen_sw.f90 │ ├── rrtmg_sw_cldprmc.f90 │ ├── rrtmg_sw_cldprop.f90 │ ├── rrtmg_sw_init.f90 │ ├── rrtmg_sw_k_g.f90 │ ├── rrtmg_sw_rad.f90 │ ├── rrtmg_sw_rad.nomcica.f90 │ ├── rrtmg_sw_read_nc.f90 │ ├── rrtmg_sw_reftra.f90 │ ├── rrtmg_sw_setcoef.f90 │ ├── rrtmg_sw_spcvmc.f90 │ ├── rrtmg_sw_spcvrt.f90 │ ├── rrtmg_sw_taumol.f90 │ └── rrtmg_sw_vrtqdr.f90 ├── thermodynamic_functions.pxd └── thermodynamic_functions.pyx /.buildkite/pipeline.yml: -------------------------------------------------------------------------------- 1 | env: 2 | MPICH_VERSION: "4.0.0" 3 | OPENMPI_VERSION: "4.1.1" 4 | CUDA_VERSION: "11.2" 5 | OPENBLAS_NUM_THREADS: 1 6 | 7 | steps: 8 | - label: "init :computer:" 9 | key: "init_cpu_env" 10 | command: 11 | 12 | - "source /home/zhaoyi/central_python2.7.15/bin/activate" 13 | - "module purge" 14 | - "module load hdf5/1.10.1" 15 | - "module load netcdf-c/4.6.1" 16 | - "module load netcdf-cxx/4.3.0" 17 | - "module load netcdf-fortran/4.4.4" 18 | - "module load openmpi/1.10.7" 19 | - "python generate_parameters.py" 20 | - "python generate_parameters_a1m.py" 21 | - "CC=mpicc python setup.py build_ext --inplace" 22 | 23 | agents: 24 | config: cpu 25 | queue: central 26 | slurm_ntasks: 1 27 | 28 | - wait 29 | 30 | - label: ":computer: tests" 31 | key: "cpu_test1" 32 | command: 33 | - "source /home/zhaoyi/central_python2.7.15/bin/activate" 34 | - "srun python main.py Bomex.in" 35 | agents: 36 | config: cpu 37 | queue: central 38 | slurm_ntasks: 1 39 | 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pkl 3 | *.pyc 4 | *.so 5 | *.o 6 | *.c 7 | parameters.pxi 8 | parameters_micro.pxi 9 | Csrc/parameters.h 10 | Csrc/parameters_micro.h 11 | *.idea 12 | *.in 13 | build/ 14 | *.txt 15 | figs/ 16 | _static/ 17 | _templates/ 18 | *.png 19 | *.mod 20 | Output/ 21 | -------------------------------------------------------------------------------- /AuxiliaryStatistics.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/AuxiliaryStatistics.pxd -------------------------------------------------------------------------------- /CGILSdata/ctl_s11.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/CGILSdata/ctl_s11.nc -------------------------------------------------------------------------------- /CGILSdata/ctl_s12.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/CGILSdata/ctl_s12.nc -------------------------------------------------------------------------------- /CGILSdata/ctl_s6.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/CGILSdata/ctl_s6.nc -------------------------------------------------------------------------------- /CGILSdata/p2k_s11.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/CGILSdata/p2k_s11.nc -------------------------------------------------------------------------------- /CGILSdata/p2k_s12.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/CGILSdata/p2k_s12.nc -------------------------------------------------------------------------------- /CGILSdata/p2k_s6.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/CGILSdata/p2k_s6.nc -------------------------------------------------------------------------------- /ConditionalStatistics.pxd: -------------------------------------------------------------------------------- 1 | #!python 2 | #cython: boundscheck=False 3 | #cython: wraparound=False 4 | #cython: initializedcheck=False 5 | #cython: cdivision=True 6 | 7 | from scipy.fftpack import fft, ifft 8 | cimport Grid 9 | cimport ReferenceState 10 | cimport DiagnosticVariables 11 | cimport PrognosticVariables 12 | cimport ParallelMPI 13 | 14 | from NetCDFIO cimport NetCDFIO_CondStats 15 | 16 | include "parameters.pxi" 17 | 18 | cdef class ConditionalStatistics: 19 | cdef list CondStatsClasses 20 | cpdef initialize(self, namelist, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, 21 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_CondStats NC, ParallelMPI.ParallelMPI Pa) 22 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, 23 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_CondStats NC, ParallelMPI.ParallelMPI Pa) 24 | 25 | 26 | cdef class NullCondStats: 27 | 28 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, 29 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_CondStats NC, ParallelMPI.ParallelMPI Pa) 30 | 31 | 32 | cdef class SpectraStatistics: 33 | cdef: 34 | Py_ssize_t nwave 35 | double dk 36 | double [:] wavenumbers 37 | double [:] kx 38 | double [:] ky 39 | cdef ParallelMPI.Pencil X_Pencil, Y_Pencil, Z_Pencil 40 | 41 | 42 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, 43 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_CondStats NC, ParallelMPI.ParallelMPI Pa) 44 | 45 | cpdef forward_transform(self, Grid.Grid Gr,ParallelMPI.ParallelMPI Pa, double [:] data, complex [:] data_fft) 46 | cpdef fluctuation_forward_transform(self, Grid.Grid Gr,ParallelMPI.ParallelMPI Pa, double [:] data, complex [:] data_fft) 47 | cpdef compute_spectrum(self, Grid.Grid Gr, ParallelMPI.ParallelMPI Pa, complex [:] data_fft ) 48 | cpdef compute_cospectrum(self, Grid.Grid Gr, ParallelMPI.ParallelMPI Pa, complex [:] data_fft_1, complex [:] data_fft_2 ) 49 | 50 | -------------------------------------------------------------------------------- /Csrc/entropies.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "parameters.h" 3 | #include "thermodynamic_functions.h" 4 | 5 | inline double sd_c(double pd, double T){ 6 | return sd_tilde + cpd*log(T/T_tilde) -Rd*log(pd/p_tilde); 7 | } 8 | 9 | inline double sv_c(double pv, double T){ 10 | return sv_tilde + cpv*log(T/T_tilde) - Rv * log(pv/p_tilde); 11 | } 12 | 13 | inline double sc_c(double L, double T){ 14 | return -L/T; 15 | } 16 | 17 | inline double s_tendency_c(double p0, double qt, double qv, double T, double qt_tendency, double T_tendency){ 18 | const double pv = pv_c(p0, qt, qv); 19 | const double pd = pd_c(p0, qt, qv); 20 | return cpm_c(qt) * T_tendency / T + (sv_c(pv,T) - sd_c(pd,T)) * qt_tendency; 21 | } 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Csrc/grid.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct DimStruct { 3 | 4 | long dims; /// number of physical dimensions 5 | 6 | long n[3]; /// Total number of grid points in grid direction 7 | long ng[3]; /// "" "" "" including ghost points 8 | long nl[3]; /// Total number of local grid points in grid direction owned by local MPI rank 9 | long nlg[3]; /// "" "" "" including ghost points 10 | 11 | long npd; /// Total grid points in domain not including ghost points 12 | long npl; /// Number of grid points not including ghost points owned by local MPI rank 13 | long npg; /// Number of grid points including ghost point owned by local MPI rank 14 | long gw; /// Number of ghost/halo points 15 | 16 | long indx_lo[3]; /// Lower left hand point (globally numbered) of subgrid owned by local MPI rank 17 | long indx_lo_g[3];/// Lower left hand point (globally numbered ) of subgrid owned by local MPI rank including ghostpoints 18 | 19 | long nbuffer[3]; /// Number of points in buffer for ghostpoint update 20 | long ghosted_stride[3]; 21 | 22 | double zp_half_0; 23 | double zp_0; 24 | 25 | double dx[3]; /// Grid spacing in grid direction 26 | double dxi[3]; // Inverse gird spacing in grid direction 27 | 28 | double *met; 29 | double *imet; 30 | double *met_half; 31 | double *imet_half; 32 | 33 | double *metl; 34 | double *imetl; 35 | double *metl_half; 36 | double *imetl_half; 37 | 38 | double *zpl; 39 | double *zpl_half; 40 | 41 | double *dzpl_half; 42 | double *dzpl; 43 | }; 44 | -------------------------------------------------------------------------------- /Csrc/lookup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct LookupStruct{ 5 | size_t n_table; 6 | double y_max; 7 | double y_min; 8 | double x_max; 9 | double x_min; 10 | double dx; 11 | double dxi; 12 | double* y; 13 | 14 | }; 15 | 16 | void init_table(struct LookupStruct *LT, size_t n, double* x, double* y){ 17 | 18 | 19 | /// Allocate memory required for storing the table 20 | LT->y = calloc(n,sizeof(double)); 21 | 22 | /// Determine bounds and set array table values 23 | LT->x_min = 9e16; 24 | LT->x_max = -9e16; 25 | LT->y_min = 9e16; 26 | LT->y_max = -9e16; 27 | for(size_t i=0;ix_max = fmax(LT->x_max,x[i]); 29 | LT->x_min = fmin(LT->x_min,x[i]); 30 | 31 | LT->y_max = fmax(LT->y_max,y[i]); 32 | LT->y_min = fmin(LT->y_min,y[i]); 33 | 34 | LT->y[i] = y[i]; 35 | } 36 | 37 | LT->dx = x[1] - x[0]; 38 | LT->dxi = 1.0/LT->dx; 39 | 40 | }; 41 | 42 | 43 | void free_table(struct LookupStruct *LT){ 44 | /// Free memory allocated in init_table 45 | free(LT->y); 46 | }; 47 | 48 | inline double lookup(struct LookupStruct *LT, double x){ 49 | const size_t indx = floor((x - LT->x_min)*LT->dxi); 50 | const double y1 = LT->y[indx] ; 51 | const double y2 = LT->y[indx + 1]; 52 | const double x1 = LT->x_min + LT-> dx * indx ; 53 | return y1 + (x - x1) * (y2 - y1)*LT->dxi; 54 | }; 55 | -------------------------------------------------------------------------------- /Csrc/thermodynamic_functions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "parameters.h" 3 | #include 4 | 5 | inline double exner_c(const double p0){ 6 | return pow((p0/p_tilde),kappa); 7 | } 8 | 9 | inline double theta_c(const double p0, const double T){ 10 | // Dry potential temperature 11 | return T / exner_c(p0); 12 | } 13 | 14 | inline double thetali_c(const double p0, const double T, const double qt, const double ql, const double qi, const double L){ 15 | // Liquid ice potential temperature consistent with Tripoli and Cotton (1981) 16 | return theta_c(p0, T) * exp(-L*(ql/(1.0 - qt) + qi/(1.0 - qt))/(T*cpd)); 17 | } 18 | 19 | inline double pd_c(const double p0,const double qt, const double qv){ 20 | return p0*(1.0-qt)/(1.0 - qt + eps_vi * qv); 21 | } 22 | 23 | inline double pv_c(const double p0, const double qt, const double qv){ 24 | return p0 * eps_vi * qv /(1.0 - qt + eps_vi * qv); 25 | } 26 | 27 | inline double density_temperature_c(const double T, const double qt, const double qv){ 28 | return T * (1.0 - qt + eps_vi * qv); 29 | } 30 | 31 | inline double theta_rho_c(const double p0, const double T, const double qt, const double qv){ 32 | return density_temperature_c(T,qt,qv)/exner_c(p0); 33 | } 34 | 35 | inline double cpm_c(const double qt){ 36 | return (1.0-qt) * cpd + qt * cpv; 37 | } 38 | 39 | inline double thetas_c(const double s, const double qt){ 40 | return T_tilde*exp((s-(1.0-qt)*sd_tilde - qt*sv_tilde)/cpm_c(qt)); 41 | } 42 | 43 | inline double thetas_t_c(const double p0, const double T, const double qt, const double qv, const double qc, const double L){ 44 | const double qd = 1.0 - qt; 45 | const double pd = pd_c(p0,qt,qt-qc); 46 | const double pv = pv_c(p0,qt,qt-qc); 47 | const double cpm = cpm_c(qt); 48 | return T * pow(p_tilde/pd,qd * Rd/cpm)*pow(p_tilde/pv,qt*Rv/cpm)*exp(-L * qc/(cpm*T)); 49 | } 50 | 51 | inline double entropy_from_thetas_c(const double thetas, const double qt){ 52 | return cpm_c(qt) * log(thetas/T_tilde) + (1.0 - qt)*sd_tilde + qt * sv_tilde; 53 | } 54 | 55 | inline double buoyancy_c(const double alpha0, const double alpha){ 56 | return g * (alpha - alpha0)/alpha0; 57 | } 58 | 59 | inline double qv_star_c(const double p0, const double qt, const double pv){ 60 | return eps_v * (1.0 - qt) * pv / (p0 - pv) ; 61 | } 62 | 63 | inline double alpha_c(double p0, double T, double qt, double qv){ 64 | return (Rd * T)/p0 * (1.0 - qt + eps_vi * qv); 65 | } 66 | -------------------------------------------------------------------------------- /DiagnosticVariables.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI 2 | cimport Grid 3 | cimport ReferenceState 4 | from NetCDFIO cimport NetCDFIO_Stats 5 | cdef class DiagnosticVariables: 6 | cdef: 7 | dict name_index 8 | dict units 9 | dict nice_name 10 | dict desc 11 | list index_name 12 | Py_ssize_t nv 13 | double [:] values 14 | double [:] bc_type 15 | long [:] sedv_index 16 | Py_ssize_t nsedv 17 | dict name_index_2d 18 | dict units_2d 19 | Py_ssize_t nv_2d 20 | double [:] values_2d 21 | void communicate_variable(self,Grid.Grid Gr,ParallelMPI.ParallelMPI PM, long nv) 22 | 23 | cpdef mean_prof(self, Grid.Grid Gr, ParallelMPI.ParallelMPI Pa, str var) 24 | cpdef add_variables(self, name, units, nice_name, desc, bc_type, ParallelMPI.ParallelMPI Pa) 25 | cpdef initialize(self,Grid.Grid Gr, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 26 | cpdef get_variable_array(self,name,Grid.Grid Gr) 27 | cdef inline int get_nv(self, str variable_name): 28 | return self.name_index[variable_name] 29 | cdef inline int get_varshift(self, Grid.Grid Gr, str variable_name): 30 | return self.name_index[variable_name] * Gr.dims.npg 31 | cpdef val_nan(self,PA,message) 32 | cpdef stats_io(self, Grid.Grid Gr, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 33 | cpdef add_variables_2d(self, name, units) 34 | cpdef debug_large(self, Grid.Grid Gr, ReferenceState.ReferenceState RS ,NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa, str message) 35 | cdef inline int get_nv_2d(self, str variable_name): 36 | return self.name_index_2d[variable_name] 37 | cdef inline int get_varshift_2d(self, Grid.Grid Gr, str variable_name): 38 | return self.name_index_2d[variable_name] * Gr.dims.nlg[0] * Gr.dims.nlg[1] -------------------------------------------------------------------------------- /FluxDivergence.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | 3 | 4 | cdef extern from 'flux_divergence.h': 5 | void scalar_flux_divergence(Grid.DimStruct *dims, double *alpha0, double *alpha0_half, 6 | double *flux, double *tendency, double dx, Py_ssize_t d) nogil 7 | 8 | 9 | void momentum_flux_divergence(Grid.DimStruct *dims, double *alpha0, double *alpha0_half, 10 | double *flux, double *tendency, Py_ssize_t d_advected, Py_ssize_t d_advecting) nogil 11 | -------------------------------------------------------------------------------- /FluxDivergence.pyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/FluxDivergence.pyx -------------------------------------------------------------------------------- /ForcingGCMFixed.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport PrognosticVariables 4 | cimport DiagnosticVariables 5 | from NetCDFIO cimport NetCDFIO_Stats 6 | cimport ParallelMPI 7 | from Thermodynamics cimport LatentHeat, ClausiusClapeyron 8 | cimport Thermodynamics 9 | cimport TimeStepping 10 | 11 | cdef class ForcingGCMNew: 12 | cdef: 13 | bint griddata 14 | bint gcm_profiles_initialized 15 | int t_indx 16 | double lat 17 | double lon 18 | double coriolis_param 19 | double [:] temp 20 | double [:] sphum 21 | double [:] ucomp 22 | double [:] vcomp 23 | double [:] ug 24 | double [:] vg 25 | 26 | bint relax_scalar 27 | bint relax_wind 28 | double tau_scalar 29 | double z_i 30 | double z_r 31 | double tau_wind 32 | int gcm_tidx 33 | bint instant_forcing 34 | bint add_advection 35 | bint add_horiz_adv_vert_fluc 36 | bint add_horiz_advection 37 | bint add_vert_fluctuation 38 | bint add_subsidence 39 | bint add_subsidence_wind 40 | bint instant_variance 41 | bint coherent_variance 42 | double hadv_variance_factor 43 | double sub_variance_factor 44 | bint add_coriolis 45 | bint add_ls_pgradient 46 | double [:] qt_tend_nudge 47 | double [:] t_tend_nudge 48 | double [:] u_tend_nudge 49 | double [:] v_tend_nudge 50 | double [:] qt_tend_adv 51 | double [:] t_tend_adv 52 | double [:] s_tend_adv 53 | double [:] qt_tend_hadv 54 | double [:] qt_tend_hadv_tr 55 | double [:] t_tend_hadv 56 | double [:] t_tend_hadv_tr 57 | double [:] s_tend_hadv 58 | double [:] s_tend_hadv_tr 59 | double [:] qt_tend_fluc 60 | double [:] t_tend_fluc 61 | double [:] omega_vv 62 | double [:] subsidence 63 | double [:] subsidence_tr 64 | str file 65 | int site 66 | cpdef initialize(self, Grid.Grid Gr,ReferenceState.ReferenceState RS, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 67 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 68 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, TimeStepping.TimeStepping TS, 69 | ParallelMPI.ParallelMPI Pa) 70 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 71 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, 72 | NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 73 | -------------------------------------------------------------------------------- /ForcingGCMVarying.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport PrognosticVariables 4 | cimport DiagnosticVariables 5 | from NetCDFIO cimport NetCDFIO_Stats 6 | cimport ParallelMPI 7 | from Thermodynamics cimport LatentHeat, ClausiusClapeyron 8 | cimport Thermodynamics 9 | cimport TimeStepping 10 | 11 | cdef class ForcingGCMVarying: 12 | cdef: 13 | bint griddata 14 | bint gcm_profiles_initialized 15 | int t_indx 16 | double lat 17 | double lon 18 | double coriolis_param 19 | double [:] temp 20 | double [:] sphum 21 | double [:] ucomp 22 | double [:] vcomp 23 | double [:] ug 24 | double [:] vg 25 | 26 | double forcing_frequency 27 | bint relax_scalar 28 | bint relax_wind 29 | double tau_scalar 30 | double z_i 31 | double z_r 32 | double tau_wind 33 | int gcm_tidx 34 | bint add_horiz_advection 35 | bint add_subsidence 36 | bint add_subsidence_wind 37 | bint add_coriolis 38 | bint add_ls_pgradient 39 | double [:] qt_tend_nudge 40 | double [:] t_tend_nudge 41 | double [:] u_tend_nudge 42 | double [:] v_tend_nudge 43 | double [:] qt_tend_adv 44 | double [:] t_tend_adv 45 | double [:] s_tend_adv 46 | double [:] qt_tend_hadv 47 | double [:] t_tend_hadv 48 | double [:] s_tend_hadv 49 | double [:] qt_tend_fluc 50 | double [:] t_tend_fluc 51 | double [:] omega_vv 52 | double [:] subsidence 53 | str file 54 | int site 55 | cpdef initialize(self, Grid.Grid Gr,ReferenceState.ReferenceState RS, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 56 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 57 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, TimeStepping.TimeStepping TS, 58 | ParallelMPI.ParallelMPI Pa) 59 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 60 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, 61 | NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 62 | -------------------------------------------------------------------------------- /Grid.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI 2 | cimport Restart 3 | 4 | cdef extern from "grid.h": 5 | struct DimStruct: 6 | 7 | int dims 8 | 9 | int [3] n 10 | int [3] ng 11 | int [3] nl 12 | int [3] nlg 13 | int [3] indx_lo_g 14 | int [3] indx_lo 15 | 16 | int npd 17 | int npl 18 | int npg 19 | int gw 20 | 21 | int [3] nbuffer 22 | int [3] ghosted_stride 23 | 24 | double [3] dx 25 | double [3] dxi 26 | 27 | double zp_half_0 28 | double zp_0 29 | 30 | double * met; 31 | double * met_half; 32 | double * imet; 33 | double * imet_half; 34 | 35 | double * metl; 36 | double * metl_half; 37 | double * imetl; 38 | double * imetl_half 39 | 40 | double * dzpl_half 41 | double * dzpl 42 | 43 | double * zpl_half 44 | double * zpl 45 | 46 | 47 | 48 | 49 | cdef class Grid: 50 | cdef: 51 | DimStruct dims 52 | 53 | bint stretch 54 | double stretch_scale 55 | 56 | double [:] x 57 | double [:] x_half 58 | double [:] y 59 | double [:] y_half 60 | double [:] z 61 | double [:] z_half 62 | 63 | double [:] xl 64 | double [:] xl_half 65 | double [:] yl 66 | double [:] yl_half 67 | double [:] zl 68 | double [:] zl_half 69 | 70 | double [:] zp 71 | double [:] zp_half 72 | double [:] zpl 73 | double [:] zpl_half 74 | 75 | double [:] dzp 76 | double [:] dzp_half 77 | 78 | double [:] dzpl 79 | double [:] dzpl_half 80 | 81 | double [:] met; 82 | double [:] met_half; 83 | double [:] imet; 84 | double [:] imet_half; 85 | 86 | double [:] metl; 87 | double [:] metl_half; 88 | double [:] imetl; 89 | double [:] imetl_half; 90 | 91 | void compute_global_dims(self) 92 | void compute_local_dims(self,ParallelMPI.ParallelMPI Parallel) 93 | void compute_coordinates(self) 94 | 95 | cpdef extract_local(self, double [:] global_array, int dim) 96 | 97 | cpdef extract_local_ghosted(self, double [:] global_array, int dim) 98 | 99 | cpdef restart(self, Restart.Restart Re) 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /Initialization.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/Initialization.pxd -------------------------------------------------------------------------------- /Kinematics.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport PrognosticVariables 3 | cimport ParallelMPI 4 | cimport ReferenceState 5 | from NetCDFIO cimport NetCDFIO_Stats 6 | 7 | cdef class Kinematics: 8 | cdef: 9 | double[:] vgrad 10 | double[:] strain_rate 11 | double[:] strain_rate_mag 12 | double[:] wind_speed 13 | double[:] wind_angle 14 | Py_ssize_t get_grad_shift(self, Grid.Grid Gr, Py_ssize_t vel_i, Py_ssize_t dx_j) 15 | cpdef initialize(self, Grid.Grid Gr, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 16 | cpdef update(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV) 17 | cpdef stats_io(self, Grid.Grid Gr,ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 18 | -------------------------------------------------------------------------------- /Lookup.pxd: -------------------------------------------------------------------------------- 1 | 2 | cdef extern from "lookup.h": 3 | struct LookupStruct: 4 | int n_table 5 | double y_max 6 | double y_min 7 | double x_max 8 | double x_min 9 | double dx 10 | double dxi 11 | double* table_values 12 | 13 | void init_table(LookupStruct *LT, long n, double *x, double *y) nogil 14 | void free_table(LookupStruct *LT) nogil 15 | inline double lookup(LookupStruct * LT, double x) nogil 16 | 17 | cdef class Lookup: 18 | cdef: 19 | LookupStruct LookupStructC 20 | cpdef initialize(self, double[:] x, double[:] y) 21 | cpdef finalize(self) 22 | cpdef table_bounds(self) 23 | cpdef lookup(self, double x) 24 | cdef: 25 | inline double fast_lookup(self, double x) nogil 26 | -------------------------------------------------------------------------------- /Lookup.pyx: -------------------------------------------------------------------------------- 1 | #!python 2 | #cython: boundscheck=False 3 | #cython: wraparound=False 4 | #cython: initializedcheck=False 5 | #cython: cdivision=True 6 | 7 | import numpy as np 8 | cimport numpy as np 9 | 10 | 11 | cdef class Lookup: 12 | def __init__(self): 13 | pass 14 | 15 | cpdef initialize(self, double[:] x, double[:] y): 16 | cdef long n = np.shape(y)[0] 17 | init_table( &self.LookupStructC, n, &x[0], &y[0]) 18 | return 19 | 20 | cpdef finalize(self): 21 | free_table(&self.LookupStructC) 22 | return 23 | 24 | cpdef table_bounds(self): 25 | return self.LookupStructC.x_min, self.LookupStructC.x_max, self.LookupStructC.y_min, self.LookupStructC.y_max 26 | 27 | cpdef lookup(self, double x): 28 | return lookup(&self.LookupStructC, x) 29 | 30 | cdef inline double fast_lookup(self, double x) nogil: 31 | return lookup(&self.LookupStructC, x) 32 | -------------------------------------------------------------------------------- /MomentumAdvection.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport PrognosticVariables 3 | cimport ParallelMPI 4 | cimport ReferenceState 5 | from NetCDFIO cimport NetCDFIO_Stats 6 | 7 | cdef class MomentumAdvection: 8 | cdef: 9 | Py_ssize_t order 10 | 11 | cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 12 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Rs, PrognosticVariables.PrognosticVariables PV, ParallelMPI.ParallelMPI Pa) 13 | cpdef stats_io(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 14 | cpdef double[:, :, :] get_flux(self, Py_ssize_t i_advected, Py_ssize_t i_advecting, Grid.Grid Gr) 15 | -------------------------------------------------------------------------------- /MomentumDiffusion.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport PrognosticVariables 4 | cimport DiagnosticVariables 5 | cimport Kinematics 6 | cimport ParallelMPI 7 | from NetCDFIO cimport NetCDFIO_Stats 8 | 9 | cdef class MomentumDiffusion: 10 | cdef: 11 | double[:] flux 12 | Py_ssize_t n_fluxes 13 | cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, 14 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 15 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Rs, PrognosticVariables.PrognosticVariables PV, 16 | DiagnosticVariables.DiagnosticVariables DV, Kinematics.Kinematics Ke) 17 | cpdef stats_io(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, 18 | DiagnosticVariables.DiagnosticVariables DV, Kinematics.Kinematics Ke, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 19 | -------------------------------------------------------------------------------- /PostProcessing/combine3d.pyx: -------------------------------------------------------------------------------- 1 | import cython 2 | 3 | 4 | @cython.boundscheck(False) # Turn off numpy array index bounds checking 5 | @cython.wraparound(False) # Turn off numpy array wrap around indexing 6 | @cython.cdivision(True) 7 | cpdef to_3d(double[:] f_data, int nl_0, int nl_1, int nl_2, int indx_lo_0, 8 | int indx_lo_1, int indx_lo_2, double[:, :, :] f_data_3d): 9 | 10 | cdef: 11 | int istride = nl_2 * nl_1 12 | int jstride = nl_2 13 | int ishift 14 | int jshift 15 | 16 | int i, j, k 17 | 18 | with nogil: 19 | for i in range(nl_0): 20 | ishift = i * istride 21 | for j in range(nl_1): 22 | jshift = j * jstride 23 | for k in range(nl_2): 24 | ijk = ishift + jshift + k 25 | f_data_3d[ 26 | indx_lo_0 + i, indx_lo_1 + j, indx_lo_2 + k] = f_data[ijk] 27 | -------------------------------------------------------------------------------- /PostProcessing/combine3dMany.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import os 3 | import netCDF4 as nc 4 | import numpy as np 5 | import subprocess 6 | 7 | def main(): 8 | import combine3dFields 9 | 10 | tau0 = '1_00x' 11 | ars = {} 12 | ars['output_root'] = '/export/data1/zhaoyi/GCMForcedLES/fields_combined/'+tau0+'/250m/' 13 | ars['fields_root'] = '/export/data1/zhaoyi/GCMForcedLES/'+tau0+'/250m/' 14 | ars['restart_time'] = '20736000' 15 | 16 | filename = '/export/data1/zhaoyi/GCMForcedLES/forcing/new_'+tau0+'_default.nc' 17 | rt_grp = nc.Dataset(filename, 'r') 18 | lons = rt_grp['lons'][0::4] 19 | rt_grp.close() 20 | 21 | ars['case_list'] = list(np.round(lons,1)[0:4]) 22 | 23 | 24 | make_paths(ars) 25 | get_fields(ars) 26 | 27 | 28 | for case in ars['case_fields'].keys(): 29 | out_path = ars['case_fields_paths'][case] 30 | fields_path = ars['case_fields'][case] 31 | 32 | print case, out_path, fields_path 33 | combine3dFields.main(fields_path, out_path) 34 | 35 | return 36 | 37 | def make_paths(ars): 38 | 39 | #Generate Altered Restarts 40 | if not os.path.exists(ars['output_root']): 41 | os.mkdir(ars['output_root']) 42 | 43 | ars['case_fields_paths'] = {} 44 | #Now create the paths for each of the individual cases 45 | for case in ars['case_list']: 46 | 47 | path = os.path.join(ars['output_root'], str(case)) 48 | path_time = os.path.join(path, ars['restart_time']) 49 | ars['case_fields_paths'][case] = path_time 50 | if not os.path.exists(path): 51 | os.mkdir(path) 52 | if not os.path.exists(path_time): 53 | os.mkdir(path_time) 54 | 55 | return 56 | 57 | def get_fields(ars): 58 | 59 | sim_dirs = glob.glob(os.path.join(ars['fields_root'], 'Output*')) 60 | 61 | ars['case_fields'] = {} 62 | for case in ars['case_list']: 63 | for sim in sim_dirs: 64 | if str(case) in sim: 65 | ars['case_fields'][case] = os.path.join(os.path.join(sim, 'fields'), ars['restart_time']) 66 | 67 | 68 | 69 | return 70 | 71 | 72 | if __name__ == '__main__': 73 | main() 74 | 75 | -------------------------------------------------------------------------------- /PostProcessing/setup.py: -------------------------------------------------------------------------------- 1 | from distutils.core import setup 2 | from Cython.Build import cythonize 3 | from distutils.extension import Extension 4 | 5 | extensions = [] 6 | extra_compile_args = [] 7 | # ,'-Rpass=loop-vectorize'] 8 | extra_compile_args += ['-O3', '-march=native', '-Wno-unused', '-Wno-#warnings'] 9 | 10 | _ext = Extension("combine3d", ["combine3d.pyx"], 11 | extra_compile_args=extra_compile_args) 12 | extensions.append(_ext) 13 | 14 | setup( 15 | ext_modules=cythonize(extensions, verbose=1) 16 | ) 17 | -------------------------------------------------------------------------------- /PressureFFTParallel.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI 2 | cimport Grid 3 | cimport ReferenceState 4 | cimport SparseSolvers 5 | cimport DiagnosticVariables 6 | 7 | cdef class PressureFFTParallel: 8 | 9 | cdef: 10 | double [:] a 11 | double [:] b 12 | double [:] c 13 | 14 | double [:] kx2 15 | double [:] ky2 16 | 17 | inline void compute_diagonal(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, Py_ssize_t i, Py_ssize_t j) nogil 18 | 19 | cdef SparseSolvers.TDMA TDMA_Solver 20 | 21 | cdef ParallelMPI.Pencil X_Pencil, Y_Pencil, Z_Pencil 22 | 23 | cpdef initialize(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, ParallelMPI.ParallelMPI Pa) 24 | 25 | cpdef compute_modified_wave_numbers(self,Grid.Grid Gr) 26 | 27 | cpdef compute_off_diagonals(self,Grid.Grid Gr, ReferenceState.ReferenceState RS) 28 | 29 | cpdef solve(self,Grid.Grid Gr, ReferenceState.ReferenceState RS,DiagnosticVariables.DiagnosticVariables DV, 30 | ParallelMPI.ParallelMPI PM) -------------------------------------------------------------------------------- /PressureFFTSerial.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI 2 | cimport Grid 3 | cimport ReferenceState 4 | cimport SparseSolvers 5 | cimport DiagnosticVariables 6 | 7 | cdef class PressureFFTSerial: 8 | 9 | cdef: 10 | double [:] a 11 | double [:] b 12 | double [:] c 13 | double [:] kx2 14 | double [:] ky2 15 | inline void compute_diagonal(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, Py_ssize_t i, Py_ssize_t j) nogil 16 | cdef SparseSolvers.TDMA TDMA_Solver 17 | cpdef initialize(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, ParallelMPI.ParallelMPI Pa) 18 | cpdef compute_modified_wave_numbers(self,Grid.Grid Gr) 19 | cpdef compute_off_diagonals(self,Grid.Grid Gr, ReferenceState.ReferenceState RS) 20 | cpdef solve(self,Grid.Grid Gr, ReferenceState.ReferenceState RS,DiagnosticVariables.DiagnosticVariables DV, ParallelMPI.ParallelMPI PM) 21 | -------------------------------------------------------------------------------- /PressureSolver.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI 2 | cimport Grid 3 | cimport ReferenceState 4 | cimport PrognosticVariables 5 | cimport DiagnosticVariables 6 | 7 | cdef class PressureSolver: 8 | cdef: 9 | #Here we define the poisson solver to be an arbitrary python object (there is likely a better way to do this) 10 | object poisson_solver 11 | double [:] divergence 12 | cpdef initialize(self,namelist, Grid.Grid Gr, ReferenceState.ReferenceState RS, DiagnosticVariables.DiagnosticVariables DV, ParallelMPI.ParallelMPI PM) 13 | cpdef update(self,Grid.Grid Gr, ReferenceState.ReferenceState RS, DiagnosticVariables.DiagnosticVariables DV, PrognosticVariables.PrognosticVariables PV, 14 | ParallelMPI.ParallelMPI PM) -------------------------------------------------------------------------------- /RRTMG/lw/data/rrtmg_lw.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/RRTMG/lw/data/rrtmg_lw.nc -------------------------------------------------------------------------------- /RRTMG/lw/modules/parkind.f90: -------------------------------------------------------------------------------- 1 | module parkind 2 | 3 | implicit none 4 | save 5 | 6 | !------------------------------------------------------------------ 7 | ! rrtmg kinds 8 | ! Define integer and real kinds for various types. 9 | ! 10 | ! Initial version: MJIacono, AER, jun2006 11 | ! Revised: MJIacono, AER, aug2008 12 | !------------------------------------------------------------------ 13 | 14 | ! 15 | ! integer kinds 16 | ! ------------- 17 | ! 18 | integer, parameter :: kind_ib = selected_int_kind(13) ! 8 byte integer 19 | integer, parameter :: kind_im = selected_int_kind(6) ! 4 byte integer 20 | integer, parameter :: kind_in = kind(1) ! native integer 21 | 22 | ! 23 | ! real kinds 24 | ! ---------- 25 | ! 26 | integer, parameter :: kind_rb = selected_real_kind(12) ! 8 byte real 27 | integer, parameter :: kind_rm = selected_real_kind(6) ! 4 byte real 28 | integer, parameter :: kind_rn = kind(1.0) ! native real 29 | 30 | end module parkind 31 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_cld.f90: -------------------------------------------------------------------------------- 1 | module rrlw_cld 2 | 3 | use parkind, only : rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_lw cloud property coefficients 10 | 11 | ! Revised: MJIacono, AER, jun2006 12 | ! Revised: MJIacono, AER, aug2008 13 | !------------------------------------------------------------------ 14 | 15 | ! name type purpose 16 | ! ----- : ---- : ---------------------------------------------- 17 | ! abscld1: real : 18 | ! absice0: real : 19 | ! absice1: real : 20 | ! absice2: real : 21 | ! absice3: real : 22 | ! absliq0: real : 23 | ! absliq1: real : 24 | !------------------------------------------------------------------ 25 | 26 | real(kind=rb) :: abscld1 27 | real(kind=rb) , dimension(2) :: absice0 28 | real(kind=rb) , dimension(2,5) :: absice1 29 | real(kind=rb) , dimension(43,16) :: absice2 30 | real(kind=rb) , dimension(46,16) :: absice3 31 | real(kind=rb) :: absliq0 32 | real(kind=rb) , dimension(58,16) :: absliq1 33 | 34 | end module rrlw_cld 35 | 36 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_con.f90: -------------------------------------------------------------------------------- 1 | module rrlw_con 2 | 3 | use parkind, only : rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_lw constants 10 | 11 | ! Initial version: MJIacono, AER, jun2006 12 | ! Revised: MJIacono, AER, aug2008 13 | !------------------------------------------------------------------ 14 | 15 | ! name type purpose 16 | ! ----- : ---- : ---------------------------------------------- 17 | ! fluxfac: real : radiance to flux conversion factor 18 | ! heatfac: real : flux to heating rate conversion factor 19 | !oneminus: real : 1.-1.e-6 20 | ! pi : real : pi 21 | ! grav : real : acceleration of gravity 22 | ! planck : real : planck constant 23 | ! boltz : real : boltzmann constant 24 | ! clight : real : speed of light 25 | ! avogad : real : avogadro constant 26 | ! alosmt : real : loschmidt constant 27 | ! gascon : real : molar gas constant 28 | ! radcn1 : real : first radiation constant 29 | ! radcn2 : real : second radiation constant 30 | ! sbcnst : real : stefan-boltzmann constant 31 | ! secdy : real : seconds per day 32 | !------------------------------------------------------------------ 33 | 34 | real(kind=rb) :: fluxfac, heatfac 35 | real(kind=rb) :: oneminus, pi, grav 36 | real(kind=rb) :: planck, boltz, clight 37 | real(kind=rb) :: avogad, alosmt, gascon 38 | real(kind=rb) :: radcn1, radcn2 39 | real(kind=rb) :: sbcnst, secdy 40 | 41 | end module rrlw_con 42 | 43 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg01.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg01 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 1 10 | ! band 1: 10-250 cm-1 (low - h2o; high - h2o) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! kao_mn2 : real 24 | ! kbo_mn2 : real 25 | ! selfrefo: real 26 | ! forrefo : real 27 | !----------------------------------------------------------------- 28 | 29 | integer(kind=im), parameter :: no1 = 16 30 | 31 | real(kind=rb) :: fracrefao(no1) , fracrefbo(no1) 32 | real(kind=rb) :: kao(5,13,no1) 33 | real(kind=rb) :: kbo(5,13:59,no1) 34 | real(kind=rb) :: kao_mn2(19,no1) , kbo_mn2(19,no1) 35 | real(kind=rb) :: selfrefo(10,no1), forrefo(4,no1) 36 | 37 | !----------------------------------------------------------------- 38 | ! rrtmg_lw COMBINED abs. coefficients for interval 1 39 | ! band 1: 10-250 cm-1 (low - h2o; high - h2o) 40 | ! 41 | ! Initial version: JJMorcrette, ECMWF, jul1998 42 | ! Revised: MJIacono, AER, jun2006 43 | ! Revised: MJIacono, AER, aug2008 44 | !----------------------------------------------------------------- 45 | ! 46 | ! name type purpose 47 | ! ---- : ---- : --------------------------------------------- 48 | !fracrefa : real 49 | !fracrefb : real 50 | ! ka : real 51 | ! kb : real 52 | ! absa : real 53 | ! absb : real 54 | ! ka_mn2 : real 55 | ! kb_mn2 : real 56 | ! selfref : real 57 | ! forref : real 58 | !----------------------------------------------------------------- 59 | 60 | integer(kind=im), parameter :: ng1 = 10 61 | 62 | real(kind=rb) :: fracrefa(ng1) , fracrefb(ng1) 63 | real(kind=rb) :: ka(5,13,ng1) , absa(65,ng1) 64 | real(kind=rb) :: kb(5,13:59,ng1), absb(235,ng1) 65 | real(kind=rb) :: ka_mn2(19,ng1) , kb_mn2(19,ng1) 66 | real(kind=rb) :: selfref(10,ng1), forref(4,ng1) 67 | 68 | equivalence (ka(1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 69 | 70 | end module rrlw_kg01 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg02.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg02 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 2 10 | ! band 2: 250-500 cm-1 (low - h2o; high - h2o) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! selfrefo: real 24 | ! forrefo : real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no2 = 16 28 | 29 | real(kind=rb) :: fracrefao(no2) , fracrefbo(no2) 30 | real(kind=rb) :: kao(5,13,no2) 31 | real(kind=rb) :: kbo(5,13:59,no2) 32 | real(kind=rb) :: selfrefo(10,no2) , forrefo(4,no2) 33 | 34 | !----------------------------------------------------------------- 35 | ! rrtmg_lw COMBINED abs. coefficients for interval 2 36 | ! band 2: 250-500 cm-1 (low - h2o; high - h2o) 37 | ! 38 | ! Initial version: JJMorcrette, ECMWF, jul1998 39 | ! Revised: MJIacono, AER, jun2006 40 | ! Revised: MJIacono, AER, aug2008 41 | !----------------------------------------------------------------- 42 | ! 43 | ! name type purpose 44 | ! ---- : ---- : --------------------------------------------- 45 | !fracrefa : real 46 | !fracrefb : real 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! 54 | ! refparam: real 55 | !----------------------------------------------------------------- 56 | 57 | integer(kind=im), parameter :: ng2 = 12 58 | 59 | real(kind=rb) :: fracrefa(ng2) , fracrefb(ng2) 60 | real(kind=rb) :: ka(5,13,ng2) , absa(65,ng2) 61 | real(kind=rb) :: kb(5,13:59,ng2), absb(235,ng2) 62 | real(kind=rb) :: selfref(10,ng2), forref(4,ng2) 63 | 64 | real(kind=rb) :: refparam(13) 65 | 66 | equivalence (ka(1,1,1),absa(1,1)),(kb(1,13,1),absb(1,1)) 67 | 68 | end module rrlw_kg02 69 | 70 | 71 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg03.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg03 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 3 10 | ! band 3: 500-630 cm-1 (low - h2o,co2; high - h2o,co2) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! kao_mn2o: real 24 | ! kbo_mn2o: real 25 | ! selfrefo: real 26 | ! forrefo : real 27 | !----------------------------------------------------------------- 28 | 29 | integer(kind=im), parameter :: no3 = 16 30 | 31 | real(kind=rb) :: fracrefao(no3,9) ,fracrefbo(no3,5) 32 | real(kind=rb) :: kao(9,5,13,no3) 33 | real(kind=rb) :: kbo(5,5,13:59,no3) 34 | real(kind=rb) :: kao_mn2o(9,19,no3), kbo_mn2o(5,19,no3) 35 | real(kind=rb) :: selfrefo(10,no3) 36 | real(kind=rb) :: forrefo(4,no3) 37 | 38 | !----------------------------------------------------------------- 39 | ! rrtmg_lw COMBINED abs. coefficients for interval 3 40 | ! band 3: 500-630 cm-1 (low - h2o,co2; high - h2o,co2) 41 | ! 42 | ! Initial version: JJMorcrette, ECMWF, jul1998 43 | ! Revised: MJIacono, AER, jun2006 44 | ! Revised: MJIacono, AER, aug2008 45 | !----------------------------------------------------------------- 46 | ! 47 | ! name type purpose 48 | ! ---- : ---- : --------------------------------------------- 49 | !fracrefa : real 50 | !fracrefb : real 51 | ! ka : real 52 | ! kb : real 53 | ! ka_mn2o : real 54 | ! kb_mn2o : real 55 | ! selfref : real 56 | ! forref : real 57 | ! 58 | ! absa : real 59 | ! absb : real 60 | !----------------------------------------------------------------- 61 | 62 | integer(kind=im), parameter :: ng3 = 16 63 | 64 | real(kind=rb) :: fracrefa(ng3,9) ,fracrefb(ng3,5) 65 | real(kind=rb) :: ka(9,5,13,ng3) ,absa(585,ng3) 66 | real(kind=rb) :: kb(5,5,13:59,ng3),absb(1175,ng3) 67 | real(kind=rb) :: ka_mn2o(9,19,ng3), kb_mn2o(5,19,ng3) 68 | real(kind=rb) :: selfref(10,ng3) 69 | real(kind=rb) :: forref(4,ng3) 70 | 71 | equivalence (ka(1,1,1,1),absa(1,1)),(kb(1,1,13,1),absb(1,1)) 72 | 73 | end module rrlw_kg03 74 | 75 | 76 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg04.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg04 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 4 10 | ! band 4: 630-700 cm-1 (low - h2o,co2; high - o3,co2) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! selfrefo: real 24 | ! forrefo : real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no4 = 16 28 | 29 | real(kind=rb) :: fracrefao(no4,9) ,fracrefbo(no4,5) 30 | real(kind=rb) :: kao(9,5,13,no4) 31 | real(kind=rb) :: kbo(5,5,13:59,no4) 32 | real(kind=rb) :: selfrefo(10,no4) ,forrefo(4,no4) 33 | 34 | !----------------------------------------------------------------- 35 | ! rrtmg_lw COMBINED abs. coefficients for interval 4 36 | ! band 4: 630-700 cm-1 (low - h2o,co2; high - o3,co2) 37 | ! 38 | ! Initial version: JJMorcrette, ECMWF, jul1998 39 | ! Revised: MJIacono, AER, jun2006 40 | ! Revised: MJIacono, AER, aug2008 41 | !----------------------------------------------------------------- 42 | ! 43 | ! name type purpose 44 | ! ---- : ---- : --------------------------------------------- 45 | ! absa : real 46 | ! absb : real 47 | !fracrefa : real 48 | !fracrefb : real 49 | ! ka : real 50 | ! kb : real 51 | ! selfref : real 52 | ! forref : real 53 | !----------------------------------------------------------------- 54 | 55 | integer(kind=im), parameter :: ng4 = 14 56 | 57 | real(kind=rb) :: fracrefa(ng4,9) ,fracrefb(ng4,5) 58 | real(kind=rb) :: ka(9,5,13,ng4) ,absa(585,ng4) 59 | real(kind=rb) :: kb(5,5,13:59,ng4),absb(1175,ng4) 60 | real(kind=rb) :: selfref(10,ng4) ,forref(4,ng4) 61 | 62 | equivalence (ka(1,1,1,1),absa(1,1)),(kb(1,1,13,1),absb(1,1)) 63 | 64 | end module rrlw_kg04 65 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg05.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg05 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 5 10 | ! band 5: 700-820 cm-1 (low - h2o,co2; high - o3,co2) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! kao_mo3 : real 24 | ! selfrefo: real 25 | ! forrefo : real 26 | ! ccl4o : real 27 | !----------------------------------------------------------------- 28 | 29 | integer(kind=im), parameter :: no5 = 16 30 | 31 | real(kind=rb) :: fracrefao(no5,9) ,fracrefbo(no5,5) 32 | real(kind=rb) :: kao(9,5,13,no5) 33 | real(kind=rb) :: kbo(5,5,13:59,no5) 34 | real(kind=rb) :: kao_mo3(9,19,no5) 35 | real(kind=rb) :: selfrefo(10,no5) 36 | real(kind=rb) :: forrefo(4,no5) 37 | real(kind=rb) :: ccl4o(no5) 38 | 39 | !----------------------------------------------------------------- 40 | ! rrtmg_lw COMBINED abs. coefficients for interval 5 41 | ! band 5: 700-820 cm-1 (low - h2o,co2; high - o3,co2) 42 | ! 43 | ! Initial version: JJMorcrette, ECMWF, jul1998 44 | ! Revised: MJIacono, AER, jun2006 45 | ! Revised: MJIacono, AER, aug2008 46 | !----------------------------------------------------------------- 47 | ! 48 | ! name type purpose 49 | ! ---- : ---- : --------------------------------------------- 50 | !fracrefa : real 51 | !fracrefb : real 52 | ! ka : real 53 | ! kb : real 54 | ! ka_mo3 : real 55 | ! selfref : real 56 | ! forref : real 57 | ! ccl4 : real 58 | ! 59 | ! absa : real 60 | ! absb : real 61 | !----------------------------------------------------------------- 62 | 63 | integer(kind=im), parameter :: ng5 = 16 64 | 65 | real(kind=rb) :: fracrefa(ng5,9) ,fracrefb(ng5,5) 66 | real(kind=rb) :: ka(9,5,13,ng5) ,absa(585,ng5) 67 | real(kind=rb) :: kb(5,5,13:59,ng5),absb(1175,ng5) 68 | real(kind=rb) :: ka_mo3(9,19,ng5) 69 | real(kind=rb) :: selfref(10,ng5) 70 | real(kind=rb) :: forref(4,ng5) 71 | real(kind=rb) :: ccl4(ng5) 72 | 73 | equivalence (ka(1,1,1,1),absa(1,1)),(kb(1,1,13,1),absb(1,1)) 74 | 75 | end module rrlw_kg05 76 | 77 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg06.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg06 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 6 10 | ! band 6: 820-980 cm-1 (low - h2o; high - nothing) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | ! kao : real 21 | ! kao_mco2: real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !cfc11adjo: real 25 | ! cfc12o : real 26 | !----------------------------------------------------------------- 27 | 28 | integer(kind=im), parameter :: no6 = 16 29 | 30 | real(kind=rb) , dimension(no6) :: fracrefao 31 | real(kind=rb) :: kao(5,13,no6) 32 | real(kind=rb) :: kao_mco2(19,no6) 33 | real(kind=rb) :: selfrefo(10,no6) 34 | real(kind=rb) :: forrefo(4,no6) 35 | 36 | real(kind=rb) , dimension(no6) :: cfc11adjo 37 | real(kind=rb) , dimension(no6) :: cfc12o 38 | 39 | !----------------------------------------------------------------- 40 | ! rrtmg_lw COMBINED abs. coefficients for interval 6 41 | ! band 6: 820-980 cm-1 (low - h2o; high - nothing) 42 | ! 43 | ! Initial version: JJMorcrette, ECMWF, jul1998 44 | ! Revised: MJIacono, AER, jun2006 45 | ! Revised: MJIacono, AER, aug2008 46 | !----------------------------------------------------------------- 47 | ! 48 | ! name type purpose 49 | ! ---- : ---- : --------------------------------------------- 50 | !fracrefa : real 51 | ! ka : real 52 | ! ka_mco2 : real 53 | ! selfref : real 54 | ! forref : real 55 | !cfc11adj : real 56 | ! cfc12 : real 57 | ! 58 | ! absa : real 59 | !----------------------------------------------------------------- 60 | 61 | integer(kind=im), parameter :: ng6 = 8 62 | 63 | real(kind=rb) , dimension(ng6) :: fracrefa 64 | real(kind=rb) :: ka(5,13,ng6),absa(65,ng6) 65 | real(kind=rb) :: ka_mco2(19,ng6) 66 | real(kind=rb) :: selfref(10,ng6) 67 | real(kind=rb) :: forref(4,ng6) 68 | 69 | real(kind=rb) , dimension(ng6) :: cfc11adj 70 | real(kind=rb) , dimension(ng6) :: cfc12 71 | 72 | equivalence (ka(1,1,1),absa(1,1)) 73 | 74 | end module rrlw_kg06 75 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg10.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg10 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 10 10 | ! band 10: 1390-1480 cm-1 (low - h2o; high - h2o) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! selfrefo: real 24 | ! forrefo : real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no10 = 16 28 | 29 | real(kind=rb) , dimension(no10) :: fracrefao 30 | real(kind=rb) , dimension(no10) :: fracrefbo 31 | 32 | real(kind=rb) :: kao(5,13,no10) 33 | real(kind=rb) :: kbo(5,13:59,no10) 34 | real(kind=rb) :: selfrefo(10,no10) 35 | real(kind=rb) :: forrefo(4,no10) 36 | 37 | !----------------------------------------------------------------- 38 | ! rrtmg_lw COMBINED abs. coefficients for interval 10 39 | ! band 10: 1390-1480 cm-1 (low - h2o; high - h2o) 40 | ! 41 | ! Initial version: JJMorcrette, ECMWF, jul1998 42 | ! Revised: MJIacono, AER, jun2006 43 | ! Revised: MJIacono, AER, aug2008 44 | !----------------------------------------------------------------- 45 | ! 46 | ! name type purpose 47 | ! ---- : ---- : --------------------------------------------- 48 | !fracrefao: real 49 | !fracrefbo: real 50 | ! kao : real 51 | ! kbo : real 52 | ! selfref : real 53 | ! forref : real 54 | ! 55 | ! absa : real 56 | ! absb : real 57 | !----------------------------------------------------------------- 58 | 59 | integer(kind=im), parameter :: ng10 = 6 60 | 61 | real(kind=rb) , dimension(ng10) :: fracrefa 62 | real(kind=rb) , dimension(ng10) :: fracrefb 63 | 64 | real(kind=rb) :: ka(5,13,ng10) , absa(65,ng10) 65 | real(kind=rb) :: kb(5,13:59,ng10), absb(235,ng10) 66 | real(kind=rb) :: selfref(10,ng10) 67 | real(kind=rb) :: forref(4,ng10) 68 | 69 | equivalence (ka(1,1,1),absa(1,1)),(kb(1,13,1),absb(1,1)) 70 | 71 | end module rrlw_kg10 72 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg12.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg12 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 12 10 | ! band 12: 1800-2080 cm-1 (low - h2o,co2; high - nothing) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | ! kao : real 21 | ! selfrefo: real 22 | ! forrefo : real 23 | !----------------------------------------------------------------- 24 | 25 | integer(kind=im), parameter :: no12 = 16 26 | 27 | real(kind=rb) :: fracrefao(no12,9) 28 | real(kind=rb) :: kao(9,5,13,no12) 29 | real(kind=rb) :: selfrefo(10,no12) 30 | real(kind=rb) :: forrefo(4,no12) 31 | 32 | !----------------------------------------------------------------- 33 | ! rrtmg_lw COMBINED abs. coefficients for interval 12 34 | ! band 12: 1800-2080 cm-1 (low - h2o,co2; high - nothing) 35 | ! 36 | ! Initial version: JJMorcrette, ECMWF, jul1998 37 | ! Revised: MJIacono, AER, jun2006 38 | ! Revised: MJIacono, AER, aug2008 39 | !----------------------------------------------------------------- 40 | ! 41 | ! name type purpose 42 | ! ---- : ---- : --------------------------------------------- 43 | !fracrefa : real 44 | ! ka : real 45 | ! selfref : real 46 | ! forref : real 47 | ! 48 | ! absa : real 49 | !----------------------------------------------------------------- 50 | 51 | integer(kind=im), parameter :: ng12 = 8 52 | 53 | real(kind=rb) :: fracrefa(ng12,9) 54 | real(kind=rb) :: ka(9,5,13,ng12) ,absa(585,ng12) 55 | real(kind=rb) :: selfref(10,ng12) 56 | real(kind=rb) :: forref(4,ng12) 57 | 58 | equivalence (ka(1,1,1,1),absa(1,1)) 59 | 60 | end module rrlw_kg12 61 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg14.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg14 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 14 10 | ! band 14: 2250-2380 cm-1 (low - co2; high - co2) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | !fracrefbo: real 21 | ! kao : real 22 | ! kbo : real 23 | ! selfrefo: real 24 | ! forrefo : real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no14 = 16 28 | 29 | real(kind=rb) , dimension(no14) :: fracrefao 30 | real(kind=rb) , dimension(no14) :: fracrefbo 31 | 32 | real(kind=rb) :: kao(5,13,no14) 33 | real(kind=rb) :: kbo(5,13:59,no14) 34 | real(kind=rb) :: selfrefo(10,no14) 35 | real(kind=rb) :: forrefo(4,no14) 36 | 37 | !----------------------------------------------------------------- 38 | ! rrtmg_lw COMBINED abs. coefficients for interval 14 39 | ! band 14: 2250-2380 cm-1 (low - co2; high - co2) 40 | ! 41 | ! Initial version: JJMorcrette, ECMWF, jul1998 42 | ! Revised: MJIacono, AER, jun2006 43 | ! Revised: MJIacono, AER, aug2008 44 | !----------------------------------------------------------------- 45 | ! 46 | ! name type purpose 47 | ! ---- : ---- : --------------------------------------------- 48 | !fracrefa : real 49 | !fracrefb : real 50 | ! ka : real 51 | ! kb : real 52 | ! selfref : real 53 | ! forref : real 54 | ! 55 | ! absa : real 56 | ! absb : real 57 | !----------------------------------------------------------------- 58 | 59 | integer(kind=im), parameter :: ng14 = 2 60 | 61 | real(kind=rb) , dimension(ng14) :: fracrefa 62 | real(kind=rb) , dimension(ng14) :: fracrefb 63 | 64 | real(kind=rb) :: ka(5,13,ng14) ,absa(65,ng14) 65 | real(kind=rb) :: kb(5,13:59,ng14),absb(235,ng14) 66 | real(kind=rb) :: selfref(10,ng14) 67 | real(kind=rb) :: forref(4,ng14) 68 | 69 | equivalence (ka(1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 70 | 71 | end module rrlw_kg14 72 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg15.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg15 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 15 10 | ! band 15: 2380-2600 cm-1 (low - n2o,co2; high - nothing) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | ! kao : real 21 | ! kao_mn2 : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !----------------------------------------------------------------- 25 | 26 | integer(kind=im), parameter :: no15 = 16 27 | 28 | real(kind=rb) :: fracrefao(no15,9) 29 | real(kind=rb) :: kao(9,5,13,no15) 30 | real(kind=rb) :: kao_mn2(9,19,no15) 31 | real(kind=rb) :: selfrefo(10,no15) 32 | real(kind=rb) :: forrefo(4,no15) 33 | 34 | 35 | !----------------------------------------------------------------- 36 | ! rrtmg_lw COMBINED abs. coefficients for interval 15 37 | ! band 15: 2380-2600 cm-1 (low - n2o,co2; high - nothing) 38 | ! 39 | ! Initial version: JJMorcrette, ECMWF, jul1998 40 | ! Revised: MJIacono, AER, jun2006 41 | ! Revised: MJIacono, AER, aug2008 42 | !----------------------------------------------------------------- 43 | ! 44 | ! name type purpose 45 | ! ---- : ---- : --------------------------------------------- 46 | !fracrefa : real 47 | ! ka : real 48 | ! ka_mn2 : real 49 | ! selfref : real 50 | ! forref : real 51 | ! 52 | ! absa : real 53 | !----------------------------------------------------------------- 54 | 55 | integer(kind=im), parameter :: ng15 = 2 56 | 57 | real(kind=rb) :: fracrefa(ng15,9) 58 | real(kind=rb) :: ka(9,5,13,ng15) ,absa(585,ng15) 59 | real(kind=rb) :: ka_mn2(9,19,ng15) 60 | real(kind=rb) :: selfref(10,ng15) 61 | real(kind=rb) :: forref(4,ng15) 62 | 63 | equivalence (ka(1,1,1,1),absa(1,1)) 64 | 65 | end module rrlw_kg15 66 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_kg16.f90: -------------------------------------------------------------------------------- 1 | module rrlw_kg16 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !----------------------------------------------------------------- 9 | ! rrtmg_lw ORIGINAL abs. coefficients for interval 16 10 | ! band 16: 2600-3000 cm-1 (low - h2o,ch4; high - nothing) 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !----------------------------------------------------------------- 16 | ! 17 | ! name type purpose 18 | ! ---- : ---- : --------------------------------------------- 19 | !fracrefao: real 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !----------------------------------------------------------------- 25 | 26 | integer(kind=im), parameter :: no16 = 16 27 | 28 | real(kind=rb) , dimension(no16) :: fracrefbo 29 | 30 | real(kind=rb) :: fracrefao(no16,9) 31 | real(kind=rb) :: kao(9,5,13,no16) 32 | real(kind=rb) :: kbo(5,13:59,no16) 33 | real(kind=rb) :: selfrefo(10,no16) 34 | real(kind=rb) :: forrefo(4,no16) 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_lw COMBINED abs. coefficients for interval 16 38 | ! band 16: 2600-3000 cm-1 (low - h2o,ch4; high - nothing) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, jul1998 41 | ! Revised: MJIacono, AER, jun2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | !fracrefa : real 48 | ! ka : real 49 | ! kb : real 50 | ! selfref : real 51 | ! forref : real 52 | ! 53 | ! absa : real 54 | ! absb : real 55 | !----------------------------------------------------------------- 56 | 57 | integer(kind=im), parameter :: ng16 = 2 58 | 59 | real(kind=rb) , dimension(ng16) :: fracrefb 60 | 61 | real(kind=rb) :: fracrefa(ng16,9) 62 | real(kind=rb) :: ka(9,5,13,ng16) ,absa(585,ng16) 63 | real(kind=rb) :: kb(5,13:59,ng16), absb(235,ng16) 64 | real(kind=rb) :: selfref(10,ng16) 65 | real(kind=rb) :: forref(4,ng16) 66 | 67 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 68 | 69 | end module rrlw_kg16 70 | 71 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_ncpar.f90: -------------------------------------------------------------------------------- 1 | module rrlw_ncpar 2 | use parkind ,only : im => kind_im, rb => kind_rb 3 | 4 | implicit none 5 | save 6 | 7 | real(kind=rb), parameter :: cpdair = 1003.5 ! Specific heat capacity of dry air 8 | ! at constant pressure at 273 K 9 | ! (J kg-1 K-1) 10 | 11 | 12 | integer(kind=im), parameter :: maxAbsorberNameLength = 5, & 13 | Absorber = 12 14 | character(len = maxAbsorberNameLength), dimension(Absorber), parameter :: & 15 | AbsorberNames = (/ & 16 | 'N2 ', & 17 | 'CCL4 ', & 18 | 'CFC11', & 19 | 'CFC12', & 20 | 'CFC22', & 21 | 'H2O ', & 22 | 'CO2 ', & 23 | 'O3 ', & 24 | 'N2O ', & 25 | 'CO ', & 26 | 'CH4 ', & 27 | 'O2 ' /) 28 | 29 | integer(kind=im), dimension(40) :: status 30 | integer(kind=im) :: i 31 | integer(kind=im), parameter :: keylower = 9, & 32 | keyupper = 5, & 33 | Tdiff = 5, & 34 | ps = 59, & 35 | plower = 13, & 36 | pupper = 47, & 37 | Tself = 10, & 38 | Tforeign = 4, & 39 | pforeign = 4, & 40 | T = 19, & 41 | Tplanck = 181, & 42 | band = 16, & 43 | GPoint = 16, & 44 | GPointSet = 2 45 | 46 | contains 47 | 48 | subroutine getAbsorberIndex(AbsorberName,AbsorberIndex) 49 | character(len = *), intent(in) :: AbsorberName 50 | integer(kind=im), intent(out) :: AbsorberIndex 51 | 52 | integer(kind=im) :: m 53 | 54 | AbsorberIndex = -1 55 | do m = 1, Absorber 56 | if (trim(AbsorberNames(m)) == trim(AbsorberName)) then 57 | AbsorberIndex = m 58 | end if 59 | end do 60 | 61 | if (AbsorberIndex == -1) then 62 | print*, "Absorber name index lookup failed." 63 | end if 64 | end subroutine getAbsorberIndex 65 | 66 | end module rrlw_ncpar 67 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_ref.f90: -------------------------------------------------------------------------------- 1 | module rrlw_ref 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_lw reference atmosphere 10 | ! Based on standard mid-latitude summer profile 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !------------------------------------------------------------------ 16 | 17 | ! name type purpose 18 | ! ----- : ---- : ---------------------------------------------- 19 | ! pref : real : Reference pressure levels 20 | ! preflog: real : Reference pressure levels, ln(pref) 21 | ! tref : real : Reference temperature levels for MLS profile 22 | ! chi_mls: real : 23 | !------------------------------------------------------------------ 24 | 25 | real(kind=rb) , dimension(59) :: pref 26 | real(kind=rb) , dimension(59) :: preflog 27 | real(kind=rb) , dimension(59) :: tref 28 | real(kind=rb) :: chi_mls(7,59) 29 | 30 | end module rrlw_ref 31 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_tbl.f90: -------------------------------------------------------------------------------- 1 | module rrlw_tbl 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_lw exponential lookup table arrays 10 | 11 | ! Initial version: JJMorcrette, ECMWF, jul1998 12 | ! Revised: MJIacono, AER, Jun 2006 13 | ! Revised: MJIacono, AER, Aug 2007 14 | ! Revised: MJIacono, AER, Aug 2008 15 | !------------------------------------------------------------------ 16 | 17 | ! name type purpose 18 | ! ----- : ---- : ---------------------------------------------- 19 | ! ntbl : integer: Lookup table dimension 20 | ! tblint : real : Lookup table conversion factor 21 | ! tau_tbl: real : Clear-sky optical depth (used in cloudy radiative 22 | ! transfer) 23 | ! exp_tbl: real : Transmittance lookup table 24 | ! tfn_tbl: real : Tau transition function; i.e. the transition of 25 | ! the Planck function from that for the mean layer 26 | ! temperature to that for the layer boundary 27 | ! temperature as a function of optical depth. 28 | ! The "linear in tau" method is used to make 29 | ! the table. 30 | ! pade : real : Pade constant 31 | ! bpade : real : Inverse of Pade constant 32 | !------------------------------------------------------------------ 33 | 34 | integer(kind=im), parameter :: ntbl = 10000 35 | 36 | real(kind=rb), parameter :: tblint = 10000.0_rb 37 | 38 | real(kind=rb) , dimension(0:ntbl) :: tau_tbl 39 | real(kind=rb) , dimension(0:ntbl) :: exp_tbl 40 | real(kind=rb) , dimension(0:ntbl) :: tfn_tbl 41 | 42 | real(kind=rb), parameter :: pade = 0.278_rb 43 | real(kind=rb) :: bpade 44 | 45 | end module rrlw_tbl 46 | 47 | -------------------------------------------------------------------------------- /RRTMG/lw/modules/rrlw_vsn.f90: -------------------------------------------------------------------------------- 1 | module rrlw_vsn 2 | 3 | implicit none 4 | save 5 | 6 | !------------------------------------------------------------------ 7 | ! rrtmg_lw version information 8 | 9 | ! Initial version: JJMorcrette, ECMWF, jul1998 10 | ! Revised: MJIacono, AER, jun2006 11 | ! Revised: MJIacono, AER, aug2008 12 | !------------------------------------------------------------------ 13 | 14 | ! name type purpose 15 | ! ----- : ---- : ---------------------------------------------- 16 | !hnamrtm :character: 17 | !hnamini :character: 18 | !hnamcld :character: 19 | !hnamclc :character: 20 | !hnamrtr :character: 21 | !hnamrtx :character: 22 | !hnamrtc :character: 23 | !hnamset :character: 24 | !hnamtau :character: 25 | !hnamatm :character: 26 | !hnamutl :character: 27 | !hnamext :character: 28 | !hnamkg :character: 29 | ! 30 | ! hvrrtm :character: 31 | ! hvrini :character: 32 | ! hvrcld :character: 33 | ! hvrclc :character: 34 | ! hvrrtr :character: 35 | ! hvrrtx :character: 36 | ! hvrrtc :character: 37 | ! hvrset :character: 38 | ! hvrtau :character: 39 | ! hvratm :character: 40 | ! hvrutl :character: 41 | ! hvrext :character: 42 | ! hvrkg :character: 43 | !------------------------------------------------------------------ 44 | 45 | character*18 hvrrtm,hvrini,hvrcld,hvrclc,hvrrtr,hvrrtx, & 46 | hvrrtc,hvrset,hvrtau,hvratm,hvrutl,hvrext 47 | character*20 hnamrtm,hnamini,hnamcld,hnamclc,hnamrtr,hnamrtx, & 48 | hnamrtc,hnamset,hnamtau,hnamatm,hnamutl,hnamext 49 | 50 | character*18 hvrkg 51 | character*20 hnamkg 52 | 53 | end module rrlw_vsn 54 | 55 | -------------------------------------------------------------------------------- /RRTMG/sw/data/rrtmg_sw.nc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/RRTMG/sw/data/rrtmg_sw.nc -------------------------------------------------------------------------------- /RRTMG/sw/modules/parkind.f90: -------------------------------------------------------------------------------- 1 | module parkind 2 | 3 | implicit none 4 | save 5 | 6 | !------------------------------------------------------------------ 7 | ! rrtmg kinds 8 | ! Define integer and real kinds for various types. 9 | ! 10 | ! Initial version: MJIacono, AER, jun2006 11 | ! Revised: MJIacono, AER, aug2008 12 | !------------------------------------------------------------------ 13 | 14 | ! 15 | ! integer kinds 16 | ! ------------- 17 | ! 18 | integer, parameter :: kind_ib = selected_int_kind(13) ! 8 byte integer 19 | integer, parameter :: kind_im = selected_int_kind(6) ! 4 byte integer 20 | integer, parameter :: kind_in = kind(1) ! native integer 21 | 22 | ! 23 | ! real kinds 24 | ! ---------- 25 | ! 26 | integer, parameter :: kind_rb = selected_real_kind(12) ! 8 byte real 27 | integer, parameter :: kind_rm = selected_real_kind(6) ! 4 byte real 28 | integer, parameter :: kind_rn = kind(1.0) ! native real 29 | 30 | end module parkind 31 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_aer.f90: -------------------------------------------------------------------------------- 1 | module rrsw_aer 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : nbndsw, naerec 5 | 6 | implicit none 7 | save 8 | 9 | !------------------------------------------------------------------ 10 | ! rrtmg_sw aerosol optical properties 11 | ! 12 | ! Data derived from six ECMWF aerosol types and defined for 13 | ! the rrtmg_sw spectral intervals 14 | ! 15 | ! Initial: J.-J. Morcrette, ECMWF, mar2003 16 | ! Revised: MJIacono, AER, jul2006 17 | ! Revised: MJIacono, AER, aug2008 18 | !------------------------------------------------------------------ 19 | ! 20 | !-- The six ECMWF aerosol types are respectively: 21 | ! 22 | ! 1/ continental average 2/ maritime 23 | ! 3/ desert 4/ urban 24 | ! 5/ volcanic active 6/ stratospheric background 25 | ! 26 | ! computed from Hess and Koepke (con, mar, des, urb) 27 | ! from Bonnel et al. (vol, str) 28 | ! 29 | ! rrtmg_sw 14 spectral intervals (microns): 30 | ! 3.846 - 3.077 31 | ! 3.077 - 2.500 32 | ! 2.500 - 2.150 33 | ! 2.150 - 1.942 34 | ! 1.942 - 1.626 35 | ! 1.626 - 1.299 36 | ! 1.299 - 1.242 37 | ! 1.242 - 0.7782 38 | ! 0.7782- 0.6250 39 | ! 0.6250- 0.4415 40 | ! 0.4415- 0.3448 41 | ! 0.3448- 0.2632 42 | ! 0.2632- 0.2000 43 | ! 12.195 - 3.846 44 | ! 45 | !------------------------------------------------------------------ 46 | ! 47 | ! name type purpose 48 | ! ----- : ---- : ---------------------------------------------- 49 | ! rsrtaua : real : ratio of average optical thickness in 50 | ! spectral band to that at 0.55 micron 51 | ! rsrpiza : real : average single scattering albedo (unitless) 52 | ! rsrasya : real : average asymmetry parameter (unitless) 53 | !------------------------------------------------------------------ 54 | 55 | real(kind=rb) :: rsrtaua(nbndsw,naerec) 56 | real(kind=rb) :: rsrpiza(nbndsw,naerec) 57 | real(kind=rb) :: rsrasya(nbndsw,naerec) 58 | 59 | end module rrsw_aer 60 | 61 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_cld.f90: -------------------------------------------------------------------------------- 1 | module rrsw_cld 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_sw cloud property coefficients 10 | ! 11 | ! Initial: J.-J. Morcrette, ECMWF, oct1999 12 | ! Revised: J. Delamere/MJIacono, AER, aug2005 13 | ! Revised: MJIacono, AER, nov2005 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | ! Revised: MJIacono, AER, dec2013: Updated xxxliq1 look-up tables 17 | !------------------------------------------------------------------ 18 | ! 19 | ! name type purpose 20 | ! ----- : ---- : ---------------------------------------------- 21 | ! xxxliq1 : real : optical properties (extinction coefficient, single 22 | ! scattering albedo, assymetry factor) based on 23 | ! Hu & Stamnes, j. clim., 6, 728-742, 1993. Derived 24 | ! from Mie scattering calculations at higher spectral 25 | ! resolution than Hu & Stamnes. Used in CIRC (Continuous 26 | ! Intercomparison of Radiation Codes) project. 27 | ! xxxice2 : real : optical properties (extinction coefficient, single 28 | ! scattering albedo, assymetry factor) from streamer v3.0, 29 | ! Key, streamer user's guide, cooperative institude 30 | ! for meteorological studies, 95 pp., 2001. 31 | ! xxxice3 : real : optical properties (extinction coefficient, single 32 | ! scattering albedo, assymetry factor) from 33 | ! Fu, j. clim., 9, 1996. 34 | ! xbari : real : optical property coefficients for five spectral 35 | ! intervals (2857-4000, 4000-5263, 5263-7692, 7692-14285, 36 | ! and 14285-40000 wavenumbers) following 37 | ! Ebert and Curry, jgr, 97, 3831-3836, 1992. 38 | !------------------------------------------------------------------ 39 | 40 | real(kind=rb) :: extliq1(58,16:29), ssaliq1(58,16:29), asyliq1(58,16:29) 41 | real(kind=rb) :: extice2(43,16:29), ssaice2(43,16:29), asyice2(43,16:29) 42 | real(kind=rb) :: extice3(46,16:29), ssaice3(46,16:29), asyice3(46,16:29) 43 | real(kind=rb) :: fdlice3(46,16:29) 44 | real(kind=rb) :: abari(5),bbari(5),cbari(5),dbari(5),ebari(5),fbari(5) 45 | 46 | end module rrsw_cld 47 | 48 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_con.f90: -------------------------------------------------------------------------------- 1 | module rrsw_con 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_sw constants 10 | 11 | ! Initial version: MJIacono, AER, jun2006 12 | ! Revised: MJIacono, AER, aug2008 13 | !------------------------------------------------------------------ 14 | 15 | ! name type purpose 16 | ! ----- : ---- : ---------------------------------------------- 17 | ! fluxfac: real : radiance to flux conversion factor 18 | ! heatfac: real : flux to heating rate conversion factor 19 | !oneminus: real : 1.-1.e-6 20 | ! pi : real : pi 21 | ! grav : real : acceleration of gravity 22 | ! planck : real : planck constant 23 | ! boltz : real : boltzmann constant 24 | ! clight : real : speed of light 25 | ! avogad : real : avogadro constant 26 | ! alosmt : real : loschmidt constant 27 | ! gascon : real : molar gas constant 28 | ! radcn1 : real : first radiation constant 29 | ! radcn2 : real : second radiation constant 30 | ! sbcnst : real : stefan-boltzmann constant 31 | ! secdy : real : seconds per day 32 | !------------------------------------------------------------------ 33 | 34 | real(kind=rb) :: fluxfac, heatfac 35 | real(kind=rb) :: oneminus, pi, grav 36 | real(kind=rb) :: planck, boltz, clight 37 | real(kind=rb) :: avogad, alosmt, gascon 38 | real(kind=rb) :: radcn1, radcn2 39 | real(kind=rb) :: sbcnst, secdy 40 | 41 | end module rrsw_con 42 | 43 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg16.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg16 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng16 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 16 11 | ! band 16: 2600-3250 cm-1 (low - h2o,ch4; high - ch4) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no16 = 16 28 | 29 | real(kind=rb) :: kao(9,5,13,no16) 30 | real(kind=rb) :: kbo(5,13:59,no16) 31 | real(kind=rb) :: selfrefo(10,no16), forrefo(3,no16) 32 | real(kind=rb) :: sfluxrefo(no16) 33 | 34 | real(kind=rb) :: rayl 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_sw COMBINED abs. coefficients for interval 16 38 | ! band 16: 2600-3250 cm-1 (low - h2o,ch4; high - ch4) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, oct1999 41 | ! Revised: MJIacono, AER, jul2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! sfluxref: real 54 | !----------------------------------------------------------------- 55 | 56 | real(kind=rb) :: ka(9,5,13,ng16) , absa(585,ng16) 57 | real(kind=rb) :: kb(5,13:59,ng16), absb(235,ng16) 58 | real(kind=rb) :: selfref(10,ng16), forref(3,ng16) 59 | real(kind=rb) :: sfluxref(ng16) 60 | 61 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 62 | 63 | end module rrsw_kg16 64 | 65 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg17.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg17 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng17 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 17 11 | ! band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o,co2) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no17 = 16 28 | 29 | real(kind=rb) :: kao(9,5,13,no17) 30 | real(kind=rb) :: kbo(5,5,13:59,no17) 31 | real(kind=rb) :: selfrefo(10,no17), forrefo(4,no17) 32 | real(kind=rb) :: sfluxrefo(no17,5) 33 | 34 | real(kind=rb) :: rayl 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_sw COMBINED abs. coefficients for interval 17 38 | ! band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o,co2) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, oct1999 41 | ! Revised: MJIacono, AER, jul2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! sfluxref: real 54 | !----------------------------------------------------------------- 55 | 56 | real(kind=rb) :: ka(9,5,13,ng17) , absa(585,ng17) 57 | real(kind=rb) :: kb(5,5,13:59,ng17), absb(1175,ng17) 58 | real(kind=rb) :: selfref(10,ng17), forref(4,ng17) 59 | real(kind=rb) :: sfluxref(ng17,5) 60 | 61 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,1,13,1),absb(1,1)) 62 | 63 | end module rrsw_kg17 64 | 65 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg18.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg18 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng18 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 18 11 | ! band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no18 = 16 28 | 29 | real(kind=rb) :: kao(9,5,13,no18) 30 | real(kind=rb) :: kbo(5,13:59,no18) 31 | real(kind=rb) :: selfrefo(10,no18), forrefo(3,no18) 32 | real(kind=rb) :: sfluxrefo(no18,9) 33 | 34 | real(kind=rb) :: rayl 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_sw COMBINED abs. coefficients for interval 18 38 | ! band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, oct1999 41 | ! Revised: MJIacono, AER, jul2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! sfluxref: real 54 | !----------------------------------------------------------------- 55 | 56 | real(kind=rb) :: ka(9,5,13,ng18), absa(585,ng18) 57 | real(kind=rb) :: kb(5,13:59,ng18), absb(235,ng18) 58 | real(kind=rb) :: selfref(10,ng18), forref(3,ng18) 59 | real(kind=rb) :: sfluxref(ng18,9) 60 | 61 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 62 | 63 | end module rrsw_kg18 64 | 65 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg19.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg19 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng19 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 19 11 | ! band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no19 = 16 28 | 29 | real(kind=rb) :: kao(9,5,13,no19) 30 | real(kind=rb) :: kbo(5,13:59,no19) 31 | real(kind=rb) :: selfrefo(10,no19), forrefo(3,no19) 32 | real(kind=rb) :: sfluxrefo(no19,9) 33 | 34 | real(kind=rb) :: rayl 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_sw COMBINED abs. coefficients for interval 19 38 | ! band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, oct1999 41 | ! Revised: MJIacono, AER, jul2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! sfluxref: real 54 | !----------------------------------------------------------------- 55 | 56 | real(kind=rb) :: ka(9,5,13,ng19), absa(585,ng19) 57 | real(kind=rb) :: kb(5,13:59,ng19), absb(235,ng19) 58 | real(kind=rb) :: selfref(10,ng19), forref(3,ng19) 59 | real(kind=rb) :: sfluxref(ng19,9) 60 | 61 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 62 | 63 | end module rrsw_kg19 64 | 65 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg20.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg20 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng20 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 20 11 | ! band 20: 5150-6150 cm-1 (low - h2o; high - h2o) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | ! absch4o : real 26 | !----------------------------------------------------------------- 27 | 28 | integer(kind=im), parameter :: no20 = 16 29 | 30 | real(kind=rb) :: kao(5,13,no20) 31 | real(kind=rb) :: kbo(5,13:59,no20) 32 | real(kind=rb) :: selfrefo(10,no20), forrefo(4,no20) 33 | real(kind=rb) :: sfluxrefo(no20) 34 | real(kind=rb) :: absch4o(no20) 35 | 36 | real(kind=rb) :: rayl 37 | 38 | !----------------------------------------------------------------- 39 | ! rrtmg_sw COMBINED abs. coefficients for interval 20 40 | ! band 20: 5150-6150 cm-1 (low - h2o; high - h2o) 41 | ! 42 | ! Initial version: JJMorcrette, ECMWF, oct1999 43 | ! Revised: MJIacono, AER, jul2006 44 | ! Revised: MJIacono, AER, aug2008 45 | !----------------------------------------------------------------- 46 | ! 47 | ! name type purpose 48 | ! ---- : ---- : --------------------------------------------- 49 | ! ka : real 50 | ! kb : real 51 | ! absa : real 52 | ! absb : real 53 | ! selfref : real 54 | ! forref : real 55 | ! sfluxref: real 56 | ! absch4 : real 57 | !----------------------------------------------------------------- 58 | 59 | real(kind=rb) :: ka(5,13,ng20), absa(65,ng20) 60 | real(kind=rb) :: kb(5,13:59,ng20), absb(235,ng20) 61 | real(kind=rb) :: selfref(10,ng20), forref(4,ng20) 62 | real(kind=rb) :: sfluxref(ng20) 63 | real(kind=rb) :: absch4(ng20) 64 | 65 | equivalence (ka(1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 66 | 67 | end module rrsw_kg20 68 | 69 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg21.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg21 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng21 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 21 11 | ! band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o,co2) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no21 = 16 28 | 29 | real(kind=rb) :: kao(9,5,13,no21) 30 | real(kind=rb) :: kbo(5,5,13:59,no21) 31 | real(kind=rb) :: selfrefo(10,no21), forrefo(4,no21) 32 | real(kind=rb) :: sfluxrefo(no21,9) 33 | 34 | real(kind=rb) :: rayl 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_sw COMBINED abs. coefficients for interval 21 38 | ! band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o,co2) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, oct1999 41 | ! Revised: MJIacono, AER, jul2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! sfluxref: real 54 | !----------------------------------------------------------------- 55 | 56 | real(kind=rb) :: ka(9,5,13,ng21), absa(585,ng21) 57 | real(kind=rb) :: kb(5,5,13:59,ng21), absb(1175,ng21) 58 | real(kind=rb) :: selfref(10,ng21), forref(4,ng21) 59 | real(kind=rb) :: sfluxref(ng21,9) 60 | 61 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,1,13,1),absb(1,1)) 62 | 63 | end module rrsw_kg21 64 | 65 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg22.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg22 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng22 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 22 11 | ! band 22: 7700-8050 cm-1 (low - h2o,o2; high - o2) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no22 = 16 28 | 29 | real(kind=rb) :: kao(9,5,13,no22) 30 | real(kind=rb) :: kbo(5,13:59,no22) 31 | real(kind=rb) :: selfrefo(10,no22), forrefo(3,no22) 32 | real(kind=rb) :: sfluxrefo(no22,9) 33 | 34 | real(kind=rb) :: rayl 35 | 36 | !----------------------------------------------------------------- 37 | ! rrtmg_sw COMBINED abs. coefficients for interval 22 38 | ! band 22: 7700-8050 cm-1 (low - h2o,o2; high - o2) 39 | ! 40 | ! Initial version: JJMorcrette, ECMWF, oct1999 41 | ! Revised: MJIacono, AER, jul2006 42 | ! Revised: MJIacono, AER, aug2008 43 | !----------------------------------------------------------------- 44 | ! 45 | ! name type purpose 46 | ! ---- : ---- : --------------------------------------------- 47 | ! ka : real 48 | ! kb : real 49 | ! absa : real 50 | ! absb : real 51 | ! selfref : real 52 | ! forref : real 53 | ! sfluxref: real 54 | !----------------------------------------------------------------- 55 | 56 | real(kind=rb) :: ka(9,5,13,ng22), absa(585,ng22) 57 | real(kind=rb) :: kb(5,13:59,ng22), absb(235,ng22) 58 | real(kind=rb) :: selfref(10,ng22), forref(3,ng22) 59 | real(kind=rb) :: sfluxref(ng22,9) 60 | 61 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 62 | 63 | end module rrsw_kg22 64 | 65 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg23.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg23 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng23 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 23 11 | ! band 23: 8050-12850 cm-1 (low - h2o; high - nothing) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no23 = 16 28 | 29 | real(kind=rb) :: kao(5,13,no23) 30 | real(kind=rb) :: selfrefo(10,no23), forrefo(3,no23) 31 | real(kind=rb) :: sfluxrefo(no23) 32 | real(kind=rb) :: raylo(no23) 33 | 34 | !----------------------------------------------------------------- 35 | ! rrtmg_sw COMBINED abs. coefficients for interval 23 36 | ! band 23: 8050-12850 cm-1 (low - h2o; high - nothing) 37 | ! 38 | ! Initial version: JJMorcrette, ECMWF, oct1999 39 | ! Revised: MJIacono, AER, jul2006 40 | ! Revised: MJIacono, AER, aug2008 41 | !----------------------------------------------------------------- 42 | ! 43 | ! name type purpose 44 | ! ---- : ---- : --------------------------------------------- 45 | ! ka : real 46 | ! kb : real 47 | ! absa : real 48 | ! absb : real 49 | ! selfref : real 50 | ! forref : real 51 | ! sfluxref: real 52 | !----------------------------------------------------------------- 53 | 54 | real(kind=rb) :: ka(5,13,ng23), absa(65,ng23) 55 | real(kind=rb) :: selfref(10,ng23), forref(3,ng23) 56 | real(kind=rb) :: sfluxref(ng23), rayl(ng23) 57 | 58 | equivalence (ka(1,1,1),absa(1,1)) 59 | 60 | end module rrsw_kg23 61 | 62 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg25.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg25 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng25 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 25 11 | ! band 25: 16000-22650 cm-1 (low - h2o; high - nothing) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | !sfluxrefo: real 22 | ! abso3ao : real 23 | ! abso3bo : real 24 | ! raylo : real 25 | !----------------------------------------------------------------- 26 | 27 | integer(kind=im), parameter :: no25 = 16 28 | 29 | real(kind=rb) :: kao(5,13,no25) 30 | real(kind=rb) :: sfluxrefo(no25) 31 | real(kind=rb) :: abso3ao(no25), abso3bo(no25) 32 | real(kind=rb) :: raylo(no25) 33 | 34 | !----------------------------------------------------------------- 35 | ! rrtmg_sw COMBINED abs. coefficients for interval 25 36 | ! band 25: 16000-22650 cm-1 (low - h2o; high - nothing) 37 | ! 38 | ! Initial version: JJMorcrette, ECMWF, oct1999 39 | ! Revised: MJIacono, AER, jul2006 40 | ! Revised: MJIacono, AER, aug2008 41 | !----------------------------------------------------------------- 42 | ! 43 | ! name type purpose 44 | ! ---- : ---- : --------------------------------------------- 45 | ! ka : real 46 | ! absa : real 47 | ! sfluxref: real 48 | ! abso3a : real 49 | ! abso3b : real 50 | ! rayl : real 51 | !----------------------------------------------------------------- 52 | 53 | real(kind=rb) :: ka(5,13,ng25), absa(65,ng25) 54 | real(kind=rb) :: sfluxref(ng25) 55 | real(kind=rb) :: abso3a(ng25), abso3b(ng25) 56 | real(kind=rb) :: rayl(ng25) 57 | 58 | equivalence (ka(1,1,1),absa(1,1)) 59 | 60 | end module rrsw_kg25 61 | 62 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg26.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg26 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng26 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 26 11 | ! band 26: 22650-29000 cm-1 (low - nothing; high - nothing) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | !sfluxrefo: real 21 | ! raylo : real 22 | !----------------------------------------------------------------- 23 | 24 | integer(kind=im), parameter :: no26 = 16 25 | 26 | real(kind=rb) :: sfluxrefo(no26) 27 | real(kind=rb) :: raylo(no26) 28 | 29 | !----------------------------------------------------------------- 30 | ! rrtmg_sw COMBINED abs. coefficients for interval 26 31 | ! band 26: 22650-29000 cm-1 (low - nothing; high - nothing) 32 | ! 33 | ! Initial version: JJMorcrette, ECMWF, oct1999 34 | ! Revised: MJIacono, AER, jul2006 35 | ! Revised: MJIacono, AER, aug2008 36 | !----------------------------------------------------------------- 37 | ! 38 | ! name type purpose 39 | ! ---- : ---- : --------------------------------------------- 40 | ! sfluxref: real 41 | ! rayl : real 42 | !----------------------------------------------------------------- 43 | 44 | real(kind=rb) :: sfluxref(ng26) 45 | real(kind=rb) :: rayl(ng26) 46 | 47 | end module rrsw_kg26 48 | 49 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg27.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg27 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng27 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 27 11 | ! band 27: 29000-38000 cm-1 (low - o3; high - o3) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | !sfluxrefo: real 23 | ! raylo : real 24 | !----------------------------------------------------------------- 25 | 26 | integer(kind=im), parameter :: no27 = 16 27 | 28 | real(kind=rb) :: kao(5,13,no27) 29 | real(kind=rb) :: kbo(5,13:59,no27) 30 | real(kind=rb) :: sfluxrefo(no27) 31 | real(kind=rb) :: raylo(no27) 32 | 33 | !----------------------------------------------------------------- 34 | ! rrtmg_sw COMBINED abs. coefficients for interval 27 35 | ! band 27: 29000-38000 cm-1 (low - o3; high - o3) 36 | ! 37 | ! Initial version: JJMorcrette, ECMWF, oct1999 38 | ! Revised: MJIacono, AER, jul2006 39 | ! Revised: MJIacono, AER, aug2008 40 | !----------------------------------------------------------------- 41 | ! 42 | ! name type purpose 43 | ! ---- : ---- : --------------------------------------------- 44 | ! ka : real 45 | ! kb : real 46 | ! absa : real 47 | ! absb : real 48 | ! sfluxref: real 49 | ! rayl : real 50 | !----------------------------------------------------------------- 51 | 52 | real(kind=rb) :: ka(5,13,ng27), absa(65,ng27) 53 | real(kind=rb) :: kb(5,13:59,ng27), absb(235,ng27) 54 | real(kind=rb) :: sfluxref(ng27) 55 | real(kind=rb) :: rayl(ng27) 56 | 57 | equivalence (ka(1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 58 | 59 | end module rrsw_kg27 60 | 61 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg28.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg28 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng28 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 28 11 | ! band 28: 38000-50000 cm-1 (low - o3, o2; high - o3, o2) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | !sfluxrefo: real 23 | !----------------------------------------------------------------- 24 | 25 | integer(kind=im), parameter :: no28 = 16 26 | 27 | real(kind=rb) :: kao(9,5,13,no28) 28 | real(kind=rb) :: kbo(5,5,13:59,no28) 29 | real(kind=rb) :: sfluxrefo(no28,5) 30 | 31 | real(kind=rb) :: rayl 32 | 33 | !----------------------------------------------------------------- 34 | ! rrtmg_sw COMBINED abs. coefficients for interval 28 35 | ! band 28: 38000-50000 cm-1 (low - o3, o2; high - o3, o2) 36 | ! 37 | ! Initial version: JJMorcrette, ECMWF, oct1999 38 | ! Revised: MJIacono, AER, jul2006 39 | ! Revised: MJIacono, AER, aug2008 40 | !----------------------------------------------------------------- 41 | ! 42 | ! name type purpose 43 | ! ---- : ---- : --------------------------------------------- 44 | ! ka : real 45 | ! kb : real 46 | ! sfluxref: real 47 | !----------------------------------------------------------------- 48 | 49 | real(kind=rb) :: ka(9,5,13,ng28), absa(585,ng28) 50 | real(kind=rb) :: kb(5,5,13:59,ng28), absb(1175,ng28) 51 | real(kind=rb) :: sfluxref(ng28,5) 52 | 53 | equivalence (ka(1,1,1,1),absa(1,1)), (kb(1,1,13,1),absb(1,1)) 54 | 55 | end module rrsw_kg28 56 | 57 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_kg29.f90: -------------------------------------------------------------------------------- 1 | module rrsw_kg29 2 | 3 | use parkind ,only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : ng29 5 | 6 | implicit none 7 | save 8 | 9 | !----------------------------------------------------------------- 10 | ! rrtmg_sw ORIGINAL abs. coefficients for interval 29 11 | ! band 29: 820-2600 cm-1 (low - h2o; high - co2) 12 | ! 13 | ! Initial version: JJMorcrette, ECMWF, oct1999 14 | ! Revised: MJIacono, AER, jul2006 15 | ! Revised: MJIacono, AER, aug2008 16 | !----------------------------------------------------------------- 17 | ! 18 | ! name type purpose 19 | ! ---- : ---- : --------------------------------------------- 20 | ! kao : real 21 | ! kbo : real 22 | ! selfrefo: real 23 | ! forrefo : real 24 | !sfluxrefo: real 25 | ! absh2oo : real 26 | ! absco2o : real 27 | !----------------------------------------------------------------- 28 | 29 | integer(kind=im), parameter :: no29 = 16 30 | 31 | real(kind=rb) :: kao(5,13,no29) 32 | real(kind=rb) :: kbo(5,13:59,no29) 33 | real(kind=rb) :: selfrefo(10,no29), forrefo(4,no29) 34 | real(kind=rb) :: sfluxrefo(no29) 35 | real(kind=rb) :: absh2oo(no29), absco2o(no29) 36 | 37 | real(kind=rb) :: rayl 38 | 39 | !----------------------------------------------------------------- 40 | ! rrtmg_sw COMBINED abs. coefficients for interval 29 41 | ! band 29: 820-2600 cm-1 (low - h2o; high - co2) 42 | ! 43 | ! Initial version: JJMorcrette, ECMWF, oct1999 44 | ! Revised: MJIacono, AER, jul2006 45 | ! Revised: MJIacono, AER, aug2008 46 | !----------------------------------------------------------------- 47 | ! 48 | ! name type purpose 49 | ! ---- : ---- : --------------------------------------------- 50 | ! ka : real 51 | ! kb : real 52 | ! selfref : real 53 | ! forref : real 54 | ! sfluxref: real 55 | ! absh2o : real 56 | ! absco2 : real 57 | !----------------------------------------------------------------- 58 | 59 | real(kind=rb) :: ka(5,13,ng29), absa(65,ng29) 60 | real(kind=rb) :: kb(5,13:59,ng29), absb(235,ng29) 61 | real(kind=rb) :: selfref(10,ng29), forref(4,ng29) 62 | real(kind=rb) :: sfluxref(ng29) 63 | real(kind=rb) :: absh2o(ng29), absco2(ng29) 64 | 65 | equivalence (ka(1,1,1),absa(1,1)), (kb(1,13,1),absb(1,1)) 66 | 67 | end module rrsw_kg29 68 | 69 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_ref.f90: -------------------------------------------------------------------------------- 1 | module rrsw_ref 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_sw reference atmosphere 10 | ! Based on standard mid-latitude summer profile 11 | ! 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jun2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !------------------------------------------------------------------ 16 | 17 | ! name type purpose 18 | ! ----- : ---- : ---------------------------------------------- 19 | ! pref : real : Reference pressure levels 20 | ! preflog: real : Reference pressure levels, ln(pref) 21 | ! tref : real : Reference temperature levels for MLS profile 22 | !------------------------------------------------------------------ 23 | 24 | real(kind=rb) , dimension(59) :: pref 25 | real(kind=rb) , dimension(59) :: preflog 26 | real(kind=rb) , dimension(59) :: tref 27 | 28 | end module rrsw_ref 29 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_tbl.f90: -------------------------------------------------------------------------------- 1 | module rrsw_tbl 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | 5 | implicit none 6 | save 7 | 8 | !------------------------------------------------------------------ 9 | ! rrtmg_sw lookup table arrays 10 | 11 | ! Initial version: MJIacono, AER, may2007 12 | ! Revised: MJIacono, AER, aug2007 13 | ! Revised: MJIacono, AER, aug2008 14 | !------------------------------------------------------------------ 15 | 16 | ! name type purpose 17 | ! ----- : ---- : ---------------------------------------------- 18 | ! ntbl : integer: Lookup table dimension 19 | ! tblint : real : Lookup table conversion factor 20 | ! tau_tbl: real : Clear-sky optical depth 21 | ! exp_tbl: real : Exponential lookup table for transmittance 22 | ! od_lo : real : Value of tau below which expansion is used 23 | ! : in place of lookup table 24 | ! pade : real : Pade approximation constant 25 | ! bpade : real : Inverse of Pade constant 26 | !------------------------------------------------------------------ 27 | 28 | integer(kind=im), parameter :: ntbl = 10000 29 | 30 | real(kind=rb), parameter :: tblint = 10000.0_rb 31 | 32 | real(kind=rb), parameter :: od_lo = 0.06_rb 33 | 34 | real(kind=rb) :: tau_tbl 35 | real(kind=rb) , dimension(0:ntbl) :: exp_tbl 36 | 37 | real(kind=rb), parameter :: pade = 0.278_rb 38 | real(kind=rb) :: bpade 39 | 40 | end module rrsw_tbl 41 | 42 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_vsn.f90: -------------------------------------------------------------------------------- 1 | module rrsw_vsn 2 | 3 | implicit none 4 | save 5 | 6 | !------------------------------------------------------------------ 7 | ! rrtmg_sw version information 8 | 9 | ! Initial version: JJMorcrette, ECMWF, jul1998 10 | ! Revised: MJIacono, AER, jul2006 11 | ! Revised: MJIacono, AER, aug2008 12 | !------------------------------------------------------------------ 13 | 14 | ! name type purpose 15 | ! ----- : ---- : ---------------------------------------------- 16 | !hnamrtm :character: 17 | !hnamini :character: 18 | !hnamcld :character: 19 | !hnamclc :character: 20 | !hnamrft :character: 21 | !hnamspv :character: 22 | !hnamspc :character: 23 | !hnamset :character: 24 | !hnamtau :character: 25 | !hnamvqd :character: 26 | !hnamatm :character: 27 | !hnamutl :character: 28 | !hnamext :character: 29 | !hnamkg :character: 30 | ! 31 | ! hvrrtm :character: 32 | ! hvrini :character: 33 | ! hvrcld :character: 34 | ! hvrclc :character: 35 | ! hvrrft :character: 36 | ! hvrspv :character: 37 | ! hvrspc :character: 38 | ! hvrset :character: 39 | ! hvrtau :character: 40 | ! hvrvqd :character: 41 | ! hvratm :character: 42 | ! hvrutl :character: 43 | ! hvrext :character: 44 | ! hvrkg :character: 45 | !------------------------------------------------------------------ 46 | 47 | character*18 hvrrtm,hvrini,hvrcld,hvrclc,hvrrft,hvrspv, & 48 | hvrspc,hvrset,hvrtau,hvrvqd,hvratm,hvrutl,hvrext 49 | character*20 hnamrtm,hnamini,hnamcld,hnamclc,hnamrft,hnamspv, & 50 | hnamspc,hnamset,hnamtau,hnamvqd,hnamatm,hnamutl,hnamext 51 | 52 | character*18 hvrkg 53 | character*20 hnamkg 54 | 55 | end module rrsw_vsn 56 | 57 | -------------------------------------------------------------------------------- /RRTMG/sw/modules/rrsw_wvn.f90: -------------------------------------------------------------------------------- 1 | module rrsw_wvn 2 | 3 | use parkind, only : im => kind_im, rb => kind_rb 4 | use parrrsw, only : nbndsw, mg, ngptsw, jpb1, jpb2 5 | 6 | implicit none 7 | save 8 | 9 | !------------------------------------------------------------------ 10 | ! rrtmg_sw spectral information 11 | 12 | ! Initial version: JJMorcrette, ECMWF, jul1998 13 | ! Revised: MJIacono, AER, jul2006 14 | ! Revised: MJIacono, AER, aug2008 15 | !------------------------------------------------------------------ 16 | 17 | ! name type purpose 18 | ! ----- : ---- : ---------------------------------------------- 19 | ! ng : integer: Number of original g-intervals in each spectral band 20 | ! nspa : integer: 21 | ! nspb : integer: 22 | !wavenum1: real : Spectral band lower boundary in wavenumbers 23 | !wavenum2: real : Spectral band upper boundary in wavenumbers 24 | ! delwave: real : Spectral band width in wavenumbers 25 | ! 26 | ! ngc : integer: The number of new g-intervals in each band 27 | ! ngs : integer: The cumulative sum of new g-intervals for each band 28 | ! ngm : integer: The index of each new g-interval relative to the 29 | ! original 16 g-intervals in each band 30 | ! ngn : integer: The number of original g-intervals that are 31 | ! combined to make each new g-intervals in each band 32 | ! ngb : integer: The band index for each new g-interval 33 | ! wt : real : RRTM weights for the original 16 g-intervals 34 | ! rwgt : real : Weights for combining original 16 g-intervals 35 | ! (224 total) into reduced set of g-intervals 36 | ! (112 total) 37 | !------------------------------------------------------------------ 38 | 39 | integer(kind=im) :: ng(jpb1:jpb2) 40 | integer(kind=im) :: nspa(jpb1:jpb2) 41 | integer(kind=im) :: nspb(jpb1:jpb2) 42 | 43 | real(kind=rb) :: wavenum1(jpb1:jpb2) 44 | real(kind=rb) :: wavenum2(jpb1:jpb2) 45 | real(kind=rb) :: delwave(jpb1:jpb2) 46 | 47 | integer(kind=im) :: ngc(nbndsw) 48 | integer(kind=im) :: ngs(nbndsw) 49 | integer(kind=im) :: ngn(ngptsw) 50 | integer(kind=im) :: ngb(ngptsw) 51 | integer(kind=im) :: ngm(nbndsw*mg) 52 | 53 | real(kind=rb) :: wt(mg) 54 | real(kind=rb) :: rwgt(nbndsw*mg) 55 | 56 | end module rrsw_wvn 57 | -------------------------------------------------------------------------------- /ReferenceState.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport Restart 3 | from NetCDFIO cimport NetCDFIO_Stats 4 | cimport ParallelMPI 5 | cdef class ReferenceState: 6 | cdef: 7 | public double [:] p0 8 | public double [:] p0_half 9 | public double [:] alpha0 10 | public double [:] alpha0_half 11 | public double [:] rho0 12 | public double [:] rho0_half 13 | public double [:] thetali0 14 | public double [:] thetali0_half 15 | 16 | public double [:] p0_global 17 | public double [:] p0_half_global 18 | public double [:] alpha0_global 19 | public double [:] alpha0_half_global 20 | public double [:] rho0_global 21 | public double [:] rho0_half_global 22 | public double [:] thetali0_global 23 | public double [:] thetali0_half_global 24 | 25 | 26 | double sg 27 | 28 | cdef public: 29 | #These public values should be set in the case initialization routine 30 | double Tg #Temperature at ground level 31 | double Pg #Pressure at ground level 32 | double qtg #Surface total water mixing ratio 33 | double u0 #u velocity removed in Galilean transformation 34 | double v0 #v velocity removed in Galilean transformation 35 | 36 | cpdef restart(self, Grid.Grid Gr, Restart.Restart Re) 37 | cpdef init_from_restart(self, Grid.Grid Gr, Restart.Restart Re, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 38 | 39 | -------------------------------------------------------------------------------- /Restart.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI 2 | 3 | cdef class Restart: 4 | cdef: 5 | public dict restart_data 6 | str restart_path 7 | str input_path 8 | public str fields_path 9 | public bint is_restart_run 10 | public bint is_altered 11 | str uuid 12 | public double last_restart_time 13 | public double frequency 14 | bint delete_old 15 | list times_retained 16 | 17 | cpdef initialize(self) 18 | cpdef write(self, ParallelMPI.ParallelMPI Pa) 19 | cpdef read(self, ParallelMPI.ParallelMPI Pa) 20 | cpdef read_aux(self, ParallelMPI.ParallelMPI Pa) 21 | cpdef free_memory(self) 22 | cpdef cleanup(self, ParallelMPI.ParallelMPI Pa) 23 | -------------------------------------------------------------------------------- /ScalarAdvection.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport PrognosticVariables 3 | cimport ParallelMPI 4 | cimport ReferenceState 5 | cimport DiagnosticVariables 6 | cimport TimeStepping 7 | from NetCDFIO cimport NetCDFIO_Stats 8 | from Thermodynamics cimport LatentHeat 9 | 10 | cdef class ScalarAdvection: 11 | 12 | cdef: 13 | double [:] flux 14 | Py_ssize_t order 15 | Py_ssize_t order_sedimentation 16 | double (*L_fp)(double T, double Lambda) nogil 17 | double (*Lambda_fp)(double T) nogil 18 | 19 | cpdef initialize(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 20 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState Rs,PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, ParallelMPI.ParallelMPI Pa) 21 | cpdef stats_io(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) -------------------------------------------------------------------------------- /ScalarDiffusion.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport PrognosticVariables 4 | cimport DiagnosticVariables 5 | cimport ParallelMPI 6 | from NetCDFIO cimport NetCDFIO_Stats 7 | 8 | cdef class ScalarDiffusion: 9 | cdef: 10 | double [:] flux 11 | double (*L_fp)(double T, double Lambda) nogil 12 | double (*Lambda_fp)(double T) nogil 13 | bint qt_entropy_source 14 | 15 | cpdef initialize(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, 16 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 17 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState RS,PrognosticVariables.PrognosticVariables PV, 18 | DiagnosticVariables.DiagnosticVariables DV) 19 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS,PrognosticVariables.PrognosticVariables PV, 20 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) -------------------------------------------------------------------------------- /Simulation3d.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/Simulation3d.pxd -------------------------------------------------------------------------------- /SparseSolvers.pxd: -------------------------------------------------------------------------------- 1 | cdef class TDMA: 2 | 3 | cdef: 4 | double* scratch 5 | Py_ssize_t n 6 | void initialize(self, Py_ssize_t n) 7 | inline void solve(self, double* x, double* a, double* b, double* c) nogil 8 | void destroy(self) -------------------------------------------------------------------------------- /SparseSolvers.pyx: -------------------------------------------------------------------------------- 1 | #!python 2 | #cython: boundscheck=False 3 | #cython: wraparound=False 4 | #cython: initializedcheck=False 5 | #cython: cdivision=True 6 | 7 | import numpy as np 8 | cimport numpy as np 9 | from cpython.mem cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free 10 | import cython 11 | 12 | cdef class TDMA: 13 | 14 | def __init__(self): 15 | pass 16 | 17 | cdef void initialize(self, Py_ssize_t n): 18 | 19 | self.n = n 20 | self.scratch = PyMem_Malloc(self.n * sizeof(double)) 21 | 22 | return 23 | 24 | cdef inline void solve(self, double* x, double* a, double* b, double* c) nogil: 25 | 26 | cdef: 27 | Py_ssize_t i 28 | double m 29 | 30 | self.scratch[0] = c[0]/b[0] 31 | x[0] = x[0]/b[0] 32 | 33 | with nogil: 34 | for i in xrange(1,self.n): 35 | m = 1.0/(b[i] - a[i] * self.scratch[i-1]) 36 | self.scratch[i] = c[i] * m 37 | x[i] = (x[i] - a[i] * x[i-1])*m 38 | 39 | 40 | for i in xrange(self.n-2,-1,-1): 41 | x[i] = x[i] - self.scratch[i] * x[i+1] 42 | 43 | return 44 | 45 | cdef void destroy(self): 46 | PyMem_Free(self.scratch) 47 | return 48 | 49 | def test(self): 50 | n = 4 51 | cdef double [:] a = np.array([0, -1, -1, -1], dtype=np.double) 52 | cdef double [:] b = np.array([4, 4, 4, 4], dtype=np.double) 53 | cdef double [:] c = np.array([-1, -1, -1, 0], dtype=np.double) 54 | cdef double [:] d = np.array([5, 5, 10, 23], dtype=np.double) 55 | 56 | self.initialize(4) 57 | self.solve(&d[0], &a[0], &b[0], &c[0]) 58 | 59 | print(np.array(d)) 60 | 61 | return -------------------------------------------------------------------------------- /SurfaceBudget.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | 4 | cimport ParallelMPI 5 | cimport TimeStepping 6 | cimport Radiation 7 | cimport Surface 8 | from NetCDFIO cimport NetCDFIO_Stats 9 | 10 | 11 | cdef class SurfaceBudgetNone: 12 | 13 | cpdef initialize(self, Grid.Grid Gr, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 14 | cpdef update(self, Grid.Grid Gr, Radiation.RadiationBase Ra, Surface.SurfaceBase Sur, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa) 15 | cpdef stats_io(self, Surface.SurfaceBase Sur, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 16 | 17 | 18 | cdef class SurfaceBudget: 19 | cdef: 20 | double ocean_heat_flux 21 | double water_depth_initial 22 | double water_depth_final 23 | double water_depth_time 24 | double fixed_sst_time 25 | double water_depth 26 | 27 | cpdef initialize(self, Grid.Grid Gr, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 28 | cpdef update(self, Grid.Grid Gr, Radiation.RadiationBase Ra, Surface.SurfaceBase Sur, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa) 29 | cpdef stats_io(self, Surface.SurfaceBase Sur, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 30 | 31 | cdef class SurfaceBudgetNew: 32 | 33 | cpdef initialize(self, Grid.Grid Gr, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 34 | cpdef update(self, Grid.Grid Gr, Radiation.RadiationBase Ra, Surface.SurfaceBase Sur, TimeStepping.TimeStepping TS, ParallelMPI.ParallelMPI Pa) 35 | cpdef stats_io(self, Surface.SurfaceBase Sur, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 36 | -------------------------------------------------------------------------------- /Thermodynamics.pxd: -------------------------------------------------------------------------------- 1 | cimport Lookup 2 | cimport ParallelMPI 3 | cimport Grid 4 | cimport ReferenceState 5 | cimport PrognosticVariables 6 | cimport DiagnosticVariables 7 | from NetCDFIO cimport NetCDFIO_Fields, NetCDFIO_Stats 8 | 9 | 10 | cdef class LatentHeat: 11 | cdef: 12 | #In the functions pointed to by the function pointer L* must not require gil 13 | double (*L_fp)(double T, double Lambda) nogil 14 | double (*Lambda_fp)(double T) nogil 15 | 16 | cpdef L(self, double T, double Lambda) 17 | 18 | cpdef Lambda(self, double T) 19 | 20 | 21 | cdef class ClausiusClapeyron: 22 | cdef: 23 | Lookup.Lookup LT 24 | 25 | #def initialize(self,namelist,LatentHeat LH, ParallelMPI.ParallelMPI Par) 26 | cpdef finalize(self) 27 | 28 | 29 | -------------------------------------------------------------------------------- /ThermodynamicsArctic.pxd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/ThermodynamicsArctic.pxd -------------------------------------------------------------------------------- /ThermodynamicsArctic.pyx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CliMA/pycles/71c1752a1ef1b43bb90e5817de9126468b4eeba9/ThermodynamicsArctic.pyx -------------------------------------------------------------------------------- /ThermodynamicsDry.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport PrognosticVariables 4 | cimport DiagnosticVariables 5 | cimport ParallelMPI 6 | cimport Thermodynamics 7 | from NetCDFIO cimport NetCDFIO_Fields, NetCDFIO_Stats 8 | 9 | 10 | cdef class ThermodynamicsDry: 11 | 12 | cdef: 13 | double (*L_fp)(double T, double Lambda) nogil 14 | double (*Lambda_fp)(double T) nogil 15 | Thermodynamics.ClausiusClapeyron CC 16 | bint s_prognostic 17 | 18 | cpdef initialize(self,Grid.Grid Gr,PrognosticVariables.PrognosticVariables PV, 19 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 20 | cpdef entropy(self,double p0, double T,double qt, double ql, double qi) 21 | cpdef eos(self, double p0, double s, double qt) 22 | cpdef alpha(self, double p0, double T, double qt, double qv) 23 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 24 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV) 25 | cpdef get_pv_star(self,t) 26 | cpdef get_lh(self,t) 27 | cpdef write_fields(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 28 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, 29 | NetCDFIO_Fields NF, ParallelMPI.ParallelMPI Pa) 30 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, 31 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) -------------------------------------------------------------------------------- /ThermodynamicsSA.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport PrognosticVariables 4 | cimport DiagnosticVariables 5 | cimport ParallelMPI 6 | 7 | from Thermodynamics cimport ClausiusClapeyron 8 | from NetCDFIO cimport NetCDFIO_Fields, NetCDFIO_Stats 9 | 10 | cdef class ThermodynamicsSA: 11 | cdef: 12 | bint do_qt_clipping 13 | double (*L_fp)(double T, double Lambda) nogil 14 | double (*Lambda_fp)(double T) nogil 15 | ClausiusClapeyron CC 16 | s_prognostic 17 | 18 | cpdef initialize(self,Grid.Grid Gr,PrognosticVariables.PrognosticVariables PV, 19 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 20 | cpdef entropy(self, double p0, double T, double qt, double ql, double qi) 21 | cpdef alpha(self, double p0, double T, double qt, double qv) 22 | cpdef eos(self, double p0, double s, double qt) 23 | cpdef update(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 24 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV) 25 | cpdef get_pv_star(self, t) 26 | cpdef get_lh(self,t) 27 | cpdef write_fields(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 28 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, 29 | NetCDFIO_Fields NF, ParallelMPI.ParallelMPI Pa) 30 | cpdef stats_io(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, 31 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) 32 | cpdef liquid_stats(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, PrognosticVariables.PrognosticVariables PV, 33 | DiagnosticVariables.DiagnosticVariables DV, NetCDFIO_Stats NS, ParallelMPI.ParallelMPI Pa) -------------------------------------------------------------------------------- /TimeStepping.pxd: -------------------------------------------------------------------------------- 1 | cimport ParallelMPI as ParallelMPI 2 | cimport PrognosticVariables as PrognosticVariables 3 | cimport DiagnosticVariables as DiagnosticVariables 4 | cimport Grid as Grid 5 | cimport Restart 6 | 7 | cdef class TimeStepping: 8 | cdef: 9 | public double dt 10 | public double t 11 | public double cfl_max 12 | public double cfl_limit 13 | public double dt_max 14 | public double dt_initial 15 | public double t_max 16 | public double acceleration_factor 17 | public double statIOdt 18 | double [:,:] value_copies 19 | double [:,:] tendency_copies 20 | public Py_ssize_t rk_step 21 | public Py_ssize_t n_rk_steps 22 | public Py_ssize_t ts_type 23 | void initialize_second(self,PrognosticVariables.PrognosticVariables PV) 24 | void initialize_third(self,PrognosticVariables.PrognosticVariables PV) 25 | void initialize_fourth(self,PrognosticVariables.PrognosticVariables PV) 26 | 27 | 28 | cpdef initialize(self, namelist, PrognosticVariables.PrognosticVariables PV, ParallelMPI.ParallelMPI Pa) 29 | cpdef update(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, ParallelMPI.ParallelMPI Pa) 30 | cpdef accelerate_tendencies(self, Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, ParallelMPI.ParallelMPI Pa) 31 | cpdef update_second(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV) 32 | cpdef update_third(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV) 33 | cpdef update_fourth(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV) 34 | 35 | cpdef adjust_timestep(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, ParallelMPI.ParallelMPI Pa) 36 | cdef void compute_cfl_max(self,Grid.Grid Gr, PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV,ParallelMPI.ParallelMPI Pa) 37 | cpdef restart(self, Restart.Restart Re) 38 | 39 | cdef inline double cfl_time_step(self) 40 | -------------------------------------------------------------------------------- /VisualizationOutput.pxd: -------------------------------------------------------------------------------- 1 | cimport Grid 2 | cimport ReferenceState 3 | cimport ParallelMPI 4 | cimport DiagnosticVariables 5 | cimport PrognosticVariables 6 | 7 | cdef class VisualizationOutput: 8 | 9 | cdef: 10 | str vis_path 11 | str uuid 12 | public double last_vis_time 13 | public double frequency 14 | 15 | cpdef initialize(self) 16 | cpdef write(self, Grid.Grid Gr, ReferenceState.ReferenceState RS, 17 | PrognosticVariables.PrognosticVariables PV, DiagnosticVariables.DiagnosticVariables DV, 18 | ParallelMPI.ParallelMPI Pa) -------------------------------------------------------------------------------- /bors.toml: -------------------------------------------------------------------------------- 1 | status = [ 2 | "buildkite/pycles-ci", 3 | ] 4 | delete_merged_branches = true 5 | timeout_sec = 10800 6 | block_labels = [ "do-not-merge-yet" ] 7 | cut_body_after = "