Ignore:
Timestamp:
10/11/12 11:23:47 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: cosmetics, removing all deboule blank lines and indent single white lines correctly

File:
1 edited

Legend:

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

    r13528 r13622  
    8282        this->inputs=new Inputs();
    8383        this->results=new Results();
    84        
     84
    8585        /*initialize pointers:*/
    8686        this->nodes=NULL;
     
    186186        GaussPenta* gauss=NULL;
    187187
    188 
    189188        /* Basal friction can only be found at the base of an ice sheet: */
    190189        if (!IsOnBed() || IsFloating()){
     
    199198        Input* vz_input=inputs->GetInput(VzEnum);                         _assert_(vz_input);
    200199
    201 
    202200        /*Build friction element, needed later: */
    203201        friction=new Friction("3d",inputs,matpar,DiagnosticHorizAnalysisEnum);
     
    216214                count++;
    217215        }
    218        
     216
    219217        /*Create PentaVertex input, which will hold the basal friction:*/
    220218        this->inputs->AddInput(new PentaP1Input(BasalFrictionEnum,&basalfriction[0]));
     
    257255        /*retrieve some parameters: */
    258256        this->parameters->FindParam(&stokesreconditioning,DiagnosticStokesreconditioningEnum);
    259        
     257
    260258        if(!IsOnBed()){
    261259                //put zero
     
    364362                sigma_yz[iv]=2*viscosity*epsilon[5];
    365363        }
    366        
     364
    367365        /*Add Stress tensor components into inputs*/
    368366        this->inputs->AddInput(new PentaP1Input(StressTensorxxEnum,&sigma_xx[0]));
     
    381379
    382380        int analysis_counter;
    383        
     381
    384382        /*go into parameters and get the analysis_counter: */
    385383        parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
     
    421419        _assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
    422420        /*}}}*/
    423        
     421
    424422        /*Skip if water element*/
    425423        if(IsOnWater()) return;
     
    652650
    653651        int i;
    654        
     652
    655653        _printLine_("Penta:");
    656654        _printLine_("   id: " << id);
     
    11911189/*FUNCTION Penta::Sid {{{*/
    11921190int    Penta::Sid(){
    1193        
     1191
    11941192        return sid;
    11951193
     
    12511249        /*Check that name is an element input*/
    12521250        if (!IsInput(name)) return;
    1253        
     1251
    12541252        if ((code==5) || (code==1)){ //boolean
    12551253                this->inputs->AddInput(new BoolInput(name,reCast<bool,IssmDouble>(scalar)));
     
    18731871                penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
    18741872        }
    1875        
     1873
    18761874        /*Free ressources:*/
    18771875        xDelete<int>(doflist);
     
    18971895        /*Add input to the element: */
    18981896        this->inputs->AddInput(new PentaP1Input(enum_type,values));
    1899        
     1897
    19001898        /*Free ressources:*/
    19011899        xDelete<int>(doflist);
     
    19371935                penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
    19381936        }
    1939        
     1937
    19401938        /*Free ressources:*/
    19411939        xDelete<int>(doflist);
     
    21702168        rho_ice=matpar->GetRhoIce();
    21712169        density=rho_ice/rho_water;
    2172        
     2170
    21732171        /*go through vertices, and update inputs, considering them to be PentaVertex type: */
    21742172        for(i=0;i<NUMVERTICES;i++){
     
    22112209                }
    22122210        }
    2213        
     2211
    22142212   /*Add basal melting rate if element just ungrounded*/
    22152213        if(!this->IsFloating() && elementonshelf==true){
     
    22932291        /*recover pointer: */
    22942292        count=*pcount;
    2295                
     2293
    22962294        /*will be needed later: */
    22972295        for(i=0;i<6;i++) vertices_ids[i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
     
    25022500/*FUNCTION Penta::RequestedOutput{{{*/
    25032501void Penta::RequestedOutput(int output_enum,int step,IssmDouble time){
    2504                        
     2502
    25052503        if(IsInput(output_enum)){
    25062504                /*just transfer this input to results, and we are done: */
     
    26772675        GetInputListOnVertices(&a_neg[0],SurfaceforcingsANegEnum);
    26782676        GetInputListOnVertices(&b_neg[0],SurfaceforcingsBNegEnum);
    2679        
     2677
    26802678   /*Recover surface elevatio at vertices: */
    26812679        GetInputListOnVertices(&h[0],ThicknessEnum);
     
    26852683   rho_ice=matpar->GetRhoIce();
    26862684   rho_water=matpar->GetRhoFreshwater();
    2687                        
     2685
    26882686   // loop over all vertices
    26892687 for(i=0;i<NUMVERTICES;i++){
     
    27912789        minz=xyz_list[0][2];
    27922790        maxz=xyz_list[0][2];
    2793        
     2791
    27942792        for(i=1;i<NUMVERTICES;i++){
    27952793                if (xyz_list[i][0]<minx)minx=xyz_list[i][0];
     
    29732971                if (reCast<bool,IssmDouble>(vertices_potentially_ungrounding[nodes[i]->Sid()])){
    29742972                        vec_nodes_on_iceshelf->SetValue(nodes[i]->Sid(),1,INS_VAL);
    2975                
     2973
    29762974                        /*If node was not on ice shelf, we flipped*/
    29772975                        if(nodes_on_iceshelf[nodes[i]->Sid()]==0){
     
    30133011        for (int iv=0;iv<NUMVERTICES;iv++){
    30143012                gauss->GaussVertex(iv);
    3015                
     3013
    30163014                thickness_input->GetInputValue(&thickness,gauss);
    30173015
     
    30193017                material->GetViscosity3dStokes(&viscosity,&epsilon[0]);
    30203018                GetPhi(&phi, &epsilon[0], viscosity);
    3021                
    30223019
    30233020                viscousheating[iv]=phi*thickness;
     
    32743271
    32753272        if(IsOnWater() || !IsOnSurface()) return 0.;
    3276        
     3273
    32773274        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
    32783275
     
    32863283        smb_input->GetInputAverage(&smb);
    32873284        Total_Smb=rho_ice*base*smb;// smb on element in kg s-1
    3288        
     3285
    32893286        /*Process units: */
    32903287        Total_Smb=UnitConversion(Total_Smb,IuToExtEnum,TotalSmbEnum);// smb on element in GigaTon yr-1
    3291        
     3288
    32923289        /*Return: */
    32933290        return Total_Smb;
     
    32993296/*FUNCTION Penta::CreateKMatrixEnthalpy {{{*/
    33003297ElementMatrix* Penta::CreateKMatrixEnthalpy(void){
    3301        
     3298
    33023299        /*compute all stiffness matrices for this element*/
    33033300        ElementMatrix* Ke1=CreateKMatrixEnthalpyVolume();
    33043301        ElementMatrix* Ke2=CreateKMatrixEnthalpyShelf();
    33053302        ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
    3306        
     3303
    33073304        /*clean-up and return*/
    33083305        delete Ke1;
     
    35043501
    35053502                gauss->GaussPoint(ig);
    3506                
     3503
    35073504                GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
    35083505                GetNodalFunctionsP1(&basis[0], gauss);
    3509                                
     3506
    35103507                D_scalar=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity/(rho_ice*heatcapacity);
    35113508                if(reCast<bool,IssmDouble>(dt)) D_scalar=dt*D_scalar;
     
    35163513                                        &Ke->values[0],1);
    35173514        }
    3518        
     3515
    35193516        /*Clean up and return*/
    35203517        delete gauss;
     
    35363533/*FUNCTION Penta::CreateKMatrixThermal {{{*/
    35373534ElementMatrix* Penta::CreateKMatrixThermal(void){
    3538        
     3535
    35393536        /*compute all stiffness matrices for this element*/
    35403537        ElementMatrix* Ke1=CreateKMatrixThermalVolume();
    35413538        ElementMatrix* Ke2=CreateKMatrixThermalShelf();
    35423539        ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
    3543        
     3540
    35443541        /*clean-up and return*/
    35453542        delete Ke1;
     
    37033700ElementMatrix* Penta::CreateKMatrixThermalShelf(void){
    37043701
    3705 
    37063702        /*Constants*/
    37073703        const int    numdof=NDOF1*NUMVERTICES;
     
    37373733
    37383734                gauss->GaussPoint(ig);
    3739                
     3735
    37403736                GetTriaJacobianDeterminant(&Jdet2d, &xyz_list_tria[0][0], gauss);
    37413737                GetNodalFunctionsP1(&basis[0], gauss);
    3742                                
     3738
    37433739                D_scalar=gauss->weight*Jdet2d*rho_water*mixed_layer_capacity*thermal_exchange_velocity/(heatcapacity*rho_ice);
    37443740                if(reCast<bool,IssmDouble>(dt)) D_scalar=dt*D_scalar;
     
    37493745                                        &Ke->values[0],1);
    37503746        }
    3751        
     3747
    37523748        /*Clean up and return*/
    37533749        delete gauss;
     
    44094405        GetInputListOnVertices(&pressure[0],PressureEnum);
    44104406        Input* surface_input=inputs->GetInput(SurfaceEnum); _assert_(surface_input);
    4411        
     4407
    44124408        this->inputs->GetInputValue(&converged,ConvergedEnum);
    44134409        if(converged){
     
    44184414                        //if(waterfraction[i]>1) _error_("Water fraction >1 found in solution vector");
    44194415                }
    4420                        
     4416
    44214417                this->inputs->AddInput(new PentaP1Input(EnthalpyEnum,values));
    44224418                this->inputs->AddInput(new PentaP1Input(WaterfractionEnum,waterfraction));
     
    44734469                input=(Input*)material->inputs->GetInput(MaterialsRheologyZEnum);
    44744470        }
    4475                
     4471
    44764472        else{
    44774473                input=inputs->GetInput(enum_type);
     
    55335529        new_input = new PentaP1Input(control_enum,values);
    55345530
    5535 
    55365531        if(control_enum==MaterialsRheologyBbarEnum){
    55375532                input=(Input*)material->inputs->GetInput(control_enum); _assert_(input);
     
    55535548/*FUNCTION Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
    55545549void  Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
    5555        
     5550
    55565551        int i,j;
    55575552
     
    55805575                                        IssmDouble  surface[6];
    55815576                                        IssmDouble  bed[6];
    5582                                        
     5577
    55835578                                        /*retrieve inputs: */
    55845579                                        GetInputListOnVertices(&thickness_init[0],ThicknessEnum);
     
    56655660/*FUNCTION Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/
    56665661void  Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){
    5667        
     5662
    56685663        int i,j,t;
    56695664        TransientInput* transientinput=NULL;
     
    56795674
    56805675                case VertexEnum:
    5681                        
     5676
    56825677                        /*Create transient input: */
    5683                                                
     5678
    56845679                        parameters->FindParam(&yts,ConstantsYtsEnum);
    56855680
     
    57525747/*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattyn{{{*/
    57535748ElementMatrix* Penta::CreateKMatrixCouplingMacAyealPattyn(void){
    5754        
     5749
    57555750        /*compute all stiffness matrices for this element*/
    57565751        ElementMatrix* Ke1=CreateKMatrixCouplingMacAyealPattynViscous();
    57575752        ElementMatrix* Ke2=CreateKMatrixCouplingMacAyealPattynFriction();
    57585753        ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
    5759        
     5754
    57605755        /*clean-up and return*/
    57615756        delete Ke1;
     
    58645859        const int numdof      = NDOF2 *NUMVERTICES;
    58655860        const int numdoftotal = NDOF4 *NUMVERTICES;
    5866        
     5861
    58675862        /*Intermediaries */
    58685863        int       i,j,ig,analysis_type;
     
    59335928                DL_scalar=alpha2*gauss->weight*Jdet2d;
    59345929                for (i=0;i<2;i++) DL[i][i]=DL_scalar;
    5935                
     5930
    59365931                /*  Do the triple producte tL*D*L: */
    59375932                TripleMultiply( &L[0][0],2,numdof,1,
     
    61656160                DLStokesMacAyeal[2][2]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[0]*bed_normal[2];
    61666161                DLStokesMacAyeal[3][3]=-alpha2_gauss*gauss->weight*Jdet2d*bed_normal[1]*bed_normal[2];
    6167                
     6162
    61686163                TripleMultiply( &LMacAyealStokes[0][0],8,numdof2dm,1,
    61696164                                        &DLMacAyealStokes[0][0],8,8,0,
     
    67006695        /*Constants*/
    67016696        const int numdof   = NDOF2*NUMVERTICES;
    6702        
     6697
    67036698        /*Intermediaries */
    67046699        int       i,j,ig;
     
    67516746                        alpha2=pow((IssmDouble)10,MOUNTAINKEXPONENT);
    67526747                }
    6753                
     6748
    67546749                DL_scalar=alpha2*gauss->weight*Jdet;
    67556750                for (i=0;i<2;i++) DL[i][i]=DL_scalar;
    6756                
     6751
    67576752                TripleMultiply( &L[0][0],2,numdof,1,
    67586753                                        &DL[0][0],2,2,0,
     
    69266921        /*DO NOT Transform Coordinate System: this stiffness matrix is already expressed in tangential coordinates*/
    69276922        //TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYZPEnum);
    6928        
     6923
    69296924        /*Clean up and return*/
    69306925        delete gauss;
     
    69356930/*FUNCTION Penta::CreateKMatrixDiagnosticVert {{{*/
    69366931ElementMatrix* Penta::CreateKMatrixDiagnosticVert(void){
    6937        
     6932
    69386933        /*compute all stiffness matrices for this element*/
    69396934        ElementMatrix* Ke1=CreateKMatrixDiagnosticVertVolume();
     
    78167811ElementVector* Penta::CreatePVectorDiagnosticVertBase(void){
    78177812
    7818 
    78197813        /*Constants*/
    78207814        const int    numdof=NDOF1*NUMVERTICES;
     
    84158409                penta=penta->GetUpperElement(); _assert_(penta->Id()!=this->id);
    84168410        }
    8417        
     8411
    84188412        /*Free ressources:*/
    84198413        xDelete<int>(doflist);
     
    86878681/*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattyn {{{*/
    86888682void  Penta::InputUpdateFromSolutionDiagnosticPattyn(IssmDouble* solution){
    8689        
     8683
    86908684        const int    numdof=NDOF2*NUMVERTICES;
    86918685
     
    88558849/*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{*/
    88568850void  Penta::InputUpdateFromSolutionDiagnosticHutter(IssmDouble* solution){
    8857        
     8851
    88588852        const int    numdof=NDOF2*NUMVERTICES;
    88598853
     
    89208914
    89218915        const int numdof=NDOF1*NUMVERTICES;
    8922        
     8916
    89238917        int      i;
    89248918        int      approximation;
     
    89378931        int*     doflist      = NULL;
    89388932
    8939 
    89408933        /*Get the approximation and do nothing if the element in Stokes or None*/
    89418934        inputs->GetInputValue(&approximation,ApproximationEnum);
     
    90229015/*FUNCTION Penta::InputUpdateFromSolutionDiagnosticStokes {{{*/
    90239016void  Penta::InputUpdateFromSolutionDiagnosticStokes(IssmDouble* solution){
    9024        
     9017
    90259018        const int numdof=NDOF4*NUMVERTICES;
    90269019
     
    90629055        for(i=0;i<NUMVERTICES;i++) pressure[i]=pressure[i]*stokesreconditioning;
    90639056        for(i=0;i<NUMVERTICES;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
    9064        
     9057
    90659058        /*Now, we have to move the previous inputs  to old
    90669059         * status, otherwise, we'll wipe them off: */
     
    91329125/*}}}*/
    91339126#endif
    9134 
Note: See TracChangeset for help on using the changeset viewer.