Changeset 12752
- Timestamp:
- 07/26/12 10:28:31 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/objects/Elements
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Elements/Penta.cpp
r12750 r12752 688 688 void Penta::Delta18oParameterization(void){ 689 689 690 690 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12]; 691 691 IssmDouble Delta18oTemperaturesPresentday[NUMVERTICES][12],Delta18oTemperaturesLgm[NUMVERTICES][12]; 692 692 IssmDouble PrecipitationsPresentday[NUMVERTICES][12]; 693 693 IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime; 694 694 IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime; 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 695 IssmDouble time,yts,finaltime; 696 this->parameters->FindParam(&time,TimeEnum); 697 this->parameters->FindParam(&yts,ConstantsYtsEnum); 698 this->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum); 699 700 /*Recover present day temperature and precipitation*/ 701 Input* input=inputs->GetInput(SurfaceforcingsDelta18oTemperaturesPresentdayEnum); _assert_(input); 702 Input* input2=inputs->GetInput(SurfaceforcingsDelta18oTemperaturesLgmEnum); _assert_(input2); 703 Input* input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3); 704 GaussPenta* gauss=new GaussPenta(); 705 for(int month=0;month<12;month++) { 706 for(int iv=0;iv<NUMVERTICES;iv++) { 707 gauss->GaussVertex(iv); 708 input->GetInputValue(&Delta18oTemperaturesPresentday[iv][month],gauss,month/12.*yts); 709 input2->GetInputValue(&Delta18oTemperaturesLgm[iv][month],gauss,month/12.*yts); 710 input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts); 711 monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion to m/yr 712 } 713 } 714 715 /*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/ 716 716 this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime*yts); 717 717 this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,(finaltime-21000)*yts); … … 721 721 this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time*yts); 722 722 723 724 725 726 727 728 729 730 731 732 723 /*Compute the temperature and precipitation*/ 724 for(int iv=0;iv<NUMVERTICES;iv++){ 725 ComputeDelta18oTemperaturePrecipitation(Delta18oSurfacePresent, Delta18oSurfaceLgm, Delta18oSurfaceTime, 726 Delta18oPresent, Delta18oLgm, Delta18oTime, 727 &PrecipitationsPresentday[iv][0], 728 &Delta18oTemperaturesLgm[iv][0], &Delta18oTemperaturesPresentday[iv][0], 729 &monthlytemperatures[iv][0], &monthlyprec[iv][0]); 730 } 731 732 /*Update inputs*/ 733 733 TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum); 734 734 TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum); 735 735 for (int imonth=0;imonth<12;imonth++) { 736 737 738 739 740 736 for(int iv=0;iv<NUMVERTICES;iv++) { 737 PentaP1Input* newmonthinput1 = new PentaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&monthlytemperatures[iv][imonth]); 738 NewTemperatureInput->AddTimeInput(newmonthinput1,imonth/12.*yts); 739 PentaP1Input* newmonthinput2 = new PentaP1Input(SurfaceforcingsPrecipitationEnum,&monthlyprec[iv][imonth]); 740 NewPrecipitationInput->AddTimeInput(newmonthinput2,imonth/12.*yts); 741 741 } 742 742 } 743 743 this->inputs->AddInput(NewTemperatureInput); 744 744 this->inputs->AddInput(NewPrecipitationInput); 745 746 /*clean-up*/ 747 delete gauss; 745 748 } 746 749 /*}}}*/ … … 2261 2264 } 2262 2265 2266 delete gauss; 2263 2267 if(found)*pvalue=value; 2264 2268 return found; … … 2358 2362 //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0])); 2359 2363 this->InputExtrude(SurfaceforcingsMassBalanceEnum,ElementEnum); 2364 2365 /*clean-up*/ 2366 delete gauss; 2360 2367 } 2361 2368 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Elements/Tria.cpp
r12750 r12752 911 911 void Tria::Delta18oParameterization(void){ 912 912 913 913 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12]; 914 914 IssmDouble Delta18oTemperaturesPresentday[NUMVERTICES][12],Delta18oTemperaturesLgm[NUMVERTICES][12]; 915 915 IssmDouble PrecipitationsPresentday[NUMVERTICES][12]; 916 916 IssmDouble Delta18oPresent,Delta18oLgm,Delta18oTime; 917 917 IssmDouble Delta18oSurfacePresent,Delta18oSurfaceLgm,Delta18oSurfaceTime; 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 918 IssmDouble time,yts,finaltime; 919 this->parameters->FindParam(&time,TimeEnum); 920 this->parameters->FindParam(&yts,ConstantsYtsEnum); 921 this->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum); 922 923 /*Recover present day temperature and precipitation*/ 924 Input* input=inputs->GetInput(SurfaceforcingsDelta18oTemperaturesPresentdayEnum); _assert_(input); 925 Input* input2=inputs->GetInput(SurfaceforcingsDelta18oTemperaturesLgmEnum); _assert_(input2); 926 Input* input3=inputs->GetInput(SurfaceforcingsPrecipitationsPresentdayEnum); _assert_(input3); 927 GaussTria* gauss=new GaussTria(); 928 for(int month=0;month<12;month++) { 929 for(int iv=0;iv<NUMVERTICES;iv++) { 930 gauss->GaussVertex(iv); 931 input->GetInputValue(&Delta18oTemperaturesPresentday[iv][month],gauss,month/12.*yts); 932 input2->GetInputValue(&Delta18oTemperaturesLgm[iv][month],gauss,month/12.*yts); 933 input3->GetInputValue(&PrecipitationsPresentday[iv][month],gauss,month/12.*yts); 934 monthlyprec[iv][month]=monthlyprec[iv][month]*yts; // convertion to m/yr 935 } 936 } 937 938 /*Recover delta18o and Delta18oSurface at present day, lgm and at time t*/ 939 939 this->parameters->FindParam(&Delta18oPresent,SurfaceforcingsDelta18oEnum,finaltime*yts); 940 940 this->parameters->FindParam(&Delta18oLgm,SurfaceforcingsDelta18oEnum,(finaltime-21000)*yts); … … 943 943 this->parameters->FindParam(&Delta18oSurfaceLgm,SurfaceforcingsDelta18oSurfaceEnum,(finaltime-21000)*yts); 944 944 this->parameters->FindParam(&Delta18oSurfaceTime,SurfaceforcingsDelta18oSurfaceEnum,time*yts); 945 946 947 948 949 950 951 952 953 954 955 945 946 /*Compute the temperature and precipitation*/ 947 for(int iv=0;iv<NUMVERTICES;iv++){ 948 ComputeDelta18oTemperaturePrecipitation(Delta18oSurfacePresent, Delta18oSurfaceLgm, Delta18oSurfaceTime, 949 Delta18oPresent, Delta18oLgm, Delta18oTime, 950 &PrecipitationsPresentday[iv][0], 951 &Delta18oTemperaturesLgm[iv][0], &Delta18oTemperaturesPresentday[iv][0], 952 &monthlytemperatures[iv][0], &monthlyprec[iv][0]); 953 } 954 955 /*Update inputs*/ 956 956 TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum); 957 957 TransientInput* NewPrecipitationInput = new TransientInput(SurfaceforcingsPrecipitationEnum); 958 958 for (int imonth=0;imonth<12;imonth++) { 959 960 961 962 963 959 for(int iv=0;iv<NUMVERTICES;iv++) { 960 TriaP1Input* newmonthinput1 = new TriaP1Input(SurfaceforcingsMonthlytemperaturesEnum,&monthlytemperatures[iv][imonth]); 961 NewTemperatureInput->AddTimeInput(newmonthinput1,imonth/12.*yts); 962 TriaP1Input* newmonthinput2 = new TriaP1Input(SurfaceforcingsPrecipitationEnum,&monthlyprec[iv][imonth]); 963 NewPrecipitationInput->AddTimeInput(newmonthinput2,imonth/12.*yts); 964 964 } 965 965 } 966 966 this->inputs->AddInput(NewTemperatureInput); 967 967 this->inputs->AddInput(NewPrecipitationInput); 968 969 /*clean-up*/ 970 delete gauss; 968 971 } 969 972 /*}}}*/ … … 2039 2042 int Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units){ 2040 2043 2041 int i; 2042 int found=0; 2043 IssmDouble value; 2044 Input* data=NULL; 2045 GaussTria *gauss = NULL; 2044 int found = 0; 2045 IssmDouble value; 2046 Input *data = NULL; 2047 GaussTria *gauss = NULL; 2046 2048 2047 2049 /*First, serarch the input: */ … … 2050 2052 /*figure out if we have the vertex id: */ 2051 2053 found=0; 2052 for(i =0;i<NUMVERTICES;i++){2054 for(int i=0;i<NUMVERTICES;i++){ 2053 2055 if(index==nodes[i]->GetVertexId()){ 2054 2056 /*Do we have natureofdataenum in our inputs? :*/ … … 2062 2064 } 2063 2065 } 2066 2067 /*clean-up*/ 2068 delete gauss; 2064 2069 2065 2070 if(found)*pvalue=value; … … 2188 2193 this->inputs->AddInput(new TriaP1Input(SurfaceforcingsMassBalanceEnum,&agd[0])); 2189 2194 // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0])); 2195 2196 /*clean-up*/ 2197 delete gauss; 2190 2198 } 2191 2199 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.