Changeset 232


Ignore:
Timestamp:
05/05/09 08:51:00 (16 years ago)
Author:
Mathieu Morlighem
Message:

Fixed Du

File:
1 edited

Legend:

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

    r205 r232  
    13691369        double obs_vx_list[numgrids];
    13701370        double obs_vy_list[numgrids];
    1371         double absolutex[numgrids];
    1372         double absolutey[numgrids];
    1373         double relativex[numgrids];
    1374         double relativey[numgrids];
    1375         double logarithmicx[numgrids];
    1376         double logarithmicy[numgrids];
     1371        double absolutex_list[numgrids];
     1372        double absolutey_list[numgrids];
     1373        double relativex_list[numgrids];
     1374        double relativey_list[numgrids];
     1375        double logarithmicx_list[numgrids];
     1376        double logarithmicy_list[numgrids];
    13771377
    13781378        /* gaussian points: */
     
    13881388        double  velocity_x,velocity_y,velocity_mag;
    13891389        double  obs_velocity_x,obs_velocity_y,obs_velocity_mag;
     1390        double  absolutex,absolutey,relativex,relativey,logarithmicx,logarithmicy;
    13901391
    13911392        /*element vector : */
     
    14321433                /*We are using an absolute misfit: */
    14331434                for (i=0;i<numgrids;i++){
    1434                         absolutex[i]=vx_list[i]-obs_vx_list[i];
    1435                         absolutey[i]=vy_list[i]-obs_vy_list[i];
     1435                        absolutex_list[i]=vx_list[i]-obs_vx_list[i];
     1436                        absolutey_list[i]=vy_list[i]-obs_vy_list[i];
    14361437                }
    14371438        }
     
    14431444                        if(obs_vx_list[i]==0)scalex=0;
    14441445                        if(obs_vy_list[i]==0)scaley=0;
    1445                         relativex[i]=scalex*(vx_list[i]-obs_vx_list[i]);
    1446                         relativey[i]=scaley*(vy_list[i]-obs_vy_list[i]);
     1446                        relativex_list[i]=scalex*(vx_list[i]-obs_vx_list[i]);
     1447                        relativey_list[i]=scaley*(vy_list[i]-obs_vy_list[i]);
    14471448                }
    14481449        }
     
    14531454                        obs_velocity_mag=sqrt(pow(obs_vx_list[i],2)+pow(obs_vy_list[i],2))+epsvel; //epsvel to avoid observed velocity being nil.
    14541455                        scale=8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
    1455                         logarithmicx[i]=scale*vx_list[i];
    1456                         logarithmicy[i]=scale*vy_list[i];
     1456                        logarithmicx_list[i]=scale*vx_list[i];
     1457                        logarithmicy_list[i]=scale*vy_list[i];
    14571458                }
    14581459        }
     
    15091510                if(fit==0){
    15101511                        /*We are using an absolute misfit: */
     1512
     1513                        /*Compute absolute(x/y) at gaussian point: */
     1514                        GetParameterValue(&absolutex, &absolutex_list[0],gauss_l1l2l3);
     1515                        GetParameterValue(&absolutey, &absolutey_list[0],gauss_l1l2l3);
     1516
     1517                        /*compute Du*/
    15111518                        for (i=0;i<numgrids;i++){
    1512                                 due_g_gaussian[i*NDOF2+0]=absolutex[i]*Jdet*gauss_weight*l1l2l3[i];
    1513                                 due_g_gaussian[i*NDOF2+1]=absolutey[i]*Jdet*gauss_weight*l1l2l3[i];
     1519                                due_g_gaussian[i*NDOF2+0]=absolutex*Jdet*gauss_weight*l1l2l3[i];
     1520                                due_g_gaussian[i*NDOF2+1]=absolutey*Jdet*gauss_weight*l1l2l3[i];
    15141521                        }
    15151522                }
    15161523                else if(fit==1){
    15171524                        /*We are using a relative misfit: */
    1518                         scalex=pow(meanvel/(obs_velocity_x+epsvel),2);
    1519                         scaley=pow(meanvel/(obs_velocity_y+epsvel),2);
    1520                         if(obs_velocity_x==0)scalex=0;
    1521                         if(obs_velocity_y==0)scaley=0;
     1525
     1526                        /*Compute relative(x/y) at gaussian point: */
     1527                        GetParameterValue(&relativex, &relativex_list[0],gauss_l1l2l3);
     1528                        GetParameterValue(&relativey, &relativey_list[0],gauss_l1l2l3);
     1529
     1530                        /*compute Du*/
    15221531                        for (i=0;i<numgrids;i++){
    1523                                 due_g_gaussian[i*NDOF2+0]=relativex[i]*Jdet*gauss_weight*l1l2l3[i];
    1524                                 due_g_gaussian[i*NDOF2+1]=relativey[i]*Jdet*gauss_weight*l1l2l3[i];
     1532                                due_g_gaussian[i*NDOF2+0]=relativex*Jdet*gauss_weight*l1l2l3[i];
     1533                                due_g_gaussian[i*NDOF2+1]=relativey*Jdet*gauss_weight*l1l2l3[i];
    15251534                        }
    15261535                }
    15271536                else if(fit==2){
    15281537                        /*We are using a logarithmic misfit: */
    1529                         velocity_mag=sqrt(pow(velocity_x,2)+pow(velocity_y,2))+epsvel; //epsvel to avoid velocity being nil.
    1530                         obs_velocity_mag=sqrt(pow(obs_velocity_x,2)+pow(obs_velocity_y,2))+epsvel; //epsvel to avoid observed velocity being nil.
    1531                         scale=8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
     1538
     1539                        /*Compute logarithmic(x/y) at gaussian point: */
     1540                        GetParameterValue(&logarithmicx, &logarithmicx_list[0],gauss_l1l2l3);
     1541                        GetParameterValue(&logarithmicy, &logarithmicy_list[0],gauss_l1l2l3);
     1542
     1543                        /*compute Du*/
    15321544                        for (i=0;i<numgrids;i++){
    1533                                 due_g_gaussian[i*NDOF2+0]=logarithmicx[i]*Jdet*gauss_weight*l1l2l3[i];
    1534                                 due_g_gaussian[i*NDOF2+1]=logarithmicy[i]*Jdet*gauss_weight*l1l2l3[i];
     1545                                due_g_gaussian[i*NDOF2+0]=logarithmicx*Jdet*gauss_weight*l1l2l3[i];
     1546                                due_g_gaussian[i*NDOF2+1]=logarithmicy*Jdet*gauss_weight*l1l2l3[i];
    15351547                        }
    15361548                }
     
    18161828
    18171829        /*element vector at the gaussian points: */
    1818         double  grade_g[numgrids];
     1830        double  grade_g[numdofs];
    18191831        double  grade_g_gaussian[numgrids];
    18201832
     
    19121924
    19131925                /*Add grade_g_gaussian to grade_g: */
    1914                 for( i=0; i<numdofs;i++)grade_g[i]+=grade_g_gaussian[i];
     1926                for( i=0; i<numgrids;i++) grade_g[i*numberofdofspernode]+=grade_g_gaussian[i];
    19151927        }
    19161928       
Note: See TracChangeset for help on using the changeset viewer.