Advection

Wall-normal relation

\[- \dmomadv{1}{1}\]
src/fluid/predict/ux.c
 93static int advection_x (
 94    const domain_t * domain,
 95    const double * restrict ux,
 96    double * restrict src
 97) {
 98  const int isize = domain->mysizes[0];
 99  const int jsize = domain->mysizes[1];
100#if NDIMS == 3
101  const int ksize = domain->mysizes[2];
102#endif
103  const double * restrict hxxf = domain->hxxf;
104  const double * restrict jdxf = domain->jdxf;
105  BEGIN
106    const double hx_xm = HXXF(i-1);
107    const double hx_x0 = HXXF(i  );
108    const double hx_xp = HXXF(i+1);
109    const double jd_xm = JDXF(i-1);
110    const double jd_x0 = JDXF(i  );
111    const double jd_xp = JDXF(i+1);
112#if NDIMS == 2
113    const double ux_xm = + 0.5 * jd_xm / hx_xm * UX(i-1, j  )
114                         + 0.5 * jd_x0 / hx_x0 * UX(i  , j  );
115    const double ux_xp = + 0.5 * jd_x0 / hx_x0 * UX(i  , j  )
116                         + 0.5 * jd_xp / hx_xp * UX(i+1, j  );
117#else
118    const double ux_xm = + 0.5 * jd_xm / hx_xm * UX(i-1, j  , k  )
119                         + 0.5 * jd_x0 / hx_x0 * UX(i  , j  , k  );
120    const double ux_xp = + 0.5 * jd_x0 / hx_x0 * UX(i  , j  , k  )
121                         + 0.5 * jd_xp / hx_xp * UX(i+1, j  , k  );
122#endif
123    const double l = - 0.5 * ux_xm;
124    const double u = + 0.5 * ux_xp;
125    const double c = - l - u;
126    src[cnt] -= 1. / jd_x0 * (
127#if NDIMS == 2
128        + l * UX(i-1, j  )
129        + c * UX(i  , j  )
130        + u * UX(i+1, j  )
131#else
132        + l * UX(i-1, j  , k  )
133        + c * UX(i  , j  , k  )
134        + u * UX(i+1, j  , k  )
135#endif
136    );
137  END
138  return 0;
139}
\[- \dmomadv{2}{1}\]
src/fluid/predict/ux.c
142static int advection_y (
143    const domain_t * domain,
144    const double * restrict ux,
145    const double * restrict uy,
146    double * restrict src
147) {
148  const int isize = domain->mysizes[0];
149  const int jsize = domain->mysizes[1];
150#if NDIMS == 3
151  const int ksize = domain->mysizes[2];
152#endif
153  const double hy = domain->hy;
154  const double * restrict jdxf = domain->jdxf;
155  const double * restrict jdxc = domain->jdxc;
156  BEGIN
157    const double jd_xm = JDXC(i-1);
158    const double jd_x0 = JDXF(i  );
159    const double jd_xp = JDXC(i  );
160#if NDIMS == 2
161    const double uy_ym = + 0.5 * jd_xm / hy * UY(i-1, j  )
162                         + 0.5 * jd_xp / hy * UY(i  , j  );
163    const double uy_yp = + 0.5 * jd_xm / hy * UY(i-1, j+1)
164                         + 0.5 * jd_xp / hy * UY(i  , j+1);
165#else
166    const double uy_ym = + 0.5 * jd_xm / hy * UY(i-1, j  , k  )
167                         + 0.5 * jd_xp / hy * UY(i  , j  , k  );
168    const double uy_yp = + 0.5 * jd_xm / hy * UY(i-1, j+1, k  )
169                         + 0.5 * jd_xp / hy * UY(i  , j+1, k  );
170#endif
171    const double l = - 0.5 * uy_ym;
172    const double u = + 0.5 * uy_yp;
173    const double c = - l - u;
174    src[cnt] -= 1. / jd_x0 * (
175#if NDIMS == 2
176        + l * UX(i  , j-1)
177        + c * UX(i  , j  )
178        + u * UX(i  , j+1)
179#else
180        + l * UX(i  , j-1, k  )
181        + c * UX(i  , j  , k  )
182        + u * UX(i  , j+1, k  )
183#endif
184    );
185  END
186  return 0;
187}
\[- \dmomadv{3}{1}\]
src/fluid/predict/ux.c
191static int advection_z (
192    const domain_t * domain,
193    const double * restrict ux,
194    const double * restrict uz,
195    double * restrict src
196) {
197  const int isize = domain->mysizes[0];
198  const int jsize = domain->mysizes[1];
199  const int ksize = domain->mysizes[2];
200  const double hz = domain->hz;
201  const double * restrict jdxf = domain->jdxf;
202  const double * restrict jdxc = domain->jdxc;
203  BEGIN
204    const double jd_xm = JDXC(i-1);
205    const double jd_x0 = JDXF(i  );
206    const double jd_xp = JDXC(i  );
207    const double uz_zm = + 0.5 * jd_xm / hz * UZ(i-1, j  , k  )
208                         + 0.5 * jd_xp / hz * UZ(i  , j  , k  );
209    const double uz_zp = + 0.5 * jd_xm / hz * UZ(i-1, j  , k+1)
210                         + 0.5 * jd_xp / hz * UZ(i  , j  , k+1);
211    const double l = - 0.5 * uz_zm;
212    const double u = + 0.5 * uz_zp;
213    const double c = - l - u;
214    src[cnt] -= 1. / jd_x0 * (
215        + l * UX(i  , j  , k-1)
216        + c * UX(i  , j  , k  )
217        + u * UX(i  , j  , k+1)
218    );
219  END
220  return 0;
221}

