Changeset 6969


Ignore:
Timestamp:
01/06/11 11:13:40 (14 years ago)
Author:
seroussi
Message:

update bed and surface on elements

Location:
issm/trunk/src/c/objects/Elements
Files:
2 edited

Legend:

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

    r6953 r6969  
    47374737        for(i=0;i<numdof2d;i++){
    47384738                values[i]         =solution[doflist[i]];
     4739                if(isnan(values[i])) _error_("NaN found in solution vector");
     4740                /*Constrain thickness to be at least 1m*/
     4741                if(values[i]<1) values[i]=1;
    47394742                values[i+numdof2d]=values[i];
    4740                 if(isnan(values[i])) _error_("NaN found in solution vector");
    47414743        }
    47424744
     
    47494751        surface_input->GetValuesPtr(&surface_ptr,&dummy);
    47504752
    4751         /*If shelf: hydrostatic equilibrium*/
    4752         if (this->IsOnShelf()){
    4753 
    4754                 /*Fing HydrostaticAdjustment to figure out how to update the geometry:*/
    4755                 this->parameters->FindParam(&hydroadjustment,HydrostaticAdjustmentEnum);
    4756 
    4757                 /*recover material parameters: */
    4758                 rho_ice=matpar->GetRhoIce();
    4759                 rho_water=matpar->GetRhoWater();
    4760 
    4761                 if(hydroadjustment==AbsoluteEnum){
    4762                         for(i=0;i<numdof;i++) {
    4763                                 surface[i]=values[i]*(1-rho_ice/rho_water);
    4764                                 bed[i]=-values[i]*rho_ice/rho_water;
     4753        /*Fing HydrostaticAdjustment to figure out how to update the geometry:*/
     4754        this->parameters->FindParam(&hydroadjustment,HydrostaticAdjustmentEnum);
     4755
     4756        /*recover material parameters: */
     4757        rho_ice=matpar->GetRhoIce();
     4758        rho_water=matpar->GetRhoWater();
     4759
     4760        for(i=0;i<numdof;i++) {
     4761                /*If shelf: hydrostatic equilibrium*/
     4762                if (this->nodes[i]->IsOnSheet()){
     4763                        surface[i]=bed_ptr[i]+values[i]; //surface=oldbed+newthickness
     4764                        bed[i]=bed_ptr[i]; //bed does not change
     4765                }
     4766                else{ //so it is an ice shelf
     4767                        if(hydroadjustment==AbsoluteEnum){
     4768                                        surface[i]=values[i]*(1-rho_ice/rho_water);
     4769                                        bed[i]=values[i]*(-rho_ice/rho_water);
    47654770                        }
    4766                 }
    4767                 else if(hydroadjustment==IncrementalEnum){
    4768                         for(i=0;i<numdof;i++) {
    4769                                 surface[i]=surface_ptr[i]+(1.0-rho_ice/rho_water)*(values[i]-thickness_ptr[i]); //surface = oldsurface + (1-di) * dH
    4770                                 bed[i]=bed_ptr[i]-rho_ice/rho_water*(values[i]-thickness_ptr[i]); //bed = oldbed + di * dH
     4771                        else if(hydroadjustment==IncrementalEnum){
     4772                                        surface[i]=surface_ptr[i]+(1.0-rho_ice/rho_water)*(values[i]-thickness_ptr[i]); //surface = oldsurface + (1-di) * dH
     4773                                        bed[i]=bed_ptr[i]-rho_ice/rho_water*(values[i]-thickness_ptr[i]); //bed = oldbed + di * dH
    47714774                        }
    4772                 }
    4773                 else _error_("Hydrostatic adjustment %i (%s) not supported yet",hydroadjustment,EnumToString(hydroadjustment));
    4774         }
    4775 
    4776         /*If sheet: surface = bed + thickness*/
    4777         else{
    4778                 /*Now Compute surface only*/
    4779                 for(i=0;i<numdof;i++) {
    4780                         surface[i]=bed_ptr[i]+values[i]; //surface=oldbed+newthickness
     4775                        else _error_("Hydrostatic adjustment %i (%s) not supported yet",hydroadjustment,EnumToString(hydroadjustment));
    47814776                }
    47824777        }
     
    47884783                penta->inputs->AddInput(new PentaVertexInput(ThicknessEnum,values));
    47894784                penta->inputs->AddInput(new PentaVertexInput(SurfaceEnum,surface));
    4790                 if (penta->IsOnShelf()) penta->inputs->AddInput(new PentaVertexInput(BedEnum,bed));
     4785                penta->inputs->AddInput(new PentaVertexInput(BedEnum,bed));
    47914786
    47924787                /*Stop if we have reached the surface*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r6953 r6969  
    39583958                values[i]=solution[doflist[i]];
    39593959                if(isnan(values[i])) _error_("NaN found in solution vector");
     3960                /*Constrain thickness to be at least 1m*/
     3961                if(values[i]<1) values[i]=1;
    39603962        }
    39613963
     
    39683970        surface_input->GetValuesPtr(&surface_ptr,&dummy);
    39693971
    3970         /*If shelf: hydrostatic equilibrium*/
    3971         if (this->IsOnShelf()){
    3972 
    3973                 /*Fing HydrostaticAdjustment to figure out how to update the geometry:*/
    3974                 this->parameters->FindParam(&hydroadjustment,HydrostaticAdjustmentEnum);
    3975 
    3976                 /*recover material parameters: */
    3977                 rho_ice=matpar->GetRhoIce();
    3978                 rho_water=matpar->GetRhoWater();
    3979 
    3980                 if(hydroadjustment==AbsoluteEnum){
    3981                         for(i=0;i<numdof;i++) {
     3972        /*Fing HydrostaticAdjustment to figure out how to update the geometry:*/
     3973        this->parameters->FindParam(&hydroadjustment,HydrostaticAdjustmentEnum);
     3974
     3975        /*recover material parameters: */
     3976        rho_ice=matpar->GetRhoIce();
     3977        rho_water=matpar->GetRhoWater();
     3978
     3979        for(i=0;i<numdof;i++) {
     3980                /*If shelf: hydrostatic equilibrium*/
     3981                if (this->nodes[i]->IsOnSheet()){
     3982                        surface[i]=bed_ptr[i]+values[i]; //surface=oldbed+newthickness
     3983                }
     3984                else{ //this is an ice shelf
     3985
     3986                        if(hydroadjustment==AbsoluteEnum){
    39823987                                surface[i]=values[i]*(1-rho_ice/rho_water);
    3983                                 bed[i]=-values[i]*rho_ice/rho_water;
    39843988                        }
    3985                 }
    3986                 else if(hydroadjustment==IncrementalEnum){
    3987                         for(i=0;i<numdof;i++) {
     3989                        else if(hydroadjustment==IncrementalEnum){
    39883990                                surface[i]=surface_ptr[i]+(1.0-rho_ice/rho_water)*(values[i]-thickness_ptr[i]); //surface = oldsurface + (1-di) * dH
    39893991                                bed[i]=bed_ptr[i]-rho_ice/rho_water*(values[i]-thickness_ptr[i]); //bed = oldbed + di * dH
    39903992                        }
    3991                 }
    3992                 else _error_("Hydrostatic adjustment %i (%s) not supported yet",hydroadjustment,EnumToString(hydroadjustment));
    3993         }
    3994 
    3995         /*If sheet: surface = bed + thickness*/
    3996         else{
    3997                 /*Now Compute surface only*/
    3998                 for(i=0;i<numdof;i++) {
    3999                         surface[i]=bed_ptr[i]+values[i]; //surface=oldbed+newthickness
     3993                        else _error_("Hydrostatic adjustment %i (%s) not supported yet",hydroadjustment,EnumToString(hydroadjustment));
    40003994                }
    40013995        }
Note: See TracChangeset for help on using the changeset viewer.