[20498] | 1 | Index: ../trunk-jpl/src/c/analyses/SealevelriseAnalysis.cpp
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/analyses/SealevelriseAnalysis.cpp (revision 20043)
|
---|
| 4 | +++ ../trunk-jpl/src/c/analyses/SealevelriseAnalysis.cpp (revision 20044)
|
---|
| 5 | @@ -70,8 +70,29 @@
|
---|
| 6 | iomodel->FetchData(°acc,SealevelriseDegaccEnum);
|
---|
| 7 | M=reCast<int,IssmDouble>(180./degacc+1.);
|
---|
| 8 | G_elastic=xNew<IssmDouble>(M);
|
---|
| 9 | +
|
---|
| 10 | + /*compute combined legendre + love number (elastic green function:*/
|
---|
| 11 | + #ifdef _HAVE_ADOLC_
|
---|
| 12 | + for(int i=0;i<M;i++){
|
---|
| 13 | + IssmDouble alpha,x;
|
---|
| 14 | + alpha= reCast<IssmDouble>(i)*degacc * PI / 180.0;
|
---|
| 15 |
|
---|
| 16 | - /*compute combined legendre + love number (elastic green function:*/
|
---|
| 17 | + G_elastic[i]= (love_k[nl-1]-love_h[nl-1])/2.0/sin(alpha/2.0);
|
---|
| 18 | + for (int n=0;n<nl;n++) {
|
---|
| 19 | + IssmDouble Pn,Pn1,Pn2;
|
---|
| 20 | + IssmDouble deltalove;
|
---|
| 21 | +
|
---|
| 22 | + deltalove = (love_k[n]-love_k[nl-1]-love_h[n]+love_h[nl-1]);
|
---|
| 23 | +
|
---|
| 24 | + if(n==0)Pn=1;
|
---|
| 25 | + else if(n==1)Pn=cos(alpha);
|
---|
| 26 | + else Pn= ( (2*n-1)*cos(alpha)*Pn1 - (n-1)*Pn2 ) /n;
|
---|
| 27 | + Pn2=Pn1; Pn1=Pn;
|
---|
| 28 | +
|
---|
| 29 | + G_elastic[i] += deltalove*Pn;
|
---|
| 30 | + }
|
---|
| 31 | + }
|
---|
| 32 | + #else
|
---|
| 33 | m=DetermineLocalSize(M,IssmComm::GetComm());
|
---|
| 34 | GetOwnershipBoundariesFromRange(&lower_row,&upper_row,m,IssmComm::GetComm());
|
---|
| 35 | G_elastic_local=xNew<IssmDouble>(m);
|
---|
| 36 | @@ -113,29 +134,8 @@
|
---|
| 37 | xDelete<int>(displs);
|
---|
| 38 |
|
---|
| 39 | /*}}}*/
|
---|
| 40 | + #endif
|
---|
| 41 |
|
---|
| 42 | - /*Old code: {{{*/
|
---|
| 43 | - /*for(int i=0;i<M;i++){
|
---|
| 44 | - IssmDouble alpha,x;
|
---|
| 45 | - alpha= reCast<IssmDouble>(i)*degacc * PI / 180.0;
|
---|
| 46 | -
|
---|
| 47 | - G_elastic[i]= (love_k[nl-1]-love_h[nl-1])/2.0/sin(alpha/2.0);
|
---|
| 48 | - for (int n=0;n<nl;n++) {
|
---|
| 49 | - IssmDouble Pn,Pn1,Pn2;
|
---|
| 50 | - IssmDouble deltalove;
|
---|
| 51 | -
|
---|
| 52 | - deltalove = (love_k[n]-love_k[nl-1]-love_h[n]+love_h[nl-1]);
|
---|
| 53 | -
|
---|
| 54 | - if(n==0)Pn=1;
|
---|
| 55 | - else if(n==1)Pn=cos(alpha);
|
---|
| 56 | - else Pn= ( (2*n-1)*cos(alpha)*Pn1 - (n-1)*Pn2 ) /n;
|
---|
| 57 | - Pn2=Pn1; Pn1=Pn;
|
---|
| 58 | -
|
---|
| 59 | - G_elastic[i] += deltalove*Pn;
|
---|
| 60 | - }
|
---|
| 61 | - }*/
|
---|
| 62 | - /*}}}*/
|
---|
| 63 | -
|
---|
| 64 | /*Avoid singularity at 0: */
|
---|
| 65 | G_elastic[0]=G_elastic[1];
|
---|
| 66 | parameters->AddObject(new DoubleVecParam(SealevelriseGElasticEnum,G_elastic,M));
|
---|