source: issm/oecreview/Archive/14312-15392/ISSM-15015-15016.diff

Last change on this file was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 5.7 KB
RevLine 
[15393]1Index: ../trunk-jpl/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp
2===================================================================
3--- ../trunk-jpl/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp (revision 15015)
4+++ ../trunk-jpl/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp (revision 15016)
5@@ -11,29 +11,16 @@
6 #include "../../toolkits/toolkits.h"
7 #include "../InputUpdateFromConstantx/InputUpdateFromConstantx.h"
8
9-#define Ntime 5 // number of times with load history
10-#define Ntimm 4 // Ntime-1 : for slope/y-cept of load segments
11-#define Ntimp 6 // Ntime+1 : for evaluation time
12
13 /*External blocks: {{{*/
14 struct blockp{
15 double pset[7];
16 };
17-
18-struct blockt{
19- double time[Ntimp];
20- double bi[Ntimm];
21- double dmi[Ntimm];
22-};
23-
24+
25 struct blocko{
26 double rhoi;
27- double hload[Ntime];
28 };
29
30-struct blocky{
31- double zhload[Ntime];
32-};
33
34 struct blockn{
35 int irate;
36@@ -50,12 +37,11 @@
37 };
38
39 extern "C" {
40- int distme_( int* pidisk,int* piedge);
41+ int distme_( int* pidisk,int* piedge, int* pNtime, int* pNtimp, int* pNtimm, int* pNafter,double* time,double* bi,double* dmi,double* zhload,double* hload);
42+
43 int what0_( int* pidisk,int* piedge);
44 extern struct blockp blockp_;
45- extern struct blockt blockt_;
46 extern struct blocko blocko_;
47- extern struct blocky blocky_;
48 extern struct blockn blockn_;
49 extern struct blockrad blockrad_;
50 extern struct blocks blocks_;
51@@ -65,6 +51,9 @@
52
53 void GiaDeflectionCorex( IssmDouble* pwi, IssmDouble* pdwidt, GiaDeflectionCoreArgs* arguments){
54
55+ /*intermediary: */
56+ int i;
57+
58 /*output: */
59 IssmDouble wi=0;
60 IssmDouble dwidt=0;
61@@ -86,6 +75,15 @@
62 IssmDouble* times; //loading history times
63 int numtimes; //loading history length
64 IssmDouble currenttime;
65+ int Ntime=5; // number of times with load history
66+ int Ntimm; // Ntime-1 : for slope/y-cept of load segments
67+ int Ntimp; // Ntime+1 : for evaluation time
68+ int Nafter;
69+ IssmDouble* blockt_time=NULL;
70+ IssmDouble* blockt_bi=NULL;
71+ IssmDouble* blockt_dmi=NULL;
72+ IssmDouble* blocky_zhload=NULL;
73+ IssmDouble* blocko_hload=NULL;
74
75 /*gia material parameters: */
76 IssmDouble lithosphere_shear_modulus;
77@@ -127,6 +125,10 @@
78 /*Modify inputs to match naruse code: */
79 //from our model, irate comes in with values in [1,2], which maps into [0,1] in naruse:
80 irate=irate-1;
81+ Nafter=1;
82+ Ntime=numtimes;
83+ Ntimm=Ntime-1;
84+ Ntimp=Ntime+Nafter;
85
86 /*Prepare block inputs for fortran distme and what0 routines of the naruse code: {{{*/
87 /*Now, let's set pset from the data that we got in input to GiaDeflectionCorex: */
88@@ -140,20 +142,27 @@
89 blocko_.rhoi=rho_ice;
90
91 /*loading history: */
92- blocky_.zhload[0]=hes[0];
93- blocky_.zhload[1]=hes[1];
94- blocky_.zhload[2]=hes[2];
95- blocky_.zhload[3]=hes[3];
96- blocky_.zhload[4]=hes[numtimes-1];
97+ blocky_zhload=xNew<IssmDouble>(numtimes);
98+ for(i=0;i<numtimes;i++){
99+ blocky_zhload[i]=hes[i];
100+ }
101
102 /*times: */
103- blockt_.time[0]=times[0]/1000.0/yts; // in kyr
104- blockt_.time[1]=times[1]/1000.0/yts; // in kyr
105- blockt_.time[2]=times[2]/1000.0/yts; // in kyr
106- blockt_.time[3]=times[3]/1000.0/yts; // in kyr
107- blockt_.time[4]=2500.0; // in kyr
108- blockt_.time[5]=times[numtimes-1]/1000.0/yts; // evaluation time, in kyr
109+ blockt_time=xNew<IssmDouble>(numtimes+1);
110+ for (i=0;i<numtimes;i++){
111+ blockt_time[i]=times[i]/1000.0/yts; //in kyr
112+ if(i==numtimes-2)blockt_time[i]=2500.0; // in kyr
113+ }
114+
115+ /*bi: */
116+ blockt_bi=xNew<IssmDouble>(numtimes-1);
117
118+ /*dmi: */
119+ blockt_dmi=xNew<IssmDouble>(numtimes-1);
120+
121+ /*hload:*/
122+ blocko_hload=xNew<IssmDouble>(numtimes);
123+
124 /*irate: */
125 blockn_.irate=irate;
126
127@@ -162,8 +171,9 @@
128 /*}}}*/
129
130 /*Call distme driver: */
131- distme_(&idisk,&iedge);
132+ distme_(&idisk,&iedge,&Ntime,&Ntimp,&Ntimm,&Nafter,blockt_time,blockt_bi,blockt_dmi,blocky_zhload,blocko_hload);
133
134+
135 /*Call what0 driver: */
136 what0_(&idisk,&iedge);
137
138@@ -179,4 +189,12 @@
139 *pdwidt=dwidt;
140 }
141
142+ /*Free ressources: */
143+ xDelete<IssmDouble>(blockt_time);
144+ xDelete<IssmDouble>(blockt_bi);
145+ xDelete<IssmDouble>(blockt_dmi);
146+ xDelete<IssmDouble>(blocky_zhload);
147+ xDelete<IssmDouble>(blocko_hload);
148+
149 }
150+
151Index: ../trunk-jpl/src/c/modules/GiaDeflectionCorex/distme.f
152===================================================================
153--- ../trunk-jpl/src/c/modules/GiaDeflectionCorex/distme.f (revision 15015)
154+++ ../trunk-jpl/src/c/modules/GiaDeflectionCorex/distme.f (revision 15016)
155@@ -1,10 +1,8 @@
156- subroutine distme(idisk,iedge)
157+ subroutine distme(idisk,iedge,Ntime,Ntimp,Ntimm,Nafter,time,bi,
158+ &dmi,zhload,hload)
159 implicit double precision (a-h,o-y)
160+ integer idisk,iedge,Ntime,Ntimp,Ntimm,Nafter
161 parameter (N3G = 1)
162- parameter (Ntime = 5)
163- parameter (Ntimm = Ntime-1)
164- parameter (Nafter = 1)
165- parameter (Ntimp = Ntime + Nafter)
166 double precision pset(7)
167 double precision time(Ntimp),dmi(Ntimm),bi(Ntimm),dumbt(Ntimp)
168 double precision hload(Ntime),qpat(Ntime),qt(Ntime)
169@@ -12,9 +10,7 @@
170 c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
171 common /blockp/ pset
172 common /blockrad/ distrad
173- common /blockt/ time,bi,dmi
174- common /blocky/ zhload
175- common /blocko/ rhoi,hload
176+ common /blocko/ rhoi
177 data g /9.832186d0/, yearco /3.15576d7/, eradm/6.371d6/
178 data dpi /3.1415926535897932d0/, dzero/0.0d0/
179 c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
180@@ -26,7 +22,6 @@
181 dumbt(k) = time(k)
182 776 continue
183 c write(6,*) time(1), time(2), time(3)
184-c write(6,*) zhload(1), zhload(2), distrad, rhoi
185 c write(6,*) pset(1), pset(2), pset(3), pset(4), pset(5), pset(6)
186 c write(6,*) pset(7)
187 c call dvecpr(time,Ntime,'::::: time @ distme.f :::::',79,0,0)
Note: See TracBrowser for help on using the repository browser.