Changeset 8611


Ignore:
Timestamp:
06/10/11 17:57:23 (14 years ago)
Author:
Mathieu Morlighem
Message:

preparing thikonov regularization in misfits

Location:
issm/trunk/src
Files:
3 edited

Legend:

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

    r8608 r8611  
    38493849double Penta::DragCoefficientAbsGradient(bool process_units,int weight_index){
    38503850
    3851         _error_("Not implemented yet");
     3851        double J;
     3852        Tria*  tria=NULL;
     3853
     3854        /*If on water, on shelf or not on bed, skip: */
     3855        if(IsOnWater()|| IsOnShelf() || !IsOnBed()) return 0;
     3856
     3857        tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria
     3858        J=tria->DragCoefficientAbsGradient(process_units,weight_index);
     3859        delete tria->matice; delete tria;
     3860        return J;
    38523861}
    38533862/*}}}*/
     
    67516760double Penta::RheologyBbarAbsGradient(bool process_units,int weight_index){
    67526761
    6753         _error_("Not implemented yet");
     6762        double J;
     6763        Tria*  tria=NULL;
     6764
     6765        /*If on water, on shelf or not on bed, skip: */
     6766        if(IsOnWater() || !IsOnBed()) return 0;
     6767
     6768        tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria
     6769        J=tria->RheologyBbarAbsGradient(process_units,weight_index);
     6770        delete tria->matice; delete tria;
     6771        return J;
    67546772}
    67556773/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r8608 r8611  
    18121812                                                pe->values[i*NDOF2+1]+=duy*weight*Jdet*gauss->weight*l1l2l3[i];
    18131813                                        }
     1814                                        break;
     1815                                case DragCoefficientAbsGradientEnum:
     1816                                        /*Nothing in P vector*/
     1817                                        break;
     1818                                case ThicknessAbsGradientEnum:
     1819                                        /*Nothing in P vector*/
     1820                                        break;
     1821                                case RheologyBbarAbsGradientEnum:
     1822                                        /*Nothing in P vector*/
    18141823                                        break;
    18151824                                default:
     
    23962405double Tria::DragCoefficientAbsGradient(bool process_units,int weight_index){
    23972406
    2398         _error_("Not implemented yet");
     2407        /* Intermediaries */
     2408        int        ig;
     2409        double     Jelem = 0;
     2410        double     weight;
     2411        double     Jdet;
     2412        double     xyz_list[NUMVERTICES][3];
     2413        double     dp[NDOF2];
     2414        GaussTria *gauss = NULL;
     2415
     2416        /*retrieve parameters and inputs*/
     2417
     2418        /*If on water, return 0: */
     2419        if(IsOnWater()) return 0;
     2420
     2421        /*Retrieve all inputs we will be needing: */
     2422        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     2423        Input* weights_input=inputs->GetInput(WeightsEnum);         _assert_(weights_input);
     2424        Input* drag_input   =inputs->GetInput(DragCoefficientEnum); _assert_(drag_input);
     2425
     2426        /* Start looping on the number of gaussian points: */
     2427        gauss=new GaussTria(2);
     2428        for (ig=gauss->begin();ig<gauss->end();ig++){
     2429
     2430                gauss->GaussPoint(ig);
     2431
     2432                /* Get Jacobian determinant: */
     2433                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     2434
     2435                /*Get all parameters at gaussian point*/
     2436                weights_input->GetParameterValue(&weight,gauss,weight_index);
     2437                drag_input->GetParameterDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
     2438
     2439                /*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */
     2440                //Jelem+=weight*1/2*(pow(dp[0],2.)+pow(dp[1],2.))*Jdet*gauss->weight;
     2441        }
     2442
     2443        /*Clean up and return*/
     2444        delete gauss;
     2445        return Jelem;
    23992446}
    24002447/*}}}*/
     
    46794726double Tria::RheologyBbarAbsGradient(bool process_units,int weight_index){
    46804727
    4681         _error_("Not implemented yet");
     4728        /* Intermediaries */
     4729        int        ig;
     4730        double     Jelem = 0;
     4731        double     weight;
     4732        double     Jdet;
     4733        double     xyz_list[NUMVERTICES][3];
     4734        double     dp[NDOF2];
     4735        GaussTria *gauss = NULL;
     4736
     4737        /*retrieve parameters and inputs*/
     4738
     4739        /*If on water, return 0: */
     4740        if(IsOnWater()) return 0;
     4741
     4742        /*Retrieve all inputs we will be needing: */
     4743        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     4744        Input* weights_input  =inputs->GetInput(WeightsEnum);              _assert_(weights_input);
     4745        Input* rheologyb_input=matice->inputs->GetInput(RheologyBbarEnum); _assert_(rheologyb_input);
     4746
     4747        /* Start looping on the number of gaussian points: */
     4748        gauss=new GaussTria(2);
     4749        for (ig=gauss->begin();ig<gauss->end();ig++){
     4750
     4751                gauss->GaussPoint(ig);
     4752
     4753                /* Get Jacobian determinant: */
     4754                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     4755
     4756                /*Get all parameters at gaussian point*/
     4757                weights_input->GetParameterValue(&weight,gauss,weight_index);
     4758                rheologyb_input->GetParameterDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
     4759
     4760                /*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */
     4761                //Jelem+=weight*1/2*(pow(dp[0],2.)+pow(dp[1],2.))*Jdet*gauss->weight;
     4762        }
     4763
     4764        /*Clean up and return*/
     4765        delete gauss;
     4766        return Jelem;
    46824767}
    46834768/*}}}*/
     
    52115296double Tria::ThicknessAbsGradient(bool process_units,int weight_index){
    52125297
    5213         _error_("Not implemented yet");
     5298        /* Intermediaries */
     5299        int        ig;
     5300        double     Jelem = 0;
     5301        double     weight;
     5302        double     Jdet;
     5303        double     xyz_list[NUMVERTICES][3];
     5304        double     dp[NDOF2];
     5305        GaussTria *gauss = NULL;
     5306
     5307        /*retrieve parameters and inputs*/
     5308
     5309        /*If on water, return 0: */
     5310        if(IsOnWater()) return 0;
     5311
     5312        /*Retrieve all inputs we will be needing: */
     5313        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     5314        Input* weights_input  =inputs->GetInput(WeightsEnum);   _assert_(weights_input);
     5315        Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
     5316
     5317        /* Start looping on the number of gaussian points: */
     5318        gauss=new GaussTria(2);
     5319        for (ig=gauss->begin();ig<gauss->end();ig++){
     5320
     5321                gauss->GaussPoint(ig);
     5322
     5323                /* Get Jacobian determinant: */
     5324                GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss);
     5325
     5326                /*Get all parameters at gaussian point*/
     5327                weights_input->GetParameterValue(&weight,gauss,weight_index);
     5328                thickness_input->GetParameterDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
     5329
     5330                /*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */
     5331                //Jelem+=weight*1/2*(pow(dp[0],2.)+pow(dp[1],2.))*Jdet*gauss->weight;
     5332        }
     5333
     5334        /*Clean up and return*/
     5335        delete gauss;
     5336        return Jelem;
    52145337}
    52155338/*}}}*/
    52165339/*FUNCTION Tria::ThicknessAbsMisfit {{{1*/
    52175340double Tria::ThicknessAbsMisfit(bool process_units,int weight_index){
    5218 
    5219         /* Constants */
    5220         const int    numdof=1*NUMVERTICES;
    52215341
    52225342        /*Intermediaries*/
     
    52335353        if(IsOnWater())return 0;
    52345354
    5235         /* Get node coordinates and dof list: */
     5355        /*Retrieve all inputs we will be needing: */
    52365356        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
    5237 
    5238         /*Retrieve all inputs we will be needing: */
    52395357        Input* thickness_input   =inputs->GetInput(ThicknessEnum);   _assert_(thickness_input);
    52405358        Input* thicknessobs_input=inputs->GetInput(ThicknessObsEnum);_assert_(thicknessobs_input);
  • issm/trunk/src/m/model/ismodelselfconsistent.m

    r8591 r8611  
    199199        checkvalues(md,{'cm_responses'},...
    200200                [SurfaceAbsVelMisfitEnum SurfaceRelVelMisfitEnum SurfaceLogVelMisfitEnum SurfaceLogVxVyMisfitEnum SurfaceAverageVelMisfitEnum...
    201                 ThicknessAbsMisfitEnum]);
     201                ThicknessAbsMisfitEnum DragCoefficientAbsGradientEnum RheologyBbarAbsGradientEnum]);
    202202
    203203        %WEIGHTS
Note: See TracChangeset for help on using the changeset viewer.