source:
issm/oecreview/Archive/25834-26739/ISSM-26100-26101.diff
Last change on this file was 26740, checked in by , 3 years ago | |
---|---|
File size: 6.9 KB |
-
../trunk-jpl/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp
43 43 44 44 void GiaDeflectionCorex( IssmDouble* pwi, IssmDouble* pdwidt, GiaDeflectionCoreArgs* arguments){ 45 45 46 /*intermediary: */47 int i;48 49 /*output: */50 IssmDouble wi=0;51 IssmDouble dwidt=0;52 53 /*inputs: {{{*/54 /*constant: */55 int idisk=1; // disk #56 IssmDouble yts;57 58 /*coming from the model structure, runtime configurable:*/59 /*gia solution parameters: */60 int iedge=0;61 62 /*gia inputs: */63 IssmDouble ri; //radial distance from center of disk to vertex i64 IssmDouble re; //radius of disk65 IssmDouble* hes; //loading history (in ice thickness)66 IssmDouble* times; //loading history times67 int numtimes; //loading history length68 IssmDouble currenttime;69 int Ntime; // number of times with load history70 int Ntimm; // Ntime-1 : for slope/y-cept of load segments71 int Ntimp; // Ntime+1 : for evaluation time72 IssmDouble* blockt_time=NULL;73 IssmDouble* blockt_bi=NULL;74 IssmDouble* blockt_dmi=NULL;75 IssmDouble* blocky_zhload=NULL;76 77 /*gia material parameters: */78 IssmDouble lithosphere_shear_modulus;79 IssmDouble lithosphere_density;80 IssmDouble mantle_shear_modulus;81 IssmDouble mantle_viscosity;82 IssmDouble mantle_density;83 IssmDouble lithosphere_thickness;84 85 /*ice properties: */86 IssmDouble rho_ice;87 88 /*some debug info: */89 int disk_id;90 91 /*}}}*/92 93 46 /*Recover material parameters and loading history: see GiaDeflectionCoreArgs for more details {{{*/ 94 ri = arguments->ri;95 re = arguments->re;96 hes = arguments->hes;97 times = arguments->times;98 numtimes = arguments->numtimes;99 currenttime = arguments->currenttime;100 lithosphere_shear_modulus = arguments->lithosphere_shear_modulus;101 lithosphere_density = arguments->lithosphere_density;102 mantle_shear_modulus = arguments->mantle_shear_modulus;103 mantle_viscosity = arguments->mantle_viscosity;104 mantle_density = arguments->mantle_density;105 lithosphere_thickness = arguments->lithosphere_thickness;106 rho_ice = arguments->rho_ice;107 disk_id = arguments->idisk;108 i edge = arguments->iedge;109 yts = arguments->yts;47 IssmDouble ri = arguments->ri; //radial distance from center of disk to vertex i 48 IssmDouble re = arguments->re; //radius of disk 49 IssmDouble *hes = arguments->hes; //loading history (in ice thickness) 50 IssmDouble *times = arguments->times; //loading history times 51 int numtimes = arguments->numtimes; //loading history length 52 IssmDouble currenttime = arguments->currenttime; 53 IssmDouble lithosphere_shear_modulus = arguments->lithosphere_shear_modulus; 54 IssmDouble lithosphere_density = arguments->lithosphere_density; 55 IssmDouble mantle_shear_modulus = arguments->mantle_shear_modulus; 56 IssmDouble mantle_viscosity = arguments->mantle_viscosity; 57 IssmDouble mantle_density = arguments->mantle_density; 58 IssmDouble lithosphere_thickness = arguments->lithosphere_thickness; 59 IssmDouble rho_ice = arguments->rho_ice; 60 int disk_id = arguments->idisk; 61 int iedge = arguments->iedge; 62 IssmDouble yts = arguments->yts; 110 63 111 64 /*}}}*/ 112 65 113 66 /*Modify inputs to match naruse code: */ 114 Ntime=numtimes;115 Ntimm=Ntime-1;116 Ntimp=Ntime+1;67 int Ntime=numtimes; // number of times with load history 68 int Ntimm=Ntime-1; // Ntime-1 : for slope/y-cept of load segments 69 int Ntimp=Ntime+1; // Ntime+1 : for evaluation time 117 70 118 71 /*Prepare block inputs for fortran distme and what0 routines of the naruse code: {{{*/ 119 72 /*Now, let's set pset from the data that we got in input to GiaDeflectionCorex: */ 120 blockp_.pset[0]=lithosphere_thickness; 121 blockp_.pset[1]=mantle_viscosity; 122 blockp_.pset[2]=lithosphere_shear_modulus; 123 blockp_.pset[3]=mantle_shear_modulus; 124 blockp_.pset[4]=lithosphere_density; 125 blockp_.pset[5]=mantle_density; 126 blockp_.pset[6]=re; 127 blocko_.rhoi=rho_ice; 73 blockp_.pset[0]=reCast<IssmPDouble>(lithosphere_thickness); 74 blockp_.pset[1]=reCast<IssmPDouble>(mantle_viscosity); 75 blockp_.pset[2]=reCast<IssmPDouble>(lithosphere_shear_modulus); 76 blockp_.pset[3]=reCast<IssmPDouble>(mantle_shear_modulus); 77 blockp_.pset[4]=reCast<IssmPDouble>(lithosphere_density); 78 blockp_.pset[5]=reCast<IssmPDouble>(mantle_density); 79 blockp_.pset[6]=reCast<IssmPDouble>(re); 80 blocko_.rhoi=reCast<IssmPDouble>(rho_ice); 81 blockrad_.distrad=reCast<IssmPDouble>(ri)/1000.0; // in km 128 82 129 83 /*loading history: */ 130 blocky_zhload=xNew<IssmDouble>(Ntime); 131 for(i=0;i<Ntime;i++){ 132 blocky_zhload[i]=hes[i]; 133 } 84 IssmPDouble* blocky_zhload=xNew<IssmPDouble>(Ntime); 85 for(int i=0;i<Ntime;i++) blocky_zhload[i]=reCast<IssmPDouble>(hes[i]); 134 86 135 87 /*times in kyr: */ 136 blockt_time=xNew<IssmDouble>(Ntimp);137 for (i=0;i<Ntimp;i++){88 IssmPDouble* blockt_time=xNew<IssmPDouble>(Ntimp); 89 for(int i=0;i<Ntimp;i++){ 138 90 blockt_time[i]=times[i]/1000.0/yts; 139 if(i==numtimes-1) blockt_time[i]=times[numtimes-1]/1000.0/yts; // final loading time, same as evaluation time140 if(i==numtimes) blockt_time[i]=times[numtimes-1]/1000.0/yts; // evaluation time91 if(i==numtimes-1) blockt_time[i]=reCast<IssmPDouble>(times[numtimes-1])/1000.0/yts; // final loading time, same as evaluation time 92 if(i==numtimes) blockt_time[i]=reCast<IssmPDouble>(times[numtimes-1])/1000.0/yts; // evaluation time 141 93 } 142 94 143 /*bi: */144 blockt_bi=xNew<IssmDouble>(Ntimm);95 IssmPDouble* blockt_bi=xNew<IssmPDouble>(Ntimm); 96 IssmPDouble* blockt_dmi=xNew<IssmPDouble>(Ntimm); 145 97 146 /*dmi: */147 blockt_dmi=xNew<IssmDouble>(Ntimm);148 149 /*radial distance of i-th element: */150 blockrad_.distrad=ri/1000.0; // in km151 /*}}}*/152 153 98 /*Call distme driver: */ 154 99 distme_(&Ntime,&Ntimp,&Ntimm,blockt_time,blockt_bi,blockt_dmi,blocky_zhload); 155 100 … … 157 102 what0_(&iedge,&Ntimp,&Ntimm,blockt_time,blockt_bi,blockt_dmi); 158 103 159 104 /*output solution: */ 160 wi = blocks_.aswokm_w; 161 dwidt = blocks_.aswokm_dwdt; 162 *pwi=wi; 163 *pdwidt=dwidt; 105 *pwi=reCast<IssmDouble>(blocks_.aswokm_w); 106 *pdwidt=reCast<IssmDouble>(blocks_.aswokm_dwdt); 164 107 165 108 /*Free ressources: */ 166 xDelete<Issm Double>(blockt_time);167 xDelete<Issm Double>(blockt_bi);168 xDelete<Issm Double>(blockt_dmi);169 xDelete<Issm Double>(blocky_zhload);109 xDelete<IssmPDouble>(blockt_time); 110 xDelete<IssmPDouble>(blockt_bi); 111 xDelete<IssmPDouble>(blockt_dmi); 112 xDelete<IssmPDouble>(blocky_zhload); 170 113 171 114 }
Note:
See TracBrowser
for help on using the repository browser.