f90 error in global climate model -
i compiled model code successfully, gives me error when try run it:
forrtl: severe (408): fort: (8): attempt fetch allocatable variable cos_zenith when not allocated.
i checked several questions , answers online i'm not sure how should handle problem in case. think error message seems quite clear don't have enough experience fortran don't know if it's bug or have modify code etc.
this module of code apparently gives trouble:
module mo_zenith ! ! description: ! <say module for> ! ! current code owner: <name of person responsible code> ! ! history: ! ! version date comment ! ------- ---- ------- ! <version> <date> original code. <your name> ! ! code description: ! language: fortran 90. ! software standards: "european standards writing , ! documenting exchangeable fortran 90 code". ! ! modules used: ! use mo_mpi, only: p_parallel_io, p_bcast, p_io use mo_kind, only: dp use mo_io_units, only: nout use mo_exception, only: finish use mo_jsbach_grid , only: domain_type implicit none private public :: compute_orbit_and_solar, init_zenith, cos_zenith real(dp), allocatable, save :: cos_zenith(:) !< cosine of solar zenith angle domain logical :: module_configured = .false. logical :: module_initialized = .false. contains subroutine compute_orbit_and_solar(domain) ! compute orbital parameters current time step ! called *jsbalone_driver* @ beginning of each time step ! if coupled echam: ! done in *pre_radiation* *mo_radiation*, called in *scan1* ! cosine of zenith angle passed echam interface ! interface copies packed zenith angle *cos_zenith* use mo_time_control, only: l_orbvsop87, get_orbit_times use mo_orbit, only: orbit_kepler, orbit_vsop87 use mo_radiation_parameters, only: nmonth,solar_parameters type(domain_type), intent(in) :: domain logical :: l_rad_call = .false. logical :: lyr_perp = .false. !< switch specify perpetual vsop87 year integer :: yr_perp = -99999 !< year if lyr_perp == .true. real(dp) :: rasc_sun, decl_sun, dist_sun, orbit_date, time_of_day real(dp) :: flx_ratio, cos_mu0(domain%nland,1), daylght_frc(domain%nland,1) real(dp), dimension(domain%nland,1) :: sinlon, sinlat, coslon, coslat integer :: nland nland = domain%nland if (.not. module_initialized) call init_zenith(domain) call get_orbit_times(l_rad_call, lyr_perp, nmonth, yr_perp, time_of_day, orbit_date) if (l_orbvsop87) call orbit_vsop87 (orbit_date, rasc_sun, decl_sun, dist_sun) else call orbit_kepler (orbit_date, rasc_sun, decl_sun, dist_sun) end if sinlon(:,1) = domain%sinlon(1:nland) sinlat(:,1) = domain%sinlat(1:nland) coslon(:,1) = domain%coslon(1:nland) coslat(:,1) = domain%coslat(1:nland) call solar_parameters(decl_sun, dist_sun, time_of_day & ,sinlon, sinlat, coslon, coslat & ,flx_ratio, cos_mu0, daylght_frc) cos_zenith(1:nland) = cos_mu0(1:nland,1) end subroutine compute_orbit_and_solar ! !================================================================================================= subroutine init_zenith(domain) ! pre-compute work quantities domain type(domain_type), intent(in) :: domain if (module_initialized) return allocate(cos_zenith(domain%nland)) module_initialized = .true. end subroutine init_zenith end module mo_zenith
any idea? thank in advance!
Comments
Post a Comment