source:
issm/oecreview/Archive/17984-18295/ISSM-18223-18224.diff@
18296
Last change on this file since 18296 was 18296, checked in by , 11 years ago | |
---|---|
File size: 3.9 KB |
-
../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp
47 47 48 48 /*Intermediaries */ 49 49 int num_responses,i; 50 IssmDouble hobs,hu2,weight,NUMx,NUMy,DEN,Jdet; 51 IssmDouble vx,vy,vbar2,nux,nuy,phi,dphi[2]; 50 IssmDouble hobs,hu2,weight,Jdet; 51 IssmDouble NUMxH2,NUMyH2,DENH2; 52 IssmDouble NUMxUbar,NUMyUbar,DENUbar; 53 IssmDouble vxobs,vyobs,vxobsbar,vyobsbar,vbarobs2,vbarobs; 54 IssmDouble nux,nuy,phi,dphi[2]; 52 55 int *responses = NULL; 53 56 IssmDouble *xyz_list = NULL; 54 57 … … 67 70 Input* thicknessobs_input = element->GetInput(InversionThicknessObsEnum); _assert_(thicknessobs_input); 68 71 Input* weights_input = element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input); 69 72 Input* potential_input = element->GetInput(PotentialEnum); _assert_(potential_input); 70 Input* vx _input = element->GetInput(BalancethicknessVxObsEnum); _assert_(vx_input);71 Input* vy _input = element->GetInput(BalancethicknessVyObsEnum); _assert_(vy_input);73 Input* vxobs_input = element->GetInput(BalancethicknessVxObsEnum); _assert_(vxobs_input); 74 Input* vyobs_input = element->GetInput(BalancethicknessVyObsEnum); _assert_(vyobs_input); 72 75 Input* nux_input = element->GetInput(BalancethicknessNuxEnum); _assert_(nux_input); 73 76 Input* nuy_input = element->GetInput(BalancethicknessNuyEnum); _assert_(nuy_input); 74 77 … … 81 84 element->NodalFunctions(basis,gauss); 82 85 element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss); 83 86 84 vx _input->GetInputValue(&vx,gauss);85 vy _input->GetInputValue(&vy,gauss);87 vxobs_input->GetInputValue(&vxobs,gauss); 88 vyobs_input->GetInputValue(&vyobs,gauss); 86 89 nux_input->GetInputValue(&nux,gauss); 87 90 nuy_input->GetInputValue(&nuy,gauss); 88 91 potential_input->GetInputValue(&phi,gauss); 89 92 potential_input->GetInputDerivativeValue(&dphi[0],xyz_list,gauss); 90 93 thicknessobs_input->GetInputValue(&hobs,gauss); 91 94 92 v bar2 = (nux*nux*vx*vx + nuy*nuy*vy*vy);93 hu2 = hobs*hobs*vbar2;95 vxobsbar = nux*vxobs; 96 vyobsbar = nuy*vyobs; 94 97 95 NUMx = 2.*dbasis[0]*dphi[0]*(dphi[0]*dphi[0] + dphi[1]*dphi[1] - hu2);96 NUMy = 2.*dbasis[1]*dphi[1]*(dphi[0]*dphi[0] + dphi[1]*dphi[1] - hu2);97 DEN = vbar2*vbar2+1.e-14;98 vbarobs2 = (nux*nux*vxobs*vxobs + nuy*nuy*vyobs*vyobs); 99 vbarobs = sqrt(vbarobs2); 100 hu2 = hobs*hobs*vbarobs2; 98 101 102 /*H^2 - Hobs^2*/ 103 NUMxH2 = 2.*dbasis[0]*dphi[0]*(dphi[0]*dphi[0] + dphi[1]*dphi[1] - hu2); 104 NUMyH2 = 2.*dbasis[1]*dphi[1]*(dphi[0]*dphi[0] + dphi[1]*dphi[1] - hu2); 105 DENH2 = vbarobs2*vbarobs2+1.e-14; 106 107 /*Ubar-Ubar_obs*/ 108 NUMxUbar = (vyobsbar*dphi[0]*dphi[1] - vxobsbar*dphi[1]*dphi[1])*vbarobs*dbasis[0]; 109 NUMyUbar = (vyobsbar*dphi[0]*dphi[0] - vxobsbar*dphi[0]*dphi[1])*vbarobs*dbasis[1]; 110 DENUbar = pow(dphi[0]*dphi[0] + dphi[1]*dphi[1],3./2.)+1.e-14; 111 99 112 /*Loop over all requested responses*/ 100 113 for(int resp=0;resp<num_responses;resp++){ 101 114 weights_input->GetInputValue(&weight,gauss,responses[resp]); 102 115 103 116 switch(responses[resp]){ 104 117 case Balancethickness2MisfitEnum: 105 //for(i=0;i<numnodes;i++) pe->values[i]+=(NUMx+NUMy)/DEN *weight*Jdet*gauss->weight; 106 for(i=0;i<numnodes;i++) pe->values[i]+= phi*basis[i]*weight*Jdet*gauss->weight; 118 /*J = (H^2 - Hobs^2)^2*/ 119 //for(i=0;i<numnodes;i++) pe->values[i]+=(NUMxH2+NUMyH2)/DENH2 *weight*Jdet*gauss->weight; NOT WORKING 120 /*J = phi^2*/ 121 //for(i=0;i<numnodes;i++) pe->values[i]+= phi*basis[i]*weight*Jdet*gauss->weight; OK 122 /*J = (ubar - nux*uobs)^2*/ 123 for(i=0;i<numnodes;i++) pe->values[i]+=(NUMxUbar-NUMyUbar)/DENUbar *weight*Jdet*gauss->weight; 107 124 break; 108 125 default: 109 126 _error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
Note:
See TracBrowser
for help on using the repository browser.