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
  • ../trunk-jpl/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp

     
    1111#include "../../toolkits/toolkits.h"
    1212#include "../InputUpdateFromConstantx/InputUpdateFromConstantx.h"
    1313
    14 #define Ntime 5 // number of times with load history
    15 #define Ntimm 4 // Ntime-1 : for slope/y-cept of load segments
    16 #define Ntimp 6 // Ntime+1 : for evaluation time 
    1714
    1815/*External blocks: {{{*/
    1916struct blockp{
    2017        double pset[7];
    2118};
    22 
    23 struct blockt{
    24         double time[Ntimp];
    25         double bi[Ntimm];
    26         double dmi[Ntimm];
    27 };
    28 
     19       
    2920struct blocko{
    3021        double rhoi;
    31         double hload[Ntime];
    3222};
    3323
    34 struct blocky{
    35         double zhload[Ntime];
    36 };
    3724
    3825struct blockn{
    3926        int irate;
     
    5037};
    5138
    5239extern "C" {
    53         int distme_( int* pidisk,int* piedge);
     40        int distme_( int* pidisk,int* piedge, int* pNtime, int* pNtimp, int* pNtimm, int* pNafter,double* time,double* bi,double* dmi,double* zhload,double* hload);
     41
    5442        int what0_( int* pidisk,int* piedge);
    5543        extern struct blockp blockp_;
    56         extern struct blockt blockt_;
    5744        extern struct blocko blocko_;
    58         extern struct blocky blocky_;
    5945        extern struct blockn blockn_;
    6046        extern struct blockrad blockrad_;
    6147        extern struct blocks blocks_;
     
    6551
    6652void GiaDeflectionCorex( IssmDouble* pwi, IssmDouble* pdwidt, GiaDeflectionCoreArgs* arguments){
    6753
     54        /*intermediary: */
     55        int i;
     56
    6857        /*output: */
    6958        IssmDouble wi=0;
    7059        IssmDouble dwidt=0;
     
    8675        IssmDouble* times; //loading history times
    8776        int numtimes; //loading history length
    8877        IssmDouble currenttime;
     78        int Ntime=5; // number of times with load history
     79        int Ntimm;  // Ntime-1 : for slope/y-cept of load segments
     80        int Ntimp; // Ntime+1 : for evaluation time 
     81        int Nafter;
     82        IssmDouble* blockt_time=NULL;
     83        IssmDouble* blockt_bi=NULL;
     84        IssmDouble* blockt_dmi=NULL;
     85        IssmDouble* blocky_zhload=NULL;
     86        IssmDouble* blocko_hload=NULL;
    8987
    9088        /*gia material parameters: */
    9189        IssmDouble lithosphere_shear_modulus;
     
    127125        /*Modify inputs to match naruse code: */
    128126        //from our model, irate comes in with values in [1,2], which maps into [0,1] in naruse:
    129127        irate=irate-1;
     128        Nafter=1;
     129        Ntime=numtimes;
     130        Ntimm=Ntime-1;
     131        Ntimp=Ntime+Nafter;
    130132
    131133        /*Prepare block inputs for fortran distme and what0 routines of the naruse code: {{{*/
    132134        /*Now, let's set pset from the data that we got in input to GiaDeflectionCorex: */
     
    140142        blocko_.rhoi=rho_ice;
    141143
    142144        /*loading history: */
    143         blocky_.zhload[0]=hes[0];
    144         blocky_.zhload[1]=hes[1];
    145         blocky_.zhload[2]=hes[2];
    146         blocky_.zhload[3]=hes[3];
    147         blocky_.zhload[4]=hes[numtimes-1];
     145        blocky_zhload=xNew<IssmDouble>(numtimes);
     146        for(i=0;i<numtimes;i++){
     147        blocky_zhload[i]=hes[i];
     148        }
    148149
    149150        /*times: */
    150         blockt_.time[0]=times[0]/1000.0/yts;    // in kyr
    151         blockt_.time[1]=times[1]/1000.0/yts;    // in kyr
    152         blockt_.time[2]=times[2]/1000.0/yts;    // in kyr
    153         blockt_.time[3]=times[3]/1000.0/yts;    // in kyr
    154         blockt_.time[4]=2500.0;                 // in kyr 
    155         blockt_.time[5]=times[numtimes-1]/1000.0/yts;  // evaluation time, in kyr
     151        blockt_time=xNew<IssmDouble>(numtimes+1);
     152        for (i=0;i<numtimes;i++){
     153                blockt_time[i]=times[i]/1000.0/yts; //in kyr
     154                if(i==numtimes-2)blockt_time[i]=2500.0;                 // in kyr 
     155        }
     156       
     157        /*bi: */
     158        blockt_bi=xNew<IssmDouble>(numtimes-1);
    156159
     160        /*dmi: */
     161        blockt_dmi=xNew<IssmDouble>(numtimes-1);
     162       
     163        /*hload:*/
     164        blocko_hload=xNew<IssmDouble>(numtimes);
     165
    157166        /*irate: */
    158167        blockn_.irate=irate;
    159168
     
    162171        /*}}}*/
    163172
    164173        /*Call distme driver: */
    165         distme_(&idisk,&iedge);
     174        distme_(&idisk,&iedge,&Ntime,&Ntimp,&Ntimm,&Nafter,blockt_time,blockt_bi,blockt_dmi,blocky_zhload,blocko_hload);
    166175
     176
    167177        /*Call what0 driver: */
    168178        what0_(&idisk,&iedge);
    169179
     
    179189                *pdwidt=dwidt;
    180190        }
    181191
     192        /*Free ressources: */
     193        xDelete<IssmDouble>(blockt_time);
     194        xDelete<IssmDouble>(blockt_bi);
     195        xDelete<IssmDouble>(blockt_dmi);
     196        xDelete<IssmDouble>(blocky_zhload);
     197        xDelete<IssmDouble>(blocko_hload);
     198
    182199}
     200     
  • ../trunk-jpl/src/c/modules/GiaDeflectionCorex/distme.f

     
    1       subroutine distme(idisk,iedge)
     1      subroutine distme(idisk,iedge,Ntime,Ntimp,Ntimm,Nafter,time,bi,
     2     &dmi,zhload,hload)
    23      implicit double precision (a-h,o-y)
     4      integer idisk,iedge,Ntime,Ntimp,Ntimm,Nafter
    35      parameter (N3G = 1)
    4       parameter (Ntime = 5)
    5       parameter (Ntimm = Ntime-1)
    6       parameter (Nafter = 1)
    7       parameter (Ntimp = Ntime + Nafter)
    86      double precision pset(7)
    97      double precision time(Ntimp),dmi(Ntimm),bi(Ntimm),dumbt(Ntimp)
    108      double precision hload(Ntime),qpat(Ntime),qt(Ntime)
     
    1210c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    1311      common /blockp/ pset
    1412      common /blockrad/ distrad
    15       common /blockt/ time,bi,dmi
    16       common /blocky/ zhload
    17       common /blocko/ rhoi,hload
     13      common /blocko/ rhoi
    1814      data g /9.832186d0/, yearco /3.15576d7/, eradm/6.371d6/
    1915      data dpi /3.1415926535897932d0/, dzero/0.0d0/
    2016c ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
    2622      dumbt(k) = time(k)
    2723  776 continue
    2824c      write(6,*) time(1), time(2), time(3)
    29 c      write(6,*) zhload(1), zhload(2), distrad, rhoi
    3025c      write(6,*) pset(1), pset(2), pset(3), pset(4), pset(5), pset(6)
    3126c      write(6,*) pset(7)
    3227c      call dvecpr(time,Ntime,'::::: time @ distme.f :::::',79,0,0)
Note: See TracBrowser for help on using the repository browser.