Changeset 24490


Ignore:
Timestamp:
12/20/19 14:32:04 (5 years ago)
Author:
tsantos
Message:

CHG: added thickness average method for Discontinuous Galerkin (stabilization in Mass Transport Analysis). Not totally tested, just keeping the code

Location:
issm/trunk-jpl/src/c
Files:
3 edited

Legend:

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

    r24484 r24490  
    27612761}
    27622762/*}}}*/
     2763void FemModel::ThicknessAverage(){/*{{{*/
     2764   
     2765        int elementswidth                   = this->GetElementsWidth();//just 2D mesh, tria elements
     2766   int numberofvertices                = this->vertices->NumberOfVertices();//total number of vertices
     2767
     2768   IssmDouble weight                   = 0.;
     2769   IssmDouble* totalweight             = NULL;
     2770        IssmDouble* Hserial                                             = NULL;
     2771   IssmDouble* H                       = xNew<IssmDouble>(elementswidth);
     2772   Vector<IssmDouble>* vecH                             = new Vector<IssmDouble>(numberofvertices);
     2773   Vector<IssmDouble>* vectotalweight  = new Vector<IssmDouble>(numberofvertices);
     2774
     2775   for(int i=0;i<this->elements->Size();i++){
     2776      Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
     2777     
     2778                /*check if there is ice in this element*/
     2779                if(!element->IsIceInElement()) continue; 
     2780       
     2781                /*get H on the vertices*/
     2782                element->GetInputListOnVertices(H,ThicknessEnum);
     2783
     2784      /*weight to calculate the smoothed H*/
     2785      weight=1.;//simple average
     2786
     2787                /*add in the serial vector*/
     2788      vecH->SetValue(element->vertices[0]->Sid(),weight*H[0],ADD_VAL);
     2789      vecH->SetValue(element->vertices[1]->Sid(),weight*H[1],ADD_VAL);
     2790      vecH->SetValue(element->vertices[2]->Sid(),weight*H[2],ADD_VAL);
     2791      /*total weight*/
     2792      vectotalweight->SetValue(element->vertices[0]->Sid(),weight,ADD_VAL);
     2793      vectotalweight->SetValue(element->vertices[1]->Sid(),weight,ADD_VAL);
     2794      vectotalweight->SetValue(element->vertices[2]->Sid(),weight,ADD_VAL);
     2795   }
     2796
     2797   /*Assemble and serialize*/
     2798   vecH->Assemble();
     2799   vectotalweight->Assemble();
     2800   Hserial=vecH->ToMPISerial();
     2801   totalweight=vectotalweight->ToMPISerial();
     2802
     2803   /*Divide for the total weight*/
     2804   for(int i=0;i<numberofvertices;i++){
     2805      _assert_(totalweight[i]>0);
     2806      Hserial[i]=Hserial[i]/totalweight[i];
     2807   }
     2808
     2809   /*Set element inputs*/
     2810   for(int i=0;i<this->elements->Size();i++){
     2811      Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
     2812                H[0]=Hserial[element->vertices[0]->Sid()];
     2813                H[1]=Hserial[element->vertices[1]->Sid()];
     2814                H[2]=Hserial[element->vertices[2]->Sid()];
     2815                element->AddInput2(ThicknessEnum,H,P1Enum);
     2816        }
     2817
     2818        /*Cleanup*/
     2819   delete vecH;
     2820   delete vectotalweight;
     2821   xDelete<IssmDouble>(H);
     2822   xDelete<IssmDouble>(Hserial);
     2823   xDelete<IssmDouble>(totalweight);
     2824}
     2825/*}}}*/
    27632826void FemModel::ThicknessPositivex(IssmDouble* pJ){/*{{{*/
    27642827
  • issm/trunk-jpl/src/c/classes/FemModel.h

    r24340 r24490  
    151151                void OmegaAbsGradientx( IssmDouble* pJ);
    152152                void EtaDiffx( IssmDouble* pJ);
     153                void ThicknessAverage();
    153154                void ThicknessAbsGradientx( IssmDouble* pJ);
    154155                void ThicknessPositivex(IssmDouble* pJ);
  • issm/trunk-jpl/src/c/cores/masstransport_core.cpp

    r24335 r24490  
    7070                else{
    7171                        solutionsequence_linear(femmodel);
     72                        // ThicknessAverage: method not totally tested
     73                        //if(stabilization==3){
     74                        //      if(VerboseSolution()) _printf0_("   call thickness average core\n");
     75                        //      femmodel->ThicknessAverage();
     76                        //}
    7277                }
    7378                femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
Note: See TracChangeset for help on using the changeset viewer.