Stream-wise relation

\[- \dmomadv{1}{2}\]
src/fluid/predict/uy.c
 92static int advection_x (
 93    const domain_t * domain,
 94    const double * restrict uy,
 95    const double * restrict ux,
 96    double * restrict src
 97) {
 98  const int isize = domain->mysizes[0];
 99  const int jsize = domain->mysizes[1];
100#if NDIMS == 3
101  const int ksize = domain->mysizes[2];
102#endif
103  const double * restrict hxxf = domain->hxxf;
104  const double * restrict jdxf = domain->jdxf;
105  const double * restrict jdxc = domain->jdxc;
106  BEGIN
107    const double hx_xm = HXXF(i  );
108    const double hx_xp = HXXF(i+1);
109    const double jd_xm = JDXF(i  );
110    const double jd_x0 = JDXC(i  );
111    const double jd_xp = JDXF(i+1);
112#if NDIMS == 2
113    const double ux_xm = + 0.5 * jd_xm / hx_xm * UX(i  , j-1)
114                         + 0.5 * jd_xm / hx_xm * UX(i  , j  );
115    const double ux_xp = + 0.5 * jd_xp / hx_xp * UX(i+1, j-1)
116                         + 0.5 * jd_xp / hx_xp * UX(i+1, j  );
117#else
118    const double ux_xm = + 0.5 * jd_xm / hx_xm * UX(i  , j-1, k  )
119                         + 0.5 * jd_xm / hx_xm * UX(i  , j  , k  );
120    const double ux_xp = + 0.5 * jd_xp / hx_xp * UX(i+1, j-1, k  )
121                         + 0.5 * jd_xp / hx_xp * UX(i+1, j  , k  );
122#endif
123    const double l = - 0.5 * ux_xm;
124    const double u = + 0.5 * ux_xp;
125    const double c = - l - u;
126    src[cnt] -= 1. / jd_x0 * (
127#if NDIMS == 2
128        + l * UY(i-1, j  )
129        + c * UY(i  , j  )
130        + u * UY(i+1, j  )
131#else
132        + l * UY(i-1, j  , k  )
133        + c * UY(i  , j  , k  )
134        + u * UY(i+1, j  , k  )
135#endif
136    );
137  END
138  return 0;
139}
\[- \dmomadv{2}{2}\]
src/fluid/predict/uy.c
142static int advection_y (
143    const domain_t * domain,
144    const double * restrict uy,
145    double * restrict src
146) {
147  const int isize = domain->mysizes[0];
148  const int jsize = domain->mysizes[1];
149#if NDIMS == 3
150  const int ksize = domain->mysizes[2];
151#endif
152  const double hy = domain->hy;
153  const double * restrict jdxc = domain->jdxc;
154  BEGIN
155    const double jd = JDXC(i  );
156#if NDIMS == 2
157    const double uy_ym = + 0.5 * jd / hy * UY(i  , j-1)
158                         + 0.5 * jd / hy * UY(i  , j  );
159    const double uy_yp = + 0.5 * jd / hy * UY(i  , j  )
160                         + 0.5 * jd / hy * UY(i  , j+1);
161#else
162    const double uy_ym = + 0.5 * jd / hy * UY(i  , j-1, k  )
163                         + 0.5 * jd / hy * UY(i  , j  , k  );
164    const double uy_yp = + 0.5 * jd / hy * UY(i  , j  , k  )
165                         + 0.5 * jd / hy * UY(i  , j+1, k  );
166#endif
167    const double l = - 0.5 * uy_ym;
168    const double u = + 0.5 * uy_yp;
169    const double c = - l - u;
170    src[cnt] -= 1. / jd * (
171#if NDIMS == 2
172        + l * UY(i  , j-1)
173        + c * UY(i  , j  )
174        + u * UY(i  , j+1)
175#else
176        + l * UY(i  , j-1, k  )
177        + c * UY(i  , j  , k  )
178        + u * UY(i  , j+1, k  )
179#endif
180    );
181  END
182  return 0;
183}
\[- \dmomadv{3}{2}\]
src/fluid/predict/uy.c
187static int advection_z (
188    const domain_t * domain,
189    const double * restrict uy,
190    const double * restrict uz,
191    double * restrict src
192) {
193  const int isize = domain->mysizes[0];
194  const int jsize = domain->mysizes[1];
195  const int ksize = domain->mysizes[2];
196  const double hz = domain->hz;
197  const double * restrict jdxc = domain->jdxc;
198  BEGIN
199    const double jd = JDXC(i  );
200    const double uz_zm = + 0.5 * jd / hz * UZ(i  , j-1, k  )
201                         + 0.5 * jd / hz * UZ(i  , j  , k  );
202    const double uz_zp = + 0.5 * jd / hz * UZ(i  , j-1, k+1)
203                         + 0.5 * jd / hz * UZ(i  , j  , k+1);
204    const double l = - 0.5 * uz_zm;
205    const double u = + 0.5 * uz_zp;
206    const double c = - l - u;
207    src[cnt] -= 1. / jd * (
208        + l * UY(i  , j  , k-1)
209        + c * UY(i  , j  , k  )
210        + u * UY(i  , j  , k+1)
211    );
212  END
213  return 0;
214}

