Changeset 20871


Ignore:
Timestamp:
07/08/16 12:12:08 (9 years ago)
Author:
adhikari
Message:

CHG: GetAreaSpherical added to compute spherical area

Location:
issm/trunk-jpl/src/c/classes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Element.h

    r20810 r20871  
    298298                #ifdef _HAVE_SEALEVELRISE_
    299299                virtual IssmDouble    GetArea3D(void)=0;
     300                virtual IssmDouble    GetAreaSpherical(void)=0;
    300301                virtual IssmDouble    OceanAverage(IssmDouble* Sg)=0;
    301302                virtual IssmDouble    OceanArea(void)=0;
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r20810 r20871  
    6464                void           FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating);
    6565                IssmDouble     GetArea3D(void){_error_("not implemented yet!");};
     66                IssmDouble     GetAreaSpherical(void){_error_("not implemented yet!");};
    6667                void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
    6768                Element*       GetBasalElement(void);
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Seg.h

    r20810 r20871  
    163163                void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
    164164                IssmDouble     GetArea3D(void){_error_("not implemented yet!");};
     165                IssmDouble     GetAreaSpherical(void){_error_("not implemented yet!");};
    165166
    166167#ifdef _HAVE_GIA_
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tetra.h

    r20810 r20871  
    6363                void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
    6464                IssmDouble     GetArea3D(void){_error_("not implemented yet!");};
     65                IssmDouble     GetAreaSpherical(void){_error_("not implemented yet!");};
    6566                Element*    GetBasalElement(void){_error_("not implemented yet");};
    6667                int         GetElementType(void);
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r20810 r20871  
    912912        return area_fraction*this->GetArea();
    913913}/*}}}*/
     914IssmDouble Tria::GetAreaSpherical(void){/*{{{*/
     915
     916        bool spherical=true;
     917        IssmDouble llr_list[NUMVERTICES][3];
     918        IssmDouble x1,y1,z1,x2,y2,z2,x3,y3,z3;
     919        IssmDouble arc12,arc23,arc31,semi_peri,excess;
     920
     921        /*retrieve coordinates: lat,long,radius */
     922        ::GetVerticesCoordinates(&llr_list[0][0],vertices,NUMVERTICES,spherical);
     923        x1=llr_list[0][0]/180*PI; y1=llr_list[0][1]/180*PI; z1=llr_list[0][2];
     924        x2=llr_list[1][0]/180*PI; y2=llr_list[1][1]/180*PI; z2=llr_list[1][2];
     925        x3=llr_list[2][0]/180*PI; y3=llr_list[2][1]/180*PI; z3=llr_list[2][2];
     926
     927        /*compute great circle distance between vertices */
     928        arc12=2.*asin(sqrt(pow(sin((x2-x1)/2),2.0)+cos(x1)*cos(x2)*pow(sin((y2-y1)/2),2)));
     929        arc23=2.*asin(sqrt(pow(sin((x3-x2)/2),2.0)+cos(x2)*cos(x3)*pow(sin((y3-y2)/2),2)));
     930        arc31=2.*asin(sqrt(pow(sin((x1-x3)/2),2.0)+cos(x3)*cos(x1)*pow(sin((y1-y3)/2),2)));
     931
     932        /*semi parameter */
     933        semi_peri=(arc12+arc23+arc31)/2;
     934
     935        /*spherical excess */
     936        excess=4.*atan(sqrt(tan(semi_peri/2)*tan((semi_peri-arc12)/2)*tan((semi_peri-arc23)/2)*tan((semi_peri-arc31)/2)));
     937
     938        /*area = excess*radius^2 */
     939        return excess*pow((z1+z2+z3)/3,2);
     940}
     941/*}}}*/
    914942void       Tria::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){/*{{{*/
    915943        /*Computeportion of the element that is grounded*/
     
    35433571IssmDouble    Tria::OceanArea(void){ /*{{{*/
    35443572
    3545         if(IsWaterInElement()) return GetArea3D();
     3573        if(IsWaterInElement()) return GetAreaSpherical();
    35463574        else return 0;
    35473575
     
    35553583
    35563584                /*Compute area of element:*/
    3557                 area=GetArea3D();
     3585                area=GetAreaSpherical();
    35583586
    35593587                /*Average Sg over vertices:*/
     
    36583686
    36593687        /*Compute area of element:*/
    3660         area=GetArea3D();
     3688        area=GetAreaSpherical();
    36613689
    36623690        /*Compute ice thickness change: */
     
    37613789
    37623790        /*Compute area of element:*/
    3763         area=GetArea3D();
     3791        area=GetAreaSpherical();
    37643792
    37653793        /* Where is the centroid of this element?:{{{*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r20810 r20871  
    157157                IssmDouble         GetArea3D(void);
    158158                IssmDouble         GetAreaIce(void);
     159                IssmDouble         GetAreaSpherical(void);
    159160                void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
    160161                int            GetElementType(void);
  • TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp

    r20810 r20871  
    23222322                Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
    23232323                oceanarea_cpu += element->OceanArea();
    2324                 eartharea_cpu+= element->GetArea3D();
     2324                eartharea_cpu+= element->GetAreaSpherical();
    23252325        }
    23262326        ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
     
    23822382                Element* element=xDynamicCast<Element*>(elements->GetObjectByOffset(i));
    23832383                oceanarea_cpu += element->OceanArea();
    2384                 eartharea_cpu+= element->GetArea3D();
     2384                eartharea_cpu+= element->GetAreaSpherical();
    23852385        }
    23862386        ISSM_MPI_Reduce (&oceanarea_cpu,&oceanarea,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
Note: See TracChangeset for help on using the changeset viewer.