[issm-svn] r12641 - issm/trunk/src/c

lemorzad at issm.ess.uci.edu lemorzad at issm.ess.uci.edu
Tue Jul 17 09:47:14 PDT 2012


Author: lemorzad
Date: 2012-07-17 09:47:14 -0700 (Tue, 17 Jul 2012)
New Revision: 12641

Modified:
   issm/trunk/src/c/objects/Elements/Penta.cpp
   issm/trunk/src/c/objects/Elements/Tria.cpp
   issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp
   issm/trunk/src/c/shared/Elements/elements.h
Log:
updating PddSurfaceMassBalance

Modified: issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- issm/trunk/src/c/objects/Elements/Penta.cpp	2012-07-17 16:11:29 UTC (rev 12640)
+++ issm/trunk/src/c/objects/Elements/Penta.cpp	2012-07-17 16:47:14 UTC (rev 12641)
@@ -2290,7 +2290,7 @@
 
    /*measure the surface mass balance*/
    for (i = 0; i < NUMVERTICES; i++){
-     agd[i]=PddSurfaceMassBlance(&monthlytemperatures[0][0], &monthlyprec[0][0], i, pdds, pds, signorm, yts, h[i], s[i], rho_ice, rho_water);
+     agd[i]=PddSurfaceMassBlance(&monthlytemperatures[i][0], &monthlyprec[i][0], pdds, pds, signorm, yts, h[i], s[i], rho_ice, rho_water);
    }
 
    /*Update inputs*/    

Modified: issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- issm/trunk/src/c/objects/Elements/Tria.cpp	2012-07-17 16:11:29 UTC (rev 12640)
+++ issm/trunk/src/c/objects/Elements/Tria.cpp	2012-07-17 16:47:14 UTC (rev 12641)
@@ -2121,7 +2121,7 @@
 
    /*measure the surface mass balance*/
    for (i = 0; i < NUMVERTICES; i++){
-     agd[i]=PddSurfaceMassBlance(&monthlytemperatures[0][0], &monthlyprec[0][0], i, pdds, pds, signorm, yts, h[i], s[i], rho_ice, rho_water);
+     agd[i]=PddSurfaceMassBlance(&monthlytemperatures[i][0], &monthlyprec[i][0], pdds, pds, signorm, yts, h[i], s[i], rho_ice, rho_water);
    }
 
    /*Update inputs*/    

Modified: issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp
===================================================================
--- issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp	2012-07-17 16:11:29 UTC (rev 12640)
+++ issm/trunk/src/c/shared/Elements/PddSurfaceMassBalance.cpp	2012-07-17 16:47:14 UTC (rev 12641)
@@ -4,15 +4,15 @@
 
 #include "./elements.h"
 
-double PddSurfaceMassBlance(double* monthlytemperatures, double* monthlyprec, int i, double* pdds, double* pds, double signorm, double yts, double h, double s, double rho_ice, double rho_water){
+double PddSurfaceMassBlance(double* monthlytemperatures, double* monthlyprec, double* pdds, double* pds, double signorm, double yts, double h, double s, double rho_ice, double rho_water){
 
   // output:
   double B;    // surface mass balance, melt+accumulation
 
   int    iqj,imonth, j;
   
-  double saccu = {0};     // yearly surface accumulation
-  double smelt = {0};     // yearly melt
+  double saccu;     // yearly surface accumulation
+  double smelt;     // yearly melt
   double precrunoff;      // yearly runoff
   double prect; // total precipitation during 1 year taking into account des. ef.
   double water; //water=rain + snowmelt 
@@ -22,8 +22,8 @@
   double density;
   double lapser=6.5/1000., sealev=0.;    // lapse rate. degrees per meter. 7.5 lev's 99 paper, 9 Marshall 99 paper
   double desfac = 0.5;                 // desert elevation factor
-  double s0p={0};         // should be set to elevation from precip source
-  double s0t={0};         // should be set to elevation from temperature source
+  double s0p=0.;         // should be set to elevation from precip source
+  double s0t=0.;         // should be set to elevation from temperature source
   double st;             // elevation between altitude of the temp record and current altitude
   double sp;             // elevation between altitude of the prec record and current altitude
   
@@ -36,15 +36,15 @@
   double pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
   
   double q, qmpt; // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
-  double qm = {0};        // snow part of the precipitation 
-  double qmt = {0};       // precipitation without desertification effect adjustment
-  double qmp = {0};       // desertification taken into account
-  double pdd = {0};     
-  double frzndd = {0};  
+  double qm = 0.;        // snow part of the precipitation 
+  double qmt = 0.;       // precipitation without desertification effect adjustment
+  double qmp = 0.;       // desertification taken into account
+  double pdd = 0.;     
+  double frzndd = 0.;  
   
   double tstar;                        // monthly mean surface temp
-  double Tsum= {0};       // average summer (JJA) temperature
-  double Tsurf = {0};     // average annual temperature    
+  double Tsum= 0.;       // average summer (JJA) temperature
+  double Tsurf = 0.;     // average annual temperature    
   
 
   double deltm=1./12.;
@@ -58,12 +58,7 @@
   double supice,supcap,diffndd;
   double fsupT=0.5,  fsupndd=0.5;  // Tsurf mode factors for supice
   double pddtj, hmx2;
-
-  double precipitation[12], temperatures[12];
   
-  for (j = 0; j < 12; j++) {precipitation[j]=monthlyprec[i*12+j];}
-  for (j = 0; j < 12; j++) {temperatures[j]=monthlytemperatures[i*12+j];}
-  
   sconv=(rho_water/rho_ice)/12.; //rhow_rain/rhoi / 12 months
   
   /*PDD constant*/
@@ -78,7 +73,7 @@
       imonth =  ismon[iqj];
   
       st=(s-s0t)/1000.;
-      tstar = temperatures[imonth] - lapser *max(st,sealev);
+      tstar = monthlytemperatures[imonth] - lapser *max(st,sealev);
       Tsurf = tstar*deltm+Tsurf;        
       
       /*********compute PD ****************/
@@ -93,8 +88,8 @@
       if (sp>0.0){q = exp(-desfac*sp);}
       else {q = 1.0;}
       
-      qmt= qmt + precipitation[imonth]*sconv;  //*sconv to convert in m of ice equivalent per month
-      qmpt= q*precipitation[imonth]*sconv;           
+      qmt= qmt + monthlyprec[imonth]*sconv;  //*sconv to convert in m of ice equivalent per month
+      qmpt= q*monthlyprec[imonth]*sconv;           
       qmp= qmp + qmpt;
       qm= qm + qmpt*pd;
       

Modified: issm/trunk/src/c/shared/Elements/elements.h
===================================================================
--- issm/trunk/src/c/shared/Elements/elements.h	2012-07-17 16:11:29 UTC (rev 12640)
+++ issm/trunk/src/c/shared/Elements/elements.h	2012-07-17 16:47:14 UTC (rev 12641)
@@ -12,7 +12,7 @@
 
 double Paterson(double temperature);
 double Arrhenius(double temperature,double depth,double n);
-double PddSurfaceMassBlance(double* monthlytemperatures,  double* monthlyprec, int i, double* pdds, double* pds, double signorm, double yts, double h, double s, double rho_ice, double rho_water);
+double PddSurfaceMassBlance(double* monthlytemperatures,  double* monthlyprec, double* pdds, double* pds, double signorm, double yts, double h, double s, double rho_ice, double rho_water);
 void   GetVerticesCoordinates(double* xyz,  Node** nodes, int numvertices);
 int    GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum);
 int*   GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum);



More information about the issm-svn mailing list