Changeset 24368


Ignore:
Timestamp:
11/20/19 09:58:23 (5 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added GL flux to 3d models

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r24356 r24368  
    19281928        /*Clean up and return*/
    19291929        return groundedarea;
     1930}
     1931/*}}}*/
     1932IssmDouble Penta::GroundinglineMassFlux(bool scaled){/*{{{*/
     1933
     1934        /*Make sure there is a grounding line here*/
     1935        if(!IsOnBase()) return 0;
     1936        if(!IsIceInElement()) return 0;
     1937        if(!IsZeroLevelset(MaskGroundediceLevelsetEnum)) return 0;
     1938
     1939        /*Scaled not implemented yet...*/
     1940        _assert_(!scaled);
     1941
     1942        int               domaintype,index1,index2;
     1943        const IssmPDouble epsilon = 1.e-15;
     1944        IssmDouble        s1,s2;
     1945        IssmDouble        gl[NUMVERTICES];
     1946        IssmDouble        xyz_front[2][3];
     1947
     1948        IssmDouble *xyz_list = NULL;
     1949        this->GetVerticesCoordinates(&xyz_list);
     1950
     1951        /*Recover parameters and values*/
     1952        GetInputListOnVertices(&gl[0],MaskGroundediceLevelsetEnum);
     1953
     1954        /*Be sure that values are not zero*/
     1955        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     1956        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     1957        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
     1958
     1959        int pt1 = 0;
     1960        int pt2 = 1;
     1961        if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
     1962
     1963                /*Portion of the segments*/
     1964                s1=gl[2]/(gl[2]-gl[1]);
     1965                s2=gl[2]/(gl[2]-gl[0]);
     1966                if(gl[2]<0.){
     1967                        pt1 = 1; pt2 = 0;
     1968                }
     1969                xyz_front[pt2][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
     1970                xyz_front[pt2][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
     1971                xyz_front[pt2][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
     1972                xyz_front[pt1][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
     1973                xyz_front[pt1][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
     1974                xyz_front[pt1][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
     1975        }
     1976        else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
     1977
     1978                /*Portion of the segments*/
     1979                s1=gl[0]/(gl[0]-gl[1]);
     1980                s2=gl[0]/(gl[0]-gl[2]);
     1981                if(gl[0]<0.){
     1982                        pt1 = 1; pt2 = 0;
     1983                }
     1984
     1985                xyz_front[pt1][0]=xyz_list[3*0+0]+s1*(xyz_list[3*1+0]-xyz_list[3*0+0]);
     1986                xyz_front[pt1][1]=xyz_list[3*0+1]+s1*(xyz_list[3*1+1]-xyz_list[3*0+1]);
     1987                xyz_front[pt1][2]=xyz_list[3*0+2]+s1*(xyz_list[3*1+2]-xyz_list[3*0+2]);
     1988                xyz_front[pt2][0]=xyz_list[3*0+0]+s2*(xyz_list[3*2+0]-xyz_list[3*0+0]);
     1989                xyz_front[pt2][1]=xyz_list[3*0+1]+s2*(xyz_list[3*2+1]-xyz_list[3*0+1]);
     1990                xyz_front[pt2][2]=xyz_list[3*0+2]+s2*(xyz_list[3*2+2]-xyz_list[3*0+2]);
     1991        }
     1992        else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
     1993
     1994                /*Portion of the segments*/
     1995                s1=gl[1]/(gl[1]-gl[0]);
     1996                s2=gl[1]/(gl[1]-gl[2]);
     1997                if(gl[1]<0.){
     1998                        pt1 = 1; pt2 = 0;
     1999                }
     2000
     2001                xyz_front[pt2][0]=xyz_list[3*1+0]+s1*(xyz_list[3*0+0]-xyz_list[3*1+0]);
     2002                xyz_front[pt2][1]=xyz_list[3*1+1]+s1*(xyz_list[3*0+1]-xyz_list[3*1+1]);
     2003                xyz_front[pt2][2]=xyz_list[3*1+2]+s1*(xyz_list[3*0+2]-xyz_list[3*1+2]);
     2004                xyz_front[pt1][0]=xyz_list[3*1+0]+s2*(xyz_list[3*2+0]-xyz_list[3*1+0]);
     2005                xyz_front[pt1][1]=xyz_list[3*1+1]+s2*(xyz_list[3*2+1]-xyz_list[3*1+1]);
     2006                xyz_front[pt1][2]=xyz_list[3*1+2]+s2*(xyz_list[3*2+2]-xyz_list[3*1+2]);
     2007        }
     2008        else{
     2009                _error_("case not possible");
     2010        }
     2011
     2012
     2013        /*Some checks in debugging mode*/
     2014        _assert_(s1>=0 && s1<=1.);
     2015        _assert_(s2>=0 && s2<=1.);
     2016
     2017        /*Get normal vector*/
     2018        IssmDouble normal[3];
     2019        this->NormalSectionBase(&normal[0],&xyz_front[0][0]);
     2020        normal[0] = -normal[0];
     2021        normal[1] = -normal[1];
     2022
     2023        this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
     2024        this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
     2025
     2026        /*Get inputs*/
     2027        IssmDouble flux = 0.;
     2028        IssmDouble vx,vy,thickness,Jdet;
     2029        IssmDouble rho_ice=FindParam(MaterialsRhoIceEnum);
     2030        Input2 *thickness_input = this->GetInput2(ThicknessEnum); _assert_(thickness_input);
     2031        Input2 *vx_input        = this->GetInput2(VxAverageEnum); _assert_(vx_input);
     2032        Input2 *vy_input        = this->GetInput2(VyAverageEnum); _assert_(vy_input);
     2033
     2034        /*Start looping on Gaussian points*/
     2035        Gauss* gauss=this->NewGaussBase(xyz_list,&xyz_front[0][0],3);
     2036        for(int ig=gauss->begin();ig<gauss->end();ig++){
     2037
     2038                gauss->GaussPoint(ig);
     2039                thickness_input->GetInputValue(&thickness,gauss);
     2040                vx_input->GetInputValue(&vx,gauss);
     2041                vy_input->GetInputValue(&vy,gauss);
     2042                this->JacobianDeterminantLine(&Jdet,&xyz_front[0][0],gauss);
     2043
     2044                flux += rho_ice*Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1]);
     2045        }
     2046
     2047        /*Clean up and return*/
     2048        delete gauss;
     2049        return flux;
     2050
    19302051}
    19312052/*}}}*/
  • issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r24335 r24368  
    104104                void           GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
    105105                IssmDouble     GroundedArea(bool scaled);
     106                IssmDouble     GroundinglineMassFlux(bool scaled);
    106107                IssmDouble              IcefrontMassFluxLevelset(bool scaled);
    107108                IssmDouble     IceVolume(bool scaled);
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r24366 r24368  
    28722872IssmDouble Tria::GroundinglineMassFlux(bool scaled){/*{{{*/
    28732873
    2874         /*Make sure there is an ice front here*/
     2874        /*Make sure there is a grounding line here*/
    28752875        if(!IsIceInElement()) return 0;
    28762876        if(!IsZeroLevelset(MaskGroundediceLevelsetEnum)) return 0;
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r24355 r24368  
    16201620}/*}}}*/
    16211621void FemModel::GroundinglineMassFluxx(IssmDouble* pM, bool scaled){/*{{{*/
     1622
     1623        /*First we need to depth average the velocities*/
     1624        int domaintype;
     1625        this->parameters->FindParam(&domaintype,DomainTypeEnum);
     1626        this->parameters->SetParam(VxEnum,InputToDepthaverageInEnum);
     1627        this->parameters->SetParam(VxAverageEnum,InputToDepthaverageOutEnum);
     1628        depthaverage_core(this);
     1629        if(domaintype!=Domain2DverticalEnum){
     1630                this->parameters->SetParam(VyEnum,InputToDepthaverageInEnum);
     1631                this->parameters->SetParam(VyAverageEnum,InputToDepthaverageOutEnum);
     1632                depthaverage_core(this);
     1633        }
    16221634
    16231635        IssmDouble local_mass_flux = 0;
Note: See TracChangeset for help on using the changeset viewer.