Changeset 21395
- Timestamp:
- 11/17/16 22:44:51 (8 years ago)
- Location:
- issm/branches/trunk-larour-NatClimateChange2016/src/c/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-larour-NatClimateChange2016/src/c/classes/FemModel.cpp
r21159 r21395 2402 2402 } 2403 2403 /*}}}*/ 2404 void FemModel::SealevelriseRotationalFeedback(Vector<IssmDouble>* pSgo_rot, Vector<IssmDouble>* pSg_old, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius){/*{{{*/ 2405 2406 /*serialized vectors:*/ 2407 IssmDouble* Sg_old=NULL; 2408 IssmDouble eartharea=0; 2409 IssmDouble eartharea_cpu=0; 2410 IssmDouble tide_love_h, tide_love_k, fluid_love, moi_e, moi_p, omega, g; 2411 IssmDouble load_love_k2 = -0.30922675; //degree 2 load Love number 2412 IssmDouble m1, m2, m3; 2413 IssmDouble lati, longi, radi, value; 2414 2415 /*Serialize vectors from previous iteration:*/ 2416 Sg_old=pSg_old->ToMPISerial(); 2417 2418 /*First, figure out the area of the ocean, which is needed to compute the eustatic component: */ 2419 for(int i=0;i<elements->Size();i++){ 2420 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 2421 eartharea_cpu += element->GetAreaSpherical(); 2422 } 2423 ISSM_MPI_Reduce (&eartharea_cpu,&eartharea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 2424 ISSM_MPI_Bcast(&eartharea,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 2425 2426 IssmDouble moi_list[3]={0,0,0}; 2427 IssmDouble moi_list_cpu[3]={0,0,0}; 2428 for(int i=0;i<elements->Size();i++){ 2429 Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i)); 2430 element->SealevelriseMomentOfInertia(&moi_list[0],Sg_old,eartharea); 2431 moi_list_cpu[0] += moi_list[0]; 2432 moi_list_cpu[1] += moi_list[1]; 2433 moi_list_cpu[2] += moi_list[2]; 2434 } 2435 ISSM_MPI_Reduce (&moi_list_cpu[0],&moi_list[0],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 2436 ISSM_MPI_Bcast(&moi_list[0],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 2437 // 2438 ISSM_MPI_Reduce (&moi_list_cpu[1],&moi_list[1],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 2439 ISSM_MPI_Bcast(&moi_list[1],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 2440 // 2441 ISSM_MPI_Reduce (&moi_list_cpu[2],&moi_list[2],1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 2442 ISSM_MPI_Bcast(&moi_list[2],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 2443 2444 /*pull out some useful parameters: */ 2445 parameters->FindParam(&tide_love_h,SealevelriseTidalLoveHEnum); 2446 parameters->FindParam(&tide_love_k,SealevelriseTidalLoveKEnum); 2447 parameters->FindParam(&fluid_love,SealevelriseFluidLoveEnum); 2448 parameters->FindParam(&moi_e,SealevelriseEquatorialMoiEnum); 2449 parameters->FindParam(&moi_p,SealevelrisePolarMoiEnum); 2450 parameters->FindParam(&omega,SealevelriseAngularVelocityEnum); 2451 2452 /*compute perturbation terms for angular velocity vector: */ 2453 m1 = 1/(1-tide_love_k/fluid_love) * (1+load_love_k2)/(moi_p-moi_e) * moi_list[0]; 2454 m2 = 1/(1-tide_love_k/fluid_love) * (1+load_love_k2)/(moi_p-moi_e) * moi_list[1]; 2455 m3 = -(1+load_love_k2)/moi_p * moi_list[2]; // term associated with fluid number (3-order-of-magnitude smaller) is negelected 2456 2457 /* Green's function (1+k_2-h_2/g): checked against Glenn Milne's thesis Chapter 3 (eqs: 3.3-4, 3.10-11) 2458 * Perturbation terms for angular velocity vector (m1, m2, m3): checked against Mitrovica (2005 Appendix) & Jensen et al (2013 Appendix A3) 2459 * Sea level rotational feedback: checked against GMD eqs 8-9 (only first order terms, i.e., degree 2 order 0 & 1 considered) 2460 * all DONE in Geographic coordinates: theta \in [-90,90], lambda \in [-180 180] 2461 */ 2462 for(int i=0;i<vertices->Size();i++){ 2463 int sid; 2464 //Vertex* vertex=(Vertex*)vertices->GetObjectByOffset(i); 2465 Vertex* vertex=xDynamicCast<Vertex*>(vertices->GetObjectByOffset(i)); 2466 sid=vertex->Sid(); 2467 2468 lati=latitude[sid]/180*PI; longi=longitude[sid]/180*PI; radi=radius[sid]; 2469 2470 /*only first order terms are considered now: */ 2471 value=((1.0+tide_love_k-tide_love_h)/9.81)*pow(omega*radi,2.0)* 2472 (-m3/6.0 + 0.5*m3*cos(2.0*lati) - 0.5*sin(2.*lati)*(m1*cos(longi)+m2*sin(longi))); 2473 2474 pSgo_rot->SetValue(sid,value,INS_VAL); //INS_VAL ensures that you don't add several times 2475 } 2476 2477 /*Assemble mesh velocity*/ 2478 pSgo_rot->Assemble(); 2479 2480 /*Free ressources:*/ 2481 xDelete<IssmDouble>(Sg_old); 2482 2483 } 2484 /*}}}*/ 2404 2485 void FemModel::SealevelriseGeodetic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pSg, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz){/*{{{*/ 2405 2486 -
issm/branches/trunk-larour-NatClimateChange2016/src/c/classes/FemModel.h
r20999 r21395 116 116 void SealevelriseEustatic(Vector<IssmDouble>* pSgi, IssmDouble* peustatic, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius); 117 117 void SealevelriseNonEustatic(Vector<IssmDouble>* pSgo, Vector<IssmDouble>* pSg_old, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius,bool verboseconvolution); 118 void SealevelriseRotationalFeedback(Vector<IssmDouble>* pSgo_rot, Vector<IssmDouble>* pSg_old, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius); 118 119 void SealevelriseGeodetic(Vector<IssmDouble>* pUp, Vector<IssmDouble>* pNorth, Vector<IssmDouble>* pEast, Vector<IssmDouble>* pSg_old, IssmDouble* latitude, IssmDouble* longitude, IssmDouble* radius, IssmDouble* xx, IssmDouble* yy, IssmDouble* zz); 119 120 IssmDouble SealevelriseOceanAverage(Vector<IssmDouble>* Sg);
Note:
See TracChangeset
for help on using the changeset viewer.