programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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-2017 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 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*=============================================================================
47  * Local Macro definitions
48  *============================================================================*/
49 
50 /*============================================================================
51  * Type definition
52  *============================================================================*/
53 
54 /*----------------------------------------------------------------------------
55  * NVD/TVD Advection Scheme
56  *----------------------------------------------------------------------------*/
57 
58 typedef enum {
59 
60  CS_NVD_GAMMA = 0, /* GAMMA */
61  CS_NVD_SMART = 1, /* SMART */
62  CS_NVD_CUBISTA = 2, /* CUBISTA */
63  CS_NVD_SUPERBEE = 3, /* SUPERBEE */
64  CS_NVD_MUSCL = 4, /* MUSCL */
65  CS_NVD_MINMOD = 5, /* MINMOD */
66  CS_NVD_CLAM = 6, /* CLAM */
67  CS_NVD_STOIC = 7, /* STOIC */
68  CS_NVD_OSHER = 8, /* OSHER */
69  CS_NVD_WASEB = 9, /* WASEB */
70  CS_NVD_VOF_HRIC = 10, /* M-HRIC for VOF */
71  CS_NVD_VOF_CICSAM = 11, /* M-CICSAM for VOF */
72  CS_NVD_VOF_STACS = 12, /* STACS for VOF */
73  CS_NVD_N_TYPES = 13 /* number of NVD schemes */
74 
76 
77 /*============================================================================
78  * Global variables
79  *============================================================================*/
80 
81 /*============================================================================
82  * Private function definitions
83  *============================================================================*/
84 
85 /*----------------------------------------------------------------------------*/
102 /*----------------------------------------------------------------------------*/
103 
104 inline static void
106  const cs_real_t pj,
107  const cs_real_t distf,
108  const cs_real_t srfan,
109  const cs_real_3_t i_face_normal,
110  const cs_real_3_t gradi,
111  const cs_real_3_t gradj,
112  const cs_real_3_t grdpai,
113  const cs_real_3_t grdpaj,
114  const cs_real_t i_massflux,
115  double *testij,
116  double *tesqck)
117 {
118  double testi, testj;
119  double dcc, ddi, ddj;
120 
121  /* Slope test
122  ----------*/
123 
124  testi = grdpai[0]*i_face_normal[0]
125  + grdpai[1]*i_face_normal[1]
126  + grdpai[2]*i_face_normal[2];
127  testj = grdpaj[0]*i_face_normal[0]
128  + grdpaj[1]*i_face_normal[1]
129  + grdpaj[2]*i_face_normal[2];
130  *testij = grdpai[0]*grdpaj[0]
131  + grdpai[1]*grdpaj[1]
132  + grdpai[2]*grdpaj[2];
133 
134  if (i_massflux>0.) {
135  dcc = gradi[0]*i_face_normal[0]
136  + gradi[1]*i_face_normal[1]
137  + gradi[2]*i_face_normal[2];
138  ddi = testi;
139  ddj = (pj-pi)/distf *srfan;
140  } else {
141  dcc = gradj[0]*i_face_normal[0]
142  + gradj[1]*i_face_normal[1]
143  + gradj[2]*i_face_normal[2];
144  ddi = (pj-pi)/distf *srfan;
145  ddj = testj;
146  }
147  *tesqck = cs_math_sq(dcc) - cs_math_sq(ddi-ddj);
148 }
149 
150 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
169 inline static void
171  const cs_real_3_t pj,
172  const cs_real_t distf,
173  const cs_real_t srfan,
174  const cs_real_3_t i_face_normal,
175  const cs_real_33_t gradi,
176  const cs_real_33_t gradj,
177  const cs_real_33_t gradsti,
178  const cs_real_33_t gradstj,
179  const cs_real_t i_massflux,
180  cs_real_t *testij,
181  cs_real_t *tesqck)
182 {
183  double testi[3], testj[3];
184  double dcc[3], ddi[3], ddj[3];
185  *testij = 0.;
186  *tesqck = 0.;
187 
188  /* Slope test
189  ----------*/
190  for (int i = 0; i < 3; i++) {
191  *testij += gradsti[i][0]*gradstj[i][0]
192  + gradsti[i][1]*gradstj[i][1]
193  + gradsti[i][2]*gradstj[i][2];
194 
195  testi[i] = gradsti[i][0]*i_face_normal[0]
196  + gradsti[i][1]*i_face_normal[1]
197  + gradsti[i][2]*i_face_normal[2];
198  testj[i] = gradstj[i][0]*i_face_normal[0]
199  + gradstj[i][1]*i_face_normal[1]
200  + gradstj[i][2]*i_face_normal[2];
201 
202  if (i_massflux > 0.) {
203  dcc[i] = gradi[i][0]*i_face_normal[0]
204  + gradi[i][1]*i_face_normal[1]
205  + gradi[i][2]*i_face_normal[2];
206  ddi[i] = testi[i];
207  ddj[i] = (pj[i]-pi[i])/distf *srfan;
208  } else {
209  dcc[i] = gradj[i][0]*i_face_normal[0]
210  + gradj[i][1]*i_face_normal[1]
211  + gradj[i][2]*i_face_normal[2];
212  ddi[i] = (pj[i]-pi[i])/distf *srfan;
213  ddj[i] = testj[i];
214  }
215  }
216 
217  *tesqck = cs_math_3_square_norm(dcc) - cs_math_3_square_distance(ddi, ddj);
218 
219 }
220 
221 /*----------------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------------*/
240 
241 inline static void
243  const cs_real_3_t pj,
244  const cs_real_t distf,
245  const cs_real_t srfan,
246  const cs_real_3_t i_face_normal,
247  const cs_real_33_t gradi,
248  const cs_real_33_t gradj,
249  const cs_real_33_t grdpai,
250  const cs_real_33_t grdpaj,
251  const cs_real_t i_massflux,
252  cs_real_t testij[3],
253  cs_real_t tesqck[3])
254 {
255  double testi[3], testj[3];
256  double dcc[3], ddi[3], ddj[3];
257 
258  /* Slope test
259  ----------*/
260  for (int isou = 0; isou < 3; isou++) {
261  testi[isou] = grdpai[isou][0]*i_face_normal[0]
262  + grdpai[isou][1]*i_face_normal[1]
263  + grdpai[isou][2]*i_face_normal[2];
264  testj[isou] = grdpaj[isou][0]*i_face_normal[0]
265  + grdpaj[isou][1]*i_face_normal[1]
266  + grdpaj[isou][2]*i_face_normal[2];
267  testij[isou] = grdpai[isou][0]*grdpaj[isou][0]
268  + grdpai[isou][1]*grdpaj[isou][1]
269  + grdpai[isou][2]*grdpaj[isou][2];
270 
271  if (i_massflux>0.) {
272  dcc[isou] = gradi[isou][0]*i_face_normal[0]
273  + gradi[isou][1]*i_face_normal[1]
274  + gradi[isou][2]*i_face_normal[2];
275  ddi[isou] = testi[isou];
276  ddj[isou] = (pj[isou]-pi[isou])/distf *srfan;
277  } else {
278  dcc[isou] = gradj[isou][0]*i_face_normal[0]
279  + gradj[isou][1]*i_face_normal[1]
280  + gradj[isou][2]*i_face_normal[2];
281  ddi[isou] = (pj[isou]-pi[isou])/distf *srfan;
282  ddj[isou] = testj[isou];
283  }
284  tesqck[isou] = cs_math_sq(dcc[isou]) - cs_math_sq(ddi[isou]-ddj[isou]);
285  }
286 }
287 
288 
289 /*----------------------------------------------------------------------------*/
306 /*----------------------------------------------------------------------------*/
307 
308 inline static void
310  const cs_real_6_t pj,
311  const cs_real_t distf,
312  const cs_real_t srfan,
313  const cs_real_3_t i_face_normal,
314  const cs_real_63_t gradi,
315  const cs_real_63_t gradj,
316  const cs_real_63_t gradsti,
317  const cs_real_63_t gradstj,
318  const cs_real_t i_massflux,
319  cs_real_t *testij,
320  cs_real_t *tesqck)
321 {
322  double testi[6], testj[6];
323  double dcc[6], ddi[6], ddj[6];
324  *testij = 0.;
325  *tesqck = 0.;
326 
327  /* Slope test */
328 
329  for (int ij = 0; ij < 6; ij++) {
330  *testij += gradsti[ij][0]*gradstj[ij][0]
331  + gradsti[ij][1]*gradstj[ij][1]
332  + gradsti[ij][2]*gradstj[ij][2];
333  testi[ij] = gradsti[ij][0]*i_face_normal[0]
334  + gradsti[ij][1]*i_face_normal[1]
335  + gradsti[ij][2]*i_face_normal[2];
336  testj[ij] = gradstj[ij][0]*i_face_normal[0]
337  + gradstj[ij][1]*i_face_normal[1]
338  + gradstj[ij][2]*i_face_normal[2];
339 
340  if (i_massflux > 0.) {
341  dcc[ij] = gradi[ij][0]*i_face_normal[0]
342  + gradi[ij][1]*i_face_normal[1]
343  + gradi[ij][2]*i_face_normal[2];
344  ddi[ij] = testi[ij];
345  ddj[ij] = (pj[ij]-pi[ij])/distf *srfan;
346  } else {
347  dcc[ij] = gradj[ij][0]*i_face_normal[0]
348  + gradj[ij][1]*i_face_normal[1]
349  + gradj[ij][2]*i_face_normal[2];
350  ddi[ij] = (pj[ij]-pi[ij])/distf *srfan;
351  ddj[ij] = testj[ij];
352  }
353 
354  *tesqck += cs_math_sq(dcc[ij]) - cs_math_sq(ddi[ij]-ddj[ij]);
355  }
356 }
357 
358 /*----------------------------------------------------------------------------*/
377 /*----------------------------------------------------------------------------*/
378 
379 inline static void
380 cs_i_compute_quantities(const int ircflp,
381  const double pnd,
382  const cs_real_3_t cell_ceni,
383  const cs_real_3_t cell_cenj,
384  const cs_real_3_t i_face_cog,
385  const cs_real_3_t dijpf,
386  const cs_real_3_t gradi,
387  const cs_real_3_t gradj,
388  const cs_real_t pi,
389  const cs_real_t pj,
390  cs_real_t *recoi,
391  cs_real_t *recoj,
392  cs_real_t *pip,
393  cs_real_t *pjp)
394 {
395  cs_real_t diipfx, diipfy, diipfz, djjpfx, djjpfy, djjpfz;
396  cs_real_t dpxf, dpyf, dpzf;//FIXME
397 
398  /* Recompute II' and JJ' at this level */
399 
400  diipfx = i_face_cog[0] - (cell_ceni[0] + (1.-pnd) * dijpf[0]);
401  diipfy = i_face_cog[1] - (cell_ceni[1] + (1.-pnd) * dijpf[1]);
402  diipfz = i_face_cog[2] - (cell_ceni[2] + (1.-pnd) * dijpf[2]);
403 
404  djjpfx = i_face_cog[0] - cell_cenj[0] + pnd * dijpf[0];
405  djjpfy = i_face_cog[1] - cell_cenj[1] + pnd * dijpf[1];
406  djjpfz = i_face_cog[2] - cell_cenj[2] + pnd * dijpf[2];
407 
408  dpxf = 0.5*(gradi[0] + gradj[0]);
409  dpyf = 0.5*(gradi[1] + gradj[1]);
410  dpzf = 0.5*(gradi[2] + gradj[2]);
411 
412  /* reconstruction only if IRCFLP = 1 */
413  *recoi = ircflp*(dpxf*diipfx+dpyf*diipfy+dpzf*diipfz);
414  *recoj = ircflp*(dpxf*djjpfx+dpyf*djjpfy+dpzf*djjpfz);
415  *pip = pi + *recoi;
416  *pjp = pj + *recoj;
417 }
418 
419 /*----------------------------------------------------------------------------*/
438 /*----------------------------------------------------------------------------*/
439 
440 inline static void
442  const double pnd,
443  const cs_real_3_t cell_ceni,
444  const cs_real_3_t cell_cenj,
445  const cs_real_3_t i_face_cog,
446  const cs_real_3_t dijpf,
447  const cs_real_33_t gradi,
448  const cs_real_33_t gradj,
449  const cs_real_3_t pi,
450  const cs_real_3_t pj,
451  cs_real_t recoi[3],
452  cs_real_t recoj[3],
453  cs_real_t pip[3],
454  cs_real_t pjp[3])
455 {
456  cs_real_3_t dijpfv, diipfv, djjpfv;
457  cs_real_3_t dpvf;
458 
459  for (int jsou = 0; jsou < 3; jsou++)
460  dijpfv[jsou] = dijpf[jsou];
461 
462  /* Recompute II' and JJ' at this level */
463  for (int jsou = 0; jsou < 3; jsou++) {
464  diipfv[jsou] = i_face_cog[jsou]
465  - (cell_ceni[jsou] + (1.-pnd) * dijpfv[jsou]);
466  djjpfv[jsou] = i_face_cog[jsou]
467  - cell_cenj[jsou] + pnd * dijpfv[jsou];
468  }
469 
470  /* x-y-z components, p = u, v, w */
471 
472  for (int isou = 0; isou < 3; isou++) {
473 
474  for (int jsou = 0; jsou < 3; jsou++)
475  dpvf[jsou] = 0.5*( gradi[isou][jsou]
476  + gradj[isou][jsou]);
477 
478  /* reconstruction only if IRCFLP = 1 */
479 
480  recoi[isou] = ircflp*( dpvf[0]*diipfv[0]
481  + dpvf[1]*diipfv[1]
482  + dpvf[2]*diipfv[2]);
483 
484 
485  recoj[isou] = ircflp*( dpvf[0]*djjpfv[0]
486  + dpvf[1]*djjpfv[1]
487  + dpvf[2]*djjpfv[2]);
488 
489  pip[isou] = pi[isou] + recoi[isou];
490 
491  pjp[isou] = pj[isou] + recoj[isou];
492 
493  }
494 }
495 
496 /*----------------------------------------------------------------------------*/
515 /*----------------------------------------------------------------------------*/
516 
517 inline static void
519  const double pnd,
520  const cs_real_3_t cell_ceni,
521  const cs_real_3_t cell_cenj,
522  const cs_real_3_t i_face_cog,
523  const cs_real_3_t dijpf,
524  const cs_real_63_t gradi,
525  const cs_real_63_t gradj,
526  const cs_real_6_t pi,
527  const cs_real_6_t pj,
528  cs_real_t recoi[6],
529  cs_real_t recoj[6],
530  cs_real_t pip[6],
531  cs_real_t pjp[6])
532 {
533  cs_real_3_t dijpfv, diipfv, djjpfv;
534  cs_real_3_t dpvf;
535 
536  for (int jsou = 0; jsou < 3; jsou++)
537  dijpfv[jsou] = dijpf[jsou];
538 
539  /* Recompute II' and JJ' at this level */
540 
541  for (int jsou = 0; jsou < 3; jsou++) {
542  diipfv[jsou] = i_face_cog[jsou]
543  - (cell_ceni[jsou] + (1.-pnd) * dijpfv[jsou]);
544  djjpfv[jsou] = i_face_cog[jsou]
545  - cell_cenj[jsou] + pnd * dijpfv[jsou];
546  }
547 
548  /* x-y-z components, p = u, v, w */
549 
550  for (int isou = 0; isou < 6; isou++) {
551 
552  for (int jsou = 0; jsou < 3; jsou++)
553  dpvf[jsou] = 0.5*( gradi[isou][jsou]
554  + gradj[isou][jsou]);
555 
556  /* reconstruction only if IRCFLP = 1 */
557 
558  recoi[isou] = ircflp*( dpvf[0]*diipfv[0]
559  + dpvf[1]*diipfv[1]
560  + dpvf[2]*diipfv[2]);
561 
562 
563  recoj[isou] = ircflp*( dpvf[0]*djjpfv[0]
564  + dpvf[1]*djjpfv[1]
565  + dpvf[2]*djjpfv[2]);
566 
567  pip[isou] = pi[isou] + recoi[isou];
568 
569  pjp[isou] = pj[isou] + recoj[isou];
570 
571  }
572 }
573 
574 /*----------------------------------------------------------------------------*/
590 /*----------------------------------------------------------------------------*/
591 
592 inline static void
593 cs_i_relax_c_val(const double relaxp,
594  const cs_real_t pia,
595  const cs_real_t pja,
596  const cs_real_t recoi,
597  const cs_real_t recoj,
598  const cs_real_t pi,
599  const cs_real_t pj,
600  cs_real_t *pir,
601  cs_real_t *pjr,
602  cs_real_t *pipr,
603  cs_real_t *pjpr)
604 {
605  *pir = pi/relaxp - (1.-relaxp)/relaxp * pia;
606  *pjr = pj/relaxp - (1.-relaxp)/relaxp * pja;
607 
608  *pipr = *pir + recoi;
609  *pjpr = *pjr + recoj;
610 }
611 
612 /*----------------------------------------------------------------------------*/
628 /*----------------------------------------------------------------------------*/
629 
630 inline static void
631 cs_i_relax_c_val_vector(const double relaxp,
632  const cs_real_3_t pia,
633  const cs_real_3_t pja,
634  const cs_real_3_t recoi,
635  const cs_real_3_t recoj,
636  const cs_real_3_t pi,
637  const cs_real_3_t pj,
638  cs_real_t pir[3],
639  cs_real_t pjr[3],
640  cs_real_t pipr[3],
641  cs_real_t pjpr[3])
642 {
643  for (int isou = 0; isou < 3; isou++) {
644  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
645  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
646 
647  pipr[isou] = pir[isou] + recoi[isou];
648  pjpr[isou] = pjr[isou] + recoj[isou];
649  }
650 }
651 
652 /*----------------------------------------------------------------------------*/
668 /*----------------------------------------------------------------------------*/
669 
670 inline static void
671 cs_i_relax_c_val_tensor(const double relaxp,
672  const cs_real_6_t pia,
673  const cs_real_6_t pja,
674  const cs_real_6_t recoi,
675  const cs_real_6_t recoj,
676  const cs_real_6_t pi,
677  const cs_real_6_t pj,
678  cs_real_t pir[6],
679  cs_real_t pjr[6],
680  cs_real_t pipr[6],
681  cs_real_t pjpr[6])
682 {
683  for (int isou = 0; isou < 6; isou++) {
684  pir[isou] = pi[isou] /relaxp - (1.-relaxp)/relaxp * pia[isou];
685  pjr[isou] = pj[isou] /relaxp - (1.-relaxp)/relaxp * pja[isou];
686 
687  pipr[isou] = pir[isou] + recoi[isou];
688  pjpr[isou] = pjr[isou] + recoj[isou];
689  }
690 }
691 
692 /*----------------------------------------------------------------------------*/
699 /*----------------------------------------------------------------------------*/
700 
701 inline static void
703  cs_real_t *pf)
704 {
705  *pf = p;
706 }
707 
708 /*----------------------------------------------------------------------------*/
715 /*----------------------------------------------------------------------------*/
716 
717 inline static void
719  cs_real_t pf[3])
720 {
721  for (int isou = 0; isou < 3; isou++)
722  pf[isou] = p[isou];
723 }
724 
725 /*----------------------------------------------------------------------------*/
732 /*----------------------------------------------------------------------------*/
733 
734 inline static void
736  cs_real_t pf[6])
737 {
738  for (int isou = 0; isou < 6; isou++)
739  pf[isou] = p[isou];
740 }
741 
742 /*----------------------------------------------------------------------------*/
751 /*----------------------------------------------------------------------------*/
752 
753 inline static void
754 cs_centered_f_val(const double pnd,
755  const cs_real_t pip,
756  const cs_real_t pjp,
757  cs_real_t *pf)
758 {
759  *pf = pnd*pip + (1.-pnd)*pjp;
760 }
761 
762 /*----------------------------------------------------------------------------*/
771 /*----------------------------------------------------------------------------*/
772 
773 inline static void
774 cs_centered_f_val_vector(const double pnd,
775  const cs_real_3_t pip,
776  const cs_real_3_t pjp,
777  cs_real_t pf[3])
778 {
779  for (int isou = 0; isou < 3; isou++)
780  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
781 }
782 
783 /*----------------------------------------------------------------------------*/
792 /*----------------------------------------------------------------------------*/
793 
794 inline static void
795 cs_centered_f_val_tensor(const double pnd,
796  const cs_real_6_t pip,
797  const cs_real_6_t pjp,
798  cs_real_t pf[6])
799 {
800  for (int isou = 0; isou < 6; isou++)
801  pf[isou] = pnd*pip[isou] + (1.-pnd)*pjp[isou];
802 }
803 
804 /*----------------------------------------------------------------------------*/
814 /*----------------------------------------------------------------------------*/
815 
816 inline static void
817 cs_solu_f_val(const cs_real_3_t cell_cen,
818  const cs_real_3_t i_face_cog,
819  const cs_real_3_t grad,
820  const cs_real_t p,
821  cs_real_t *pf)
822 {
823  cs_real_3_t df;
824 
825  df[0] = i_face_cog[0] - cell_cen[0];
826  df[1] = i_face_cog[1] - cell_cen[1];
827  df[2] = i_face_cog[2] - cell_cen[2];
828 
829  *pf = p + cs_math_3_dot_product(df, grad);
830 }
831 
832 /*----------------------------------------------------------------------------*/
842 /*----------------------------------------------------------------------------*/
843 
844 inline static void
846  const cs_real_3_t i_face_cog,
847  const cs_real_33_t grad,
848  const cs_real_3_t p,
849  cs_real_t pf[3])
850 {
851  cs_real_3_t df;
852 
853  for (int jsou = 0; jsou < 3; jsou++)
854  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
855 
856  for (int isou = 0; isou < 3; isou++) {
857  pf[isou] = p[isou] + df[0]*grad[isou][0]
858  + df[1]*grad[isou][1]
859  + df[2]*grad[isou][2];
860 
861  }
862 }
863 
864 /*----------------------------------------------------------------------------*/
874 /*----------------------------------------------------------------------------*/
875 
876 inline static void
878  const cs_real_3_t i_face_cog,
879  const cs_real_63_t grad,
880  const cs_real_6_t p,
881  cs_real_t pf[6])
882 {
883  cs_real_3_t df;
884 
885  for (int jsou = 0; jsou < 3; jsou++)
886  df[jsou] = i_face_cog[jsou] - cell_cen[jsou];
887 
888  for (int isou = 0; isou < 6; isou++) {
889  pf[isou] = p[isou] + df[0]*grad[isou][0]
890  + df[1]*grad[isou][1]
891  + df[2]*grad[isou][2];
892  }
893 }
894 
895 /*----------------------------------------------------------------------------*/
905 /*----------------------------------------------------------------------------*/
906 
907 inline static void
908 cs_blend_f_val(const double blencp,
909  const cs_real_t p,
910  cs_real_t *pf)
911 {
912  *pf = blencp * (*pf) + (1. - blencp) * p;
913 }
914 
915 /*----------------------------------------------------------------------------*/
925 /*----------------------------------------------------------------------------*/
926 
927 inline static void
928 cs_blend_f_val_vector(const double blencp,
929  const cs_real_3_t p,
930  cs_real_t pf[3])
931 {
932  for (int isou = 0; isou < 3; isou++)
933  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
934 }
935 
936 /*----------------------------------------------------------------------------*/
946 /*----------------------------------------------------------------------------*/
947 
948 inline static void
949 cs_blend_f_val_tensor(const double blencp,
950  const cs_real_6_t p,
951  cs_real_t pf[6])
952 {
953  for (int isou = 0; isou < 6; isou++)
954  pf[isou] = blencp*(pf[isou])+(1.-blencp)*p[isou];
955 }
956 
957 /*----------------------------------------------------------------------------*/
978 /*----------------------------------------------------------------------------*/
979 
980 inline static void
981 cs_i_conv_flux(const int iconvp,
982  const cs_real_t thetap,
983  const int imasac,
984  const cs_real_t pi,
985  const cs_real_t pj,
986  const cs_real_t pifri,
987  const cs_real_t pifrj,
988  const cs_real_t pjfri,
989  const cs_real_t pjfrj,
990  const cs_real_t i_massflux,
991  const cs_real_t xcppi,
992  const cs_real_t xcppj,
993  cs_real_2_t fluxij)
994 {
995  cs_real_t flui, fluj;
996 
997  flui = 0.5*(i_massflux + fabs(i_massflux));
998  fluj = 0.5*(i_massflux - fabs(i_massflux));
999 
1000  fluxij[0] += iconvp*xcppi*(thetap*(flui*pifri + fluj*pjfri) - imasac*i_massflux*pi);
1001  fluxij[1] += iconvp*xcppj*(thetap*(flui*pifrj + fluj*pjfrj) - imasac*i_massflux*pj);
1002 }
1003 
1004 /*----------------------------------------------------------------------------*/
1022 /*----------------------------------------------------------------------------*/
1023 
1024 inline static void
1025 cs_i_conv_flux_vector(const int iconvp,
1026  const cs_real_t thetap,
1027  const int imasac,
1028  const cs_real_3_t pi,
1029  const cs_real_3_t pj,
1030  const cs_real_3_t pifri,
1031  const cs_real_3_t pifrj,
1032  const cs_real_3_t pjfri,
1033  const cs_real_3_t pjfrj,
1034  const cs_real_t i_massflux,
1035  cs_real_t fluxi[3],
1036  cs_real_t fluxj[3])
1037 {
1038  cs_real_t flui, fluj;
1039 
1040  flui = 0.5*(i_massflux + fabs(i_massflux));
1041  fluj = 0.5*(i_massflux - fabs(i_massflux));
1042 
1043  for (int isou = 0; isou < 3; isou++) {
1044 
1045  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1046  - imasac*i_massflux*pi[isou]);
1047  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1048  - imasac*i_massflux*pj[isou]);
1049  }
1050 }
1051 
1052 /*----------------------------------------------------------------------------*/
1070 /*----------------------------------------------------------------------------*/
1071 
1072 inline static void
1073 cs_i_conv_flux_tensor(const int iconvp,
1074  const cs_real_t thetap,
1075  const int imasac,
1076  const cs_real_6_t pi,
1077  const cs_real_6_t pj,
1078  const cs_real_6_t pifri,
1079  const cs_real_6_t pifrj,
1080  const cs_real_6_t pjfri,
1081  const cs_real_6_t pjfrj,
1082  const cs_real_t i_massflux,
1083  cs_real_t fluxi[6],
1084  cs_real_t fluxj[6])
1085 {
1086  cs_real_t flui, fluj;
1087 
1088  flui = 0.5*(i_massflux + fabs(i_massflux));
1089  fluj = 0.5*(i_massflux - fabs(i_massflux));
1090 
1091  for (int isou = 0; isou < 6; isou++) {
1092  fluxi[isou] += iconvp*( thetap*(flui*pifri[isou] + fluj*pjfri[isou])
1093  - imasac*i_massflux*pi[isou]);
1094  fluxj[isou] += iconvp*( thetap*(flui*pifrj[isou] + fluj*pjfrj[isou])
1095  - imasac*i_massflux*pj[isou]);
1096  }
1097 }
1098 
1099 /*----------------------------------------------------------------------------*/
1112 /*----------------------------------------------------------------------------*/
1113 
1114 inline static void
1115 cs_i_diff_flux(const int idiffp,
1116  const cs_real_t thetap,
1117  const cs_real_t pip,
1118  const cs_real_t pjp,
1119  const cs_real_t pipr,
1120  const cs_real_t pjpr,
1121  const cs_real_t i_visc,
1122  cs_real_2_t fluxij)
1123 {
1124  fluxij[0] += idiffp*thetap*i_visc*(pipr -pjp);
1125  fluxij[1] += idiffp*thetap*i_visc*(pip -pjpr);
1126 }
1127 
1128 /*----------------------------------------------------------------------------*/
1142 /*----------------------------------------------------------------------------*/
1143 
1144 inline static void
1145 cs_i_diff_flux_vector(const int idiffp,
1146  const cs_real_t thetap,
1147  const cs_real_3_t pip,
1148  const cs_real_3_t pjp,
1149  const cs_real_3_t pipr,
1150  const cs_real_3_t pjpr,
1151  const cs_real_t i_visc,
1152  cs_real_t fluxi[3],
1153  cs_real_t fluxj[3])
1154 {
1155  for (int isou = 0; isou < 3; isou++) {
1156  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1157  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1158  }
1159 }
1160 
1161 /*----------------------------------------------------------------------------*/
1175 /*----------------------------------------------------------------------------*/
1176 
1177 inline static void
1178 cs_i_diff_flux_tensor(const int idiffp,
1179  const cs_real_t thetap,
1180  const cs_real_6_t pip,
1181  const cs_real_6_t pjp,
1182  const cs_real_6_t pipr,
1183  const cs_real_6_t pjpr,
1184  const cs_real_t i_visc,
1185  cs_real_t fluxi[6],
1186  cs_real_t fluxj[6])
1187 {
1188  for (int isou = 0; isou < 6; isou++) {
1189  fluxi[isou] += idiffp*thetap*i_visc*(pipr[isou] -pjp[isou]);
1190  fluxj[isou] += idiffp*thetap*i_visc*(pip[isou] -pjpr[isou]);
1191  }
1192 }
1193 
1194 /*----------------------------------------------------------------------------*/
1221 /*----------------------------------------------------------------------------*/
1222 
1223 inline static void
1224 cs_i_cd_steady_upwind(const int ircflp,
1225  const cs_real_t relaxp,
1226  const cs_real_t weight,
1227  const cs_real_3_t cell_ceni,
1228  const cs_real_3_t cell_cenj,
1229  const cs_real_3_t i_face_cog,
1230  const cs_real_3_t dijpf,
1231  const cs_real_3_t gradi,
1232  const cs_real_3_t gradj,
1233  const cs_real_t pi,
1234  const cs_real_t pj,
1235  const cs_real_t pia,
1236  const cs_real_t pja,
1237  cs_real_t *pifri,
1238  cs_real_t *pifrj,
1239  cs_real_t *pjfri,
1240  cs_real_t *pjfrj,
1241  cs_real_t *pip,
1242  cs_real_t *pjp,
1243  cs_real_t *pipr,
1244  cs_real_t *pjpr)
1245 {
1246  cs_real_t pir, pjr;
1247  cs_real_t recoi, recoj;
1248 
1249  cs_i_compute_quantities(ircflp,
1250  weight,
1251  cell_ceni,
1252  cell_cenj,
1253  i_face_cog,
1254  dijpf,
1255  gradi,
1256  gradj,
1257  pi,
1258  pj,
1259  &recoi,
1260  &recoj,
1261  pip,
1262  pjp);
1263 
1264  cs_i_relax_c_val(relaxp,
1265  pia,
1266  pja,
1267  recoi,
1268  recoj,
1269  pi,
1270  pj,
1271  &pir,
1272  &pjr,
1273  pipr,
1274  pjpr);
1275 
1276  cs_upwind_f_val(pi,
1277  pifrj);
1278  cs_upwind_f_val(pir,
1279  pifri);
1280  cs_upwind_f_val(pj,
1281  pjfri);
1282  cs_upwind_f_val(pjr,
1283  pjfrj);
1284 }
1285 
1286 /*----------------------------------------------------------------------------*/
1313 /*----------------------------------------------------------------------------*/
1314 
1315 inline static void
1317  const cs_real_t relaxp,
1318  const cs_real_t weight,
1319  const cs_real_3_t cell_ceni,
1320  const cs_real_3_t cell_cenj,
1321  const cs_real_3_t i_face_cog,
1322  const cs_real_3_t dijpf,
1323  const cs_real_33_t gradi,
1324  const cs_real_33_t gradj,
1325  const cs_real_3_t pi,
1326  const cs_real_3_t pj,
1327  const cs_real_3_t pia,
1328  const cs_real_3_t pja,
1329  cs_real_t pifri[3],
1330  cs_real_t pifrj[3],
1331  cs_real_t pjfri[3],
1332  cs_real_t pjfrj[3],
1333  cs_real_t pip[3],
1334  cs_real_t pjp[3],
1335  cs_real_t pipr[3],
1336  cs_real_t pjpr[3])
1337 {
1338  cs_real_3_t pir, pjr;
1339  cs_real_3_t recoi, recoj;
1340 
1342  weight,
1343  cell_ceni,
1344  cell_cenj,
1345  i_face_cog,
1346  dijpf,
1347  gradi,
1348  gradj,
1349  pi,
1350  pj,
1351  recoi,
1352  recoj,
1353  pip,
1354  pjp);
1355 
1356  cs_i_relax_c_val_vector(relaxp,
1357  pia,
1358  pja,
1359  recoi,
1360  recoj,
1361  pi,
1362  pj,
1363  pir,
1364  pjr,
1365  pipr,
1366  pjpr);
1367 
1369  pifrj);
1371  pifri);
1373  pjfri);
1375  pjfrj);
1376 
1377 }
1378 
1379 /*----------------------------------------------------------------------------*/
1406 /*----------------------------------------------------------------------------*/
1407 
1408 inline static void
1410  const cs_real_t relaxp,
1411  const cs_real_t weight,
1412  const cs_real_3_t cell_ceni,
1413  const cs_real_3_t cell_cenj,
1414  const cs_real_3_t i_face_cog,
1415  const cs_real_3_t dijpf,
1416  const cs_real_63_t gradi,
1417  const cs_real_63_t gradj,
1418  const cs_real_6_t pi,
1419  const cs_real_6_t pj,
1420  const cs_real_6_t pia,
1421  const cs_real_6_t pja,
1422  cs_real_t pifri[6],
1423  cs_real_t pifrj[6],
1424  cs_real_t pjfri[6],
1425  cs_real_t pjfrj[6],
1426  cs_real_t pip[6],
1427  cs_real_t pjp[6],
1428  cs_real_t pipr[6],
1429  cs_real_t pjpr[6])
1430 {
1431  cs_real_6_t pir, pjr;
1432  cs_real_6_t recoi, recoj;
1433 
1435  weight,
1436  cell_ceni,
1437  cell_cenj,
1438  i_face_cog,
1439  dijpf,
1440  gradi,
1441  gradj,
1442  pi,
1443  pj,
1444  recoi,
1445  recoj,
1446  pip,
1447  pjp);
1448 
1449  cs_i_relax_c_val_tensor(relaxp,
1450  pia,
1451  pja,
1452  recoi,
1453  recoj,
1454  pi,
1455  pj,
1456  pir,
1457  pjr,
1458  pipr,
1459  pjpr);
1460 
1462  pifrj);
1464  pifri);
1466  pjfri);
1468  pjfrj);
1469 }
1470 
1471 /*----------------------------------------------------------------------------*/
1491 /*----------------------------------------------------------------------------*/
1492 
1493 inline static void
1494 cs_i_cd_unsteady_upwind(const int ircflp,
1495  const cs_real_t weight,
1496  const cs_real_3_t cell_ceni,
1497  const cs_real_3_t cell_cenj,
1498  const cs_real_3_t i_face_cog,
1499  const cs_real_3_t dijpf,
1500  const cs_real_3_t gradi,
1501  const cs_real_3_t gradj,
1502  const cs_real_t pi,
1503  const cs_real_t pj,
1504  cs_real_t *pif,
1505  cs_real_t *pjf,
1506  cs_real_t *pip,
1507  cs_real_t *pjp)
1508 {
1509  cs_real_t recoi, recoj;
1510 
1511  cs_i_compute_quantities(ircflp,
1512  weight,
1513  cell_ceni,
1514  cell_cenj,
1515  i_face_cog,
1516  dijpf,
1517  gradi,
1518  gradj,
1519  pi,
1520  pj,
1521  &recoi,
1522  &recoj,
1523  pip,
1524  pjp);
1525 
1526  cs_upwind_f_val(pi, pif);
1527  cs_upwind_f_val(pj, pjf);
1528 }
1529 
1530 /*----------------------------------------------------------------------------*/
1550 /*----------------------------------------------------------------------------*/
1551 
1552 inline static void
1554  const cs_real_t weight,
1555  const cs_real_3_t cell_ceni,
1556  const cs_real_3_t cell_cenj,
1557  const cs_real_3_t i_face_cog,
1558  const cs_real_3_t dijpf,
1559  const cs_real_33_t gradi,
1560  const cs_real_33_t gradj,
1561  const cs_real_3_t pi,
1562  const cs_real_3_t pj,
1563  cs_real_t pif[3],
1564  cs_real_t pjf[3],
1565  cs_real_t pip[3],
1566  cs_real_t pjp[3])
1567 {
1568  cs_real_3_t recoi, recoj;
1569 
1571  weight,
1572  cell_ceni,
1573  cell_cenj,
1574  i_face_cog,
1575  dijpf,
1576  gradi,
1577  gradj,
1578  pi,
1579  pj,
1580  recoi,
1581  recoj,
1582  pip,
1583  pjp);
1584 
1585  cs_upwind_f_val_vector(pi, pif);
1586  cs_upwind_f_val_vector(pj, pjf);
1587 
1588 }
1589 
1590 /*----------------------------------------------------------------------------*/
1610 /*----------------------------------------------------------------------------*/
1611 
1612 inline static void
1614  const cs_real_t weight,
1615  const cs_real_3_t cell_ceni,
1616  const cs_real_3_t cell_cenj,
1617  const cs_real_3_t i_face_cog,
1618  const cs_real_3_t dijpf,
1619  const cs_real_63_t gradi,
1620  const cs_real_63_t gradj,
1621  const cs_real_6_t pi,
1622  const cs_real_6_t pj,
1623  cs_real_t pif[6],
1624  cs_real_t pjf[6],
1625  cs_real_t pip[6],
1626  cs_real_t pjp[6])
1627 {
1628  cs_real_6_t recoi, recoj;
1629 
1631  weight,
1632  cell_ceni,
1633  cell_cenj,
1634  i_face_cog,
1635  dijpf,
1636  gradi,
1637  gradj,
1638  pi,
1639  pj,
1640  recoi,
1641  recoj,
1642  pip,
1643  pjp);
1644 
1645  cs_upwind_f_val_tensor(pi, pif);
1646  cs_upwind_f_val_tensor(pj, pjf);
1647 
1648 }
1649 
1650 /*----------------------------------------------------------------------------*/
1682 /*----------------------------------------------------------------------------*/
1683 
1684 inline static void
1685 cs_i_cd_steady(const int ircflp,
1686  const int ischcp,
1687  const double relaxp,
1688  const double blencp,
1689  const cs_real_t weight,
1690  const cs_real_3_t cell_ceni,
1691  const cs_real_3_t cell_cenj,
1692  const cs_real_3_t i_face_cog,
1693  const cs_real_3_t dijpf,
1694  const cs_real_3_t gradi,
1695  const cs_real_3_t gradj,
1696  const cs_real_3_t gradupi,
1697  const cs_real_3_t gradupj,
1698  const cs_real_t pi,
1699  const cs_real_t pj,
1700  const cs_real_t pia,
1701  const cs_real_t pja,
1702  cs_real_t *pifri,
1703  cs_real_t *pifrj,
1704  cs_real_t *pjfri,
1705  cs_real_t *pjfrj,
1706  cs_real_t *pip,
1707  cs_real_t *pjp,
1708  cs_real_t *pipr,
1709  cs_real_t *pjpr)
1710 {
1711  cs_real_t pir, pjr;
1712  cs_real_t recoi, recoj;
1713 
1714  cs_i_compute_quantities(ircflp,
1715  weight,
1716  cell_ceni,
1717  cell_cenj,
1718  i_face_cog,
1719  dijpf,
1720  gradi,
1721  gradj,
1722  pi,
1723  pj,
1724  &recoi,
1725  &recoj,
1726  pip,
1727  pjp);
1728 
1729  cs_i_relax_c_val(relaxp,
1730  pia,
1731  pja,
1732  recoi,
1733  recoj,
1734  pi,
1735  pj,
1736  &pir,
1737  &pjr,
1738  pipr,
1739  pjpr);
1740 
1741  if (ischcp == 1) {
1742 
1743  /* Centered
1744  --------*/
1745 
1746  cs_centered_f_val(weight,
1747  *pip,
1748  *pjpr,
1749  pifrj);
1750  cs_centered_f_val(weight,
1751  *pipr,
1752  *pjp,
1753  pifri);
1754  cs_centered_f_val(weight,
1755  *pipr,
1756  *pjp,
1757  pjfri);
1758  cs_centered_f_val(weight,
1759  *pip,
1760  *pjpr,
1761  pjfrj);
1762 
1763  } else if (ischcp == 0) {
1764 
1765  /* Original SOLU
1766  --------------*/
1767 
1768  cs_solu_f_val(cell_ceni,
1769  i_face_cog,
1770  gradi,
1771  pi,
1772  pifrj);
1773  cs_solu_f_val(cell_ceni,
1774  i_face_cog,
1775  gradi,
1776  pir,
1777  pifri);
1778  cs_solu_f_val(cell_cenj,
1779  i_face_cog,
1780  gradj,
1781  pj,
1782  pjfri);
1783  cs_solu_f_val(cell_cenj,
1784  i_face_cog,
1785  gradj,
1786  pjr,
1787  pjfrj);
1788 
1789  } else {
1790 
1791  /* SOLU
1792  ----*/
1793 
1794  cs_solu_f_val(cell_ceni,
1795  i_face_cog,
1796  gradupi,
1797  pi,
1798  pifrj);
1799  cs_solu_f_val(cell_ceni,
1800  i_face_cog,
1801  gradupi,
1802  pir,
1803  pifri);
1804  cs_solu_f_val(cell_cenj,
1805  i_face_cog,
1806  gradupj,
1807  pj,
1808  pjfri);
1809  cs_solu_f_val(cell_cenj,
1810  i_face_cog,
1811  gradupj,
1812  pjr,
1813  pjfrj);
1814 
1815  }
1816 
1817  /* Blending
1818  --------*/
1819 
1820  cs_blend_f_val(blencp,
1821  pi,
1822  pifrj);
1823  cs_blend_f_val(blencp,
1824  pir,
1825  pifri);
1826  cs_blend_f_val(blencp,
1827  pj,
1828  pjfri);
1829  cs_blend_f_val(blencp,
1830  pjr,
1831  pjfrj);
1832 }
1833 
1834 /*----------------------------------------------------------------------------*/
1864 /*----------------------------------------------------------------------------*/
1865 
1866 inline static void
1867 cs_i_cd_steady_vector(const int ircflp,
1868  const int ischcp,
1869  const double relaxp,
1870  const double blencp,
1871  const cs_real_t weight,
1872  const cs_real_3_t cell_ceni,
1873  const cs_real_3_t cell_cenj,
1874  const cs_real_3_t i_face_cog,
1875  const cs_real_3_t dijpf,
1876  const cs_real_33_t gradi,
1877  const cs_real_33_t gradj,
1878  const cs_real_3_t pi,
1879  const cs_real_3_t pj,
1880  const cs_real_3_t pia,
1881  const cs_real_3_t pja,
1882  cs_real_t pifri[3],
1883  cs_real_t pifrj[3],
1884  cs_real_t pjfri[3],
1885  cs_real_t pjfrj[3],
1886  cs_real_t pip[3],
1887  cs_real_t pjp[3],
1888  cs_real_t pipr[3],
1889  cs_real_t pjpr[3])
1890 {
1891  cs_real_3_t pir, pjr;
1892  cs_real_3_t recoi, recoj;
1893 
1895  weight,
1896  cell_ceni,
1897  cell_cenj,
1898  i_face_cog,
1899  dijpf,
1900  gradi,
1901  gradj,
1902  pi,
1903  pj,
1904  recoi,
1905  recoj,
1906  pip,
1907  pjp);
1908 
1909  cs_i_relax_c_val_vector(relaxp,
1910  pia,
1911  pja,
1912  recoi,
1913  recoj,
1914  pi,
1915  pj,
1916  pir,
1917  pjr,
1918  pipr,
1919  pjpr);
1920 
1921  if (ischcp == 1) {
1922 
1923  /* Centered
1924  --------*/
1925 
1926  cs_centered_f_val_vector(weight,
1927  pip,
1928  pjpr,
1929  pifrj);
1930  cs_centered_f_val_vector(weight,
1931  pipr,
1932  pjp,
1933  pifri);
1934  cs_centered_f_val_vector(weight,
1935  pipr,
1936  pjp,
1937  pjfri);
1938  cs_centered_f_val_vector(weight,
1939  pip,
1940  pjpr,
1941  pjfrj);
1942 
1943  } else {
1944 
1945  /* Second order
1946  ------------*/
1947 
1948  cs_solu_f_val_vector(cell_ceni,
1949  i_face_cog,
1950  gradi,
1951  pi,
1952  pifrj);
1953  cs_solu_f_val_vector(cell_ceni,
1954  i_face_cog,
1955  gradi,
1956  pir,
1957  pifri);
1958  cs_solu_f_val_vector(cell_cenj,
1959  i_face_cog,
1960  gradj,
1961  pj,
1962  pjfri);
1963  cs_solu_f_val_vector(cell_cenj,
1964  i_face_cog,
1965  gradj,
1966  pjr,
1967  pjfrj);
1968 
1969  }
1970 
1971  /* Blending
1972  --------*/
1973  cs_blend_f_val_vector(blencp,
1974  pi,
1975  pifrj);
1976  cs_blend_f_val_vector(blencp,
1977  pir,
1978  pifri);
1979  cs_blend_f_val_vector(blencp,
1980  pj,
1981  pjfri);
1982  cs_blend_f_val_vector(blencp,
1983  pjr,
1984  pjfrj);
1985 
1986 }
1987 
1988 /*----------------------------------------------------------------------------*/
2018 /*----------------------------------------------------------------------------*/
2019 
2020 inline static void
2021 cs_i_cd_steady_tensor(const int ircflp,
2022  const int ischcp,
2023  const double relaxp,
2024  const double blencp,
2025  const cs_real_t weight,
2026  const cs_real_3_t cell_ceni,
2027  const cs_real_3_t cell_cenj,
2028  const cs_real_3_t i_face_cog,
2029  const cs_real_3_t dijpf,
2030  const cs_real_63_t gradi,
2031  const cs_real_63_t gradj,
2032  const cs_real_6_t pi,
2033  const cs_real_6_t pj,
2034  const cs_real_6_t pia,
2035  const cs_real_6_t pja,
2036  cs_real_t pifri[6],
2037  cs_real_t pifrj[6],
2038  cs_real_t pjfri[6],
2039  cs_real_t pjfrj[6],
2040  cs_real_t pip[6],
2041  cs_real_t pjp[6],
2042  cs_real_t pipr[6],
2043  cs_real_t pjpr[6])
2044 
2045 {
2046  cs_real_6_t pir, pjr;
2047  cs_real_6_t recoi, recoj;
2048 
2050  weight,
2051  cell_ceni,
2052  cell_cenj,
2053  i_face_cog,
2054  dijpf,
2055  gradi,
2056  gradj,
2057  pi,
2058  pj,
2059  recoi,
2060  recoj,
2061  pip,
2062  pjp);
2063 
2064  cs_i_relax_c_val_tensor(relaxp,
2065  pia,
2066  pja,
2067  recoi,
2068  recoj,
2069  pi,
2070  pj,
2071  pir,
2072  pjr,
2073  pipr,
2074  pjpr);
2075 
2076  if (ischcp == 1) {
2077 
2078  /* Centered
2079  --------*/
2080 
2081  cs_centered_f_val_tensor(weight,
2082  pip,
2083  pjpr,
2084  pifrj);
2085  cs_centered_f_val_tensor(weight,
2086  pipr,
2087  pjp,
2088  pifri);
2089  cs_centered_f_val_tensor(weight,
2090  pipr,
2091  pjp,
2092  pjfri);
2093  cs_centered_f_val_tensor(weight,
2094  pip,
2095  pjpr,
2096  pjfrj);
2097 
2098  } else {
2099 
2100  /* Second order
2101  ------------*/
2102 
2103  cs_solu_f_val_tensor(cell_ceni,
2104  i_face_cog,
2105  gradi,
2106  pi,
2107  pifrj);
2108  cs_solu_f_val_tensor(cell_ceni,
2109  i_face_cog,
2110  gradi,
2111  pir,
2112  pifri);
2113  cs_solu_f_val_tensor(cell_cenj,
2114  i_face_cog,
2115  gradj,
2116  pj,
2117  pjfri);
2118  cs_solu_f_val_tensor(cell_cenj,
2119  i_face_cog,
2120  gradj,
2121  pjr,
2122  pjfrj);
2123 
2124  }
2125 
2126  /* Blending
2127  --------*/
2128 
2129  cs_blend_f_val_tensor(blencp,
2130  pi,
2131  pifrj);
2132  cs_blend_f_val_tensor(blencp,
2133  pir,
2134  pifri);
2135  cs_blend_f_val_tensor(blencp,
2136  pj,
2137  pjfri);
2138  cs_blend_f_val_tensor(blencp,
2139  pjr,
2140  pjfrj);
2141 
2142 }
2143 
2144 /*----------------------------------------------------------------------------*/
2171 /*----------------------------------------------------------------------------*/
2172 
2173 inline static void
2174 cs_i_cd_unsteady(const int ircflp,
2175  const int ischcp,
2176  const double blencp,
2177  const cs_real_t weight,
2178  const cs_real_3_t cell_ceni,
2179  const cs_real_3_t cell_cenj,
2180  const cs_real_3_t i_face_cog,
2181  const cs_real_3_t dijpf,
2182  const cs_real_3_t gradi,
2183  const cs_real_3_t gradj,
2184  const cs_real_3_t gradupi,
2185  const cs_real_3_t gradupj,
2186  const cs_real_t pi,
2187  const cs_real_t pj,
2188  cs_real_t *pif,
2189  cs_real_t *pjf,
2190  cs_real_t *pip,
2191  cs_real_t *pjp)
2192 {
2193  cs_real_t recoi, recoj;
2194 
2195  cs_i_compute_quantities(ircflp,
2196  weight,
2197  cell_ceni,
2198  cell_cenj,
2199  i_face_cog,
2200  dijpf,
2201  gradi,
2202  gradj,
2203  pi,
2204  pj,
2205  &recoi,
2206  &recoj,
2207  pip,
2208  pjp);
2209 
2210 
2211  if (ischcp == 1) {
2212 
2213  /* Centered
2214  --------*/
2215 
2216  cs_centered_f_val(weight,
2217  *pip,
2218  *pjp,
2219  pif);
2220  cs_centered_f_val(weight,
2221  *pip,
2222  *pjp,
2223  pjf);
2224 
2225  } else if (ischcp == 0) {
2226 
2227  /* Original SOLU
2228  ------------*/
2229 
2230  cs_solu_f_val(cell_ceni,
2231  i_face_cog,
2232  gradi,
2233  pi,
2234  pif);
2235  cs_solu_f_val(cell_cenj,
2236  i_face_cog,
2237  gradj,
2238  pj,
2239  pjf);
2240 
2241  } else {
2242 
2243  /* SOLU
2244  ----*/
2245 
2246  cs_solu_f_val(cell_ceni,
2247  i_face_cog,
2248  gradupi,
2249  pi,
2250  pif);
2251  cs_solu_f_val(cell_cenj,
2252  i_face_cog,
2253  gradupj,
2254  pj,
2255  pjf);
2256 
2257  }
2258 
2259 
2260  /* Blending
2261  --------*/
2262 
2263  cs_blend_f_val(blencp,
2264  pi,
2265  pif);
2266  cs_blend_f_val(blencp,
2267  pj,
2268  pjf);
2269 }
2270 
2271 /*----------------------------------------------------------------------------*/
2296 /*----------------------------------------------------------------------------*/
2297 
2298 inline static void
2299 cs_i_cd_unsteady_vector(const int ircflp,
2300  const int ischcp,
2301  const double blencp,
2302  const cs_real_t weight,
2303  const cs_real_3_t cell_ceni,
2304  const cs_real_3_t cell_cenj,
2305  const cs_real_3_t i_face_cog,
2306  const cs_real_t hybrid_blend_i,
2307  const cs_real_t hybrid_blend_j,
2308  const cs_real_3_t dijpf,
2309  const cs_real_33_t gradi,
2310  const cs_real_33_t gradj,
2311  const cs_real_3_t pi,
2312  const cs_real_3_t pj,
2313  cs_real_t pif[3],
2314  cs_real_t pjf[3],
2315  cs_real_t pip[3],
2316  cs_real_t pjp[3])
2317 
2318 {
2319  cs_real_3_t recoi, recoj;
2320 
2322  weight,
2323  cell_ceni,
2324  cell_cenj,
2325  i_face_cog,
2326  dijpf,
2327  gradi,
2328  gradj,
2329  pi,
2330  pj,
2331  recoi,
2332  recoj,
2333  pip,
2334  pjp);
2335 
2336  if (ischcp == 1) {
2337 
2338  /* Centered
2339  --------*/
2340 
2341  cs_centered_f_val_vector(weight,
2342  pip,
2343  pjp,
2344  pif);
2345  cs_centered_f_val_vector(weight,
2346  pip,
2347  pjp,
2348  pjf);
2349  } else if (ischcp ==3) {
2350 
2351  /* Centered
2352  --------*/
2353 
2354  cs_centered_f_val_vector(weight,
2355  pip,
2356  pjp,
2357  pif);
2358  cs_centered_f_val_vector(weight,
2359  pip,
2360  pjp,
2361  pjf);
2362 
2363  /* SOLU
2364  -----*/
2365  cs_real_t pif_up[3], pjf_up[3];
2366  cs_real_t hybrid_blend_interp;
2367 
2368  cs_solu_f_val_vector(cell_ceni,
2369  i_face_cog,
2370  gradi,
2371  pi,
2372  pif_up);
2373  cs_solu_f_val_vector(cell_cenj,
2374  i_face_cog,
2375  gradj,
2376  pj,
2377  pjf_up);
2378 
2379  for (int isou = 0; isou < 3; isou++) {
2380  hybrid_blend_interp = fmin(hybrid_blend_i,hybrid_blend_j);
2381  pif[isou] = hybrid_blend_interp*pif[isou] + (1. - hybrid_blend_interp)*pif_up[isou];
2382  pjf[isou] = hybrid_blend_interp*pjf[isou] + (1. - hybrid_blend_interp)*pjf_up[isou];
2383  }
2384  } else {
2385 
2386  /* Second order
2387  ------------*/
2388 
2389  cs_solu_f_val_vector(cell_ceni,
2390  i_face_cog,
2391  gradi,
2392  pi,
2393  pif);
2394  cs_solu_f_val_vector(cell_cenj,
2395  i_face_cog,
2396  gradj,
2397  pj,
2398  pjf);
2399 
2400  }
2401 
2402  /* Blending
2403  --------*/
2404 
2405  cs_blend_f_val_vector(blencp,
2406  pi,
2407  pif);
2408  cs_blend_f_val_vector(blencp,
2409  pj,
2410  pjf);
2411 }
2412 
2413 /*----------------------------------------------------------------------------*/
2436 /*----------------------------------------------------------------------------*/
2437 
2438 inline static void
2439 cs_i_cd_unsteady_tensor(const int ircflp,
2440  const int ischcp,
2441  const double blencp,
2442  const cs_real_t weight,
2443  const cs_real_3_t cell_ceni,
2444  const cs_real_3_t cell_cenj,
2445  const cs_real_3_t i_face_cog,
2446  const cs_real_3_t dijpf,
2447  const cs_real_63_t gradi,
2448  const cs_real_63_t gradj,
2449  const cs_real_6_t pi,
2450  const cs_real_6_t pj,
2451  cs_real_t pif[6],
2452  cs_real_t pjf[6],
2453  cs_real_t pip[6],
2454  cs_real_t pjp[6])
2455 
2456 {
2457  cs_real_6_t recoi, recoj;
2458 
2460  weight,
2461  cell_ceni,
2462  cell_cenj,
2463  i_face_cog,
2464  dijpf,
2465  gradi,
2466  gradj,
2467  pi,
2468  pj,
2469  recoi,
2470  recoj,
2471  pip,
2472  pjp);
2473 
2474  if (ischcp == 1) {
2475 
2476  /* Centered
2477  --------*/
2478 
2479  cs_centered_f_val_tensor(weight,
2480  pip,
2481  pjp,
2482  pif);
2483  cs_centered_f_val_tensor(weight,
2484  pip,
2485  pjp,
2486  pjf);
2487 
2488  } else {
2489 
2490  /* Second order
2491  ------------*/
2492 
2493  cs_solu_f_val_tensor(cell_ceni,
2494  i_face_cog,
2495  gradi,
2496  pi,
2497  pif);
2498  cs_solu_f_val_tensor(cell_cenj,
2499  i_face_cog,
2500  gradj,
2501  pj,
2502  pjf);
2503 
2504  }
2505 
2506  /* Blending
2507  --------*/
2508 
2509  cs_blend_f_val_tensor(blencp,
2510  pi,
2511  pif);
2512  cs_blend_f_val_tensor(blencp,
2513  pj,
2514  pjf);
2515 
2516 }
2517 
2518 /*----------------------------------------------------------------------------*/
2561 /*----------------------------------------------------------------------------*/
2562 
2563 inline static void
2564 cs_i_cd_steady_slope_test(bool *upwind_switch,
2565  const int iconvp,
2566  const int ircflp,
2567  const int ischcp,
2568  const double relaxp,
2569  const double blencp,
2570  const double blend_st,
2571  const cs_real_t weight,
2572  const cs_real_t i_dist,
2573  const cs_real_t i_face_surf,
2574  const cs_real_3_t cell_ceni,
2575  const cs_real_3_t cell_cenj,
2576  const cs_real_3_t i_face_normal,
2577  const cs_real_3_t i_face_cog,
2578  const cs_real_3_t dijpf,
2579  const cs_real_t i_massflux,
2580  const cs_real_3_t gradi,
2581  const cs_real_3_t gradj,
2582  const cs_real_3_t gradupi,
2583  const cs_real_3_t gradupj,
2584  const cs_real_3_t gradsti,
2585  const cs_real_3_t gradstj,
2586  const cs_real_t pi,
2587  const cs_real_t pj,
2588  const cs_real_t pia,
2589  const cs_real_t pja,
2590  cs_real_t *pifri,
2591  cs_real_t *pifrj,
2592  cs_real_t *pjfri,
2593  cs_real_t *pjfrj,
2594  cs_real_t *pip,
2595  cs_real_t *pjp,
2596  cs_real_t *pipr,
2597  cs_real_t *pjpr)
2598 {
2599  cs_real_t pir, pjr;
2600  cs_real_t recoi, recoj;
2601  cs_real_t distf, srfan, testij, tesqck;
2602 
2603  distf = i_dist;
2604  srfan = i_face_surf;
2605 
2606  *upwind_switch = false;
2607 
2608  cs_i_compute_quantities(ircflp,
2609  weight,
2610  cell_ceni,
2611  cell_cenj,
2612  i_face_cog,
2613  dijpf,
2614  gradi,
2615  gradj,
2616  pi,
2617  pj,
2618  &recoi,
2619  &recoj,
2620  pip,
2621  pjp);
2622 
2623  cs_i_relax_c_val(relaxp,
2624  pia,
2625  pja,
2626  recoi,
2627  recoj,
2628  pi,
2629  pj,
2630  &pir,
2631  &pjr,
2632  pipr,
2633  pjpr);
2634 
2635  /* Convection slope test is needed only when iconv >0 */
2636  if (iconvp > 0) {
2637  cs_slope_test(pi,
2638  pj,
2639  distf,
2640  srfan,
2641  i_face_normal,
2642  gradi,
2643  gradj,
2644  gradsti,
2645  gradstj,
2646  i_massflux,
2647  &testij,
2648  &tesqck);
2649 
2650  if (ischcp==1) {
2651 
2652  /* Centered
2653  --------*/
2654 
2655  cs_centered_f_val(weight,
2656  *pip,
2657  *pjpr,
2658  pifrj);
2659  cs_centered_f_val(weight,
2660  *pipr,
2661  *pjp,
2662  pifri);
2663  cs_centered_f_val(weight,
2664  *pipr,
2665  *pjp,
2666  pjfri);
2667  cs_centered_f_val(weight,
2668  *pip,
2669  *pjpr,
2670  pjfrj);
2671 
2672  } else if (ischcp == 0) {
2673 
2674  /* Second order
2675  ------------*/
2676 
2677  cs_solu_f_val(cell_ceni,
2678  i_face_cog,
2679  gradi,
2680  pi,
2681  pifrj);
2682  cs_solu_f_val(cell_ceni,
2683  i_face_cog,
2684  gradi,
2685  pir,
2686  pifri);
2687  cs_solu_f_val(cell_cenj,
2688  i_face_cog,
2689  gradj,
2690  pj,
2691  pjfri);
2692  cs_solu_f_val(cell_cenj,
2693  i_face_cog,
2694  gradj,
2695  pjr,
2696  pjfrj);
2697 
2698  } else {
2699 
2700  /* SOLU
2701  -----*/
2702 
2703  cs_solu_f_val(cell_ceni,
2704  i_face_cog,
2705  gradupi,
2706  pi,
2707  pifrj);
2708  cs_solu_f_val(cell_ceni,
2709  i_face_cog,
2710  gradupi,
2711  pir,
2712  pifri);
2713  cs_solu_f_val(cell_cenj,
2714  i_face_cog,
2715  gradupj,
2716  pj,
2717  pjfri);
2718  cs_solu_f_val(cell_cenj,
2719  i_face_cog,
2720  gradupj,
2721  pjr,
2722  pjfrj);
2723  }
2724 
2725 
2726  /* Slope test: Pourcentage of upwind
2727  ----------------------------------*/
2728 
2729  if (tesqck <= 0. || testij <= 0.) {
2730 
2731  cs_blend_f_val(blend_st,
2732  pi,
2733  pifrj);
2734  cs_blend_f_val(blend_st,
2735  pir,
2736  pifri);
2737  cs_blend_f_val(blend_st,
2738  pj,
2739  pjfri);
2740  cs_blend_f_val(blend_st,
2741  pjr,
2742  pjfrj);
2743 
2744  *upwind_switch = true;
2745 
2746  }
2747 
2748 
2749  /* Blending
2750  --------*/
2751 
2752  cs_blend_f_val(blencp,
2753  pi,
2754  pifrj);
2755  cs_blend_f_val(blencp,
2756  pir,
2757  pifri);
2758  cs_blend_f_val(blencp,
2759  pj,
2760  pjfri);
2761  cs_blend_f_val(blencp,
2762  pjr,
2763  pjfrj);
2764 
2765  /* If iconv=0 p*fr* are useless */
2766  } else {
2767  cs_upwind_f_val(pi,
2768  pifrj);
2769  cs_upwind_f_val(pir,
2770  pifri);
2771  cs_upwind_f_val(pj,
2772  pjfri);
2773  cs_upwind_f_val(pjr,
2774  pjfrj);
2775  }
2776 
2777 }
2778 
2779 /*----------------------------------------------------------------------------*/
2817 /*----------------------------------------------------------------------------*/
2818 
2819 inline static void
2821  const int iconvp,
2822  const int ircflp,
2823  const int ischcp,
2824  const double relaxp,
2825  const double blencp,
2826  const cs_real_t weight,
2827  const cs_real_t i_dist,
2828  const cs_real_t i_face_surf,
2829  const cs_real_3_t cell_ceni,
2830  const cs_real_3_t cell_cenj,
2831  const cs_real_3_t i_face_normal,
2832  const cs_real_3_t i_face_cog,
2833  const cs_real_3_t dijpf,
2834  const cs_real_t i_massflux,
2835  const cs_real_33_t gradi,
2836  const cs_real_33_t gradj,
2837  const cs_real_33_t grdpai,
2838  const cs_real_33_t grdpaj,
2839  const cs_real_3_t pi,
2840  const cs_real_3_t pj,
2841  const cs_real_3_t pia,
2842  const cs_real_3_t pja,
2843  cs_real_t pifri[3],
2844  cs_real_t pifrj[3],
2845  cs_real_t pjfri[3],
2846  cs_real_t pjfrj[3],
2847  cs_real_t pip[3],
2848  cs_real_t pjp[3],
2849  cs_real_t pipr[3],
2850  cs_real_t pjpr[3])
2851 {
2852  cs_real_3_t pir, pjr;
2853  cs_real_3_t recoi, recoj;
2854  cs_real_t distf, srfan;
2855  cs_real_3_t testij, tesqck;
2856  int isou;
2857 
2858  distf = i_dist;
2859  srfan = i_face_surf;
2860 
2862  weight,
2863  cell_ceni,
2864  cell_cenj,
2865  i_face_cog,
2866  dijpf,
2867  gradi,
2868  gradj,
2869  pi,
2870  pj,
2871  recoi,
2872  recoj,
2873  pip,
2874  pjp);
2875 
2876  cs_i_relax_c_val_vector(relaxp,
2877  pia,
2878  pja,
2879  recoi,
2880  recoj,
2881  pi,
2882  pj,
2883  pir,
2884  pjr,
2885  pipr,
2886  pjpr);
2887 
2888  /* Convection slope test is needed only when iconv >0 */
2889  if (iconvp > 0) {
2891  pj,
2892  distf,
2893  srfan,
2894  i_face_normal,
2895  gradi,
2896  gradj,
2897  grdpai,
2898  grdpaj,
2899  i_massflux,
2900  testij,
2901  tesqck);
2902 
2903  for (isou = 0; isou < 3; isou++) {
2904  if (tesqck[isou]<=0. || testij[isou]<=0.) {
2905 
2906  /* Upwind
2907  --------*/
2908 
2909  cs_upwind_f_val(pi[isou],
2910  &pifrj[isou]);
2911  cs_upwind_f_val(pir[isou],
2912  &pifri[isou]);
2913  cs_upwind_f_val(pj[isou],
2914  &pjfri[isou]);
2915  cs_upwind_f_val(pjr[isou],
2916  &pjfrj[isou]);
2917 
2918  *upwind_switch = true;
2919 
2920  } else {
2921 
2922  if (ischcp==1) {
2923 
2924  /* Centered
2925  --------*/
2926 
2927  cs_centered_f_val(weight,
2928  pip[isou],
2929  pjpr[isou],
2930  &pifrj[isou]);
2931  cs_centered_f_val(weight,
2932  pipr[isou],
2933  pjp[isou],
2934  &pifri[isou]);
2935  cs_centered_f_val(weight,
2936  pipr[isou],
2937  pjp[isou],
2938  &pjfri[isou]);
2939  cs_centered_f_val(weight,
2940  pip[isou],
2941  pjpr[isou],
2942  &pjfrj[isou]);
2943 
2944  } else {
2945 
2946  /* Second order
2947  ------------*/
2948 
2949  cs_solu_f_val(cell_ceni,
2950  i_face_cog,
2951  gradi[isou],
2952  pi[isou],
2953  &pifrj[isou]);
2954  cs_solu_f_val(cell_ceni,
2955  i_face_cog,
2956  gradi[isou],
2957  pir[isou],
2958  &pifri[isou]);
2959  cs_solu_f_val(cell_cenj,
2960  i_face_cog,
2961  gradj[isou],
2962  pj[isou],
2963  &pjfri[isou]);
2964  cs_solu_f_val(cell_cenj,
2965  i_face_cog,
2966  gradj[isou],
2967  pjr[isou],
2968  &pjfrj[isou]);
2969 
2970  }
2971  }
2972  }
2973 
2974  /* Blending
2975  --------*/
2976  cs_blend_f_val_vector(blencp,
2977  pi,
2978  pifrj);
2979  cs_blend_f_val_vector(blencp,
2980  pir,
2981  pifri);
2982  cs_blend_f_val_vector(blencp,
2983  pj,
2984  pjfri);
2985  cs_blend_f_val_vector(blencp,
2986  pjr,
2987  pjfrj);
2988 
2989  /* If iconv=0 p*fr* are useless */
2990  } else {
2991  for (isou = 0; isou < 3; isou++) {
2992  cs_upwind_f_val(pi[isou],
2993  &pifrj[isou]);
2994  cs_upwind_f_val(pir[isou],
2995  &pifri[isou]);
2996  cs_upwind_f_val(pj[isou],
2997  &pjfri[isou]);
2998  cs_upwind_f_val(pjr[isou],
2999  &pjfrj[isou]);
3000  }
3001  }
3002 
3003 }
3004 
3005 /*----------------------------------------------------------------------------*/
3046 /*----------------------------------------------------------------------------*/
3047 
3048 inline static void
3050  const int iconvp,
3051  const int ircflp,
3052  const int ischcp,
3053  const double relaxp,
3054  const double blencp,
3055  const double blend_st,
3056  const cs_real_t weight,
3057  const cs_real_t i_dist,
3058  const cs_real_t i_face_surf,
3059  const cs_real_3_t cell_ceni,
3060  const cs_real_3_t cell_cenj,
3061  const cs_real_3_t i_face_normal,
3062  const cs_real_3_t i_face_cog,
3063  const cs_real_3_t dijpf,
3064  const cs_real_t i_massflux,
3065  const cs_real_33_t gradi,
3066  const cs_real_33_t gradj,
3067  const cs_real_33_t grdpai,
3068  const cs_real_33_t grdpaj,
3069  const cs_real_3_t pi,
3070  const cs_real_3_t pj,
3071  const cs_real_3_t pia,
3072  const cs_real_3_t pja,
3073  cs_real_t pifri[3],
3074  cs_real_t pifrj[3],
3075  cs_real_t pjfri[3],
3076  cs_real_t pjfrj[3],
3077  cs_real_t pip[3],
3078  cs_real_t pjp[3],
3079  cs_real_t pipr[3],
3080  cs_real_t pjpr[3])
3081 {
3082  cs_real_3_t pir, pjr;
3083  cs_real_3_t recoi, recoj;
3084  cs_real_t distf, srfan;
3085  cs_real_t testij, tesqck;
3086  int isou;
3087 
3088  distf = i_dist;
3089  srfan = i_face_surf;
3090 
3092  weight,
3093  cell_ceni,
3094  cell_cenj,
3095  i_face_cog,
3096  dijpf,
3097  gradi,
3098  gradj,
3099  pi,
3100  pj,
3101  recoi,
3102  recoj,
3103  pip,
3104  pjp);
3105 
3106  cs_i_relax_c_val_vector(relaxp,
3107  pia,
3108  pja,
3109  recoi,
3110  recoj,
3111  pi,
3112  pj,
3113  pir,
3114  pjr,
3115  pipr,
3116  pjpr);
3117 
3118  /* Convection slope test is needed only when iconv >0 */
3119  if (iconvp > 0) {
3121  pj,
3122  distf,
3123  srfan,
3124  i_face_normal,
3125  gradi,
3126  gradj,
3127  grdpai,
3128  grdpaj,
3129  i_massflux,
3130  &testij,
3131  &tesqck);
3132 
3133  for (isou = 0; isou < 3; isou++) {
3134  if (ischcp==1) {
3135 
3136  /* Centered
3137  --------*/
3138 
3139  cs_centered_f_val(weight,
3140  pip[isou],
3141  pjpr[isou],
3142  &pifrj[isou]);
3143  cs_centered_f_val(weight,
3144  pipr[isou],
3145  pjp[isou],
3146  &pifri[isou]);
3147  cs_centered_f_val(weight,
3148  pipr[isou],
3149  pjp[isou],
3150  &pjfri[isou]);
3151  cs_centered_f_val(weight,
3152  pip[isou],
3153  pjpr[isou],
3154  &pjfrj[isou]);
3155 
3156  } else {
3157 
3158  /* Second order
3159  ------------*/
3160 
3161  cs_solu_f_val(cell_ceni,
3162  i_face_cog,
3163  gradi[isou],
3164  pi[isou],
3165  &pifrj[isou]);
3166  cs_solu_f_val(cell_ceni,
3167  i_face_cog,
3168  gradi[isou],
3169  pir[isou],
3170  &pifri[isou]);
3171  cs_solu_f_val(cell_cenj,
3172  i_face_cog,
3173  gradj[isou],
3174  pj[isou],
3175  &pjfri[isou]);
3176  cs_solu_f_val(cell_cenj,
3177  i_face_cog,
3178  gradj[isou],
3179  pjr[isou],
3180  &pjfrj[isou]);
3181 
3182  }
3183 
3184  }
3185 
3186  /* Slope test: Pourcentage of upwind
3187  ----------------------------------*/
3188 
3189  if (tesqck <= 0. || testij <= 0.) {
3190  cs_blend_f_val_vector(blend_st,
3191  pi,
3192  pifrj);
3193  cs_blend_f_val_vector(blend_st,
3194  pir,
3195  pifri);
3196  cs_blend_f_val_vector(blend_st,
3197  pj,
3198  pjfri);
3199  cs_blend_f_val_vector(blend_st,
3200  pjr,
3201  pjfrj);
3202 
3203  *upwind_switch = true;
3204  }
3205 
3206 
3207  /* Blending
3208  --------*/
3209  cs_blend_f_val_vector(blencp,
3210  pi,
3211  pifrj);
3212  cs_blend_f_val_vector(blencp,
3213  pir,
3214  pifri);
3215  cs_blend_f_val_vector(blencp,
3216  pj,
3217  pjfri);
3218  cs_blend_f_val_vector(blencp,
3219  pjr,
3220  pjfrj);
3221 
3222  /* If iconv=0 p*fr* are useless */
3223  } else {
3224  for (isou = 0; isou < 3; isou++) {
3225  cs_upwind_f_val(pi[isou],
3226  &pifrj[isou]);
3227  cs_upwind_f_val(pir[isou],
3228  &pifri[isou]);
3229  cs_upwind_f_val(pj[isou],
3230  &pjfri[isou]);
3231  cs_upwind_f_val(pjr[isou],
3232  &pjfrj[isou]);
3233  }
3234  }
3235 
3236 }
3237 
3238 /*----------------------------------------------------------------------------*/
3279 /*----------------------------------------------------------------------------*/
3280 
3281 inline static void
3283  const int iconvp,
3284  const int ircflp,
3285  const int ischcp,
3286  const double relaxp,
3287  const double blencp,
3288  const double blend_st,
3289  const cs_real_t weight,
3290  const cs_real_t i_dist,
3291  const cs_real_t i_face_surf,
3292  const cs_real_3_t cell_ceni,
3293  const cs_real_3_t cell_cenj,
3294  const cs_real_3_t i_face_normal,
3295  const cs_real_3_t i_face_cog,
3296  const cs_real_3_t dijpf,
3297  const cs_real_t i_massflux,
3298  const cs_real_63_t gradi,
3299  const cs_real_63_t gradj,
3300  const cs_real_63_t grdpai,
3301  const cs_real_63_t grdpaj,
3302  const cs_real_6_t pi,
3303  const cs_real_6_t pj,
3304  const cs_real_6_t pia,
3305  const cs_real_6_t pja,
3306  cs_real_t pifri[6],
3307  cs_real_t pifrj[6],
3308  cs_real_t pjfri[6],
3309  cs_real_t pjfrj[6],
3310  cs_real_t pip[6],
3311  cs_real_t pjp[6],
3312  cs_real_t pipr[6],
3313  cs_real_t pjpr[6])
3314 {
3315  cs_real_6_t pir, pjr;
3316  cs_real_6_t recoi, recoj;
3317  cs_real_t distf, srfan;
3318  cs_real_t testij, tesqck;
3319  int isou;
3320 
3321  distf = i_dist;
3322  srfan = i_face_surf;
3323 
3325  weight,
3326  cell_ceni,
3327  cell_cenj,
3328  i_face_cog,
3329  dijpf,
3330  gradi,
3331  gradj,
3332  pi,
3333  pj,
3334  recoi,
3335  recoj,
3336  pip,
3337  pjp);
3338 
3339  cs_i_relax_c_val_tensor(relaxp,
3340  pia,
3341  pja,
3342  recoi,
3343  recoj,
3344  pi,
3345  pj,
3346  pir,
3347  pjr,
3348  pipr,
3349  pjpr);
3350 
3351  /* Convection slope test is needed only when iconv >0 */
3352  if (iconvp > 0) {
3354  pj,
3355  distf,
3356  srfan,
3357  i_face_normal,
3358  gradi,
3359  gradj,
3360  grdpai,
3361  grdpaj,
3362  i_massflux,
3363  &testij,
3364  &tesqck);
3365 
3366  for (isou = 0; isou < 6; isou++) {
3367  if (ischcp==1) {
3368 
3369  /* Centered
3370  --------*/
3371 
3372  cs_centered_f_val(weight,
3373  pip[isou],
3374  pjpr[isou],
3375  &pifrj[isou]);
3376  cs_centered_f_val(weight,
3377  pipr[isou],
3378  pjp[isou],
3379  &pifri[isou]);
3380  cs_centered_f_val(weight,
3381  pipr[isou],
3382  pjp[isou],
3383  &pjfri[isou]);
3384  cs_centered_f_val(weight,
3385  pip[isou],
3386  pjpr[isou],
3387  &pjfrj[isou]);
3388 
3389  } else {
3390 
3391  /* Second order
3392  ------------*/
3393 
3394  cs_solu_f_val(cell_ceni,
3395  i_face_cog,
3396  gradi[isou],
3397  pi[isou],
3398  &pifrj[isou]);
3399  cs_solu_f_val(cell_ceni,
3400  i_face_cog,
3401  gradi[isou],
3402  pir[isou],
3403  &pifri[isou]);
3404  cs_solu_f_val(cell_cenj,
3405  i_face_cog,
3406  gradj[isou],
3407  pj[isou],
3408  &pjfri[isou]);
3409  cs_solu_f_val(cell_cenj,
3410  i_face_cog,
3411  gradj[isou],
3412  pjr[isou],
3413  &pjfrj[isou]);
3414 
3415  }
3416 
3417  }
3418 
3419  /* Slope test: Pourcentage of upwind
3420  ----------------------------------*/
3421 
3422  if (tesqck <= 0. || testij <= 0.) {
3423 
3424  cs_blend_f_val_tensor(blend_st,
3425  pi,
3426  pifrj);
3427  cs_blend_f_val_tensor(blend_st,
3428  pir,
3429  pifri);
3430  cs_blend_f_val_tensor(blend_st,
3431  pj,
3432  pjfri);
3433  cs_blend_f_val_tensor(blend_st,
3434  pjr,
3435  pjfrj);
3436 
3437  *upwind_switch = true;
3438 
3439  }
3440 
3441 
3442  /* Blending
3443  --------*/
3444 
3445  cs_blend_f_val_tensor(blencp,
3446  pi,
3447  pifrj);
3448  cs_blend_f_val_tensor(blencp,
3449  pir,
3450  pifri);
3451  cs_blend_f_val_tensor(blencp,
3452  pj,
3453  pjfri);
3454  cs_blend_f_val_tensor(blencp,
3455  pjr,
3456  pjfrj);
3457 
3458  /* If iconv=0 p*fr* are useless */
3459  } else {
3460  for (isou = 0; isou < 6; isou++) {
3461  cs_upwind_f_val(pi[isou],
3462  &pifrj[isou]);
3463  cs_upwind_f_val(pir[isou],
3464  &pifri[isou]);
3465  cs_upwind_f_val(pj[isou],
3466  &pjfri[isou]);
3467  cs_upwind_f_val(pjr[isou],
3468  &pjfrj[isou]);
3469  }
3470  }
3471 
3472 }
3473 
3474 /*----------------------------------------------------------------------------*/
3510 /*----------------------------------------------------------------------------*/
3511 
3512 inline static void
3513 cs_i_cd_unsteady_slope_test(bool *upwind_switch,
3514  const int iconvp,
3515  const int ircflp,
3516  const int ischcp,
3517  const double blencp,
3518  const double blend_st,
3519  const cs_real_t weight,
3520  const cs_real_t i_dist,
3521  const cs_real_t i_face_surf,
3522  const cs_real_3_t cell_ceni,
3523  const cs_real_3_t cell_cenj,
3524  const cs_real_3_t i_face_normal,
3525  const cs_real_3_t i_face_cog,
3526  const cs_real_3_t dijpf,
3527  const cs_real_t i_massflux,
3528  const cs_real_3_t gradi,
3529  const cs_real_3_t gradj,
3530  const cs_real_3_t gradupi,
3531  const cs_real_3_t gradupj,
3532  const cs_real_3_t gradsti,
3533  const cs_real_3_t gradstj,
3534  const cs_real_t pi,
3535  const cs_real_t pj,
3536  cs_real_t *pif,
3537  cs_real_t *pjf,
3538  cs_real_t *pip,
3539  cs_real_t *pjp)
3540 {
3541  CS_UNUSED(blend_st);
3542 
3543  cs_real_t recoi, recoj;
3544  cs_real_t distf, srfan, testij, tesqck;
3545 
3546  distf = i_dist;
3547  srfan = i_face_surf;
3548 
3549  *upwind_switch = false;
3550 
3551  cs_i_compute_quantities(ircflp,
3552  weight,
3553  cell_ceni,
3554  cell_cenj,
3555  i_face_cog,
3556  dijpf,
3557  gradi,
3558  gradj,
3559  pi,
3560  pj,
3561  &recoi,
3562  &recoj,
3563  pip,
3564  pjp);
3565 
3566  /* Convection slope test is needed only when iconv >0 */
3567  if (iconvp > 0) {
3568  cs_slope_test(pi,
3569  pj,
3570  distf,
3571  srfan,
3572  i_face_normal,
3573  gradi,
3574  gradj,
3575  gradsti,
3576  gradstj,
3577  i_massflux,
3578  &testij,
3579  &tesqck);
3580 
3581  if (ischcp==1) {
3582 
3583  /* Centered
3584  --------*/
3585 
3586  cs_centered_f_val(weight,
3587  *pip,
3588  *pjp,
3589  pif);
3590  cs_centered_f_val(weight,
3591  *pip,
3592  *pjp,
3593  pjf);
3594 
3595  } else if (ischcp == 0) {
3596 
3597  /* Original SOLU
3598  --------------*/
3599 
3600  cs_solu_f_val(cell_ceni,
3601  i_face_cog,
3602  gradi,
3603  pi,
3604  pif);
3605  cs_solu_f_val(cell_cenj,
3606  i_face_cog,
3607  gradj,
3608  pj,
3609  pjf);
3610 
3611  } else {
3612 
3613  /* SOLU
3614  -----*/
3615 
3616  cs_solu_f_val(cell_ceni,
3617  i_face_cog,
3618  gradupi,
3619  pi,
3620  pif);
3621  cs_solu_f_val(cell_cenj,
3622  i_face_cog,
3623  gradupj,
3624  pj,
3625  pjf);
3626 
3627  }
3628 
3629  /* Slope test: Pourcentage of upwind
3630  ----------------------------------*/
3631 
3632  if (tesqck<=0. || testij<=0.) {
3633 
3634  cs_blend_f_val(blend_st,
3635  pi,
3636  pif);
3637  cs_blend_f_val(blend_st,
3638  pj,
3639  pjf);
3640 
3641  *upwind_switch = true;
3642 
3643  }
3644 
3645  /* Blending
3646  --------*/
3647 
3648  cs_blend_f_val(blencp,
3649  pi,
3650  pif);
3651  cs_blend_f_val(blencp,
3652  pj,
3653  pjf);
3654 
3655  /* If iconv=0 p*f are useless */
3656  } else {
3657  cs_upwind_f_val(pi,
3658  pif);
3659  cs_upwind_f_val(pj,
3660  pjf);
3661  }
3662 
3663 }
3664 
3665 /*----------------------------------------------------------------------------*/
3696 /*----------------------------------------------------------------------------*/
3697 
3698 inline static void
3700  const int iconvp,
3701  const int ircflp,
3702  const int ischcp,
3703  const double blencp,
3704  const cs_real_t weight,
3705  const cs_real_t i_dist,
3706  const cs_real_t i_face_surf,
3707  const cs_real_3_t cell_ceni,
3708  const cs_real_3_t cell_cenj,
3709  const cs_real_3_t i_face_normal,
3710  const cs_real_3_t i_face_cog,
3711  const cs_real_3_t dijpf,
3712  const cs_real_t i_massflux,
3713  const cs_real_33_t gradi,
3714  const cs_real_33_t gradj,
3715  const cs_real_33_t grdpai,
3716  const cs_real_33_t grdpaj,
3717  const cs_real_3_t pi,
3718  const cs_real_3_t pj,
3719  cs_real_t pif[3],
3720  cs_real_t pjf[3],
3721  cs_real_t pip[3],
3722  cs_real_t pjp[3])
3723 {
3724  cs_real_3_t recoi, recoj;
3725  cs_real_t distf, srfan;
3726  cs_real_3_t testij, tesqck;
3727  int isou;
3728 
3729  distf = i_dist;
3730  srfan = i_face_surf;
3731 
3733  weight,
3734  cell_ceni,
3735  cell_cenj,
3736  i_face_cog,
3737  dijpf,
3738  gradi,
3739  gradj,
3740  pi,
3741  pj,
3742  recoi,
3743  recoj,
3744  pip,
3745  pjp);
3746 
3747  /* Convection slope test is needed only when iconv >0 */
3748  if (iconvp > 0) {
3750  pj,
3751  distf,
3752  srfan,
3753  i_face_normal,
3754  gradi,
3755  gradj,
3756  grdpai,
3757  grdpaj,
3758  i_massflux,
3759  testij,
3760  tesqck);
3761 
3762  /* FIXME: slope test should be done for the vector and not component by
3763  * component. This is conserved for compatibility only. */
3764  for (isou = 0; isou < 3; isou++) {
3765  if (tesqck[isou]<=0. || testij[isou]<=0.) {
3766 
3767  /* Upwind
3768  --------*/
3769 
3770  cs_upwind_f_val(pi[isou],
3771  &pif[isou]);
3772  cs_upwind_f_val(pj[isou],
3773  &pjf[isou]);
3774 
3775  *upwind_switch = true;
3776 
3777  } else {
3778 
3779  if (ischcp==1) {
3780 
3781  /* Centered
3782  --------*/
3783 
3784  cs_centered_f_val(weight,
3785  pip[isou],
3786  pjp[isou],
3787  &pif[isou]);
3788  cs_centered_f_val(weight,
3789  pip[isou],
3790  pjp[isou],
3791  &pjf[isou]);
3792 
3793  } else {
3794 
3795  /* Second order
3796  ------------*/
3797 
3798  cs_solu_f_val(cell_ceni,
3799  i_face_cog,
3800  gradi[isou],
3801  pi[isou],
3802  &pif[isou]);
3803  cs_solu_f_val(cell_cenj,
3804  i_face_cog,
3805  gradj[isou],
3806  pj[isou],
3807  &pjf[isou]);
3808 
3809  }
3810  }
3811  }
3812 
3813  /* Blending
3814  --------*/
3815  cs_blend_f_val_vector(blencp,
3816  pi,
3817  pif);
3818  cs_blend_f_val_vector(blencp,
3819  pj,
3820  pjf);
3821 
3822  /* If iconv=0 p*f are useless */
3823  } else {
3824 
3825  for (isou = 0; isou < 3; isou++) {
3826  cs_upwind_f_val(pi[isou],
3827  &pif[isou]);
3828  cs_upwind_f_val(pj[isou],
3829  &pjf[isou]);
3830 
3831  }
3832  }
3833 }
3834 
3835 
3836 /*----------------------------------------------------------------------------*/
3870 /*----------------------------------------------------------------------------*/
3871 
3872 inline static void
3874  const int iconvp,
3875  const int ircflp,
3876  const int ischcp,
3877  const double blencp,
3878  const double blend_st,
3879  const cs_real_t weight,
3880  const cs_real_t i_dist,
3881  const cs_real_t i_face_surf,
3882  const cs_real_3_t cell_ceni,
3883  const cs_real_3_t cell_cenj,
3884  const cs_real_3_t i_face_normal,
3885  const cs_real_3_t i_face_cog,
3886  const cs_real_3_t dijpf,
3887  const cs_real_t i_massflux,
3888  const cs_real_33_t gradi,
3889  const cs_real_33_t gradj,
3890  const cs_real_33_t grdpai,
3891  const cs_real_33_t grdpaj,
3892  const cs_real_3_t pi,
3893  const cs_real_3_t pj,
3894  cs_real_t pif[3],
3895  cs_real_t pjf[3],
3896  cs_real_t pip[3],
3897  cs_real_t pjp[3])
3898 {
3899  cs_real_3_t recoi, recoj;
3900  cs_real_t distf, srfan;
3901  cs_real_t testij, tesqck;
3902  int isou;
3903 
3904  distf = i_dist;
3905  srfan = i_face_surf;
3906 
3908  weight,
3909  cell_ceni,
3910  cell_cenj,
3911  i_face_cog,
3912  dijpf,
3913  gradi,
3914  gradj,
3915  pi,
3916  pj,
3917  recoi,
3918  recoj,
3919  pip,
3920  pjp);
3921 
3922  /* Convection slope test is needed only when iconv >0 */
3923  if (iconvp > 0) {
3925  pj,
3926  distf,
3927  srfan,
3928  i_face_normal,
3929  gradi,
3930  gradj,
3931  grdpai,
3932  grdpaj,
3933  i_massflux,
3934  &testij,
3935  &tesqck);
3936 
3937  for (isou = 0; isou < 3; isou++) {
3938  if (ischcp == 1) {
3939 
3940  /* Centered
3941  --------*/
3942 
3943  cs_centered_f_val(weight,
3944  pip[isou],
3945  pjp[isou],
3946  &pif[isou]);
3947  cs_centered_f_val(weight,
3948  pip[isou],
3949  pjp[isou],
3950  &pjf[isou]);
3951 
3952  } else {
3953 
3954  /* Second order
3955  ------------*/
3956 
3957  cs_solu_f_val(cell_ceni,
3958  i_face_cog,
3959  gradi[isou],
3960  pi[isou],
3961  &pif[isou]);
3962  cs_solu_f_val(cell_cenj,
3963  i_face_cog,
3964  gradj[isou],
3965  pj[isou],
3966  &pjf[isou]);
3967 
3968  }
3969 
3970  }
3971 
3972  /* Slope test: Pourcentage of upwind
3973  ----------------------------------*/
3974 
3975  if (tesqck <= 0. || testij <= 0.) {
3976 
3977  cs_blend_f_val_vector(blend_st,
3978  pi,
3979  pif);
3980  cs_blend_f_val_vector(blend_st,
3981  pj,
3982  pjf);
3983 
3984  *upwind_switch = true;
3985 
3986  }
3987 
3988 
3989  /* Blending
3990  --------*/
3991  cs_blend_f_val_vector(blencp,
3992  pi,
3993  pif);
3994  cs_blend_f_val_vector(blencp,
3995  pj,
3996  pjf);
3997 
3998  /* If iconv=0 p*f are useless */
3999  } else {
4000 
4001  for (isou = 0; isou < 3; isou++) {
4002  cs_upwind_f_val(pi[isou],
4003  &pif[isou]);
4004  cs_upwind_f_val(pj[isou],
4005  &pjf[isou]);
4006 
4007  }
4008  }
4009 }
4010 
4011 /*----------------------------------------------------------------------------*/
4045 /*----------------------------------------------------------------------------*/
4046 
4047 inline static void
4049  const int iconvp,
4050  const int ircflp,
4051  const int ischcp,
4052  const double blencp,
4053  const double blend_st,
4054  const cs_real_t weight,
4055  const cs_real_t i_dist,
4056  const cs_real_t i_face_surf,
4057  const cs_real_3_t cell_ceni,
4058  const cs_real_3_t cell_cenj,
4059  const cs_real_3_t i_face_normal,
4060  const cs_real_3_t i_face_cog,
4061  const cs_real_3_t dijpf,
4062  const cs_real_t i_massflux,
4063  const cs_real_63_t gradi,
4064  const cs_real_63_t gradj,
4065  const cs_real_63_t grdpai,
4066  const cs_real_63_t grdpaj,
4067  const cs_real_6_t pi,
4068  const cs_real_6_t pj,
4069  cs_real_t pif[6],
4070  cs_real_t pjf[6],
4071  cs_real_t pip[6],
4072  cs_real_t pjp[6])
4073 {
4074  cs_real_6_t recoi, recoj;
4075  cs_real_t distf, srfan;
4076  cs_real_t testij, tesqck;
4077  int isou;
4078 
4079  distf = i_dist;
4080  srfan = i_face_surf;
4081 
4083  weight,
4084  cell_ceni,
4085  cell_cenj,
4086  i_face_cog,
4087  dijpf,
4088  gradi,
4089  gradj,
4090  pi,
4091  pj,
4092  recoi,
4093  recoj,
4094  pip,
4095  pjp);
4096 
4097  /* Convection slope test is needed only when iconv >0 */
4098  if (iconvp > 0) {
4100  pj,
4101  distf,
4102  srfan,
4103  i_face_normal,
4104  gradi,
4105  gradj,
4106  grdpai,
4107  grdpaj,
4108  i_massflux,
4109  &testij,
4110  &tesqck);
4111 
4112  for (isou = 0; isou < 6; isou++) {
4113 
4114  if (ischcp==1) {
4115 
4116  /* Centered
4117  --------*/
4118 
4119  cs_centered_f_val(weight,
4120  pip[isou],
4121  pjp[isou],
4122  &pif[isou]);
4123  cs_centered_f_val(weight,
4124  pip[isou],
4125  pjp[isou],
4126  &pjf[isou]);
4127 
4128  } else {
4129 
4130  /* Second order
4131  ------------*/
4132 
4133  cs_solu_f_val(cell_ceni,
4134  i_face_cog,
4135  gradi[isou],
4136  pi[isou],
4137  &pif[isou]);
4138  cs_solu_f_val(cell_cenj,
4139  i_face_cog,
4140  gradj[isou],
4141  pj[isou],
4142  &pjf[isou]);
4143  }
4144 
4145  }
4146 
4147  /* Slope test activated: poucentage of upwind */
4148  if (tesqck <= 0. || testij <= 0.) {
4149 
4150  /* Upwind
4151  --------*/
4152 
4153  cs_blend_f_val_tensor(blend_st,
4154  pi,
4155  pif);
4156  cs_blend_f_val_tensor(blend_st,
4157  pj,
4158  pjf);
4159 
4160  *upwind_switch = true;
4161  }
4162 
4163 
4164  /* Blending
4165  --------*/
4166 
4167  cs_blend_f_val_tensor(blencp,
4168  pi,
4169  pif);
4170  cs_blend_f_val_tensor(blencp,
4171  pj,
4172  pjf);
4173 
4174  /* If iconv=0 p*fr* are useless */
4175  } else {
4176 
4177  for (isou = 0; isou < 6; isou++) {
4178  cs_upwind_f_val(pi[isou],
4179  &pif[isou]);
4180  cs_upwind_f_val(pj[isou],
4181  &pjf[isou]);
4182  }
4183  }
4184 }
4185 
4186 /*----------------------------------------------------------------------------*/
4195 /*----------------------------------------------------------------------------*/
4196 
4197 inline static void
4199  const cs_real_3_t gradi,
4200  const int ircflp,
4201  cs_real_t *recoi)
4202 {
4203  *recoi = ircflp * ( gradi[0]*diipb[0]
4204  + gradi[1]*diipb[1]
4205  + gradi[2]*diipb[2]);
4206 }
4207 
4208 /*----------------------------------------------------------------------------*/
4217 /*----------------------------------------------------------------------------*/
4218 
4219 inline static void
4221  const cs_real_33_t gradi,
4222  const int ircflp,
4223  cs_real_t recoi[3])
4224 {
4225  for (int isou = 0; isou < 3; isou++) {
4226  recoi[isou] = ircflp * (gradi[isou][0]*diipb[0]
4227  + gradi[isou][1]*diipb[1]
4228  + gradi[isou][2]*diipb[2]);
4229  }
4230 }
4231 
4232 /*----------------------------------------------------------------------------*/
4241 /*----------------------------------------------------------------------------*/
4242 
4243 inline static void
4245  const cs_real_63_t gradi,
4246  const int ircflp,
4247  cs_real_t recoi[6])
4248 {
4249  for (int isou = 0; isou < 6; isou++) {
4250  recoi[isou] = ircflp * (gradi[isou][0]*diipb[0]
4251  + gradi[isou][1]*diipb[1]
4252  + gradi[isou][2]*diipb[2]);
4253  }
4254 }
4255 
4256 /*----------------------------------------------------------------------------*/
4267 /*----------------------------------------------------------------------------*/
4268 
4269 inline static void
4270 cs_b_relax_c_val(const double relaxp,
4271  const cs_real_t pi,
4272  const cs_real_t pia,
4273  const cs_real_t recoi,
4274  cs_real_t *pir,
4275  cs_real_t *pipr)
4276 {
4277  *pir = pi/relaxp - (1.-relaxp)/relaxp*pia;
4278  *pipr = *pir + recoi;
4279 }
4280 
4281 /*----------------------------------------------------------------------------*/
4292 /*----------------------------------------------------------------------------*/
4293 
4294 inline static void
4295 cs_b_relax_c_val_vector(const double relaxp,
4296  const cs_real_3_t pi,
4297  const cs_real_3_t pia,
4298  const cs_real_3_t recoi,
4299  cs_real_t pir[3],
4300  cs_real_t pipr[3])
4301 {
4302  for (int isou = 0; isou < 3; isou++) {
4303  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4304  pipr[isou] = pir[isou] + recoi[isou];
4305  }
4306 }
4307 
4308 /*----------------------------------------------------------------------------*/
4319 /*----------------------------------------------------------------------------*/
4320 
4321 inline static void
4322 cs_b_relax_c_val_tensor(const double relaxp,
4323  const cs_real_6_t pi,
4324  const cs_real_6_t pia,
4325  const cs_real_6_t recoi,
4326  cs_real_t pir[6],
4327  cs_real_t pipr[6])
4328 {
4329  for (int isou = 0; isou < 6; isou++) {
4330  pir[isou] = pi[isou]/relaxp - (1.-relaxp)/relaxp*pia[isou];
4331  pipr[isou] = pir[isou] + recoi[isou];
4332  }
4333 }
4334 
4335 /*----------------------------------------------------------------------------*/
4359 /*----------------------------------------------------------------------------*/
4360 
4361 inline static void
4363  cs_real_t thetap,
4364  int imasac,
4365  int inc,
4366  cs_int_t bc_type,
4367  int icvfli,
4368  cs_real_t pi,
4369  cs_real_t pir,
4370  cs_real_t pipr,
4371  cs_real_t coefap,
4372  cs_real_t coefbp,
4373  cs_real_t coface,
4374  cs_real_t cofbce,
4375  cs_real_t b_massflux,
4376  cs_real_t xcpp,
4377  cs_real_t *flux)
4378 {
4379  cs_real_t flui, fluj, pfac;
4380 
4381  /* Computed convective flux */
4382 
4383  if (icvfli == 0) {
4384 
4385  /* Remove decentering for coupled faces */
4386  if (bc_type == CS_COUPLED_FD) {
4387  flui = 0.0;
4388  fluj = b_massflux;
4389  } else {
4390  flui = 0.5*(b_massflux +fabs(b_massflux));
4391  fluj = 0.5*(b_massflux -fabs(b_massflux));
4392  }
4393 
4394  pfac = inc*coefap + coefbp*pipr;
4395  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4396 
4397  /* Imposed convective flux */
4398 
4399  } else {
4400 
4401  pfac = inc*coface + cofbce*pipr;
4402  *flux += iconvp*xcpp*(-imasac*(b_massflux*pi) + thetap*(pfac));
4403 
4404  }
4405 }
4406 
4407 /*----------------------------------------------------------------------------*/
4429 /*----------------------------------------------------------------------------*/
4430 
4431 inline static void
4433  cs_real_t thetap,
4434  int imasac,
4435  int inc,
4436  cs_int_t bc_type,
4437  int icvfli,
4438  const cs_real_t pi[restrict 3],
4439  const cs_real_t pir[restrict 3],
4440  const cs_real_t pipr[restrict 3],
4441  const cs_real_t coefap[restrict 3],
4442  const cs_real_t coefbp[restrict 3][3],
4443  const cs_real_t coface[restrict 3],
4444  const cs_real_t cofbce[restrict 3][3],
4445  cs_real_t b_massflux,
4446  cs_real_t flux[restrict 3])
4447 {
4448  cs_real_t flui, fluj, pfac;
4449 
4450  /* Computed convective flux */
4451 
4452  if (icvfli == 0) {
4453 
4454  /* Remove decentering for coupled faces */
4455  if (bc_type == CS_COUPLED_FD) {
4456  flui = 0.0;
4457  fluj = b_massflux;
4458  } else {
4459  flui = 0.5*(b_massflux +fabs(b_massflux));
4460  fluj = 0.5*(b_massflux -fabs(b_massflux));
4461  }
4462  for (int isou = 0; isou < 3; isou++) {
4463  pfac = inc*coefap[isou];
4464  for (int jsou = 0; jsou < 3; jsou++) {
4465  pfac += coefbp[isou][jsou]*pipr[jsou];
4466  }
4467  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4468  - imasac*b_massflux*pi[isou]);
4469  }
4470 
4471  /* Imposed convective flux */
4472 
4473  } else {
4474 
4475  for (int isou = 0; isou < 3; isou++) {
4476  pfac = inc*coface[isou];
4477  for (int jsou = 0; jsou < 3; jsou++) {
4478  pfac += cofbce[isou][jsou]*pipr[jsou];
4479  }
4480  flux[isou] += iconvp*( thetap*pfac
4481  - imasac*b_massflux*pi[isou]);
4482  }
4483 
4484  }
4485 }
4486 
4487 /*----------------------------------------------------------------------------*/
4507 /*----------------------------------------------------------------------------*/
4508 
4509 inline static void
4510 cs_b_upwind_flux(const int iconvp,
4511  const cs_real_t thetap,
4512  const int imasac,
4513  const int inc,
4514  const int bc_type,
4515  const cs_real_t pi,
4516  const cs_real_t pir,
4517  const cs_real_t pipr,
4518  const cs_real_t coefap,
4519  const cs_real_t coefbp,
4520  const cs_real_t b_massflux,
4521  const cs_real_t xcpp,
4522  cs_real_t *flux)
4523 {
4524  cs_real_t flui, fluj, pfac;
4525 
4526  /* Remove decentering for coupled faces */
4527  if (bc_type == CS_COUPLED_FD) {
4528  flui = 0.0;
4529  fluj = b_massflux;
4530  } else {
4531  flui = 0.5*(b_massflux +fabs(b_massflux));
4532  fluj = 0.5*(b_massflux -fabs(b_massflux));
4533  }
4534 
4535  pfac = inc*coefap + coefbp*pipr;
4536  *flux += iconvp*xcpp*(thetap*(flui*pir + fluj*pfac) -imasac*( b_massflux*pi));
4537 }
4538 
4539 /*----------------------------------------------------------------------------*/
4559 /*----------------------------------------------------------------------------*/
4560 
4561 inline static void
4562 cs_b_upwind_flux_vector(const int iconvp,
4563  const cs_real_t thetap,
4564  const int imasac,
4565  const int inc,
4566  const int bc_type,
4567  const cs_real_3_t pi,
4568  const cs_real_3_t pir,
4569  const cs_real_3_t pipr,
4570  const cs_real_3_t coefa,
4571  const cs_real_33_t coefb,
4572  const cs_real_t b_massflux,
4573  cs_real_t flux[3])
4574 {
4575  cs_real_t flui, fluj, pfac;
4576 
4577  /* Remove decentering for coupled faces */
4578  if (bc_type == CS_COUPLED_FD) {
4579  flui = 0.0;
4580  fluj = b_massflux;
4581  } else {
4582  flui = 0.5*(b_massflux +fabs(b_massflux));
4583  fluj = 0.5*(b_massflux -fabs(b_massflux));
4584  }
4585  for (int isou = 0; isou < 3; isou++) {
4586  pfac = inc*coefa[isou];
4587  for (int jsou = 0; jsou < 3; jsou++) {
4588  pfac += coefb[isou][jsou]*pipr[jsou];
4589  }
4590  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4591  - imasac*b_massflux*pi[isou]);
4592  }
4593 }
4594 
4595 /*----------------------------------------------------------------------------*/
4615 /*----------------------------------------------------------------------------*/
4616 
4617 inline static void
4618 cs_b_upwind_flux_tensor(const int iconvp,
4619  const cs_real_t thetap,
4620  const int imasac,
4621  const int inc,
4622  const int bc_type,
4623  const cs_real_6_t pi,
4624  const cs_real_6_t pir,
4625  const cs_real_6_t pipr,
4626  const cs_real_6_t coefa,
4627  const cs_real_66_t coefb,
4628  const cs_real_t b_massflux,
4629  cs_real_t flux[6])
4630 {
4631  cs_real_t flui, fluj, pfac;
4632 
4633  /* Remove decentering for coupled faces */
4634  if (bc_type == CS_COUPLED_FD) {
4635  flui = 0.0;
4636  fluj = b_massflux;
4637  } else {
4638  flui = 0.5*(b_massflux +fabs(b_massflux));
4639  fluj = 0.5*(b_massflux -fabs(b_massflux));
4640  }
4641  for (int isou = 0; isou < 6; isou++) {
4642  pfac = inc*coefa[isou];
4643  for (int jsou = 0; jsou < 6; jsou++) {
4644  pfac += coefb[isou][jsou]*pipr[jsou];
4645  }
4646  flux[isou] += iconvp*( thetap*(flui*pir[isou] + fluj*pfac)
4647  - imasac*b_massflux*pi[isou]);
4648  }
4649 }
4650 
4651 /*----------------------------------------------------------------------------*/
4664 /*----------------------------------------------------------------------------*/
4665 
4666 inline static void
4667 cs_b_diff_flux(const int idiffp,
4668  const cs_real_t thetap,
4669  const int inc,
4670  const cs_real_t pipr,
4671  const cs_real_t cofafp,
4672  const cs_real_t cofbfp,
4673  const cs_real_t b_visc,
4674  cs_real_t *flux)
4675 {
4676  cs_real_t pfacd = inc*cofafp + cofbfp*pipr;
4677  *flux += idiffp*thetap*b_visc*pfacd;
4678 }
4679 
4680 /*----------------------------------------------------------------------------*/
4693 /*----------------------------------------------------------------------------*/
4694 
4695 inline static void
4696 cs_b_diff_flux_vector(const int idiffp,
4697  const cs_real_t thetap,
4698  const int inc,
4699  const cs_real_3_t pipr,
4700  const cs_real_3_t cofaf,
4701  const cs_real_33_t cofbf,
4702  const cs_real_t b_visc,
4703  cs_real_t flux[3])
4704 {
4705  cs_real_t pfacd ;
4706  for (int isou = 0; isou < 3; isou++) {
4707  pfacd = inc*cofaf[isou];
4708  for (int jsou = 0; jsou < 3; jsou++) {
4709  pfacd += cofbf[isou][jsou]*pipr[jsou];
4710  }
4711  flux[isou] += idiffp*thetap*b_visc*pfacd;
4712  }
4713 }
4714 
4715 /*----------------------------------------------------------------------------*/
4728 /*----------------------------------------------------------------------------*/
4729 
4730 inline static void
4731 cs_b_diff_flux_tensor(const int idiffp,
4732  const cs_real_t thetap,
4733  const int inc,
4734  const cs_real_6_t pipr,
4735  const cs_real_6_t cofaf,
4736  const cs_real_66_t cofbf,
4737  const cs_real_t b_visc,
4738  cs_real_t flux[6])
4739 {
4740  cs_real_t pfacd ;
4741  for (int isou = 0; isou < 6; isou++) {
4742  pfacd = inc*cofaf[isou];
4743  for (int jsou = 0; jsou < 6; jsou++) {
4744  pfacd += cofbf[isou][jsou]*pipr[jsou];
4745  }
4746  flux[isou] += idiffp*thetap*b_visc*pfacd;
4747  }
4748 }
4749 
4750 /*----------------------------------------------------------------------------*/
4764 /*----------------------------------------------------------------------------*/
4765 
4766 inline static void
4767 cs_b_cd_steady(const int ircflp,
4768  const double relaxp,
4769  const cs_real_3_t diipb,
4770  const cs_real_3_t gradi,
4771  const cs_real_t pi,
4772  const cs_real_t pia,
4773  cs_real_t *pir,
4774  cs_real_t *pipr)
4775 {
4776  cs_real_t recoi;
4777 
4779  gradi,
4780  ircflp,
4781  &recoi);
4782 
4783  cs_b_relax_c_val(relaxp,
4784  pi,
4785  pia,
4786  recoi,
4787  pir,
4788  pipr);
4789 }
4790 
4791 /*----------------------------------------------------------------------------*/
4805 /*----------------------------------------------------------------------------*/
4806 
4807 inline static void
4808 cs_b_cd_steady_vector(const int ircflp,
4809  const double relaxp,
4810  const cs_real_3_t diipb,
4811  const cs_real_33_t gradi,
4812  const cs_real_3_t pi,
4813  const cs_real_3_t pia,
4814  cs_real_t pir[3],
4815  cs_real_t pipr[3])
4816 {
4817  cs_real_3_t recoi;
4818 
4820  gradi,
4821  ircflp,
4822  recoi);
4823 
4824  cs_b_relax_c_val_vector(relaxp,
4825  pi,
4826  pia,
4827  recoi,
4828  pir,
4829  pipr);
4830 }
4831 
4832 /*----------------------------------------------------------------------------*/
4846 /*----------------------------------------------------------------------------*/
4847 
4848 inline static void
4849 cs_b_cd_steady_tensor(const int ircflp,
4850  const double relaxp,
4851  const cs_real_3_t diipb,
4852  const cs_real_63_t gradi,
4853  const cs_real_6_t pi,
4854  const cs_real_6_t pia,
4855  cs_real_t pir[6],
4856  cs_real_t pipr[6])
4857 {
4858  cs_real_6_t recoi;
4859 
4861  gradi,
4862  ircflp,
4863  recoi);
4864 
4865  cs_b_relax_c_val_tensor(relaxp,
4866  pi,
4867  pia,
4868  recoi,
4869  pir,
4870  pipr);
4871 }
4872 
4873 /*----------------------------------------------------------------------------*/
4884 /*----------------------------------------------------------------------------*/
4885 
4886 inline static void
4887 cs_b_cd_unsteady(const int ircflp,
4888  const cs_real_3_t diipb,
4889  const cs_real_3_t gradi,
4890  const cs_real_t pi,
4891  cs_real_t *pip)
4892 {
4893  cs_real_t recoi;
4894 
4896  gradi,
4897  ircflp,
4898  &recoi);
4899 
4900  *pip = pi + recoi;
4901 }
4902 
4903 /*----------------------------------------------------------------------------*/
4914 /*----------------------------------------------------------------------------*/
4915 
4916 inline static void
4917 cs_b_cd_unsteady_vector(const int ircflp,
4918  const cs_real_3_t diipb,
4919  const cs_real_33_t gradi,
4920  const cs_real_3_t pi,
4921  cs_real_t pip[3])
4922 {
4923  cs_real_3_t recoi;
4924 
4926  gradi,
4927  ircflp,
4928  recoi);
4929 
4930  for (int isou = 0; isou < 3; isou++)
4931  pip[isou] = pi[isou] + recoi[isou];
4932 }
4933 
4934 /*----------------------------------------------------------------------------*/
4945 /*----------------------------------------------------------------------------*/
4946 
4947 inline static void
4948 cs_b_cd_unsteady_tensor(const int ircflp,
4949  const cs_real_3_t diipb,
4950  const cs_real_63_t gradi,
4951  const cs_real_6_t pi,
4952  cs_real_t pip[6])
4953 {
4954  cs_real_6_t recoi;
4955 
4957  gradi,
4958  ircflp,
4959  recoi);
4960 
4961  for(int isou = 0; isou< 6; isou++)
4962  pip[isou] = pi[isou] + recoi[isou];
4963 }
4964 
4965 /*----------------------------------------------------------------------------*/
4976 /*----------------------------------------------------------------------------*/
4977 
4978 inline static void
4979 cs_b_diff_flux_coupling(const int idiffp,
4980  const cs_real_t pi,
4981  const cs_real_t pj,
4982  const cs_real_t b_visc,
4983  cs_real_t *fluxi)
4984 {
4985  *fluxi += idiffp*b_visc*(pi - pj);
4986 }
4987 
4988 /*----------------------------------------------------------------------------*/
4999 /*----------------------------------------------------------------------------*/
5000 
5001 inline static void
5003  const cs_real_3_t pi,
5004  const cs_real_3_t pj,
5005  const cs_real_t b_visc,
5006  cs_real_t fluxi[3])
5007 {
5008  for (int k = 0; k < 3; k++)
5009  fluxi[k] += idiffp*b_visc*(pi[k] - pj[k]);
5010 }
5011 
5012 
5013 /*============================================================================
5014  * Public function prototypes for Fortran API
5015  *============================================================================*/
5016 
5017 /*----------------------------------------------------------------------------
5018  * Wrapper to cs_face_diffusion_potential
5019  *----------------------------------------------------------------------------*/
5020 
5021 void CS_PROCF (itrmas, ITRMAS)
5022 (
5023  const cs_int_t *const f_id,
5024  const cs_int_t *const init,
5025  const cs_int_t *const inc,
5026  const cs_int_t *const imrgra,
5027  const cs_int_t *const iccocg,
5028  const cs_int_t *const nswrgp,
5029  const cs_int_t *const imligp,
5030  const cs_int_t *const iphydp,
5031  const cs_int_t *const iwgrp,
5032  const cs_int_t *const iwarnp,
5033  const cs_real_t *const epsrgp,
5034  const cs_real_t *const climgp,
5035  const cs_real_t *const extrap,
5036  cs_real_3_t frcxt[],
5037  cs_real_t pvar[],
5038  const cs_real_t coefap[],
5039  const cs_real_t coefbp[],
5040  const cs_real_t cofafp[],
5041  const cs_real_t cofbfp[],
5042  const cs_real_t i_visc[],
5043  const cs_real_t b_visc[],
5044  cs_real_t visel[],
5045  cs_real_t i_massflux[],
5046  cs_real_t b_massflux[]
5047 );
5048 
5049 /*----------------------------------------------------------------------------
5050  * Wrapper to cs_face_anisotropic_diffusion_potential
5051  *----------------------------------------------------------------------------*/
5052 
5053 void CS_PROCF (itrmav, ITRMAV)
5054 (
5055  const cs_int_t *const f_id,
5056  const cs_int_t *const init,
5057  const cs_int_t *const inc,
5058  const cs_int_t *const imrgra,
5059  const cs_int_t *const iccocg,
5060  const cs_int_t *const nswrgp,
5061  const cs_int_t *const imligp,
5062  const cs_int_t *const ircflp,
5063  const cs_int_t *const iphydp,
5064  const cs_int_t *const iwgrp,
5065  const cs_int_t *const iwarnp,
5066  const cs_real_t *const epsrgp,
5067  const cs_real_t *const climgp,
5068  const cs_real_t *const extrap,
5069  cs_real_3_t frcxt[],
5070  cs_real_t pvar[],
5071  const cs_real_t coefap[],
5072  const cs_real_t coefbp[],
5073  const cs_real_t cofafp[],
5074  const cs_real_t cofbfp[],
5075  const cs_real_t i_visc[],
5076  const cs_real_t b_visc[],
5077  cs_real_6_t viscel[],
5078  const cs_real_2_t weighf[],
5079  const cs_real_t weighb[],
5080  cs_real_t i_massflux[],
5081  cs_real_t b_massflux[]
5082 );
5083 
5084 /*----------------------------------------------------------------------------
5085  * Wrapper to cs_diffusion_potential
5086  *----------------------------------------------------------------------------*/
5087 
5088 void CS_PROCF (itrgrp, ITRGRP)
5089 (
5090  const cs_int_t *const f_id,
5091  const cs_int_t *const init,
5092  const cs_int_t *const inc,
5093  const cs_int_t *const imrgra,
5094  const cs_int_t *const iccocg,
5095  const cs_int_t *const nswrgp,
5096  const cs_int_t *const imligp,
5097  const cs_int_t *const iphydp,
5098  const cs_int_t *const iwarnp,
5099  const cs_real_t *const epsrgp,
5100  const cs_real_t *const climgp,
5101  const cs_real_t *const extrap,
5102  cs_real_3_t frcxt[],
5103  cs_real_t pvar[],
5104  const cs_real_t coefap[],
5105  const cs_real_t coefbp[],
5106  const cs_real_t cofafp[],
5107  const cs_real_t cofbfp[],
5108  const cs_real_t i_visc[],
5109  const cs_real_t b_visc[],
5110  cs_real_t visel[],
5111  cs_real_t diverg[]
5112 );
5113 
5114 /*----------------------------------------------------------------------------
5115  * Wrapper to cs_anisotropic_diffusion_potential
5116  *----------------------------------------------------------------------------*/
5117 
5118 void CS_PROCF (itrgrv, ITRGRV)
5119 (
5120  const cs_int_t *const f_id,
5121  const cs_int_t *const init,
5122  const cs_int_t *const inc,
5123  const cs_int_t *const imrgra,
5124  const cs_int_t *const iccocg,
5125  const cs_int_t *const nswrgp,
5126  const cs_int_t *const imligp,
5127  const cs_int_t *const ircflp,
5128  const cs_int_t *const iphydp,
5129  const cs_int_t *const iwarnp,
5130  const cs_real_t *const epsrgp,
5131  const cs_real_t *const climgp,
5132  const cs_real_t *const extrap,
5133  cs_real_3_t frcxt[],
5134  cs_real_t pvar[],
5135  const cs_real_t coefap[],
5136  const cs_real_t coefbp[],
5137  const cs_real_t cofafp[],
5138  const cs_real_t cofbfp[],
5139  const cs_real_t i_visc[],
5140  const cs_real_t b_visc[],
5141  cs_real_6_t viscel[],
5142  const cs_real_2_t weighf[],
5143  const cs_real_t weighb[],
5144  cs_real_t diverg[]
5145 );
5146 
5147 /*=============================================================================
5148  * Public function prototypes
5149  *============================================================================*/
5150 
5151 /*----------------------------------------------------------------------------*/
5170 /*----------------------------------------------------------------------------*/
5171 
5172 void
5173 cs_slope_test_gradient(int f_id,
5174  int inc,
5175  cs_halo_type_t halo_type,
5176  const cs_real_3_t *grad,
5177  cs_real_3_t *grdpa,
5178  const cs_real_t *pvar,
5179  const cs_real_t *coefap,
5180  const cs_real_t *coefbp,
5181  const cs_real_t *i_massflux);
5182 
5183 /*----------------------------------------------------------------------------*/
5199 /*----------------------------------------------------------------------------*/
5200 
5201 void
5202 cs_upwind_gradient(const int f_id,
5203  const int inc,
5204  const cs_halo_type_t halo_type,
5205  const cs_real_t coefap[],
5206  const cs_real_t coefbp[],
5207  const cs_real_t i_massflux[],
5208  const cs_real_t b_massflux[],
5209  const cs_real_t *restrict pvar,
5210  cs_real_3_t *restrict grdpa);
5211 
5212 /*----------------------------------------------------------------------------*/
5230 /*----------------------------------------------------------------------------*/
5231 
5232 void
5233 cs_slope_test_gradient_vector(const int inc,
5234  const cs_halo_type_t halo_type,
5235  const cs_real_33_t *grad,
5236  cs_real_33_t *grdpa,
5237  const cs_real_3_t *pvar,
5238  const cs_real_3_t *coefa,
5239  const cs_real_33_t *coefb,
5240  const cs_real_t *i_massflux);
5241 
5242 /*----------------------------------------------------------------------------*/
5260 /*----------------------------------------------------------------------------*/
5261 
5262 void
5263 cs_slope_test_gradient_tensor(const int inc,
5264  const cs_halo_type_t halo_type,
5265  const cs_real_63_t *grad,
5266  cs_real_63_t *grdpa,
5267  const cs_real_6_t *pvar,
5268  const cs_real_6_t *coefa,
5269  const cs_real_66_t *coefb,
5270  const cs_real_t *i_massflux);
5271 
5272 /*----------------------------------------------------------------------------*/
5281 /*----------------------------------------------------------------------------*/
5282 
5283 void
5284 cs_max_limiter_building(int f_id,
5285  int inc,
5286  const cs_real_t rovsdt[]);
5287 
5288 /*----------------------------------------------------------------------------*/
5340 /*----------------------------------------------------------------------------*/
5341 
5342 void
5344  int f_id,
5345  const cs_var_cal_opt_t var_cal_opt,
5346  int icvflb,
5347  int inc,
5348  int iccocg,
5349  int imasac,
5350  cs_real_t *restrict pvar,
5351  const cs_real_t *restrict pvara,
5352  const cs_int_t icvfli[],
5353  const cs_real_t coefap[],
5354  const cs_real_t coefbp[],
5355  const cs_real_t cofafp[],
5356  const cs_real_t cofbfp[],
5357  const cs_real_t i_massflux[],
5358  const cs_real_t b_massflux[],
5359  const cs_real_t i_visc[],
5360  const cs_real_t b_visc[],
5361  cs_real_t *restrict rhs);
5362 
5363 /*----------------------------------------------------------------------------*/
5422 /*----------------------------------------------------------------------------*/
5423 
5424 void
5426  int f_id,
5427  const cs_var_cal_opt_t var_cal_opt,
5428  int icvflb,
5429  int inc,
5430  int ivisep,
5431  int imasac,
5432  cs_real_3_t *restrict pvar,
5433  const cs_real_3_t *restrict pvara,
5434  const cs_int_t icvfli[],
5435  const cs_real_3_t coefav[],
5436  const cs_real_33_t coefbv[],
5437  const cs_real_3_t cofafv[],
5438  const cs_real_33_t cofbfv[],
5439  const cs_real_t i_massflux[],
5440  const cs_real_t b_massflux[],
5441  const cs_real_t i_visc[],
5442  const cs_real_t b_visc[],
5443  const cs_real_t secvif[],
5444  cs_real_3_t *restrict rhs);
5445 
5446 /*----------------------------------------------------------------------------*/
5491 /*----------------------------------------------------------------------------*/
5492 
5493 void
5495  int f_id,
5496  const cs_var_cal_opt_t var_cal_opt,
5497  int icvflb,
5498  int inc,
5499  int imasac,
5500  cs_real_6_t *restrict pvar,
5501  const cs_real_6_t *restrict pvara,
5502  const cs_real_6_t coefa[],
5503  const cs_real_66_t coefb[],
5504  const cs_real_6_t cofaf[],
5505  const cs_real_66_t cofbf[],
5506  const cs_real_t i_massflux[],
5507  const cs_real_t b_massflux[],
5508  const cs_real_t i_visc[],
5509  const cs_real_t b_visc[],
5510  cs_real_6_t *restrict rhs);
5511 
5512 /*----------------------------------------------------------------------------*/
5558 /*----------------------------------------------------------------------------*/
5559 
5560 void
5562  int f_id,
5563  const cs_var_cal_opt_t var_cal_opt,
5564  int inc,
5565  int iccocg,
5566  int imasac,
5567  cs_real_t *restrict pvar,
5568  const cs_real_t *restrict pvara,
5569  const cs_real_t coefap[],
5570  const cs_real_t coefbp[],
5571  const cs_real_t cofafp[],
5572  const cs_real_t cofbfp[],
5573  const cs_real_t i_massflux[],
5574  const cs_real_t b_massflux[],
5575  const cs_real_t i_visc[],
5576  const cs_real_t b_visc[],
5577  const cs_real_t xcpp[],
5578  cs_real_t *restrict rhs);
5579 
5580 /*----------------------------------------------------------------------------*/
5628 /*----------------------------------------------------------------------------*/
5629 
5630 void
5632  int f_id,
5633  const cs_var_cal_opt_t var_cal_opt,
5634  int inc,
5635  int iccocg,
5636  cs_real_t *restrict pvar,
5637  const cs_real_t *restrict pvara,
5638  const cs_real_t coefap[],
5639  const cs_real_t coefbp[],
5640  const cs_real_t cofafp[],
5641  const cs_real_t cofbfp[],
5642  const cs_real_t i_visc[],
5643  const cs_real_t b_visc[],
5644  cs_real_6_t *restrict viscel,
5645  const cs_real_2_t weighf[],
5646  const cs_real_t weighb[],
5647  cs_real_t *restrict rhs);
5648 
5649 /*-----------------------------------------------------------------------------*/
5692 /*----------------------------------------------------------------------------*/
5693 
5694 void
5696  int f_id,
5697  const cs_var_cal_opt_t var_cal_opt,
5698  int inc,
5699  int ivisep,
5700  cs_real_3_t *restrict pvar,
5701  const cs_real_3_t *restrict pvara,
5702  const cs_real_3_t coefav[],
5703  const cs_real_33_t coefbv[],
5704  const cs_real_3_t cofafv[],
5705  const cs_real_33_t cofbfv[],
5706  const cs_real_33_t i_visc[],
5707  const cs_real_t b_visc[],
5708  const cs_real_t secvif[],
5709  cs_real_3_t *restrict rhs);
5710 
5711 /*-----------------------------------------------------------------------------*/
5759 /*----------------------------------------------------------------------------*/
5760 
5761 void
5763  int f_id,
5764  const cs_var_cal_opt_t var_cal_opt,
5765  int inc,
5766  int ivisep,
5767  cs_real_3_t *restrict pvar,
5768  const cs_real_3_t *restrict pvara,
5769  const cs_real_3_t coefav[],
5770  const cs_real_33_t coefbv[],
5771  const cs_real_3_t cofafv[],
5772  const cs_real_33_t cofbfv[],
5773  const cs_real_t i_visc[],
5774  const cs_real_t b_visc[],
5775  const cs_real_t secvif[],
5776  cs_real_6_t *restrict viscel,
5777  const cs_real_2_t weighf[],
5778  const cs_real_t weighb[],
5779  cs_real_3_t *restrict rhs);
5780 
5781 
5782 /*----------------------------------------------------------------------------*/
5826 /*----------------------------------------------------------------------------*/
5827 
5828 void
5830  int f_id,
5831  const cs_var_cal_opt_t var_cal_opt,
5832  int inc,
5833  cs_real_6_t *restrict pvar,
5834  const cs_real_6_t *restrict pvara,
5835  const cs_real_6_t coefa[],
5836  const cs_real_66_t coefb[],
5837  const cs_real_6_t cofaf[],
5838  const cs_real_66_t cofbf[],
5839  const cs_real_t i_visc[],
5840  const cs_real_t b_visc[],
5841  cs_real_6_t *restrict viscel,
5842  const cs_real_2_t weighf[],
5843  const cs_real_t weighb[],
5844  cs_real_6_t *restrict rhs);
5845 
5846 /*----------------------------------------------------------------------------*/
5906 /*----------------------------------------------------------------------------*/
5907 
5908 void
5909 cs_face_diffusion_potential(const int f_id,
5910  const cs_mesh_t *m,
5911  cs_mesh_quantities_t *fvq,
5912  int init,
5913  int inc,
5914  int imrgra,
5915  int iccocg,
5916  int nswrgp,
5917  int imligp,
5918  int iphydp,
5919  int iwgrp,
5920  int iwarnp,
5921  double epsrgp,
5922  double climgp,
5923  double extrap,
5924  cs_real_3_t *restrict frcxt,
5925  cs_real_t *restrict pvar,
5926  const cs_real_t coefap[],
5927  const cs_real_t coefbp[],
5928  const cs_real_t cofafp[],
5929  const cs_real_t cofbfp[],
5930  const cs_real_t i_visc[],
5931  const cs_real_t b_visc[],
5932  cs_real_t *restrict visel,
5933  cs_real_t *restrict i_massflux,
5934  cs_real_t *restrict b_massflux);
5935 
5936 /*----------------------------------------------------------------------------*/
6007 /*----------------------------------------------------------------------------*/
6008 
6009 void
6011  const cs_mesh_t *m,
6012  cs_mesh_quantities_t *fvq,
6013  int init,
6014  int inc,
6015  int imrgra,
6016  int iccocg,
6017  int nswrgp,
6018  int imligp,
6019  int ircflp,
6020  int iphydp,
6021  int iwgrp,
6022  int iwarnp,
6023  double epsrgp,
6024  double climgp,
6025  double extrap,
6026  cs_real_3_t *restrict frcxt,
6027  cs_real_t *restrict pvar,
6028  const cs_real_t coefap[],
6029  const cs_real_t coefbp[],
6030  const cs_real_t cofafp[],
6031  const cs_real_t cofbfp[],
6032  const cs_real_t i_visc[],
6033  const cs_real_t b_visc[],
6034  cs_real_6_t *restrict viscel,
6035  const cs_real_2_t weighf[],
6036  const cs_real_t weighb[],
6037  cs_real_t *restrict i_massflux,
6038  cs_real_t *restrict b_massflux);
6039 
6040 /*----------------------------------------------------------------------------*/
6096 /*----------------------------------------------------------------------------*/
6097 
6098 void
6099 cs_diffusion_potential(const int f_id,
6100  const cs_mesh_t *m,
6101  cs_mesh_quantities_t *fvq,
6102  int init,
6103  int inc,
6104  int imrgra,
6105  int iccocg,
6106  int nswrgp,
6107  int imligp,
6108  int iphydp,
6109  int iwarnp,
6110  double epsrgp,
6111  double climgp,
6112  double extrap,
6113  cs_real_3_t *restrict frcxt,
6114  cs_real_t *restrict pvar,
6115  const cs_real_t coefap[],
6116  const cs_real_t coefbp[],
6117  const cs_real_t cofafp[],
6118  const cs_real_t cofbfp[],
6119  const cs_real_t i_visc[],
6120  const cs_real_t b_visc[],
6121  cs_real_t visel[],
6122  cs_real_t *restrict diverg);
6123 
6124 /*----------------------------------------------------------------------------*/
6193 /*----------------------------------------------------------------------------*/
6194 
6195 void
6196 cs_anisotropic_diffusion_potential(const int f_id,
6197  const cs_mesh_t *m,
6198  cs_mesh_quantities_t *fvq,
6199  int init,
6200  int inc,
6201  int imrgra,
6202  int iccocg,
6203  int nswrgp,
6204  int imligp,
6205  int ircflp,
6206  int iphydp,
6207  int iwarnp,
6208  double epsrgp,
6209  double climgp,
6210  double extrap,
6211  cs_real_3_t *restrict frcxt,
6212  cs_real_t *restrict pvar,
6213  const cs_real_t coefap[],
6214  const cs_real_t coefbp[],
6215  const cs_real_t cofafp[],
6216  const cs_real_t cofbfp[],
6217  const cs_real_t i_visc[],
6218  const cs_real_t b_visc[],
6219  cs_real_6_t *restrict viscel,
6220  const cs_real_2_t weighf[],
6221  const cs_real_t weighb[],
6222  cs_real_t *restrict diverg);
6223 
6224 /*----------------------------------------------------------------------------*/
6225 
6227 
6228 #endif /* __CS_CONVECTION_DIFFUSION_H__ */
static void cs_b_cd_steady(const int ircflp, 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:4767
Definition: cs_field_pointer.h:70
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:718
#define restrict
Definition: cs_defs.h:122
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:253
static void cs_slope_test_vector_old(const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, 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_t i_massflux, cs_real_t testij[3], cs_real_t tesqck[3])
DEPRECATED Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:242
static void cs_b_imposed_conv_flux_vector(int iconvp, cs_real_t thetap, int imasac, int inc, cs_int_t 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:4432
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:4731
cs_real_t cs_real_2_t[2]
vector of 2 floating-point values
Definition: cs_defs.h:308
cs_real_t cs_real_6_t[6]
vector of 6 floating-point values
Definition: cs_defs.h:311
static void cs_i_cd_unsteady(const int ircflp, 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 dijpf, 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:2174
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:8755
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:795
cs_nvd_type_t
Definition: cs_convection_diffusion.h:58
void cs_anisotropic_diffusion_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int iccocg, 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:6780
static void cs_b_cd_steady_vector(const int ircflp, 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:4808
static void cs_i_cd_unsteady_slope_test_vector_old(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double blencp, 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 dijpf, 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])
DEPRECATED Handle preparation of internal face values for the fluxes computation in case of a unstead...
Definition: cs_convection_diffusion.h:3699
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:735
static void cs_b_cd_unsteady(const int ircflp, 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:4887
static void cs_i_cd_steady_upwind_vector(const int ircflp, const cs_real_t relaxp, 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 dijpf, 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:1316
cs_real_t cs_real_66_t[6][6]
6x6 matrix of floating-point values
Definition: cs_defs.h:316
Definition: cs_convection_diffusion.h:67
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:1681
static void cs_b_imposed_conv_flux(int iconvp, cs_real_t thetap, int imasac, int inc, cs_int_t 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:4362
void cs_generalized_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 secvif[], cs_real_3_t *restrict rhs)
Add the explicit part of the diffusion terms with a symmetric tensorial diffusivity for a transport e...
Definition: cs_convection_diffusion.c:7496
#define BEGIN_C_DECLS
Definition: cs_defs.h:453
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:296
#define CS_UNUSED(x)
Definition: cs_defs.h:439
static void cs_b_diff_flux_coupling_vector(const int idiffp, const cs_real_3_t pi, const cs_real_3_t pj, const 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:5002
static void cs_i_cd_unsteady_slope_test(bool *upwind_switch, const int iconvp, const int ircflp, 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 dijpf, 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:3513
static void cs_i_cd_steady_tensor(const int ircflp, 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 dijpf, 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:2021
Definition: cs_parameters.h:142
static void cs_i_relax_c_val_tensor(const double relaxp, const cs_real_6_t pia, const cs_real_6_t pja, const cs_real_6_t recoi, const cs_real_6_t recoj, const cs_real_6_t pi, const cs_real_6_t pj, 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:671
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:593
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:1526
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:754
static void cs_i_cd_steady_vector(const int ircflp, 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 dijpf, 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:1867
Definition: cs_field_pointer.h:67
static void cs_b_compute_quantities_vector(const cs_real_3_t diipb, const cs_real_33_t gradi, const int ircflp, cs_real_t recoi[3])
Reconstruct values in I' at boundary cell i.
Definition: cs_convection_diffusion.h:4220
Definition: cs_convection_diffusion.h:62
void itrgrp(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const iphydp, const cs_int_t *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:1100
Definition: cs_convection_diffusion.h:65
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:928
static void cs_i_compute_quantities_vector(const int ircflp, const double pnd, 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 dijpf, 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' and J'.
Definition: cs_convection_diffusion.h:441
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
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:877
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:288
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:845
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:4562
static cs_real_t cs_math_sq(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:120
Definition: cs_mesh.h:63
static void cs_i_cd_unsteady_slope_test_tensor(bool *upwind_switch, const int iconvp, const int ircflp, 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 dijpf, 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:4048
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_2_t fluxij)
Add diffusive fluxes to fluxes at face ij.
Definition: cs_convection_diffusion.h:1115
static void cs_i_cd_unsteady_vector(const int ircflp, 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 dijpf, 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:2299
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 cs_int_t 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 secvif[], 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:3339
static void cs_i_compute_quantities_tensor(const int ircflp, const double pnd, 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 dijpf, 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' and J'.
Definition: cs_convection_diffusion.h:518
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:4696
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:631
static void cs_i_diff_flux_tensor(const int idiffp, const cs_real_t thetap, const cs_real_6_t pip, const cs_real_6_t pjp, const cs_real_6_t pipr, const cs_real_6_t pjpr, 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:1178
Definition: cs_convection_diffusion.h:64
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:4322
static void cs_i_cd_unsteady_tensor(const int ircflp, 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 dijpf, 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:2439
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:4270
static void cs_i_cd_steady_upwind_tensor(const int ircflp, const cs_real_t relaxp, 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 dijpf, 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:1409
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:817
Definition: cs_mesh_quantities.h:82
cs_halo_type_t
Definition: cs_halo.h:50
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 iccocg, int nswrgp, int imligp, int ircflp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, double extrap, 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:9714
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:4510
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 iccocg, int nswrgp, int imligp, int ircflp, int iphydp, int iwarnp, double epsrgp, double climgp, double extrap, 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:10589
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_3_t i_face_normal, const cs_real_3_t gradi, const cs_real_3_t gradj, const cs_real_3_t grdpai, const cs_real_3_t grdpaj, const cs_real_t i_massflux, double *testij, double *tesqck)
Compute slope test criteria at internal face between cell i and j.
Definition: cs_convection_diffusion.h:105
Definition: cs_convection_diffusion.h:61
static void cs_b_compute_quantities_tensor(const cs_real_3_t diipb, const cs_real_63_t gradi, const int ircflp, cs_real_t recoi[6])
Reconstruct values in I' at boundary cell i.
Definition: cs_convection_diffusion.h:4244
static void cs_i_cd_unsteady_upwind_vector(const int ircflp, 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 dijpf, 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:1553
static void cs_slope_test_tensor(const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, const cs_real_63_t gradi, const cs_real_63_t gradj, const cs_real_63_t gradsti, const cs_real_63_t gradstj, 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:309
static void cs_slope_test_vector(const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_t distf, const cs_real_t srfan, const cs_real_3_t i_face_normal, const cs_real_33_t gradi, const cs_real_33_t gradj, const cs_real_33_t gradsti, const cs_real_33_t gradstj, 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:170
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:981
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:774
static void cs_b_cd_unsteady_tensor(const int ircflp, 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:4948
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 iccocg, int nswrgp, int imligp, int iphydp, int iwgrp, int iwarnp, double epsrgp, double climgp, double extrap, 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:9356
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:309
static void cs_b_diff_flux_coupling(const int idiffp, const cs_real_t pi, const cs_real_t pj, const cs_real_t b_visc, cs_real_t *fluxi)
Add diffusive flux to flux at an internal coupling face.
Definition: cs_convection_diffusion.h:4979
static void cs_i_cd_steady_slope_test_tensor(bool *upwind_switch, const int iconvp, const int ircflp, 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 dijpf, 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:3282
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:4618
Definition: cs_convection_diffusion.h:73
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:1245
static void cs_i_conv_flux_vector(const int iconvp, const cs_real_t thetap, const int imasac, const cs_real_3_t pi, const cs_real_3_t pj, const cs_real_3_t pifri, const cs_real_3_t pifrj, const cs_real_3_t pjfri, const cs_real_3_t pjfrj, 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:1025
static void cs_i_conv_flux_tensor(const int iconvp, const cs_real_t thetap, const int imasac, const cs_real_6_t pi, const cs_real_6_t pj, const cs_real_6_t pifri, const cs_real_6_t pifrj, const cs_real_6_t pjfri, const cs_real_6_t pjfrj, 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:1073
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:4665
static void cs_i_cd_steady_slope_test_vector_old(bool *upwind_switch, const int iconvp, const int ircflp, const int ischcp, const double relaxp, const double blencp, 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 dijpf, 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:2820
structure containing the variable calculation options.
Definition: cs_parameters.h:59
static void cs_i_cd_steady_slope_test_vector(bool *upwind_switch, const int iconvp, const int ircflp, 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 dijpf, 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:3049
static void cs_b_compute_quantities(const cs_real_3_t diipb, const cs_real_3_t gradi, const int ircflp, cs_real_t *recoi)
Reconstruct values in I' at boundary cell i.
Definition: cs_convection_diffusion.h:4198
static void cs_i_diff_flux_vector(const int idiffp, const cs_real_t thetap, const cs_real_3_t pip, const cs_real_3_t pjp, const cs_real_3_t pipr, const cs_real_3_t pjpr, 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:1145
static void cs_i_cd_steady(const int ircflp, 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 dijpf, 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, 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:1685
void itrgrv(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const ircflp, const cs_int_t *const iphydp, const cs_int_t *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:1159
Definition: cs_convection_diffusion.h:69
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:231
static void cs_i_cd_steady_slope_test(bool *upwind_switch, const int iconvp, const int ircflp, 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 dijpf, 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:2564
void itrmas(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const iphydp, const cs_int_t *const iwgrp, const cs_int_t *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:968
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 iccocg, int nswrgp, int imligp, int iphydp, int iwarnp, double epsrgp, double climgp, double extrap, 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:10182
#define END_C_DECLS
Definition: cs_defs.h:454
static void cs_i_cd_steady_upwind(const int ircflp, const cs_real_t relaxp, 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 dijpf, const cs_real_3_t gradi, const cs_real_3_t gradj, 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:1224
Definition: cs_convection_diffusion.h:66
Definition: cs_convection_diffusion.h:71
static void cs_i_compute_quantities(const int ircflp, const double pnd, 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 dijpf, 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' and J'.
Definition: cs_convection_diffusion.h:380
#define CS_PROCF(x, y)
Definition: cs_defs.h:467
static void cs_i_cd_unsteady_slope_test_vector(bool *upwind_switch, const int iconvp, const int ircflp, 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 dijpf, 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:3873
static void cs_i_cd_unsteady_upwind_tensor(const int ircflp, 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 dijpf, 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:1613
cs_real_t cs_real_33_t[3][3]
3x3 matrix of floating-point values
Definition: cs_defs.h:315
Definition: cs_convection_diffusion.h:70
Definition: cs_convection_diffusion.h:60
Definition: cs_convection_diffusion.h:63
void cs_convection_diffusion_scalar(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int icvflb, int inc, int iccocg, int imasac, cs_real_t *restrict pvar, const cs_real_t *restrict pvara, const cs_int_t 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:1978
static void cs_blend_f_val_tensor(const double blencp, const cs_real_6_t p, 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:949
cs_real_t cs_real_63_t[6][3]
Definition: cs_defs.h:321
static void cs_b_cd_unsteady_vector(const int ircflp, 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:4917
static void cs_i_cd_unsteady_upwind(const int ircflp, 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 dijpf, 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 *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:1494
static void cs_b_cd_steady_tensor(const int ircflp, 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:4849
void cs_max_limiter_building(int f_id, int inc, const cs_real_t rovsdt[])
Compute a coefficient for blending that ensures the positivity of the scalar.
Definition: cs_convection_diffusion.c:1827
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:702
void cs_convection_diffusion_thermal(int idtvar, int f_id, const cs_var_cal_opt_t var_cal_opt, int inc, int iccocg, 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:5580
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:4667
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:1394
Definition: cs_convection_diffusion.h:68
void itrmav(const cs_int_t *const f_id, const cs_int_t *const init, const cs_int_t *const inc, const cs_int_t *const imrgra, const cs_int_t *const iccocg, const cs_int_t *const nswrgp, const cs_int_t *const imligp, const cs_int_t *const ircflp, const cs_int_t *const iphydp, const cs_int_t *const iwgrp, const cs_int_t *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:1031
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:4295
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:908
Definition: cs_convection_diffusion.h:72
void cs_anisotropic_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_t i_visc[], const cs_real_t b_visc[], const cs_real_t secvif[], cs_real_6_t *restrict viscel, const cs_real_2_t weighf[], const cs_real_t weighb[], cs_real_3_t *restrict rhs)
Add the explicit part of the diffusion terms with a symmetric tensorial diffusivity for a transport e...
Definition: cs_convection_diffusion.c:8068