source: issm/oecreview/Archive/19101-20495/ISSM-19136-19137.diff@ 20498

Last change on this file since 20498 was 20498, checked in by Mathieu Morlighem, 9 years ago

CHG: done with Archive/19101-20495

File size: 5.5 KB
RevLine 
[20498]1Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
2===================================================================
3--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 19136)
4+++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 19137)
5@@ -2573,10 +2573,12 @@
6 int i;
7 IssmDouble agd[NUMVERTICES]; // surface mass balance
8 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
9+ IssmDouble yearlytemperatures[NUMVERTICES]={0.};
10 IssmDouble tmp[NUMVERTICES];
11 IssmDouble h[NUMVERTICES],s[NUMVERTICES];
12 IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
13 IssmDouble PfacTime,TdiffTime,sealevTime;
14+ IssmDouble mavg=1./12.; //factor for monthly average
15
16 /*Get material parameters :*/
17 rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
18@@ -2589,7 +2591,7 @@
19 rlaps=matpar->GetMaterialParameter(SurfaceforcingsRlapsEnum);
20 rlapslgm=matpar->GetMaterialParameter(SurfaceforcingsRlapslgmEnum);
21
22- /*Recover monthly temperatures and precipitation and Present day and LGm ones*/
23+ /*Recover monthly temperatures and precipitation and compute the yearly mean temperatures*/
24 Input* input=inputs->GetInput(SurfaceforcingsMonthlytemperaturesEnum); _assert_(input);
25 Input* input2=inputs->GetInput(SurfaceforcingsPrecipitationEnum); _assert_(input2);
26 GaussTria* gauss=new GaussTria();
27@@ -2597,15 +2599,15 @@
28 this->parameters->FindParam(&time,TimeEnum);
29 this->parameters->FindParam(&yts,ConstantsYtsEnum);
30
31-
32 for(int month=0;month<12;month++) {
33 for(int iv=0;iv<NUMVERTICES;iv++) {
34 gauss->GaussVertex(iv);
35 input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
36- monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
37+ yearlytemperatures[iv]=yearlytemperatures[iv]+monthlytemperatures[iv][month]*mavg; // Has to be in Kelvin
38+ monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius for PDD module
39 input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
40 }
41- }
42+ }
43
44 /*Recover Pfac, Tdiff and sealev at time t:
45 This parameters are used to interpolate the temperature
46@@ -2625,11 +2627,11 @@
47
48 /*measure the surface mass balance*/
49 for (int iv = 0; iv<NUMVERTICES; iv++){
50- agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
51+ agd[iv]=PddSurfaceMassBalance(&monthlytemperatures[iv][0], &monthlyprec[iv][0],
52 pdds, pds, signorm, yts, h[iv], s[iv],
53 desfac, s0t, s0p,rlaps,rlapslgm,TdiffTime,sealevTime,
54 rho_water,rho_ice);
55- }
56+ }
57
58 /*Update inputs*/
59 // TransientInput* NewTemperatureInput = new TransientInput(SurfaceforcingsMonthlytemperaturesEnum);
60@@ -2647,7 +2649,8 @@
61 // NewPrecipitationInput->Configure(this->parameters);
62
63
64- this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
65+ this->inputs->AddInput(new TriaInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
66+ this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
67 // this->inputs->AddInput(NewTemperatureInput);
68 // this->inputs->AddInput(NewPrecipitationInput);
69 // this->inputs->AddInput(new TriaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
70Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
71===================================================================
72--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp (revision 19136)
73+++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp (revision 19137)
74@@ -2165,10 +2165,12 @@
75 int i;
76 IssmDouble agd[NUMVERTICES]; // surface mass balance
77 IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
78+ IssmDouble yearlytemperatures[NUMVERTICES]={0.};
79 IssmDouble tmp[NUMVERTICES];
80 IssmDouble h[NUMVERTICES],s[NUMVERTICES];
81 IssmDouble rho_water,rho_ice,desfac,s0p,s0t,rlaps,rlapslgm;
82 IssmDouble PfacTime,TdiffTime,sealevTime;
83+ IssmDouble mavg=1./12.; //factor for monthly average
84
85 /*Get material parameters :*/
86 rho_water=matpar->GetMaterialParameter(MaterialsRhoSeawaterEnum);
87@@ -2193,7 +2195,8 @@
88 for(int iv=0;iv<NUMVERTICES;iv++) {
89 gauss->GaussVertex(iv);
90 input->GetInputValue(&monthlytemperatures[iv][month],gauss,time+month/12.*yts);
91- monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius
92+ yearlytemperatures[iv]=yearlytemperatures[iv]+monthlytemperatures[iv][month]*mavg; // Has to be in Kelvin
93+ monthlytemperatures[iv][month]=monthlytemperatures[iv][month]-273.15; // conversion from Kelvin to celcius for PDD module
94 input2->GetInputValue(&monthlyprec[iv][month],gauss,time+month/12.*yts);
95 }
96 }
97@@ -2240,11 +2243,13 @@
98
99
100
101+ this->inputs->AddInput(new PentaInput(TemperatureEnum,&yearlytemperatures[0],P1Enum));
102 this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum));
103 // this->inputs->AddInput(NewTemperatureInput);
104 // this->inputs->AddInput(NewPrecipitationInput);
105 // //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0]));
106 this->InputExtrude(SurfaceforcingsMassBalanceEnum,-1);
107+ this->InputExtrude(TemperatureEnum,-1);
108 // this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum,-1);
109 // this->InputExtrude(SurfaceforcingsPrecipitationEnum,-1);
110
Note: See TracBrowser for help on using the repository browser.