Changeset 4460


Ignore:
Timestamp:
07/08/10 11:02:13 (15 years ago)
Author:
Mathieu Morlighem
Message:

Began DepthAverageAtBase, to be continued

File:
1 edited

Legend:

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

    r4459 r4460  
    10741074/*FUNCTION Penta::InputDepthAverageAtBase{{{1*/
    10751075void  Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){
    1076         ISSMERROR("Not implemented yet (see Penta::InputExtrude and Node::FieldDepthAverageAtBase)");
     1076        ISSMERROR("Not implemented yet (see Node::FieldDepthAverageAtBase)");
     1077
     1078        /*Intermediaries*/
     1079        const int numvertices=6;
     1080        bool onbed;
     1081        bool onsurface;
     1082        int  i;
     1083
     1084        Penta* penta=NULL;
     1085        Input* original_input=NULL;
     1086        Input* integrated_input=NULL;
     1087        Input* element_thickness_input=NULL;
     1088        Input* total_thickness_input=NULL;
     1089        Input* depth_averaged_input=NULL;
     1090
     1091        double  xyz_list[numvertices][3];
     1092        double  Helem_list[numvertices];
     1093        double  zeros_list[numvertices]={0.0};
     1094
     1095        /*recover parameters: */
     1096        inputs->GetParameterValue(&onbed,ElementOnBedEnum);
     1097
     1098        /*Are we on the base, not on the surface?:*/
     1099        if(onbed==1){
     1100
     1101                /*OK, we are on bed. Initialize inputs*/
     1102                total_thickness_input=new PentaVertexInput(ThicknessEnum,zeros_list);
     1103                depth_averaged_input =new PentaVertexInput(average_enum_type,zeros_list);
     1104
     1105                /*Now follow all the upper element from the base to the surface to integrate the input*/
     1106                penta=this;
     1107                for(;;){
     1108
     1109                        /*Step1: Get original input (to be depth avegaged): */
     1110                        original_input=(Input*)penta->inputs->GetInput(enum_type);
     1111                        if(!original_input) ISSMERROR("%s%s"," could not find input with enum:",EnumAsString(enum_type));
     1112
     1113                        /*Step2: Create element thickness input*/
     1114                        GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);
     1115                        for(i=0;i<3;i++){
     1116                                Helem_list[i]=xyz_list[i+3][2]-xyz_list[i][2];
     1117                                Helem_list[i+3]=Helem_list[i];
     1118                        }
     1119                        element_thickness_input=new PentaVertexInput(ThicknessEnum,Helem_list);
     1120
     1121                        /*Step3: Vertically integrate original input and update totalthickness_input*/
     1122                        //integrated_input=original_input->VerticallyIntegrate(element_thickness_input); //TO BE ADDED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1123                        total_thickness_input->AXPY(element_thickness_input,1.0);
     1124
     1125                        /*Stop if we have reached the surface, else, take upper penta*/
     1126                        if (penta->IsOnSurface()){
     1127                                break;
     1128                        }
     1129                        else{
     1130                                /* get upper Penta*/
     1131                                penta=penta->GetUpperElement();
     1132                                ISSMASSERT(penta->Id()!=this->id);
     1133                        }
     1134                }
     1135
     1136                /*OK, now we only need to divide the depth integrated input by the total thickness!*/
     1137                //depth_averaged_input=integrated_input->InputPointwiseDivide(total_thickness_input);  //TO BE ADDED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1138                depth_averaged_input->ChangeEnum(average_enum_type);
     1139
     1140                /*Finally, add to inputs*/
     1141                this->inputs->AddInput((Input*)depth_averaged_input);
     1142        }
     1143
     1144        return;
    10771145}
    10781146/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.