Changeset 205
- Timestamp:
- 05/04/09 10:55:32 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Tria.cpp
r202 r205 663 663 GetParameterValue(&alpha2, &alpha2_list[0],gauss_l1l2l3); 664 664 665 if (velocity_param){ 666 DL_scalar=alpha2*gauss_weight*Jdet; 667 } 668 else{ 669 DL_scalar=0; 670 } 671 665 DL_scalar=alpha2*gauss_weight*Jdet; 672 666 for (i=0;i<2;i++){ 673 667 DL[i][i]=DL_scalar; … … 922 916 B_param=ParameterInputsRecover(inputs,"B"); 923 917 if(temperature_average_param){ 918 temperature_average-0; 924 919 for(i=0;i<3;i++) temperature_average+=temperature_average_param[doflist[i*numberofdofspernode+0]]; 925 920 temperature_average=temperature_average/3.0; … … 1374 1369 double obs_vx_list[numgrids]; 1375 1370 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]; 1376 1377 1377 1378 /* gaussian points: */ … … 1399 1400 1400 1401 /*relative and algorithmic fitting: */ 1401 double meanvel=0; 1402 double epsvel=0; 1403 double scalex=1; 1404 double scaley=1; 1402 double scalex=0; 1403 double scaley=0; 1405 1404 double scale=0; 1406 1405 double* fit_param=NULL; … … 1427 1426 obs_vx_list[i]=obs_velocity[doflist[i*numberofdofspernode+0]]; 1428 1427 obs_vy_list[i]=obs_velocity[doflist[i*numberofdofspernode+1]]; 1429 1430 } 1431 1428 } 1429 1430 /*Get Du at the 3 nodes (integration of the linearized function)*/ 1431 if(fit==0){ 1432 /*We are using an absolute misfit: */ 1433 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]; 1436 } 1437 } 1438 else if(fit==1){ 1439 /*We are using a relative misfit: */ 1440 for (i=0;i<numgrids;i++){ 1441 scalex=pow(meanvel/(obs_vx_list[i]+epsvel),2); 1442 scaley=pow(meanvel/(obs_vy_list[i]+epsvel),2); 1443 if(obs_vx_list[i]==0)scalex=0; 1444 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]); 1447 } 1448 } 1449 else if(fit==2){ 1450 /*We are using a logarithmic misfit: */ 1451 for (i=0;i<numgrids;i++){ 1452 velocity_mag=sqrt(pow(vx_list[i],2)+pow(vy_list[i],2))+epsvel; //epsvel to avoid velocity being nil. 1453 obs_velocity_mag=sqrt(pow(obs_vx_list[i],2)+pow(obs_vy_list[i],2))+epsvel; //epsvel to avoid observed velocity being nil. 1454 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]; 1457 } 1458 } 1459 else{ 1460 /*Not supported yet! : */ 1461 throw ErrorException(__FUNCT__,exprintf("%s%g","unsupported type of fit: ",fit)); 1462 } 1432 1463 1433 1464 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 1479 1510 /*We are using an absolute misfit: */ 1480 1511 for (i=0;i<numgrids;i++){ 1481 due_g_gaussian[i*NDOF2+0]= (velocity_x-obs_velocity_x)*Jdet*gauss_weight*l1l2l3[i];1482 due_g_gaussian[i*NDOF2+1]= (velocity_y-obs_velocity_y)*Jdet*gauss_weight*l1l2l3[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]; 1483 1514 } 1484 1515 } … … 1490 1521 if(obs_velocity_y==0)scaley=0; 1491 1522 for (i=0;i<numgrids;i++){ 1492 due_g_gaussian[i*NDOF2+0]= scalex*(velocity_x-obs_velocity_x)*Jdet*gauss_weight*l1l2l3[i];1493 due_g_gaussian[i*NDOF2+1]= scaley*(velocity_y-obs_velocity_y)*Jdet*gauss_weight*l1l2l3[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]; 1494 1525 } 1495 1526 } 1496 1527 else if(fit==2){ 1497 1498 1528 /*We are using a logarithmic misfit: */ 1499 1529 velocity_mag=sqrt(pow(velocity_x,2)+pow(velocity_y,2))+epsvel; //epsvel to avoid velocity being nil. … … 1501 1531 scale=8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag); 1502 1532 for (i=0;i<numgrids;i++){ 1503 due_g_gaussian[i*NDOF2+0]= scale*velocity_x*Jdet*gauss_weight*l1l2l3[i];1504 due_g_gaussian[i*NDOF2+1]= scale*velocity_y*Jdet*gauss_weight*l1l2l3[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]; 1505 1535 } 1506 1536 } … … 1510 1540 } 1511 1541 1512 1513 1542 /*Add due_g_gaussian vector to due_g: */ 1514 1543 for( i=0; i<numdofs; i++){ … … 1516 1545 } 1517 1546 } 1518 1519 1547 1520 1548 /*Add due_g to global vector du_g: */ … … 2127 2155 &Ke_gg_gaussian[0][0],0); 2128 2156 2157 2129 2158 /* Add the Ke_gg_gaussian, and optionally Ke_gg_drag_gaussian onto Ke_gg: */ 2130 2159 for( i=0; i<numdofs; i++) for(j=0;j<numdofs;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j]; … … 2356 2385 /*Get bed slope: */ 2357 2386 GetParameterDerivativeValue(&slope[0], &b[0],&xyz_list[0][0], gauss_l1l2l3); 2358 dbdx= slope[0];2359 dbdy= slope[1];2387 dbdx=-slope[0]; 2388 dbdy=-slope[1]; 2360 2389 2361 2390 /* Get Jacobian determinant: */
Note:
See TracChangeset
for help on using the changeset viewer.