Changeset 23290


Ignore:
Timestamp:
09/15/18 19:56:48 (7 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added codi test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/test/NightlyRun/test3015.m

    r21925 r23290  
    1515%setup autodiff parameters
    1616index=1; %this is the scalar component we are checking against
    17 md.autodiff.independents={...
    18         independent('name','md.geometry.thickness','type','vertex','nods',md.mesh.numberofvertices,'fos_forward_index',index)
     17
     18if IssmConfig('_HAVE_CODIPACK_')
     19        md.autodiff.independents={...
     20                independent('name','md.geometry.thickness','type','vertex','nods',md.mesh.numberofvertices)
     21        };
     22        md.autodiff.dependents={...
     23                dependent('name','IceVolume','type','scalar','fos_reverse_index',index)...
     24                };
     25        md.autodiff.driver='fos_reverse';
     26else
     27        md.autodiff.independents={...
     28                independent('name','md.geometry.thickness','type','vertex','nods',md.mesh.numberofvertices,'fos_forward_index',index)
    1929        };
    2030
    21 md.autodiff.dependents={...
    22         dependent('name','IceVolume','type','scalar')...
    23         };
    24 md.autodiff.driver='fos_forward';
     31        md.autodiff.dependents={...
     32                dependent('name','IceVolume','type','scalar')...
     33                };
     34        md.autodiff.driver='fos_forward';
     35end
    2536
    2637%parameters for the step-wise derivative
     
    7081md=solve(md,'Masstransport');
    7182%retrieve directly
    72 dVdh_ad=md.results.MasstransportSolution.AutodiffJacobian;
     83if IssmConfig('_HAVE_CODIPACK_')
     84        dVdh_ad=md.results.MasstransportSolution.AutodiffJacobian(index);
     85else
     86        dVdh_ad=md.results.MasstransportSolution.AutodiffJacobian;
     87end
    7388
    74 disp(sprintf('dV/dh: analytical:  %16.16g\n       using adolc:  %16.16g\n',dVdh_an,dVdh_ad));
     89disp(sprintf('dV/dh: analytical:  %16.16g\n       using ad  %16.16g\n',dVdh_an,dVdh_ad));
    7590
    7691%Fields and tolerances to track changes
Note: See TracChangeset for help on using the changeset viewer.