7.3
general documentation
cs_convection_diffusion.h
Go to the documentation of this file.
1 #ifndef __CS_CONVECTION_DIFFUSION_H__
2 #define __CS_CONVECTION_DIFFUSION_H__
3 
4 /*============================================================================
5  * Convection-diffusion operators.
6  *============================================================================*/
7 
8 /*
9  This file is part of code_saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2022 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 #include "cs_defs.h"
31 
32 /*----------------------------------------------------------------------------
33  * Local headers
34  *----------------------------------------------------------------------------*/
35 
36 #include "cs_base.h"
37 #include "cs_halo.h"
38 #include "cs_math.h"
39 #include "cs_mesh_quantities.h"
40 #include "cs_parameters.h"
41 #include "cs_field_pointer.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*=============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definition
53  *============================================================================*/
54 
55 /*----------------------------------------------------------------------------
56  * NVD/TVD Advection Scheme
57  *----------------------------------------------------------------------------*/
58 
59 typedef enum {
60 
61  CS_NVD_GAMMA = 0, /* GAMMA */
62  CS_NVD_SMART = 1, /* SMART */
63  CS_NVD_CUBISTA = 2, /* CUBISTA */
64  CS_NVD_SUPERBEE = 3, /* SUPERBEE */
65  CS_NVD_MUSCL = 4, /* MUSCL */
66  CS_NVD_MINMOD = 5, /* MINMOD */
67  CS_NVD_CLAM = 6, /* CLAM */
68  CS_NVD_STOIC = 7, /* STOIC */
69  CS_NVD_OSHER = 8, /* OSHER */
70  CS_NVD_WASEB = 9, /* WASEB */
71  CS_NVD_VOF_HRIC = 10, /* M-HRIC for VOF */
72  CS_NVD_VOF_CICSAM = 11, /* M-CICSAM for VOF */
73  CS_NVD_VOF_STACS = 12, /* STACS for VOF */
74  CS_NVD_N_TYPES = 13 /* number of NVD schemes */
75 
77 
78 /*============================================================================
79  * Global variables
80  *============================================================================*/
81 
82 /*============================================================================
83  * Public inlined function
84  *============================================================================*/
85 
86 /*----------------------------------------------------------------------------
87  * Synchronize halos for scalar variables.
88  *
89  * parameters:
90  * m <-- pointer to associated mesh structure
91  * pvar <-> variable
92  *----------------------------------------------------------------------------*/
93 
94 inline static void
96  cs_real_t pvar[])
97 {
98  if (m->halo != NULL)
100 }
101 
102 /*----------------------------------------------------------------------------*/
113 /*----------------------------------------------------------------------------*/
114 
115 inline static cs_real_t
117  const cs_real_t nvf_p_c,
118  const cs_real_t nvf_r_f,
119  const cs_real_t nvf_r_c)
120 {
121  cs_real_t nvf_p_f;
122 
123  cs_real_t beta_m, rfc, r1f, r1, r2, r3, b1, b2;
124 
125  switch (limiter) {
126  case CS_NVD_GAMMA: /* Gamma scheme */
127  beta_m = 0.1; /* in [0.1, 0.5] */
128  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
129 
130  if (nvf_p_c < beta_m) {
131  nvf_p_f = nvf_p_c*(1.+rfc*(1.-nvf_p_c)/beta_m);
132  } else {
133  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
134 
135  nvf_p_f = r1f*nvf_p_c+rfc;
136  }
137 
138  break;
139 
140  case CS_NVD_SMART: /* SMART scheme */
141  if (nvf_p_c < (nvf_r_c/3.)) {
142  r1 = nvf_r_f*(1.-3.*nvf_r_c+2.*nvf_r_f);
143  r2 = nvf_r_c*(1.-nvf_r_c);
144 
145  nvf_p_f = nvf_p_c*r1/r2;
146  } else if (nvf_p_c <= (nvf_r_c*(1.+nvf_r_f-nvf_r_c)/nvf_r_f)) {
147  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
148  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
149 
150  nvf_p_f = nvf_r_f*(r1f*nvf_p_c/nvf_r_c + rfc);
151  } else {
152  nvf_p_f = 1.;
153  }
154 
155  break;
156 
157  case CS_NVD_CUBISTA: /* CUBISTA scheme */
158  if (nvf_p_c < (3.*nvf_r_c/4.)) {
159  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
160 
161  nvf_p_f = nvf_r_f*(1.+rfc/3.)*nvf_p_c/nvf_r_c;
162  } else if (nvf_p_c <= (nvf_r_c*(1.+2.*(nvf_r_f-nvf_r_c))/(2.*nvf_r_f-nvf_r_c))) {
163  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
164  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
165 
166  nvf_p_f = nvf_r_f*(r1f*nvf_p_c/nvf_r_c+rfc);
167  } else {
168  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
169 
170  nvf_p_f = 1.-.5*r1f*(1.-nvf_p_c);
171  }
172 
173  break;
174 
175  case CS_NVD_SUPERBEE: /* SuperBee scheme */
176  if (nvf_p_c < (nvf_r_c/(2.-nvf_r_c))) {
177  nvf_p_f = (2.*nvf_r_f-nvf_r_c)*nvf_p_c/nvf_r_c;
178  } else if (nvf_p_c < nvf_r_c) {
179  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
180  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
181 
182  nvf_p_f = r1f*nvf_p_c+rfc;
183  } else if (nvf_p_c < (nvf_r_c/nvf_r_f)) {
184  nvf_p_f = nvf_r_f*nvf_p_c/nvf_r_c;
185  } else {
186  nvf_p_f = 1.;
187  }
188 
189  break;
190 
191  case CS_NVD_MUSCL: /* MUSCL scheme */
192  if (nvf_p_c < (.5*nvf_r_c)) {
193  nvf_p_f = (2.*nvf_r_f-nvf_r_c)*nvf_p_c/nvf_r_c;
194  } else if (nvf_p_c < (1.+nvf_r_c-nvf_r_f)) {
195  nvf_p_f = nvf_p_c+nvf_r_f-nvf_r_c;
196  } else {
197  nvf_p_f = 1.;
198  }
199 
200  break;
201 
202  case CS_NVD_MINMOD: /* MINMOD scheme */
203  if (nvf_p_c < nvf_r_c) {
204  nvf_p_f = nvf_r_f*nvf_p_c/nvf_r_c;
205  } else {
206  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
207  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
208 
209  nvf_p_f = r1f*nvf_p_c+rfc;
210  }
211 
212  break;
213 
214  case CS_NVD_CLAM: /* CLAM scheme */
215  r1 = nvf_r_c*nvf_r_c-nvf_r_f;
216  r2 = nvf_r_c*(nvf_r_c-1.);
217  r3 = nvf_r_f-nvf_r_c;
218 
219  nvf_p_f = nvf_p_c*(r1+r3*nvf_p_c)/r2;
220 
221  break;
222 
223  case CS_NVD_STOIC: /* STOIC scheme */
224  b1 = (nvf_r_c-nvf_r_f)*nvf_r_c;
225  b2 = nvf_r_c+nvf_r_f+2.*nvf_r_f*nvf_r_f-4.*nvf_r_f*nvf_r_c;
226 
227  if (nvf_p_c < (b1/b2)) {
228  r1 = -nvf_r_f*(1.-3.*nvf_r_c+2.*nvf_r_f);
229  r2 = nvf_r_c*(nvf_r_c-1.);
230 
231  nvf_p_f = nvf_p_c*r1/r2;
232  } else if (nvf_p_c < nvf_r_c) {
233  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
234  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
235 
236  nvf_p_f = r1f*nvf_p_c+rfc;
237  } else if (nvf_p_c < (nvf_r_c*(1.+nvf_r_f-nvf_r_c)/nvf_r_f)) {
238  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
239  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
240 
241  nvf_p_f = nvf_r_f*(nvf_p_c*r1f/nvf_r_c+rfc);
242  } else {
243  nvf_p_f = 1.;
244  }
245 
246  break;
247 
248  case CS_NVD_OSHER: /* OSHER scheme */
249  if (nvf_p_c < (nvf_r_c/nvf_r_f)) {
250  nvf_p_f = nvf_r_f*nvf_p_c/nvf_r_c;
251  } else {
252  nvf_p_f = 1.;
253  }
254 
255  break;
256 
257  case CS_NVD_WASEB: /* WASEB scheme */
258  r1 = nvf_r_c*nvf_r_f*(nvf_r_f-nvf_r_c);
259  r2 = 2.*nvf_r_c*(1.-nvf_r_c)-nvf_r_f*(1.-nvf_r_f);
260 
261  if (nvf_p_c < (r1/r2)) {
262  nvf_p_f = 2.*nvf_p_c;
263  } else if (nvf_p_c <= (nvf_r_c*(1.+nvf_r_f-nvf_r_c)/nvf_r_f)) {
264  rfc = (nvf_r_f-nvf_r_c)/(1.-nvf_r_c);
265  r1f = (1.-nvf_r_f)/(1.-nvf_r_c);
266 
267  nvf_p_f = nvf_r_f*(nvf_p_c*r1f/nvf_r_c+rfc);
268  } else {
269  nvf_p_f = 1.;
270  }
271 
272  break;
273 
274  default: /* Upwinding */
275  nvf_p_f = nvf_p_c;
276  break;
277  }
278 
279  return nvf_p_f;
280 }
281 
282 /*----------------------------------------------------------------------------*/
298 /*----------------------------------------------------------------------------*/
299 
300 inline static cs_real_t
302  const cs_real_3_t i_face_normal,
303  const cs_real_t nvf_p_c,
304  const cs_real_t nvf_r_f,
305  const cs_real_t nvf_r_c,
306  const cs_real_3_t gradv_c,
307  const cs_real_t c_courant)
308 {
309  assert(limiter >= CS_NVD_VOF_HRIC);
310 
311  cs_real_t nvf_p_f;
312  cs_real_t blend, high_order, low_order, ratio;
313 
314  /* Compute gradient angle indicator */
315  cs_real_t dotp = CS_ABS(cs_math_3_dot_product(gradv_c, i_face_normal));
316  cs_real_t sgrad = cs_math_3_norm(gradv_c);
317  cs_real_t snorm = cs_math_3_norm(i_face_normal);
318  cs_real_t denom = snorm*sgrad;
319 
320  if (limiter == CS_NVD_VOF_HRIC) { /* M-HRIC scheme */
321  /* High order scheme : Bounded Downwind */
322  if (nvf_p_c <= .5) {
323  high_order = 2.*nvf_p_c;
324  } else {
325  high_order = 1.;
326  }
327 
328  /* Low order scheme : MUSCL */
330  nvf_p_c,
331  nvf_r_f,
332  nvf_r_c);
333 
334  /* Compute the blending factor */
335  if (denom <= (cs_math_epzero*dotp)) {
336  blend = 1.;
337  } else {
338  ratio = dotp/denom;
339  blend = CS_MIN(1., pow(ratio, .5));
340  }
341 
342  /* Blending */
343  nvf_p_f = blend*high_order + (1.-blend)*low_order;
344 
345  /* Extra blending due to the cell Courant number */
346  if (c_courant < .7 && c_courant > .3) {
347  nvf_p_f = nvf_p_f + (nvf_p_f - low_order)*(.7 - c_courant )/.4;
348  } else if (c_courant >= .7) {
349  nvf_p_f = low_order;
350  }
351  } else if (limiter == CS_NVD_VOF_CICSAM) { /* M-CICSAM scheme */
352  /* High order scheme : HYPER-C + SUPERBEE */
353  if (c_courant <= .3) {
354  high_order = CS_MIN(1., nvf_p_c/(c_courant+cs_math_epzero));
355  } else if (c_courant <= .6) {
356  high_order = CS_MIN(1., nvf_p_c/.3);
357  } else if (c_courant <= .7) {
359  nvf_p_c,
360  nvf_r_f,
361  nvf_r_c);
362  high_order = 10.*( (.7-c_courant)*CS_MIN(1., nvf_p_c/.3)
363  + (c_courant-.6)*superbee);
364  }
365  else {
367  nvf_p_c,
368  nvf_r_f,
369  nvf_r_c);
370  }
371 
372  /* Low order scheme : MUSCL */
374  nvf_p_c,
375  nvf_r_f,
376  nvf_r_c);
377 
378  /* Compute the blending factor */
379  if (denom <= (cs_math_epzero*dotp)) {
380  blend = 1.;
381  } else {
382  ratio = dotp/denom;
383  blend = CS_MIN(1., pow(ratio, 2.));
384  }
385 
386  /* Blending */
387  nvf_p_f = blend*high_order + (1.-blend)*low_order;
388  } else { /* STACS scheme */
389  /* High order scheme : SUPERBEE */
391  nvf_p_c,
392  nvf_r_f,
393  nvf_r_c);
394 
395  /* Low order scheme : STOIC */
397  nvf_p_c,
398  nvf_r_f,
399  nvf_r_c);
400 
401  /* Compute the blending factor */
402  if (denom <= (cs_math_epzero*dotp)) {
403  blend = 1.;
404  } else {
405  ratio = dotp/denom;
406  blend = CS_MIN(1., pow(ratio, 4.));
407  }
408 
409  /* Blending */
410  nvf_p_f = blend*high_order + (1.-blend)*low_order;
411  }
412 
413  return nvf_p_f;
414 }
415 
416 /*----------------------------------------------------------------------------*/
433 /*----------------------------------------------------------------------------*/
434 
435 inline static void
437  const cs_real_t pj,
438  const cs_real_t distf,
439  const cs_real_t srfan,
440  const cs_real_t i_face_normal[3],
441  const cs_real_t gradi[3],
442  const cs_real_t gradj[3],
443  const cs_real_t grdpai[3],
444  const cs_real_t grdpaj[3],
445  const cs_real_t i_massflux,
446  cs_real_t *testij,
447  cs_real_t *tesqck)
448 {
449  cs_real_t testi, testj;
450  cs_real_t dcc, ddi, ddj;
451 
452  /* Slope test */
453 
454  testi = grdpai[0]*i_face_normal[0]
455  + grdpai[1]*i_face_normal[1]
456  + grdpai[2]*i_face_normal[2];
457  testj = grdpaj[0]*i_face_normal[0]
458  + grdpaj[1]*i_face_normal[1]
459  + grdpaj[2]*i_face_normal[2];
460 
461  *testij = grdpai[0]*grdpaj[0]
462  + grdpai[1]*grdpaj[1]
463  + grdpai[2]*grdpaj[2];
464 
465  if (i_massflux>0.) {
466  dcc = gradi[0]*i_face_normal[0]
467  + gradi[1]*i_face_normal[1]
468  + gradi[2]*i_face_normal[2];
469  ddi = testi;
470  ddj = (pj-pi)/distf *srfan;
471  } else {
472  dcc = gradj[0]*i_face_normal[0]
473  + gradj[1]*i_face_normal[1]
474  + gradj[2]*i_face_normal[2];
475  ddi = (pj-pi)/distf *srfan;
476  ddj = testj;
477  }
478 
479  *tesqck = cs_math_sq(dcc) - cs_math_sq(ddi-ddj);
480 }
481 
482 /*----------------------------------------------------------------------------*/
499 /*----------------------------------------------------------------------------*/
500 
501 inline static void
503  const cs_real_t pj[3],
504  const cs_real_t distf,
505  const cs_real_t srfan,
506  const cs_real_t i_face_normal[3],
507  const cs_real_t gradi[3][3],
508  const cs_real_t gradj[3][3],
509  const cs_real_t gradsti[3][3],
510  const cs_real_t gradstj[3][3],
511  const cs_real_t i_massflux,
512  cs_real_t *testij,
513  cs_real_t *tesqck)
514 {
515  cs_real_t testi[3], testj[3];
516  cs_real_t dcc[3], ddi[3], ddj[3];
517  *testij = 0.;
518  *tesqck = 0.;
519 
520  /* Slope test */
521 
522  for (int i = 0; i < 3; i++) {
523  *testij += gradsti[i][0]*gradstj[i][0]
524  + gradsti[i][1]*gradstj[i][1]
525  + gradsti[i][2]*gradstj[i][2];
526 
527  testi[i] = gradsti[i][0]*i_face_normal[0]
528  + gradsti[i][1]*i_face_normal[1]
529  + gradsti[i][2]*i_face_normal[2];
530  testj[i] = gradstj[i][0]*i_face_normal[0]
531  + gradstj[i][1]*i_face_normal[1]
532  + gradstj[i][2]*i_face_normal[2];
533 
534  if (i_massflux > 0.) {
535  dcc[i] = gradi[i][0]*i_face_normal[0]
536  + gradi[i][1]*i_face_normal[1]
537  + gradi[i][2]*i_face_normal[2];
538  ddi[i] = testi[i];
539  ddj[i] = (pj[i]-pi[i])/distf *srfan;
540  } else {
541  dcc[i] = gradj[i][0]*i_face_normal[0]
542  + gradj[i][1]*i_face_normal[1]
543  + gradj[i][2]*i_face_normal[2];
544  ddi[i] = (pj[i]-pi[i])/distf *srfan;
545  ddj[i] = testj[i];
546  }
547  }
548 
549  *tesqck = cs_math_3_square_norm(dcc) - cs_math_3_square_distance(ddi, ddj);
550 }
551 
552 /*----------------------------------------------------------------------------*/
569 /*----------------------------------------------------------------------------*/
570 
571 inline static void
573  const cs_real_t pj[6],
574  const cs_real_t distf,
575  const cs_real_t srfan,
576  const cs_real_t i_face_normal[3],
577  const cs_real_t gradi[6][3],
578  const cs_real_t gradj[6][3],
579  const cs_real_t gradsti[6][3],
580  const cs_real_t gradstj[6][3],
581  const cs_real_t i_massflux,
582  cs_real_t *testij,
583  cs_real_t *tesqck)
584 {
585  cs_real_t testi[6], testj[6];
586  cs_real_t dcc[6], ddi[6], ddj[6];
587 
588  *testij = 0.;
589  *tesqck = 0.;
590 
591  /* Slope test */
592 
593  for (int ij = 0; ij < 6; ij++) {
594  *testij += gradsti[ij][0]*gradstj[ij][0]
595  + gradsti[ij][1]*gradstj[ij][1]
596  + gradsti[ij][2]*gradstj[ij][2];
597  testi[ij] = gradsti[ij][0]*i_face_normal[0]
598  + gradsti[ij][1]*i_face_normal[1]
599  + gradsti[ij][2]*i_face_normal[2];
600  testj[ij] = gradstj[ij][0]*i_face_normal[0]
601  + gradstj[ij][1]*i_face_normal[1]
602  + gradstj[ij][2]*i_face_normal[2];
603 
604  if (i_massflux > 0.) {
605  dcc[ij] = gradi[ij][0]*i_face_normal[0]
606  + gradi[ij][1]*i_face_normal[1]
607  + gradi[ij][2]*i_face_normal[2];
608  ddi[ij] = testi[ij];
609  ddj[ij] = (pj[ij]-pi[ij])/distf *srfan;
610  }
611  else {
612  dcc[ij] = gradj[ij][0]*i_face_normal[0]
613  + gradj[ij][1]*i_face_normal[1]
614  + gradj[ij][2]*i_face_normal[2];
615  ddi[ij] = (pj[ij]-pi[ij])/distf *srfan;
616  ddj[ij] = testj[ij];
617  }
618 
619  *tesqck += cs_math_sq(dcc[ij]) - cs_math_sq(ddi[ij]-ddj[ij]);
620  }
621 }
622 
623 /*----------------------------------------------------------------------------*/
639 /*----------------------------------------------------------------------------*/
640 
641 inline static void
643  const cs_real_3_t diipf,
644  const cs_real_3_t djjpf,
645  const cs_real_3_t gradi,
646  const cs_real_3_t gradj,
647  const cs_real_t pi,
648  const cs_real_t pj,
649  cs_real_t *recoi,
650  cs_real_t *recoj,
651  cs_real_t *pip,
652  cs_real_t *pjp)
653 {
654  cs_real_t gradpf[3] = {0.5*(gradi[0] + gradj[0]),
655  0.5*(gradi[1] + gradj[1]),
656  0.5*(gradi[2] + gradj[2])};
657 
658  /* reconstruction only if IRCFLP = 1 */
659  *recoi = bldfrp*(cs_math_3_dot_product(gradpf, diipf));
660  *recoj = bldfrp*(cs_math_3_dot_product(gradpf, djjpf));
661  *pip = pi + *recoi;
662  *pjp = pj + *recoj;
663 }
664 
665 /*----------------------------------------------------------------------------*/
681 /*----------------------------------------------------------------------------*/
682 
683 inline static void
685  const cs_real_3_t diipf,
686  const cs_real_3_t djjpf,
687  const cs_real_33_t gradi,
688  const cs_real_33_t gradj,
689  const cs_real_3_t pi,
690  const cs_real_3_t pj,
691  cs_real_t recoi[3],
692  cs_real_t recoj[3],
693  cs_real_t pip[3],
694  cs_real_t pjp[3])
695 {
696  cs_real_3_t dpvf;
697 
698  /* x-y-z components, p = u, v, w */
699 
700  for (int isou = 0; isou < 3; isou++) {
701 
702  for (int jsou = 0; jsou < 3; jsou++)
703  dpvf[jsou] = 0.5*( gradi[isou][jsou]
704  + gradj[isou][jsou]);
705 
706  /* reconstruction only if IRCFLP = 1 */
707 
708  recoi[isou] = bldfrp*(cs_math_3_dot_product(dpvf, diipf));
709  recoj[isou] = bldfrp*(cs_math_3_dot_product(dpvf, djjpf));
710 
711  pip[isou] = pi[isou] + recoi[isou];
712  pjp[isou] = pj[isou] + recoj[isou];
713 
714  }
715 }
716 
717 /*----------------------------------------------------------------------------*/
733 /*----------------------------------------------------------------------------*/
734 
735 inline static void
737  const cs_real_3_t diipf,
738  const cs_real_3_t djjpf,
739  const cs_real_63_t gradi,
740  const cs_real_63_t gradj,
741  const cs_real_6_t pi,
742  const cs_real_6_t pj,
743  cs_real_t recoi[6],
744  cs_real_t recoj[6],
745  cs_real_t pip[6],
746  cs_real_t pjp[6])
747 {
748  cs_real_3_t dpvf;
749 
750  /* x-y-z components, p = u, v, w */
751 
752  for (int isou = 0; isou < 6; isou++) {
753 
754  for (int jsou = 0; jsou < 3; jsou++)
755  dpvf[jsou] = 0.5*( gradi[isou][jsou]
756  + gradj[isou][jsou]);
757 
758  /* reconstruction only if IRCFLP = 1 */
759 
760  recoi[isou] = bldfrp*(cs_math_3_dot_product(dpvf, diipf));
761  recoj[isou] = bldfrp*(cs_math_3_dot_product(dpvf, djjpf));
762 
763  pip[isou] = pi[isou] + recoi[isou];
764  pjp[isou] = pj[isou] + recoj[isou];
765 
766  }
767 }
768 
769 /*----------------------------------------------------------------------------*/
785 /*----------------------------------------------------------------------------*/
786 
787 inline static void
788 cs_i_relax_c_val(const double relaxp,
789  const cs_real_t pia,
790  const cs_real_t pja,
791  const cs_real_t recoi,
792  const cs_real_t recoj,
793  const cs_real_t pi,
794  const cs_real_t pj,
795  cs_real_t *pir,
796  cs_real_t *pjr,
797  cs_real_t *pipr,
798  cs_real_t *pjpr)
799 {
800  *pir = pi/relaxp - (1.-relaxp)/relaxp * pia;
801  *pjr = pj/relaxp - (1.-relaxp)/relaxp * pja;
802 
803  *pipr = *pir + recoi;
804  *pjpr = *pjr + recoj;
805 }
806 
807 /*----------------------------------------------------------------------------*/
823 /*----------------------------------------------------------------------------*/
824 
825 inline static void
826 cs_i_relax_c_val_vector(const double relaxp,
827  const cs_real_3_t pia,
828  const cs_real_3_t pja,
829  const cs_real_3_t recoi,
830  const cs_real_3_t recoj,
831  const cs_real_3_t pi,
832  const cs_real_3_t pj,
833  cs_real_t pir[3],
834  cs_real_t pjr[3],
835  cs_real_t pipr[3],
836  cs_real_t pjpr[3])
837 {
838  for (int isou = 0; isou < 3; isou++) {
839  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
840  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
841 
842  pipr[isou] = pir[isou] + recoi[isou];
843  pjpr[isou] = pjr[isou] + recoj[isou];
844  }
845 }
846 
847 /*----------------------------------------------------------------------------*/
863 /*----------------------------------------------------------------------------*/
864 
865 inline static void
867  const cs_real_t pia[6],
868  const cs_real_t pja[6],
869  const cs_real_t recoi[6],
870  const cs_real_t recoj[6],
871  const cs_real_t pi[6],
872  const cs_real_t pj[6],
873  cs_real_t pir[6],
874  cs_real_t pjr[6],
875  cs_real_t pipr[6],
876  cs_real_t pjpr[6])
877 {
878  for (int isou = 0; isou < 6; isou++) {
879  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
880  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
881 
882  pipr[isou] = pir[isou] + recoi[isou];
883  pjpr[isou] = pjr[isou] + recoj[isou];
884  }
885 }
886 
887 /*----------------------------------------------------------------------------*/
894 /*----------------------------------------------------------------------------*/
895 
896 inline static void
898  cs_real_t *pf)
899 {
900  *pf = p;
901 }
902 
903 /*----------------------------------------------------------------------------*/
910 /*----------------------------------------------------------------------------*/
911 
912 inline static void
914  cs_real_t pf[3])
915 {
916  for (int isou = 0; isou < 3; isou++)
917  pf[isou] = p[isou];
918 }
919 
920 /*----------------------------------------------------------------------------*/
927 /*----------------------------------------------------------------------------*/
928 
929 inline static void
931  cs_real_t pf[6])
932 {
933  for (int isou = 0; isou < 6; isou++)
934  pf[isou] = p[isou];
935 }
936 
937 /*----------------------------------------------------------------------------*/
946 /*----------------------------------------------------------------------------*/
947 
948 inline static void
949 cs_centered_f_val(const double pnd,
950  const cs_real_t pip,
951  const cs_real_t pjp,
952  cs_real_t *pf)
953 {
954  *pf = pnd*pip + (1.-pnd)*pjp;
955 }
956 
957 /*----------------------------------------------------------------------------*/
966 /*----------------------------------------------------------------------------*/
967 
968 inline static void
969 cs_centered_f_val_vector(const double pnd,
970  const cs_real_3_t pip,
971  const cs_real_3_t pjp,
972  cs_real_t pf[3])
973 {
974  for (int isou = 0; isou < 3; isou++)
975  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
976 }
977 
978 /*----------------------------------------------------------------------------*/
987 /*----------------------------------------------------------------------------*/
988 
989 inline static void
990 cs_centered_f_val_tensor(const double pnd,
991  const cs_real_6_t pip,
992  const cs_real_6_t pjp,
993  cs_real_t pf[6])
994 {
995  for (int isou = 0; isou < 6; isou++)
996  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
997 }
998 
999 /*----------------------------------------------------------------------------*/
1009 /*----------------------------------------------------------------------------*/
1010 
1011 inline static void
1013  const cs_real_3_t i_face_cog,
1014  const cs_real_3_t grad,
1015  const cs_real_t p,
1016  cs_real_t *pf)
1017 {
1018  cs_real_t df[3];
1019 
1020  df[0] = i_face_cog[0] - cell_cen[0];
1021  df[1] = i_face_cog[1] - cell_cen[1];
1022  df[2] = i_face_cog[2] - cell_cen[2];
1023 
1024  *pf = p + cs_math_3_dot_product(df, grad);
1025 }
1026 
1027 /*----------------------------------------------------------------------------*/
1037 /*----------------------------------------------------------------------------*/
1038 
1039 inline static void
1041  const cs_real_3_t i_face_cog,
1042  const cs_real_33_t grad,
1043  const cs_real_3_t p,
1044  cs_real_t pf[3])
1045 {
1046  cs_real_t df[3];
1047 
1048  for (int jsou = 0; jsou < 3; jsou++)
1049  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
1050 
1051  for (int isou = 0; isou < 3; isou++) {
1052  pf[isou] = p[isou] + df[0]*grad[isou][0]
1053  + df[1]*grad[isou][1]
1054  + df[2]*grad[isou][2];
1055 
1056  }
1057 }
1058 
1059 /*----------------------------------------------------------------------------*/
1069 /*----------------------------------------------------------------------------*/
1070 
1071 inline static void
1073  const cs_real_3_t i_face_cog,
1074  const cs_real_63_t grad,
1075  const cs_real_6_t p,
1076  cs_real_t pf[6])
1077 {
1078  cs_real_t df[3];
1079 
1080  for (int jsou = 0; jsou < 3; jsou++)
1081  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
1082 
1083  for (int isou = 0; isou < 6; isou++) {
1084  pf[isou] = p[isou] + df[0]*grad[isou][0]
1085  + df[1]*grad[isou][1]
1086  + df[2]*grad[isou][2];
1087  }
1088 }
1089 
1090 /*----------------------------------------------------------------------------*/
1100 /*----------------------------------------------------------------------------*/
1101 
1102 inline static void
1103 cs_blend_f_val(const double blencp,
1104  const cs_real_t p,
1105  cs_real_t *pf)
1106 {
1107  *pf = blencp * (*pf) + (1. - blencp) * p;
1108 }
1109 
1110 /*----------------------------------------------------------------------------*/
1120 /*----------------------------------------------------------------------------*/
1121 
1122 inline static void
1123 cs_blend_f_val_vector(const double blencp,
1124  const cs_real_3_t p,
1125  cs_real_t pf[3])
1126 {
1127  for (int isou = 0; isou < 3; isou++)
1128  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
1129 }
1130 
1131 /*----------------------------------------------------------------------------*/
1141 /*----------------------------------------------------------------------------*/
1142 
1143 inline static void
1144 cs_blend_f_val_tensor(const double blencp,
1145  const cs_real_t p[6],
1146  cs_real_t pf[6])
1147 {
1148  for (int isou = 0; isou < 6; isou++)
1149  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
1150 }
1151 
1152 /*----------------------------------------------------------------------------*/
1173 /*----------------------------------------------------------------------------*/
1174 
1175 inline static void
1176 cs_i_conv_flux(const int iconvp,
1177  const cs_real_t thetap,
1178  const int imasac,
1179  const cs_real_t pi,
1180  const cs_real_t pj,
1181  const cs_real_t pifri,
1182  const cs_real_t pifrj,
1183  const cs_real_t pjfri,
1184  const cs_real_t pjfrj,
1185  const cs_real_t i_massflux,
1186  const cs_real_t xcppi,
1187  const cs_real_t xcppj,
1188  cs_real_2_t fluxij)
1189 {
1190  cs_real_t flui, fluj;
1191 
1192  flui = 0.5*(i_massflux + fabs(i_massflux));
1193  fluj = 0.5*(i_massflux - fabs(i_massflux));
1194 
1195  fluxij[0] += iconvp*xcppi*(thetap*(flui*pifri + fluj*pjfri) - imasac*i_massflux*pi);
1196  fluxij[1] += iconvp*xcppj*(thetap*(flui*pifrj + fluj*pjfrj) - imasac*i_massflux*pj);
1197 }
1198 
1199 /*----------------------------------------------------------------------------*/
1217 /*----------------------------------------------------------------------------*/
1218 
1219 inline static void
1220 cs_i_conv_flux_vector(const int iconvp,
1221  const cs_real_t thetap,
1222  const int imasac,
1223  const cs_real_t pi[3],
1224  const cs_real_t pj[3],
1225  const cs_real_t pifri[3],
1226  const cs_real_t pifrj[3],
1227  const cs_real_t pjfri[3],
1228  const cs_real_t pjfrj[3],
1229  const cs_real_t i_massflux,
1230  cs_real_t fluxi[3],
1231  cs_real_t fluxj[3])
1232 {
1233  cs_real_t flui, fluj;
1234 
1235  flui = 0.5*(i_massflux + fabs(i_massflux));
1236  fluj = 0.5*(i_massflux - fabs(i_massflux));
1237 
1238  for (int isou = 0; isou < 3; isou++) {
1239 
1240  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1241  - imasac*i_massflux*pi[isou]);
1242  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1243  - imasac*i_massflux*pj[isou]);
1244  }
1245 }
1246 
1247 /*----------------------------------------------------------------------------*/
1265 /*----------------------------------------------------------------------------*/
1266 
1267 inline static void
1268 cs_i_conv_flux_tensor(const int iconvp,
1269  const cs_real_t thetap,
1270  const int imasac,
1271  const cs_real_t pi[6],
1272  const cs_real_t pj[6],
1273  const cs_real_t pifri[6],
1274  const cs_real_t pifrj[6],
1275  const cs_real_t pjfri[6],
1276  const cs_real_t pjfrj[6],
1277  const cs_real_t i_massflux,
1278  cs_real_t fluxi[6],
1279  cs_real_t fluxj[6])
1280 {
1281  cs_real_t flui, fluj;
1282 
1283  flui = 0.5*(i_massflux + fabs(i_massflux));
1284  fluj = 0.5*(i_massflux - fabs(i_massflux));
1285 
1286  for (int isou = 0; isou < 6; isou++) {
1287  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1288  - imasac*i_massflux*pi[isou]);
1289  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1290  - imasac*i_massflux*pj[isou]);
1291  }
1292 }
1293 
1294 /*----------------------------------------------------------------------------*/
1307 /*----------------------------------------------------------------------------*/
1308 
1309 inline static void
1310 cs_i_diff_flux(const int idiffp,
1311  const cs_real_t thetap,
1312  const cs_real_t pip,
1313  const cs_real_t pjp,
1314  const cs_real_t pipr,
1315  const cs_real_t pjpr,
1316  const cs_real_t i_visc,
1317  cs_real_t fluxij[2])
1318 {
1319  fluxij[0] += idiffp*thetap*i_visc*(pipr -pjp);
1320  fluxij[1] += idiffp*thetap*i_visc*(pip -pjpr);
1321 }
1322 
1323 /*----------------------------------------------------------------------------*/
1337 /*----------------------------------------------------------------------------*/
1338 
1339 inline static void
1340 cs_i_diff_flux_vector(const int idiffp,
1341  const cs_real_t thetap,
1342  const cs_real_t pip[3],
1343  const cs_real_t pjp[3],
1344  const cs_real_t pipr[3],
1345  const cs_real_t pjpr[3],
1346  const cs_real_t i_visc,
1347  cs_real_t fluxi[3],
1348  cs_real_t fluxj[3])
1349 {
1350  for (int isou = 0; isou < 3; isou++) {
1351  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1352  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1353  }
1354 }
1355 
1356 /*----------------------------------------------------------------------------*/
1370 /*----------------------------------------------------------------------------*/
1371 
1372 inline static void
1373 cs_i_diff_flux_tensor(const int idiffp,
1374  const cs_real_t thetap,
1375  const cs_real_t pip[6],
1376  const cs_real_t pjp[6],
1377  const cs_real_t pipr[6],
1378  const cs_real_t pjpr[6],
1379  const cs_real_t i_visc,
1380  cs_real_t fluxi[6],
1381  cs_real_t fluxj[6])
1382 {
1383  for (int isou = 0; isou < 6; isou++) {
1384  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1385  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1386  }
1387 }
1388 
1389 /*----------------------------------------------------------------------------*/
1413 /*----------------------------------------------------------------------------*/
1414 
1415 inline static void
1417  const cs_real_t relaxp,
1418  const cs_real_t diipf[3],
1419  const cs_real_t djjpf[3],
1420  const cs_real_t gradi[3],
1421  const cs_real_t gradj[3],
1422  const cs_real_t pi,
1423  const cs_real_t pj,
1424  const cs_real_t pia,
1425  const cs_real_t pja,
1426  cs_real_t *pifri,
1427  cs_real_t *pifrj,
1428  cs_real_t *pjfri,
1429  cs_real_t *pjfrj,
1430  cs_real_t *pip,
1431  cs_real_t *pjp,
1432  cs_real_t *pipr,
1433  cs_real_t *pjpr)
1434 {
1435  cs_real_t pir, pjr;
1436  cs_real_t recoi, recoj;
1437 
1438  cs_i_compute_quantities(bldfrp,
1439  diipf,
1440  djjpf,
1441  gradi,
1442  gradj,
1443  pi,
1444  pj,
1445  &recoi,
1446  &recoj,
1447  pip,
1448  pjp);
1449 
1450  cs_i_relax_c_val(relaxp,
1451  pia,
1452  pja,
1453  recoi,
1454  recoj,
1455  pi,
1456  pj,
1457  &pir,
1458  &pjr,
1459  pipr,
1460  pjpr);
1461 
1462  cs_upwind_f_val(pi,
1463  pifrj);
1464  cs_upwind_f_val(pir,
1465  pifri);
1466  cs_upwind_f_val(pj,
1467  pjfri);
1468  cs_upwind_f_val(pjr,
1469  pjfrj);
1470 }
1471 
1472 /*----------------------------------------------------------------------------*/
1496 /*----------------------------------------------------------------------------*/
1497 
1498 inline static void
1500  const cs_real_t relaxp,
1501  const cs_real_t diipf[3],
1502  const cs_real_t djjpf[3],
1503  const cs_real_t gradi[3][3],
1504  const cs_real_t gradj[3][3],
1505  const cs_real_t pi[3],
1506  const cs_real_t pj[3],
1507  const cs_real_t pia[3],
1508  const cs_real_t pja[3],
1509  cs_real_t pifri[3],
1510  cs_real_t pifrj[3],
1511  cs_real_t pjfri[3],
1512  cs_real_t pjfrj[3],
1513  cs_real_t pip[3],
1514  cs_real_t pjp[3],
1515  cs_real_t pipr[3],
1516  cs_real_t pjpr[3])
1517 {
1518  cs_real_t pir[3], pjr[3];
1519  cs_real_t recoi[3], recoj[3];
1520 
1522  diipf,
1523  djjpf,
1524  gradi,
1525  gradj,
1526  pi,
1527  pj,
1528  recoi,
1529  recoj,
1530  pip,
1531  pjp);
1532 
1533  cs_i_relax_c_val_vector(relaxp,
1534  pia,
1535  pja,
1536  recoi,
1537  recoj,
1538  pi,
1539  pj,
1540  pir,
1541  pjr,
1542  pipr,
1543  pjpr);
1544 
1546  pifrj);
1548  pifri);
1550  pjfri);
1552  pjfrj);
1553 }
1554 
1555 /*----------------------------------------------------------------------------*/
1579 /*----------------------------------------------------------------------------*/
1580 
1581 inline static void
1583  const cs_real_t relaxp,
1584  const cs_real_t diipf[3],
1585  const cs_real_t djjpf[3],
1586  const cs_real_t gradi[6][3],
1587  const cs_real_t gradj[6][3],
1588  const cs_real_t pi[6],
1589  const cs_real_t pj[6],
1590  const cs_real_t pia[6],
1591  const cs_real_t pja[6],
1592  cs_real_t pifri[6],
1593  cs_real_t pifrj[6],
1594  cs_real_t pjfri[6],
1595  cs_real_t pjfrj[6],
1596  cs_real_t pip[6],
1597  cs_real_t pjp[6],
1598  cs_real_t pipr[6],
1599  cs_real_t pjpr[6])
1600 {
1601  cs_real_t pir[6], pjr[6];
1602  cs_real_t recoi[6], recoj[6];
1603 
1605  diipf,
1606  djjpf,
1607  gradi,
1608  gradj,
1609  pi,
1610  pj,
1611  recoi,
1612  recoj,
1613  pip,
1614  pjp);
1615 
1616  cs_i_relax_c_val_tensor(relaxp,
1617  pia,
1618  pja,
1619  recoi,
1620  recoj,
1621  pi,
1622  pj,
1623  pir,
1624  pjr,
1625  pipr,
1626  pjpr);
1627 
1629  pifrj);
1631  pifri);
1633  pjfri);
1635  pjfrj);
1636 }
1637 
1638 /*----------------------------------------------------------------------------*/
1655 /*----------------------------------------------------------------------------*/
1656 
1657 inline static void
1659  const cs_real_t diipf[3],
1660  const cs_real_t djjpf[3],
1661  const cs_real_t gradi[3],
1662  const cs_real_t gradj[3],
1663  const cs_real_t pi,
1664  const cs_real_t pj,
1665  cs_real_t *pif,
1666  cs_real_t *pjf,
1667  cs_real_t *pip,
1668  cs_real_t *pjp)
1669 {
1670  cs_real_t recoi, recoj;
1671 
1672  cs_i_compute_quantities(bldfrp,
1673  diipf,
1674  djjpf,
1675  gradi,
1676  gradj,
1677  pi,
1678  pj,
1679  &recoi,
1680  &recoj,
1681  pip,
1682  pjp);
1683 
1684  cs_upwind_f_val(pi, pif);
1685  cs_upwind_f_val(pj, pjf);
1686 }
1687 
1688 /*----------------------------------------------------------------------------*/
1705 /*----------------------------------------------------------------------------*/
1706 
1707 inline static void
1709  const cs_real_t diipf[3],
1710  const cs_real_t djjpf[3],
1711  const cs_real_t gradi[3][3],
1712  const cs_real_t gradj[3][3],
1713  const cs_real_t pi[3],
1714  const cs_real_t pj[3],
1715  cs_real_t pif[3],
1716  cs_real_t pjf[3],
1717  cs_real_t pip[3],
1718  cs_real_t pjp[3])
1719 {
1720  cs_real_t recoi[3], recoj[3];
1721 
1723  diipf,
1724  djjpf,
1725  gradi,
1726  gradj,
1727  pi,
1728  pj,
1729  recoi,
1730  recoj,
1731  pip,
1732  pjp);
1733 
1734  cs_upwind_f_val_vector(pi, pif);
1735  cs_upwind_f_val_vector(pj, pjf);
1736 }
1737 
1738 /*----------------------------------------------------------------------------*/
1755 /*----------------------------------------------------------------------------*/
1756 
1757 inline static void
1759  const cs_real_t diipf[3],
1760  const cs_real_t djjpf[3],
1761  const cs_real_t gradi[6][3],
1762  const cs_real_t gradj[6][3],
1763  const cs_real_t pi[6],
1764  const cs_real_t pj[6],
1765  cs_real_t pif[6],
1766  cs_real_t pjf[6],
1767  cs_real_t pip[6],
1768  cs_real_t pjp[6])
1769 {
1770  cs_real_t recoi[6], recoj[6];
1771 
1773  diipf,
1774  djjpf,
1775  gradi,
1776  gradj,
1777  pi,
1778  pj,
1779  recoi,
1780  recoj,
1781  pip,
1782  pjp);
1783 
1784  cs_upwind_f_val_tensor(pi, pif);
1785  cs_upwind_f_val_tensor(pj, pjf);
1786 
1787 }
1788 
1789 /*----------------------------------------------------------------------------*/
1822 /*----------------------------------------------------------------------------*/
1823 
1824 inline static void
1826  const int ischcp,
1827  const double relaxp,
1828  const double blencp,
1829  const cs_real_t weight,
1830  const cs_real_t cell_ceni[3],
1831  const cs_real_t cell_cenj[3],
1832  const cs_real_t i_face_cog[3],
1833  const cs_real_t diipf[3],
1834  const cs_real_t djjpf[3],
1835  const cs_real_t gradi[3],
1836  const cs_real_t gradj[3],
1837  const cs_real_t gradupi[3],
1838  const cs_real_t gradupj[3],
1839  const cs_real_t pi,
1840  const cs_real_t pj,
1841  const cs_real_t pia,
1842  const cs_real_t pja,
1843  cs_real_t *pifri,
1844  cs_real_t *pifrj,
1845  cs_real_t *pjfri,
1846  cs_real_t *pjfrj,
1847  cs_real_t *pip,
1848  cs_real_t *pjp,
1849  cs_real_t *pipr,
1850  cs_real_t *pjpr)
1851 {
1852  cs_real_t pir, pjr;
1853  cs_real_t recoi, recoj;
1854 
1855  cs_i_compute_quantities(bldfrp,
1856  diipf,
1857  djjpf,
1858  gradi,
1859  gradj,
1860  pi,
1861  pj,
1862  &recoi,
1863  &recoj,
1864  pip,
1865  pjp);
1866 
1867  cs_i_relax_c_val(relaxp,
1868  pia,
1869  pja,
1870  recoi,
1871  recoj,
1872  pi,
1873  pj,
1874  &pir,
1875  &pjr,
1876  pipr,
1877  pjpr);
1878 
1879  if (ischcp == 1) {
1880 
1881  /* Centered
1882  --------*/
1883 
1884  cs_centered_f_val(weight,
1885  *pip,
1886  *pjpr,
1887  pifrj);
1888  cs_centered_f_val(weight,
1889  *pipr,
1890  *pjp,
1891  pifri);
1892  cs_centered_f_val(weight,
1893  *pipr,
1894  *pjp,
1895  pjfri);
1896  cs_centered_f_val(weight,
1897  *pip,
1898  *pjpr,
1899  pjfrj);
1900 
1901  } else if (ischcp == 0) {
1902 
1903  /* Original SOLU
1904  --------------*/
1905 
1906  cs_solu_f_val(cell_ceni,
1907  i_face_cog,
1908  gradi,
1909  pi,
1910  pifrj);
1911  cs_solu_f_val(cell_ceni,
1912  i_face_cog,
1913  gradi,
1914  pir,
1915  pifri);
1916  cs_solu_f_val(cell_cenj,
1917  i_face_cog,
1918  gradj,
1919  pj,
1920  pjfri);
1921  cs_solu_f_val(cell_cenj,
1922  i_face_cog,
1923  gradj,
1924  pjr,
1925  pjfrj);
1926 
1927  } else {
1928 
1929  /* SOLU
1930  ----*/
1931 
1932  cs_solu_f_val(cell_ceni,
1933  i_face_cog,
1934  gradupi,
1935  pi,
1936  pifrj);
1937  cs_solu_f_val(cell_ceni,
1938  i_face_cog,
1939  gradupi,
1940  pir,
1941  pifri);
1942  cs_solu_f_val(cell_cenj,
1943  i_face_cog,
1944  gradupj,
1945  pj,
1946  pjfri);
1947  cs_solu_f_val(cell_cenj,
1948  i_face_cog,
1949  gradupj,
1950  pjr,
1951  pjfrj);
1952 
1953  }
1954 
1955  /* Blending
1956  --------*/
1957 
1958  cs_blend_f_val(blencp,
1959  pi,
1960  pifrj);
1961  cs_blend_f_val(blencp,
1962  pir,
1963  pifri);
1964  cs_blend_f_val(blencp,
1965  pj,
1966  pjfri);
1967  cs_blend_f_val(blencp,
1968  pjr,
1969  pjfrj);
1970 }
1971 
1972 /*----------------------------------------------------------------------------*/
2003 /*----------------------------------------------------------------------------*/
2004 
2005 inline static void
2007  const int ischcp,
2008  const double relaxp,
2009  const double blencp,
2010  const cs_real_t weight,
2011  const cs_real_3_t cell_ceni,
2012  const cs_real_3_t cell_cenj,
2013  const cs_real_3_t i_face_cog,
2014  const cs_real_3_t diipf,
2015  const cs_real_3_t djjpf,
2016  const cs_real_33_t gradi,
2017  const cs_real_33_t gradj,
2018  const cs_real_3_t pi,
2019  const cs_real_3_t pj,
2020  const cs_real_3_t pia,
2021  const cs_real_3_t pja,
2022  cs_real_t pifri[3],
2023  cs_real_t pifrj[3],
2024  cs_real_t pjfri[3],
2025  cs_real_t pjfrj[3],
2026  cs_real_t pip[3],
2027  cs_real_t pjp[3],
2028  cs_real_t pipr[3],
2029  cs_real_t pjpr[3])
2030 {
2031  cs_real_t pir[3], pjr[3];
2032  cs_real_t recoi[3], recoj[3];
2033 
2035  diipf,
2036  djjpf,
2037  gradi,
2038  gradj,
2039  pi,
2040  pj,
2041  recoi,
2042  recoj,
2043  pip,
2044  pjp);
2045 
2046  cs_i_relax_c_val_vector(relaxp,
2047  pia,
2048  pja,
2049  recoi,
2050  recoj,
2051  pi,
2052  pj,
2053  pir,
2054  pjr,
2055  pipr,
2056  pjpr);
2057 
2058  if (ischcp == 1) {
2059 
2060  /* Centered
2061  --------*/
2062 
2063  cs_centered_f_val_vector(weight,
2064  pip,
2065  pjpr,
2066  pifrj);
2067  cs_centered_f_val_vector(weight,
2068  pipr,
2069  pjp,
2070  pifri);
2071  cs_centered_f_val_vector(weight,
2072  pipr,
2073  pjp,
2074  pjfri);
2075  cs_centered_f_val_vector(weight,
2076  pip,
2077  pjpr,
2078  pjfrj);
2079 
2080  } else {
2081 
2082  /* Second order
2083  ------------*/
2084 
2085  cs_solu_f_val_vector(cell_ceni,
2086  i_face_cog,
2087  gradi,
2088  pi,
2089  pifrj);
2090  cs_solu_f_val_vector(cell_ceni,
2091  i_face_cog,
2092  gradi,
2093  pir,
2094  pifri);
2095  cs_solu_f_val_vector(cell_cenj,
2096  i_face_cog,
2097  gradj,
2098  pj,
2099  pjfri);
2100  cs_solu_f_val_vector(cell_cenj,
2101  i_face_cog,
2102  gradj,
2103  pjr,
2104  pjfrj);
2105 
2106  }
2107 
2108  /* Blending
2109  --------*/
2110  cs_blend_f_val_vector(blencp,
2111  pi,
2112  pifrj);
2113  cs_blend_f_val_vector(blencp,
2114  pir,
2115  pifri);
2116  cs_blend_f_val_vector(blencp,
2117  pj,
2118  pjfri);
2119  cs_blend_f_val_vector(blencp,
2120  pjr,
2121  pjfrj);
2122 
2123 }
2124 
2125 /*----------------------------------------------------------------------------*/
2156 /*----------------------------------------------------------------------------*/
2157 
2158 inline static void
2160  const int ischcp,
2161  const double relaxp,
2162  const double blencp,
2163  const cs_real_t weight,
2164  const cs_real_3_t cell_ceni,
2165  const cs_real_3_t cell_cenj,
2166  const cs_real_3_t i_face_cog,
2167  const cs_real_3_t diipf,
2168  const cs_real_3_t djjpf,
2169  const cs_real_63_t gradi,
2170  const cs_real_63_t gradj,
2171  const cs_real_6_t pi,
2172  const cs_real_6_t pj,
2173  const cs_real_6_t pia,
2174  const cs_real_6_t pja,
2175  cs_real_t pifri[6],
2176  cs_real_t pifrj[6],
2177  cs_real_t pjfri[6],
2178  cs_real_t pjfrj[6],
2179  cs_real_t pip[6],
2180  cs_real_t pjp[6],
2181  cs_real_t pipr[6],
2182  cs_real_t pjpr[6])
2183 
2184 {
2185  cs_real_t pir[6], pjr[6];
2186  cs_real_t recoi[6], recoj[6];
2187 
2189  diipf,
2190  djjpf,
2191  gradi,
2192  gradj,
2193  pi,
2194  pj,
2195  recoi,
2196  recoj,
2197  pip,
2198  pjp);
2199 
2200  cs_i_relax_c_val_tensor(relaxp,
2201  pia,
2202  pja,
2203  recoi,
2204  recoj,
2205  pi,
2206  pj,
2207  pir,
2208  pjr,
2209  pipr,
2210  pjpr);
2211 
2212  if (ischcp == 1) {
2213 
2214  /* Centered
2215  --------*/
2216 
2217  cs_centered_f_val_tensor(weight,
2218  pip,
2219  pjpr,
2220  pifrj);
2221  cs_centered_f_val_tensor(weight,
2222  pipr,
2223  pjp,
2224  pifri);
2225  cs_centered_f_val_tensor(weight,
2226  pipr,
2227  pjp,
2228  pjfri);
2229  cs_centered_f_val_tensor(weight,
2230  pip,
2231  pjpr,
2232  pjfrj);
2233 
2234  } else {
2235 
2236  /* Second order
2237  ------------*/
2238 
2239  cs_solu_f_val_tensor(cell_ceni,
2240  i_face_cog,
2241  gradi,
2242  pi,
2243  pifrj);
2244  cs_solu_f_val_tensor(cell_ceni,
2245  i_face_cog,
2246  gradi,
2247  pir,
2248  pifri);
2249  cs_solu_f_val_tensor(cell_cenj,
2250  i_face_cog,
2251  gradj,
2252  pj,
2253  pjfri);
2254  cs_solu_f_val_tensor(cell_cenj,
2255  i_face_cog,
2256  gradj,
2257  pjr,
2258  pjfrj);
2259 
2260  }
2261 
2262  /* Blending
2263  --------*/
2264 
2265  cs_blend_f_val_tensor(blencp,
2266  pi,
2267  pifrj);
2268  cs_blend_f_val_tensor(blencp,
2269  pir,
2270  pifri);
2271  cs_blend_f_val_tensor(blencp,
2272  pj,
2273  pjfri);
2274  cs_blend_f_val_tensor(blencp,
2275  pjr,
2276  pjfrj);
2277 }
2278 
2279 /*----------------------------------------------------------------------------*/
2309 /*----------------------------------------------------------------------------*/
2310 
2311 inline static void
2313  const int ischcp,
2314  const double blencp,
2315  const cs_real_t weight,
2316  const cs_real_3_t cell_ceni,
2317  const cs_real_3_t cell_cenj,
2318  const cs_real_3_t i_face_cog,
2319  const cs_real_t hybrid_blend_i,
2320  const cs_real_t hybrid_blend_j,
2321  const cs_real_3_t diipf,
2322  const cs_real_3_t djjpf,
2323  const cs_real_3_t gradi,
2324  const cs_real_3_t gradj,
2325  const cs_real_3_t gradupi,
2326  const cs_real_3_t gradupj,
2327  const cs_real_t pi,
2328  const cs_real_t pj,
2329  cs_real_t *pif,
2330  cs_real_t *pjf,
2331  cs_real_t *pip,
2332  cs_real_t *pjp)
2333 {
2334  cs_real_t recoi, recoj;
2335 
2336  cs_i_compute_quantities(bldfrp,
2337  diipf,
2338  djjpf,
2339  gradi,
2340  gradj,
2341  pi,
2342  pj,
2343  &recoi,
2344  &recoj,
2345  pip,
2346  pjp);
2347 
2348 
2349  if (ischcp == 1) {
2350 
2351  /* Centered
2352  --------*/
2353 
2354  cs_centered_f_val(weight,
2355  *pip,
2356  *pjp,
2357  pif);
2358  cs_centered_f_val(weight,
2359  *pip,
2360  *pjp,
2361  pjf);
2362 
2363  } else if (ischcp == 0) {
2364 
2365  /* Legacy SOLU
2366  -----------*/
2367 
2368  cs_solu_f_val(cell_ceni,
2369  i_face_cog,
2370  gradi,
2371  pi,
2372  pif);
2373  cs_solu_f_val(cell_cenj,
2374  i_face_cog,
2375  gradj,
2376  pj,
2377  pjf);
2378 
2379  } else if (ischcp == 3) {
2380 
2381  /* Centered
2382  --------*/
2383 
2384  cs_centered_f_val(weight,
2385  *pip,
2386  *pjp,
2387  pif);
2388  cs_centered_f_val(weight,
2389  *pip,
2390  *pjp,
2391  pjf);
2392 
2393  /* Legacy SOLU
2394  -----------*/
2395  cs_real_t pif_up, pjf_up;
2396  cs_real_t hybrid_blend_interp;
2397 
2398  cs_solu_f_val(cell_ceni,
2399  i_face_cog,
2400  gradi,
2401  pi,
2402  &pif_up);
2403  cs_solu_f_val(cell_cenj,
2404  i_face_cog,
2405  gradj,
2406  pj,
2407  &pjf_up);
2408 
2409  hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2410  *pif = hybrid_blend_interp*(*pif) + (1. - hybrid_blend_interp)*pif_up;
2411  *pjf = hybrid_blend_interp*(*pjf) + (1. - hybrid_blend_interp)*pjf_up;
2412 
2413  } else {
2414 
2415  /* SOLU
2416  ----*/
2417 
2418  cs_solu_f_val(cell_ceni,
2419  i_face_cog,
2420  gradupi,
2421  pi,
2422  pif);
2423  cs_solu_f_val(cell_cenj,
2424  i_face_cog,
2425  gradupj,
2426  pj,
2427  pjf);
2428 
2429  }
2430 
2431 
2432  /* Blending
2433  --------*/
2434 
2435  cs_blend_f_val(blencp,
2436  pi,
2437  pif);
2438  cs_blend_f_val(blencp,
2439  pj,
2440  pjf);
2441 }
2442 
2443 /*----------------------------------------------------------------------------*/
2469 /*----------------------------------------------------------------------------*/
2470 
2471 inline static void
2473  const int ischcp,
2474  const double blencp,
2475  const cs_real_t weight,
2476  const cs_real_3_t cell_ceni,
2477  const cs_real_3_t cell_cenj,
2478  const cs_real_3_t i_face_cog,
2479  const cs_real_t hybrid_blend_i,
2480  const cs_real_t hybrid_blend_j,
2481  const cs_real_3_t diipf,
2482  const cs_real_3_t djjpf,
2483  const cs_real_33_t gradi,
2484  const cs_real_33_t gradj,
2485  const cs_real_3_t pi,
2486  const cs_real_3_t pj,
2487  cs_real_t pif[3],
2488  cs_real_t pjf[3],
2489  cs_real_t pip[3],
2490  cs_real_t pjp[3])
2491 
2492 {
2493  cs_real_t recoi[3], recoj[3];
2494 
2496  diipf,
2497  djjpf,
2498  gradi,
2499  gradj,
2500  pi,
2501  pj,
2502  recoi,
2503  recoj,
2504  pip,
2505  pjp);
2506 
2507  if (ischcp == 1) {
2508 
2509  /* Centered
2510  --------*/
2511 
2512  cs_centered_f_val_vector(weight,
2513  pip,
2514  pjp,
2515  pif);
2516  cs_centered_f_val_vector(weight,
2517  pip,
2518  pjp,
2519  pjf);
2520  } else if (ischcp == 3) {
2521 
2522  /* Centered
2523  --------*/
2524 
2525  cs_centered_f_val_vector(weight,
2526  pip,
2527  pjp,
2528  pif);
2529  cs_centered_f_val_vector(weight,
2530  pip,
2531  pjp,
2532  pjf);
2533 
2534  /* SOLU
2535  -----*/
2536  cs_real_t pif_up[3], pjf_up[3];
2537  cs_real_t hybrid_blend_interp;
2538 
2539  cs_solu_f_val_vector(cell_ceni,
2540  i_face_cog,
2541  gradi,
2542  pi,
2543  pif_up);
2544  cs_solu_f_val_vector(cell_cenj,
2545  i_face_cog,
2546  gradj,
2547  pj,
2548  pjf_up);
2549 
2550  hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2551  for (int isou = 0; isou < 3; isou++) {
2552  pif[isou] = hybrid_blend_interp *pif[isou]
2553  + (1. - hybrid_blend_interp)*pif_up[isou];
2554  pjf[isou] = hybrid_blend_interp *pjf[isou]
2555  + (1. - hybrid_blend_interp)*pjf_up[isou];
2556  }
2557  } else {
2558 
2559  /* Second order
2560  ------------*/
2561 
2562  cs_solu_f_val_vector(cell_ceni,
2563  i_face_cog,
2564  gradi,
2565  pi,
2566  pif);
2567  cs_solu_f_val_vector(cell_cenj,
2568  i_face_cog,
2569  gradj,
2570  pj,
2571  pjf);
2572 
2573  }
2574 
2575  /* Blending
2576  --------*/
2577 
2578  cs_blend_f_val_vector(blencp,
2579  pi,
2580  pif);
2581  cs_blend_f_val_vector(blencp,
2582  pj,
2583  pjf);
2584 
2585 }
2586 
2587 /*----------------------------------------------------------------------------*/
2611 /*----------------------------------------------------------------------------*/
2612 
2613 inline static void
2615  const int ischcp,
2616  const double blencp,
2617  const cs_real_t weight,
2618  const cs_real_3_t cell_ceni,
2619  const cs_real_3_t cell_cenj,
2620  const cs_real_3_t i_face_cog,
2621  const cs_real_3_t diipf,
2622  const cs_real_3_t djjpf,
2623  const cs_real_63_t gradi,
2624  const cs_real_63_t gradj,
2625  const cs_real_6_t pi,
2626  const cs_real_6_t pj,
2627  cs_real_t pif[6],
2628  cs_real_t pjf[6],
2629  cs_real_t pip[6],
2630  cs_real_t pjp[6])
2631 
2632 {
2633  cs_real_t recoi[6], recoj[6];
2634 
2636  diipf,
2637  djjpf,
2638  gradi,
2639  gradj,
2640  pi,
2641  pj,
2642  recoi,
2643  recoj,
2644  pip,
2645  pjp);
2646 
2647  if (ischcp == 1) {
2648 
2649  /* Centered
2650  --------*/
2651 
2652  cs_centered_f_val_tensor(weight,
2653  pip,
2654  pjp,
2655  pif);
2656  cs_centered_f_val_tensor(weight,
2657  pip,
2658  pjp,
2659  pjf);
2660 
2661  } else {
2662 
2663  /* Second order
2664  ------------*/
2665 
2666  cs_solu_f_val_tensor(cell_ceni,
2667  i_face_cog,
2668  gradi,
2669  pi,
2670  pif);
2671  cs_solu_f_val_tensor(cell_cenj,
2672  i_face_cog,
2673  gradj,
2674  pj,
2675  pjf);
2676 
2677  }
2678 
2679  /* Blending
2680  --------*/
2681 
2682  cs_blend_f_val_tensor(blencp,
2683  pi,
2684  pif);
2685  cs_blend_f_val_tensor(blencp,
2686  pj,
2687  pjf);
2688 
2689 }
2690 
2691 /*----------------------------------------------------------------------------*/
2735 /*----------------------------------------------------------------------------*/
2736 
2737 inline static void
2738 cs_i_cd_steady_slope_test(bool *upwind_switch,
2739  const int iconvp,
2740  const cs_real_t bldfrp,
2741  const int ischcp,
2742  const double relaxp,
2743  const double blencp,
2744  const double blend_st,
2745  const cs_real_t weight,
2746  const cs_real_t i_dist,
2747  const cs_real_t i_face_surf,
2748  const cs_real_3_t cell_ceni,
2749  const cs_real_3_t cell_cenj,
2750  const cs_real_3_t i_face_normal,
2751  const cs_real_3_t i_face_cog,
2752  const cs_real_3_t diipf,
2753  const cs_real_3_t djjpf,
2754  const cs_real_t i_massflux,
2755  const cs_real_3_t gradi,
2756  const cs_real_3_t gradj,
2757  const cs_real_3_t gradupi,
2758  const cs_real_3_t gradupj,
2759  const cs_real_3_t gradsti,
2760  const cs_real_3_t gradstj,
2761  const cs_real_t pi,
2762  const cs_real_t pj,
2763  const cs_real_t pia,
2764  const cs_real_t pja,
2765  cs_real_t *pifri,
2766  cs_real_t *pifrj,
2767  cs_real_t *pjfri,
2768  cs_real_t *pjfrj,
2769  cs_real_t *pip,
2770  cs_real_t *pjp,
2771  cs_real_t *pipr,
2772  cs_real_t *pjpr)
2773 {
2774  cs_real_t pir, pjr;
2775  cs_real_t recoi, recoj;
2776  cs_real_t testij, tesqck;
2777 
2778  *upwind_switch = false;
2779 
2780  cs_i_compute_quantities(bldfrp,
2781  diipf,
2782  djjpf,
2783  gradi,
2784  gradj,
2785  pi,
2786  pj,
2787  &recoi,
2788  &recoj,
2789  pip,
2790  pjp);
2791 
2792  cs_i_relax_c_val(relaxp,
2793  pia,
2794  pja,
2795  recoi,
2796  recoj,
2797  pi,
2798  pj,
2799  &pir,
2800  &pjr,
2801  pipr,
2802  pjpr);
2803 
2804  /* Convection slope test is needed only when iconv >0 */
2805  if (iconvp > 0) {
2806  cs_slope_test(pi,
2807  pj,
2808  i_dist,
2809  i_face_surf,
2810  i_face_normal,
2811  gradi,
2812  gradj,
2813  gradsti,
2814  gradstj,
2815  i_massflux,
2816  &testij,
2817  &tesqck);
2818 
2819  if (ischcp==1) {
2820 
2821  /* Centered
2822  --------*/
2823 
2824  cs_centered_f_val(weight,
2825  *pip,
2826  *pjpr,
2827  pifrj);
2828  cs_centered_f_val(weight,
2829  *pipr,
2830  *pjp,
2831  pifri);
2832  cs_centered_f_val(weight,
2833  *pipr,
2834  *pjp,
2835  pjfri);
2836  cs_centered_f_val(weight,
2837  *pip,
2838  *pjpr,
2839  pjfrj);
2840 
2841  } else if (ischcp == 0) {
2842 
2843  /* Second order
2844  ------------*/
2845 
2846  cs_solu_f_val(cell_ceni,
2847  i_face_cog,
2848  gradi,
2849  pi,
2850  pifrj);
2851  cs_solu_f_val(cell_ceni,
2852  i_face_cog,
2853  gradi,
2854  pir,
2855  pifri);
2856  cs_solu_f_val(cell_cenj,
2857  i_face_cog,
2858  gradj,
2859  pj,
2860  pjfri);
2861  cs_solu_f_val(cell_cenj,
2862  i_face_cog,
2863  gradj,
2864  pjr,
2865  pjfrj);
2866 
2867  } else {
2868 
2869  /* SOLU
2870  -----*/
2871 
2872  cs_solu_f_val(cell_ceni,
2873  i_face_cog,
2874  gradupi,
2875  pi,
2876  pifrj);
2877  cs_solu_f_val(cell_ceni,
2878  i_face_cog,
2879  gradupi,
2880  pir,
2881  pifri);
2882  cs_solu_f_val(cell_cenj,
2883  i_face_cog,
2884  gradupj,
2885  pj,
2886  pjfri);
2887  cs_solu_f_val(cell_cenj,
2888  i_face_cog,
2889  gradupj,
2890  pjr,
2891  pjfrj);
2892  }
2893 
2894 
2895  /* Slope test: Pourcentage of upwind
2896  ----------------------------------*/
2897 
2898  if (tesqck <= 0. || testij <= 0.) {
2899 
2900  cs_blend_f_val(blend_st,
2901  pi,
2902  pifrj);
2903  cs_blend_f_val(blend_st,
2904  pir,
2905  pifri);
2906  cs_blend_f_val(blend_st,
2907  pj,
2908  pjfri);
2909  cs_blend_f_val(blend_st,
2910  pjr,
2911  pjfrj);
2912 
2913  *upwind_switch = true;
2914 
2915  }
2916 
2917 
2918  /* Blending
2919  --------*/
2920 
2921  cs_blend_f_val(blencp,
2922  pi,
2923  pifrj);
2924  cs_blend_f_val(blencp,
2925  pir,
2926  pifri);
2927  cs_blend_f_val(blencp,
2928  pj,
2929  pjfri);
2930  cs_blend_f_val(blencp,
2931  pjr,
2932  pjfrj);
2933 
2934  /* If iconv=0 p*fr* are useless */
2935  } else {
2936  cs_upwind_f_val(pi,
2937  pifrj);
2938  cs_upwind_f_val(pir,
2939  pifri);
2940  cs_upwind_f_val(pj,
2941  pjfri);
2942  cs_upwind_f_val(pjr,
2943  pjfrj);
2944  }
2945 
2946 }
2947 
2948 /*----------------------------------------------------------------------------*/
2990 /*----------------------------------------------------------------------------*/
2991 
2992 inline static void
2994  const int iconvp,
2995  const cs_real_t bldfrp,
2996  const int ischcp,
2997  const double relaxp,
2998  const double blencp,
2999  const double blend_st,
3000  const cs_real_t weight,
3001  const cs_real_t i_dist,
3002  const cs_real_t i_face_surf,
3003  const cs_real_3_t cell_ceni,
3004  const cs_real_3_t cell_cenj,
3005  const cs_real_3_t i_face_normal,
3006  const cs_real_3_t i_face_cog,
3007  const cs_real_3_t diipf,
3008  const cs_real_3_t djjpf,
3009  const cs_real_t i_massflux,
3010  const cs_real_33_t gradi,
3011  const cs_real_33_t gradj,
3012  const cs_real_33_t grdpai,
3013  const cs_real_33_t grdpaj,
3014  const cs_real_3_t pi,
3015  const cs_real_3_t pj,
3016  const cs_real_3_t pia,
3017  const cs_real_3_t pja,
3018  cs_real_t pifri[3],
3019  cs_real_t pifrj[3],
3020  cs_real_t pjfri[3],
3021  cs_real_t pjfrj[3],
3022  cs_real_t pip[3],
3023  cs_real_t pjp[3],
3024  cs_real_t pipr[3],
3025  cs_real_t pjpr[3])
3026 {
3027  cs_real_t pir[3], pjr[3];
3028  cs_real_t recoi[3], recoj[3];
3029  cs_real_t testij, tesqck;
3030  int isou;
3031 
3033  diipf,
3034  djjpf,
3035  gradi,
3036  gradj,
3037  pi,
3038  pj,
3039  recoi,
3040  recoj,
3041  pip,
3042  pjp);
3043 
3044  cs_i_relax_c_val_vector(relaxp,
3045  pia,
3046  pja,
3047  recoi,
3048  recoj,
3049  pi,
3050  pj,
3051  pir,
3052  pjr,
3053  pipr,
3054  pjpr);
3055 
3056  /* Convection slope test is needed only when iconv >0 */
3057  if (iconvp > 0) {
3059  pj,
3060  i_dist,
3061  i_face_surf,
3062  i_face_normal,
3063  gradi,
3064  gradj,
3065  grdpai,
3066  grdpaj,
3067  i_massflux,
3068  &testij,
3069  &tesqck);
3070 
3071  for (isou = 0; isou < 3; isou++) {
3072  if (ischcp==1) {
3073 
3074  /* Centered
3075  --------*/
3076 
3077  cs_centered_f_val(weight,
3078  pip[isou],
3079  pjpr[isou],
3080  &pifrj[isou]);
3081  cs_centered_f_val(weight,
3082  pipr[isou],
3083  pjp[isou],
3084  &pifri[isou]);
3085  cs_centered_f_val(weight,
3086  pipr[isou],
3087  pjp[isou],
3088  &pjfri[isou]);
3089  cs_centered_f_val(weight,
3090  pip[isou],
3091  pjpr[isou],
3092  &pjfrj[isou]);
3093 
3094  } else {
3095 
3096  /* Second order
3097  ------------*/
3098 
3099  cs_solu_f_val(cell_ceni,
3100  i_face_cog,
3101  gradi[isou],
3102  pi[isou],
3103  &pifrj[isou]);
3104  cs_solu_f_val(cell_ceni,
3105  i_face_cog,
3106  gradi[isou],
3107  pir[isou],
3108  &pifri[isou]);
3109  cs_solu_f_val(cell_cenj,
3110  i_face_cog,
3111  gradj[isou],
3112  pj[isou],
3113  &pjfri[isou]);
3114  cs_solu_f_val(cell_cenj,
3115  i_face_cog,
3116  gradj[isou],
3117  pjr[isou],
3118  &pjfrj[isou]);
3119 
3120  }
3121 
3122  }
3123 
3124  /* Slope test: Pourcentage of upwind
3125  ----------------------------------*/
3126 
3127  if (tesqck <= 0. || testij <= 0.) {
3128  cs_blend_f_val_vector(blend_st,
3129  pi,
3130  pifrj);
3131  cs_blend_f_val_vector(blend_st,
3132  pir,
3133  pifri);
3134  cs_blend_f_val_vector(blend_st,
3135  pj,
3136  pjfri);
3137  cs_blend_f_val_vector(blend_st,
3138  pjr,
3139  pjfrj);
3140 
3141  *upwind_switch = true;
3142  }
3143 
3144 
3145  /* Blending
3146  --------*/
3147  cs_blend_f_val_vector(blencp,
3148  pi,
3149  pifrj);
3150  cs_blend_f_val_vector(blencp,
3151  pir,
3152  pifri);
3153  cs_blend_f_val_vector(blencp,
3154  pj,
3155  pjfri);
3156  cs_blend_f_val_vector(blencp,
3157  pjr,
3158  pjfrj);
3159 
3160  /* If iconv=0 p*fr* are useless */
3161  } else {
3162  for (isou = 0; isou < 3; isou++) {
3163  cs_upwind_f_val(pi[isou],
3164  &pifrj[isou]);
3165  cs_upwind_f_val(pir[isou],
3166  &pifri[isou]);
3167  cs_upwind_f_val(pj[isou],
3168  &pjfri[isou]);
3169  cs_upwind_f_val(pjr[isou],
3170  &pjfrj[isou]);
3171  }
3172  }
3173 
3174 }
3175 
3176 /*----------------------------------------------------------------------------*/
3218 /*----------------------------------------------------------------------------*/
3219 
3220 inline static void
3222  const int iconvp,
3223  const cs_real_t bldfrp,
3224  const int ischcp,
3225  const double relaxp,
3226  const double blencp,
3227  const double blend_st,
3228  const cs_real_t weight,
3229  const cs_real_t i_dist,
3230  const cs_real_t i_face_surf,
3231  const cs_real_3_t cell_ceni,
3232  const cs_real_3_t cell_cenj,
3233  const cs_real_3_t i_face_normal,
3234  const cs_real_3_t i_face_cog,
3235  const cs_real_3_t diipf,
3236  const cs_real_3_t djjpf,
3237  const cs_real_t i_massflux,
3238  const cs_real_63_t gradi,
3239  const cs_real_63_t gradj,
3240  const cs_real_63_t grdpai,
3241  const cs_real_63_t grdpaj,
3242  const cs_real_6_t pi,
3243  const cs_real_6_t pj,
3244  const cs_real_6_t pia,
3245  const cs_real_6_t pja,
3246  cs_real_t pifri[6],
3247  cs_real_t pifrj[6],
3248  cs_real_t pjfri[6],
3249  cs_real_t pjfrj[6],
3250  cs_real_t pip[6],
3251  cs_real_t pjp[6],
3252  cs_real_t pipr[6],
3253  cs_real_t pjpr[6])
3254 {
3255  cs_real_t pir[6], pjr[6];
3256  cs_real_t recoi[6], recoj[6];
3257  cs_real_t testij, tesqck;
3258  int isou;
3259 
3261  diipf,
3262  djjpf,
3263  gradi,
3264  gradj,
3265  pi,
3266  pj,
3267  recoi,
3268  recoj,
3269  pip,
3270  pjp);
3271 
3272  cs_i_relax_c_val_tensor(relaxp,
3273  pia,
3274  pja,
3275  recoi,
3276  recoj,
3277  pi,
3278  pj,
3279  pir,
3280  pjr,
3281  pipr,
3282  pjpr);
3283 
3284  /* Convection slope test is needed only when iconv >0 */
3285  if (iconvp > 0) {
3287  pj,
3288  i_dist,
3289  i_face_surf,
3290  i_face_normal,
3291  gradi,
3292  gradj,
3293  grdpai,
3294  grdpaj,
3295  i_massflux,
3296  &testij,
3297  &tesqck);
3298 
3299  for (isou = 0; isou < 6; isou++) {
3300  if (ischcp==1) {
3301 
3302  /* Centered
3303  --------*/
3304 
3305  cs_centered_f_val(weight,
3306  pip[isou],
3307  pjpr[isou],
3308  &pifrj[isou]);
3309  cs_centered_f_val(weight,
3310  pipr[isou],
3311  pjp[isou],
3312  &pifri[isou]);
3313  cs_centered_f_val(weight,
3314  pipr[isou],
3315  pjp[isou],
3316  &pjfri[isou]);
3317  cs_centered_f_val(weight,
3318  pip[isou],
3319  pjpr[isou],
3320  &pjfrj[isou]);
3321 
3322  } else {
3323 
3324  /* Second order
3325  ------------*/
3326 
3327  cs_solu_f_val(cell_ceni,
3328  i_face_cog,
3329  gradi[isou],
3330  pi[isou],
3331  &pifrj[isou]);
3332  cs_solu_f_val(cell_ceni,
3333  i_face_cog,
3334  gradi[isou],
3335  pir[isou],
3336  &pifri[isou]);
3337  cs_solu_f_val(cell_cenj,
3338  i_face_cog,
3339  gradj[isou],
3340  pj[isou],
3341  &pjfri[isou]);
3342  cs_solu_f_val(cell_cenj,
3343  i_face_cog,
3344  gradj[isou],
3345  pjr[isou],
3346  &pjfrj[isou]);
3347 
3348  }
3349 
3350  }
3351 
3352  /* Slope test: Pourcentage of upwind
3353  ----------------------------------*/
3354 
3355  if (tesqck <= 0. || testij <= 0.) {
3356 
3357  cs_blend_f_val_tensor(blend_st,
3358  pi,
3359  pifrj);
3360  cs_blend_f_val_tensor(blend_st,
3361  pir,
3362  pifri);
3363  cs_blend_f_val_tensor(blend_st,
3364  pj,
3365  pjfri);
3366  cs_blend_f_val_tensor(blend_st,
3367  pjr,
3368  pjfrj);
3369 
3370  *upwind_switch = true;
3371 
3372  }
3373 
3374 
3375  /* Blending
3376  --------*/
3377 
3378  cs_blend_f_val_tensor(blencp,
3379  pi,
3380  pifrj);
3381  cs_blend_f_val_tensor(blencp,
3382  pir,
3383  pifri);
3384  cs_blend_f_val_tensor(blencp,
3385  pj,
3386  pjfri);
3387  cs_blend_f_val_tensor(blencp,
3388  pjr,
3389  pjfrj);
3390 
3391  /* If iconv=0 p*fr* are useless */
3392  } else {
3393  for (isou = 0; isou < 6; isou++) {
3394  cs_upwind_f_val(pi[isou],
3395  &pifrj[isou]);
3396  cs_upwind_f_val(pir[isou],
3397  &pifri[isou]);
3398  cs_upwind_f_val(pj[isou],
3399  &pjfri[isou]);
3400  cs_upwind_f_val(pjr[isou],
3401  &pjfrj[isou]);
3402  }
3403  }
3404 
3405 }
3406 
3407 /*----------------------------------------------------------------------------*/
3444 /*----------------------------------------------------------------------------*/
3445 
3446 inline static void
3447 cs_i_cd_unsteady_slope_test(bool *upwind_switch,
3448  const int iconvp,
3449  const cs_real_t bldfrp,
3450  const int ischcp,
3451  const double blencp,
3452  const double blend_st,
3453  const cs_real_t weight,
3454  const cs_real_t i_dist,
3455  const cs_real_t i_face_surf,
3456  const cs_real_3_t cell_ceni,
3457  const cs_real_3_t cell_cenj,
3458  const cs_real_3_t i_face_normal,
3459  const cs_real_3_t i_face_cog,
3460  const cs_real_3_t diipf,
3461  const cs_real_3_t djjpf,
3462  const cs_real_t i_massflux,
3463  const cs_real_3_t gradi,
3464  const cs_real_3_t gradj,
3465  const cs_real_3_t gradupi,
3466  const cs_real_3_t gradupj,
3467  const cs_real_3_t gradsti,
3468  const cs_real_3_t gradstj,
3469  const cs_real_t pi,
3470  const cs_real_t pj,
3471  cs_real_t *pif,
3472  cs_real_t *pjf,
3473  cs_real_t *pip,
3474  cs_real_t *pjp)
3475 {
3476  CS_UNUSED(blend_st);
3477 
3478  cs_real_t recoi, recoj;
3479  cs_real_t testij, tesqck;
3480 
3481  *upwind_switch = false;
3482 
3483  cs_i_compute_quantities(bldfrp,
3484  diipf,
3485  djjpf,
3486  gradi,
3487  gradj,
3488  pi,
3489  pj,
3490  &recoi,
3491  &recoj,
3492  pip,
3493  pjp);
3494 
3495  /* Convection slope test is needed only when iconv >0 */
3496  if (iconvp > 0) {
3497  cs_slope_test(pi,
3498  pj,
3499  i_dist,
3500  i_face_surf,
3501  i_face_normal,
3502  gradi,
3503  gradj,
3504  gradsti,
3505  gradstj,
3506  i_massflux,
3507  &testij,
3508  &tesqck);
3509 
3510  if (ischcp==1) {
3511 
3512  /* Centered
3513  --------*/
3514 
3515  cs_centered_f_val(weight,
3516  *pip,
3517  *pjp,
3518  pif);
3519  cs_centered_f_val(weight,
3520  *pip,
3521  *pjp,
3522  pjf);
3523 
3524  } else if (ischcp == 0) {
3525 
3526  /* Original SOLU
3527  --------------*/
3528 
3529  cs_solu_f_val(cell_ceni,
3530  i_face_cog,
3531  gradi,
3532  pi,
3533  pif);
3534  cs_solu_f_val(cell_cenj,
3535  i_face_cog,
3536  gradj,
3537  pj,
3538  pjf);
3539 
3540  } else {
3541 
3542  /* SOLU
3543  -----*/
3544 
3545  cs_solu_f_val(cell_ceni,
3546  i_face_cog,
3547  gradupi,
3548  pi,
3549  pif);
3550  cs_solu_f_val(cell_cenj,
3551  i_face_cog,
3552  gradupj,
3553  pj,
3554  pjf);
3555 
3556  }
3557 
3558  /* Slope test: Pourcentage of upwind
3559  ----------------------------------*/
3560 
3561  if (tesqck<=0. || testij<=0.) {
3562 
3563  cs_blend_f_val(blend_st,
3564  pi,
3565  pif);
3566  cs_blend_f_val(blend_st,
3567  pj,
3568  pjf);
3569 
3570  *upwind_switch = true;
3571 
3572  }
3573 
3574  /* Blending
3575  --------*/
3576 
3577  cs_blend_f_val(blencp,
3578  pi,
3579  pif);
3580  cs_blend_f_val(blencp,
3581  pj,
3582  pjf);
3583 
3584  /* If iconv=0 p*f are useless */
3585  } else {
3586  cs_upwind_f_val(pi,
3587  pif);
3588  cs_upwind_f_val(pj,
3589  pjf);
3590  }
3591 
3592 }
3593 
3594 /*----------------------------------------------------------------------------*/
3605 /*----------------------------------------------------------------------------*/
3606 
3607 inline static void
3609  const cs_lnum_t jj,
3610  const cs_real_t i_massflux,
3611  cs_lnum_t *ic,
3612  cs_lnum_t *id)
3613 {
3614  if (i_massflux >= 0.) {
3615  *ic = ii;
3616  *id = jj;
3617  } else {
3618  *ic = jj;
3619  *id = ii;
3620  }
3621 }
3622 
3623 /*----------------------------------------------------------------------------*/
3644 /*----------------------------------------------------------------------------*/
3645 
3646 inline static void
3648  const double beta,
3649  const cs_real_3_t cell_cen_c,
3650  const cs_real_3_t cell_cen_d,
3651  const cs_real_3_t i_face_normal,
3652  const cs_real_3_t i_face_cog,
3653  const cs_real_3_t gradv_c,
3654  const cs_real_t p_c,
3655  const cs_real_t p_d,
3656  const cs_real_t local_max_c,
3657  const cs_real_t local_min_c,
3658  const cs_real_t courant_c,
3659  cs_real_t *pif,
3660  cs_real_t *pjf)
3661 {
3662  /* distance between face center and central cell center */
3663  cs_real_t dist_fc;
3664  cs_real_3_t nfc;
3665  cs_math_3_length_unitv(cell_cen_c, i_face_cog, &dist_fc, nfc);
3666 
3667  /* unit vector and distance between central and downwind cells centers */
3668  cs_real_t dist_dc;
3669  cs_real_3_t ndc;
3670  cs_math_3_length_unitv(cell_cen_c, cell_cen_d, &dist_dc, ndc);
3671 
3672  /* Place the upwind point on the line that joins
3673  the two cells on the upwind side and the same
3674  distance as that between the two cells */
3675  const cs_real_t dist_cu = dist_dc;
3676  const cs_real_t dist_du = dist_dc + dist_cu;
3677 
3678  /* Compute the property on the upwind assuming a parabolic
3679  variation of the property between the two cells */
3680  const cs_real_t gradc = cs_math_3_dot_product(gradv_c, ndc);
3681 
3682  const cs_real_t grad2c = ((p_d - p_c)/dist_dc - gradc)/dist_dc;
3683 
3684  cs_real_t p_u = p_c + (grad2c*dist_cu - gradc)*dist_cu;
3685  p_u = CS_MAX(CS_MIN(p_u, local_max_c), local_min_c);
3686 
3687  /* Compute the normalised distances */
3688  const cs_real_t nvf_r_f = (dist_fc+dist_cu)/dist_du;
3689  const cs_real_t nvf_r_c = dist_cu/dist_du;
3690 
3691  /* Check for the bounds of the NVD diagram and compute the face
3692  property according to the selected NVD scheme */
3693  const cs_real_t _small = cs_math_epzero
3694  * (CS_ABS(p_u)+CS_ABS(p_c)+CS_ABS(p_d));
3695 
3696  if (CS_ABS(p_d-p_u) <= _small) {
3697  *pif = p_c;
3698  *pjf = p_c;
3699  } else {
3700  const cs_real_t nvf_p_c = (p_c - p_u)/(p_d - p_u);
3701 
3702  if (nvf_p_c <= 0. || nvf_p_c >= 1.) {
3703  *pif = p_c;
3704  *pjf = p_c;
3705  } else {
3706  cs_real_t nvf_p_f;
3707 
3708  /* Highly compressive NVD scheme for VOF */
3709  if (limiter >= CS_NVD_VOF_HRIC) {
3710  nvf_p_f = cs_nvd_vof_scheme_scalar(limiter,
3711  i_face_normal,
3712  nvf_p_c,
3713  nvf_r_f,
3714  nvf_r_c,
3715  gradv_c,
3716  courant_c);
3717  } else { /* Regular NVD scheme */
3718  nvf_p_f = cs_nvd_scheme_scalar(limiter,
3719  nvf_p_c,
3720  nvf_r_f,
3721  nvf_r_c);
3722  }
3723 
3724  *pif = p_u + nvf_p_f*(p_d - p_u);
3725  *pif = CS_MAX(CS_MIN(*pif, local_max_c), local_min_c);
3726 
3727  cs_blend_f_val(beta,
3728  p_c,
3729  pif);
3730 
3731  *pjf = *pif;
3732  }
3733  }
3734 }
3735 
3736 /*----------------------------------------------------------------------------*/
3771 /*----------------------------------------------------------------------------*/
3772 
3773 inline static void
3775  const int iconvp,
3776  const cs_real_t bldfrp,
3777  const int ischcp,
3778  const double blencp,
3779  const double blend_st,
3780  const cs_real_t weight,
3781  const cs_real_t i_dist,
3782  const cs_real_t i_face_surf,
3783  const cs_real_3_t cell_ceni,
3784  const cs_real_3_t cell_cenj,
3785  const cs_real_3_t i_face_normal,
3786  const cs_real_3_t i_face_cog,
3787  const cs_real_3_t diipf,
3788  const cs_real_3_t djjpf,
3789  const cs_real_t i_massflux,
3790  const cs_real_33_t gradi,
3791  const cs_real_33_t gradj,
3792  const cs_real_33_t grdpai,
3793  const cs_real_33_t grdpaj,
3794  const cs_real_3_t pi,
3795  const cs_real_3_t pj,
3796  cs_real_t pif[3],
3797  cs_real_t pjf[3],
3798  cs_real_t pip[3],
3799  cs_real_t pjp[3])
3800 {
3801  cs_real_t recoi[3], recoj[3];
3802  cs_real_t testij, tesqck;
3803 
3805  diipf,
3806  djjpf,
3807  gradi,
3808  gradj,
3809  pi,
3810  pj,
3811  recoi,
3812  recoj,
3813  pip,
3814  pjp);
3815 
3816  /* Convection slope test is needed only when iconv >0 */
3817  if (iconvp > 0) {
3819  pj,
3820  i_dist,
3821  i_face_surf,
3822  i_face_normal,
3823  gradi,
3824  gradj,
3825  grdpai,
3826  grdpaj,
3827  i_massflux,
3828  &testij,
3829  &tesqck);
3830 
3831  for (int isou = 0; isou < 3; isou++) {
3832  if (ischcp == 1) {
3833 
3834  /* Centered
3835  --------*/
3836 
3837  cs_centered_f_val(weight,
3838  pip[isou],
3839  pjp[isou],
3840  &pif[isou]);
3841  cs_centered_f_val(weight,
3842  pip[isou],
3843  pjp[isou],
3844  &pjf[isou]);
3845 
3846  } else {
3847 
3848  /* Second order
3849  ------------*/
3850 
3851  cs_solu_f_val(cell_ceni,
3852  i_face_cog,
3853  gradi[isou],
3854  pi[isou],
3855  &pif[isou]);
3856  cs_solu_f_val(cell_cenj,
3857  i_face_cog,
3858  gradj[isou],
3859  pj[isou],
3860  &pjf[isou]);
3861 
3862  }
3863 
3864  }
3865 
3866  /* Slope test: Percentage of upwind
3867  ----------------------------------*/
3868 
3869  if (tesqck <= 0. || testij <= 0.) {
3870 
3871  cs_blend_f_val_vector(blend_st,
3872  pi,
3873  pif);
3874  cs_blend_f_val_vector(blend_st,
3875  pj,
3876  pjf);
3877 
3878  *upwind_switch = true;
3879 
3880  }
3881 
3882 
3883  /* Blending
3884  --------*/
3885  cs_blend_f_val_vector(blencp,
3886  pi,
3887  pif);
3888  cs_blend_f_val_vector(blencp,
3889  pj,
3890  pjf);
3891 
3892  /* If iconv=0 p*f are useless */
3893  } else {
3894 
3895  for (int isou = 0; isou < 3; isou++) {
3896  cs_upwind_f_val(pi[isou],
3897  &pif[isou]);
3898  cs_upwind_f_val(pj[isou],
3899  &pjf[isou]);
3900 
3901  }
3902  }
3903 
3904 }
3905 
3906 /*----------------------------------------------------------------------------*/
3941 /*----------------------------------------------------------------------------*/
3942 
3943 inline static void
3945  const int iconvp,
3946  const cs_real_t bldfrp,
3947  const int ischcp,
3948  const double blencp,
3949  const double blend_st,
3950  const cs_real_t weight,
3951  const cs_real_t i_dist,
3952  const cs_real_t i_face_surf,
3953  const cs_real_3_t cell_ceni,
3954  const cs_real_3_t cell_cenj,
3955  const cs_real_3_t i_face_normal,
3956  const cs_real_3_t i_face_cog,
3957  const cs_real_3_t diipf,
3958  const cs_real_3_t djjpf,
3959  const cs_real_t i_massflux,
3960  const cs_real_63_t gradi,
3961  const cs_real_63_t gradj,
3962  const cs_real_63_t grdpai,
3963  const cs_real_63_t grdpaj,
3964  const cs_real_6_t pi,
3965  const cs_real_6_t pj,
3966  cs_real_t pif[6],
3967  cs_real_t pjf[6],
3968  cs_real_t pip[6],
3969  cs_real_t pjp[6])
3970 {
3971  cs_real_t recoi[6], recoj[6];
3972  cs_real_t testij, tesqck;
3973  int isou;
3974 
3976  diipf,
3977  djjpf,
3978  gradi,
3979  gradj,
3980  pi,
3981  pj,
3982  recoi,
3983  recoj,
3984  pip,
3985  pjp);
3986 
3987  /* Convection slope test is needed only when iconv >0 */
3988  if (iconvp > 0) {
3990  pj,
3991  i_dist,
3992  i_face_surf,
3993  i_face_normal,
3994  gradi,
3995  gradj,
3996  grdpai,
3997  grdpaj,
3998  i_massflux,
3999  &testij,
4000  &tesqck);
4001 
4002  for (isou = 0; isou < 6; isou++) {
4003 
4004  if (ischcp==1) {
4005 
4006  /* Centered
4007  --------*/
4008 
4009  cs_centered_f_val(weight,
4010  pip[isou],
4011  pjp[isou],
4012  &pif[isou]);
4013  cs_centered_f_val(weight,
4014  pip[isou],
4015  pjp[isou],
4016  &pjf[isou]);
4017 
4018  } else {
4019 
4020  /* Second order
4021  ------------*/
4022 
4023  cs_solu_f_val(cell_ceni,
4024  i_face_cog,
4025  gradi[isou],
4026  pi[isou],
4027  &pif[isou]);
4028  cs_solu_f_val(cell_cenj,
4029  i_face_cog,
4030  gradj[isou],
4031  pj[isou],
4032  &pjf[isou]);
4033  }
4034 
4035  }
4036 
4037  /* Slope test activated: poucentage of upwind */
4038  if (tesqck <= 0. || testij <= 0.) {
4039 
4040  /* Upwind
4041  --------*/
4042 
4043  cs_blend_f_val_tensor(blend_st,
4044  pi,
4045  pif);
4046  cs_blend_f_val_tensor(blend_st,
4047  pj,
4048  pjf);
4049 
4050  *upwind_switch = true;
4051  }
4052 
4053 
4054  /* Blending
4055  --------*/
4056 
4057  cs_blend_f_val_tensor(blencp,
4058  pi,
4059  pif);
4060  cs_blend_f_val_tensor(blencp,
4061  pj,
4062  pjf);
4063 
4064  /* If iconv=0 p*fr* are useless */
4065  } else {
4066 
4067  for (isou = 0; isou < 6; isou++) {
4068  cs_upwind_f_val(pi[isou],
4069  &pif[isou]);
4070  cs_upwind_f_val(pj[isou],
4071  &pjf[isou]);
4072  }
4073  }
4074 }
4075 
4076 /*----------------------------------------------------------------------------*/
4085 /*----------------------------------------------------------------------------*/
4086 
4087 inline static void
4089  const cs_real_3_t gradi,
4090  const cs_real_t bldfrp,
4091  cs_real_t *recoi)
4092 {
4093  *recoi = bldfrp * ( gradi[0]*diipb[0]
4094  + gradi[1]*diipb[1]
4095  + gradi[2]*diipb[2]);
4096 }
4097 
4098 /*----------------------------------------------------------------------------*/
4107 /*----------------------------------------------------------------------------*/
4108 
4109 inline static void
4111  const cs_real_33_t gradi,
4112  const cs_real_t bldfrp,
4113  cs_real_t recoi[3])
4114 {
4115  for (int isou = 0; isou < 3; isou++) {
4116  recoi[isou] = bldfrp * ( gradi[isou][0]*diipb[0]
4117  + gradi[isou][1]*diipb[1]
4118  + gradi[isou][2]*diipb[2]);
4119  }
4120 }
4121 
4122 /*----------------------------------------------------------------------------*/
4131 /*----------------------------------------------------------------------------*/
4132 
4133 inline static void
4135  const cs_real_63_t gradi,
4136  const cs_real_t bldfrp,
4137  cs_real_t recoi[6])
4138 {
4139  for (int isou = 0; isou < 6; isou++) {
4140  recoi[isou] = bldfrp * ( gradi[isou][0]*diipb[0]
4141  + gradi[isou][1]*diipb[1]
4142  + gradi[isou][2]*diipb[2]);
4143  }
4144 }
4145 
4146 /*----------------------------------------------------------------------------*/
4157 /*----------------------------------------------------------------------------*/
4158 
4159 inline static void
4160 cs_b_relax_c_val(const double relaxp,
4161  const cs_real_t pi,
4162  const cs_real_t pia,
4163  const cs_real_t recoi,
4164  cs_real_t *pir,
4165  cs_real_t *pipr)
4166 {
4167  *pir = pi/relaxp - (1.-relaxp)/relaxp*pia;
4168  *pipr = *pir + recoi;
4169 }
4170 
4171 /*----------------------------------------------------------------------------*/
4182 /*----------------------------------------------------------------------------*/
4183 
4184 inline static void
4185 cs_b_relax_c_val_vector(const double relaxp,
4186  const cs_real_3_t pi,
4187  const cs_real_3_t pia,
4188  const cs_real_3_t recoi,
4189  cs_real_t pir[3],
4190  cs_real_t pipr[3])
4191 {
4192  for (int isou = 0; isou < 3; isou++) {
4193  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4194  pipr[isou] = pir[isou] + recoi[isou];
4195  }
4196 }
4197 
4198 /*----------------------------------------------------------------------------*/
4209 /*----------------------------------------------------------------------------*/
4210 
4211 inline static void
4212 cs_b_relax_c_val_tensor(const double relaxp,
4213  const cs_real_6_t pi,
4214  const cs_real_6_t pia,
4215  const cs_real_6_t recoi,
4216  cs_real_t pir[6],
4217  cs_real_t pipr[6])
4218 {
4219  for (int isou = 0; isou < 6; isou++) {
4220  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4221  pipr[isou] = pir[isou] + recoi[isou];
4222  }
4223 }
4224 
4225 /*----------------------------------------------------------------------------*/
4249 /*----------------------------------------------------------------------------*/
4250 
4251 inline static void
4253  cs_real_t thetap,
4254  int imasac,
4255  int inc,
4256  int bc_type,
4257  int icvfli,
4258  cs_real_t pi,
4259  cs_real_t pir,
4260  cs_real_t pipr,
4261  cs_real_t coefap,
4262  cs_real_t coefbp,
4263  cs_real_t coface,
4264  cs_real_t cofbce,
4265  cs_real_t b_massflux,
4266  cs_real_t xcpp,
4267  cs_real_t *flux)
4268 {
4269  cs_real_t flui, fluj, pfac;
4270 
4271  /* Computed convective flux */
4272 
4273  if (icvfli == 0) {
4274 
4275  /* Remove decentering for coupled faces */
4276  if (bc_type == CS_COUPLED_FD) {
4277  flui = 0.0;
4278  fluj = b_massflux;
4279  } else {
4280  flui = 0.5*(b_massflux +fabs(b_massflux));
4281  fluj = 0.5*(b_massflux -fabs(b_massflux));
4282  }
4283 
4284  pfac = inc*coefap + coefbp*pipr;
4285  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4286 
4287  /* Imposed convective flux */
4288 
4289  } else {
4290 
4291  pfac = inc*coface + cofbce*pipr;
4292  *flux += iconvp*xcpp*(-imasac*(b_massflux*pi) + thetap*(pfac));
4293 
4294  }
4295 }
4296 
4297 /*----------------------------------------------------------------------------*/
4319 /*----------------------------------------------------------------------------*/
4320 
4321 inline static void
4323  cs_real_t thetap,
4324  int imasac,
4325  int inc,
4326  int bc_type,
4327  int icvfli,
4328  const cs_real_t pi[restrict 3],
4329  const cs_real_t pir[restrict 3],
4330  const cs_real_t pipr[restrict 3],
4331  const cs_real_t coefap[restrict 3],
4332  const cs_real_t coefbp[restrict 3][3],
4333  const cs_real_t coface[restrict 3],
4334  const cs_real_t cofbce[restrict 3][3],
4335  cs_real_t b_massflux,
4336  cs_real_t flux[restrict 3])
4337 {
4338  cs_real_t flui, fluj, pfac;
4339 
4340  /* Computed convective flux */
4341 
4342  if (icvfli == 0) {
4343 
4344  /* Remove decentering for coupled faces */
4345  if (bc_type == CS_COUPLED_FD) {
4346  flui = 0.0;
4347  fluj = b_massflux;
4348  } else {
4349  flui = 0.5*(b_massflux +fabs(b_massflux));
4350  fluj = 0.5*(b_massflux -fabs(b_massflux));
4351  }
4352  for (int isou = 0; isou < 3; isou++) {
4353  pfac = inc*coefap[isou];
4354  for (int jsou = 0; jsou < 3; jsou++) {
4355  pfac += coefbp[isou][jsou]*pipr[jsou];
4356  }
4357  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4358  - imasac*b_massflux*pi[isou]);
4359  }
4360 
4361  /* Imposed convective flux */
4362 
4363  } else {
4364 
4365  for (int isou = 0; isou < 3; isou++) {
4366  pfac = inc*coface[isou];
4367  for (int jsou = 0; jsou < 3; jsou++) {
4368  pfac += cofbce[isou][jsou]*pipr[jsou];
4369  }
4370  flux[isou] += iconvp*( thetap*pfac
4371  - imasac*b_massflux*pi[isou]);
4372  }
4373 
4374  }
4375 }
4376 
4377 /*----------------------------------------------------------------------------*/
4397 /*----------------------------------------------------------------------------*/
4398 
4399 inline static void
4400 cs_b_upwind_flux(const int iconvp,
4401  const cs_real_t thetap,
4402  const int imasac,
4403  const int inc,
4404  const int bc_type,
4405  const cs_real_t pi,
4406  const cs_real_t pir,
4407  const cs_real_t pipr,
4408  const cs_real_t coefap,
4409  const cs_real_t coefbp,
4410  const cs_real_t b_massflux,
4411  const cs_real_t xcpp,
4412  cs_real_t *flux)
4413 {
4414  cs_real_t flui, fluj, pfac;
4415 
4416  /* Remove decentering for coupled faces */
4417  if (bc_type == CS_COUPLED_FD) {
4418  flui = 0.0;
4419  fluj = b_massflux;
4420  } else {
4421  flui = 0.5*(b_massflux +fabs(b_massflux));
4422  fluj = 0.5*(b_massflux -fabs(b_massflux));
4423  }
4424 
4425  pfac = inc*coefap + coefbp*pipr;
4426  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4427 }
4428 
4429 /*----------------------------------------------------------------------------*/
4449 /*----------------------------------------------------------------------------*/
4450 
4451 inline static void
4452 cs_b_upwind_flux_vector(const int iconvp,
4453  const cs_real_t thetap,
4454  const int imasac,
4455  const int inc,
4456  const int bc_type,
4457  const cs_real_3_t pi,
4458  const cs_real_3_t pir,
4459  const cs_real_3_t pipr,
4460  const cs_real_3_t coefa,
4461  const cs_real_33_t coefb,
4462  const cs_real_t b_massflux,
4463  cs_real_t flux[3])
4464 {
4465  cs_real_t flui, fluj, pfac;
4466 
4467  /* Remove decentering for coupled faces */
4468  if (bc_type == CS_COUPLED_FD) {
4469  flui = 0.0;
4470  fluj = b_massflux;
4471  } else {
4472  flui = 0.5*(b_massflux +fabs(b_massflux));
4473  fluj = 0.5*(b_massflux -fabs(b_massflux));
4474  }
4475  for (int isou = 0; isou < 3; isou++) {
4476  pfac = inc*coefa[isou];
4477  for (int jsou = 0; jsou < 3; jsou++) {
4478  pfac += coefb[isou][jsou]*pipr[jsou];
4479  }
4480  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4481  - imasac*b_massflux*pi[isou]);
4482  }
4483 }
4484 
4485 /*----------------------------------------------------------------------------*/
4505 /*----------------------------------------------------------------------------*/
4506 
4507 inline static void
4508 cs_b_upwind_flux_tensor(const int iconvp,
4509  const cs_real_t thetap,
4510  const int imasac,
4511  const int inc,
4512  const int bc_type,
4513  const cs_real_6_t pi,
4514  const cs_real_6_t pir,
4515  const cs_real_6_t pipr,
4516  const cs_real_6_t coefa,
4517  const cs_real_66_t coefb,
4518  const cs_real_t b_massflux,
4519  cs_real_t flux[6])
4520 {
4521  cs_real_t flui, fluj, pfac;
4522 
4523  /* Remove decentering for coupled faces */
4524  if (bc_type == CS_COUPLED_FD) {
4525  flui = 0.0;
4526  fluj = b_massflux;
4527  } else {
4528  flui = 0.5*(b_massflux +fabs(b_massflux));
4529  fluj = 0.5*(b_massflux -fabs(b_massflux));
4530  }
4531  for (int isou = 0; isou < 6; isou++) {
4532  pfac = inc*coefa[isou];
4533  for (int jsou = 0; jsou < 6; jsou++) {
4534  pfac += coefb[isou][jsou]*pipr[jsou];
4535  }
4536  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4537  - imasac*b_massflux*pi[isou]);
4538  }
4539 }
4540 
4541 /*----------------------------------------------------------------------------*/
4554 /*----------------------------------------------------------------------------*/
4555 
4556 inline static void
4557 cs_b_diff_flux(const int idiffp,
4558  const cs_real_t thetap,
4559  const int inc,
4560  const cs_real_t pipr,
4561  const cs_real_t cofafp,
4562  const cs_real_t cofbfp,
4563  const cs_real_t b_visc,
4564  cs_real_t *flux)
4565 {
4566  cs_real_t pfacd = inc*cofafp + cofbfp*pipr;
4567  *flux += idiffp*thetap*b_visc*pfacd;
4568 }
4569 
4570 /*----------------------------------------------------------------------------*/
4583 /*----------------------------------------------------------------------------*/
4584 
4585 inline static void
4586 cs_b_diff_flux_vector(const int idiffp,
4587  const cs_real_t thetap,
4588  const int inc,
4589  const cs_real_3_t pipr,
4590  const cs_real_3_t cofaf,
4591  const cs_real_33_t cofbf,
4592  const cs_real_t b_visc,
4593  cs_real_t flux[3])
4594 {
4595  cs_real_t pfacd ;
4596  for (int isou = 0; isou < 3; isou++) {
4597  pfacd = inc*cofaf[isou];
4598  for (int jsou = 0; jsou < 3; jsou++) {
4599  pfacd += cofbf[isou][jsou]*pipr[jsou];
4600  }
4601  flux[isou] += idiffp*thetap*b_visc*pfacd;
4602  }
4603 }
4604 
4605 /*----------------------------------------------------------------------------*/
4618 /*----------------------------------------------------------------------------*/
4619 
4620 inline static void
4621 cs_b_diff_flux_tensor(const int idiffp,
4622  const cs_real_t thetap,
4623  const int inc,
4624  const cs_real_6_t pipr,
4625  const cs_real_6_t cofaf,
4626  const cs_real_66_t cofbf,
4627  const cs_real_t b_visc,
4628  cs_real_t flux[6])
4629 {
4630  cs_real_t pfacd ;
4631  for (int isou = 0; isou < 6; isou++) {
4632  pfacd = inc*cofaf[isou];
4633  for (int jsou = 0; jsou < 6; jsou++) {
4634  pfacd += cofbf[isou][jsou]*pipr[jsou];
4635  }
4636  flux[isou] += idiffp*thetap*b_visc*pfacd;
4637  }
4638 }
4639 
4640 /*----------------------------------------------------------------------------*/
4654 /*----------------------------------------------------------------------------*/
4655 
4656 inline static void
4658  const double relaxp,
4659  const cs_real_3_t diipb,
4660  const cs_real_3_t gradi,
4661  const cs_real_t pi,
4662  const cs_real_t pia,
4663  cs_real_t *pir,
4664  cs_real_t *pipr)
4665 {
4666  cs_real_t recoi;
4667 
4669  gradi,
4670  bldfrp,
4671  &recoi);
4672 
4673  cs_b_relax_c_val(relaxp,
4674  pi,
4675  pia,
4676  recoi,
4677  pir,
4678  pipr);
4679 }
4680 
4681 /*----------------------------------------------------------------------------*/
4695 /*----------------------------------------------------------------------------*/
4696 
4697 inline static void
4699  const double relaxp,
4700  const cs_real_3_t diipb,
4701  const cs_real_33_t gradi,
4702  const cs_real_3_t pi,
4703  const cs_real_3_t pia,
4704  cs_real_t pir[3],
4705  cs_real_t pipr[3])
4706 {
4707  cs_real_3_t recoi;
4708 
4710  gradi,
4711  bldfrp,
4712  recoi);
4713 
4714  cs_b_relax_c_val_vector(relaxp,
4715  pi,
4716  pia,
4717  recoi,
4718  pir,
4719  pipr);
4720 }
4721 
4722 /*----------------------------------------------------------------------------*/
4736 /*----------------------------------------------------------------------------*/
4737 
4738 inline static void
4740  const double relaxp,
4741  const cs_real_3_t diipb,
4742  const cs_real_63_t gradi,
4743  const cs_real_6_t pi,
4744  const cs_real_6_t pia,
4745  cs_real_t pir[6],
4746  cs_real_t pipr[6])
4747 {
4748  cs_real_6_t recoi;
4749 
4751  gradi,
4752  bldfrp,
4753  recoi);
4754 
4755  cs_b_relax_c_val_tensor(relaxp,
4756  pi,
4757  pia,
4758  recoi,
4759  pir,
4760  pipr);
4761 }
4762 
4763 /*----------------------------------------------------------------------------*/
4774 /*----------------------------------------------------------------------------*/
4775 
4776 inline static void
4778  const cs_real_3_t diipb,
4779  const cs_real_3_t gradi,
4780  const cs_real_t pi,
4781  cs_real_t *pip)
4782 {
4783  cs_real_t recoi;
4784 
4786  gradi,
4787  bldfrp,
4788  &recoi);
4789 
4790  *pip = pi + recoi;
4791 }
4792 
4793 /*----------------------------------------------------------------------------*/
4804 /*----------------------------------------------------------------------------*/
4805 
4806 inline static void
4808  const cs_real_3_t diipb,
4809  const cs_real_33_t gradi,
4810  const cs_real_3_t pi,
4811  cs_real_t pip[3])
4812 {
4813  cs_real_3_t recoi;
4814 
4816  gradi,
4817  bldfrp,
4818  recoi);
4819 
4820  for (int isou = 0; isou < 3; isou++)
4821  pip[isou] = pi[isou] + recoi[isou];
4822 }
4823 
4824 /*----------------------------------------------------------------------------*/
4835 /*----------------------------------------------------------------------------*/
4836 
4837 inline static void
4839  const cs_real_3_t diipb,
4840  const cs_real_63_t gradi,
4841  const cs_real_6_t pi,
4842  cs_real_t pip[6])
4843 {
4844  cs_real_6_t recoi;
4845 
4847  gradi,
4848  bldfrp,
4849  recoi);
4850 
4851  for(int isou = 0; isou< 6; isou++)
4852  pip[isou] = pi[isou] + recoi[isou];
4853 }
4854 
4855 /*----------------------------------------------------------------------------*/
4866 /*----------------------------------------------------------------------------*/
4867 
4868 inline static void
4870  cs_real_t pi,
4871  cs_real_t pj,
4872  cs_real_t b_visc,
4873  cs_real_t *fluxi)
4874 {
4875  *fluxi += idiffp*b_visc*(pi - pj);
4876 }
4877 
4878 /*----------------------------------------------------------------------------*/
4889 /*----------------------------------------------------------------------------*/
4890 
4891 inline static void
4893  const cs_real_t pi[3],
4894  const cs_real_t pj[3],
4895  cs_real_t b_visc,
4896  cs_real_t fluxi[3])
4897 {
4898  for (int k = 0; k < 3; k++)
4899  fluxi[k] += idiffp*b_visc*(pi[k] - pj[k]);
4900 }
4901 
4902 
4903 /*============================================================================
4904  * Public function prototypes for Fortran API
4905  *============================================================================*/
4906 
4907 /*----------------------------------------------------------------------------
4908  * Wrapper to cs_face_diffusion_potential
4909  *----------------------------------------------------------------------------*/
4910 
4911 void CS_PROCF (itrmas, ITRMAS)
4912 (
4913  const int *const f_id,
4914  const int *const init,
4915  const int *const inc,
4916  const int *const imrgra,
4917  const int *const nswrgp,
4918  const int *const imligp,
4919  const int *const iphydp,
4920  const int *const iwgrp,
4921  const int *const iwarnp,
4922  const cs_real_t *const epsrgp,
4923  const cs_real_t *const climgp,
4924  const cs_real_t *const extrap,
4925  cs_real_3_t frcxt[],
4926  cs_real_t pvar[],
4927  const cs_real_t coefap[],
4928  const cs_real_t coefbp[],
4929  const cs_real_t cofafp[],
4930  const cs_real_t cofbfp[],
4931  const cs_real_t i_visc[],
4932  const cs_real_t b_visc[],
4933  cs_real_t visel[],
4934  cs_real_t i_massflux[],
4935  cs_real_t b_massflux[]
4936 );
4937 
4938 /*----------------------------------------------------------------------------
4939  * Wrapper to cs_face_anisotropic_diffusion_potential
4940  *----------------------------------------------------------------------------*/
4941 
4942 void CS_PROCF (itrmav, ITRMAV)
4943 (
4944  const int *const f_id,
4945  const int *const init,
4946  const int *const inc,
4947  const int *const imrgra,
4948  const int *const nswrgp,
4949  const int *const imligp,
4950  const int *const ircflp,
4951  const int *const iphydp,
4952  const int *const iwgrp,
4953  const int *const iwarnp,
4954  const cs_real_t *const epsrgp,
4955  const cs_real_t *const climgp,
4956  const cs_real_t *const extrap,
4957  cs_real_3_t frcxt[],
4958  cs_real_t pvar[],
4959  const cs_real_t coefap[],
4960  const cs_real_t coefbp[],
4961  const cs_real_t cofafp[],
4962  const cs_real_t cofbfp[],
4963  const cs_real_t i_visc[],
4964  const cs_real_t b_visc[],
4965  cs_real_6_t viscel[],
4966  const cs_real_2_t weighf[],
4967  const cs_real_t weighb[],
4968  cs_real_t i_massflux[],
4969  cs_real_t b_massflux[]
4970 );
4971 
4972 /*----------------------------------------------------------------------------
4973  * Wrapper to cs_diffusion_potential
4974  *----------------------------------------------------------------------------*/
4975 
4976 void CS_PROCF (itrgrp, ITRGRP)
4977 (
4978  const int *const f_id,
4979  const int *const init,
4980  const int *const inc,
4981  const int *const imrgra,
4982  const int *const nswrgp,
4983  const int *const imligp,
4984  const int *const iphydp,
4985  const int *const iwgrp,
4986  const int *const iwarnp,
4987  const cs_real_t *const epsrgp,
4988  const cs_real_t *const climgp,
4989  const cs_real_t *const extrap,
4990  cs_real_3_t frcxt[],
4991  cs_real_t pvar[],
4992  const cs_real_t coefap[],
4993  const cs_real_t coefbp[],
4994  const cs_real_t cofafp[],
4995  const cs_real_t cofbfp[],
4996  const cs_real_t i_visc[],
4997  const cs_real_t b_visc[],
4998  cs_real_t visel[],
4999  cs_real_t diverg[]
5000 );
5001 
5002 /*----------------------------------------------------------------------------
5003  * Wrapper to cs_anisotropic_diffusion_potential
5004  *----------------------------------------------------------------------------*/
5005 
5006 void CS_PROCF (itrgrv, ITRGRV)
5007 (
5008  const int *const f_id,
5009  const int *const init,
5010  const int *const inc,
5011  const int *const imrgra,
5012  const int *const nswrgp,
5013  const int *const imligp,
5014  const int *const ircflp,
5015  const int *const iphydp,
5016  const int *const iwgrp,
5017  const int *const iwarnp,
5018  const cs_real_t *const epsrgp,
5019  const cs_real_t *const climgp,
5020  const cs_real_t *const extrap,
5021  cs_real_3_t frcxt[],
5022  cs_real_t pvar[],
5023  const cs_real_t coefap[],
5024  const cs_real_t coefbp[],
5025  const cs_real_t cofafp[],
5026  const cs_real_t cofbfp[],
5027  const cs_real_t i_visc[],
5028  const cs_real_t b_visc[],
5029  cs_real_6_t viscel[],
5030  const cs_real_2_t weighf[],
5031  const cs_real_t weighb[],
5032  cs_real_t diverg[]
5033 );
5034 
5035 /*=============================================================================
5036  * Public function prototypes
5037  *============================================================================*/
5038 
5039 /*----------------------------------------------------------------------------
5040  * Compute the local cell Courant number as the maximum of all cell face based
5041  * Courant number at each cell.
5042  *
5043  * parameters:
5044  * f_id <-- field id (or -1)
5045  * courant --> cell Courant number
5046  */
5047 /*----------------------------------------------------------------------------*/
5048 
5049 void
5050 cs_cell_courant_number(const int f_id,
5051  cs_real_t *courant);
5052 
5053 /*----------------------------------------------------------------------------
5054  * Return pointer to slope test indicator field values if active.
5055  *
5056  * parameters:
5057  * f_id <-- field id (or -1)
5058  * var_cal_opt <-- variable calculation options
5059  *
5060  * return:
5061  * pointer to local values array, or NULL;
5062  *----------------------------------------------------------------------------*/
5063 
5064 cs_real_t *
5065 cs_get_v_slope_test(int f_id,
5067 
5068 /*----------------------------------------------------------------------------*/
5087 /*----------------------------------------------------------------------------*/
5088 
5089 void
5090 cs_slope_test_gradient(int f_id,
5091  int inc,
5092  cs_halo_type_t halo_type,
5093  const cs_real_3_t *grad,
5094  cs_real_3_t *grdpa,
5095  const cs_real_t *pvar,
5096  const cs_real_t *coefap,
5097  const cs_real_t *coefbp,
5098  const cs_real_t *i_massflux);
5099 
5100 /*----------------------------------------------------------------------------*/
5116 /*----------------------------------------------------------------------------*/
5117 
5118 void
5119 cs_upwind_gradient(const int f_id,
5120  const int inc,
5121  const cs_halo_type_t halo_type,
5122  const cs_real_t coefap[],
5123  const cs_real_t coefbp[],
5124  const cs_real_t i_massflux[],
5125  const cs_real_t b_massflux[],
5126  const cs_real_t *restrict pvar,
5127  cs_real_3_t *restrict grdpa);
5128 
5129 /*----------------------------------------------------------------------------*/
5147 /*----------------------------------------------------------------------------*/
5148 
5149 void
5150 cs_slope_test_gradient_vector(const int inc,
5151  const cs_halo_type_t halo_type,
5152  const cs_real_33_t *grad,
5153  cs_real_33_t *grdpa,
5154  const cs_real_3_t *pvar,
5155  const cs_real_3_t *coefa,
5156  const cs_real_33_t *coefb,
5157  const cs_real_t *i_massflux);
5158 
5159 /*----------------------------------------------------------------------------*/
5177 /*----------------------------------------------------------------------------*/
5178 
5179 void
5180 cs_slope_test_gradient_tensor(const int inc,
5181  const cs_halo_type_t halo_type,
5182  const cs_real_63_t *grad,
5183  cs_real_63_t *grdpa,
5184  const cs_real_6_t *pvar,
5185  const cs_real_6_t *coefa,
5186  const cs_real_66_t *coefb,
5187  const cs_real_t *i_massflux);
5188 
5189 /*----------------------------------------------------------------------------*/
5198 /*----------------------------------------------------------------------------*/
5199 
5200 void
5201 cs_beta_limiter_building(int f_id,
5202  int inc,
5203  const cs_real_t rovsdt[]);
5204 
5205 /*----------------------------------------------------------------------------*/
5257 /*----------------------------------------------------------------------------*/
5258 
5259 void
5261  int f_id,
5262  const cs_var_cal_opt_t var_cal_opt,
5263  int icvflb,
5264  int inc,
5265  int imasac,
5266  cs_real_t *restrict pvar,
5267  const cs_real_t *restrict pvara,
5268  const int icvfli[],
5269  const cs_real_t coefap[],
5270  const cs_real_t coefbp[],
5271  const cs_real_t cofafp[],
5272  const cs_real_t cofbfp[],
5273  const cs_real_t i_massflux[],
5274  const cs_real_t b_massflux[],
5275  const cs_real_t i_visc[],
5276  const cs_real_t b_visc[],
5277  cs_real_t *restrict rhs);
5278 
5279 /*----------------------------------------------------------------------------*/
5314 /*----------------------------------------------------------------------------*/
5315 
5316 void
5318  int f_id,
5319  const cs_var_cal_opt_t var_cal_opt,
5320  int icvflb,
5321  int inc,
5322  int imasac,
5323  cs_real_t *restrict pvar,
5324  const cs_real_t *restrict pvara,
5325  const int icvfli[],
5326  const cs_real_t coefap[],
5327  const cs_real_t coefbp[],
5328  const cs_real_t i_massflux[],
5329  const cs_real_t b_massflux[],
5330  cs_real_2_t i_conv_flux[],
5331  cs_real_t b_conv_flux[]);
5332 
5333 /*----------------------------------------------------------------------------*/
5393 /*----------------------------------------------------------------------------*/
5394 
5395 void
5397  int f_id,
5398  const cs_var_cal_opt_t var_cal_opt,
5399  int icvflb,
5400  int inc,
5401  int ivisep,
5402  int imasac,
5403  cs_real_3_t *restrict pvar,
5404  const cs_real_3_t *restrict pvara,
5405  const int icvfli[],
5406  const cs_real_3_t coefav[],
5407  const cs_real_33_t coefbv[],
5408  const cs_real_3_t cofafv[],
5409  const cs_real_33_t cofbfv[],
5410  const cs_real_t i_massflux[],
5411  const cs_real_t b_massflux[],
5412  const cs_real_t i_visc[],
5413  const cs_real_t b_visc[],
5414  const cs_real_t i_secvis[],
5415  const cs_real_t b_secvis[],
5416  cs_real_3_t *restrict rhs);
5417 
5418 /*----------------------------------------------------------------------------*/
5463 /*----------------------------------------------------------------------------*/
5464 
5465 void
5467  int f_id,
5468  const cs_var_cal_opt_t var_cal_opt,
5469  int icvflb,
5470  int inc,
5471  int imasac,
5472  cs_real_6_t *restrict pvar,
5473  const cs_real_6_t *restrict pvara,
5474  const cs_real_6_t coefa[],
5475  const cs_real_66_t coefb[],
5476  const cs_real_6_t cofaf[],
5477  const cs_real_66_t cofbf[],
5478  const cs_real_t i_massflux[],
5479  const cs_real_t b_massflux[],
5480  const cs_real_t i_visc[],
5481  const cs_real_t b_visc[],
5482  cs_real_6_t *restrict rhs);
5483 
5484 /*----------------------------------------------------------------------------*/
5526 /*----------------------------------------------------------------------------*/
5527 
5528 void
5530  int f_id,
5531  const cs_var_cal_opt_t var_cal_opt,
5532  int inc,
5533  int imasac,
5534  cs_real_t *restrict pvar,
5535  const cs_real_t *restrict pvara,
5536  const cs_real_t coefap[],
5537  const cs_real_t coefbp[],
5538  const cs_real_t cofafp[],
5539  const cs_real_t cofbfp[],
5540  const cs_real_t i_massflux[],
5541  const cs_real_t b_massflux[],
5542  const cs_real_t i_visc[],
5543  const cs_real_t b_visc[],
5544  const cs_real_t xcpp[],
5545  cs_real_t *restrict rhs);
5546 
5547 /*----------------------------------------------------------------------------*/
5591 /*----------------------------------------------------------------------------*/
5592 
5593 void
5595  int f_id,
5596  const cs_var_cal_opt_t var_cal_opt,
5597  int inc,
5598  cs_real_t *restrict pvar,
5599  const cs_real_t *restrict pvara,
5600  const cs_real_t coefap[],
5601  const cs_real_t coefbp[],
5602  const cs_real_t cofafp[],
5603  const cs_real_t cofbfp[],
5604  const cs_real_t i_visc[],
5605  const cs_real_t b_visc[],
5606  cs_real_6_t *restrict viscel,
5607  const cs_real_2_t weighf[],
5608  const cs_real_t weighb[],
5609  cs_real_t *restrict rhs);
5610 
5611 /*-----------------------------------------------------------------------------*/
5661 /*----------------------------------------------------------------------------*/
5662 
5663 void
5665  int f_id,
5666  const cs_var_cal_opt_t var_cal_opt,
5667  int inc,
5668  int ivisep,
5669  cs_real_3_t *restrict pvar,
5670  const cs_real_3_t *restrict pvara,
5671  const cs_real_3_t coefav[],
5672  const cs_real_33_t coefbv[],
5673  const cs_real_3_t cofafv[],
5674  const cs_real_33_t cofbfv[],
5675  const cs_real_33_t i_visc[],
5676  const cs_real_t b_visc[],
5677  const cs_real_t i_secvis[],
5678  cs_real_3_t *restrict rhs);
5679 
5680 /*-----------------------------------------------------------------------------*/
5725 /*----------------------------------------------------------------------------*/
5726 
5727 void
5729  int f_id,
5730  const cs_var_cal_opt_t var_cal_opt,
5731  int inc,
5732  cs_real_3_t *restrict pvar,
5733  const cs_real_3_t *restrict pvara,
5734  const cs_real_3_t coefav[],
5735  const cs_real_33_t coefbv[],
5736  const cs_real_3_t cofafv[],
5737  const cs_real_33_t cofbfv[],
5738  const cs_real_t i_visc[],
5739  const cs_real_t b_visc[],
5740  cs_real_6_t *restrict viscel,
5741  const cs_real_2_t weighf[],
5742  const cs_real_t weighb[],
5743  cs_real_3_t *restrict rhs);
5744 
5745 /*----------------------------------------------------------------------------*/
5789 /*----------------------------------------------------------------------------*/
5790 
5791 void
5793  int f_id,
5794  const cs_var_cal_opt_t var_cal_opt,
5795  int inc,
5796  cs_real_6_t *restrict pvar,
5797  const cs_real_6_t *restrict pvara,
5798  const cs_real_6_t coefa[],
5799  const cs_real_66_t coefb[],
5800  const cs_real_6_t cofaf[],
5801  const cs_real_66_t cofbf[],
5802  const cs_real_t i_visc[],
5803  const cs_real_t b_visc[],
5804  cs_real_6_t *restrict viscel,
5805  const cs_real_2_t weighf[],
5806  const cs_real_t weighb[],
5807  cs_real_6_t *restrict rhs);
5808 
5809 /*----------------------------------------------------------------------------*/
5868 /*----------------------------------------------------------------------------*/
5869 
5870 void
5871 cs_face_diffusion_potential(const int f_id,
5872  const cs_mesh_t *m,
5873  cs_mesh_quantities_t *fvq,
5874  int init,
5875  int inc,
5876  int imrgra,
5877  int nswrgp,
5878  int imligp,
5879  int iphydp,
5880  int iwgrp,
5881  int iwarnp,
5882  double epsrgp,
5883  double climgp,
5884  cs_real_3_t *restrict frcxt,
5885  cs_real_t *restrict pvar,
5886  const cs_real_t coefap[],
5887  const cs_real_t coefbp[],
5888  const cs_real_t cofafp[],
5889  const cs_real_t cofbfp[],
5890  const cs_real_t i_visc[],
5891  const cs_real_t b_visc[],
5892  cs_real_t *restrict visel,
5893  cs_real_t *restrict i_massflux,
5894  cs_real_t *restrict b_massflux);
5895 
5896 /*----------------------------------------------------------------------------*/
5962 /*----------------------------------------------------------------------------*/
5963 
5964 void
5966  const cs_mesh_t *m,
5967  cs_mesh_quantities_t *fvq,
5968  int init,
5969  int inc,
5970  int imrgra,
5971  int nswrgp,
5972  int imligp,
5973  int ircflp,
5974  int iphydp,
5975  int iwgrp,
5976  int iwarnp,
5977  double epsrgp,
5978  double climgp,
5979  cs_real_3_t *restrict frcxt,
5980  cs_real_t *restrict pvar,
5981  const cs_real_t coefap[],
5982  const cs_real_t coefbp[],
5983  const cs_real_t cofafp[],
5984  const cs_real_t cofbfp[],
5985  const cs_real_t i_visc[],
5986  const cs_real_t b_visc[],
5987  cs_real_6_t *restrict viscel,
5988  const cs_real_2_t weighf[],
5989  const cs_real_t weighb[],
5990  cs_real_t *restrict i_massflux,
5991  cs_real_t *restrict b_massflux);
5992 
5993 /*----------------------------------------------------------------------------*/
6047 /*----------------------------------------------------------------------------*/
6048 
6049 void
6050 cs_diffusion_potential(const int f_id,
6051  const cs_mesh_t *m,
6052  cs_mesh_quantities_t *fvq,
6053  int init,
6054  int inc,
6055  int imrgra,
6056  int nswrgp,
6057  int imligp,
6058  int iphydp,
6059  int iwgrp,
6060  int iwarnp,
6061  double epsrgp,
6062  double climgp,
6063  cs_real_3_t *restrict frcxt,
6064  cs_real_t *restrict pvar,
6065  const cs_real_t coefap[],
6066  const cs_real_t coefbp[],
6067  const cs_real_t cofafp[],
6068  const cs_real_t cofbfp[],
6069  const cs_real_t i_visc[],
6070  const cs_real_t b_visc[],
6071  cs_real_t visel[],
6072  cs_real_t *restrict diverg);
6073 
6074 /*----------------------------------------------------------------------------*/
6141 /*----------------------------------------------------------------------------*/
6142 
6143 void
6144 cs_anisotropic_diffusion_potential(const int f_id,
6145  const cs_mesh_t *m,
6146  cs_mesh_quantities_t *fvq,
6147  int init,
6148  int inc,
6149  int imrgra,
6150  int nswrgp,
6151  int imligp,
6152  int ircflp,
6153  int iphydp,
6154  int iwgrp,
6155  int iwarnp,
6156  double epsrgp,
6157  double climgp,
6158  cs_real_3_t *restrict frcxt,
6159  cs_real_t *restrict pvar,
6160  const cs_real_t coefap[],
6161  const cs_real_t coefbp[],
6162  const cs_real_t cofafp[],
6163  const cs_real_t cofbfp[],
6164  const cs_real_t i_visc[],
6165  const cs_real_t b_visc[],
6166  cs_real_6_t *restrict viscel,
6167  const cs_real_2_t weighf[],
6168  const cs_real_t weighb[],
6169  cs_real_t *restrict diverg);
6170 
6171 /*----------------------------------------------------------------------------*/
6172 
6174 
6175 #endif /* __CS_CONVECTION_DIFFUSION_H__ */
Definition: cs_field_pointer.h:70
void itrmas(const int *const f_id, const int *const init, const int *const inc, const int *const imrgra, const int *const nswrgp, const int *const imligp, const int *const iphydp, const int *const iwgrp, const int *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t i_massflux[], cs_real_t b_massflux[])
Definition: cs_convection_diffusion.c:611
static void cs_i_cd_unsteady_tensor(const cs_real_t bldfrp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:2614
static void cs_sync_scalar_halo(const cs_mesh_t *m, cs_real_t pvar[])
Definition: cs_convection_diffusion.h:95
static void cs_upwind_f_val_vector(const cs_real_3_t p, cs_real_t pf[3])
Prepare value at face ij by using an upwind scheme.
Definition: cs_convection_diffusion.h:913
void cs_convection_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int ivisep, int imasac, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const int icvfli[], const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], const cs_real_t b_secvis[], cs_real_3_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a vector field ...
Definition: cs_convection_diffusion.c:4248
double precision, dimension(:,:), pointer diipb
Definition: mesh.f90:212
#define restrict
Definition: cs_defs.h:142
static cs_real_t cs_math_3_dot_product(const cs_real_t u[3], const cs_real_t v[3])
Compute the dot product of two vectors of 3 real values.
Definition: cs_math.h:332
static void cs_b_diff_flux_tensor(const int idiffp, const cs_real_t thetap, const int inc, const cs_real_6_t pipr, const cs_real_6_t cofaf, const cs_real_66_t cofbf, const cs_real_t b_visc, cs_real_t flux[6])
Add diffusive flux to flux at boundary face.
Definition: cs_convection_diffusion.h:4621
static void cs_i_cd_steady_upwind_vector(const cs_real_t bldfrp, const cs_real_t relaxp, const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[3][3], const cs_real_t gradj[3][3], const cs_real_t pi[3], const cs_real_t pj[3], const cs_real_t pia[3], const cs_real_t pja[3], cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1499
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:334
static void cs_i_cd_unsteady_upwind_vector(const cs_real_t bldfrp, const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[3][3], const cs_real_t gradj[3][3], const cs_real_t pi[3], const cs_real_t pj[3], cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:1708
static void cs_b_compute_quantities_tensor(const cs_real_3_t diipb, const cs_real_63_t gradi, const cs_real_t bldfrp, cs_real_t recoi[6])
Reconstruct values in I&#39; at boundary cell i.
Definition: cs_convection_diffusion.h:4134
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:337
void cs_anisotropic_diffusion_tensor(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, cs_real_6_t *restrict pvar, const cs_real_6_t *restrict pvara, const cs_real_6_t coefa[], const cs_real_66_t coefb[], const cs_real_6_t cofaf[], const cs_real_66_t cofbf[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_6_t *restrict rhs)
Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equa...
Definition: cs_convection_diffusion.c:10197
static void cs_central_downwind_cells(const cs_lnum_t ii, const cs_lnum_t jj, const cs_real_t i_massflux, cs_lnum_t *ic, cs_lnum_t *id)
Determine the upwind and downwind sides of an internal face and matching cell indices.
Definition: cs_convection_diffusion.h:3608
static void cs_centered_f_val_tensor(const double pnd, const cs_real_6_t pip, const cs_real_6_t pjp, cs_real_t pf[6])
Prepare value at face ij by using a centered scheme.
Definition: cs_convection_diffusion.h:990
static void cs_slope_test_tensor(const cs_real_t pi[6], const cs_real_t pj[6], const cs_real_t distf, const cs_real_t srfan, const cs_real_t i_face_normal[3], const cs_real_t gradi[6][3], const cs_real_t gradj[6][3], const cs_real_t gradsti[6][3], const cs_real_t gradstj[6][3], const cs_real_t i_massflux, cs_real_t *testij, cs_real_t *tesqck)
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:572
cs_nvd_type_t
Definition: cs_convection_diffusion.h:59
void cs_cell_courant_number(const int f_id, cs_real_t *courant)
Definition: cs_convection_diffusion.c:877
static void cs_i_relax_c_val_tensor(const cs_real_t relaxp, const cs_real_t pia[6], const cs_real_t pja[6], const cs_real_t recoi[6], const cs_real_t recoj[6], const cs_real_t pi[6], const cs_real_t pj[6], cs_real_t pir[6], cs_real_t pjr[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Compute relaxed values at cell i and j.
Definition: cs_convection_diffusion.h:866
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:186
static void cs_i_compute_quantities_vector(const cs_real_t bldfrp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t recoi[3], cs_real_t recoj[3], cs_real_t pip[3], cs_real_t pjp[3])
Reconstruct values in I&#39; and J&#39;.
Definition: cs_convection_diffusion.h:684
#define CS_ABS(a)
Definition: cs_defs.h:474
static void cs_upwind_f_val_tensor(const cs_real_6_t p, cs_real_t pf[6])
Prepare value at face ij by using an upwind scheme.
Definition: cs_convection_diffusion.h:930
static void cs_b_cd_unsteady(const cs_real_t bldfrp, const cs_real_3_t diipb, const cs_real_3_t gradi, const cs_real_t pi, cs_real_t *pip)
Handle preparation of boundary face values for the flux computation in case of an unsteady algorithm...
Definition: cs_convection_diffusion.h:4777
static void cs_i_conv_flux_vector(const int iconvp, const cs_real_t thetap, const int imasac, const cs_real_t pi[3], const cs_real_t pj[3], const cs_real_t pifri[3], const cs_real_t pifrj[3], const cs_real_t pjfri[3], const cs_real_t pjfrj[3], const cs_real_t i_massflux, cs_real_t fluxi[3], cs_real_t fluxj[3])
Add convective fluxes (substracting the mass accumulation from them) to fluxes at face ij...
Definition: cs_convection_diffusion.h:1220
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:345
static void cs_b_compute_quantities(const cs_real_3_t diipb, const cs_real_3_t gradi, const cs_real_t bldfrp, cs_real_t *recoi)
Reconstruct values in I&#39; at boundary cell i.
Definition: cs_convection_diffusion.h:4088
void cs_face_convection_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const int icvfli[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], cs_real_2_t i_conv_flux[], cs_real_t b_conv_flux[])
Update face flux with convection contribution of a standard transport equation of a scalar field ...
Definition: cs_convection_diffusion.c:3148
static void cs_b_cd_steady(const cs_real_t bldfrp, const double relaxp, const cs_real_3_t diipb, const cs_real_3_t gradi, const cs_real_t pi, const cs_real_t pia, cs_real_t *pir, cs_real_t *pipr)
Handle preparation of boundary face values for the flux computation in case of a steady algorithm...
Definition: cs_convection_diffusion.h:4657
Definition: cs_convection_diffusion.h:68
static void cs_b_cd_unsteady_tensor(const cs_real_t bldfrp, const cs_real_3_t diipb, const cs_real_63_t gradi, const cs_real_6_t pi, cs_real_t pip[6])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm...
Definition: cs_convection_diffusion.h:4838
void cs_slope_test_gradient_tensor(const int inc, const cs_halo_type_t halo_type, const cs_real_63_t *grad, cs_real_63_t *grdpa, const cs_real_6_t *pvar, const cs_real_6_t *coefa, const cs_real_66_t *coefb, const cs_real_t *i_massflux)
Compute the upwind gradient used in the slope tests.
Definition: cs_convection_diffusion.c:1442
static cs_real_t cs_nvd_scheme_scalar(const cs_nvd_type_t limiter, const cs_real_t nvf_p_c, const cs_real_t nvf_r_f, const cs_real_t nvf_r_c)
Compute the normalized face scalar using the specified NVD scheme.
Definition: cs_convection_diffusion.h:116
double precision pi
value with 16 digits
Definition: cstnum.f90:48
#define BEGIN_C_DECLS
Definition: cs_defs.h:512
const cs_real_t cs_math_epzero
static void cs_b_imposed_conv_flux_vector(int iconvp, cs_real_t thetap, int imasac, int inc, int bc_type, int icvfli, const cs_real_t pi[restrict 3], const cs_real_t pir[restrict 3], const cs_real_t pipr[restrict 3], const cs_real_t coefap[restrict 3], const cs_real_t coefbp[restrict 3][3], const cs_real_t coface[restrict 3], const cs_real_t cofbce[restrict 3][3], cs_real_t b_massflux, cs_real_t flux[restrict 3])
Add convective flux (substracting the mass accumulation from it) to flux at boundary face...
Definition: cs_convection_diffusion.h:4322
static void cs_i_diff_flux(const int idiffp, const cs_real_t thetap, const cs_real_t pip, const cs_real_t pjp, const cs_real_t pipr, const cs_real_t pjpr, const cs_real_t i_visc, cs_real_t fluxij[2])
Add diffusive fluxes to fluxes at face ij.
Definition: cs_convection_diffusion.h:1310
static void cs_i_cd_unsteady_slope_test_vector(bool *upwind_switch, const int iconvp, const cs_real_t bldfrp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:3774
#define CS_UNUSED(x)
Definition: cs_defs.h:498
static void cs_i_cd_unsteady_vector(const cs_real_t bldfrp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_t hybrid_blend_i, const cs_real_t hybrid_blend_j, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pif[3], cs_real_t pjf[3], cs_real_t pip[3], cs_real_t pjp[3])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:2472
static void cs_i_relax_c_val(const double relaxp, const cs_real_t pia, const cs_real_t pja, const cs_real_t recoi, const cs_real_t recoj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pir, cs_real_t *pjr, cs_real_t *pipr, cs_real_t *pjpr)
Compute relaxed values at cell i and j.
Definition: cs_convection_diffusion.h:788
static void cs_i_conv_flux_tensor(const int iconvp, const cs_real_t thetap, const int imasac, const cs_real_t pi[6], const cs_real_t pj[6], const cs_real_t pifri[6], const cs_real_t pifrj[6], const cs_real_t pjfri[6], const cs_real_t pjfrj[6], const cs_real_t i_massflux, cs_real_t fluxi[6], cs_real_t fluxj[6])
Add convective fluxes (substracting the mass accumulation from them) to fluxes at face ij...
Definition: cs_convection_diffusion.h:1268
void cs_slope_test_gradient_vector(const int inc, const cs_halo_type_t halo_type, const cs_real_33_t *grad, cs_real_33_t *grdpa, const cs_real_3_t *pvar, const cs_real_3_t *coefa, const cs_real_33_t *coefb, const cs_real_t *i_massflux)
Compute the upwind gradient used in the slope tests.
Definition: cs_convection_diffusion.c:1290
double precision, dimension(ncharm), save beta
Definition: cpincl.f90:99
static void cs_centered_f_val(const double pnd, const cs_real_t pip, const cs_real_t pjp, cs_real_t *pf)
Prepare value at face ij by using a centered scheme.
Definition: cs_convection_diffusion.h:949
static void cs_i_cd_steady(const cs_real_t bldfrp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_t cell_ceni[3], const cs_real_t cell_cenj[3], const cs_real_t i_face_cog[3], const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[3], const cs_real_t gradj[3], const cs_real_t gradupi[3], const cs_real_t gradupj[3], const cs_real_t pi, const cs_real_t pj, const cs_real_t pia, const cs_real_t pja, cs_real_t *pifri, cs_real_t *pifrj, cs_real_t *pjfri, cs_real_t *pjfrj, cs_real_t *pip, cs_real_t *pjp, cs_real_t *pipr, cs_real_t *pjpr)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1825
integer(c_int), pointer, save idtvar
option for a variable time step
Definition: optcal.f90:331
static void cs_i_cd_steady_slope_test(bool *upwind_switch, const int iconvp, const cs_real_t bldfrp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_3_t gradsti, const cs_real_3_t gradstj, const cs_real_t pi, const cs_real_t pj, const cs_real_t pia, const cs_real_t pja, cs_real_t *pifri, cs_real_t *pifrj, cs_real_t *pjfri, cs_real_t *pjfrj, cs_real_t *pip, cs_real_t *pjp, cs_real_t *pipr, cs_real_t *pjpr)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2738
void cs_anisotropic_left_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int ivisep, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_33_t i_visc[], const cs_real_t b_visc[], const cs_real_t i_secvis[], cs_real_3_t *restrict rhs)
Add explicit part of the terms of diffusion by a left-multiplying symmetric tensorial diffusivity for...
Definition: cs_convection_diffusion.c:8951
Definition: cs_field_pointer.h:67
void cs_math_3_length_unitv(const cs_real_t xa[3], const cs_real_t xb[3], cs_real_t *len, cs_real_3_t unitv)
Compute the length (Euclidean norm) between two points xa and xb in a Cartesian coordinate system of ...
Definition: cs_math.c:438
Definition: cs_convection_diffusion.h:63
void cs_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t *restrict diverg)
Update the cell mass flux divergence with the face pressure (or pressure increment, or pressure double increment) gradient.
Definition: cs_convection_diffusion.c:11611
Definition: cs_convection_diffusion.h:66
integer, dimension(:), allocatable icvfli
boundary convection flux indicator of a Rusanov or an analytical flux (some boundary contributions of...
Definition: cfpoin.f90:52
static void cs_blend_f_val_vector(const double blencp, const cs_real_3_t p, cs_real_t pf[3])
Blend face values for a centered or SOLU scheme with face values for an upwind scheme.
Definition: cs_convection_diffusion.h:1123
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
static void cs_solu_f_val_tensor(const cs_real_3_t cell_cen, const cs_real_3_t i_face_cog, const cs_real_63_t grad, const cs_real_6_t p, cs_real_t pf[6])
Prepare value at face ij by using a Second Order Linear Upwind scheme.
Definition: cs_convection_diffusion.h:1072
static void cs_i_cd_steady_slope_test_tensor(bool *upwind_switch, const int iconvp, const cs_real_t bldfrp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t grdpai, const cs_real_63_t grdpaj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:3221
static cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:417
static void cs_solu_f_val_vector(const cs_real_3_t cell_cen, const cs_real_3_t i_face_cog, const cs_real_33_t grad, const cs_real_3_t p, cs_real_t pf[3])
Prepare value at face ij by using a Second Order Linear Upwind scheme.
Definition: cs_convection_diffusion.h:1040
static void cs_b_upwind_flux_vector(const int iconvp, const cs_real_t thetap, const int imasac, const int inc, const int bc_type, const cs_real_3_t pi, const cs_real_3_t pir, const cs_real_3_t pipr, const cs_real_3_t coefa, const cs_real_33_t coefb, const cs_real_t b_massflux, cs_real_t flux[3])
Add convective flux (substracting the mass accumulation from it) to flux at boundary face...
Definition: cs_convection_diffusion.h:4452
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:199
Definition: cs_mesh.h:85
static void cs_i_cd_steady_slope_test_vector(bool *upwind_switch, const int iconvp, const cs_real_t bldfrp, const int ischcp, const double relaxp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t grdpai, const cs_real_33_t grdpaj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2993
void cs_convection_diffusion_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const int icvfli[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a standard transport equation of a scalar ...
Definition: cs_convection_diffusion.c:1730
void itrgrp(const int *const f_id, const int *const init, const int *const inc, const int *const imrgra, const int *const nswrgp, const int *const imligp, const int *const iphydp, const int *const iwgrp, const int *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t visel[], cs_real_t diverg[])
Definition: cs_convection_diffusion.c:741
static void cs_b_cd_steady_vector(const cs_real_t bldfrp, const double relaxp, const cs_real_3_t diipb, const cs_real_33_t gradi, const cs_real_3_t pi, const cs_real_3_t pia, cs_real_t pir[3], cs_real_t pipr[3])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm...
Definition: cs_convection_diffusion.h:4698
static void cs_blend_f_val_tensor(const double blencp, const cs_real_t p[6], cs_real_t pf[6])
Blend face values for a centered or SOLU scheme with face values for an upwind scheme.
Definition: cs_convection_diffusion.h:1144
static void cs_b_diff_flux_coupling(int idiffp, cs_real_t pi, cs_real_t pj, cs_real_t b_visc, cs_real_t *fluxi)
Add diffusive flux to flux at an internal coupling face.
Definition: cs_convection_diffusion.h:4869
cs_equation_param_t * var_cal_opt
Definition: keywords.h:135
void cs_halo_sync_var(const cs_halo_t *halo, cs_halo_type_t sync_mode, cs_real_t var[])
Definition: cs_halo.c:1915
static void cs_i_cd_steady_vector(const cs_real_t bldfrp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pia, const cs_real_3_t pja, cs_real_t pifri[3], cs_real_t pifrj[3], cs_real_t pjfri[3], cs_real_t pjfrj[3], cs_real_t pip[3], cs_real_t pjp[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2006
static void cs_b_diff_flux_vector(const int idiffp, const cs_real_t thetap, const int inc, const cs_real_3_t pipr, const cs_real_3_t cofaf, const cs_real_33_t cofbf, const cs_real_t b_visc, cs_real_t flux[3])
Add diffusive flux to flux at boundary face.
Definition: cs_convection_diffusion.h:4586
double precision, dimension(ncharm), save b2
Definition: cpincl.f90:233
static void cs_i_diff_flux_vector(const int idiffp, const cs_real_t thetap, const cs_real_t pip[3], const cs_real_t pjp[3], const cs_real_t pipr[3], const cs_real_t pjpr[3], const cs_real_t i_visc, cs_real_t fluxi[3], cs_real_t fluxj[3])
Add diffusive fluxes to fluxes at face ij.
Definition: cs_convection_diffusion.h:1340
void cs_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int ircflp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict diverg)
Add the explicit part of the divergence of the mass flux due to the pressure gradient (routine analog...
Definition: cs_convection_diffusion.c:11976
static void cs_i_relax_c_val_vector(const double relaxp, const cs_real_3_t pia, const cs_real_3_t pja, const cs_real_3_t recoi, const cs_real_3_t recoj, const cs_real_3_t pi, const cs_real_3_t pj, cs_real_t pir[3], cs_real_t pjr[3], cs_real_t pipr[3], cs_real_t pjpr[3])
Compute relaxed values at cell i and j.
Definition: cs_convection_diffusion.h:826
static void cs_i_cd_unsteady_slope_test_tensor(bool *upwind_switch, const int iconvp, const cs_real_t bldfrp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t grdpai, const cs_real_63_t grdpaj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:3944
static void cs_i_cd_unsteady_nvd(const cs_nvd_type_t limiter, const double beta, const cs_real_3_t cell_cen_c, const cs_real_3_t cell_cen_d, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t gradv_c, const cs_real_t p_c, const cs_real_t p_d, const cs_real_t local_max_c, const cs_real_t local_min_c, const cs_real_t courant_c, cs_real_t *pif, cs_real_t *pjf)
Handle preparation of internal face values for the convection flux computation in case of an unsteady...
Definition: cs_convection_diffusion.h:3647
Definition: cs_convection_diffusion.h:65
void cs_anisotropic_right_diffusion_vector(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, cs_real_3_t *restrict pvar, const cs_real_3_t *restrict pvara, const cs_real_3_t coefav[], const cs_real_33_t coefbv[], const cs_real_3_t cofafv[], const cs_real_33_t cofbfv[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_3_t *restrict rhs)
Add explicit part of the terms of diffusion by a right-multiplying symmetric tensorial diffusivity fo...
Definition: cs_convection_diffusion.c:9490
static void cs_b_relax_c_val_tensor(const double relaxp, const cs_real_6_t pi, const cs_real_6_t pia, const cs_real_6_t recoi, cs_real_t pir[6], cs_real_t pipr[6])
Compute relaxed values at boundary cell i.
Definition: cs_convection_diffusion.h:4212
static void cs_b_relax_c_val(const double relaxp, const cs_real_t pi, const cs_real_t pia, const cs_real_t recoi, cs_real_t *pir, cs_real_t *pipr)
Compute relaxed values at boundary cell i.
Definition: cs_convection_diffusion.h:4160
static void cs_b_diff_flux_coupling_vector(int idiffp, const cs_real_t pi[3], const cs_real_t pj[3], cs_real_t b_visc, cs_real_t fluxi[3])
Add diffusive flux to flux at an internal coupling face for a vector.
Definition: cs_convection_diffusion.h:4892
static void cs_b_imposed_conv_flux(int iconvp, cs_real_t thetap, int imasac, int inc, int bc_type, int icvfli, cs_real_t pi, cs_real_t pir, cs_real_t pipr, cs_real_t coefap, cs_real_t coefbp, cs_real_t coface, cs_real_t cofbce, cs_real_t b_massflux, cs_real_t xcpp, cs_real_t *flux)
Add convective flux (substracting the mass accumulation from it) to flux at boundary face...
Definition: cs_convection_diffusion.h:4252
static void cs_solu_f_val(const cs_real_3_t cell_cen, const cs_real_3_t i_face_cog, const cs_real_3_t grad, const cs_real_t p, cs_real_t *pf)
Prepare value at face ij by using a Second Order Linear Upwind scheme.
Definition: cs_convection_diffusion.h:1012
Definition: cs_mesh_quantities.h:89
#define CS_MIN(a, b)
Definition: cs_defs.h:475
static void cs_i_cd_unsteady(const cs_real_t bldfrp, const int ischcp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_t hybrid_blend_i, const cs_real_t hybrid_blend_j, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of a unsteady algorithm...
Definition: cs_convection_diffusion.h:2312
cs_halo_type_t
Definition: cs_halo.h:56
static void cs_b_upwind_flux(const int iconvp, const cs_real_t thetap, const int imasac, const int inc, const int bc_type, const cs_real_t pi, const cs_real_t pir, const cs_real_t pipr, const cs_real_t coefap, const cs_real_t coefbp, const cs_real_t b_massflux, const cs_real_t xcpp, cs_real_t *flux)
Add convective flux (substracting the mass accumulation from it) to flux at boundary face...
Definition: cs_convection_diffusion.h:4400
static void cs_b_cd_steady_tensor(const cs_real_t bldfrp, const double relaxp, const cs_real_3_t diipb, const cs_real_63_t gradi, const cs_real_6_t pi, const cs_real_6_t pia, cs_real_t pir[6], cs_real_t pipr[6])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm...
Definition: cs_convection_diffusion.h:4739
Definition: cs_convection_diffusion.h:62
static cs_real_t cs_math_3_norm(const cs_real_t v[3])
Compute the euclidean norm of a vector of dimension 3.
Definition: cs_math.h:401
void itrmav(const int *const f_id, const int *const init, const int *const inc, const int *const imrgra, const int *const nswrgp, const int *const imligp, const int *const ircflp, const int *const iphydp, const int *const iwgrp, const int *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t viscel[], const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t i_massflux[], cs_real_t b_massflux[])
Definition: cs_convection_diffusion.c:673
static void cs_i_conv_flux(const int iconvp, const cs_real_t thetap, const int imasac, const cs_real_t pi, const cs_real_t pj, const cs_real_t pifri, const cs_real_t pifrj, const cs_real_t pjfri, const cs_real_t pjfrj, const cs_real_t i_massflux, const cs_real_t xcppi, const cs_real_t xcppj, cs_real_2_t fluxij)
Add convective fluxes (substracting the mass accumulation from them) to fluxes at face ij...
Definition: cs_convection_diffusion.h:1176
static void cs_i_compute_quantities_tensor(const cs_real_t bldfrp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, cs_real_t recoi[6], cs_real_t recoj[6], cs_real_t pip[6], cs_real_t pjp[6])
Reconstruct values in I&#39; and J&#39;.
Definition: cs_convection_diffusion.h:736
static void cs_centered_f_val_vector(const double pnd, const cs_real_3_t pip, const cs_real_3_t pjp, cs_real_t pf[3])
Prepare value at face ij by using a centered scheme.
Definition: cs_convection_diffusion.h:969
static cs_real_t cs_nvd_vof_scheme_scalar(const cs_nvd_type_t limiter, const cs_real_3_t i_face_normal, const cs_real_t nvf_p_c, const cs_real_t nvf_r_f, const cs_real_t nvf_r_c, const cs_real_3_t gradv_c, const cs_real_t c_courant)
Compute the normalised face scalar using the specified NVD scheme for the case of a Volume-of-Fluid (...
Definition: cs_convection_diffusion.h:301
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:335
static void cs_i_cd_steady_upwind(const cs_real_t bldfrp, const cs_real_t relaxp, const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[3], const cs_real_t gradj[3], const cs_real_t pi, const cs_real_t pj, const cs_real_t pia, const cs_real_t pja, cs_real_t *pifri, cs_real_t *pifrj, cs_real_t *pjfri, cs_real_t *pjfrj, cs_real_t *pip, cs_real_t *pjp, cs_real_t *pipr, cs_real_t *pjpr)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1416
static void cs_i_compute_quantities(const cs_real_t bldfrp, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_t pi, const cs_real_t pj, cs_real_t *recoi, cs_real_t *recoj, cs_real_t *pip, cs_real_t *pjp)
Reconstruct values in I&#39; and J&#39;.
Definition: cs_convection_diffusion.h:642
static void cs_b_upwind_flux_tensor(const int iconvp, const cs_real_t thetap, const int imasac, const int inc, const int bc_type, const cs_real_6_t pi, const cs_real_6_t pir, const cs_real_6_t pipr, const cs_real_6_t coefa, const cs_real_66_t coefb, const cs_real_t b_massflux, cs_real_t flux[6])
Add convective flux (substracting the mass accumulation from it) to flux at boundary face...
Definition: cs_convection_diffusion.h:4508
Definition: cs_convection_diffusion.h:74
void cs_slope_test_gradient(int f_id, int inc, cs_halo_type_t halo_type, const cs_real_3_t *grad, cs_real_3_t *grdpa, const cs_real_t *pvar, const cs_real_t *coefap, const cs_real_t *coefbp, const cs_real_t *i_massflux)
Compute the upwind gradient used in the slope tests.
Definition: cs_convection_diffusion.c:1024
static void cs_slope_test_vector(const cs_real_t pi[3], const cs_real_t pj[3], const cs_real_t distf, const cs_real_t srfan, const cs_real_t i_face_normal[3], const cs_real_t gradi[3][3], const cs_real_t gradj[3][3], const cs_real_t gradsti[3][3], const cs_real_t gradstj[3][3], const cs_real_t i_massflux, cs_real_t *testij, cs_real_t *tesqck)
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:502
void cs_convection_diffusion_tensor(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int imasac, cs_real_6_t *restrict pvar, const cs_real_6_t *restrict pvara, const cs_real_6_t coefa[], const cs_real_66_t coefb[], const cs_real_6_t cofaf[], const cs_real_66_t cofbf[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a vector field ...
Definition: cs_convection_diffusion.c:5929
double precision, save fmin
Definition: coincl.f90:182
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
void itrgrv(const int *const f_id, const int *const init, const int *const inc, const int *const imrgra, const int *const nswrgp, const int *const imligp, const int *const ircflp, const int *const iphydp, const int *const iwgrp, const int *const iwarnp, const cs_real_t *const epsrgp, const cs_real_t *const climgp, const cs_real_t *const extrap, cs_real_3_t frcxt[], cs_real_t pvar[], const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t viscel[], const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t diverg[])
Definition: cs_convection_diffusion.c:801
Definition: cs_convection_diffusion.h:70
static cs_real_t cs_math_3_square_distance(const cs_real_t xa[3], const cs_real_t xb[3])
Compute the squared distance between two points xa and xb in a Cartesian coordinate system of dimensi...
Definition: cs_math.h:310
Definition: cs_halo.h:58
static void cs_i_cd_steady_tensor(const cs_real_t bldfrp, const int ischcp, const double relaxp, const double blencp, const cs_real_t weight, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pia, const cs_real_6_t pja, cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:2159
#define END_C_DECLS
Definition: cs_defs.h:513
Definition: cs_convection_diffusion.h:67
Definition: cs_convection_diffusion.h:72
static void cs_i_cd_steady_upwind_tensor(const cs_real_t bldfrp, const cs_real_t relaxp, const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[6][3], const cs_real_t gradj[6][3], const cs_real_t pi[6], const cs_real_t pj[6], const cs_real_t pia[6], const cs_real_t pja[6], cs_real_t pifri[6], cs_real_t pifrj[6], cs_real_t pjfri[6], cs_real_t pjfrj[6], cs_real_t pip[6], cs_real_t pjp[6], cs_real_t pipr[6], cs_real_t pjpr[6])
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:1582
void cs_face_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_t *restrict visel, cs_real_t *restrict i_massflux, cs_real_t *restrict b_massflux)
Update the face mass flux with the face pressure (or pressure increment, or pressure double increment...
Definition: cs_convection_diffusion.c:10803
#define CS_PROCF(x, y)
Definition: cs_defs.h:526
#define CS_MAX(a, b)
Definition: cs_defs.h:476
Definition: cs_parameters.h:99
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:344
static void cs_b_cd_unsteady_vector(const cs_real_t bldfrp, const cs_real_3_t diipb, const cs_real_33_t gradi, const cs_real_3_t pi, cs_real_t pip[3])
Handle preparation of boundary face values for the flux computation in case of a steady algorithm...
Definition: cs_convection_diffusion.h:4807
Definition: cs_convection_diffusion.h:71
Definition: cs_convection_diffusion.h:61
Definition: cs_convection_diffusion.h:64
void cs_face_anisotropic_diffusion_potential(const int f_id, const cs_mesh_t *m, cs_mesh_quantities_t *fvq, int init, int inc, int imrgra, int nswrgp, int imligp, int ircflp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, cs_real_3_t *restrict frcxt, cs_real_t *restrict pvar, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict i_massflux, cs_real_t *restrict b_massflux)
Add the explicit part of the pressure gradient term to the mass flux in case of anisotropic diffusion...
Definition: cs_convection_diffusion.c:11139
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:352
static void cs_i_diff_flux_tensor(const int idiffp, const cs_real_t thetap, const cs_real_t pip[6], const cs_real_t pjp[6], const cs_real_t pipr[6], const cs_real_t pjpr[6], const cs_real_t i_visc, cs_real_t fluxi[6], cs_real_t fluxj[6])
Add diffusive fluxes to fluxes at face ij.
Definition: cs_convection_diffusion.h:1373
void cs_convection_diffusion_thermal(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t i_visc[], const cs_real_t b_visc[], const cs_real_t xcpp[], cs_real_t *restrict rhs)
Add the explicit part of the convection/diffusion terms of a transport equation of a scalar field su...
Definition: cs_convection_diffusion.c:6884
static void cs_b_compute_quantities_vector(const cs_real_3_t diipb, const cs_real_33_t gradi, const cs_real_t bldfrp, cs_real_t recoi[3])
Reconstruct values in I&#39; at boundary cell i.
Definition: cs_convection_diffusion.h:4110
static void cs_slope_test(const cs_real_t pi, const cs_real_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_t i_face_normal[3], const cs_real_t gradi[3], const cs_real_t gradj[3], const cs_real_t grdpai[3], const cs_real_t grdpaj[3], const cs_real_t i_massflux, cs_real_t *testij, cs_real_t *tesqck)
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:436
static void cs_upwind_f_val(const cs_real_t p, cs_real_t *pf)
Prepare value at face ij by using an upwind scheme.
Definition: cs_convection_diffusion.h:897
void cs_beta_limiter_building(int f_id, int inc, const cs_real_t rovsdt[])
Compute the beta blending coefficient of the beta limiter (ensuring preservation of a given min/max p...
Definition: cs_convection_diffusion.c:1585
double precision, dimension(ncharm), save b1
Definition: cpincl.f90:233
static void cs_b_diff_flux(const int idiffp, const cs_real_t thetap, const int inc, const cs_real_t pipr, const cs_real_t cofafp, const cs_real_t cofbfp, const cs_real_t b_visc, cs_real_t *flux)
Add diffusive flux to flux at boundary face.
Definition: cs_convection_diffusion.h:4557
void cs_upwind_gradient(const int f_id, const int inc, const cs_halo_type_t halo_type, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t i_massflux[], const cs_real_t b_massflux[], const cs_real_t *restrict pvar, cs_real_3_t *restrict grdpa)
Compute the upwind gradient in order to cope with SOLU schemes observed in the litterature.
Definition: cs_convection_diffusion.c:1163
cs_real_t * cs_get_v_slope_test(int f_id, const cs_var_cal_opt_t var_cal_opt)
Definition: cs_convection_diffusion.c:965
Definition: cs_convection_diffusion.h:69
static void cs_i_cd_unsteady_upwind_tensor(const cs_real_t bldfrp, const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[6][3], const cs_real_t gradj[6][3], const cs_real_t pi[6], const cs_real_t pj[6], cs_real_t pif[6], cs_real_t pjf[6], cs_real_t pip[6], cs_real_t pjp[6])
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:1758
integer(c_int), pointer, save imrgra
type of gradient reconstruction
Definition: optcal.f90:208
static void cs_i_cd_unsteady_slope_test(bool *upwind_switch, const int iconvp, const cs_real_t bldfrp, const int ischcp, const double blencp, const double blend_st, const cs_real_t weight, const cs_real_t i_dist, const cs_real_t i_face_surf, const cs_real_3_t cell_ceni, const cs_real_3_t cell_cenj, const cs_real_3_t i_face_normal, const cs_real_3_t i_face_cog, const cs_real_3_t diipf, const cs_real_3_t djjpf, const cs_real_t i_massflux, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t gradupi, const cs_real_3_t gradupj, const cs_real_3_t gradsti, const cs_real_3_t gradstj, const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of a steady algorithm a...
Definition: cs_convection_diffusion.h:3447
cs_halo_t * halo
Definition: cs_mesh.h:156
static void cs_b_relax_c_val_vector(const double relaxp, const cs_real_3_t pi, const cs_real_3_t pia, const cs_real_3_t recoi, cs_real_t pir[3], cs_real_t pipr[3])
Compute relaxed values at boundary cell i.
Definition: cs_convection_diffusion.h:4185
static void cs_blend_f_val(const double blencp, const cs_real_t p, cs_real_t *pf)
Blend face values for a centered or SOLU scheme with face values for an upwind scheme.
Definition: cs_convection_diffusion.h:1103
Definition: cs_convection_diffusion.h:73
void cs_anisotropic_diffusion_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_real_t coefap[], const cs_real_t coefbp[], const cs_real_t cofafp[], const cs_real_t cofbfp[], const cs_real_t i_visc[], const cs_real_t b_visc[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_t *restrict rhs)
Add the explicit part of the diffusion terms with a symmetric tensor diffusivity for a transport equa...
Definition: cs_convection_diffusion.c:8206
static void cs_i_cd_unsteady_upwind(const cs_real_t bldfrp, const cs_real_t diipf[3], const cs_real_t djjpf[3], const cs_real_t gradi[3], const cs_real_t gradj[3], const cs_real_t pi, const cs_real_t pj, cs_real_t *pif, cs_real_t *pjf, cs_real_t *pip, cs_real_t *pjp)
Handle preparation of internal face values for the fluxes computation in case of an unsteady algorith...
Definition: cs_convection_diffusion.h:1658