diff --git a/lis/arch/Config.pl b/lis/arch/Config.pl index c26605256..1d954cc1e 100755 --- a/lis/arch/Config.pl +++ b/lis/arch/Config.pl @@ -165,9 +165,11 @@ $sys_c_opt .= " -Wunused-function -Wunused-parameter"; $sys_c_opt .= " -Wunused-variable -Wwrite-strings"; # Run-time flags - $sys_c_opt .= " -check=conversions,stack,uninit"; + #EMK 20231109...Disabled several flags that are rejected by the new ICX + #compiler on Narwhal. + #$sys_c_opt .= " -check=conversions,stack,uninit"; $sys_c_opt .= " -fp-stack-check -fp-trap=common -fp-trap-all=common"; - $sys_c_opt .= " -ftrapuv"; + #$sys_c_opt .= " -ftrapuv"; } elsif($sys_arch eq "linux_pgi") { print "Optimization level $opt_lev is not defined for $sys_arch.\n"; diff --git a/lis/surfacemodels/land/rdhm.3.5.6/frz/gen_frzst.c b/lis/surfacemodels/land/rdhm.3.5.6/frz/gen_frzst.c index ca6f22a08..295d8ead3 100755 --- a/lis/surfacemodels/land/rdhm.3.5.6/frz/gen_frzst.c +++ b/lis/surfacemodels/land/rdhm.3.5.6/frz/gen_frzst.c @@ -6,6 +6,10 @@ #include "linux.h" /* #include "models.h" */ +extern void fstfg1_(int *, int *, int *, int *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *); + +extern void frzind1_(float *, float *, float *, float *, int *, float *, float *, float *); + int gen_frzst(int npix, int *nsoil, int *nupl, float *sac_parx, float *frz_parx, float *frz_stx, float *sac_stx, float *sacst_prv, float *smc, float *sh2o, float dthr, diff --git a/lis/surfacemodels/land/rdhm.3.5.6/frz/scale_frzst.c b/lis/surfacemodels/land/rdhm.3.5.6/frz/scale_frzst.c index a3b7c3062..a15c23eb8 100755 --- a/lis/surfacemodels/land/rdhm.3.5.6/frz/scale_frzst.c +++ b/lis/surfacemodels/land/rdhm.3.5.6/frz/scale_frzst.c @@ -4,6 +4,14 @@ #include "com_header.h" #include "linux.h" +extern void fstfg1_(int *, int *, int *, int *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *, float *); + +extern void soil_int1_(float *,int *,float *,float *,int *,float *); + +extern void scale_sh2o_(float *, float *, float *, int *, int *, float *, float *, float *, float *, float *, float *, float *); + +extern void frzind1_(float *, float *, float *, float *, int *, float *, float *, float *); + int scale_frzst(int npix, int *nsoil, int *nupl, float *sac_parx, float *frz_parx, float *frz_stx, float *sac_stx, float *sacst_prv, float *smc, float *sh2o, float dthr, diff --git a/lis/surfacemodels/land/rdhm.3.5.6/rdhm_get_ped.c b/lis/surfacemodels/land/rdhm.3.5.6/rdhm_get_ped.c index b0a3358b1..ad97bf88e 100755 --- a/lis/surfacemodels/land/rdhm.3.5.6/rdhm_get_ped.c +++ b/lis/surfacemodels/land/rdhm.3.5.6/rdhm_get_ped.c @@ -9,6 +9,9 @@ //-------------------------END NOTICE -- DO NOT EDIT----------------------- /* wrapper for calling get_ped Shugong Wang 10/25/2013 */ + +extern void get_ped(int, int, int, int, int, float *, float *, float *); + void rdhm_get_ped_(int *year, /* */ int *month, /* */ int *day, /* */ diff --git a/lis/surfacemodels/land/rdhm.3.5.6/sac/days_of_month.c b/lis/surfacemodels/land/rdhm.3.5.6/sac/days_of_month.c index cef3f38c3..b109acf20 100755 --- a/lis/surfacemodels/land/rdhm.3.5.6/sac/days_of_month.c +++ b/lis/surfacemodels/land/rdhm.3.5.6/sac/days_of_month.c @@ -13,6 +13,8 @@ #include "com_header.h" #include "models.h" +extern int is_leap_year(int); + int days_of_month(int m, int y) { int num_days[12]={31,28,31,30,31,30,31,31,30,31,30,31}; diff --git a/lis/surfacemodels/land/rdhm.3.5.6/sac/get_daily_pe.c b/lis/surfacemodels/land/rdhm.3.5.6/sac/get_daily_pe.c index e6f2aa2c1..d30f3a0fa 100755 --- a/lis/surfacemodels/land/rdhm.3.5.6/sac/get_daily_pe.c +++ b/lis/surfacemodels/land/rdhm.3.5.6/sac/get_daily_pe.c @@ -15,6 +15,8 @@ #include "models.h" +extern int days_of_month(int, int); + void get_daily_pe(int yr, int mon, int day, int npix, float *pe, float *pe_adj, float *pe_day) { diff --git a/lis/surfacemodels/land/rdhm.3.5.6/sac/get_ped.c b/lis/surfacemodels/land/rdhm.3.5.6/sac/get_ped.c index 65dca8f2b..80af81203 100755 --- a/lis/surfacemodels/land/rdhm.3.5.6/sac/get_ped.c +++ b/lis/surfacemodels/land/rdhm.3.5.6/sac/get_ped.c @@ -16,6 +16,8 @@ #include "com_header.h" #include "models.h" +extern void get_daily_pe(int, int, int, int, float *, float *, float *); + void get_ped(int y, int m, int d, int npix, int dtm, float *pe, float *pe_adj, float *ped) { diff --git a/lis/surfacemodels/land/vic.4.1.1/vic411_read_vegparam.c b/lis/surfacemodels/land/vic.4.1.1/physics/vic411_read_vegparam.c similarity index 76% rename from lis/surfacemodels/land/vic.4.1.1/vic411_read_vegparam.c rename to lis/surfacemodels/land/vic.4.1.1/physics/vic411_read_vegparam.c index c89ba26df..a87371872 100644 --- a/lis/surfacemodels/land/vic.4.1.1/vic411_read_vegparam.c +++ b/lis/surfacemodels/land/vic.4.1.1/physics/vic411_read_vegparam.c @@ -1,25 +1,13 @@ -//-----------------------BEGIN NOTICE -- DO NOT EDIT----------------------- -// NASA Goddard Space Flight Center -// Land Information System Framework (LISF) -// Version 7.4 -// -// Copyright (c) 2022 United States Government as represented by the -// Administrator of the National Aeronautics and Space Administration. -// All Rights Reserved. -//-------------------------END NOTICE -- DO NOT EDIT----------------------- - #include #include -#include "vic411_vicNl.h" +#include #include static char vcid[] = "$Id: vic411_read_vegparam.c,v 4.5.2.11 2009/10/01 21:12:16 vicadmin Exp $"; -// shugong: if cannot find entry for the gridid+vegetation class, return 0, other return 1 -int vic411_read_vegparam(FILE *vegparam, - int gridcel, - int Nveg_type, - int lis_veg_class, - vic411_veg_con_struct *lis_temp) + +vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, + int gridcel, + int Nveg_type) /********************************************************************** vic411_read_vegparam.c Keith Cherkauer and Dag Lohmann 1997 @@ -58,7 +46,7 @@ int vic411_read_vegparam(FILE *vegparam, **********************************************************************/ { - void vic411_ttrim1( char *string ); + void vic411_ttrim( char *string ); extern vic411_veg_lib_struct *vic411_veg_lib; extern vic411_option_struct vic411_options; #if LINK_DEBUG @@ -80,18 +68,6 @@ int vic411_read_vegparam(FILE *vegparam, char *token; char *vegarr[500]; size_t length; - int vic411_flag; - vic411_flag = 0; // defualt: not found - // added by Shugong Wang. - /* vic_veg_clas is defined to save the vegetation class in vegetation parameter file (called real vegetation class after). - temp is a vic411_veg_con_struct. Firstly, the real vegetation class will be read in and save in the veg_class of temp. Then, - vic411_read_vegparam will find the index number of the real vegetation class in vegetation parameter library (vic411_veg_lib). - In the end, the veg_class of temp will be replced with the index number. In other word, the vegetation class in vic411_veg_con_struct - will not be the real vegetatoin class. In stead, it will be the corresponding index number in vegetatoin parameter library. - - In this function (vic411_read_vegparam), lis_veg_class is real vegetation class. In order to update the LAI and related values in - vic411_veg_lib correctly, lis_veg_class should be compared with the real vegetation class (vic_veg_class) */ - int vic_veg_class; if(vic411_options.GLOBAL_LAI) skip=2; else skip=1; @@ -121,7 +97,7 @@ int vic411_read_vegparam(FILE *vegparam, exit(99); } if(vegetat_type_num >= MAX_VEG) { - sprintf(ErrStr,"Vegetation parameter file wants more vegetation tiles in grid cell %i (%i) than are allowed by MAX_VEG (%i) [NOTE: bare soil class is assumed]. Edit vicNl_def.h and recompile.",gridcel,vegetat_type_num+1,MAX_VEG); + sprintf(ErrStr,"Vegetation parameter file wants more vegetation tiles in grid cell %i (%i) than are allowed by MAX_VEG (%i) [NOTE: bare soil class is assumed]. Edit vic411_vicNl_def.h and recompile.",gridcel,vegetat_type_num+1,MAX_VEG); vic411_nrerror(ErrStr); } @@ -146,7 +122,7 @@ int vic411_read_vegparam(FILE *vegparam, vic411_nrerror(ErrStr); } strcpy(tmpline, line); - vic411_ttrim1( tmpline ); + vic411_ttrim( tmpline ); token = strtok (tmpline, delimiters); /* token => veg_class, move 'line' pointer to next field */ Nfields = 0; vegarr[Nfields] = calloc( 500, sizeof(char)); @@ -174,20 +150,15 @@ int vic411_read_vegparam(FILE *vegparam, temp[i].LAKE = 0; temp[i].veg_class = atoi( vegarr[0] ); - /* added by Shugong Wang */ - vic_veg_class = temp[i].veg_class; // this is the real vegetation class in vegetation parameter file. - temp[i].Cv = atof( vegarr[1] ); depth_sum = 0; sum = 0.; - /* the following VIC code read root zoon information from vegetation parameter file*/ for(j=0;jzone_depth[j] = temp[i].zone_depth[j]; - lis_temp->zone_fract[j] = temp[i].zone_fract[j]; - } - } - - if(vic411_options.BLOWING) { j = 2 * vic411_options.ROOT_ZONES; temp[i].sigma_slope = atof( vegarr[2 + j] ); @@ -238,16 +194,14 @@ int vic411_read_vegparam(FILE *vegparam, vic411_nrerror(ErrStr); } else - { temp[i].veg_class = veg_class; - } temp[0].Cv_sum += temp[i].Cv; for(k=0; k #include -#include +#include "vic411_vicNl.h" #include -static char vcid[] = "$Id: vic411_read_vegparam.c,v 4.5.2.11 2009/10/01 21:12:16 vicadmin Exp $"; - -vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, - int gridcel, - int Nveg_type) +static char vcid[] = "$Id: vic411_read_vegparam_lis.c,v 4.5.2.11 2009/10/01 21:12:16 vicadmin Exp $"; +// shugong: if cannot find entry for the gridid+vegetation class, return 0, other return 1 +int vic411_read_vegparam_lis(FILE *vegparam, + int gridcel, + int Nveg_type, + int lis_veg_class, + vic411_veg_con_struct *lis_temp) /********************************************************************** vic411_read_vegparam.c Keith Cherkauer and Dag Lohmann 1997 @@ -46,7 +58,7 @@ vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, **********************************************************************/ { - void vic411_ttrim( char *string ); + void vic411_ttrim1( char *string ); extern vic411_veg_lib_struct *vic411_veg_lib; extern vic411_option_struct vic411_options; #if LINK_DEBUG @@ -68,6 +80,18 @@ vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, char *token; char *vegarr[500]; size_t length; + int vic411_flag; + vic411_flag = 0; // defualt: not found + // added by Shugong Wang. + /* vic_veg_clas is defined to save the vegetation class in vegetation parameter file (called real vegetation class after). + temp is a vic411_veg_con_struct. Firstly, the real vegetation class will be read in and save in the veg_class of temp. Then, + vic411_read_vegparam will find the index number of the real vegetation class in vegetation parameter library (vic411_veg_lib). + In the end, the veg_class of temp will be replced with the index number. In other word, the vegetation class in vic411_veg_con_struct + will not be the real vegetatoin class. In stead, it will be the corresponding index number in vegetatoin parameter library. + + In this function (vic411_read_vegparam), lis_veg_class is real vegetation class. In order to update the LAI and related values in + vic411_veg_lib correctly, lis_veg_class should be compared with the real vegetation class (vic_veg_class) */ + int vic_veg_class; if(vic411_options.GLOBAL_LAI) skip=2; else skip=1; @@ -97,7 +121,7 @@ vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, exit(99); } if(vegetat_type_num >= MAX_VEG) { - sprintf(ErrStr,"Vegetation parameter file wants more vegetation tiles in grid cell %i (%i) than are allowed by MAX_VEG (%i) [NOTE: bare soil class is assumed]. Edit vic411_vicNl_def.h and recompile.",gridcel,vegetat_type_num+1,MAX_VEG); + sprintf(ErrStr,"Vegetation parameter file wants more vegetation tiles in grid cell %i (%i) than are allowed by MAX_VEG (%i) [NOTE: bare soil class is assumed]. Edit vicNl_def.h and recompile.",gridcel,vegetat_type_num+1,MAX_VEG); vic411_nrerror(ErrStr); } @@ -122,7 +146,7 @@ vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, vic411_nrerror(ErrStr); } strcpy(tmpline, line); - vic411_ttrim( tmpline ); + vic411_ttrim1( tmpline ); token = strtok (tmpline, delimiters); /* token => veg_class, move 'line' pointer to next field */ Nfields = 0; vegarr[Nfields] = calloc( 500, sizeof(char)); @@ -150,15 +174,20 @@ vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, temp[i].LAKE = 0; temp[i].veg_class = atoi( vegarr[0] ); + /* added by Shugong Wang */ + vic_veg_class = temp[i].veg_class; // this is the real vegetation class in vegetation parameter file. + temp[i].Cv = atof( vegarr[1] ); depth_sum = 0; sum = 0.; + /* the following VIC code read root zoon information from vegetation parameter file*/ for(j=0;jzone_depth[j] = temp[i].zone_depth[j]; + lis_temp->zone_fract[j] = temp[i].zone_fract[j]; + } + } + + if(vic411_options.BLOWING) { j = 2 * vic411_options.ROOT_ZONES; temp[i].sigma_slope = atof( vegarr[2 + j] ); @@ -194,14 +238,16 @@ vic411_veg_con_struct *vic411_read_vegparam(FILE *vegparam, vic411_nrerror(ErrStr); } else + { temp[i].veg_class = veg_class; + } temp[0].Cv_sum += temp[i].Cv; for(k=0; k #include "ftn.h" +extern void write_atmosdata(atmos_data_struct *, int); + //BOP // // !ROUTINE: vic412_write_atmos diff --git a/lis/surfacemodels/land/vic.4.1.2.l/vic412_write_state.c b/lis/surfacemodels/land/vic.4.1.2.l/vic412_write_state.c index 3a57c3e89..4fbd36c50 100755 --- a/lis/surfacemodels/land/vic.4.1.2.l/vic412_write_state.c +++ b/lis/surfacemodels/land/vic.4.1.2.l/vic412_write_state.c @@ -13,6 +13,9 @@ #include "ftn.h" #define VIC_BASED 0 /** VIC based vegetation tiling Added by Shugong Wang on 05/01/2012 **/ #define LIS_BASED 1 /** LIS based vegetation tiling Added by Shugong Wang on 05/01/2012 **/ + +extern void pack_model_state(dist_prcp_struct *, global_param_struct *, int, int, filep_struct *, soil_con_struct *, char *, int *, float *, int *); + //BOP // // !ROUTINE: vic412_write_state