Changeset 17457


Ignore:
Timestamp:
03/18/14 09:55:41 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added Cuffey.cpp

Location:
issm/trunk-jpl/src/c
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r17398 r17457  
    215215                                        ./shared/Sorting/sorting.h\
    216216                                        ./shared/Elements/elements.h\
     217                                        ./shared/Elements/Cuffey.cpp\
    217218                                        ./shared/Elements/Paterson.cpp\
    218219                                        ./shared/Elements/Arrhenius.cpp\
  • issm/trunk-jpl/src/c/shared/Elements/Paterson.cpp

    r14951 r17457  
    1111IssmDouble Paterson(IssmDouble temperature){
    1212
    13         /*output: */
    14         IssmDouble B;
    15         IssmDouble T;
     13        IssmDouble B,T;
    1614
    1715        /*Switch to celsius from Kelvin: */
    1816        T=temperature-273.15;
    1917
    20 //      %The routine below is equivalent to:
    21 //      % n=3; T=temperature-273;
    22 //      % %From Paterson,
    23 //      % Temp=[0;-2;-5;-10;-15;-20;-25;-30;-35;-40;-45;-50];
    24 //      % A=[6.8*10^-15;2.4*10^-15;1.6*10^-15;4.9*10^-16;2.9*10^-16;1.7*10^-16;9.4*
    25 //      % 10^-17;5.1*10^-17;2.7*10^-17;1.4*10^-17;7.3*10^-18;3.6*10^-18];;%s-1(kPa-3)
    26 //      % %Convert into B B
    27 //      % B=A.^(-1/n)*10^3; %s^(1/3)Pa
    28 //      % %Now, do a cubic fit between Temp and B:
    29 //      % fittedmodel=fit(Temp,B,'cubicspline');
    30 //      % B=fittedmodel(temperature);
    3118
    3219        if(T<=-45.0){
    33                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+50,3)+ 0.011672640664130*pow(T+50,2)  -0.325004442485481*(T+50)+  6.524779401948101);
     20                B=1.e+8*(-0.000292866376675*pow(T+50.,3)+ 0.011672640664130*pow(T+50.,2)  -0.325004442485481*(T+50.)+  6.524779401948101);
    3421        }
    3522        else if((T>=-45.0) && (T<=-40.0)){
    36                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000292866376675*pow(T+45,3)+ 0.007279645014004*pow(T+45,2)  -0.230243014094813*(T+45)+  5.154964909039554);
     23                B=1.e+8*(-0.000292866376675*pow(T+45.,3)+ 0.007279645014004*pow(T+45.,2)  -0.230243014094813*(T+45.)+  5.154964909039554);
    3724        }
    3825        else if((T>=-40.0) && (T<=-35.0)){
    39                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000072737147457*pow(T+40,3)+  0.002886649363879*pow(T+40,2)  -0.179411542205399*(T+40)+  4.149132666831214);
     26                B=1.e+8*(0.000072737147457*pow(T+40.,3)+  0.002886649363879*pow(T+40.,2)  -0.179411542205399*(T+40.)+  4.149132666831214);
    4027        }
    4128        else if((T>=-35.0) && (T<=-30.0)){
    42                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000086144770023*pow(T+35,3)+ 0.003977706575736*pow(T+35,2)  -0.145089762507325*(T+35)+  3.333333333333331);
     29                B=1.e+8*(-0.000086144770023*pow(T+35.,3)+ 0.003977706575736*pow(T+35.,2)  -0.145089762507325*(T+35.)+  3.333333333333331);
    4330        }
    4431        else if((T>=-30.0) && (T<=-25.0)){
    45                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000043984685769*pow(T+30,3)+ 0.002685535025386*pow(T+30,2)  -0.111773554501713*(T+30)+  2.696559088937191);
     32                B=1.e+8*(-0.000043984685769*pow(T+30.,3)+ 0.002685535025386*pow(T+30.,2)  -0.111773554501713*(T+30.)+  2.696559088937191);
    4633        }
    4734        else if((T>=-25.0) && (T<=-20.0)){
    48                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000029799523463*pow(T+25,3)+ 0.002025764738854*pow(T+25,2)  -0.088217055680511*(T+25)+  2.199331606342181);
     35                B=1.e+8*(-0.000029799523463*pow(T+25.,3)+ 0.002025764738854*pow(T+25.,2)  -0.088217055680511*(T+25.)+  2.199331606342181);
    4936        }
    5037        else if((T>=-20.0) && (T<=-15.0)){
    51                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.000136920904777*pow(T+20,3)+  0.001578771886910*pow(T+20,2)  -0.070194372551690*(T+20)+  1.805165505978111);
     38                B=1.e+8*(0.000136920904777*pow(T+20.,3)+  0.001578771886910*pow(T+20.,2)  -0.070194372551690*(T+20.)+  1.805165505978111);
    5239        }
    5340        else if((T>=-15.0) && (T<=-10.0)){
    54                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.000899763781026*pow(T+15,3)+ 0.003632585458564*pow(T+15,2)  -0.044137585824322*(T+15)+  1.510778053489523);
     41                B=1.e+8*(-0.000899763781026*pow(T+15.,3)+ 0.003632585458564*pow(T+15.,2)  -0.044137585824322*(T+15.)+  1.510778053489523);
    5542        }
    5643        else if((T>=-10.0) && (T<=-5.0)){
    57                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(0.001676964325070*pow(T+10,3)-  0.009863871256831*pow(T+10,2)  -0.075294014815659*(T+10)+  1.268434288203714);
     44                B=1.e+8*(0.001676964325070*pow(T+10.,3)-  0.009863871256831*pow(T+10.,2)  -0.075294014815659*(T+10.)+  1.268434288203714);
    5845        }
    5946        else if((T>=-5.0) && (T<=-2.0)){
    60                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622487*pow(T+5,3)+0.015290593619213*pow(T+5,2)  -0.048160403003748*(T+5)+  0.854987973338348);
     47                B=1.e+8*(-0.003748937622487*pow(T+5.,3)+0.015290593619213*pow(T+5.,2)  -0.048160403003748*(T+5.)+  0.854987973338348);
    6148        }
    6249        else{
    63                 B=pow((IssmPDouble)10,(IssmPDouble)8)*(-0.003748937622488*pow(T+2,3)-0.018449844983174*pow(T+2,2)  -0.057638157095631*(T+2)+  0.746900791092860);
     50                B=1.e+8*(-0.003748937622488*pow(T+2.,3)-0.018449844983174*pow(T+2.,2)  -0.057638157095631*(T+2.)+  0.746900791092860);
    6451        }
    6552
    6653        /*B cannot be negative!*/
    67         if(B<0) B=pow((IssmPDouble)10,(IssmPDouble)6);
     54        if(B<0) B=1.e+6;
    6855
    6956        return B;
  • issm/trunk-jpl/src/c/shared/Elements/elements.h

    r16322 r17457  
    88#include "../Numerics/types.h"
    99
     10IssmDouble Cuffey(IssmDouble temperature);
    1011IssmDouble Paterson(IssmDouble temperature);
    1112IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n);
  • issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp

    r17405 r17457  
    4646        file_line= what_line;
    4747        /*When error messages are not shown properly, uncomment the following line*/
    48         this->Report();
     48        //this->Report();
    4949
    5050}/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.