Changeset 19583
- Timestamp:
- 09/25/15 09:12:29 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r19567 r19583 2164 2164 int m; 2165 2165 IssmDouble SmbMassBalance=0; 2166 int count=0; 2166 2167 /*}}}*/ 2167 2168 … … 2246 2247 a = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)a[i]=aSnow; //set albedo equal to fresh snow [fraction] 2247 2248 T = xNewZeroInit<IssmDouble>(m); for(int i=0;i<m;i++)T[i]=Tmean; //set initial grid cell temperature to the annual mean temperature [K] 2248 swf = xNewZeroInit<IssmDouble>(m);2249 2249 2250 2250 //fixed lower temperatuer bounday condition - T is fixed … … 2265 2265 DoubleArrayInput* a_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbAEnum));_assert_(a_input); 2266 2266 DoubleArrayInput* T_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbTEnum));_assert_(T_input); 2267 DoubleArrayInput* swf_input= dynamic_cast<DoubleArrayInput*>(this->GetInput(SmbSwfEnum));_assert_(swf_input);2268 2267 2269 2268 /*Recover arrays: */ … … 2277 2276 a_input->GetValues(&a,&m); 2278 2277 T_input->GetValues(&T,&m); 2279 swf_input->GetValues(&swf,&m); 2278 2279 //fixed lower temperatuer bounday condition - T is fixed 2280 T_bottom=T[m-1]; 2280 2281 2281 2282 } /*}}}*/ … … 2292 2293 2293 2294 /*Start loop: */ 2295 count=1; 2294 2296 for (t=time;t<=time+dt;t=t+smb_dt){ 2295 2297 2296 if(VerboseSmb() && this->Sid()==0 && IssmComm::GetRank()==0)_printf0_("Time: t=" << setprecision(8) << t/365.0/24.0/3600.0 << " yr/" << (time+dt)/365.0/24.0/3600.0 << " yr" << "\n");2298 if(VerboseSmb() && this->Sid()==0 && IssmComm::GetRank()==0)_printf0_("Time: t=" << setprecision(8) << t/365.0/24.0/3600.0 << " yr/" << (time+dt)/365.0/24.0/3600.0 << " yr" << setprecision(3) << " Step: " << count << "\n"); 2297 2299 2298 2300 /*extract daily data:{{{*/ … … 2315 2317 2316 2318 /*Distribution of absorbed short wave radation with depth:*/ 2317 if(isshortwave)shortwave( swf, swIdx, aIdx, dsw, a[0], d, dz, re,m,this->Sid());2319 if(isshortwave)shortwave(&swf, swIdx, aIdx, dsw, a[0], d, dz, re,m,this->Sid()); 2318 2320 2321 /*Calculate net shortwave [W m-2]*/ 2322 netSW = cellsum(swf,m); 2323 2319 2324 /*Thermal profile computation:*/ 2320 2325 if(isthermal)thermo(&EC, T, dz, d, swf, dlw, Ta, V, eAir, pAir, W[0], smb_dt, m, Vz, Tz,this->Sid()); … … 2338 2343 ulw = 5.67E-8 * pow(T[0],4.0); 2339 2344 2340 /*Calculate net shortwave and longwave [W m-2]*/ 2341 netSW = cellsum(swf,m); 2345 /*Calculate net longwave [W m-2]*/ 2342 2346 netLW = dlw - ulw; 2343 2347 2344 2348 /*Calculate turbulent heat fluxes [W m-2]*/ 2345 2349 if(isturbulentflux)turbulentFlux(&shf, &lhf, &dayEC, Ta, T[0], V, eAir, pAir, d[0], W[0], Vz, Tz,this->Sid()); 2350 2351 /*Verbose some resuls in debug mode: {{{*/ 2352 if(VerboseSmb() && 0){ 2353 _printf_("smb log: count[" << count << "] m[" << m << "] " 2354 << setprecision(16) << "T[" << cellsum(T,m) << "] " 2355 << "d[" << cellsum(d,m) << "] " 2356 << "dz[" << cellsum(dz,m) << "] " 2357 << "a[" << cellsum(a,m) << "] " 2358 << "W[" << cellsum(W,m) << "] " 2359 << "re[" << cellsum(re,m) << "] " 2360 << "gdn[" << cellsum(gdn,m) << "] " 2361 << "gsp[" << cellsum(gsp,m) << "] " 2362 << "swf[" << netSW << "] " 2363 << "\n"); 2364 } /*}}}*/ 2346 2365 2347 2366 /*Sum component mass changes [kg m-2]*/ … … 2359 2378 2360 2379 /*Check mass conservation:*/ 2361 if (!VerboseSmb())if(dMass != 0.0) _printf_("total system mass not conserved in MB function");2380 if (dMass != 0.0) _printf_("total system mass not conserved in MB function"); 2362 2381 2363 2382 /*Check bottom grid cell T is unchanged:*/ 2364 if (!VerboseSmb())if(T[m-1]!=T_bottom) _printf_("T(end)~=T_bottom" << "\n");2383 if (T[m-1]!=T_bottom) _printf_("T(end)~=T_bottom" << "\n"); 2365 2384 2366 2385 SmbMassBalance += sumP + sumEC - sumR; //increment SMB for the entire time span of ice-flow dynamics. 2367 2386 2387 count++; 2368 2388 2369 2389 } //for (t=time;t<=time+dt;t=t+smb_dt) … … 2392 2412 xDelete<IssmDouble>(a); 2393 2413 xDelete<IssmDouble>(T); 2414 xDelete<IssmDouble>(swf); 2415 delete gauss; 2394 2416 /*}}}*/ 2395 2417 }
Note:
See TracChangeset
for help on using the changeset viewer.