source: issm/oecreview/Archive/18296-19100/ISSM-18967-18968.diff@ 19102

Last change on this file since 19102 was 19102, checked in by Mathieu Morlighem, 10 years ago

NEW: added 18296-19100

File size: 92.1 KB
  • ../trunk-jpl/test/NightlyRun/test236.py

     
    1515# Use of ispdd and isdelta18o methods
    1616md.surfaceforcings = SMBpdd();
    1717md.surfaceforcings.isdelta18o=1
     18md.surfaceforcings.ismungsm=0
    1819
    1920# Add temperature, precipitation and delta18o needed to measure the surface mass balance
    2021# creating delta18o
     
    4950for imonth in xrange(0,12):
    5051    md.surfaceforcings.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    5152    md.surfaceforcings.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
     53    md.surfaceforcings.precipitations_lgm[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
     54    md.surfaceforcings.precipitations_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
    5255
     56# Interpolation factors
     57md.surfaceforcings.Tdiff[1,1:md.timestepping.final_time]=0.5;
     58md.surfaceforcings.sealev[1,1:md.timestepping.final_time]=0.5;
     59# Year of each data point
     60md.surfaceforcings.Tdiff[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
     61md.surfaceforcings.sealev[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
     62
    5363# time steps and resolution
    5464md.timestepping.time_step=20.
    5565md.timestepping.final_time=60.
    5666
    57 md.surfaceforcings.Pfac=[1,1]
    58 md.surfaceforcings.Tdiff=[1,1]
    59 md.surfaceforcings.sealev=[1,1]
    6067
    6168#
    6269md.transient.requested_outputs=['default','SurfaceforcingsMonthlytemperatures']
  • ../trunk-jpl/test/NightlyRun/test237.py

     
    1111
    1212md=triangle(model(),'../Exp/Square.exp',600000)    #180000
    1313md=setmask(md,'all','')
     14md=parameterize(md,'../Par/SquareShelf.py')
    1415
    1516# Use of ispdd and isdelta18o methods
    1617md.surfaceforcings = SMBpdd();
    17 md.surfaceforcings.isdelta18o=1
     18md.surfaceforcings.isdelta18o=0
     19md.surfaceforcings.ismungsm=1
    1820
    19 md=parameterize(md,'../Par/SquareShelf.py')
    2021
    21 # Add temperature, precipitation and delta18o needed to measure the surface mass balance
    22 # creating delta18o
    23 delta18o=numpy.loadtxt('../Data/delta18o.data')
    24 md.surfaceforcings.delta18o=delta18o
    25 # creating delta18oSurface
    26 md.surfaceforcings.delta18o_surface = numpy.zeros((2,numpy.size(delta18o,axis=1)))
    27 md.surfaceforcings.delta18o_surface[1,:] = delta18o[1,:]
     22# # Add temperature, precipitation and delta18o needed to measure the surface mass balance
     23# # creating delta18o
     24# delta18o=numpy.loadtxt('../Data/delta18o.data')
     25# md.surfaceforcings.delta18o=delta18o
     26# # creating delta18oSurface
     27# md.surfaceforcings.delta18o_surface = numpy.zeros((2,numpy.size(delta18o,axis=1)))
     28# md.surfaceforcings.delta18o_surface[1,:] = delta18o[1,:]
    2829
    2930# creating Present day and lgm temperatures
    3031# Same temperature over the all region:
     
    5152for imonth in xrange(0,12):
    5253    md.surfaceforcings.precipitations_presentday[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
    5354    md.surfaceforcings.precipitations_presentday[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
     55    md.surfaceforcings.precipitations_lgm[0:md.mesh.numberofvertices,imonth]=-0.4*10**(-6)*md.mesh.y+0.5
     56    md.surfaceforcings.precipitations_lgm[md.mesh.numberofvertices,imonth]=((float(imonth)+1.)/12.)
    5457
     58# Interpolation factors
     59md.surfaceforcings.Pfac[1,1:md.timestepping.final_time]=0.5;
     60md.surfaceforcings.Tdiff[1,1:md.timestepping.final_time]=0.5;
     61md.surfaceforcings.sealev[1,1:md.timestepping.final_time]=0.5;
     62# Year of each data point
     63md.surfaceforcings.Pfac[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
     64md.surfaceforcings.Tdiff[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
     65md.surfaceforcings.sealev[2,1:md.timestepping.final_time]=1:1:md.timestepping.final_time;
     66
    5567# time steps and resolution
    5668md.timestepping.time_step=20.
    5769md.settings.output_frequency=1
    5870md.timestepping.final_time=60.
    5971
    60 md.surfaceforcings.Pfac=[1,1]
    61 md.surfaceforcings.Tdiff=[1,1]
    62 md.surfaceforcings.sealev=[1,1]
    63 
    6472#
    6573md.transient.requested_outputs=['default','SurfaceforcingsMonthlytemperatures']
    6674md.extrude(3,1.)
  • ../trunk-jpl/test/NightlyRun/test236.m

     
    22md=setmask(md,'all','');
    33md=parameterize(md,'../Par/SquareShelf.par');
    44
     5%md.verbose=verbose('all');
     6
    57% Use of ispdd and isdelta18o methods
    68md.surfaceforcings = SMBpdd();
    79md.surfaceforcings.isdelta18o=1;
     10md.surfaceforcings.ismungsm=0;
    811
     12%md.surfaceforcings.precipitation(1:md.mesh.numberofvertices,1:12)=0;
     13%md.surfaceforcings.monthlytemperatures(1:md.mesh.numberofvertices,1:12)=273;
     14
    915% Add temperature, precipitation and delta18o needed to measure the surface mass balance
    10 % creating delta18o
     16%  creating delta18o
    1117load '../Data/delta18o.data'
    1218md.surfaceforcings.delta18o=delta18o;
    1319% creating delta18oSurface
     
    2531    md.surfaceforcings.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
    2632end
    2733
    28 % creating initialization and spc temperatures initialization and spc
     34% creating initialization and spc temperatures initialization and
     35% spc
    2936md.thermal.spctemperature=mean(md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
    3037md.thermal.spctemperature=repmat(md.thermal.spctemperature,1,md.timestepping.final_time/md.timestepping.time_step);
    3138itemp=0:md.timestepping.time_step:md.timestepping.final_time-md.timestepping.time_step;
     
    3643% creating precipitation
    3744for imonth=0:11
    3845    md.surfaceforcings.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
     46    md.surfaceforcings.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
     47    % Time for the last line:
    3948    md.surfaceforcings.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
     49    md.surfaceforcings.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
    4050end
    4151
     52% Interpolation factors
     53md.surfaceforcings.Tdiff(1,1:md.timestepping.final_time)=0.5;
     54md.surfaceforcings.sealev(1,1:md.timestepping.final_time)=0.5;
     55% Year of each data point
     56md.surfaceforcings.Tdiff(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
     57md.surfaceforcings.sealev(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
     58
    4259% time steps and resolution
    4360md.timestepping.time_step=20;
     61md.settings.output_frequency=1;
    4462md.timestepping.final_time=60;
    4563
    46 md.surfaceforcings.Pfac=[1;1];
    47 md.surfaceforcings.Tdiff=[1;1];
    48 md.surfaceforcings.sealev=[1;1];
    49 
    5064%
    5165md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
    5266md=setflowequation(md,'SSA','all');
    53 md.cluster=generic('name',oshostname(),'np',3);
     67md.cluster=generic('name',oshostname(),'np',1); % 3 for the cluster
    5468md=solve(md,TransientSolutionEnum());
    5569
    5670%Fields and tolerances to track changes
  • ../trunk-jpl/test/NightlyRun/test237.m

     
    11md=triangle(model(),'../Exp/Square.exp',600000.);%180000
    22md=setmask(md,'all','');
     3md=parameterize(md,'../Par/SquareShelf.par');
    34
    4 % Use of ispdd and isdelta18o methods
     5%md.verbose=verbose('all');
     6
     7% Use of ispdd methods
    58md.surfaceforcings = SMBpdd();
    6 md.surfaceforcings.isdelta18o=1;
     9md.surfaceforcings.isdelta18o=0;
     10md.surfaceforcings.ismungsm=1;
    711
    8 md=parameterize(md,'../Par/SquareShelf.par');
     12if md.surfaceforcings.isdelta18o==0 & md.surfaceforcings.ismungsm==0
     13    md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
     14    md.surfaceforcings.monthlytemperatures=273*ones(md.mesh.numberofvertices,1);
     15end
     16   
    917
    1018% Add temperature, precipitation and delta18o needed to measure the surface mass balance
    11 % creating delta18o
    12 load '../Data/delta18o.data'
    13 md.surfaceforcings.delta18o=delta18o;
    14 % creating delta18oSurface
    15 md.surfaceforcings.delta18o_surface(1,1:(length(delta18o))) = 0;
    16 md.surfaceforcings.delta18o_surface(2,:) = delta18o(2,:);
     19% % creating delta18o
     20% load '../Data/delta18o.data'
     21% md.surfaceforcings.delta18o=delta18o;
     22% % creating delta18oSurface
     23% md.surfaceforcings.delta18o_surface(1,1:(length(delta18o))) = 0;
     24% md.surfaceforcings.delta18o_surface(2,:) = delta18o(2,:);
    1725
    1826% creating Present day and lgm temperatures
    1927% Same temperature over the all region:
     
    3745% creating precipitation
    3846for imonth=0:11
    3947    md.surfaceforcings.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
     48    md.surfaceforcings.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
     49    % Time for the last line:
    4050    md.surfaceforcings.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
     51    md.surfaceforcings.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
    4152end
    4253
    43 md.surfaceforcings.Pfac=[1;1];
    44 md.surfaceforcings.Tdiff=[1;1];
    45 md.surfaceforcings.sealev=[1;1];
     54md.surfaceforcings.Pfac(1,1:md.timestepping.final_time)=0.5;
     55md.surfaceforcings.Tdiff(1,1:md.timestepping.final_time)=0.5;
     56md.surfaceforcings.sealev(1,1:md.timestepping.final_time)=0.5;
     57% Year of each data point
     58md.surfaceforcings.Pfac(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
     59md.surfaceforcings.Tdiff(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
     60md.surfaceforcings.sealev(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
    4661
    4762% time steps and resolution
    4863md.timestepping.time_step=20;
     
    5166
    5267%
    5368md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
    54 md=extrude(md,3,1.);
     69md=extrude(md,3,1);
     70
    5571md=setflowequation(md,'SSA','all');
    56 md.cluster=generic('name',oshostname(),'np',1);
    57 md=solve(md,TransientSolutionEnum());
     72md.cluster=generic('name',oshostname(),'np',1); % 3 for the cluster
     73md=solve(md,TransientSolutionEnum);
    5874
    5975%Fields and tolerances to track changes
    6076field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', ...
  • ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp

     
    119119
    120120        int    stabilization,finiteelement,smb_model;
    121121        bool   dakota_analysis;
    122         bool   isdelta18o;
     122        bool   isdelta18o,ismungsm;
    123123        bool   isgroundingline;
    124124        bool   islevelset;
    125125
     
    178178                        break;
    179179                case SMBpddEnum:
    180180                        iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
     181                        iomodel->Constant(&ismungsm,SurfaceforcingsIsmungsmEnum);
    181182                        iomodel->FetchDataToInput(elements,ThermalSpctemperatureEnum);
    182                         if(isdelta18o){
     183                        if(isdelta18o || ismungsm){
    183184                                iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesLgmEnum);
    184185                                iomodel->FetchDataToInput(elements,SurfaceforcingsTemperaturesPresentdayEnum);
    185186                                iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsPresentdayEnum);
    186187                                iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationsLgmEnum);
    187188                        }
    188189                        else{
    189                                 iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
     190                                iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
    190191                                iomodel->FetchDataToInput(elements,SurfaceforcingsMonthlytemperaturesEnum);
    191192                        }
     193
    192194                        break;
    193195                case SMBgradientsEnum:
    194196                        iomodel->FetchDataToInput(elements,SurfaceforcingsHrefEnum);
  • ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h

     
    343343        SurfaceforcingsDelta18oEnum,
    344344        SurfaceforcingsDelta18oSurfaceEnum,
    345345        SurfaceforcingsIsdelta18oEnum,
     346        SurfaceforcingsIsmungsmEnum,
    346347        SurfaceforcingsPrecipitationsPresentdayEnum,
    347348        SurfaceforcingsPrecipitationsLgmEnum,
    348349        SurfaceforcingsTemperaturesPresentdayEnum,
  • ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp

     
    349349                case SurfaceforcingsDelta18oEnum : return "SurfaceforcingsDelta18o";
    350350                case SurfaceforcingsDelta18oSurfaceEnum : return "SurfaceforcingsDelta18oSurface";
    351351                case SurfaceforcingsIsdelta18oEnum : return "SurfaceforcingsIsdelta18o";
     352                case SurfaceforcingsIsmungsmEnum : return "SurfaceforcingsIsmungsm";
    352353                case SurfaceforcingsPrecipitationsPresentdayEnum : return "SurfaceforcingsPrecipitationsPresentday";
    353354                case SurfaceforcingsPrecipitationsLgmEnum : return "SurfaceforcingsPrecipitationsLgm";
    354355                case SurfaceforcingsTemperaturesPresentdayEnum : return "SurfaceforcingsTemperaturesPresentday";
  • ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp

     
    355355              else if (strcmp(name,"SurfaceforcingsDelta18o")==0) return SurfaceforcingsDelta18oEnum;
    356356              else if (strcmp(name,"SurfaceforcingsDelta18oSurface")==0) return SurfaceforcingsDelta18oSurfaceEnum;
    357357              else if (strcmp(name,"SurfaceforcingsIsdelta18o")==0) return SurfaceforcingsIsdelta18oEnum;
     358              else if (strcmp(name,"SurfaceforcingsIsmungsm")==0) return SurfaceforcingsIsmungsmEnum;
    358359              else if (strcmp(name,"SurfaceforcingsPrecipitationsPresentday")==0) return SurfaceforcingsPrecipitationsPresentdayEnum;
    359360              else if (strcmp(name,"SurfaceforcingsPrecipitationsLgm")==0) return SurfaceforcingsPrecipitationsLgmEnum;
    360361              else if (strcmp(name,"SurfaceforcingsTemperaturesPresentday")==0) return SurfaceforcingsTemperaturesPresentdayEnum;
     
    381382              else if (strcmp(name,"SurfaceforcingsRunoff")==0) return SurfaceforcingsRunoffEnum;
    382383              else if (strcmp(name,"SMBmeltcomponents")==0) return SMBmeltcomponentsEnum;
    383384              else if (strcmp(name,"SurfaceforcingsMelt")==0) return SurfaceforcingsMeltEnum;
    384               else if (strcmp(name,"SurfaceforcingsRefreeze")==0) return SurfaceforcingsRefreezeEnum;
    385385         else stage=4;
    386386   }
    387387   if(stage==4){
    388               if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
     388              if (strcmp(name,"SurfaceforcingsRefreeze")==0) return SurfaceforcingsRefreezeEnum;
     389              else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
    389390              else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
    390391              else if (strcmp(name,"SolutionType")==0) return SolutionTypeEnum;
    391392              else if (strcmp(name,"AnalysisType")==0) return AnalysisTypeEnum;
     
    504505              else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum;
    505506              else if (strcmp(name,"Masscon")==0) return MassconEnum;
    506507              else if (strcmp(name,"MassconName")==0) return MassconNameEnum;
    507               else if (strcmp(name,"MassconDefinitionenum")==0) return MassconDefinitionenumEnum;
    508508         else stage=5;
    509509   }
    510510   if(stage==5){
    511               if (strcmp(name,"MassconLevelset")==0) return MassconLevelsetEnum;
     511              if (strcmp(name,"MassconDefinitionenum")==0) return MassconDefinitionenumEnum;
     512              else if (strcmp(name,"MassconLevelset")==0) return MassconLevelsetEnum;
    512513              else if (strcmp(name,"Massconaxpby")==0) return MassconaxpbyEnum;
    513514              else if (strcmp(name,"MassconaxpbyName")==0) return MassconaxpbyNameEnum;
    514515              else if (strcmp(name,"MassconaxpbyDefinitionenum")==0) return MassconaxpbyDefinitionenumEnum;
     
    627628              else if (strcmp(name,"DeviatoricStressxz")==0) return DeviatoricStressxzEnum;
    628629              else if (strcmp(name,"DeviatoricStressyy")==0) return DeviatoricStressyyEnum;
    629630              else if (strcmp(name,"DeviatoricStressyz")==0) return DeviatoricStressyzEnum;
    630               else if (strcmp(name,"DeviatoricStresszz")==0) return DeviatoricStresszzEnum;
    631631         else stage=6;
    632632   }
    633633   if(stage==6){
    634               if (strcmp(name,"StrainRate")==0) return StrainRateEnum;
     634              if (strcmp(name,"DeviatoricStresszz")==0) return DeviatoricStresszzEnum;
     635              else if (strcmp(name,"StrainRate")==0) return StrainRateEnum;
    635636              else if (strcmp(name,"StrainRatexx")==0) return StrainRatexxEnum;
    636637              else if (strcmp(name,"StrainRatexy")==0) return StrainRatexyEnum;
    637638              else if (strcmp(name,"StrainRatexz")==0) return StrainRatexzEnum;
     
    750751              else if (strcmp(name,"GroundinglineMigration")==0) return GroundinglineMigrationEnum;
    751752              else if (strcmp(name,"Gset")==0) return GsetEnum;
    752753              else if (strcmp(name,"Index")==0) return IndexEnum;
    753               else if (strcmp(name,"Indexed")==0) return IndexedEnum;
    754754         else stage=7;
    755755   }
    756756   if(stage==7){
    757               if (strcmp(name,"Intersect")==0) return IntersectEnum;
     757              if (strcmp(name,"Indexed")==0) return IndexedEnum;
     758              else if (strcmp(name,"Intersect")==0) return IntersectEnum;
    758759              else if (strcmp(name,"Nodal")==0) return NodalEnum;
    759760              else if (strcmp(name,"OldGradient")==0) return OldGradientEnum;
    760761              else if (strcmp(name,"OutputFilePointer")==0) return OutputFilePointerEnum;
  • ../trunk-jpl/src/c/shared/Elements/elements.h

     
    1212IssmDouble Arrhenius(IssmDouble temperature,IssmDouble depth,IssmDouble n);
    1313IssmDouble LliboutryDuval(IssmDouble enthalpy, IssmDouble pressure, IssmDouble n, IssmDouble betaCC, IssmDouble referencetemperature, IssmDouble heatcapacity, IssmDouble latentheat);
    1414// IssmDouble LliboutryDuval(IssmDouble temperature, IssmDouble waterfraction, IssmDouble depth,IssmDouble n);
    15 IssmDouble PddSurfaceMassBlance(IssmDouble* monthlytemperatures,  IssmDouble* monthlyprec,
    16                                 IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday,
    17                                 IssmDouble* PrecipitationsLgm, IssmDouble* PrecipitationsPresentday,
    18                                 IssmDouble* pdds, IssmDouble* pds,IssmDouble signorm, IssmDouble yts,
    19                                 IssmDouble h, IssmDouble s, IssmDouble desfac,
    20                                 IssmDouble s0t,IssmDouble s0p, IssmDouble rlaps, IssmDouble rlapslgm,
    21                                 IssmDouble PfacTime,IssmDouble TdiffTime,IssmDouble sealevTime);
     15IssmDouble PddSurfaceMassBalance(IssmDouble* monthlytemperatures,  IssmDouble* monthlyprec,
     16                                 IssmDouble* pdds, IssmDouble* pds,IssmDouble signorm, IssmDouble yts,
     17                                 IssmDouble h, IssmDouble s, IssmDouble desfac,IssmDouble s0t,
     18                                 IssmDouble s0p, IssmDouble rlaps, IssmDouble rlapslgm,
     19                                 IssmDouble TdiffTime,IssmDouble sealevTime,
     20                                 IssmDouble rho_water, IssmDouble rho_ice);
    2221void ComputeDelta18oTemperaturePrecipitation(IssmDouble Delta18oSurfacePresent, IssmDouble Delta18oSurfaceLgm, IssmDouble Delta18oSurfaceTime,
    23                                      IssmDouble Delta18oPresent, IssmDouble Delta18oLgm, IssmDouble Delta18oTime,
    24                                      IssmDouble* PrecipitationsPresentday,
    25                                      IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday,
    26                                           IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout);
     22                                             IssmDouble Delta18oPresent, IssmDouble Delta18oLgm, IssmDouble Delta18oTime,
     23                                             IssmDouble* PrecipitationsPresentday,
     24                                             IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday,
     25                                             IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout);
     26void ComputeMungsmTemperaturePrecipitation(IssmDouble TdiffTime, IssmDouble PfacTime,
     27                                           IssmDouble* PrecipitationsLgm,IssmDouble* PrecipitationsPresentday,
     28                                           IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday,
     29                                           IssmDouble* monthlytemperaturesout, IssmDouble* monthlyprecout);
    2730IssmDouble DrainageFunctionWaterfraction(IssmDouble waterfraction, IssmDouble dt=0.);
    2831IssmDouble StressIntensityIntegralWeight(IssmDouble depth, IssmDouble water_depth, IssmDouble thickness);
    2932
  • ../trunk-jpl/src/c/shared/Elements/PddSurfaceMassBalance.cpp

     
    11/* file:  PddSurfaceMassBlance.cpp
    22   Calculating the surface mass balance using the positive degree day method.
     3   Updating the precipitation and temperature to the new elevation
    34 */
    45
    56#include "./elements.h"
    67#include "../Numerics/numerics.h"
    78
    8 IssmDouble PddSurfaceMassBlance(IssmDouble* monthlytemperatures, IssmDouble* monthlyprec,
    9                                 IssmDouble* TemperaturesLgm, IssmDouble* TemperaturesPresentday,
    10                                 IssmDouble* PrecipitationsLgm, IssmDouble* PrecipitationsPresentday,
    11                                 IssmDouble* pdds, IssmDouble* pds, IssmDouble signorm,
    12                                 IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble desfac,
    13                                 IssmDouble s0t,
    14                                 IssmDouble s0p, IssmDouble rlaps, IssmDouble rlapslgm,
    15                                 IssmDouble PfacTime,IssmDouble TdiffTime,IssmDouble sealevTime){
     9IssmDouble PddSurfaceMassBalance(IssmDouble* monthlytemperatures, IssmDouble* monthlyprec,
     10                                 IssmDouble* pdds, IssmDouble* pds, IssmDouble signorm,
     11                                 IssmDouble yts, IssmDouble h, IssmDouble s, IssmDouble desfac,
     12                                 IssmDouble s0t,IssmDouble s0p, IssmDouble rlaps,IssmDouble rlapslgm,
     13                                 IssmDouble TdiffTime,IssmDouble sealevTime,
     14                                 IssmDouble rho_water,IssmDouble rho_ice){
    1615
    17   // CURENTLY monthlytemperatures and monthlyprec ARE NOT USED HERE.
    18   // THEY ARE REPLACE BY tdiffh No usage of deltO18 anymore
    19 
    2016  // output:
    2117  IssmDouble B;    // surface mass balance, melt+accumulation
    2218  int    iqj,imonth;
     
    2723  IssmDouble prect; // total precipitation during 1 year taking into account des. ef.
    2824  IssmDouble water; //water=rain + snowmelt
    2925  IssmDouble runoff; //meltwater only, does not include rain
     26  IssmDouble sconv; //rhow_rain/rhoi / 12 months
    3027
    3128  //IssmDouble  sealev=0.;         // degrees per meter. 7.5 lev's 99 paper, 9 Marshall 99 paper
    3229  //IssmDouble  Pfac=0.5,Tdiff=0.5;
    33   IssmDouble  rtlaps;
     30  IssmDouble rtlaps;
    3431  // IssmDouble lapser=6.5         // lapse rate
    3532  // IssmDouble desfac = 0.3;      // desert elevation factor
    3633  // IssmDouble s0p=0.;            // should be set to elevation from precip source
    3734  // IssmDouble s0t=0.;         // should be set to elevation from temperature source
    38   IssmDouble tdiffh; 
    3935  IssmDouble st;             // elevation between altitude of the temp record and current altitude
    4036  IssmDouble sp;             // elevation between altitude of the prec record and current altitude
    4137  IssmDouble deselcut=1.0;
     
    4844  IssmDouble DT = 0.02;
    4945  IssmDouble pddt, pd; // pd: snow/precip fraction, precipitation falling as snow
    5046
    51   IssmDouble premt;     // monthly precipitation (m of ice equivalent)
    5247  IssmDouble q, qmpt;   // q is desert/elev. fact, hnpfac is huybrect fact, and pd is normal dist.
    5348  IssmDouble qm = 0.;   // snow part of the precipitation
    5449  IssmDouble qmt = 0.;  // precipitation without desertification effect adjustment
     
    7267  IssmDouble fsupT=0.5,  fsupndd=0.5;  // Tsurf mode factors for supice
    7368  IssmDouble pddtj, hmx2;
    7469
     70  sconv=(rho_water/rho_ice)/12.; //rhow_rain/rhoi / 12 months
    7571
    7672  /*PDD constant*/
    7773  siglim = 2.5*signorm;
     
    8985    rtlaps=TdiffTime*rlapslgm + (1.-TdiffTime)*rlaps; // lapse rate
    9086   
    9187    /*********compute Surface temperature *******/
    92     tdiffh = TdiffTime*( TemperaturesLgm[imonth] - TemperaturesPresentday[imonth] );
    93     tstar = tdiffh + TemperaturesPresentday[imonth] - rtlaps *max(st,sealevTime*0.001);
     88    monthlytemperatures[imonth]=monthlytemperatures[imonth] - rtlaps *max(st,sealevTime*0.001);
     89    tstar = monthlytemperatures[imonth];
    9490    Tsurf = tstar*deltm+Tsurf;       
    9591
    9692      /*********compute PD ****************/
     
    105101      if (sp>0.0){q = exp(-desfac*sp);}
    106102      else {q = 1.0;}
    107103
    108       premt =min(1.5, PrecipitationsPresentday[imonth] * pow(PrecipitationsLgm[imonth],PfacTime));   // [m/month]
    109 
    110       qmt= qmt + premt; 
    111       qmpt= q*premt;           
     104      qmt= qmt + monthlyprec[imonth]*sconv;  //*sconv to convert in m of ice equivalent per month 
     105      qmpt= q*monthlyprec[imonth]*sconv;           
    112106      qmp= qmp + qmpt;
    113107      qm= qm + qmpt*pd;
    114108
     
    123117        pdd = pdd + pddsig*deltm;
    124118        frzndd = frzndd - (tstar-pddsig)*deltm;}
    125119      else{frzndd = frzndd - tstar*deltm; }
     120
     121      /*Assign output pointer*/
     122      *(monthlytemperatures+imonth) = monthlytemperatures[imonth];
     123      *(monthlyprec+imonth) = monthlyprec[imonth];     
    126124  } // end of seasonal loop
    127125  //******************************************************************
    128126
  • ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp

     
    2121        int         numoutputs,materialtype,smb_model,basalforcing_model;
    2222        char**      requestedoutputs = NULL;
    2323        IssmDouble  time;
    24         bool        isdelta18o;
     24        bool        isdelta18o,ismungsm;
    2525
    2626        /*parameters for mass flux:*/
    2727        int          mass_flux_num_profiles     = 0;
     
    107107                        break;
    108108                case SMBpddEnum:
    109109                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsdelta18oEnum));
     110                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsIsmungsmEnum));
    110111                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsDesfacEnum));
    111112                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0pEnum));
    112113                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsS0tEnum));
    113114                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsRlapsEnum));
    114115                        parameters->AddObject(iomodel->CopyConstantObject(SurfaceforcingsRlapslgmEnum));
    115116                        iomodel->Constant(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
     117                        iomodel->Constant(&ismungsm,SurfaceforcingsIsmungsmEnum);
    116118
    117                         iomodel->FetchData(&temp,&N,&M,SurfaceforcingsPfacEnum); _assert_(N==2);
    118                         for(i=0;i<M;i++) temp[M+i]=temp[M+i];
    119                         parameters->AddObject(new TransientParam(SurfaceforcingsPfacEnum,&temp[0],&temp[M],M));
    120                         iomodel->DeleteData(temp,SurfaceforcingsPfacEnum);
     119                        if(ismungsm){
     120                          iomodel->FetchData(&temp,&N,&M,SurfaceforcingsPfacEnum); _assert_(N==2);
     121                          for(i=0;i<M;i++) temp[M+i]=temp[M+i];
     122                          parameters->AddObject(new TransientParam(SurfaceforcingsPfacEnum,&temp[0],&temp[M],M));
     123                          iomodel->DeleteData(temp,SurfaceforcingsPfacEnum);
    121124                       
    122                         iomodel->FetchData(&temp,&N,&M,SurfaceforcingsTdiffEnum); _assert_(N==2);
    123                         for(i=0;i<M;i++) temp[M+i]=temp[M+i];
    124                         parameters->AddObject(new TransientParam(SurfaceforcingsTdiffEnum,&temp[0],&temp[M],M));
    125                         iomodel->DeleteData(temp,SurfaceforcingsTdiffEnum);
     125                          iomodel->FetchData(&temp,&N,&M,SurfaceforcingsTdiffEnum); _assert_(N==2);
     126                          for(i=0;i<M;i++) temp[M+i]=temp[M+i];
     127                          parameters->AddObject(new TransientParam(SurfaceforcingsTdiffEnum,&temp[0],&temp[M],M));
     128                          iomodel->DeleteData(temp,SurfaceforcingsTdiffEnum);
    126129
    127                         iomodel->FetchData(&temp,&N,&M,SurfaceforcingsSealevEnum); _assert_(N==2);
    128                         for(i=0;i<M;i++) temp[M+i]=temp[M+i];
    129                         parameters->AddObject(new TransientParam(SurfaceforcingsSealevEnum,&temp[0],&temp[M],M));
    130                         iomodel->DeleteData(temp,SurfaceforcingsSealevEnum);
     130                          iomodel->FetchData(&temp,&N,&M,SurfaceforcingsSealevEnum); _assert_(N==2);
     131                          for(i=0;i<M;i++) temp[M+i]=temp[M+i];
     132                          parameters->AddObject(new TransientParam(SurfaceforcingsSealevEnum,&temp[0],&temp[M],M));
     133                          iomodel->DeleteData(temp,SurfaceforcingsSealevEnum);
     134                        }
    131135
    132136                        if(isdelta18o){
    133137                                iomodel->Constant(&yts,ConstantsYtsEnum);
  • ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.h

     
    1111void SurfaceMassBalancex(FemModel* femmodel);
    1212void SmbGradientsx(FemModel* femmodel);
    1313void Delta18oParameterizationx(FemModel* femmodel);
     14void MungsmtpParameterizationx(FemModel* femmodel);
    1415void PositiveDegreeDayx(FemModel* femmodel);
    1516void SmbHenningx(FemModel* femmodel);
    1617void SmbComponentsx(FemModel* femmodel);
  • ../trunk-jpl/src/c/modules/SurfaceMassBalancex/SurfaceMassBalancex.cpp

     
    1010
    1111        /*Intermediaties*/
    1212        int  smb_model;
    13         bool isdelta18o;
     13        bool isdelta18o,ismungsm;
    1414
    1515        /*First, get SMB model from parameters*/
    1616        femmodel->parameters->FindParam(&smb_model,SurfaceforcingsEnum);
     
    2222                        break;
    2323                case SMBpddEnum:
    2424                        femmodel->parameters->FindParam(&isdelta18o,SurfaceforcingsIsdelta18oEnum);
     25                        femmodel->parameters->FindParam(&ismungsm,SurfaceforcingsIsmungsmEnum);
    2526                        if(isdelta18o){
    26                                 if(VerboseSolution()) _printf0_("   call Delta18oParametrization module\n");
     27                                if(VerboseSolution()) _printf0_("   call Delta18oParameterization module\n");
    2728                                Delta18oParameterizationx(femmodel);
    2829                        }
     30                        if(ismungsm){
     31                                if(VerboseSolution()) _printf0_("   call MungsmtpParameterization module\n");
     32                                MungsmtpParameterizationx(femmodel);
     33                        }
    2934                        if(VerboseSolution()) _printf0_("   call positive degree day module\n");
    3035                        PositiveDegreeDayx(femmodel);
    3136                        break;
     
    117122        }
    118123
    119124}/*}}}*/
     125void MungsmtpParameterizationx(FemModel* femmodel){/*{{{*/
     126
     127        for(int i=0;i<femmodel->elements->Size();i++){
     128                Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
     129                element->MungsmtpParameterization();
     130        }
     131
     132}/*}}}*/
    120133void PositiveDegreeDayx(FemModel* femmodel){/*{{{*/
    121134
    122135        // void PositiveDegreeDayx(hd,vTempsea,vPrec,agd,Tsurf,ni){
     
    143156        IssmDouble PDup, PDCUT = 2.0;    // PDcut: rain/snow cutoff temperature (C)
    144157        IssmDouble tstar; // monthly mean surface temp
    145158
     159        bool ismungsm;
     160
    146161        IssmDouble *pdds    = NULL;
    147162        IssmDouble *pds     = NULL;
    148163        Element    *element = NULL;
     
    150165        pdds=xNew<IssmDouble>(NPDMAX+1);
    151166        pds=xNew<IssmDouble>(NPDCMAX+1);
    152167
     168        // Get ismungsm parameter
     169        femmodel->parameters->FindParam(&ismungsm,SurfaceforcingsIsmungsmEnum);
     170
    153171        /* initialize PDD (creation of a lookup table)*/
    154172        tstep    = 0.1;
    155173        tsint    = tstep*0.5;
     
    204222
    205223        for(i=0;i<femmodel->elements->Size();i++){
    206224                element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
    207                 element->PositiveDegreeDay(pdds,pds,signorm);
     225                element->PositiveDegreeDay(pdds,pds,signorm,ismungsm);
    208226        }
    209 
    210227        /*free ressouces: */
    211228        xDelete<IssmDouble>(pdds);
    212229        xDelete<IssmDouble>(pds);
  • ../trunk-jpl/src/c/Makefile.am

     
    219219                                        ./shared/Elements/PrintArrays.cpp\
    220220                                        ./shared/Elements/PddSurfaceMassBalance.cpp\
    221221                                        ./shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp\
     222                                        ./shared/Elements/ComputeMungsmTemperaturePrecipitation.cpp\
    222223                                        ./shared/Elements/DrainageFunctionWaterfraction.cpp\
    223224                                        ./shared/String/sharedstring.h\
    224225                                        ./shared/String/DescriptorIndex.cpp\
  • ../trunk-jpl/src/c/classes/Elements/Element.h

     
    179179                virtual void       ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index)=0;
    180180                virtual void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum)=0;
    181181                virtual void       Delta18oParameterization(void)=0;
     182                virtual void       MungsmtpParameterization(void)=0;
    182183                virtual void       ElementResponse(IssmDouble* presponse,int response_enum)=0;
    183184                virtual void       ElementSizes(IssmDouble* phx,IssmDouble* phy,IssmDouble* phz)=0;
    184185                virtual int        FiniteElement(void)=0;
     
    250251                virtual void       NormalTop(IssmDouble* normal,IssmDouble* xyz_list)=0;
    251252                virtual int        NumberofNodesPressure(void)=0;
    252253                virtual int        NumberofNodesVelocity(void)=0;
    253                 virtual void       PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0;
     254                virtual void       PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm)=0;
    254255                virtual void       PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
    255256                virtual int        PressureInterpolation()=0;
    256257                virtual void       ReduceMatrices(ElementMatrix* Ke,ElementVector* pe)=0;
  • ../trunk-jpl/src/c/classes/Elements/Tria.cpp

     
    608608                        input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
    609609                        input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
    610610                        input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
    611                         PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month]/yts; // converion in m/sec
    612611                }
    613612        }
    614613
     
    650649        /*clean-up*/
    651650        delete gauss;
    652651}
     652void       Tria::MungsmtpParameterization(void){/*{{{*/
     653        /*Are we on the base? If not, return*/
     654        if(!IsOnBase()) return;
     655
     656        int        i;
     657        IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
     658        IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
     659        IssmDouble PrecipitationsPresentday[NUMVERTICES][12],PrecipitationsLgm[NUMVERTICES][12];
     660        IssmDouble tmp[NUMVERTICES];
     661        IssmDouble TdiffTime,PfacTime;
     662        IssmDouble time,yts;
     663        this->parameters->FindParam(&time,TimeEnum);
     664        this->parameters->FindParam(&yts,ConstantsYtsEnum);
     665
     666        /*Recover present day temperature and precipitation*/
     667        Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
     668        Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
     669        Input*     input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
     670        Input*     input4=inputs->GetInput(SurfaceforcingsPrecipitationsLgmEnum);        _assert_(input4);
     671        GaussTria* gauss=new GaussTria();
     672        for(int month=0;month<12;month++) {
     673                for(int iv=0;iv<NUMVERTICES;iv++) {
     674                        gauss->GaussVertex(iv);
     675                        input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
     676                        input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
     677                        input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
     678                        input4->GetInputValue(&PrecipitationsLgm[iv][month],gauss,month/12.*yts);
     679                }
     680        }
     681
     682        /*Recover interpolation parameters at time t*/
     683        this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
     684        this->parameters->FindParam(&PfacTime,SurfaceforcingsPfacEnum,time);
     685
     686        /*Compute the temperature and precipitation*/
     687        for(int iv=0;iv<NUMVERTICES;iv++){
     688          ComputeMungsmTemperaturePrecipitation(TdiffTime,PfacTime,
     689                                        &PrecipitationsLgm[iv][0],&PrecipitationsPresentday[iv][0],
     690                                        &TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0],
     691                                        &monthlytemperatures[iv][0], &monthlyprec[iv][0]);
     692        }
     693
     694        /*Update inputs*/
     695        TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
     696        TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
     697        for (int imonth=0;imonth<12;imonth++) {
     698                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
     699                TriaInput* newmonthinput1 = new TriaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
     700                NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
     701
     702                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
     703                TriaInput* newmonthinput2 = new TriaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
     704                NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
     705        }
     706        NewTemperatureInput->Configure(this->parameters);
     707        NewPrecipitationInput->Configure(this->parameters);
     708
     709        this->inputs->AddInput(NewTemperatureInput);
     710        this->inputs->AddInput(NewPrecipitationInput);
     711
     712        /*clean-up*/
     713        delete gauss;
     714}
    653715/*}}}*/
    654716int        Tria::EdgeOnBaseIndex(void){/*{{{*/
    655717
     
    24412503        return TriaRef::NumberofNodes(this->VelocityInterpolation());
    24422504}
    24432505/*}}}*/
    2444 void       Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){/*{{{*/
    2445 
     2506void       Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){/*{{{*/
     2507 
     2508   int        i;
    24462509   IssmDouble agd[NUMVERTICES];             // surface mass balance
    24472510   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
    2448    IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
    2449    IssmDouble PrecipitationsPresentday[NUMVERTICES][12],PrecipitationsLgm[NUMVERTICES][12];
     2511   IssmDouble tmp[NUMVERTICES];
    24502512   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
    24512513   IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
    24522514   IssmDouble PfacTime,TdiffTime,sealevTime;
    2453    IssmDouble sconv; //rhow_rain/rhoi / 12 months
    24542515   
    24552516   /*Get material parameters :*/
    24562517   rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
    24572518   rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
    2458    //rho_ice=matpar->GetRhoIce();
    2459    //rho_water=matpar->GetRhoFreshwater();
    24602519
    2461    sconv=(rho_water/rho_ice)/12.; //to convert monbthly prec in m of ice equivalent per month
     2520  /*Get some pdd parameters*/
     2521  desfac=matpar->GetMaterialParameter(SurfaceforcingsDesfacEnum);
     2522  s0p=matpar->GetMaterialParameter(SurfaceforcingsS0pEnum);
     2523  s0t=matpar->GetMaterialParameter(SurfaceforcingsS0tEnum);
     2524  rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
     2525  rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
    24622526
    24632527   /*Recover monthly temperatures and precipitation and Present day and LGm ones*/
    24642528   Input*     input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
    24652529   Input*     input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2);
    2466    Input*     input3=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input3);
    2467    Input*     input4=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input4);
    2468    Input*     input5=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum);  _assert_(input5);
    2469    Input*     input6=inputs->GetInput(SurfaceforcingsPrecipitationsLgmEnum);   _assert_(input6);
    24702530   GaussTria* gauss=new GaussTria();
    24712531   IssmDouble time,yts;
    24722532   this->parameters->FindParam(&time,TimeEnum);
    24732533   this->parameters->FindParam(&yts,ConstantsYtsEnum);
     2534
     2535
    24742536   for(int month=0;month<12;month++) {
    24752537     for(int iv=0;iv<NUMVERTICES;iv++) {
    24762538       gauss->GaussVertex(iv);
    24772539       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
    24782540       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
    24792541       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
    2480        monthlyprec[iv][month]=monthlyprec[iv][month]*sconv*yts; // convertion in m/y
    2481        input3->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
    2482        TemperaturesPresentday[iv][month]=TemperaturesPresentday[iv][month]-273.15; // conversion from Kelvin to celcius
    2483        input4->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
    2484        TemperaturesLgm[iv][month]=TemperaturesLgm[iv][month]-273.15; // conversion from Kelvin to celcius
    2485        input5->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
    2486        PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month];
    2487        input6->GetInputValue(&PrecipitationsLgm[iv][month],gauss,month/12.*yts);
    2488        PrecipitationsLgm[iv][month]=PrecipitationsLgm[iv][month]; 
    24892542     }
    24902543   }
    24912544
    2492   /*Recover Pfac, Tdiff and sealev at time t:*/
    2493   this->parameters->FindParam(&PfacTime,SurfaceforcingsPfacEnum,time);
    2494   this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
    2495   this->parameters->FindParam(&sealevTime,SurfaceforcingsSealevEnum,time);
     2545  /*Recover Pfac, Tdiff and sealev at time t:
     2546    This parameters are used to interpolate the temperature
     2547    and precipitaton between PD and LGM when ismungsm==1 */
     2548  if (ismungsm==1){ 
     2549    this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
     2550    this->parameters->FindParam(&sealevTime,SurfaceforcingsSealevEnum,time);
     2551  }
     2552  else {
     2553    TdiffTime=0;
     2554    sealevTime=0; 
     2555  }
    24962556
    24972557  /*Recover info at the vertices: */
    24982558  GetInputListOnVertices(&h[0],ThicknessEnum);
    24992559  GetInputListOnVertices(&s[0],SurfaceEnum);
    2500 
    2501   /*Get other pdd parameters*/
    2502   desfac=matpar->GetMaterialParameter(SurfaceforcingsDesfacEnum);
    2503   s0p=matpar->GetMaterialParameter(SurfaceforcingsS0pEnum);
    2504   s0t=matpar->GetMaterialParameter(SurfaceforcingsS0tEnum);
    2505   rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
    2506   rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
    25072560     
    25082561   /*measure the surface mass balance*/
    2509    for (int iv = 0; iv<NUMVERTICES; iv++){
    2510      agd[iv]=PddSurfaceMassBlance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
    2511                                   &TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0],
    2512                                   &PrecipitationsLgm[iv][0], &PrecipitationsPresentday[iv][0],
     2562  for (int iv = 0; iv<NUMVERTICES; iv++){
     2563     agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
    25132564                                  pdds, pds, signorm, yts, h[iv], s[iv],
    2514                                   desfac, s0t, s0p,rlaps,rlapslgm,PfacTime,TdiffTime,sealevTime);
     2565                                  desfac, s0t, s0p,rlaps,rlapslgm,TdiffTime,sealevTime,
     2566                                  rho_water,rho_ice);
    25152567   }
    25162568
    25172569   /*Update inputs*/   
     2570   // TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
     2571   // TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
     2572   // for (int imonth=0;imonth<12;imonth++) {
     2573   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
     2574   //   TriaInput* newmonthinput1 = new TriaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
     2575   //   NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
     2576   //
     2577   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
     2578   //   TriaInput* newmonthinput2 = new TriaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
     2579   //   NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
     2580   // }
     2581   // NewTemperatureInput->Configure(this->parameters);
     2582   // NewPrecipitationInput->Configure(this->parameters);
     2583
     2584
    25182585   this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
     2586   // this->inputs->AddInput(NewTemperatureInput);
     2587   // this->inputs->AddInput(NewPrecipitationInput);
    25192588   // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
    25202589
     2590   //this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
     2591   // this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
     2592   // this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
     2593
    25212594        /*clean-up*/
    25222595        delete gauss;
    25232596}
  • ../trunk-jpl/src/c/classes/Elements/Tria.h

     
    6262                void        ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
    6363                void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
    6464                void        Delta18oParameterization(void);
     65                void        MungsmtpParameterization(void);
    6566                int         EdgeOnBaseIndex();
    6667                void        EdgeOnBaseIndices(int* pindex1,int* pindex);
    6768                int         EdgeOnSurfaceIndex();
     
    108109                int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
    109110                int         NumberofNodesPressure(void);
    110111                int         NumberofNodesVelocity(void);
    111                 void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
     112                void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm);
    112113                void        PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
    113114                int         PressureInterpolation();
    114115                void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
  • ../trunk-jpl/src/c/classes/Elements/Penta.cpp

     
    607607                        input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
    608608                        input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
    609609                        input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
    610                         PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month]/yts; // converion in m/sec
    611610                }
    612611        }
    613612
     
    652651        /*clean-up*/
    653652        delete gauss;
    654653}
     654void       Penta::MungsmtpParameterization(void){/*{{{*/
     655        /*Are we on the base? If not, return*/
     656        if(!IsOnBase()) return;
     657
     658        int        i;
     659        IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
     660        IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
     661        IssmDouble PrecipitationsPresentday[NUMVERTICES][12],PrecipitationsLgm[NUMVERTICES][12];
     662        IssmDouble tmp[NUMVERTICES];
     663        IssmDouble TdiffTime,PfacTime;
     664        IssmDouble time,yts;
     665        this->parameters->FindParam(&time,TimeEnum);
     666        this->parameters->FindParam(&yts,ConstantsYtsEnum);
     667
     668        /*Recover present day temperature and precipitation*/
     669        Input*     input=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);    _assert_(input);
     670        Input*     input2=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);          _assert_(input2);
     671        Input*     input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3);
     672        Input*     input4=inputs->GetInput(SurfaceforcingsPrecipitationsLgmEnum);        _assert_(input4);
     673        GaussPenta* gauss=new GaussPenta();
     674        for(int month=0;month<12;month++) {
     675                for(int iv=0;iv<NUMVERTICES;iv++) {
     676                        gauss->GaussVertex(iv);
     677                        input->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
     678                        input2->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
     679                        input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
     680                        input4->GetInputValue(&PrecipitationsLgm[iv][month],gauss,month/12.*yts);
     681                }
     682        }
     683
     684        /*Recover interpolation parameters at time t*/
     685        this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
     686        this->parameters->FindParam(&PfacTime,SurfaceforcingsPfacEnum,time);
     687
     688        /*Compute the temperature and precipitation*/
     689        for(int iv=0;iv<NUMVERTICES;iv++){
     690          ComputeMungsmTemperaturePrecipitation(TdiffTime,PfacTime,
     691                                        &PrecipitationsLgm[iv][0],&PrecipitationsPresentday[iv][0],
     692                                        &TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0],
     693                                        &monthlytemperatures[iv][0], &monthlyprec[iv][0]);
     694        }
     695
     696        /*Update inputs*/
     697        TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
     698        TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
     699        for (int imonth=0;imonth<12;imonth++) {
     700                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
     701                PentaInput* newmonthinput1 = new PentaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
     702                NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
     703       
     704                for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
     705                PentaInput* newmonthinput2 = new PentaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
     706                NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
     707        }
     708        NewTemperatureInput->Configure(this->parameters);
     709        NewPrecipitationInput->Configure(this->parameters);
     710
     711        this->inputs->AddInput(NewTemperatureInput);
     712        this->inputs->AddInput(NewPrecipitationInput);
     713       
     714        this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
     715        this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
     716
     717        /*clean-up*/
     718        delete gauss;
     719}
    655720/*}}}*/
    656721void       Penta::ElementResponse(IssmDouble* presponse,int response_enum){/*{{{*/
    657722
     
    20812146
    20822147}
    20832148/*}}}*/
    2084 void       Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){/*{{{*/
     2149void       Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){/*{{{*/
    20852150
     2151   int        i;
    20862152   IssmDouble agd[NUMVERTICES];             // surface mass balance
    20872153   IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
    2088    IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
    2089    IssmDouble PrecipitationsPresentday[NUMVERTICES][12],PrecipitationsLgm[NUMVERTICES][12];
     2154   IssmDouble tmp[NUMVERTICES];
    20902155   IssmDouble h[NUMVERTICES],s[NUMVERTICES];
    20912156   IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
    20922157   IssmDouble PfacTime,TdiffTime,sealevTime;
    2093    IssmDouble sconv; //rhow_rain/rhoi / 12 months
    20942158
    20952159   /*Get material parameters :*/
    20962160   rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
    20972161   rho_ice=matpar->GetMaterialParameter(MaterialsRhoIceEnum);
    2098    //rho_ice=matpar->GetRhoIce();
    2099    //rho_water=matpar->GetRhoFreshwater();
    21002162
    2101    sconv=(rho_water/rho_ice)/12.; //to convert monbthly prec in m of ice equivalent per month
     2163  /*Get some pdd parameters*/
     2164  desfac=matpar->GetMaterialParameter(SurfaceforcingsDesfacEnum);
     2165  s0p=matpar->GetMaterialParameter(SurfaceforcingsS0pEnum);
     2166  s0t=matpar->GetMaterialParameter(SurfaceforcingsS0tEnum);
     2167  rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
     2168  rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
    21022169
    21032170   /*Recover monthly temperatures and precipitation*/
    21042171   Input*     input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
    21052172   Input*     input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2);
    2106    Input*     input3=inputs->GetInput(SurfaceforcingsTemperaturesPresentdayEnum);  _assert_(input3);
    2107    Input*     input4=inputs->GetInput(SurfaceforcingsTemperaturesLgmEnum);   _assert_(input4);
    2108    Input*     input5=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum);  _assert_(input5);
    2109    Input*     input6=inputs->GetInput(SurfaceforcingsPrecipitationsLgmEnum);   _assert_(input6);
    21102173   GaussPenta* gauss=new GaussPenta();
    21112174   IssmDouble time,yts;
    21122175   this->parameters->FindParam(&time,TimeEnum);
     
    21182181       input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
    21192182       monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
    21202183       input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
    2121        monthlyprec[iv][month]=monthlyprec[iv][month]*sconv; // convertion to m/yr
    2122        input3->GetInputValue(&TemperaturesPresentday[iv][month],gauss,month/12.*yts);
    2123        TemperaturesPresentday[iv][month]=TemperaturesPresentday[iv][month]-273.15; // conversion from Kelvin to celcius
    2124        input4->GetInputValue(&TemperaturesLgm[iv][month],gauss,month/12.*yts);
    2125        TemperaturesLgm[iv][month]=TemperaturesLgm[iv][month]-273.15; // conversion from Kelvin to celcius
    2126        input5->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts);
    2127        PrecipitationsPresentday[iv][month]=PrecipitationsPresentday[iv][month];
    2128        input6->GetInputValue(&PrecipitationsLgm[iv][month],gauss,month/12.*yts);
    2129        PrecipitationsLgm[iv][month]=PrecipitationsLgm[iv][month]; 
    21302184     }
    21312185   }
    21322186
    2133   /*Recover Pfac, Tdiff and sealev at time t:*/
    2134   this->parameters->FindParam(&PfacTime,SurfaceforcingsPfacEnum,time);
    2135   this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
    2136   this->parameters->FindParam(&sealevTime,SurfaceforcingsSealevEnum,time);
     2187  /*Recover Pfac, Tdiff and sealev at time t:
     2188    This parameters are used to interpolate the temperature
     2189    and precipitaton between PD and LGM when ismungsm==1 */
     2190  if (ismungsm==1){ 
     2191    this->parameters->FindParam(&TdiffTime,SurfaceforcingsTdiffEnum,time);
     2192    this->parameters->FindParam(&sealevTime,SurfaceforcingsSealevEnum,time);
     2193  }
     2194  else {
     2195    TdiffTime=0;
     2196    sealevTime=0; 
     2197  }
    21372198
    21382199  /*Recover info at the vertices: */
    21392200  GetInputListOnVertices(&h[0],ThicknessEnum);
    21402201  GetInputListOnVertices(&s[0],SurfaceEnum);
    21412202
    2142   /*Get other pdd parameters*/
    2143   desfac=matpar->GetMaterialParameter(SurfaceforcingsDesfacEnum);
    2144   s0p=matpar->GetMaterialParameter(SurfaceforcingsS0pEnum);
    2145   s0t=matpar->GetMaterialParameter(SurfaceforcingsS0tEnum);
    2146   rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
    2147   rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
    21482203
    21492204   /*measure the surface mass balance*/
    21502205   for (int iv = 0; iv < NUMVERTICES; iv++){
    2151      agd[iv]=PddSurfaceMassBlance(&monthlytemperatures[iv][0], &monthlyprec[iv][0], 
    2152                                   &TemperaturesLgm[iv][0], &TemperaturesPresentday[iv][0],
    2153                                   &PrecipitationsLgm[iv][0], &PrecipitationsPresentday[iv][0],
     2206     agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0], 
    21542207                                  pdds,pds, signorm, yts, h[iv], s[iv],
    2155                                   desfac, s0t, s0p,rlaps,rlapslgm,PfacTime,TdiffTime,sealevTime);
     2208                                  desfac, s0t, s0p,rlaps,rlapslgm,TdiffTime,sealevTime,
     2209                                  rho_water,rho_ice);
    21562210   }
    21572211
    21582212   /*Update inputs*/   
     2213   // TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
     2214   // TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum);
     2215   // for (int imonth=0;imonth<12;imonth++) {
     2216   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlytemperatures[i][imonth];
     2217   //   PentaInput* newmonthinput1 = new PentaInput(SurfaceforcingsMonthlytemperaturesEnum,&tmp[0],P1Enum);
     2218   //   NewTemperatureInput->AddTimeInput(newmonthinput1,time+imonth/12.*yts);
     2219   //
     2220   //   for(i=0;i<NUMVERTICES;i++) tmp[i]=monthlyprec[i][imonth];
     2221   //   PentaInput* newmonthinput2 = new PentaInput(SurfaceforcingsPrecipitationEnum,&tmp[0],P1Enum);
     2222   //   NewPrecipitationInput->AddTimeInput(newmonthinput2,time+imonth/12.*yts);
     2223   // }
     2224   // NewTemperatureInput->Configure(this->parameters);
     2225   // NewPrecipitationInput->Configure(this->parameters);
     2226
     2227
     2228
    21592229   this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
    2160    //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
    2161    this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
     2230   // this->inputs->AddInput(NewTemperatureInput);
     2231   // this->inputs->AddInput(NewPrecipitationInput);
     2232   // //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
     2233    this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
     2234   // this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
     2235   // this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
    21622236
    2163         /*clean-up*/
    2164         delete gauss;
     2237   /*clean-up*/
     2238   delete gauss;
    21652239}
    21662240/*}}}*/
    21672241void       Penta::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){/*{{{*/
  • ../trunk-jpl/src/c/classes/Elements/Penta.h

     
    5858                void           ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
    5959                ElementMatrix* CreateBasalMassMatrix(void);
    6060                void           Delta18oParameterization(void);
     61                void           MungsmtpParameterization(void);
    6162                void           ElementResponse(IssmDouble* presponse,int response_enum);
    6263                void           ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
    6364                int            FiniteElement(void);
     
    136137                int            NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
    137138                int            NumberofNodesPressure(void);
    138139                int            NumberofNodesVelocity(void);
    139                 void           PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
     140                void           PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm);
    140141                void           PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
    141142                int            PressureInterpolation();
    142143                void           ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
  • ../trunk-jpl/src/c/classes/Elements/Seg.h

     
    5353                void        ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
    5454                void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
    5555                void        Delta18oParameterization(void){_error_("not implemented yet");};
     56                void        MungsmtpParameterization(void){_error_("not implemented yet");};
    5657                void        ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
    5758                void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
    5859                void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
     
    128129                void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list){_error_("not implemented yet");};
    129130                int         NumberofNodesPressure(void){_error_("not implemented yet");};
    130131                int         NumberofNodesVelocity(void){_error_("not implemented yet");};
    131                 void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
     132                void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){_error_("not implemented yet");};
    132133                void        PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
    133134                int         PressureInterpolation(void){_error_("not implemented yet");};
    134135                void        ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){_error_("not implemented yet");};
  • ../trunk-jpl/src/c/classes/Elements/Tetra.h

     
    5353                void        ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
    5454                void        ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
    5555                void        Delta18oParameterization(void){_error_("not implemented yet");};
     56                void        MungsmtpParameterization(void){_error_("not implemented yet");};
    5657                IssmDouble  DragCoefficientAbsGradient(void){_error_("not implemented yet");};
    5758                void        ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
    5859                void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
     
    134135                void        NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
    135136                int         NumberofNodesPressure(void);
    136137                int         NumberofNodesVelocity(void);
    137                 void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
     138                void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm,bool ismungsm){_error_("not implemented yet");};
    138139                void        PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
    139140                int         PressureInterpolation(void);
    140141                void        ResetFSBasalBoundaryCondition(void);
  • ../trunk-jpl/src/m/classes/SMBpdd.py

     
    2525                self.Tdiff                     = float('NaN')
    2626                self.sealev                    = float('NaN')
    2727                self.isdelta18o                = 0
     28                self.ismungsm                  = 0
    2829                self.delta18o                  = float('NaN')
    2930                self.delta18o_surface          = float('NaN')
    3031                self.temperatures_presentday   = float('NaN')
    3132                self.temperatures_lgm          = float('NaN')
    3233                self.precipitations_presentday = float('NaN')
     34                self.precipitations_lgm        = float('NaN')
    3335
    3436                #set defaults
    3537                self.setdefaultparameters()
     
    3739        def __repr__(self): # {{{
    3840                string="   surface forcings parameters:"
    3941
    40                 string="%s\n%s"%(string,fielddisplay(self,'precipitation','surface precipitation [m/yr water eq]'))
     42                string="%s\n%s"%(string,fielddisplay(self,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)'))
     43                string="%s\n%s"%(string,fielddisplay(self,'ismungsm','is temperature and precipitation mungsm parametrisation activated (0 or 1, default is 0)'))
    4144                string="%s\n%s"%(string,fielddisplay(self,'desfac','desertification elevation factor (between 0 and 1, default is 0.5) [m]'))
    42                 string="%s\n%s"%(string,fielddisplay(self,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)'))
    4345                string="%s\n%s"%(string,fielddisplay(self,'s0p','should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]'))
    4446                string="%s\n%s"%(string,fielddisplay(self,'s0t','should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]'))
    4547                string="%s\n%s"%(string,fielddisplay(self,'rlaps','present day lapse rate [degree/km]'))
    4648                string="%s\n%s"%(string,fielddisplay(self,'rlapslgm','LGM lapse rate [degree/km]'))
    47                 string="%s\n%s"%(string,fielddisplay(self,'Pfac','time interpolation parameter for precipitation, 1D (year)'))
    48                 string="%s\n%s"%(string,fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D (year)'))
    49                 string="%s\n%s"%(string,fielddisplay(self,'sealev','sea level [m], 1D(year)'))
    50                 string="%s\n%s"%(string,fielddisplay(self,'monthlytemperatures','monthly surface temperatures [K], required if pdd is activated and delta18o not activated'))
    51                 string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if pdd is activated and delta18o activated'))
    52                 string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if pdd is activated and delta18o activated'))
    53                 string="%s\n%s"%(string,fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated'))
    54                 string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
    55                 string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
    56 
     49                if not (self.isdelta18o and self.ismungsm):
     50                        string="%s\n%s"%(string,fielddisplay(self,'monthlytemperatures',['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']))
     51                        string="%s\n%s"%(string,fielddisplay(self,'precipitation',['monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated']))
     52                        if self.isdelta18o:
     53                                string="%s\n%s"%(string,fielddisplay(self,'delta18o','delta18o, required if pdd is activated and delta18o activated'))
     54                                string="%s\n%s"%(string,fielddisplay(self,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated'))
     55                                string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
     56                                string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
     57                                string="%s\n%s"%(string,fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     58                                string="%s\n%s"%(string,fielddisplay(self,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     59                                string="%s\n%s"%(string,fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
     60                                string="%s\n%s"%(string,fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated'))
     61                        if self.ismungsm:
     62                                string="%s\n%s"%(string,fielddisplay(self,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated'))
     63                                string="%s\n%s"%(string,fielddisplay(self,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated'))
     64                                string="%s\n%s"%(string,fielddisplay(self,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     65                                string="%s\n%s"%(string,fielddisplay(self,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated'))
     66                                string="%s\n%s"%(string,fielddisplay(self,'Pfac','time interpolation parameter for precipitation, 1D(year), required if mungsm is activated'))
     67                                string="%s\n%s"%(string,fielddisplay(self,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated'))
     68                                string="%s\n%s"%(string,fielddisplay(self,'sealev','sea level [m], 1D(year), required if mungsm is activated'))
    5769                return string
    5870                #}}}
    5971        def extrude(self,md): # {{{
    6072
    61                 self.precipitation=project3d(md,'vector',self.precipitation,'type','node');
    62                 self.monthlytemperatures=project3d(md,'vector',self.monthlytemperatures,'type','node');
     73                if not (self.isdelta18o and self.ismungsm):
     74                        self.precipitation=project3d(md,'vector',self.precipitation,'type','node')
     75                        self.monthlytemperatures=project3d(md,'vector',self.monthlytemperatures,'type','node')
    6376                if self.isdelta18o: self.temperatures_lgm=project3d(md,'vector',self.temperatures_lgm,'type','node')
    6477                if self.isdelta18o: self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node')
    6578                if self.isdelta18o: self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node')
     79                if self.isdelta18o: self.precipitations_lgm=project3d(md,'vector',self.precipitations_lgm,'type','node')
     80                if self.ismungsm: self.temperatures_lgm=project3d(md,'vector',self.temperatures_lgm,'type','node')
     81                if self.ismungsm: self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node')
     82                if self.ismungsm: self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node')
     83                if self.ismungsm: self.precipitations_lgm=project3d(md,'vector',self.precipitations_lgm,'type','node')
    6684                return self
    6785        #}}}
    6886        def initialize(self,md): # {{{
    6987
    70                 if numpy.all(numpy.isnan(self.precipitation)):
    71                         self.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
    72                         print "      no SMBpdd.precipitation specified: values set as zero"
    73 
    74                 return self
     88                # if numpy.all(numpy.isnan(self.precipitation)):
     89                #       self.precipitation=numpy.zeros((md.mesh.numberofvertices,1))
     90                #       print "      no SMBpdd.precipitation specified: values set as zero"
     91                #
     92                # return self
    7593        #}}}
    7694        def setdefaultparameters(self): # {{{
    7795                 
    7896                #pdd method not used in default mode
    7997                self.isdelta18o = 0
     98                self.ismungsm   = 0
    8099                self.desfac     = 0.5
    81100                self.s0p        = 0.
    82101                self.s0t        = 0.
     
    88107        def checkconsistency(self,md,solution,analyses):    # {{{
    89108
    90109                if MasstransportAnalysisEnum() in analyses:
    91                         md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',[1]);
    92                         md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',[1]);
    93                         md = checkfield(md,'fieldname','surfaceforcings.s0t','>=',0,'numel',[1]);
    94                         md = checkfield(md,'fieldname','surfaceforcings.rlaps','>=',0,'numel',[1]);
    95                         md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',[1]);
    96                         md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,numpy.nan]);
    97                         md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1,'size',[2,numpy.nan]);
    98                         md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1,'size',[2,numpy.nan]);
    99                         if not self.isdelta18o:
    100                                 md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1)
    101                                 md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1)
    102                         else:
     110                        md = checkfield(md,'fieldname','surfaceforcings.desfac','<=',1,'numel',[1])
     111                        md = checkfield(md,'fieldname','surfaceforcings.s0p','>=',0,'numel',[1])
     112                        md = checkfield(md,'fieldname','surfaceforcings.s0t','>=',0,'numel',[1])
     113                        md = checkfield(md,'fieldname','surfaceforcings.rlaps','>=',0,'numel',[1])
     114                        md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',[1])
     115
     116                        if not (self.isdelta18o and self.ismungsm):
     117                                md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','NaN',1)
     118                                md = checkfield(md,'fieldname','surfaceforcings.precipitation','NaN',1)
     119                        elif self.isdelta18o:
    103120                                md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1)
    104121                                md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1)
    105122                                md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
    106123                                md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1,12],'NaN',1)
    107124                                md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1)
     125                                md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1)                                       
     126                                md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1,'size',[2,numpy.nan])
     127                                md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1,'size',[2,numpy.nan])
     128                        elif self.ismungsm:
     129                                md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1)
     130                                md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1)
     131                                md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1)
     132                                md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1)                                       
     133                                md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,numpy.nan])
     134                                md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1,'size',[2,numpy.nan])
     135                                md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1,'size',[2,numpy.nan])
    108136
    109137                return md
    110138        # }}}
     
    112140
    113141                yts=365.0*24.0*3600.0
    114142
    115                 WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer');
     143                WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer')
    116144
    117                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
    118145                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean')
    119                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','desfac','format','Double');
    120                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0p','format','Double');
    121                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0t','format','Double');
    122                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlaps','format','Double');
    123                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlapslgm','format','Double');
    124                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1);
    125                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
    126                 WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
    127                 if self.isdelta18o:
     146                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','ismungsm','format','Boolean')
     147                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','desfac','format','Double')
     148                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0p','format','Double')
     149                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','s0t','format','Double')
     150                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlaps','format','Double')
     151                WriteData(fid,'object',self,'class','surfaceforcings','fieldname','rlapslgm','format','Double')
     152
     153                if not (self.isdelta18o and self.ismungsm):
     154                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1)
     155                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1)
     156                elif self.isdelta18o:
    128157                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1)
    129158                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1)
    130159                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1)
     160                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1)
    131161                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1)
    132162                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1)
    133                 else:
    134                         WriteData(fid,'object',self,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
     163                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1)
     164                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1)                   
     165                elif self.ismungsm:
     166                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1)
     167                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1)
     168                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1)
     169                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1)
     170                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1)
     171                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1)
     172                        WriteData(fid,'object',self,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1)
    135173        # }}}
  • ../trunk-jpl/src/m/classes/SMBpdd.m

     
    1616                Tdiff                     = NaN;
    1717                sealev                    = NaN;
    1818                isdelta18o                = 0;
     19                ismungsm                  = 0;
    1920                delta18o                  = NaN;
    2021                delta18o_surface          = NaN;
    2122                temperatures_presentday   = NaN;
     
    3334                        end
    3435                end % }}}
    3536                function self = extrude(self,md) % {{{
    36 
    37                         self.precipitation=project3d(md,'vector',self.precipitation,'type','node');
    38                         self.monthlytemperatures=project3d(md,'vector',self.monthlytemperatures,'type','node');
     37                        if(self.isdelta18o==0 & self.ismungsm==0),self.precipitation=project3d(md,'vector',self.precipitation,'type','node');end
     38                        if(self.isdelta18o==0 & self.ismungsm==0),self.monthlytemperatures=project3d(md,'vector',self.monthlytemperatures,'type','node');end
    3939                        if(self.isdelta18o),self.temperatures_lgm=project3d(md,'vector',self.temperatures_lgm,'type','node');end
    4040                        if(self.isdelta18o),self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node');end
    4141                        if(self.isdelta18o),self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node');end
    4242                        if(self.isdelta18o),self.precipitations_lgm=project3d(md,'vector',self.precipitations_lgm,'type','node');end
     43                        if(self.ismungsm),self.temperatures_lgm=project3d(md,'vector',self.temperatures_lgm,'type','node');end
     44                        if(self.ismungsm),self.temperatures_presentday=project3d(md,'vector',self.temperatures_presentday,'type','node');end
     45                        if(self.ismungsm),self.precipitations_presentday=project3d(md,'vector',self.precipitations_presentday,'type','node');end
     46                        if(self.ismungsm),self.precipitations_lgm=project3d(md,'vector',self.precipitations_lgm,'type','node');end
    4347
    44 
    4548                end % }}}
    4649                function self = initialize(self,md) % {{{
     50                   
     51                        % if isnan(self.precipitation),
     52                        %       self.precipitation=zeros(md.mesh.numberofvertices,1);
     53                        %       disp('      no SMBpdd.precipitation specified: values set as zero');
     54                        % end
    4755
    48                         if isnan(self.precipitation),
    49                                 self.precipitation=zeros(md.mesh.numberofvertices,1);
    50                                 disp('      no SMBpdd.precipitation specified: values set as zero');
    51                         end
    52 
    5356                end % }}}
    5457                function obj = setdefaultparameters(obj) % {{{
    5558
    5659                  obj.isdelta18o = 0;
     60                  obj.ismungsm   = 0;
    5761                  obj.desfac     = 0.5;
    5862                  obj.s0p        = 0;
    5963                  obj.s0t        = 0;
     
    6973                                md = checkfield(md,'fieldname','surfaceforcings.s0t','>=',0,'numel',1);
    7074                                md = checkfield(md,'fieldname','surfaceforcings.rlaps','>=',0,'numel',1);
    7175                                md = checkfield(md,'fieldname','surfaceforcings.rlapslgm','>=',0,'numel',1);
    72             md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,NaN]);
    73             md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1,'size',[2,NaN]);
    74             md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1,'size',[2,NaN]);
    75                                 if(obj.isdelta18o==0)
    76                                         md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
    77                                         md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
    78                                 else
    79                                         md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
    80                                         md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
    81                                         md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    82                                         md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    83                                         md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
    84                                         md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     76                                if(obj.isdelta18o==0 & obj.ismungsm==0)
     77                                    md = checkfield(md,'fieldname','surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
     78                                    md = checkfield(md,'fieldname','surfaceforcings.precipitation','forcing',1,'NaN',1);
     79                                elseif(obj.isdelta18o==1)
     80                                    md = checkfield(md,'fieldname','surfaceforcings.delta18o','NaN',1);
     81                                    md = checkfield(md,'fieldname','surfaceforcings.delta18o_surface','NaN',1);
     82                                    md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     83                                    md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     84                                    md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     85                                    md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
     86                                    md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
     87                                    md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
     88                                elseif(obj.ismungsm==1)
     89                                    md = checkfield(md,'fieldname','surfaceforcings.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     90                                    md = checkfield(md,'fieldname','surfaceforcings.temperatures_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     91                                    md = checkfield(md,'fieldname','surfaceforcings.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1);
     92                                    md = checkfield(md,'fieldname','surfaceforcings.precipitations_lgm','size',[md.mesh.numberofvertices+1 12],'NaN',1);                                       
     93                                    md = checkfield(md,'fieldname','surfaceforcings.Pfac','NaN',1,'size',[2,NaN]);
     94                                    md = checkfield(md,'fieldname','surfaceforcings.Tdiff','NaN',1);
     95                                    md = checkfield(md,'fieldname','surfaceforcings.sealev','NaN',1);
    8596                                end
    86                         end
     97                        end
    8798                end % }}}
    8899                function disp(obj) % {{{
    89100                        disp(sprintf('   surface forcings parameters:'));
    90101
    91102                        disp(sprintf('\n   PDD and deltaO18 parameters:'));
    92103                        fielddisplay(obj,'isdelta18o','is temperature and precipitation delta18o parametrisation activated (0 or 1, default is 0)');
     104                        fielddisplay(obj,'ismungsm','is temperature and precipitation mungsm parametrisation activated (0 or 1, default is 0)');
    93105                        fielddisplay(obj,'desfac','desertification elevation factor (between 0 and 1, default is 0.5) [m]');
    94106                        fielddisplay(obj,'s0p','should be set to elevation from precip source (between 0 and a few 1000s m, default is 0) [m]');
    95107                        fielddisplay(obj,'s0t','should be set to elevation from temperature source (between 0 and a few 1000s m, default is 0) [m]');
    96108                        fielddisplay(obj,'rlaps','present day lapse rate [degree/km]');
    97109                        fielddisplay(obj,'rlapslgm','LGM lapse rate [degree/km]');
    98                         fielddisplay(obj,'Pfac','time interpolation parameter for precipitation, 1D(year)');
    99                         fielddisplay(obj,'Tdiff','time interpolation parameter for temperature, 1D(year)');
    100                         fielddisplay(obj,'sealev','sea level [m], 1D(year)');
    101                         fielddisplay(obj,'monthlytemperatures',['CURRENTLY NOT USED monthly surface temperatures [K], required if pdd is activated and delta18o not activated']);
    102                         fielddisplay(obj,'precipitation',['CURRENTLY NOT USED monthly surface precipitation [m/yr water eq]']);
    103                         fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [K], required if pdd is activated and delta18o activated');
    104                         fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [K], required if pdd is activated and delta18o activated');
    105                         fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated');
    106                         fielddisplay(obj,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o activated');
    107                         fielddisplay(obj,'delta18o','delta18o, required if pdd is activated and delta18o activated');
    108                         fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
    109 
     110                        if(obj.isdelta18o==0 & obj.ismungsm==0)
     111                            fielddisplay(obj,'monthlytemperatures',['monthly surface temperatures [K], required if pdd is activated and delta18o not activated']);
     112                            fielddisplay(obj,'precipitation',['monthly surface precipitation [m/yr water eq], required if pdd is activated and delta18o or mungsm not activated']);
     113                        elseif(obj.isdelta18o==1)
     114                            fielddisplay(obj,'delta18o','delta18o, required if pdd is activated and delta18o activated');
     115                            fielddisplay(obj,'delta18o_surface','surface elevation of the delta18o site, required if pdd is activated and delta18o activated');
     116                            fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated');
     117                            fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated');
     118                            fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
     119                            fielddisplay(obj,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
     120                            fielddisplay(obj,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated');
     121                            fielddisplay(obj,'sealev','sea level [m], 1D(year), required if mungsm is activated');
     122                        elseif(obj.ismungsm==1)
     123                            fielddisplay(obj,'temperatures_presentday','monthly present day surface temperatures [K], required if delta18o/mungsm is activated');
     124                            fielddisplay(obj,'temperatures_lgm','monthly LGM surface temperatures [K], required if delta18o or mungsm is activated');
     125                            fielddisplay(obj,'precipitations_presentday','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
     126                            fielddisplay(obj,'precipitations_lgm','monthly surface precipitation [m/yr water eq], required if delta18o or mungsm is activated');
     127                            fielddisplay(obj,'Pfac','time interpolation parameter for precipitation, 1D(year), required if mungsm is activated');
     128                            fielddisplay(obj,'Tdiff','time interpolation parameter for temperature, 1D(year), required if mungsm is activated');
     129                            fielddisplay(obj,'sealev','sea level [m], 1D(year), required if mungsm is activated');
     130                        end
    110131                end % }}}
    111132                function marshall(obj,md,fid) % {{{
    112133
     
    114135
    115136                        WriteData(fid,'enum',SurfaceforcingsEnum(),'data',SMBpddEnum(),'format','Integer');
    116137
    117                         WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
     138                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean');
     139                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','ismungsm','format','Boolean');
    118140                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','desfac','format','Double');
    119141                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','s0p','format','Double');
    120142                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','s0t','format','Double');
    121143                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','rlaps','format','Double');
    122144                        WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','rlapslgm','format','Double');
    123                         WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1);
    124                         WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
    125                         WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
    126                         WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','isdelta18o','format','Boolean');
    127                         if obj.isdelta18o
     145
     146                        if(obj.isdelta18o==0 & obj.ismungsm==0)
     147                            %WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1);
     148                            WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
     149                            WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitation','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
     150                        elseif obj.isdelta18o
    128151                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
    129152                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
    130153                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
    131154                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1);
    132155                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','delta18o_surface','format','DoubleMat','mattype',1);
    133156                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','delta18o','format','DoubleMat','mattype',1);
    134                         else
    135                                 WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','monthlytemperatures','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
     157                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
     158                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
     159                        elseif obj.ismungsm
     160                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_presentday','format','DoubleMat','mattype',1);
     161                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','temperatures_lgm','format','DoubleMat','mattype',1);
     162                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_presentday','format','DoubleMat','mattype',1);
     163                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','precipitations_lgm','format','DoubleMat','mattype',1);
     164                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Pfac','format','DoubleMat','mattype',1);
     165                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','Tdiff','format','DoubleMat','mattype',1);
     166                                WriteData(fid,'object',obj,'class','surfaceforcings','fieldname','sealev','format','DoubleMat','mattype',1);
    136167                        end
    137168                end % }}}
    138169        end
  • ../trunk-jpl/src/m/enum/EnumDefinitions.py

     
    341341def SurfaceforcingsDelta18oEnum(): return StringToEnum("SurfaceforcingsDelta18o")[0]
    342342def SurfaceforcingsDelta18oSurfaceEnum(): return StringToEnum("SurfaceforcingsDelta18oSurface")[0]
    343343def SurfaceforcingsIsdelta18oEnum(): return StringToEnum("SurfaceforcingsIsdelta18o")[0]
     344def SurfaceforcingsIsmungsmEnum(): return StringToEnum("SurfaceforcingsIsmungsm")[0]
    344345def SurfaceforcingsPrecipitationsPresentdayEnum(): return StringToEnum("SurfaceforcingsPrecipitationsPresentday")[0]
    345346def SurfaceforcingsPrecipitationsLgmEnum(): return StringToEnum("SurfaceforcingsPrecipitationsLgm")[0]
    346347def SurfaceforcingsTemperaturesPresentdayEnum(): return StringToEnum("SurfaceforcingsTemperaturesPresentday")[0]
Note: See TracBrowser for help on using the repository browser.