source: trunk/src/solsor_gx2_x_r.h @ 49

Last change on this file since 49 was 49, checked in by jbrlod, 13 years ago

reorganisation de order

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1/***************************************************************************
2                 module classe solsor_gc1_x_r.h  -  description
3***************************************************************************/
4// Julien Brajard
5// locean-ipsl.upmc, Paris, April 25, 2011
6//===========================================================================
7//                          methode forward
8forward (YREAL x1, YREAL x2, YREAL x3, YREAL x4, YREAL x5, YREAL x6, YREAL x7, YREAL x8, YREAL x9)
9{
10  /*    1       from    gcx_dynspg_flt          1  i    j         t
11        2       from    gcb_dynspg_flt          1  i    j         t
12        3       from    solsor_gc1_x_r          1  i    j-1  k    t
13        4       from    solsor_gc1_x_r          1  i-1  j    k    t
14        5       from    solsor_gc1_x_r          1  i+1  j    k    t
15        6       from    solsor_gc1_x_r          1  i    j+1  k    t
16        7       from    solsor_gc1_x_r          1  i    j    k    t
17        8       from    solsor_flag             2  NX   NY   k    t
18        9       from    solsor_gc1_x_r          2  i    j    k-1  t
19        }
20        output 1 : gcx
21        oupput 2 : gcr (pour l'arrêt des itérations)
22       
23  */
24  if(Yt==TU)
25    {
26      YS1=0;
27      YS2=x9;
28    }
29  else {
30    int t;
31    if(Yt==TU+1 && neuler==0)
32      t=0;
33    else
34      t=1;
35   
36    if (x8==1)
37      {
38        YS1=x7;
39        YS2=x9;
40      }
41    else
42      {
43        if (Yk==0) {
44          YS1=x7;
45          YS2=x9;
46        } //Yk=0;
47        else {
48          YREAL ztmp,zres;
49          int ishift=(Yj-1)%2;
50          if ((Yi+1)%2==ishift) { //! Guess black update
51            ztmp = x2
52              - gcp(Yi,Yj,0,t) * x3   
53              - gcp(Yi,Yj,1,t) * x4   
54              - gcp(Yi,Yj,2,t) * x5   
55              - gcp(Yi,Yj,3,t) * x6;
56            //     ! Estimate of the residual
57            zres = ztmp - x7;
58            YS2 = zres * gcdmat(Yi,Yj,t) * zres;
59            //               ! Guess update
60            YS1 = sor * ztmp + (1.-sor) * x7;
61          }
62          else
63            {
64              YS2=x9;
65              YS1=x7;
66            }
67         
68         
69         
70        } // Yk>0
71      } //if x8==0
72    //if (Yt==TU+1)
73    //printf("%d\t%d\t%d\t%e\t%e (2)\n",Yk,Yj,Yi,YS1,YS2); 
74  } //Yt>TU
75}
76
77//===========================================================================
78//                          methode backward
79
80backward (YREAL x1, YREAL x2, YREAL x3, YREAL x4, YREAL x5, YREAL x6, YREAL x7, YREAL x8, YREAL x9) {
81  /*    1       from    gcx_dynspg_flt          1  i    j         t
82        2       from    gcb_dynspg_flt          1  i    j         t
83        3       from    solsor_gc1_x_r          1  i    j-1  k    t
84        4       from    solsor_gc1_x_r          1  i-1  j    k    t
85        5       from    solsor_gc1_x_r          1  i+1  j    k    t
86        6       from    solsor_gc1_x_r          1  i    j+1  k    t
87        7       from    solsor_gc1_x_r          1  i    j    k    t
88        8       from    solsor_flag             2  NX   NY   k    t
89        9       from    solsor_gc1_x_r          2  i    j    k-1  t
90        }
91        output 1 : gcx
92        oupput 2 : gcr (pour l'arrêt des itérations)
93       
94  */
95 
96  if(Yt==TU)
97    {
98      YJ2I9=0;
99    }
100  else {
101    int t;
102    if(Yt==TU+1 && neuler==0)
103      t=0;
104    else
105      t=1;
106   
107    if (x8==1)
108      {
109        YJ1I7=1;
110      }
111    else
112      {
113        if (Yk==0) {
114          YJ1I7=1;
115        } //Yk=0;
116        else {
117          int ishift=(Yj-1)%2;
118          if ((Yi+1)%2==ishift) { //! Guess black update
119            YREAL dztmpdx2=1;
120            YREAL dztmpdx3=-gcp(Yi,Yj,0,t);
121            YREAL dztmpdx4=-gcp(Yi,Yj,1,t);
122            YREAL dztmpdx5=-gcp(Yi,Yj,2,t);
123            YREAL dztmpdx6=-gcp(Yi,Yj,3,t);
124            /*ztmp = x2
125              - gcp(Yi,Yj,0,t) * x3   
126              - gcp(Yi,Yj,1,t) * x4   
127              - gcp(Yi,Yj,2,t) * x5   
128              - gcp(Yi,Yj,3,t) * x6;*/
129           
130            YJ1I2=sor*dztmpdx2;
131            YJ1I3=sor*dztmpdx3;
132            YJ1I4=sor*dztmpdx4;
133            YJ1I5=sor*dztmpdx5;
134            YJ1I6=sor*dztmpdx6;
135            YJ1I7=(1.-sor);         
136            //       YS1 = sor * ztmp + (1.-sor) * x7;
137          }
138          else
139            {
140              YJ1I7=1;
141              //  YS1=x7;
142            }
143        }         
144      }
145  }
146  /*
147  for (int i=0;i<  9;i++)
148    {
149     
150      for (int j=0;j<2;j++) {
151        if (Yjac[j][i]>1 & YG1Y_solsor_gx2_x_r>1e-10) {
152            printf("gx2 (%d,%d,%d,%d) YG1=%e,YG2=%e(%e)",Yi,Yj,Yk,Yt,YG1Y_solsor_gx2_x_r,YG2Y_solsor_gx2_x_r,(&YG1Y_solsor_gx2_x_r)[1]);
153            printf(" YJ%dI%d=%e\n",j+1,i+1,Yjac[j][i]);
154          }
155      }
156      }*/
157}
Note: See TracBrowser for help on using the repository browser.