Span-wise relation

\[- \dmomadv{1}{3}\]
src/fluid/predict/uz.c
 79static int advection_x (
 80    const domain_t * domain,
 81    const double * restrict uz,
 82    const double * restrict ux,
 83    double * restrict src
 84) {
 85  const int isize = domain->mysizes[0];
 86  const int jsize = domain->mysizes[1];
 87  const int ksize = domain->mysizes[2];
 88  const double * restrict hxxf = domain->hxxf;
 89  const double * restrict jdxf = domain->jdxf;
 90  const double * restrict jdxc = domain->jdxc;
 91  BEGIN
 92    const double hx_xm = HXXF(i  );
 93    const double hx_xp = HXXF(i+1);
 94    const double jd_xm = JDXF(i  );
 95    const double jd_x0 = JDXC(i  );
 96    const double jd_xp = JDXF(i+1);
 97    const double ux_xm = + 0.5 * jd_xm / hx_xm * UX(i  , j  , k-1)
 98                         + 0.5 * jd_xm / hx_xm * UX(i  , j  , k  );
 99    const double ux_xp = + 0.5 * jd_xp / hx_xp * UX(i+1, j  , k-1)
100                         + 0.5 * jd_xp / hx_xp * UX(i+1, j  , k  );
101    const double l = - 0.5 * ux_xm;
102    const double u = + 0.5 * ux_xp;
103    const double c = - l - u;
104    src[cnt] -= 1. / jd_x0 * (
105        + l * UZ(i-1, j  , k  )
106        + c * UZ(i  , j  , k  )
107        + u * UZ(i+1, j  , k  )
108    );
109  END
110  return 0;
111}
\[- \dmomadv{2}{3}\]
src/fluid/predict/uz.c
114static int advection_y (
115    const domain_t * domain,
116    const double * restrict uz,
117    const double * restrict uy,
118    double * restrict src
119) {
120  const int isize = domain->mysizes[0];
121  const int jsize = domain->mysizes[1];
122  const int ksize = domain->mysizes[2];
123  const double hy = domain->hy;
124  const double * restrict jdxc = domain->jdxc;
125  BEGIN
126    const double jd = JDXC(i  );
127    const double uy_ym = + 0.5 * jd / hy * UY(i  , j  , k-1)
128                         + 0.5 * jd / hy * UY(i  , j  , k  );
129    const double uy_yp = + 0.5 * jd / hy * UY(i  , j+1, k-1)
130                         + 0.5 * jd / hy * UY(i  , j+1, k  );
131    const double l = - 0.5 * uy_ym;
132    const double u = + 0.5 * uy_yp;
133    const double c = - l - u;
134    src[cnt] -= 1. / jd * (
135        + l * UZ(i  , j-1, k  )
136        + c * UZ(i  , j  , k  )
137        + u * UZ(i  , j+1, k  )
138    );
139  END
140  return 0;
141}
\[- \dmomadv{3}{3}\]
src/fluid/predict/uz.c
144static int advection_z (
145    const domain_t * domain,
146    const double * restrict uz,
147    double * restrict src
148) {
149  const int isize = domain->mysizes[0];
150  const int jsize = domain->mysizes[1];
151  const int ksize = domain->mysizes[2];
152  const double hz = domain->hz;
153  const double * restrict jdxc = domain->jdxc;
154  BEGIN
155    const double jd = JDXC(i  );
156    const double uz_zm = + 0.5 * jd / hz * UZ(i  , j  , k-1)
157                         + 0.5 * jd / hz * UZ(i  , j  , k  );
158    const double uz_zp = + 0.5 * jd / hz * UZ(i  , j  , k  )
159                         + 0.5 * jd / hz * UZ(i  , j  , k+1);
160    const double l = - 0.5 * uz_zm;
161    const double u = + 0.5 * uz_zp;
162    const double c = - l - u;
163    src[cnt] -= 1. / jd * (
164        + l * UZ(i  , j  , k-1)
165        + c * UZ(i  , j  , k  )
166        + u * UZ(i  , j  , k+1)
167    );
168  END
169  return 0;
170}