Changeset 3509


Ignore:
Timestamp:
04/12/10 07:55:18 (15 years ago)
Author:
seroussi
Message:

fixed problems for Hutter2d

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

Legend:

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

    r3479 r3509  
    5252 
    5353        /*Compute B on the element if provided*/
    54         if (iomodel->B){
     54        if (num_vertices==3 || num_vertices==6){
     55                if (iomodel->B){
     56                        B_avg=0;
     57                        for(j=0;j<num_vertices;j++){
     58                                B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1));
     59                        }
     60                        B_avg=B_avg/num_vertices;
     61                }
     62        }
     63        else if (num_vertices==1 || num_vertices==2){
    5564                B_avg=0;
    56                 for(j=0;j<num_vertices;j++){
    57                         B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1));
     65                if (iomodel->B){
     66                        B_avg+=*(iomodel->B+i);
    5867                }
    5968                B_avg=B_avg/num_vertices;
    6069        }
     70        else ISSMERROR("num_vertices = %i not supported yet",num_vertices);
    6171       
    6272        if (iomodel->B) matice_B=B_avg;
    6373        else            matice_B=UNDEF;
    64         if (iomodel->n) matice_n=(double)*(iomodel->n+i);
     74        if (iomodel->n){
     75                if (num_vertices==3 || num_vertices==6){
     76                        matice_n=(double)*(iomodel->n+i);
     77                }
     78                else if (num_vertices==1 || num_vertices==2){
     79                        /*n is on the elements for now, so just take the first one*/
     80                        matice_n=(double)*(iomodel->n);
     81                }
     82                else ISSMERROR("num_vertices = %i not supported yet",num_vertices);
     83        }
    6584        else            matice_n=UNDEF;
    6685
  • issm/trunk/src/c/objects/Matpar.cpp

    r3463 r3509  
    3434Matpar::Matpar(IoModel* iomodel){
    3535
    36         int     matpar_mid;
    37         double  matpar_rho_ice;
    38         double  matpar_rho_water;
     36        int       matpar_mid;
     37        double  matpar_rho_ice;
     38        double  matpar_rho_water;
    3939        double  matpar_heatcapacity;
    4040        double  matpar_thermalconductivity;
     
    4646        double  matpar_g;
    4747
    48         matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials
     48        if (iomodel->analysis_type==DiagnosticAnalysisEnum() && iomodel->sub_analysis_type==HutterAnalysisEnum()){
     49                if (strcmp(iomodel->meshtype,"2d")==0){
     50                        matpar_mid=iomodel->numberofvertices+1; //put it at the end of the materials
     51                }
     52                else{ matpar_mid=iomodel->numberofvertices2d*(iomodel->numlayers-1)+1;}
     53        }
     54        else{
     55                matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials
     56        }
    4957        matpar_g=iomodel->g;
    5058        matpar_rho_ice=iomodel->rho_ice;
Note: See TracChangeset for help on using the changeset viewer.